Files
Chamilo/web/assets/linkifyjs/linkify-react.min.js
2025-04-10 11:37:29 +02:00

1 line
2.0 KiB
JavaScript

"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,a:!1,b:!0,c:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}!function(e,t,n){var r=function(e,t){function n(n,r){for(var i=t.tokenize(n),o=[],s=0,a=0;a<i.length;a++){var p=i[a];if("nl"===p.type&&r.nl2br)o.push(e.createElement("br",{key:"linkified-"+ ++s}));else if(p.isLink&&r.check(p)){var c=r.resolve(p),f=c.formatted,l=c.formattedHref,u=c.tagName,h=c.className,y=c.target,d=c.attributes,k={key:"linkified-"+ ++s,href:l};if(h&&(k.className=h),y&&(k.target=y),d)for(var m in d)k[m]=d[m];o.push(e.createElement(u,k,f))}else o.push(p.toString())}return o}function r(t,o){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(0===e.Children.count(t.props.children))return t;var a=[];e.Children.forEach(t.props.children,function(t){"string"==typeof t?(s+=1,a.push.apply(a,n(t,o))):e.isValidElement(t)?"string"==typeof t.type&&i.contains(o.ignoreTags,t.type.toUpperCase())?a.push(t):a.push(r(t,o,++s)):a.push(t)});var p={key:"linkified-element-"+s};for(var c in t.props)p[c]=t.props[c];return e.cloneElement(t,p,a)}e="default"in e?e["default"]:e;var i=t.options,o=i.Options,s=function(t){function n(){return _classCallCheck(this,n),_possibleConstructorReturn(this,t.apply(this,arguments))}return _inherits(n,t),n.prototype.render=function(){var t={key:"linkified-element-0"};for(var n in this.props)"options"!==n&&"tagName"!==n&&(t[n]=this.props[n]);var i=new o(this.props.options),s=this.props.tagName||"span",a=e.createElement(s,t);return r(a,i,0)},n}(e.Component);return s}(t,n);e.Linkify=e.LinkifyReact=r}(window,React,linkify);