1var SwaggerUIApiKeyAuthFormPlugin=function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o(o.s=0)}([function(e,t,n){"use strict";function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.r(t);function l(){return(l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function u(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(e){f(t,e,n[e])})}return t}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(){return(j=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(A){return function(){function a(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),t=function(e,t){return!t||"object"!==s(t)&&"function"!=typeof t?y(e):t}(this,p(a).call(this,e));var n=e.name,r=(0,e.getConfigs)().configs.apiKeyAuthFormPlugin,o={},i={},u=!1;return r&&r.forms&&"object"===s(r.forms[n])&&(j(o,h,r.forms[n]),u=!0,Object.keys(o.fields).forEach(function(e){return i[e]=""})),t.state={config:o,showForm:u,values:i},t.setFieldValue=t.setFieldValue.bind(y(t)),t.handleSubmit=t.handleSubmit.bind(y(t)),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(a,A.Component),function(e,t,n){t&&r(e.prototype,t),n&&r(e,n)}(a,[{key:"getValue",value:function(){var e=this.props,t=e.name,n=e.authorized;return n&&n.getIn([t,"value"])}},{key:"setFieldValue",value:function(e){var t=e.target,n=t.name,r=t.value,o=t.type,i=t.checked;"checkbox"===o||"radio"===o?this.setState(function(e){return{values:u({},e.values,f({},n,i?r:""))}}):this.setState(function(e){return{values:u({},e.values,f({},n,r))}})}},{key:"handleSubmit",value:function(){var o=this;this.setState(function(e){return u({},e,{error:void 0})});var e=this.state.config;e.authCallback&&e.authCallback(this.state.values,function(e,t){if(e)o.setState({error:String(e)});else{var n=o.props,r=n.name;(0,n.preauthorizeApiKey)(r,t)}})}},{key:"render",value:function(){var m=this,e=this.props.getComponent,t=this.state,n=t.config,r=t.showForm,d=t.values,o=t.error;if(this.getValue()||!r)return null;var i=n.containerStyle,u=n.fields,a=n.submitBtnLabel,g=e("Input"),S=e("Row"),w=e("Col"),c=e("Button");return A.createElement("div",{className:"auth-container-api-key-form",style:i},function(e){for(var t=[],n=Object.keys(e),r=0;r<n.length;r++)t.push([n[r],e[n[r]]]);return t}(u).map(function(e){var t=O(e,2),n=t[0],r=t[1],o=r.label,i=void 0===o?"Label":o,u=r.type,a=void 0===u?"text":u,c=r.rowProps,l=void 0===c?{}:c,f=r.labelProps,s=void 0===f?{}:f,p=r.colProps,y=void 0===p?{}:p,h=r.inputProps,b=void 0===h?{}:h,v={};return"checkbox"===a||"radio"===a?v.checked=d[n]:v.value=d[n],A.createElement(S,j({key:n},l),A.createElement("label",s,i,":"),A.createElement(w,y,A.createElement(g,j({name:n,type:a},b,{onChange:m.setFieldValue}))))}),o&&A.createElement("div",{className:"errors",style:{backgroundColor:"#ffeeee",color:"red",margin:"1em"}},A.createElement("span",null,o)),A.createElement(S,null,A.createElement(c,{className:"btn modal-btn auth authorize",onClick:this.handleSubmit},a)))}}]),a}()}var h={containerStyle:{marginLeft:20},fields:{username:{type:"text",label:"Username"},password:{type:"password",label:"Password"}},submitBtnLabel:"Get Key with Credentials"};function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}
1(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return"SwUI_apiKeyAuth_".concat(e,"_").concat(window.location.host).concat(window.location.pathname)}function a(l,e){(function(e){for(var t=[],n=Object.keys(e),r=0;r<n.length;r++)t.push([n[r],e[n[r]]]);return t})(e).forEach(function(e){var t=b(e,2),n=t[0],r=t[1],o=(void 0===r?{}:r).key,i=void 0===o?m(n):o,u=localStorage.getItem(i);if(u){var a=JSON.parse(u),c=a.value;a.expiredAt<Date.now()?localStorage.removeItem(i):l(n,c)}})}t.default=function(e){var t=e.React;return{afterLoad:function(e){var t=e.getConfigs().apiKeyAuthFormPlugin,n=t&&t.localStorage||{};this.rootInjects.saveApiKeyAuth=function(e,t,n){if("object"===v(e[t])){var r=e[t],o=r.key,i=void 0===o?m(t):o,u=r.ttl,a=void 0===u?3600:u;localStorage.setItem(i,JSON.stringify({value:n,expiredAt:Date.now()+1e3*a}))}}.bind(null,n),this.rootInjects.forgetApiKeyAuth=function(e,t){if("object"===v(e[t])){var n=e[t].key,r=void 0===n?m(t):n;localStorage.removeItem(r)}}.bind(null,n),this.rootInjects.loadSavedApiKeyAuths=a.bind(null,this.rootInjects.preauthorizeApiKey,n),this.rootInjects.preauthorizeApiKey=function(e,t,n,r){t(n,r),e(n,r)}.bind(null,this.rootInjects.preauthorizeApiKey,this.rootInjects.saveApiKeyAuth)},statePlugins:{auth:{wrapActions:{authorize:function(t,r){return function(e){(function(e){for(var t=[],n=Object.keys(e),r=0;r<n.length;r++)t.push(e[n[r]]);return t})(e).forEach(function(e){var t=e.name,n=e.value;r.saveApiKeyAuth(t,n)}),t(e)}},logout:function(t,n){return function(e){e.forEach(function(e){return n.forgetApiKeyAuth(e)}),t(e)}}}},spec:{wrapActions:{updateJsonSpec:function(t,n){return function(e){t(e),n.loadSavedApiKeyAuths()}}}}},components:{apiKeyAuthForm:i(t)},wrapComponents:{apiKeyAuth:function(a){return function(i,u){return function(e){var t=e.getComponent,n=u.getConfigs,r=u.preauthorizeApiKey,o=t("apiKeyAuthForm");return a.createElement("div",null,a.createElement(i,e),a.createElement(o,c({getConfigs:n,preauthorizeApiKey:r},e)))}}}(t),HttpAuth:function(c){return function(u,a){return function(e){var t=e.getComponent,n=a.getConfigs,r=a.preauthorizeApiKey,o=t("apiKeyAuthForm"),i=(e.schema.get("scheme")||"").toLowerCase();return c.createElement("div",null,c.createElement(u,e),"bearer"===i&&c.createElement(o,l({getConfigs:n,preauthorizeApiKey:r},e)))}}}(t)}}}}]).default; 2//# sourceMappingURL=swagger-ui-apikey-auth-form.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.