UNPKG

verdaccio-doreamon-oauth2

Version:

A GitLab OAuth Plugin for [Verdaccio](https://www.verdaccio.org)

2 lines (1 loc) 20.1 kB
!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t,e){return t(e={exports:{}},e.exports),e.exports}var n=function(t){return t&&t.Math==Math&&t},r=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||Function("return this")(),o=function(t){try{return!!t()}catch(t){return!0}},i=!o((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),u={}.propertyIsEnumerable,c=Object.getOwnPropertyDescriptor,a={f:c&&!u.call({1:2},1)?function(t){var e=c(this,t);return!!e&&e.enumerable}:u},l=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},f={}.toString,s=function(t){return f.call(t).slice(8,-1)},p="".split,d=o((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==s(t)?p.call(t,""):Object(t)}:Object,h=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},g=function(t){return d(h(t))},v=function(t){return"object"==typeof t?null!==t:"function"==typeof t},y=function(t,e){if(!v(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!v(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!v(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!v(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},m={}.hasOwnProperty,S=function(t,e){return m.call(t,e)},x=r.document,b=v(x)&&v(x.createElement),E=function(t){return b?x.createElement(t):{}},O=!i&&!o((function(){return 7!=Object.defineProperty(E("div"),"a",{get:function(){return 7}}).a})),w=Object.getOwnPropertyDescriptor,T={f:i?w:function(t,e){if(t=g(t),e=y(e,!0),O)try{return w(t,e)}catch(t){}if(S(t,e))return l(!a.f.call(t,e),t[e])}},I=function(t){if(!v(t))throw TypeError(String(t)+" is not an object");return t},j=Object.defineProperty,A={f:i?j:function(t,e,n){if(I(t),e=y(e,!0),I(n),O)try{return j(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},C=i?function(t,e,n){return A.f(t,e,l(1,n))}:function(t,e,n){return t[e]=n,t},R=function(t,e){try{C(r,t,e)}catch(n){r[t]=e}return e},L=r["__core-js_shared__"]||R("__core-js_shared__",{}),P=Function.toString;"function"!=typeof L.inspectSource&&(L.inspectSource=function(t){return P.call(t)});var k,M,_,D=L.inspectSource,N=r.WeakMap,U="function"==typeof N&&/native code/.test(D(N)),F=e((function(t){(t.exports=function(t,e){return L[t]||(L[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),B=0,G=Math.random(),V=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++B+G).toString(36)},q=F("keys"),$=function(t){return q[t]||(q[t]=V(t))},z={},H=r.WeakMap;if(U){var K=new H,W=K.get,Y=K.has,X=K.set;k=function(t,e){return X.call(K,t,e),e},M=function(t){return W.call(K,t)||{}},_=function(t){return Y.call(K,t)}}else{var J=$("state");z[J]=!0,k=function(t,e){return C(t,J,e),e},M=function(t){return S(t,J)?t[J]:{}},_=function(t){return S(t,J)}}var Q={set:k,get:M,has:_,enforce:function(t){return _(t)?M(t):k(t,{})},getterFor:function(t){return function(e){var n;if(!v(e)||(n=M(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}},Z=e((function(t){var e=Q.get,n=Q.enforce,o=String(String).split("String");(t.exports=function(t,e,i,u){var c=!!u&&!!u.unsafe,a=!!u&&!!u.enumerable,l=!!u&&!!u.noTargetGet;"function"==typeof i&&("string"!=typeof e||S(i,"name")||C(i,"name",e),n(i).source=o.join("string"==typeof e?e:"")),t!==r?(c?!l&&t[e]&&(a=!0):delete t[e],a?t[e]=i:C(t,e,i)):a?t[e]=i:R(e,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||D(this)}))})),tt=r,et=function(t){return"function"==typeof t?t:void 0},nt=function(t,e){return arguments.length<2?et(tt[t])||et(r[t]):tt[t]&&tt[t][e]||r[t]&&r[t][e]},rt=Math.ceil,ot=Math.floor,it=function(t){return isNaN(t=+t)?0:(t>0?ot:rt)(t)},ut=Math.min,ct=function(t){return t>0?ut(it(t),9007199254740991):0},at=Math.max,lt=Math.min,ft=function(t){return function(e,n,r){var o,i=g(e),u=ct(i.length),c=function(t,e){var n=it(t);return n<0?at(n+e,0):lt(n,e)}(r,u);if(t&&n!=n){for(;u>c;)if((o=i[c++])!=o)return!0}else for(;u>c;c++)if((t||c in i)&&i[c]===n)return t||c||0;return!t&&-1}},st={includes:ft(!0),indexOf:ft(!1)},pt=st.indexOf,dt=function(t,e){var n,r=g(t),o=0,i=[];for(n in r)!S(z,n)&&S(r,n)&&i.push(n);for(;e.length>o;)S(r,n=e[o++])&&(~pt(i,n)||i.push(n));return i},ht=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],gt=ht.concat("length","prototype"),vt={f:Object.getOwnPropertyNames||function(t){return dt(t,gt)}},yt={f:Object.getOwnPropertySymbols},mt=nt("Reflect","ownKeys")||function(t){var e=vt.f(I(t)),n=yt.f;return n?e.concat(n(t)):e},St=function(t,e){for(var n=mt(e),r=A.f,o=T.f,i=0;i<n.length;i++){var u=n[i];S(t,u)||r(t,u,o(e,u))}},xt=/#|\.prototype\./,bt=function(t,e){var n=Ot[Et(t)];return n==Tt||n!=wt&&("function"==typeof e?o(e):!!e)},Et=bt.normalize=function(t){return String(t).replace(xt,".").toLowerCase()},Ot=bt.data={},wt=bt.NATIVE="N",Tt=bt.POLYFILL="P",It=bt,jt=T.f,At=function(t,e){var n,o,i,u,c,a=t.target,l=t.global,f=t.stat;if(n=l?r:f?r[a]||R(a,{}):(r[a]||{}).prototype)for(o in e){if(u=e[o],i=t.noTargetGet?(c=jt(n,o))&&c.value:n[o],!It(l?o:a+(f?".":"#")+o,t.forced)&&void 0!==i){if(typeof u==typeof i)continue;St(u,i)}(t.sham||i&&i.sham)&&C(u,"sham",!0),Z(n,o,u,t)}},Ct=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t},Rt=function(t){return Object(h(t))},Lt=Array.isArray||function(t){return"Array"==s(t)},Pt=!!Object.getOwnPropertySymbols&&!o((function(){return!String(Symbol())})),kt=Pt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Mt=F("wks"),_t=r.Symbol,Dt=kt?_t:_t&&_t.withoutSetter||V,Nt=function(t){return S(Mt,t)||(Pt&&S(_t,t)?Mt[t]=_t[t]:Mt[t]=Dt("Symbol."+t)),Mt[t]},Ut=Nt("species"),Ft=function(t,e){var n;return Lt(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!Lt(n.prototype)?v(n)&&null===(n=n[Ut])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)},Bt=[].push,Gt=function(t){var e=1==t,n=2==t,r=3==t,o=4==t,i=6==t,u=5==t||i;return function(c,a,l,f){for(var s,p,h=Rt(c),g=d(h),v=function(t,e,n){if(Ct(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}(a,l,3),y=ct(g.length),m=0,S=f||Ft,x=e?S(c,y):n?S(c,0):void 0;y>m;m++)if((u||m in g)&&(p=v(s=g[m],m,h),t))if(e)x[m]=p;else if(p)switch(t){case 3:return!0;case 5:return s;case 6:return m;case 2:Bt.call(x,s)}else if(o)return!1;return i?-1:r||o?o:x}},Vt={forEach:Gt(0),map:Gt(1),filter:Gt(2),some:Gt(3),every:Gt(4),find:Gt(5),findIndex:Gt(6)},qt=function(t,e){var n=[][t];return!!n&&o((function(){n.call(null,e||function(){throw 1},1)}))},$t=Object.defineProperty,zt={},Ht=function(t){throw t},Kt=function(t,e){if(S(zt,t))return zt[t];e||(e={});var n=[][t],r=!!S(e,"ACCESSORS")&&e.ACCESSORS,u=S(e,0)?e[0]:Ht,c=S(e,1)?e[1]:void 0;return zt[t]=!!n&&!o((function(){if(r&&!i)return!0;var t={length:-1};r?$t(t,1,{enumerable:!0,get:Ht}):t[1]=1,n.call(t,u,c)}))},Wt=Vt.forEach,Yt=qt("forEach"),Xt=Kt("forEach"),Jt=Yt&&Xt?[].forEach:function(t){return Wt(this,t,arguments.length>1?arguments[1]:void 0)};At({target:"Array",proto:!0,forced:[].forEach!=Jt},{forEach:Jt});var Qt,Zt=Object.keys||function(t){return dt(t,ht)},te=i?Object.defineProperties:function(t,e){I(t);for(var n,r=Zt(e),o=r.length,i=0;o>i;)A.f(t,n=r[i++],e[n]);return t},ee=nt("document","documentElement"),ne=$("IE_PROTO"),re=function(){},oe=function(t){return"<script>"+t+"<\/script>"},ie=function(){try{Qt=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;ie=Qt?function(t){t.write(oe("")),t.close();var e=t.parentWindow.Object;return t=null,e}(Qt):((e=E("iframe")).style.display="none",ee.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(oe("document.F=Object")),t.close(),t.F);for(var n=ht.length;n--;)delete ie.prototype[ht[n]];return ie()};z[ne]=!0;var ue=Object.create||function(t,e){var n;return null!==t?(re.prototype=I(t),n=new re,re.prototype=null,n[ne]=t):n=ie(),void 0===e?n:te(n,e)},ce=Nt("unscopables"),ae=Array.prototype;null==ae[ce]&&A.f(ae,ce,{configurable:!0,value:ue(null)});var le,fe=st.includes;At({target:"Array",proto:!0,forced:!Kt("indexOf",{ACCESSORS:!0,1:0})},{includes:function(t){return fe(this,t,arguments.length>1?arguments[1]:void 0)}}),le="includes",ae[ce][le]=!0;var se=Nt("match"),pe=function(t){var e;return v(t)&&(void 0!==(e=t[se])?!!e:"RegExp"==s(t))},de=function(t){if(pe(t))throw TypeError("The method doesn't accept regular expressions");return t},he=Nt("match");At({target:"String",proto:!0,forced:!function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[he]=!1,"/./"[t](e)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~String(h(this)).indexOf(de(t),arguments.length>1?arguments[1]:void 0)}});for(var ge in{CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}){var ve=r[ge],ye=ve&&ve.prototype;if(ye&&ye.forEach!==Jt)try{C(ye,"forEach",Jt)}catch(t){ye.forEach=Jt}}var me,Se,xe=function(t,e,n){var r=y(e);r in t?A.f(t,r,l(0,n)):t[r]=n},be=nt("navigator","userAgent")||"",Ee=r.process,Oe=Ee&&Ee.versions,we=Oe&&Oe.v8;we?Se=(me=we.split("."))[0]+me[1]:be&&(!(me=be.match(/Edge\/(\d+)/))||me[1]>=74)&&(me=be.match(/Chrome\/(\d+)/))&&(Se=me[1]);var Te=Se&&+Se,Ie=Nt("species"),je=function(t){return Te>=51||!o((function(){var e=[];return(e.constructor={})[Ie]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},Ae=Nt("isConcatSpreadable"),Ce=Te>=51||!o((function(){var t=[];return t[Ae]=!1,t.concat()[0]!==t})),Re=je("concat"),Le=function(t){if(!v(t))return!1;var e=t[Ae];return void 0!==e?!!e:Lt(t)};At({target:"Array",proto:!0,forced:!Ce||!Re},{concat:function(t){var e,n,r,o,i,u=Rt(this),c=Ft(u,0),a=0;for(e=-1,r=arguments.length;e<r;e++)if(Le(i=-1===e?u:arguments[e])){if(a+(o=ct(i.length))>9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n<o;n++,a++)n in i&&xe(c,a,i[n])}else{if(a>=9007199254740991)throw TypeError("Maximum allowed index exceeded");xe(c,a++,i)}return c.length=a,c}});var Pe=st.indexOf,ke=[].indexOf,Me=!!ke&&1/[1].indexOf(1,-0)<0,_e=qt("indexOf"),De=Kt("indexOf",{ACCESSORS:!0,1:0});At({target:"Array",proto:!0,forced:Me||!_e||!De},{indexOf:function(t){return Me?ke.apply(this,arguments)||0:Pe(this,t,arguments.length>1?arguments[1]:void 0)}});var Ne=[].join,Ue=d!=Object,Fe=qt("join",",");At({target:"Array",proto:!0,forced:Ue||!Fe},{join:function(t){return Ne.call(g(this),void 0===t?",":t)}});var Be=Vt.filter,Ge=je("filter"),Ve=Kt("filter");At({target:"Array",proto:!0,forced:!Ge||!Ve},{filter:function(t){return Be(this,t,arguments.length>1?arguments[1]:void 0)}});var qe=Vt.map,$e=je("map"),ze=Kt("map");At({target:"Array",proto:!0,forced:!$e||!ze},{map:function(t){return qe(this,t,arguments.length>1?arguments[1]:void 0)}});var He=function(t){return function(e,n,r,o){Ct(n);var i=Rt(e),u=d(i),c=ct(i.length),a=t?c-1:0,l=t?-1:1;if(r<2)for(;;){if(a in u){o=u[a],a+=l;break}if(a+=l,t?a<0:c<=a)throw TypeError("Reduce of empty array with no initial value")}for(;t?a>=0:c>a;a+=l)a in u&&(o=n(o,u[a],a,i));return o}},Ke={left:He(!1),right:He(!0)}.left,We=qt("reduce"),Ye=Kt("reduce",{1:0});At({target:"Array",proto:!0,forced:!We||!Ye},{reduce:function(t){return Ke(this,t,arguments.length,arguments.length>1?arguments[1]:void 0)}});var Xe=function(){var t=I(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e};function Je(t,e){return RegExp(t,e)}var Qe,Ze,tn={UNSUPPORTED_Y:o((function(){var t=Je("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),BROKEN_CARET:o((function(){var t=Je("^r","gy");return t.lastIndex=2,null!=t.exec("str")}))},en=RegExp.prototype.exec,nn=String.prototype.replace,rn=en,on=(Qe=/a/,Ze=/b*/g,en.call(Qe,"a"),en.call(Ze,"a"),0!==Qe.lastIndex||0!==Ze.lastIndex),un=tn.UNSUPPORTED_Y||tn.BROKEN_CARET,cn=void 0!==/()??/.exec("")[1];(on||cn||un)&&(rn=function(t){var e,n,r,o,i=this,u=un&&i.sticky,c=Xe.call(i),a=i.source,l=0,f=t;return u&&(-1===(c=c.replace("y","")).indexOf("g")&&(c+="g"),f=String(t).slice(i.lastIndex),i.lastIndex>0&&(!i.multiline||i.multiline&&"\n"!==t[i.lastIndex-1])&&(a="(?: "+a+")",f=" "+f,l++),n=new RegExp("^(?:"+a+")",c)),cn&&(n=new RegExp("^"+a+"$(?!\\s)",c)),on&&(e=i.lastIndex),r=en.call(u?n:i,f),u?r?(r.input=r.input.slice(l),r[0]=r[0].slice(l),r.index=i.lastIndex,i.lastIndex+=r[0].length):i.lastIndex=0:on&&r&&(i.lastIndex=i.global?r.index+r[0].length:e),cn&&r&&r.length>1&&nn.call(r[0],n,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(r[o]=void 0)})),r});var an=rn;At({target:"RegExp",proto:!0,forced:/./.exec!==an},{exec:an});var ln=Nt("species"),fn=!o((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),sn="$0"==="a".replace(/./,"$0"),pn=Nt("replace"),dn=!!/./[pn]&&""===/./[pn]("a","$0"),hn=!o((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),gn=function(t,e,n,r){var i=Nt(t),u=!o((function(){var e={};return e[i]=function(){return 7},7!=""[t](e)})),c=u&&!o((function(){var e=!1,n=/a/;return"split"===t&&((n={}).constructor={},n.constructor[ln]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return e=!0,null},n[i](""),!e}));if(!u||!c||"replace"===t&&(!fn||!sn||dn)||"split"===t&&!hn){var a=/./[i],l=n(i,""[t],(function(t,e,n,r,o){return e.exec===an?u&&!o?{done:!0,value:a.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),{REPLACE_KEEPS_$0:sn,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:dn}),f=l[0],s=l[1];Z(String.prototype,t,f),Z(RegExp.prototype,i,2==e?function(t,e){return s.call(t,this,e)}:function(t){return s.call(t,this)})}r&&C(RegExp.prototype[i],"sham",!0)},vn=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e},yn=function(t,e){var n=t.exec;if("function"==typeof n){var r=n.call(t,e);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==s(t))throw TypeError("RegExp#exec called on incompatible receiver");return an.call(t,e)};gn("search",1,(function(t,e,n){return[function(e){var n=h(this),r=null==e?void 0:e[t];return void 0!==r?r.call(e,n):new RegExp(e)[t](String(n))},function(t){var r=n(e,t,this);if(r.done)return r.value;var o=I(t),i=String(this),u=o.lastIndex;vn(u,0)||(o.lastIndex=0);var c=yn(o,i);return vn(o.lastIndex,u)||(o.lastIndex=u),null===c?-1:c.index}]}));var mn=Nt("species"),Sn=function(t){return function(e,n){var r,o,i=String(h(e)),u=it(n),c=i.length;return u<0||u>=c?t?"":void 0:(r=i.charCodeAt(u))<55296||r>56319||u+1===c||(o=i.charCodeAt(u+1))<56320||o>57343?t?i.charAt(u):r:t?i.slice(u,u+2):o-56320+(r-55296<<10)+65536}},xn={codeAt:Sn(!1),charAt:Sn(!0)}.charAt,bn=function(t,e,n){return e+(n?xn(t,e).length:1)},En=[].push,On=Math.min,wn=!o((function(){return!RegExp(4294967295,"y")}));gn("split",2,(function(t,e,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,n){var r=String(h(this)),o=void 0===n?4294967295:n>>>0;if(0===o)return[];if(void 0===t)return[r];if(!pe(t))return e.call(r,t,o);for(var i,u,c,a=[],l=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),f=0,s=new RegExp(t.source,l+"g");(i=an.call(s,r))&&!((u=s.lastIndex)>f&&(a.push(r.slice(f,i.index)),i.length>1&&i.index<r.length&&En.apply(a,i.slice(1)),c=i[0].length,f=u,a.length>=o));)s.lastIndex===i.index&&s.lastIndex++;return f===r.length?!c&&s.test("")||a.push(""):a.push(r.slice(f)),a.length>o?a.slice(0,o):a}:"0".split(void 0,0).length?function(t,n){return void 0===t&&0===n?[]:e.call(this,t,n)}:e,[function(e,n){var o=h(this),i=null==e?void 0:e[t];return void 0!==i?i.call(e,o,n):r.call(String(o),e,n)},function(t,o){var i=n(r,t,this,o,r!==e);if(i.done)return i.value;var u=I(t),c=String(this),a=function(t,e){var n,r=I(t).constructor;return void 0===r||null==(n=I(r)[mn])?e:Ct(n)}(u,RegExp),l=u.unicode,f=(u.ignoreCase?"i":"")+(u.multiline?"m":"")+(u.unicode?"u":"")+(wn?"y":"g"),s=new a(wn?u:"^(?:"+u.source+")",f),p=void 0===o?4294967295:o>>>0;if(0===p)return[];if(0===c.length)return null===yn(s,c)?[c]:[];for(var d=0,h=0,g=[];h<c.length;){s.lastIndex=wn?h:0;var v,y=yn(s,wn?c:c.slice(h));if(null===y||(v=On(ct(s.lastIndex+(wn?0:h)),c.length))===d)h=bn(c,h,l);else{if(g.push(c.slice(d,h)),g.length===p)return g;for(var m=1;m<=y.length-1;m++)if(g.push(y[m]),g.length===p)return g;h=d=v}}return g.push(c.slice(d)),g}]}),!wn);function Tn(t,e){document.addEventListener("click",(function(n){(function(t,e){var n=e.path||e.composedPath&&e.composedPath(),r=document.querySelector(t);return n.indexOf(r)>=0})(t,n)&&(n.preventDefault(),n.stopPropagation(),e())}),!0)}function In(){return!!localStorage.getItem("username")&&!!localStorage.getItem("token")&&!!localStorage.getItem("npm")}function jn(){if(!In()){var t=(location.search||"?").substring(1).split("&").filter((function(t){return t})).map((function(t){return t.split("=").concat(["true"])})).reduce((function(t,e){return t[e[0]]=decodeURIComponent(e[1]),t}),{});(function(t){return t.username&&t.jwtToken&&t.npmToken})(t)&&(!function(t){localStorage.setItem("username",t.username),localStorage.setItem("token",t.jwtToken),localStorage.setItem("npm",t.npmToken)}(t),history.replaceState(null,"",location.pathname),location.reload())}}function An(t){for(var e=0;e<10;e++)setTimeout((function(){return t()}),100*e)}function Cn(){var t=function(){if(!localStorage.getItem("username"))return"Click the login button to authenticate with Doreamon.";var t="//"+location.host+"/",e=localStorage.getItem("npm");return["npm config set ".concat(t,':_authToken "').concat(e,'"')].join("\n")}(),e=In();document.querySelectorAll(".doreamon-oauth2").forEach((function(n){var r=n,o=r.parentElement.querySelector("button");r.innerText=t,o.style.visibility=e?"visible":"hidden",o.onclick=function(e){e.preventDefault(),e.stopPropagation(),function(t){var e=document.createElement("div");e.innerText=t,document.body.appendChild(e);var n=document.createRange(),r=window.getSelection();n.selectNodeContents(e),r.removeAllRanges(),r.addRange(n),document.execCommand("copy"),document.body.removeChild(e)}(t)}}))}!function(t){jn();var e=t.loginButton,n=t.logoutButton,r=t.updateUsageInfo;Tn(e,(function(){location.href="/-/oauth/authorize"})),Tn(n,(function(){localStorage.removeItem("username"),localStorage.removeItem("token"),localStorage.removeItem("npm"),location.href="/"})),document.addEventListener("click",(function(){return An(r)})),An(r)}({loginButton:"#header--button-login, [data-testid='header--button-login']",logoutButton:"#header--button-logout, [data-testid='header--button-logout']",updateUsageInfo:function(){document.querySelectorAll("#help-card .MuiCardContent-root span, .MuiDialogContent-root .MuiTypography-root span").forEach((function(t){var e=t;e.innerText.includes("adduser")&&e.classList.add("doreamon-oauth2")})),Cn()}})}));