"use strict";function a(b){"@babel/helpers - typeof";return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},a(b)}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var b=l(require("react")),c=j(require("prop-types")),d=require("carbon-components-react"),e=j(require("classnames")),f=require("../utils/common"),g=j(require("./Markdown")),h=j(require("lodash/isEqual")),i=require("../utils/translate");function j(a){return a&&a.__esModule?a:{default:a}}function k(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(k=function(a){return a?c:b})(a)}function l(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!==a(b)&&"function"!=typeof b)return{default:b};var d=k(c);if(d&&d.has(b))return d.get(b);var e={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var g in b)if("default"!=g&&Object.prototype.hasOwnProperty.call(b,g)){var h=f?Object.getOwnPropertyDescriptor(b,g):null;h&&(h.get||h.set)?Object.defineProperty(e,g,h):e[g]=b[g]}return e["default"]=b,d&&d.set(b,e),e}function m(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function n(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function o(a,b,c){return b&&n(a.prototype,b),c&&n(a,c),a}function p(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&q(a,b)}function q(a,b){return q=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},q(a,b)}function r(a){var b=u();return function(){var c,d=v(a);if(b){var e=v(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return s(this,c)}}function s(b,c){if(c&&("object"===a(c)||"function"==typeof c))return c;if(void 0!==c)throw new TypeError("Derived constructors may only return object or undefined");return t(b)}function t(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function v(a){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},v(a)}var w=function(a){function c(a){var b;return m(this,c),b=j.call(this,a),b.state={tag:""},b}p(c,a);var j=r(c);return o(c,[{key:"componentDidUpdate",value:function componentDidUpdate(a){(0,h["default"])(a,this.props)||this.setState(this.configureTag(this.props))}},{key:"configureTag",value:function configureTag(a){return{tag:a.tag}}},{key:"render",value:function render(){var a,c=this.props,h=c.tag,j=c.apiTags,k=c.markupType;return a=h in j.tags&&("description"in j.tags[h]||"externalDocs"in j.tags[h])?b["default"].createElement("div",{className:(0,e["default"])("bx--tag",(0,f.generateRandomTag)(h)),"data-floating-menu-container":!0,style:{position:"relative",float:"right"}},b["default"].createElement(d.TooltipDefinition,{triggerClassName:(0,f.generateRandomTag)(h),tooltipText:function tooltiptext(a,c,f){return b["default"].createElement("div",null,c.tags[a].description&&b["default"].createElement(g["default"],{className:"tagDescription",data:(0,i.getTranslatedExtensions)(c.tags[a],"description"),markupType:f}),c.tags[a].externalDocs&&c.tags[a].externalDocs.description&&b["default"].createElement("div",{className:(0,e["default"])("tagtip","bx--tooltip__footer")},b["default"].createElement(d.Link,{href:c.tags[a].externalDocs.url,target:"_blank",rel:"noopener noreferrer"},c.tags[a].externalDocs.description+": ",c.tags[a].externalDocs.url)))}(h,j,k),tabIndex:0,direction:"bottom",align:"end"},h)):b["default"].createElement("span",{className:(0,e["default"])("bx--tag",(0,f.generateRandomTag)(h)),style:{position:"relative",float:"right"}},h),a}}]),c}(b.Component);exports["default"]=w,w.propTypes={tag:c["default"].string,apiTags:c["default"].object,markupType:c["default"].string};