Socket
Socket
Sign inDemoInstall

autolinker

Package Overview
Dependencies
Maintainers
2
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autolinker - npm Package Compare versions

Comparing version 3.16.2 to 4.0.0

dist/commonjs/match/abstract-match.d.ts

18

dist/autolinker.min.js
/*!
* Autolinker.js
* v3.16.2
* v4.0.0
*

@@ -10,3 +10,17 @@ * Copyright(c) 2022 Gregory Jacobs <greg@greg-jacobs.com>

*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Autolinker=e()}(this,(function(){"use strict";function t(t,e){if(Array.prototype.indexOf)return t.indexOf(e);for(var u=0,n=t.length;u<n;u++)if(t[u]===e)return u;return-1}function e(t,e){for(var u=t.length-1;u>=0;u--)!0===e(t[u])&&t.splice(u,1)}function u(t){throw new Error("Unhandled case for value: '".concat(t,"'"))}var n=function(){function e(t){void 0===t&&(t={}),this.tagName="",this.attrs={},this.innerHTML="",this.whitespaceRegex=/\s+/,this.tagName=t.tagName||"",this.attrs=t.attrs||{},this.innerHTML=t.innerHtml||t.innerHTML||""}return e.prototype.setTagName=function(t){return this.tagName=t,this},e.prototype.getTagName=function(){return this.tagName||""},e.prototype.setAttr=function(t,e){return this.getAttrs()[t]=e,this},e.prototype.getAttr=function(t){return this.getAttrs()[t]},e.prototype.setAttrs=function(t){return Object.assign(this.getAttrs(),t),this},e.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},e.prototype.setClass=function(t){return this.setAttr("class",t)},e.prototype.addClass=function(e){for(var u,n=this.getClass(),r=this.whitespaceRegex,a=n?n.split(r):[],i=e.split(r);u=i.shift();)-1===t(a,u)&&a.push(u);return this.getAttrs().class=a.join(" "),this},e.prototype.removeClass=function(e){for(var u,n=this.getClass(),r=this.whitespaceRegex,a=n?n.split(r):[],i=e.split(r);a.length&&(u=i.shift());){var s=t(a,u);-1!==s&&a.splice(s,1)}return this.getAttrs().class=a.join(" "),this},e.prototype.getClass=function(){return this.getAttrs().class||""},e.prototype.hasClass=function(t){return-1!==(" "+this.getClass()+" ").indexOf(" "+t+" ")},e.prototype.setInnerHTML=function(t){return this.innerHTML=t,this},e.prototype.setInnerHtml=function(t){return this.setInnerHTML(t)},e.prototype.getInnerHTML=function(){return this.innerHTML||""},e.prototype.getInnerHtml=function(){return this.getInnerHTML()},e.prototype.toAnchorString=function(){var t=this.getTagName(),e=this.buildAttrsStr();return["<",t,e=e?" "+e:"",">",this.getInnerHtml(),"</",t,">"].join("")},e.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var t=this.getAttrs(),e=[];for(var u in t)t.hasOwnProperty(u)&&e.push(u+'="'+t[u]+'"');return e.join(" ")},e}();var r=function(){function t(t){void 0===t&&(t={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=t.newWindow||!1,this.truncate=t.truncate||{},this.className=t.className||""}return t.prototype.build=function(t){return new n({tagName:"a",attrs:this.createAttrs(t),innerHtml:this.processAnchorText(t.getAnchorText())})},t.prototype.createAttrs=function(t){var e={href:t.getAnchorHref()},u=this.createCssClass(t);return u&&(e.class=u),this.newWindow&&(e.target="_blank",e.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<t.getAnchorText().length&&(e.title=t.getAnchorHref()),e},t.prototype.createCssClass=function(t){var e=this.className;if(e){for(var u=[e],n=t.getCssClassSuffixes(),r=0,a=n.length;r<a;r++)u.push(e+"-"+n[r]);return u.join(" ")}return""},t.prototype.processAnchorText=function(t){return t=this.doTruncate(t)},t.prototype.doTruncate=function(t){var e=this.truncate;if(!e||!e.length)return t;var u=e.length,n=e.location;return"smart"===n?function(t,e,u){var n,r;null==u?(u="&hellip;",r=3,n=8):(r=u.length,n=u.length);var a=function(t){var e="";return t.scheme&&t.host&&(e+=t.scheme+"://"),t.host&&(e+=t.host),t.path&&(e+="/"+t.path),t.query&&(e+="?"+t.query),t.fragment&&(e+="#"+t.fragment),e},i=function(t,e){var n=e/2,r=Math.ceil(n),a=-1*Math.floor(n),i="";return a<0&&(i=t.substr(a)),t.substr(0,r)+u+i};if(t.length<=e)return t;var s=e-r,o=function(t){var e={},u=t,n=u.match(/^([a-z]+):\/\//i);return n&&(e.scheme=n[1],u=u.substr(n[0].length)),(n=u.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(e.host=n[1],u=u.substr(n[0].length)),(n=u.match(/^\/(.*?)(?=(\?|#|$))/i))&&(e.path=n[1],u=u.substr(n[0].length)),(n=u.match(/^\?(.*?)(?=(#|$))/i))&&(e.query=n[1],u=u.substr(n[0].length)),(n=u.match(/^#(.*?)$/i))&&(e.fragment=n[1]),e}(t);if(o.query){var c=o.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);c&&(o.query=o.query.substr(0,c[1].length),t=a(o))}if(t.length<=e)return t;if(o.host&&(o.host=o.host.replace(/^www\./,""),t=a(o)),t.length<=e)return t;var h="";if(o.host&&(h+=o.host),h.length>=s)return o.host.length==e?(o.host.substr(0,e-r)+u).substr(0,s+n):i(h,s).substr(0,s+n);var l="";if(o.path&&(l+="/"+o.path),o.query&&(l+="?"+o.query),l){if((h+l).length>=s)return(h+l).length==e?(h+l).substr(0,e):(h+i(l,s-h.length)).substr(0,s+n);h+=l}if(o.fragment){var p="#"+o.fragment;if((h+p).length>=s)return(h+p).length==e?(h+p).substr(0,e):(h+i(p,s-h.length)).substr(0,s+n);h+=p}if(o.scheme&&o.host){var g=o.scheme+"://";if((h+g).length<s)return(g+h).substr(0,e)}if(h.length<=e)return h;var f="";return s>0&&(f=h.substr(-1*Math.floor(s/2))),(h.substr(0,Math.ceil(s/2))+u+f).substr(0,s+n)}(t,u):"middle"===n?function(t,e,u){if(t.length<=e)return t;var n,r;null==u?(u="&hellip;",n=8,r=3):(n=u.length,r=u.length);var a=e-r,i="";return a>0&&(i=t.substr(-1*Math.floor(a/2))),(t.substr(0,Math.ceil(a/2))+u+i).substr(0,a+n)}(t,u):function(t,e,u){return function(t,e,u){var n;return t.length>e&&(null==u?(u="&hellip;",n=3):n=u.length,t=t.substring(0,e-n)+u),t}(t,e,u)}(t,u)},t}(),a=function(){function t(t){this.__jsduckDummyDocProp=null,this.matchedText="",this.offset=0,this.tagBuilder=t.tagBuilder,this.matchedText=t.matchedText,this.offset=t.offset}return t.prototype.getMatchedText=function(){return this.matchedText},t.prototype.setOffset=function(t){this.offset=t},t.prototype.getOffset=function(){return this.offset},t.prototype.getCssClassSuffixes=function(){return[this.getType()]},t.prototype.buildTag=function(){return this.tagBuilder.build(this)},t}(),i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var u in e)Object.prototype.hasOwnProperty.call(e,u)&&(t[u]=e[u])},i(t,e)};function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function u(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(u.prototype=e.prototype,new u)}var o,c=function(){return c=Object.assign||function(t){for(var e,u=1,n=arguments.length;u<n;u++)for(var r in e=arguments[u])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},c.apply(this,arguments)},h=function(t){function e(e){var u=t.call(this,e)||this;return u.email="",u.email=e.email,u}return s(e,t),e.prototype.getType=function(){return"email"},e.prototype.getEmail=function(){return this.email},e.prototype.getAnchorHref=function(){return"mailto:"+this.email},e.prototype.getAnchorText=function(){return this.email},e}(a),l=function(t){function e(e){var u=t.call(this,e)||this;return u.serviceName="",u.hashtag="",u.serviceName=e.serviceName,u.hashtag=e.hashtag,u}return s(e,t),e.prototype.getType=function(){return"hashtag"},e.prototype.getServiceName=function(){return this.serviceName},e.prototype.getHashtag=function(){return this.hashtag},e.prototype.getAnchorHref=function(){var t=this.serviceName,e=this.hashtag;switch(t){case"twitter":return"https://twitter.com/hashtag/"+e;case"facebook":return"https://www.facebook.com/hashtag/"+e;case"instagram":return"https://instagram.com/explore/tags/"+e;case"tiktok":return"https://www.tiktok.com/tag/"+e;default:throw new Error("Unknown service name to point hashtag to: "+t)}},e.prototype.getAnchorText=function(){return"#"+this.hashtag},e}(a),p=function(t){function e(e){var u=t.call(this,e)||this;return u.serviceName="twitter",u.mention="",u.mention=e.mention,u.serviceName=e.serviceName,u}return s(e,t),e.prototype.getType=function(){return"mention"},e.prototype.getMention=function(){return this.mention},e.prototype.getServiceName=function(){return this.serviceName},e.prototype.getAnchorHref=function(){switch(this.serviceName){case"twitter":return"https://twitter.com/"+this.mention;case"instagram":return"https://instagram.com/"+this.mention;case"soundcloud":return"https://soundcloud.com/"+this.mention;case"tiktok":return"https://www.tiktok.com/@"+this.mention;default:throw new Error("Unknown service name to point mention to: "+this.serviceName)}},e.prototype.getAnchorText=function(){return"@"+this.mention},e.prototype.getCssClassSuffixes=function(){var e=t.prototype.getCssClassSuffixes.call(this),u=this.getServiceName();return u&&e.push(u),e},e}(a),g=function(t){function e(e){var u=t.call(this,e)||this;return u.number="",u.plusSign=!1,u.number=e.number,u.plusSign=e.plusSign,u}return s(e,t),e.prototype.getType=function(){return"phone"},e.prototype.getPhoneNumber=function(){return this.number},e.prototype.getNumber=function(){return this.getPhoneNumber()},e.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number},e.prototype.getAnchorText=function(){return this.matchedText},e}(a),f=function(t){function e(e){var u=t.call(this,e)||this;return u.url="",u.urlMatchType="scheme",u.protocolUrlMatch=!1,u.protocolRelativeMatch=!1,u.stripPrefix={scheme:!0,www:!0},u.stripTrailingSlash=!0,u.decodePercentEncoding=!0,u.schemePrefixRegex=/^(https?:\/\/)?/i,u.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i,u.protocolRelativeRegex=/^\/\//,u.protocolPrepended=!1,u.urlMatchType=e.urlMatchType,u.url=e.url,u.protocolUrlMatch=e.protocolUrlMatch,u.protocolRelativeMatch=e.protocolRelativeMatch,u.stripPrefix=e.stripPrefix,u.stripTrailingSlash=e.stripTrailingSlash,u.decodePercentEncoding=e.decodePercentEncoding,u}return s(e,t),e.prototype.getType=function(){return"url"},e.prototype.getUrlMatchType=function(){return this.urlMatchType},e.prototype.getUrl=function(){var t=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(t=this.url="http://"+t,this.protocolPrepended=!0),t},e.prototype.getAnchorHref=function(){return this.getUrl().replace(/&amp;/g,"&")},e.prototype.getAnchorText=function(){var t=this.getMatchedText();return this.protocolRelativeMatch&&(t=this.stripProtocolRelativePrefix(t)),this.stripPrefix.scheme&&(t=this.stripSchemePrefix(t)),this.stripPrefix.www&&(t=this.stripWwwPrefix(t)),this.stripTrailingSlash&&(t=this.removeTrailingSlash(t)),this.decodePercentEncoding&&(t=this.removePercentEncoding(t)),t},e.prototype.stripSchemePrefix=function(t){return t.replace(this.schemePrefixRegex,"")},e.prototype.stripWwwPrefix=function(t){return t.replace(this.wwwPrefixRegex,"$1")},e.prototype.stripProtocolRelativePrefix=function(t){return t.replace(this.protocolRelativeRegex,"")},e.prototype.removeTrailingSlash=function(t){return"/"===t.charAt(t.length-1)&&(t=t.slice(0,-1)),t},e.prototype.removePercentEncoding=function(t){var e=t.replace(/%22/gi,"&quot;").replace(/%26/gi,"&amp;").replace(/%27/gi,"&#39;").replace(/%3C/gi,"&lt;").replace(/%3E/gi,"&gt;");try{return decodeURIComponent(e)}catch(t){return e}},e}(a),d=function(t){this.__jsduckDummyDocProp=null,this.tagBuilder=t.tagBuilder},m=/[A-Za-z]/,A=/[\d]/,b=/[\D]/,x=/\s/,y=/['"]/,F=/[\x00-\x1F\x7F]/,w=/A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source,v=w+/\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source+/\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source,B=/0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source,C=v+B,D=v+B,E=new RegExp("[".concat(D,"]")),k="(?:["+B+"]{1,3}\\.){3}["+B+"]{1,3}",T="["+D+"](?:["+D+"\\-_]{0,61}["+D+"])?",M=function(t){return"(?=("+T+"))\\"+t},P=function(t){return"(?:"+M(t)+"(?:\\."+M(t+1)+"){0,126}|"+k+")"},j=E,z=/(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbah1a3hjkrd|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--mgbcpq6gpa1a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq480n2rg|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|travelchannel|wolterskluwer|xn--cckwcxetd|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--4dbrk0ce|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nextdirect|properties|protection|prudential|realestate|republican|restaurant|schaeffler|tatamotors|technology|university|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--q7ce6a|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--qxa6a|xn--tckwe|xn--vhquv|yodobashi|موريتانيا|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|builders|business|capetown|catering|catholic|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|etisalat|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|البحرين|الجزائر|العليان|پاکستان|كاثوليك|இந்தியா|abarth|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|loans|locus|lotte|lotto|macys|mango|media|miami|money|movie|music|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|ישראל|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kids|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|read|reit|rent|rest|rich|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|アマゾン|グーグル|クラウド|ポイント|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceo|cfa|cfd|com|cpa|crs|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gay|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|spa|srl|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ລາວ|ストア|セール|みんな|中文网|亚马逊|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|ευ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|广东|微博|慈善|手机|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,R=new RegExp("[".concat(D,"!#$%&'*+/=?^_`{|}~-]")),q=new RegExp("^".concat(z.source,"$")),N=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.localPartCharRegex=R,e.strictTldRegex=q,e}return s(e,t),e.prototype.parseMatches=function(t){for(var e=this.tagBuilder,n=this.localPartCharRegex,r=this.strictTldRegex,a=[],i=t.length,s=new O,o={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"},l=0,p=0,g=s;l<i;){var f=t.charAt(l);switch(p){case 0:d(f);break;case 1:m(t.charAt(l-1),f);break;case 2:A(f);break;case 3:b(f);break;case 4:x(f);break;case 5:y(f);break;case 6:F(f);break;case 7:w(f);break;default:u(p)}l++}return C(),a;function d(t){"m"===t?v(1):n.test(t)&&v()}function m(t,e){":"===t?n.test(e)?(p=2,g=new O(c(c({},g),{hasMailtoPrefix:!0}))):B():o[t]===e||(n.test(e)?p=2:"."===e?p=3:"@"===e?p=4:B())}function A(t){"."===t?p=3:"@"===t?p=4:n.test(t)||B()}function b(t){"."===t||"@"===t?B():n.test(t)?p=2:B()}function x(t){j.test(t)?p=5:B()}function y(t){"."===t?p=7:"-"===t?p=6:j.test(t)||C()}function F(t){"-"===t||"."===t?C():j.test(t)?p=5:C()}function w(t){"."===t||"-"===t?C():j.test(t)?(p=5,g=new O(c(c({},g),{hasDomainDot:!0}))):C()}function v(t){void 0===t&&(t=2),p=t,g=new O({idx:l})}function B(){p=0,g=s}function C(){if(g.hasDomainDot){var u=t.slice(g.idx,l);/[-.]$/.test(u)&&(u=u.slice(0,-1));var n=g.hasMailtoPrefix?u.slice("mailto:".length):u;(function(t){var e=(t.split(".").pop()||"").toLowerCase();return r.test(e)})(n)&&a.push(new h({tagBuilder:e,matchedText:u,offset:g.idx,email:n}))}B()}},e}(d),O=function(t){void 0===t&&(t={}),this.idx=void 0!==t.idx?t.idx:-1,this.hasMailtoPrefix=!!t.hasMailtoPrefix,this.hasDomainDot=!!t.hasDomainDot},S=function(){function t(){}return t.isValid=function(t,e){return!(e&&!this.isValidUriScheme(e)||this.urlMatchDoesNotHaveProtocolOrDot(t,e)||this.urlMatchDoesNotHaveAtLeastOneWordChar(t,e)&&!this.isValidIpAddress(t)||this.containsMultipleDots(t))},t.isValidIpAddress=function(t){var e=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);return null!==t.match(e)},t.containsMultipleDots=function(t){var e=t;return this.hasFullProtocolRegex.test(t)&&(e=t.split("://")[1]),e.split("/")[0].indexOf("..")>-1},t.isValidUriScheme=function(t){var e=t.match(this.uriSchemeRegex),u=e&&e[0].toLowerCase();return"javascript:"!==u&&"vbscript:"!==u},t.urlMatchDoesNotHaveProtocolOrDot=function(t,e){return!(!t||e&&this.hasFullProtocolRegex.test(e)||-1!==t.indexOf("."))},t.urlMatchDoesNotHaveAtLeastOneWordChar=function(t,e){return!(!t||!e)&&(!this.hasFullProtocolRegex.test(e)&&!this.hasWordCharAfterProtocolRegex.test(t))},t.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//,t.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/,t.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+w+"]"),t.ipRegex=/[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/,t}(),H=(o=new RegExp("[/?#](?:["+D+"\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*["+D+"\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"),new RegExp(["(?:","(",/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source,P(2),")","|","(","(//)?",/(?:www\.)/.source,P(6),")","|","(","(//)?",P(10)+"\\.",z.source,"(?![-"+C+"])",")",")","(?::[0-9]+)?","(?:"+o.source+")?"].join(""),"gi")),_=new RegExp("["+D+"]"),U=function(t){function e(e){var u=t.call(this,e)||this;return u.stripPrefix={scheme:!0,www:!0},u.stripTrailingSlash=!0,u.decodePercentEncoding=!0,u.matcherRegex=H,u.wordCharRegExp=_,u.stripPrefix=e.stripPrefix,u.stripTrailingSlash=e.stripTrailingSlash,u.decodePercentEncoding=e.decodePercentEncoding,u}return s(e,t),e.prototype.parseMatches=function(t){for(var e,u=this.matcherRegex,n=this.stripPrefix,r=this.stripTrailingSlash,a=this.decodePercentEncoding,i=this.tagBuilder,s=[],o=function(){var u=e[0],o=e[1],h=e[4],l=e[5],p=e[9],g=e.index,d=l||p,m=t.charAt(g-1);if(!S.isValid(u,o))return"continue";if(g>0&&"@"===m)return"continue";if(g>0&&d&&c.wordCharRegExp.test(m))return"continue";if(/\?$/.test(u)&&(u=u.substr(0,u.length-1)),c.matchHasUnbalancedClosingParen(u))u=u.substr(0,u.length-1);else{var A=c.matchHasInvalidCharAfterTld(u,o);A>-1&&(u=u.substr(0,A))}var b=["http://","https://"].find((function(t){return!!o&&-1!==o.indexOf(t)}));if(b){var x=u.indexOf(b);u=u.substr(x),o=o.substr(x),g+=x}var y=o?"scheme":h?"www":"tld",F=!!o;s.push(new f({tagBuilder:i,matchedText:u,offset:g,urlMatchType:y,url:u,protocolUrlMatch:F,protocolRelativeMatch:!!d,stripPrefix:n,stripTrailingSlash:r,decodePercentEncoding:a}))},c=this;null!==(e=u.exec(t));)o();return s},e.prototype.matchHasUnbalancedClosingParen=function(t){var e,u=t.charAt(t.length-1);if(")"===u)e="(";else if("]"===u)e="[";else{if("}"!==u)return!1;e="{"}for(var n=0,r=0,a=t.length-1;r<a;r++){var i=t.charAt(r);i===e?n++:i===u&&(n=Math.max(n-1,0))}return 0===n},e.prototype.matchHasInvalidCharAfterTld=function(t,e){if(!t)return-1;var u=0;e&&(u=t.indexOf(":"),t=t.slice(u));var n=new RegExp("^((.?//)?[-."+D+"]*[-"+D+"]\\.[-"+D+"]+)").exec(t);return null===n?-1:(u+=n[1].length,t=t.slice(n[1].length),/^[^-.A-Za-z0-9:\/?#]/.test(t)?u:-1)},e}(d),W=new RegExp("[_".concat(D,"]")),I=function(t){function e(e){var u=t.call(this,e)||this;return u.serviceName="twitter",u.serviceName=e.serviceName,u}return s(e,t),e.prototype.parseMatches=function(t){for(var e=this.tagBuilder,n=this.serviceName,r=[],a=t.length,i=0,s=-1,o=0;i<a;){var c=t.charAt(i);switch(o){case 0:h(c);break;case 1:p(c);break;case 2:g(c);break;case 3:f(c);break;default:u(o)}i++}return d(),r;function h(t){"#"===t?(o=2,s=i):E.test(t)&&(o=1)}function p(t){E.test(t)||(o=0)}function g(t){o=W.test(t)?3:E.test(t)?1:0}function f(t){W.test(t)||(d(),s=-1,o=E.test(t)?1:0)}function d(){if(s>-1&&i-s<=140){var u=t.slice(s,i),a=new l({tagBuilder:e,matchedText:u,offset:s,serviceName:n,hashtag:u.slice(1)});r.push(a)}}},e}(d),L=["twitter","facebook","instagram","tiktok"],$=new RegExp("".concat(/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/.source,"|").concat(/(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/.source),"g"),Z=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.matcherRegex=$,e}return s(e,t),e.prototype.parseMatches=function(t){for(var e,u=this.matcherRegex,n=this.tagBuilder,r=[];null!==(e=u.exec(t));){var a=e[0],i=a.replace(/[^0-9,;#]/g,""),s=!(!e[1]&&!e[2]),o=0==e.index?"":t.substr(e.index-1,1),c=t.substr(e.index+a.length,1),h=!o.match(/\d/)&&!c.match(/\d/);this.testMatch(e[3])&&this.testMatch(a)&&h&&r.push(new g({tagBuilder:n,matchedText:a,offset:e.index,number:i,plusSign:s}))}return r},e.prototype.testMatch=function(t){return b.test(t)},e}(d),V=new RegExp("@[_".concat(D,"]{1,50}(?![_").concat(D,"])"),"g"),Y=new RegExp("@[_.".concat(D,"]{1,30}(?![_").concat(D,"])"),"g"),G=new RegExp("@[-_.".concat(D,"]{1,50}(?![-_").concat(D,"])"),"g"),J=new RegExp("@[_.".concat(D,"]{1,23}[_").concat(D,"](?![_").concat(D,"])"),"g"),K=new RegExp("[^"+D+"]"),Q=function(t){function e(e){var u=t.call(this,e)||this;return u.serviceName="twitter",u.matcherRegexes={twitter:V,instagram:Y,soundcloud:G,tiktok:J},u.nonWordCharRegex=K,u.serviceName=e.serviceName,u}return s(e,t),e.prototype.parseMatches=function(t){var e,u=this.serviceName,n=this.matcherRegexes[this.serviceName],r=this.nonWordCharRegex,a=this.tagBuilder,i=[];if(!n)return i;for(;null!==(e=n.exec(t));){var s=e.index,o=t.charAt(s-1);if(0===s||r.test(o)){var c=e[0].replace(/\.+$/g,""),h=c.slice(1);i.push(new p({tagBuilder:a,matchedText:c,offset:s,serviceName:u,mention:h}))}}return i},e}(d);function X(t,e){for(var n,r=e.onOpenTag,a=e.onCloseTag,i=e.onText,s=e.onComment,o=e.onDoctype,h=new tt,l=0,p=t.length,g=0,f=0,d=h;l<p;){var b=t.charAt(l);switch(g){case 0:w(b);break;case 1:v(b);break;case 2:C(b);break;case 3:B(b);break;case 4:D(b);break;case 5:E(b);break;case 6:k(b);break;case 7:T(b);break;case 8:M(b);break;case 9:P(b);break;case 10:j(b);break;case 11:z(b);break;case 12:R(b);break;case 13:q();break;case 14:N(b);break;case 15:O(b);break;case 16:S(b);break;case 17:H(b);break;case 18:_(b);break;case 19:U(b);break;case 20:W(b);break;default:u(g)}l++}function w(t){"<"===t&&L()}function v(t){"!"===t?g=13:"/"===t?(g=2,d=new tt(c(c({},d),{isClosing:!0}))):"<"===t?L():m.test(t)?(g=3,d=new tt(c(c({},d),{isOpening:!0}))):(g=0,d=h)}function B(t){x.test(t)?(d=new tt(c(c({},d),{name:Z()})),g=4):"<"===t?L():"/"===t?(d=new tt(c(c({},d),{name:Z()})),g=12):">"===t?(d=new tt(c(c({},d),{name:Z()})),$()):m.test(t)||A.test(t)||":"===t||I()}function C(t){">"===t?I():m.test(t)?g=3:I()}function D(t){x.test(t)||("/"===t?g=12:">"===t?$():"<"===t?L():"="===t||y.test(t)||F.test(t)?I():g=5)}function E(t){x.test(t)?g=6:"/"===t?g=12:"="===t?g=7:">"===t?$():"<"===t?L():y.test(t)&&I()}function k(t){x.test(t)||("/"===t?g=12:"="===t?g=7:">"===t?$():"<"===t?L():y.test(t)?I():g=5)}function T(t){x.test(t)||('"'===t?g=8:"'"===t?g=9:/[>=`]/.test(t)?I():"<"===t?L():g=10)}function M(t){'"'===t&&(g=11)}function P(t){"'"===t&&(g=11)}function j(t){x.test(t)?g=4:">"===t?$():"<"===t&&L()}function z(t){x.test(t)?g=4:"/"===t?g=12:">"===t?$():"<"===t?L():(g=4,l--)}function R(t){">"===t?(d=new tt(c(c({},d),{isClosing:!0})),$()):g=4}function q(e){"--"===t.substr(l,2)?(l+=2,d=new tt(c(c({},d),{type:"comment"})),g=14):"DOCTYPE"===t.substr(l,7).toUpperCase()?(l+=7,d=new tt(c(c({},d),{type:"doctype"})),g=20):I()}function N(t){"-"===t?g=15:">"===t?I():g=16}function O(t){"-"===t?g=18:">"===t?I():g=16}function S(t){"-"===t&&(g=17)}function H(t){g="-"===t?18:16}function _(t){">"===t?$():"!"===t?g=19:"-"===t||(g=16)}function U(t){"-"===t?g=17:">"===t?$():g=16}function W(t){">"===t?$():"<"===t&&L()}function I(){g=0,d=h}function L(){g=1,d=new tt({idx:l})}function $(){var e=t.slice(f,d.idx);e&&i(e,f),"comment"===d.type?s(d.idx):"doctype"===d.type?o(d.idx):(d.isOpening&&r(d.name,d.idx),d.isClosing&&a(d.name,d.idx)),I(),f=l+1}function Z(){var e=d.idx+(d.isClosing?2:1);return t.slice(e,l).toLowerCase()}f<l&&(n=t.slice(f,l),i(n,f),f=l+1)}var tt=function(t){void 0===t&&(t={}),this.idx=void 0!==t.idx?t.idx:-1,this.type=t.type||"tag",this.name=t.name||"",this.isOpening=!!t.isOpening,this.isClosing=!!t.isClosing};return function(){function t(e){void 0===e&&(e={}),this.version=t.version,this.urls={},this.email=!0,this.phone=!0,this.hashtag=!1,this.mention=!1,this.newWindow=!0,this.stripPrefix={scheme:!0,www:!0},this.stripTrailingSlash=!0,this.decodePercentEncoding=!0,this.truncate={length:0,location:"end"},this.className="",this.replaceFn=null,this.context=void 0,this.sanitizeHtml=!1,this.matchers=null,this.tagBuilder=null,this.urls=this.normalizeUrlsCfg(e.urls),this.email="boolean"==typeof e.email?e.email:this.email,this.phone="boolean"==typeof e.phone?e.phone:this.phone,this.hashtag=e.hashtag||this.hashtag,this.mention=e.mention||this.mention,this.newWindow="boolean"==typeof e.newWindow?e.newWindow:this.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(e.stripPrefix),this.stripTrailingSlash="boolean"==typeof e.stripTrailingSlash?e.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding="boolean"==typeof e.decodePercentEncoding?e.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=e.sanitizeHtml||!1;var u=this.mention;if(!1!==u&&-1===["twitter","instagram","soundcloud","tiktok"].indexOf(u))throw new Error("invalid `mention` cfg '".concat(u,"' - see docs"));var n=this.hashtag;if(!1!==n&&-1===L.indexOf(n))throw new Error("invalid `hashtag` cfg '".concat(n,"' - see docs"));this.truncate=this.normalizeTruncateCfg(e.truncate),this.className=e.className||this.className,this.replaceFn=e.replaceFn||this.replaceFn,this.context=e.context||this}return t.link=function(e,u){return new t(u).link(e)},t.parse=function(e,u){return new t(u).parse(e)},t.prototype.normalizeUrlsCfg=function(t){return null==t&&(t=!0),"boolean"==typeof t?{schemeMatches:t,wwwMatches:t,tldMatches:t}:{schemeMatches:"boolean"!=typeof t.schemeMatches||t.schemeMatches,wwwMatches:"boolean"!=typeof t.wwwMatches||t.wwwMatches,tldMatches:"boolean"!=typeof t.tldMatches||t.tldMatches}},t.prototype.normalizeStripPrefixCfg=function(t){return null==t&&(t=!0),"boolean"==typeof t?{scheme:t,www:t}:{scheme:"boolean"!=typeof t.scheme||t.scheme,www:"boolean"!=typeof t.www||t.www}},t.prototype.normalizeTruncateCfg=function(t){return"number"==typeof t?{length:t,location:"end"}:function(t,e){for(var u in e)e.hasOwnProperty(u)&&void 0===t[u]&&(t[u]=e[u]);return t}(t||{},{length:Number.POSITIVE_INFINITY,location:"end"})},t.prototype.parse=function(t){var e=this,u=["a","style","script"],n=0,r=[];return X(t,{onOpenTag:function(t){u.indexOf(t)>=0&&n++},onText:function(t,u){if(0===n){var a=function(t,e){if(!e.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var u,n=[],r=0;u=e.exec(t);)n.push(t.substring(r,u.index)),n.push(u[0]),r=u.index+u[0].length;return n.push(t.substring(r)),n}(t,/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi),i=u;a.forEach((function(t,u){if(u%2==0){var n=e.parseText(t,i);r.push.apply(r,n)}i+=t.length}))}},onCloseTag:function(t){u.indexOf(t)>=0&&(n=Math.max(n-1,0))},onComment:function(t){},onDoctype:function(t){}}),r=this.compactMatches(r),r=this.removeUnwantedMatches(r)},t.prototype.compactMatches=function(t){t.sort((function(t,e){return t.getOffset()-e.getOffset()}));for(var e=0;e<t.length-1;){var u=t[e],n=u.getOffset(),r=u.getMatchedText().length,a=n+r;if(e+1<t.length){if(t[e+1].getOffset()===n){var i=t[e+1].getMatchedText().length>r?e:e+1;t.splice(i,1);continue}if(t[e+1].getOffset()<a){t.splice(e+1,1);continue}}e++}return t},t.prototype.removeUnwantedMatches=function(t){return this.hashtag||e(t,(function(t){return"hashtag"===t.getType()})),this.email||e(t,(function(t){return"email"===t.getType()})),this.phone||e(t,(function(t){return"phone"===t.getType()})),this.mention||e(t,(function(t){return"mention"===t.getType()})),this.urls.schemeMatches||e(t,(function(t){return"url"===t.getType()&&"scheme"===t.getUrlMatchType()})),this.urls.wwwMatches||e(t,(function(t){return"url"===t.getType()&&"www"===t.getUrlMatchType()})),this.urls.tldMatches||e(t,(function(t){return"url"===t.getType()&&"tld"===t.getUrlMatchType()})),t},t.prototype.parseText=function(t,e){void 0===e&&(e=0),e=e||0;for(var u=this.getMatchers(),n=[],r=0,a=u.length;r<a;r++){for(var i=u[r].parseMatches(t),s=0,o=i.length;s<o;s++)i[s].setOffset(e+i[s].getOffset());n.push.apply(n,i)}return n},t.prototype.link=function(t){if(!t)return"";this.sanitizeHtml&&(t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"));for(var e=this.parse(t),u=[],n=0,r=0,a=e.length;r<a;r++){var i=e[r];u.push(t.substring(n,i.getOffset())),u.push(this.createMatchReturnVal(i)),n=i.getOffset()+i.getMatchedText().length}return u.push(t.substring(n)),u.join("")},t.prototype.createMatchReturnVal=function(t){var e;return this.replaceFn&&(e=this.replaceFn.call(this.context,t)),"string"==typeof e?e:!1===e?t.getMatchedText():e instanceof n?e.toAnchorString():t.buildTag().toAnchorString()},t.prototype.getMatchers=function(){if(this.matchers)return this.matchers;var t=this.getTagBuilder(),e=[new I({tagBuilder:t,serviceName:this.hashtag}),new N({tagBuilder:t}),new Z({tagBuilder:t}),new Q({tagBuilder:t,serviceName:this.mention}),new U({tagBuilder:t,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=e},t.prototype.getTagBuilder=function(){var t=this.tagBuilder;return t||(t=this.tagBuilder=new r({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),t},t.version="3.16.2",t.AnchorTagBuilder=r,t.HtmlTag=n,t.matcher={Email:N,Hashtag:I,Matcher:d,Mention:Q,Phone:Z,Url:U},t.match={Email:h,Hashtag:l,Match:a,Mention:p,Phone:g,Url:f},t}()}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Autolinker=e()}(this,(function(){"use strict";function t(t){return"boolean"==typeof t}function e(t,e){for(var u=t.length-1;u>=0;u--)t[u]===e&&t.splice(u,1)}function u(t,e){for(var u=t.length-1;u>=0;u--)!0===e(t[u])&&t.splice(u,1)}function n(t){throw new Error("Unhandled case for value: '".concat(t,"'"))}var a=/[A-Za-z]/,r=/[\d]/,s=/\s/,i=/['"]/,o=/[\x00-\x1F\x7F]/,c=/A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source+/\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source+/\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source+/0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source,h=new RegExp("[".concat(c,"]")),l=function(){function t(t){void 0===t&&(t={}),this.tagName="",this.attrs={},this.innerHTML="",this.tagName=t.tagName||"",this.attrs=t.attrs||{},this.innerHTML=t.innerHtml||t.innerHTML||""}return t.prototype.setTagName=function(t){return this.tagName=t,this},t.prototype.getTagName=function(){return this.tagName||""},t.prototype.setAttr=function(t,e){return this.getAttrs()[t]=e,this},t.prototype.getAttr=function(t){return this.getAttrs()[t]},t.prototype.setAttrs=function(t){return Object.assign(this.getAttrs(),t),this},t.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},t.prototype.setClass=function(t){return this.setAttr("class",t)},t.prototype.addClass=function(t){for(var e,u=this.getClass(),n=u?u.split(s):[],a=t.split(s);e=a.shift();)-1===n.indexOf(e)&&n.push(e);return this.getAttrs().class=n.join(" "),this},t.prototype.removeClass=function(t){for(var e,u=this.getClass(),n=u?u.split(s):[],a=t.split(s);n.length&&(e=a.shift());){var r=n.indexOf(e);-1!==r&&n.splice(r,1)}return this.getAttrs().class=n.join(" "),this},t.prototype.getClass=function(){return this.getAttrs().class||""},t.prototype.hasClass=function(t){return-1!==(" "+this.getClass()+" ").indexOf(" "+t+" ")},t.prototype.setInnerHTML=function(t){return this.innerHTML=t,this},t.prototype.setInnerHtml=function(t){return this.setInnerHTML(t)},t.prototype.getInnerHTML=function(){return this.innerHTML||""},t.prototype.getInnerHtml=function(){return this.getInnerHTML()},t.prototype.toAnchorString=function(){var t=this.getTagName(),e=this.buildAttrsStr();return["<",t,e=e?" "+e:"",">",this.getInnerHtml(),"</",t,">"].join("")},t.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var t=this.getAttrs(),e=[];for(var u in t)t.hasOwnProperty(u)&&e.push(u+'="'+t[u]+'"');return e.join(" ")},t}();var p=function(){function t(t){void 0===t&&(t={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=t.newWindow||!1,this.truncate=t.truncate||{},this.className=t.className||""}return t.prototype.build=function(t){return new l({tagName:"a",attrs:this.createAttrs(t),innerHtml:this.processAnchorText(t.getAnchorText())})},t.prototype.createAttrs=function(t){var e={href:t.getAnchorHref()},u=this.createCssClass(t);return u&&(e.class=u),this.newWindow&&(e.target="_blank",e.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<t.getAnchorText().length&&(e.title=t.getAnchorHref()),e},t.prototype.createCssClass=function(t){var e=this.className;if(e){for(var u=[e],n=t.getCssClassSuffixes(),a=0,r=n.length;a<r;a++)u.push(e+"-"+n[a]);return u.join(" ")}return""},t.prototype.processAnchorText=function(t){return t=this.doTruncate(t)},t.prototype.doTruncate=function(t){var e=this.truncate;if(!e||!e.length)return t;var u=e.length,n=e.location;return"smart"===n?function(t,e,u){var n,a;null==u?(u="&hellip;",a=3,n=8):(a=u.length,n=u.length);var r=function(t){var e="";return t.scheme&&t.host&&(e+=t.scheme+"://"),t.host&&(e+=t.host),t.path&&(e+="/"+t.path),t.query&&(e+="?"+t.query),t.fragment&&(e+="#"+t.fragment),e},s=function(t,e){var n=e/2,a=Math.ceil(n),r=-1*Math.floor(n),s="";return r<0&&(s=t.substr(r)),t.substr(0,a)+u+s};if(t.length<=e)return t;var i=e-a,o=function(t){var e={},u=t,n=u.match(/^([a-z]+):\/\//i);return n&&(e.scheme=n[1],u=u.substr(n[0].length)),(n=u.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(e.host=n[1],u=u.substr(n[0].length)),(n=u.match(/^\/(.*?)(?=(\?|#|$))/i))&&(e.path=n[1],u=u.substr(n[0].length)),(n=u.match(/^\?(.*?)(?=(#|$))/i))&&(e.query=n[1],u=u.substr(n[0].length)),(n=u.match(/^#(.*?)$/i))&&(e.fragment=n[1]),e}(t);if(o.query){var c=o.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);c&&(o.query=o.query.substr(0,c[1].length),t=r(o))}if(t.length<=e)return t;if(o.host&&(o.host=o.host.replace(/^www\./,""),t=r(o)),t.length<=e)return t;var h="";if(o.host&&(h+=o.host),h.length>=i)return o.host.length==e?(o.host.substr(0,e-a)+u).substr(0,i+n):s(h,i).substr(0,i+n);var l="";if(o.path&&(l+="/"+o.path),o.query&&(l+="?"+o.query),l){if((h+l).length>=i)return(h+l).length==e?(h+l).substr(0,e):(h+s(l,i-h.length)).substr(0,i+n);h+=l}if(o.fragment){var p="#"+o.fragment;if((h+p).length>=i)return(h+p).length==e?(h+p).substr(0,e):(h+s(p,i-h.length)).substr(0,i+n);h+=p}if(o.scheme&&o.host){var f=o.scheme+"://";if((h+f).length<i)return(f+h).substr(0,e)}if(h.length<=e)return h;var g="";return i>0&&(g=h.substr(-1*Math.floor(i/2))),(h.substr(0,Math.ceil(i/2))+u+g).substr(0,i+n)}(t,u):"middle"===n?function(t,e,u){if(t.length<=e)return t;var n,a;null==u?(u="&hellip;",n=8,a=3):(n=u.length,a=u.length);var r=e-a,s="";return r>0&&(s=t.substr(-1*Math.floor(r/2))),(t.substr(0,Math.ceil(r/2))+u+s).substr(0,r+n)}(t,u):function(t,e,u){return function(t,e,u){var n;return t.length>e&&(null==u?(u="&hellip;",n=3):n=u.length,t=t.substring(0,e-n)+u),t}(t,e,u)}(t,u)},t}(),f=function(t,e){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var u in e)Object.prototype.hasOwnProperty.call(e,u)&&(t[u]=e[u])},f(t,e)};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function g(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function u(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(u.prototype=e.prototype,new u)}var d=function(){return d=Object.assign||function(t){for(var e,u=1,n=arguments.length;u<n;u++)for(var a in e=arguments[u])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t},d.apply(this,arguments)},m=function(){function t(t){this._=null,this.matchedText="",this.offset=0,this.tagBuilder=t.tagBuilder,this.matchedText=t.matchedText,this.offset=t.offset}return t.prototype.getMatchedText=function(){return this.matchedText},t.prototype.setOffset=function(t){this.offset=t},t.prototype.getOffset=function(){return this.offset},t.prototype.getCssClassSuffixes=function(){return[this.type]},t.prototype.buildTag=function(){return this.tagBuilder.build(this)},t}(),A=new RegExp("^(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbah1a3hjkrd|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--mgbcpq6gpa1a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq480n2rg|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|travelchannel|wolterskluwer|xn--cckwcxetd|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--4dbrk0ce|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nextdirect|properties|protection|prudential|realestate|republican|restaurant|schaeffler|tatamotors|technology|university|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--q7ce6a|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--qxa6a|xn--tckwe|xn--vhquv|yodobashi|موريتانيا|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|builders|business|capetown|catering|catholic|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|etisalat|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|البحرين|الجزائر|العليان|پاکستان|كاثوليك|இந்தியா|abarth|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|loans|locus|lotte|lotto|macys|mango|media|miami|money|movie|music|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|ישראל|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kids|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|read|reit|rent|rest|rich|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|アマゾン|グーグル|クラウド|ポイント|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceo|cfa|cfd|com|cpa|crs|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gay|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|spa|srl|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ລາວ|ストア|セール|みんな|中文网|亚马逊|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|ευ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|广东|微博|慈善|手机|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)$"),b=/[\/?#]/,x=/[-+&@#/%=~_()|'$*\[\]{}\u2713]/,F=/[?!:,.;^]/,y=/https?:\/\//i,B=new RegExp("^"+y.source,"i"),C=new RegExp(F.source+"$"),v=/^(javascript|vbscript):/i,k=/^[A-Za-z][-.+A-Za-z0-9]*:(\/\/)?([^:/]*)/,w=/^(?:\/\/)?([^/#?:]+)/;function D(t){return a.test(t)}function E(t){return a.test(t)||r.test(t)||"+"===t||"-"===t||"."===t}function T(t){return h.test(t)}function j(t){return"_"===t||T(t)}function M(t){return h.test(t)||x.test(t)||F.test(t)}function q(t){return b.test(t)}function z(t){return A.test(t.toLowerCase())}var S=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,N=/[:/?#]/;var O=/^(https?:\/\/)?(www\.)?/i,P=/^\/\//,R=function(t){function e(e){var u=t.call(this,e)||this;return u.type="url",u.url="",u.urlMatchType="scheme",u.protocolRelativeMatch=!1,u.stripPrefix={scheme:!0,www:!0},u.stripTrailingSlash=!0,u.decodePercentEncoding=!0,u.protocolPrepended=!1,u.urlMatchType=e.urlMatchType,u.url=e.url,u.protocolRelativeMatch=e.protocolRelativeMatch,u.stripPrefix=e.stripPrefix,u.stripTrailingSlash=e.stripTrailingSlash,u.decodePercentEncoding=e.decodePercentEncoding,u}return g(e,t),e.prototype.getType=function(){return"url"},e.prototype.getUrlMatchType=function(){return this.urlMatchType},e.prototype.getUrl=function(){var t=this.url;return this.protocolRelativeMatch||"scheme"===this.urlMatchType||this.protocolPrepended||(t=this.url="http://"+t,this.protocolPrepended=!0),t},e.prototype.getAnchorHref=function(){return this.getUrl().replace(/&amp;/g,"&")},e.prototype.getAnchorText=function(){var t=this.getMatchedText();return this.protocolRelativeMatch&&(t=t.replace(P,"")),this.stripPrefix.scheme&&(t=t.replace(B,"")),this.stripPrefix.www&&(t=function(t){return t.replace(O,"$1")}(t)),this.stripTrailingSlash&&(t=function(t){"/"===t.charAt(t.length-1)&&(t=t.slice(0,-1));return t}(t)),this.decodePercentEncoding&&(t=function(t){var e=t.replace(/%22/gi,"&quot;").replace(/%26/gi,"&amp;").replace(/%27/gi,"&#39;").replace(/%3C/gi,"&lt;").replace(/%3E/gi,"&gt;");try{return decodeURIComponent(e)}catch(t){return e}}(t)),t},e}(m);var H=/^mailto:/i,I=new RegExp("[".concat(c,"!#$%&'*+/=?^_`{|}~-]"));function L(t){return I.test(t)}var $=function(t){function e(e){var u=t.call(this,e)||this;return u.type="email",u.email="",u.email=e.email,u}return g(e,t),e.prototype.getType=function(){return"email"},e.prototype.getEmail=function(){return this.email},e.prototype.getAnchorHref=function(){return"mailto:"+this.email},e.prototype.getAnchorText=function(){return this.email},e}(m);function _(t){return"_"===t||h.test(t)}var U=["twitter","facebook","instagram","tiktok"],V=function(t){function e(e){var u=t.call(this,e)||this;return u.type="hashtag",u.serviceName="twitter",u.hashtag="",u.serviceName=e.serviceName,u.hashtag=e.hashtag,u}return g(e,t),e.prototype.getType=function(){return"hashtag"},e.prototype.getServiceName=function(){return this.serviceName},e.prototype.getHashtag=function(){return this.hashtag},e.prototype.getAnchorHref=function(){var t=this.serviceName,e=this.hashtag;switch(t){case"twitter":return"https://twitter.com/hashtag/"+e;case"facebook":return"https://www.facebook.com/hashtag/"+e;case"instagram":return"https://instagram.com/explore/tags/"+e;case"tiktok":return"https://www.tiktok.com/tag/"+e;default:throw n(t),new Error("Invalid hashtag service: ".concat(t))}},e.prototype.getAnchorText=function(){return"#"+this.hashtag},e.prototype.getCssClassSuffixes=function(){var e=t.prototype.getCssClassSuffixes.call(this),u=this.getServiceName();return u&&e.push(u),e},e}(m),W={twitter:/^@\w{1,15}$/,instagram:/^@[_\w]{1,30}$/,soundcloud:/^@[-a-z0-9_]{3,25}$/,tiktok:/^@[.\w]{1,23}[\w]$/},Z=/[-\w.]/;function Y(t){return Z.test(t)}var G=["twitter","instagram","soundcloud","tiktok"],J=function(t){function e(e){var u=t.call(this,e)||this;return u.type="mention",u.serviceName="twitter",u.mention="",u.mention=e.mention,u.serviceName=e.serviceName,u}return g(e,t),e.prototype.getType=function(){return"mention"},e.prototype.getMention=function(){return this.mention},e.prototype.getServiceName=function(){return this.serviceName},e.prototype.getAnchorHref=function(){switch(this.serviceName){case"twitter":return"https://twitter.com/"+this.mention;case"instagram":return"https://instagram.com/"+this.mention;case"soundcloud":return"https://soundcloud.com/"+this.mention;case"tiktok":return"https://www.tiktok.com/@"+this.mention;default:throw new Error("Unknown service name to point mention to: "+this.serviceName)}},e.prototype.getAnchorText=function(){return"@"+this.mention},e.prototype.getCssClassSuffixes=function(){var e=t.prototype.getCssClassSuffixes.call(this),u=this.getServiceName();return u&&e.push(u),e},e}(m),K=/[-. ]/,Q=/[-. ()]/,X=/[,;]/,tt=new RegExp("^".concat(/(?:(?:(?:(\+)?\d{1,3}[-. ]?)?\(?\d{3}\)?[-. ]?\d{3}[-. ]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-. ]?(?:\d[-. ]?){6,12}\d+))([,;]+[0-9]+#?)*/.source,"|").concat(/(0([1-9]-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/.source,"$"));function et(t){return K.test(t)}function ut(t){return X.test(t)}var nt=function(t){function e(e){var u=t.call(this,e)||this;return u.type="phone",u.number="",u.plusSign=!1,u.number=e.number,u.plusSign=e.plusSign,u}return g(e,t),e.prototype.getType=function(){return"phone"},e.prototype.getPhoneNumber=function(){return this.number},e.prototype.getNumber=function(){return this.getPhoneNumber()},e.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number},e.prototype.getAnchorText=function(){return this.matchedText},e}(m);function at(t,u){for(var s=u.tagBuilder,i=u.stripPrefix,o=u.stripTrailingSlash,c=u.decodePercentEncoding,l=u.hashtagServiceName,p=u.mentionServiceName,f=[],g=t.length,d=[],m=0;m<g;m++){var A=t.charAt(m);if(0===d.length)B(A);else for(var b=d.length-1;b>=0;b--){var x=d[b];switch(x.state){case 11:G(x,A);break;case 12:K(x,A);break;case 0:O(x,A);break;case 1:P(x,A);break;case 2:I(x,A);break;case 3:U(x,A);break;case 4:Z(x,A);break;case 5:X(x,A);break;case 6:at(x,A);break;case 7:lt(x,A);break;case 13:pt(x,A);break;case 14:ft(x,A);break;case 8:gt(x,A);break;case 9:dt(x,A);break;case 10:mt(x,A);break;case 15:At(x,A);break;case 16:bt(x,A);break;case 17:xt(x,A);break;case 18:Ft(x,A);break;case 19:yt(x,A);break;case 20:Bt(x,A);break;case 21:Ct(x,A);break;case 22:vt(x,A);break;case 23:kt(x,A);break;case 24:wt(x,A);break;case 25:Dt(x,A);break;case 26:Et(x,A);break;case 27:Tt(x,A);break;case 28:jt(x,A);break;case 29:Mt(x,A);break;case 30:qt(x,A);break;case 31:zt(x,A);break;case 32:Nt(x,A);break;case 33:Ot(x,A);break;case 34:Pt(x,A);break;case 35:Rt(x,A);break;case 36:Ht(x,A);break;case 37:St(x,A);break;case 38:It(x,A);break;case 39:Lt(x,A);break;case 40:$t(x,A);break;case 41:_t(x,A);break;default:n(x.state)}}}for(var F=d.length-1;F>=0;F--)d.forEach((function(t){return Ut(t)}));return f;function B(t){if("#"===t)d.push({type:"hashtag",startIdx:m,state:28,acceptStateReached:!1});else if("@"===t)d.push(function(t,e){return{type:"mention",startIdx:t,state:e,acceptStateReached:!1}}(m,30));else if("/"===t)d.push(ct(m,11));else if("+"===t)d.push(ht(m,37));else if("("===t)d.push(ht(m,32));else{if(r.test(t)&&(d.push(ht(m,38)),d.push(function(t,e){return{type:"url",startIdx:t,state:e,acceptStateReached:!1,matchType:"ipV4",octetsEncountered:1}}(m,13))),function(t){return h.test(t)}(t)){var e="m"===t.toLowerCase()?15:22;d.push(function(t,e){return{type:"email",startIdx:t,state:e,acceptStateReached:!1}}(m,e))}D(t)&&d.push(ot(m,0)),h.test(t)&&d.push(ct(m,5))}}function O(t,u){":"===u?t.state=2:"-"===u?t.state=1:E(u)||e(d,t)}function P(t,u){"-"===u||("/"===u?(e(d,t),d.push(ct(m,11))):E(u)?t.state=0:e(d,t))}function I(t,u){"/"===u?t.state=3:"."===u?e(d,t):T(u)?(t.state=5,D(u)&&d.push(ot(m,0))):e(d,t)}function U(t,e){"/"===e?t.state=4:M(e)?(t.state=10,t.acceptStateReached=!0):Ut(t)}function Z(t,u){"/"===u?t.state=10:T(u)?(t.state=5,t.acceptStateReached=!0):e(d,t)}function G(t,u){"/"===u?t.state=12:e(d,t)}function K(t,u){T(u)?t.state=5:e(d,t)}function X(t,e){"."===e?t.state=7:"-"===e?t.state=6:":"===e?t.state=8:q(e)?t.state=10:j(e)||Ut(t)}function at(t,e){"-"===e||("."===e?Ut(t):T(e)?t.state=5:Ut(t))}function lt(t,e){"."===e?Ut(t):T(e)?(t.state=5,t.acceptStateReached=!0):Ut(t)}function pt(t,u){"."===u?t.state=14:":"===u?t.state=8:r.test(u)||(q(u)?t.state=10:h.test(u)?e(d,t):Ut(t))}function ft(t,e){r.test(e)?(t.octetsEncountered++,4===t.octetsEncountered&&(t.acceptStateReached=!0),t.state=13):Ut(t)}function gt(t,e){r.test(e)?t.state=9:Ut(t)}function dt(t,e){r.test(e)||(q(e)?t.state=10:Ut(t))}function mt(t,e){M(e)||Ut(t)}function At(t,e){"a"===e.toLowerCase()?t.state=16:vt(t,e)}function bt(t,e){"i"===e.toLowerCase()?t.state=17:vt(t,e)}function xt(t,e){"l"===e.toLowerCase()?t.state=18:vt(t,e)}function Ft(t,e){"t"===e.toLowerCase()?t.state=19:vt(t,e)}function yt(t,e){"o"===e.toLowerCase()?t.state=20:vt(t,e)}function Bt(t,e){":"===e.toLowerCase()?t.state=21:vt(t,e)}function Ct(t,u){L(u)?t.state=22:e(d,t)}function vt(t,u){"."===u?t.state=23:"@"===u?t.state=24:L(u)?t.state=22:e(d,t)}function kt(t,u){"."===u||"@"===u?e(d,t):L(u)?t.state=22:e(d,t)}function wt(t,u){T(u)?t.state=25:e(d,t)}function Dt(t,e){"."===e?t.state=27:"-"===e?t.state=26:j(e)||Ut(t)}function Et(t,e){"-"===e||"."===e?Ut(t):j(e)?t.state=25:Ut(t)}function Tt(t,e){"."===e||"-"===e?Ut(t):T(e)?(t.state=25,t.acceptStateReached=!0):Ut(t)}function jt(t,u){_(u)?(t.state=29,t.acceptStateReached=!0):e(d,t)}function Mt(t,e){_(e)||Ut(t)}function qt(t,u){Y(u)?(t.state=31,t.acceptStateReached=!0):e(d,t)}function zt(t,u){Y(u)||(h.test(u)?e(d,t):Ut(t))}function St(t,u){r.test(u)?t.state=38:(e(d,t),B(u))}function Nt(t,u){r.test(u)?t.state=33:e(d,t),B(u)}function Ot(t,u){r.test(u)?t.state=34:e(d,t)}function Pt(t,u){r.test(u)?t.state=35:e(d,t)}function Rt(t,u){")"===u?t.state=36:e(d,t)}function Ht(t,u){r.test(u)?t.state=38:et(u)?t.state=39:e(d,t)}function It(t,e){t.acceptStateReached=!0,ut(e)?t.state=40:"#"===e?t.state=41:r.test(e)||("("===e?t.state=32:et(e)?t.state=39:(Ut(t),D(e)&&d.push(ot(m,0))))}function Lt(t,e){r.test(e)?t.state=38:"("===e?t.state=32:(Ut(t),B(e))}function $t(t,e){ut(e)||("#"===e?t.state=41:r.test(e)?t.state=38:Ut(t))}function _t(t,u){ut(u)?t.state=40:r.test(u)?e(d,t):Ut(t)}function Ut(u){if(e(d,u),u.acceptStateReached){var r,h,g,A=u.startIdx,b=t.slice(u.startIdx,m);if(b=function(t){for(var e={"(":0,"{":0,"[":0},u=0;u<t.length;u++){var n=t.charAt(u);rt.test(n)?e[n]++:st.test(n)&&e[it[n]]--}var a,r=t.length-1;for(;r>=0;)if(a=t.charAt(r),st.test(a)){var s=it[a];if(!(e[s]<0))break;e[s]++,r--}else{if(!C.test(a))break;r--}return t.slice(0,r+1)}(b),"url"===u.type){if("@"===t.charAt(u.startIdx-1))return;var x=u.matchType;if("scheme"===x){var F=y.exec(b);if(F&&(A+=F.index,b=b.slice(F.index)),!function(t){if(v.test(t))return!1;var e=t.match(k);if(!e)return!1;var u=!!e[1],n=e[2];return!!u||!(-1===n.indexOf(".")||!a.test(n))}(b))return}else if("tld"===x){if(!function(t){var e=t.match(w);if(!e)return!1;var u=e[0].split(".");return!(u.length<2||!z(u[u.length-1]))}(b))return}else if("ipV4"===x){if(g=b.split(N,1)[0],!S.test(g))return}else n(x);f.push(new R({tagBuilder:s,matchedText:b,offset:A,urlMatchType:x,url:b,protocolRelativeMatch:"//"===b.slice(0,2),stripPrefix:i,stripTrailingSlash:o,decodePercentEncoding:c}))}else if("email"===u.type)z(b.split(".").pop()||"")&&f.push(new $({tagBuilder:s,matchedText:b,offset:A,email:b.replace(H,"")}));else if("hashtag"===u.type)b.length<=140&&f.push(new V({tagBuilder:s,matchedText:b,offset:A,serviceName:l,hashtag:b.slice(1)}));else if("mention"===u.type)h=b,W[p].test(h)&&f.push(new J({tagBuilder:s,matchedText:b,offset:A,serviceName:p,mention:b.slice(1)}));else if("phone"===u.type){if(b=b.replace(/ +$/g,""),("+"===(r=b).charAt(0)||Q.test(r))&&tt.test(r)){var B=b.replace(/[^0-9,;#]/g,"");f.push(new nt({tagBuilder:s,matchedText:b,offset:A,number:B,plusSign:"+"===b.charAt(0)}))}}else n(u)}}}var rt=/[\(\{\[]/,st=/[\)\}\]]/,it={")":"(","}":"{","]":"["};function ot(t,e){return{type:"url",startIdx:t,state:e,acceptStateReached:!1,matchType:"scheme"}}function ct(t,e){return{type:"url",startIdx:t,state:e,acceptStateReached:!1,matchType:"tld"}}function ht(t,e){return{type:"phone",startIdx:t,state:e,acceptStateReached:!1}}function lt(t,e){for(var u,c=e.onOpenTag,h=e.onCloseTag,l=e.onText,p=e.onComment,f=e.onDoctype,g=new pt,m=0,A=t.length,b=0,x=0,F=g;m<A;){var y=t.charAt(m);switch(b){case 0:B(y);break;case 1:C(y);break;case 2:k(y);break;case 3:v(y);break;case 4:w(y);break;case 5:D(y);break;case 6:E(y);break;case 7:T(y);break;case 8:j(y);break;case 9:M(y);break;case 10:q(y);break;case 11:z(y);break;case 12:S(y);break;case 13:N();break;case 14:O(y);break;case 15:P(y);break;case 16:R(y);break;case 17:H(y);break;case 18:I(y);break;case 19:L(y);break;case 20:$(y);break;default:n(b)}m++}function B(t){"<"===t&&U()}function C(t){"!"===t?b=13:"/"===t?(b=2,F=new pt(d(d({},F),{isClosing:!0}))):"<"===t?U():a.test(t)?(b=3,F=new pt(d(d({},F),{isOpening:!0}))):(b=0,F=g)}function v(t){s.test(t)?(F=new pt(d(d({},F),{name:W()})),b=4):"<"===t?U():"/"===t?(F=new pt(d(d({},F),{name:W()})),b=12):">"===t?(F=new pt(d(d({},F),{name:W()})),V()):a.test(t)||r.test(t)||":"===t||_()}function k(t){">"===t?_():a.test(t)?b=3:_()}function w(t){s.test(t)||("/"===t?b=12:">"===t?V():"<"===t?U():"="===t||i.test(t)||o.test(t)?_():b=5)}function D(t){s.test(t)?b=6:"/"===t?b=12:"="===t?b=7:">"===t?V():"<"===t?U():i.test(t)&&_()}function E(t){s.test(t)||("/"===t?b=12:"="===t?b=7:">"===t?V():"<"===t?U():i.test(t)?_():b=5)}function T(t){s.test(t)||('"'===t?b=8:"'"===t?b=9:/[>=`]/.test(t)?_():"<"===t?U():b=10)}function j(t){'"'===t&&(b=11)}function M(t){"'"===t&&(b=11)}function q(t){s.test(t)?b=4:">"===t?V():"<"===t&&U()}function z(t){s.test(t)?b=4:"/"===t?b=12:">"===t?V():"<"===t?U():(b=4,m--)}function S(t){">"===t?(F=new pt(d(d({},F),{isClosing:!0})),V()):b=4}function N(e){"--"===t.substr(m,2)?(m+=2,F=new pt(d(d({},F),{type:"comment"})),b=14):"DOCTYPE"===t.substr(m,7).toUpperCase()?(m+=7,F=new pt(d(d({},F),{type:"doctype"})),b=20):_()}function O(t){"-"===t?b=15:">"===t?_():b=16}function P(t){"-"===t?b=18:">"===t?_():b=16}function R(t){"-"===t&&(b=17)}function H(t){b="-"===t?18:16}function I(t){">"===t?V():"!"===t?b=19:"-"===t||(b=16)}function L(t){"-"===t?b=17:">"===t?V():b=16}function $(t){">"===t?V():"<"===t&&U()}function _(){b=0,F=g}function U(){b=1,F=new pt({idx:m})}function V(){var e=t.slice(x,F.idx);e&&l(e,x),"comment"===F.type?p(F.idx):"doctype"===F.type?f(F.idx):(F.isOpening&&c(F.name,F.idx),F.isClosing&&h(F.name,F.idx)),_(),x=m+1}function W(){var e=F.idx+(F.isClosing?2:1);return t.slice(e,m).toLowerCase()}x<m&&(u=t.slice(x,m),l(u,x),x=m+1)}var pt=function(t){void 0===t&&(t={}),this.idx=void 0!==t.idx?t.idx:-1,this.type=t.type||"tag",this.name=t.name||"",this.isOpening=!!t.isOpening,this.isClosing=!!t.isClosing};return function(){function e(u){void 0===u&&(u={}),this.version=e.version,this.urls={},this.email=!0,this.phone=!0,this.hashtag=!1,this.mention=!1,this.newWindow=!0,this.stripPrefix={scheme:!0,www:!0},this.stripTrailingSlash=!0,this.decodePercentEncoding=!0,this.truncate={length:0,location:"end"},this.className="",this.replaceFn=null,this.context=void 0,this.sanitizeHtml=!1,this.tagBuilder=null,this.urls=function(e){null==e&&(e=!0);return t(e)?{schemeMatches:e,tldMatches:e,ipV4Matches:e}:{schemeMatches:!t(e.schemeMatches)||e.schemeMatches,tldMatches:!t(e.tldMatches)||e.tldMatches,ipV4Matches:!t(e.ipV4Matches)||e.ipV4Matches}}(u.urls),this.email=t(u.email)?u.email:this.email,this.phone=t(u.phone)?u.phone:this.phone,this.hashtag=u.hashtag||this.hashtag,this.mention=u.mention||this.mention,this.newWindow=t(u.newWindow)?u.newWindow:this.newWindow,this.stripPrefix=function(e){null==e&&(e=!0);return t(e)?{scheme:e,www:e}:{scheme:!t(e.scheme)||e.scheme,www:!t(e.www)||e.www}}(u.stripPrefix),this.stripTrailingSlash=t(u.stripTrailingSlash)?u.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding=t(u.decodePercentEncoding)?u.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=u.sanitizeHtml||!1;var n=this.mention;if(!1!==n&&-1===G.indexOf(n))throw new Error("invalid `mention` cfg '".concat(n,"' - see docs"));var a,r=this.hashtag;if(!1!==r&&-1===U.indexOf(r))throw new Error("invalid `hashtag` cfg '".concat(r,"' - see docs"));this.truncate="number"==typeof(a=u.truncate)?{length:a,location:"end"}:function(t,e){for(var u in e)e.hasOwnProperty(u)&&void 0===t[u]&&(t[u]=e[u]);return t}(a||{},{length:Number.POSITIVE_INFINITY,location:"end"}),this.className=u.className||this.className,this.replaceFn=u.replaceFn||this.replaceFn,this.context=u.context||this}return e.link=function(t,u){return new e(u).link(t)},e.parse=function(t,u){return new e(u).parse(t)},e.prototype.parse=function(t){var e=this,u=["a","style","script"],n=0,a=[];return lt(t,{onOpenTag:function(t){u.indexOf(t)>=0&&n++},onText:function(t,u){if(0===n){var r=t.split(/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi),s=u;r.forEach((function(t,u){if(u%2==0){var n=e.parseText(t,s);a.push.apply(a,n)}s+=t.length}))}},onCloseTag:function(t){u.indexOf(t)>=0&&(n=Math.max(n-1,0))},onComment:function(t){},onDoctype:function(t){}}),a=this.compactMatches(a),a=this.removeUnwantedMatches(a)},e.prototype.compactMatches=function(t){t.sort((function(t,e){return t.getOffset()-e.getOffset()}));for(var e=0;e<t.length-1;){var u=t[e],n=u.getOffset(),a=u.getMatchedText().length,r=n+a;if(e+1<t.length){if(t[e+1].getOffset()===n){var s=t[e+1].getMatchedText().length>a?e:e+1;t.splice(s,1);continue}if(t[e+1].getOffset()<r){t.splice(e+1,1);continue}}e++}return t},e.prototype.removeUnwantedMatches=function(t){return this.hashtag||u(t,(function(t){return"hashtag"===t.getType()})),this.email||u(t,(function(t){return"email"===t.getType()})),this.phone||u(t,(function(t){return"phone"===t.getType()})),this.mention||u(t,(function(t){return"mention"===t.getType()})),this.urls.schemeMatches||u(t,(function(t){return"url"===t.getType()&&"scheme"===t.getUrlMatchType()})),this.urls.tldMatches||u(t,(function(t){return"url"===t.getType()&&"tld"===t.getUrlMatchType()})),this.urls.ipV4Matches||u(t,(function(t){return"url"===t.getType()&&"ipV4"===t.getUrlMatchType()})),t},e.prototype.parseText=function(t,e){void 0===e&&(e=0),e=e||0;for(var u=at(t,{tagBuilder:this.getTagBuilder(),stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding,hashtagServiceName:this.hashtag,mentionServiceName:this.mention||"twitter"}),n=0,a=u.length;n<a;n++)u[n].setOffset(e+u[n].getOffset());return u},e.prototype.link=function(t){if(!t)return"";this.sanitizeHtml&&(t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"));for(var e=this.parse(t),u=[],n=0,a=0,r=e.length;a<r;a++){var s=e[a];u.push(t.substring(n,s.getOffset())),u.push(this.createMatchReturnVal(s)),n=s.getOffset()+s.getMatchedText().length}return u.push(t.substring(n)),u.join("")},e.prototype.createMatchReturnVal=function(t){var e;return this.replaceFn&&(e=this.replaceFn.call(this.context,t)),"string"==typeof e?e:!1===e?t.getMatchedText():e instanceof l?e.toAnchorString():t.buildTag().toAnchorString()},e.prototype.getTagBuilder=function(){var t=this.tagBuilder;return t||(t=this.tagBuilder=new p({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),t},e.version="4.0.0",e}()}));
//# sourceMappingURL=autolinker.min.js.map

30

dist/commonjs/anchor-tag-builder.d.ts

@@ -1,4 +0,4 @@

import { Match } from './match/match';
import { HtmlTag } from './html-tag';
import { TruncateConfigObj } from './autolinker';
import { AbstractMatch } from './match/abstract-match';
/**

@@ -55,7 +55,6 @@ * @protected

*
* @param {Autolinker.match.Match} match The Match instance to generate an
* anchor tag from.
* @return {Autolinker.HtmlTag} The HtmlTag instance for the anchor tag.
* @param match The Match instance to generate an anchor tag from.
* @return The HtmlTag instance for the anchor tag.
*/
build(match: Match): HtmlTag;
build(match: AbstractMatch): HtmlTag;
/**

@@ -66,7 +65,6 @@ * Creates the Object (map) of the HTML attributes for the anchor (&lt;a&gt;)

* @protected
* @param {Autolinker.match.Match} match The Match instance to generate an
* anchor tag from.
* @return {Object} A key/value Object (map) of the anchor tag's attributes.
* @param match The Match instance to generate an anchor tag from.
* @return A key/value Object (map) of the anchor tag's attributes.
*/
protected createAttrs(match: Match): {
protected createAttrs(match: AbstractMatch): {
[attrName: string]: string;

@@ -88,9 +86,9 @@ };

* @protected
* @param {Autolinker.match.Match} match The Match instance to generate an
* @param match The Match instance to generate an
* anchor tag from.
* @return {String} The CSS class string for the link. Example return:
* @return The CSS class string for the link. Example return:
* "myLink myLink-url". If no {@link #className} was configured, returns
* an empty string.
*/
protected createCssClass(match: Match): string;
protected createCssClass(match: AbstractMatch): string;
/**

@@ -101,5 +99,5 @@ * Processes the `anchorText` by truncating the text according to the

* @private
* @param {String} anchorText The anchor tag's text (i.e. what will be
* @param anchorText The anchor tag's text (i.e. what will be
* displayed).
* @return {String} The processed `anchorText`.
* @return The processed `anchorText`.
*/

@@ -114,5 +112,5 @@ private processAnchorText;

* @private
* @param {String} anchorText The anchor tag's text (i.e. what will be
* @param anchorText The anchor tag's text (i.e. what will be
* displayed).
* @return {String} The truncated anchor text.
* @return The truncated anchor text.
*/

@@ -119,0 +117,0 @@ private doTruncate;

@@ -64,5 +64,4 @@ "use strict";

*
* @param {Autolinker.match.Match} match The Match instance to generate an
* anchor tag from.
* @return {Autolinker.HtmlTag} The HtmlTag instance for the anchor tag.
* @param match The Match instance to generate an anchor tag from.
* @return The HtmlTag instance for the anchor tag.
*/

@@ -81,5 +80,4 @@ AnchorTagBuilder.prototype.build = function (match) {

* @protected
* @param {Autolinker.match.Match} match The Match instance to generate an
* anchor tag from.
* @return {Object} A key/value Object (map) of the anchor tag's attributes.
* @param match The Match instance to generate an anchor tag from.
* @return A key/value Object (map) of the anchor tag's attributes.
*/

@@ -119,5 +117,5 @@ AnchorTagBuilder.prototype.createAttrs = function (match) {

* @protected
* @param {Autolinker.match.Match} match The Match instance to generate an
* @param match The Match instance to generate an
* anchor tag from.
* @return {String} The CSS class string for the link. Example return:
* @return The CSS class string for the link. Example return:
* "myLink myLink-url". If no {@link #className} was configured, returns

@@ -144,5 +142,5 @@ * an empty string.

* @private
* @param {String} anchorText The anchor tag's text (i.e. what will be
* @param anchorText The anchor tag's text (i.e. what will be
* displayed).
* @return {String} The processed `anchorText`.
* @return The processed `anchorText`.
*/

@@ -160,5 +158,5 @@ AnchorTagBuilder.prototype.processAnchorText = function (anchorText) {

* @private
* @param {String} anchorText The anchor tag's text (i.e. what will be
* @param anchorText The anchor tag's text (i.e. what will be
* displayed).
* @return {String} The truncated anchor text.
* @return The truncated anchor text.
*/

@@ -165,0 +163,0 @@ AnchorTagBuilder.prototype.doTruncate = function (anchorText) {

@@ -1,15 +0,5 @@

import { AnchorTagBuilder } from './anchor-tag-builder';
import { Match } from './match/match';
import { EmailMatch } from './match/email-match';
import { HashtagMatch } from './match/hashtag-match';
import { MentionMatch } from './match/mention-match';
import { PhoneMatch } from './match/phone-match';
import { UrlMatch } from './match/url-match';
import { Matcher } from './matcher/matcher';
import { HtmlTag } from './html-tag';
import { EmailMatcher } from './matcher/email-matcher';
import { UrlMatcher } from './matcher/url-matcher';
import { HashtagMatcher, HashtagService } from './matcher/hashtag-matcher';
import { PhoneMatcher } from './matcher/phone-matcher';
import { MentionMatcher } from './matcher/mention-matcher';
import { MentionService } from './parser/mention-utils';
import { HashtagService } from './parser/hashtag-utils';
/**

@@ -130,38 +120,4 @@ * @class Autolinker

*/
static readonly version = "3.16.2";
static readonly version = "4.0.0";
/**
* For backwards compatibility with Autolinker 1.x, the AnchorTagBuilder
* class is provided as a static on the Autolinker class.
*/
static readonly AnchorTagBuilder: typeof AnchorTagBuilder;
/**
* For backwards compatibility with Autolinker 1.x, the HtmlTag class is
* provided as a static on the Autolinker class.
*/
static readonly HtmlTag: typeof HtmlTag;
/**
* For backwards compatibility with Autolinker 1.x, the Matcher classes are
* provided as statics on the Autolinker class.
*/
static readonly matcher: {
Email: typeof EmailMatcher;
Hashtag: typeof HashtagMatcher;
Matcher: typeof Matcher;
Mention: typeof MentionMatcher;
Phone: typeof PhoneMatcher;
Url: typeof UrlMatcher;
};
/**
* For backwards compatibility with Autolinker 1.x, the Match classes are
* provided as statics on the Autolinker class.
*/
static readonly match: {
Email: typeof EmailMatch;
Hashtag: typeof HashtagMatch;
Match: typeof Match;
Mention: typeof MentionMatch;
Phone: typeof PhoneMatch;
Url: typeof UrlMatch;
};
/**
* Automatically links URLs, Email addresses, Phone Numbers, Twitter handles,

@@ -227,4 +183,6 @@ * Hashtags, and Mentions found in the given chunk of HTML. Does not link URLs

* Ex: 0.25.1
*
* @property {String} version
*/
readonly version = "3.16.2";
readonly version = "4.0.0";
/**

@@ -244,4 +202,4 @@ * @cfg {Boolean/Object} [urls]

* schemeMatches : true,
* wwwMatches : true,
* tldMatches : true
* tldMatches : true,
* ipV4Matches : true
* }

@@ -256,11 +214,12 @@ *

* `false` to prevent these types of matches.
* @cfg {Boolean} [urls.wwwMatches] `true` to match urls found prefixed with
* `'www.'`, i.e. `www.google.com`. `false` to prevent these types of
* matches. Note that if the URL had a prefixed scheme, and
* `schemeMatches` is true, it will still be linked.
* @cfg {Boolean} [urls.tldMatches] `true` to match URLs with known top
* level domains (.com, .net, etc.) that are not prefixed with a scheme or
* `'www.'`. This option attempts to match anything that looks like a URL
* in the given text. Ex: `google.com`, `asdf.org/?page=1`, etc. `false`
* to prevent these types of matches.
* level domains (.com, .net, etc.) that are not prefixed with a scheme
* (such as 'http://'). This option attempts to match anything that looks
* like a URL in the given text. Ex: `google.com`, `asdf.org/?page=1`, etc.
* `false` to prevent these types of matches.
* @cfg {Boolean} [urls.ipV4Matches] `true` to match IPv4 addresses in text
* that are not prefixed with a scheme (such as 'http://'). This option
* attempts to match anything that looks like an IPv4 address in text. Ex:
* `192.168.0.1`, `10.0.0.1/?page=1`, etc. `false` to prevent these types
* of matches.
*/

@@ -304,2 +263,3 @@ private readonly urls;

* - 'soundcloud'
* - 'tiktok'
*

@@ -477,12 +437,2 @@ * Defaults to `false` to skip auto-linking of mentions.

* @private
* @property {Autolinker.matcher.Matcher[]} matchers
*
* The {@link Autolinker.matcher.Matcher} instances for this Autolinker
* instance.
*
* This is lazily created in {@link #getMatchers}.
*/
private matchers;
/**
* @private
* @property {Autolinker.AnchorTagBuilder} tagBuilder

@@ -501,35 +451,2 @@ *

/**
* Normalizes the {@link #urls} config into an Object with 3 properties:
* `schemeMatches`, `wwwMatches`, and `tldMatches`, all Booleans.
*
* See {@link #urls} config for details.
*
* @private
* @param {Boolean/Object} urls
* @return {Object}
*/
private normalizeUrlsCfg;
/**
* Normalizes the {@link #stripPrefix} config into an Object with 2
* properties: `scheme`, and `www` - both Booleans.
*
* See {@link #stripPrefix} config for details.
*
* @private
* @param {Boolean/Object} stripPrefix
* @return {Object}
*/
private normalizeStripPrefixCfg;
/**
* Normalizes the {@link #truncate} config into an Object with 2 properties:
* `length` (Number), and `location` (String).
*
* See {@link #truncate} config for details.
*
* @private
* @param {Number/Object} truncate
* @return {Object}
*/
private normalizeTruncateCfg;
/**
* Parses the input `textOrHtml` looking for URLs, email addresses, phone

@@ -652,10 +569,2 @@ * numbers, username handles, and hashtags (depending on the configuration

/**
* Lazily instantiates and returns the {@link Autolinker.matcher.Matcher}
* instances for this Autolinker instance.
*
* @private
* @return {Autolinker.matcher.Matcher[]}
*/
private getMatchers;
/**
* Returns the {@link #tagBuilder} instance for this Autolinker instance,

@@ -688,6 +597,5 @@ * lazily instantiating it if it does not yet exist.

schemeMatches?: boolean;
wwwMatches?: boolean;
tldMatches?: boolean;
ipV4Matches?: boolean;
}
export declare type UrlMatchTypeOptions = 'scheme' | 'www' | 'tld';
export declare type StripPrefixConfig = boolean | StripPrefixConfigObj;

@@ -704,5 +612,4 @@ export interface StripPrefixConfigObj {

export declare type HashtagConfig = false | HashtagService;
export declare type MentionConfig = false | MentionServices;
export declare type MentionServices = 'twitter' | 'instagram' | 'soundcloud' | 'tiktok';
export declare type MentionConfig = false | MentionService;
export declare type ReplaceFn = (match: Match) => ReplaceFnReturn;
export declare type ReplaceFnReturn = boolean | string | HtmlTag | null | undefined | void;

@@ -6,16 +6,7 @@ "use strict";

var anchor_tag_builder_1 = require("./anchor-tag-builder");
var match_1 = require("./match/match");
var email_match_1 = require("./match/email-match");
var hashtag_match_1 = require("./match/hashtag-match");
var mention_match_1 = require("./match/mention-match");
var phone_match_1 = require("./match/phone-match");
var url_match_1 = require("./match/url-match");
var matcher_1 = require("./matcher/matcher");
var html_tag_1 = require("./html-tag");
var email_matcher_1 = require("./matcher/email-matcher");
var url_matcher_1 = require("./matcher/url-matcher");
var hashtag_matcher_1 = require("./matcher/hashtag-matcher");
var phone_matcher_1 = require("./matcher/phone-matcher");
var mention_matcher_1 = require("./matcher/mention-matcher");
var parse_matches_1 = require("./parser/parse-matches");
var parse_html_1 = require("./htmlParser/parse-html");
var mention_utils_1 = require("./parser/mention-utils");
var hashtag_utils_1 = require("./parser/hashtag-utils");
/**

@@ -139,2 +130,4 @@ * @class Autolinker

* Ex: 0.25.1
*
* @property {String} version
*/

@@ -156,4 +149,4 @@ this.version = Autolinker.version;

* schemeMatches : true,
* wwwMatches : true,
* tldMatches : true
* tldMatches : true,
* ipV4Matches : true
* }

@@ -168,11 +161,12 @@ *

* `false` to prevent these types of matches.
* @cfg {Boolean} [urls.wwwMatches] `true` to match urls found prefixed with
* `'www.'`, i.e. `www.google.com`. `false` to prevent these types of
* matches. Note that if the URL had a prefixed scheme, and
* `schemeMatches` is true, it will still be linked.
* @cfg {Boolean} [urls.tldMatches] `true` to match URLs with known top
* level domains (.com, .net, etc.) that are not prefixed with a scheme or
* `'www.'`. This option attempts to match anything that looks like a URL
* in the given text. Ex: `google.com`, `asdf.org/?page=1`, etc. `false`
* to prevent these types of matches.
* level domains (.com, .net, etc.) that are not prefixed with a scheme
* (such as 'http://'). This option attempts to match anything that looks
* like a URL in the given text. Ex: `google.com`, `asdf.org/?page=1`, etc.
* `false` to prevent these types of matches.
* @cfg {Boolean} [urls.ipV4Matches] `true` to match IPv4 addresses in text
* that are not prefixed with a scheme (such as 'http://'). This option
* attempts to match anything that looks like an IPv4 address in text. Ex:
* `192.168.0.1`, `10.0.0.1/?page=1`, etc. `false` to prevent these types
* of matches.
*/

@@ -216,2 +210,3 @@ this.urls = {}; // default value just to get the above doc comment in the ES5 output and documentation generator

* - 'soundcloud'
* - 'tiktok'
*

@@ -395,12 +390,2 @@ * Defaults to `false` to skip auto-linking of mentions.

* @private
* @property {Autolinker.matcher.Matcher[]} matchers
*
* The {@link Autolinker.matcher.Matcher} instances for this Autolinker
* instance.
*
* This is lazily created in {@link #getMatchers}.
*/
this.matchers = null;
/**
* @private
* @property {Autolinker.AnchorTagBuilder} tagBuilder

@@ -414,22 +399,19 @@ *

// it refers to the default values set above the constructor
this.urls = this.normalizeUrlsCfg(cfg.urls);
this.email = typeof cfg.email === 'boolean' ? cfg.email : this.email;
this.phone = typeof cfg.phone === 'boolean' ? cfg.phone : this.phone;
this.urls = normalizeUrlsCfg(cfg.urls);
this.email = (0, utils_1.isBoolean)(cfg.email) ? cfg.email : this.email;
this.phone = (0, utils_1.isBoolean)(cfg.phone) ? cfg.phone : this.phone;
this.hashtag = cfg.hashtag || this.hashtag;
this.mention = cfg.mention || this.mention;
this.newWindow = typeof cfg.newWindow === 'boolean' ? cfg.newWindow : this.newWindow;
this.stripPrefix = this.normalizeStripPrefixCfg(cfg.stripPrefix);
this.stripTrailingSlash =
typeof cfg.stripTrailingSlash === 'boolean'
? cfg.stripTrailingSlash
: this.stripTrailingSlash;
this.decodePercentEncoding =
typeof cfg.decodePercentEncoding === 'boolean'
? cfg.decodePercentEncoding
: this.decodePercentEncoding;
this.newWindow = (0, utils_1.isBoolean)(cfg.newWindow) ? cfg.newWindow : this.newWindow;
this.stripPrefix = normalizeStripPrefixCfg(cfg.stripPrefix);
this.stripTrailingSlash = (0, utils_1.isBoolean)(cfg.stripTrailingSlash)
? cfg.stripTrailingSlash
: this.stripTrailingSlash;
this.decodePercentEncoding = (0, utils_1.isBoolean)(cfg.decodePercentEncoding)
? cfg.decodePercentEncoding
: this.decodePercentEncoding;
this.sanitizeHtml = cfg.sanitizeHtml || false;
// Validate the value of the `mention` cfg
var mention = this.mention;
if (mention !== false &&
['twitter', 'instagram', 'soundcloud', 'tiktok'].indexOf(mention) === -1) {
if (mention !== false && mention_utils_1.mentionServices.indexOf(mention) === -1) {
throw new Error("invalid `mention` cfg '".concat(mention, "' - see docs"));

@@ -439,6 +421,6 @@ }

var hashtag = this.hashtag;
if (hashtag !== false && hashtag_matcher_1.hashtagServices.indexOf(hashtag) === -1) {
if (hashtag !== false && hashtag_utils_1.hashtagServices.indexOf(hashtag) === -1) {
throw new Error("invalid `hashtag` cfg '".concat(hashtag, "' - see docs"));
}
this.truncate = this.normalizeTruncateCfg(cfg.truncate);
this.truncate = normalizeTruncateCfg(cfg.truncate);
this.className = cfg.className || this.className;

@@ -512,73 +494,2 @@ this.replaceFn = cfg.replaceFn || this.replaceFn;

/**
* Normalizes the {@link #urls} config into an Object with 3 properties:
* `schemeMatches`, `wwwMatches`, and `tldMatches`, all Booleans.
*
* See {@link #urls} config for details.
*
* @private
* @param {Boolean/Object} urls
* @return {Object}
*/
Autolinker.prototype.normalizeUrlsCfg = function (urls) {
if (urls == null)
urls = true; // default to `true`
if (typeof urls === 'boolean') {
return { schemeMatches: urls, wwwMatches: urls, tldMatches: urls };
}
else {
// object form
return {
schemeMatches: typeof urls.schemeMatches === 'boolean' ? urls.schemeMatches : true,
wwwMatches: typeof urls.wwwMatches === 'boolean' ? urls.wwwMatches : true,
tldMatches: typeof urls.tldMatches === 'boolean' ? urls.tldMatches : true,
};
}
};
/**
* Normalizes the {@link #stripPrefix} config into an Object with 2
* properties: `scheme`, and `www` - both Booleans.
*
* See {@link #stripPrefix} config for details.
*
* @private
* @param {Boolean/Object} stripPrefix
* @return {Object}
*/
Autolinker.prototype.normalizeStripPrefixCfg = function (stripPrefix) {
if (stripPrefix == null)
stripPrefix = true; // default to `true`
if (typeof stripPrefix === 'boolean') {
return { scheme: stripPrefix, www: stripPrefix };
}
else {
// object form
return {
scheme: typeof stripPrefix.scheme === 'boolean' ? stripPrefix.scheme : true,
www: typeof stripPrefix.www === 'boolean' ? stripPrefix.www : true,
};
}
};
/**
* Normalizes the {@link #truncate} config into an Object with 2 properties:
* `length` (Number), and `location` (String).
*
* See {@link #truncate} config for details.
*
* @private
* @param {Number/Object} truncate
* @return {Object}
*/
Autolinker.prototype.normalizeTruncateCfg = function (truncate) {
if (typeof truncate === 'number') {
return { length: truncate, location: 'end' };
}
else {
// object, or undefined/null
return (0, utils_1.defaults)(truncate || {}, {
length: Number.POSITIVE_INFINITY,
location: 'end',
});
}
};
/**
* Parses the input `textOrHtml` looking for URLs, email addresses, phone

@@ -634,4 +545,4 @@ * numbers, username handles, and hashtags (depending on the configuration

// don't emit them as "text" except for &amp; entities
var htmlCharacterEntitiesRegex = /(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi;
var textSplit = (0, utils_1.splitAndCapture)(text, htmlCharacterEntitiesRegex);
var htmlCharacterEntitiesRegex = /(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi; // NOTE: capturing group is significant to include the split characters in the .split() call below
var textSplit = text.split(htmlCharacterEntitiesRegex);
var currentOffset_1 = offset;

@@ -653,4 +564,4 @@ textSplit.forEach(function (splitText, i) {

},
onComment: function (offset) { },
onDoctype: function (offset) { }, // no need to process doctype nodes
onComment: function (_offset) { },
onDoctype: function (_offset) { }, // no need to process doctype nodes
});

@@ -724,28 +635,28 @@ // After we have found all matches, remove subsequent matches that

if (!this.hashtag)
(0, utils_1.remove)(matches, function (match) {
(0, utils_1.removeWithPredicate)(matches, function (match) {
return match.getType() === 'hashtag';
});
if (!this.email)
(0, utils_1.remove)(matches, function (match) {
(0, utils_1.removeWithPredicate)(matches, function (match) {
return match.getType() === 'email';
});
if (!this.phone)
(0, utils_1.remove)(matches, function (match) {
(0, utils_1.removeWithPredicate)(matches, function (match) {
return match.getType() === 'phone';
});
if (!this.mention)
(0, utils_1.remove)(matches, function (match) {
(0, utils_1.removeWithPredicate)(matches, function (match) {
return match.getType() === 'mention';
});
if (!this.urls.schemeMatches) {
(0, utils_1.remove)(matches, function (m) {
(0, utils_1.removeWithPredicate)(matches, function (m) {
return m.getType() === 'url' && m.getUrlMatchType() === 'scheme';
});
}
if (!this.urls.wwwMatches) {
(0, utils_1.remove)(matches, function (m) { return m.getType() === 'url' && m.getUrlMatchType() === 'www'; });
}
if (!this.urls.tldMatches) {
(0, utils_1.remove)(matches, function (m) { return m.getType() === 'url' && m.getUrlMatchType() === 'tld'; });
(0, utils_1.removeWithPredicate)(matches, function (m) { return m.getType() === 'url' && m.getUrlMatchType() === 'tld'; });
}
if (!this.urls.ipV4Matches) {
(0, utils_1.removeWithPredicate)(matches, function (m) { return m.getType() === 'url' && m.getUrlMatchType() === 'ipV4'; });
}
return matches;

@@ -777,13 +688,16 @@ };

offset = offset || 0;
var matchers = this.getMatchers(), matches = [];
for (var i = 0, numMatchers = matchers.length; i < numMatchers; i++) {
var textMatches = matchers[i].parseMatches(text);
// Correct the offset of each of the matches. They are originally
// the offset of the match within the provided text node, but we
// need to correct them to be relative to the original HTML input
// string (i.e. the one provided to #parse).
for (var j = 0, numTextMatches = textMatches.length; j < numTextMatches; j++) {
textMatches[j].setOffset(offset + textMatches[j].getOffset());
}
matches.push.apply(matches, textMatches);
var matches = (0, parse_matches_1.parseMatches)(text, {
tagBuilder: this.getTagBuilder(),
stripPrefix: this.stripPrefix,
stripTrailingSlash: this.stripTrailingSlash,
decodePercentEncoding: this.decodePercentEncoding,
hashtagServiceName: this.hashtag,
mentionServiceName: this.mention || 'twitter',
});
// Correct the offset of each of the matches. They are originally
// the offset of the match within the provided text node, but we
// need to correct them to be relative to the original HTML input
// string (i.e. the one provided to #parse).
for (var i = 0, numTextMatches = matches.length; i < numTextMatches; i++) {
matches[i].setOffset(offset + matches[i].getOffset());
}

@@ -866,36 +780,2 @@ return matches;

/**
* Lazily instantiates and returns the {@link Autolinker.matcher.Matcher}
* instances for this Autolinker instance.
*
* @private
* @return {Autolinker.matcher.Matcher[]}
*/
Autolinker.prototype.getMatchers = function () {
if (!this.matchers) {
var tagBuilder = this.getTagBuilder();
var matchers = [
new hashtag_matcher_1.HashtagMatcher({
tagBuilder: tagBuilder,
serviceName: this.hashtag,
}),
new email_matcher_1.EmailMatcher({ tagBuilder: tagBuilder }),
new phone_matcher_1.PhoneMatcher({ tagBuilder: tagBuilder }),
new mention_matcher_1.MentionMatcher({
tagBuilder: tagBuilder,
serviceName: this.mention,
}),
new url_matcher_1.UrlMatcher({
tagBuilder: tagBuilder,
stripPrefix: this.stripPrefix,
stripTrailingSlash: this.stripTrailingSlash,
decodePercentEncoding: this.decodePercentEncoding,
}),
];
return (this.matchers = matchers);
}
else {
return this.matchers;
}
};
/**
* Returns the {@link #tagBuilder} instance for this Autolinker instance,

@@ -928,39 +808,76 @@ * lazily instantiating it if it does not yet exist.

Autolinker.version = version_1.version;
/**
* For backwards compatibility with Autolinker 1.x, the AnchorTagBuilder
* class is provided as a static on the Autolinker class.
*/
Autolinker.AnchorTagBuilder = anchor_tag_builder_1.AnchorTagBuilder;
/**
* For backwards compatibility with Autolinker 1.x, the HtmlTag class is
* provided as a static on the Autolinker class.
*/
Autolinker.HtmlTag = html_tag_1.HtmlTag;
/**
* For backwards compatibility with Autolinker 1.x, the Matcher classes are
* provided as statics on the Autolinker class.
*/
Autolinker.matcher = {
Email: email_matcher_1.EmailMatcher,
Hashtag: hashtag_matcher_1.HashtagMatcher,
Matcher: matcher_1.Matcher,
Mention: mention_matcher_1.MentionMatcher,
Phone: phone_matcher_1.PhoneMatcher,
Url: url_matcher_1.UrlMatcher,
};
/**
* For backwards compatibility with Autolinker 1.x, the Match classes are
* provided as statics on the Autolinker class.
*/
Autolinker.match = {
Email: email_match_1.EmailMatch,
Hashtag: hashtag_match_1.HashtagMatch,
Match: match_1.Match,
Mention: mention_match_1.MentionMatch,
Phone: phone_match_1.PhoneMatch,
Url: url_match_1.UrlMatch,
};
return Autolinker;
}());
exports.default = Autolinker;
/**
* Normalizes the {@link #urls} config into an Object with its 2 properties:
* `schemeMatches` and `tldMatches`, both booleans.
*
* See {@link #urls} config for details.
*
* @private
* @param {Boolean/Object} urls
* @return {Object}
*/
function normalizeUrlsCfg(urls) {
if (urls == null)
urls = true; // default to `true`
if ((0, utils_1.isBoolean)(urls)) {
return { schemeMatches: urls, tldMatches: urls, ipV4Matches: urls };
}
else {
// object form
return {
schemeMatches: (0, utils_1.isBoolean)(urls.schemeMatches) ? urls.schemeMatches : true,
tldMatches: (0, utils_1.isBoolean)(urls.tldMatches) ? urls.tldMatches : true,
ipV4Matches: (0, utils_1.isBoolean)(urls.ipV4Matches) ? urls.ipV4Matches : true,
};
}
}
/**
* Normalizes the {@link #stripPrefix} config into an Object with 2
* properties: `scheme`, and `www` - both Booleans.
*
* See {@link #stripPrefix} config for details.
*
* @private
* @param {Boolean/Object} stripPrefix
* @return {Object}
*/
function normalizeStripPrefixCfg(stripPrefix) {
if (stripPrefix == null)
stripPrefix = true; // default to `true`
if ((0, utils_1.isBoolean)(stripPrefix)) {
return { scheme: stripPrefix, www: stripPrefix };
}
else {
// object form
return {
scheme: (0, utils_1.isBoolean)(stripPrefix.scheme) ? stripPrefix.scheme : true,
www: (0, utils_1.isBoolean)(stripPrefix.www) ? stripPrefix.www : true,
};
}
}
/**
* Normalizes the {@link #truncate} config into an Object with 2 properties:
* `length` (Number), and `location` (String).
*
* See {@link #truncate} config for details.
*
* @private
* @param {Number/Object} truncate
* @return {Object}
*/
function normalizeTruncateCfg(truncate) {
if (typeof truncate === 'number') {
return { length: truncate, location: 'end' };
}
else {
// object, or undefined/null
return (0, utils_1.defaults)(truncate || {}, {
length: Number.POSITIVE_INFINITY,
location: 'end',
});
}
}
//# sourceMappingURL=autolinker.js.map

@@ -99,9 +99,2 @@ /**

/**
* @protected
* @property {RegExp} whitespaceRegex
*
* Regular expression used to match whitespace in a string of CSS classes.
*/
protected whitespaceRegex: RegExp;
/**
* @method constructor

@@ -218,3 +211,3 @@ * @param {Object} [cfg] The configuration properties for this class, in an Object (map)

/**
* Override of superclass method used to generate the HTML string for the tag.
* Generates the HTML string for the tag.
*

@@ -221,0 +214,0 @@ * @return {String}

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HtmlTag = void 0;
var utils_1 = require("./utils");
var regex_lib_1 = require("./regex-lib");
/**

@@ -108,9 +108,2 @@ * @class Autolinker.HtmlTag

this.innerHTML = ''; // default value just to get the above doc comment in the ES5 output and documentation generator
/**
* @protected
* @property {RegExp} whitespaceRegex
*
* Regular expression used to match whitespace in a string of CSS classes.
*/
this.whitespaceRegex = /\s+/; // default value just to get the above doc comment in the ES5 output and documentation generator
this.tagName = cfg.tagName || '';

@@ -193,5 +186,5 @@ this.attrs = cfg.attrs || {};

HtmlTag.prototype.addClass = function (cssClass) {
var classAttr = this.getClass(), whitespaceRegex = this.whitespaceRegex, classes = !classAttr ? [] : classAttr.split(whitespaceRegex), newClasses = cssClass.split(whitespaceRegex), newClass;
var classAttr = this.getClass(), classes = !classAttr ? [] : classAttr.split(regex_lib_1.whitespaceRe), newClasses = cssClass.split(regex_lib_1.whitespaceRe), newClass;
while ((newClass = newClasses.shift())) {
if ((0, utils_1.indexOf)(classes, newClass) === -1) {
if (classes.indexOf(newClass) === -1) {
classes.push(newClass);

@@ -210,5 +203,5 @@ }

HtmlTag.prototype.removeClass = function (cssClass) {
var classAttr = this.getClass(), whitespaceRegex = this.whitespaceRegex, classes = !classAttr ? [] : classAttr.split(whitespaceRegex), removeClasses = cssClass.split(whitespaceRegex), removeClass;
var classAttr = this.getClass(), classes = !classAttr ? [] : classAttr.split(regex_lib_1.whitespaceRe), removeClasses = cssClass.split(regex_lib_1.whitespaceRe), removeClass;
while (classes.length && (removeClass = removeClasses.shift())) {
var idx = (0, utils_1.indexOf)(classes, removeClass);
var idx = classes.indexOf(removeClass);
if (idx !== -1) {

@@ -275,3 +268,3 @@ classes.splice(idx, 1);

/**
* Override of superclass method used to generate the HTML string for the tag.
* Generates the HTML string for the tag.
*

@@ -278,0 +271,0 @@ * @return {String}

@@ -141,3 +141,3 @@ "use strict";

default:
(0, utils_1.throwUnhandledCaseError)(state);
(0, utils_1.assertNever)(state);
}

@@ -144,0 +144,0 @@ // For debugging: search for other "For debugging" lines

@@ -8,2 +8,2 @@ import Autolinker from './autolinker';

export * from './match/index';
export * from './matcher/index';
export * from './parser/index';

@@ -18,3 +18,3 @@ "use strict";

(0, tslib_1.__exportStar)(require("./match/index"), exports);
(0, tslib_1.__exportStar)(require("./matcher/index"), exports);
(0, tslib_1.__exportStar)(require("./parser/index"), exports);
//# sourceMappingURL=index.js.map

@@ -1,5 +0,5 @@

import { Match, MatchConfig } from './match';
import { AbstractMatchConfig, AbstractMatch } from './abstract-match';
/**
* @class Autolinker.match.Email
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -10,4 +10,13 @@ * Represents a Email match found in an input string which should be Autolinked.

*/
export declare class EmailMatch extends Match {
export declare class EmailMatch extends AbstractMatch {
/**
* @public
* @property {'email'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
readonly type: 'email';
/**
* @cfg {String} email (required)

@@ -30,3 +39,3 @@ *

*/
getType(): string;
getType(): 'email';
/**

@@ -51,4 +60,4 @@ * Returns the email address that was matched.

}
export interface EmailMatchConfig extends MatchConfig {
export interface EmailMatchConfig extends AbstractMatchConfig {
email: string;
}

@@ -5,6 +5,6 @@ "use strict";

var tslib_1 = require("tslib");
var match_1 = require("./match");
var abstract_match_1 = require("./abstract-match");
/**
* @class Autolinker.match.Email
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -25,2 +25,11 @@ * Represents a Email match found in an input string which should be Autolinked.

/**
* @public
* @property {'email'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
_this.type = 'email';
/**
* @cfg {String} email (required)

@@ -68,4 +77,4 @@ *

return EmailMatch;
}(match_1.Match));
}(abstract_match_1.AbstractMatch));
exports.EmailMatch = EmailMatch;
//# sourceMappingURL=email-match.js.map

@@ -1,5 +0,6 @@

import { Match, MatchConfig } from './match';
import { HashtagService } from '../parser/hashtag-utils';
import { AbstractMatch, AbstractMatchConfig } from './abstract-match';
/**
* @class Autolinker.match.Hashtag
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -12,4 +13,13 @@ * Represents a Hashtag match found in an input string which should be

*/
export declare class HashtagMatch extends Match {
export declare class HashtagMatch extends AbstractMatch {
/**
* @public
* @property {'hashtag'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
readonly type: 'hashtag';
/**
* @cfg {String} serviceName

@@ -39,3 +49,3 @@ *

*/
getType(): string;
getType(): 'hashtag';
/**

@@ -47,3 +57,3 @@ * Returns the configured {@link #serviceName} to point the HashtagMatch to.

*/
getServiceName(): string;
getServiceName(): HashtagService;
/**

@@ -67,6 +77,14 @@ * Returns the matched hashtag, without the '#' character.

getAnchorText(): string;
/**
* Returns the CSS class suffixes that should be used on a tag built with
* the match. See {@link Autolinker.match.Match#getCssClassSuffixes} for
* details.
*
* @return {String[]}
*/
getCssClassSuffixes(): string[];
}
export interface HashtagMatchConfig extends MatchConfig {
serviceName: string;
export interface HashtagMatchConfig extends AbstractMatchConfig {
serviceName: HashtagService;
hashtag: string;
}

@@ -5,6 +5,7 @@ "use strict";

var tslib_1 = require("tslib");
var match_1 = require("./match");
var utils_1 = require("../utils");
var abstract_match_1 = require("./abstract-match");
/**
* @class Autolinker.match.Hashtag
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -27,2 +28,11 @@ * Represents a Hashtag match found in an input string which should be

/**
* @public
* @property {'hashtag'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
_this.type = 'hashtag';
/**
* @cfg {String} serviceName

@@ -33,3 +43,3 @@ *

*/
_this.serviceName = ''; // default value just to get the above doc comment in the ES5 output and documentation generator
_this.serviceName = 'twitter'; // default value just to get the above doc comment in the ES5 output and documentation generator
/**

@@ -88,4 +98,5 @@ * @cfg {String} hashtag (required)

default:
// Shouldn't happen because Autolinker's constructor should block any invalid values, but just in case.
throw new Error('Unknown service name to point hashtag to: ' + serviceName);
// Shouldn't happen because Autolinker's constructor should block any invalid values, but just in case
(0, utils_1.assertNever)(serviceName);
throw new Error("Invalid hashtag service: ".concat(serviceName));
}

@@ -101,5 +112,19 @@ };

};
/**
* Returns the CSS class suffixes that should be used on a tag built with
* the match. See {@link Autolinker.match.Match#getCssClassSuffixes} for
* details.
*
* @return {String[]}
*/
HashtagMatch.prototype.getCssClassSuffixes = function () {
var cssClassSuffixes = _super.prototype.getCssClassSuffixes.call(this), serviceName = this.getServiceName();
if (serviceName) {
cssClassSuffixes.push(serviceName);
}
return cssClassSuffixes;
};
return HashtagMatch;
}(match_1.Match));
}(abstract_match_1.AbstractMatch));
exports.HashtagMatch = HashtagMatch;
//# sourceMappingURL=hashtag-match.js.map

@@ -0,6 +1,7 @@

export * from './match';
export * from './email-match';
export * from './hashtag-match';
export * from './match';
export * from './abstract-match';
export * from './mention-match';
export * from './phone-match';
export * from './url-match';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
(0, tslib_1.__exportStar)(require("./match"), exports);
(0, tslib_1.__exportStar)(require("./email-match"), exports);
(0, tslib_1.__exportStar)(require("./hashtag-match"), exports);
(0, tslib_1.__exportStar)(require("./match"), exports);
(0, tslib_1.__exportStar)(require("./abstract-match"), exports);
(0, tslib_1.__exportStar)(require("./mention-match"), exports);

@@ -8,0 +9,0 @@ (0, tslib_1.__exportStar)(require("./phone-match"), exports);

@@ -1,165 +0,7 @@

import { AnchorTagBuilder } from '../anchor-tag-builder';
/**
* @abstract
* @class Autolinker.match.Match
*
* Represents a match found in an input string which should be Autolinked. A Match object is what is provided in a
* {@link Autolinker#replaceFn replaceFn}, and may be used to query for details about the match.
*
* For example:
*
* var input = "..."; // string with URLs, Email Addresses, and Mentions (Twitter, Instagram, Soundcloud)
*
* var linkedText = Autolinker.link( input, {
* replaceFn : function( match ) {
* console.log( "href = ", match.getAnchorHref() );
* console.log( "text = ", match.getAnchorText() );
*
* switch( match.getType() ) {
* case 'url' :
* console.log( "url: ", match.getUrl() );
*
* case 'email' :
* console.log( "email: ", match.getEmail() );
*
* case 'mention' :
* console.log( "mention: ", match.getMention() );
* }
* }
* } );
*
* See the {@link Autolinker} class for more details on using the {@link Autolinker#replaceFn replaceFn}.
*/
export declare abstract class Match {
/**
* @cfg {Autolinker.AnchorTagBuilder} tagBuilder (required)
*
* Reference to the AnchorTagBuilder instance to use to generate an anchor
* tag for the Match.
*/
private __jsduckDummyDocProp;
private readonly tagBuilder;
/**
* @cfg {String} matchedText (required)
*
* The original text that was matched by the {@link Autolinker.matcher.Matcher}.
*/
protected readonly matchedText: string;
/**
* @cfg {Number} offset (required)
*
* The offset of where the match was made in the input string.
*/
private offset;
/**
* @member Autolinker.match.Match
* @method constructor
* @param {Object} cfg The configuration properties for the Match
* instance, specified in an Object (map).
*/
constructor(cfg: MatchConfig);
/**
* Returns a string name for the type of match that this class represents.
*
* @abstract
* @return {String}
*/
abstract getType(): string;
/**
* Returns the original text that was matched.
*
* @return {String}
*/
getMatchedText(): string;
/**
* Sets the {@link #offset} of where the match was made in the input string.
*
* A {@link Autolinker.matcher.Matcher} will be fed only HTML text nodes,
* and will therefore set an original offset that is relative to the HTML
* text node itself. However, we want this offset to be relative to the full
* HTML input string, and thus if using {@link Autolinker#parse} (rather
* than calling a {@link Autolinker.matcher.Matcher} directly), then this
* offset is corrected after the Matcher itself has done its job.
*
* @param {Number} offset
*/
setOffset(offset: number): void;
/**
* Returns the offset of where the match was made in the input string. This
* is the 0-based index of the match.
*
* @return {Number}
*/
getOffset(): number;
/**
* Returns the anchor href that should be generated for the match.
*
* @abstract
* @return {String}
*/
abstract getAnchorHref(): string;
/**
* Returns the anchor text that should be generated for the match.
*
* @abstract
* @return {String}
*/
abstract getAnchorText(): string;
/**
* Returns the CSS class suffix(es) for this match.
*
* A CSS class suffix is appended to the {@link Autolinker#className} in
* the {@link Autolinker.AnchorTagBuilder} when a match is translated into
* an anchor tag.
*
* For example, if {@link Autolinker#className} was configured as 'myLink',
* and this method returns `[ 'url' ]`, the final class name of the element
* will become: 'myLink myLink-url'.
*
* The match may provide multiple CSS class suffixes to be appended to the
* {@link Autolinker#className} in order to facilitate better styling
* options for different match criteria. See {@link Autolinker.match.Mention}
* for an example.
*
* By default, this method returns a single array with the match's
* {@link #getType type} name, but may be overridden by subclasses.
*
* @return {String[]}
*/
getCssClassSuffixes(): string[];
/**
* Builds and returns an {@link Autolinker.HtmlTag} instance based on the
* Match.
*
* This can be used to easily generate anchor tags from matches, and either
* return their HTML string, or modify them before doing so.
*
* Example Usage:
*
* var tag = match.buildTag();
* tag.addClass( 'cordova-link' );
* tag.setAttr( 'target', '_system' );
*
* tag.toAnchorString(); // <a href="http://google.com" class="cordova-link" target="_system">Google</a>
*
* Example Usage in {@link Autolinker#replaceFn}:
*
* var html = Autolinker.link( "Test google.com", {
* replaceFn : function( match ) {
* var tag = match.buildTag(); // returns an {@link Autolinker.HtmlTag} instance
* tag.setAttr( 'rel', 'nofollow' );
*
* return tag;
* }
* } );
*
* // generated html:
* // Test <a href="http://google.com" target="_blank" rel="nofollow">google.com</a>
*/
buildTag(): import("..").HtmlTag;
}
export interface MatchConfig {
tagBuilder: AnchorTagBuilder;
matchedText: string;
offset: number;
}
import { EmailMatch } from './email-match';
import { HashtagMatch } from './hashtag-match';
import { MentionMatch } from './mention-match';
import { PhoneMatch } from './phone-match';
import { UrlMatch } from './url-match';
export declare type Match = EmailMatch | HashtagMatch | MentionMatch | PhoneMatch | UrlMatch;
export declare type MatchType = 'email' | 'hashtag' | 'mention' | 'phone' | 'url';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Match = void 0;
/**
* @abstract
* @class Autolinker.match.Match
*
* Represents a match found in an input string which should be Autolinked. A Match object is what is provided in a
* {@link Autolinker#replaceFn replaceFn}, and may be used to query for details about the match.
*
* For example:
*
* var input = "..."; // string with URLs, Email Addresses, and Mentions (Twitter, Instagram, Soundcloud)
*
* var linkedText = Autolinker.link( input, {
* replaceFn : function( match ) {
* console.log( "href = ", match.getAnchorHref() );
* console.log( "text = ", match.getAnchorText() );
*
* switch( match.getType() ) {
* case 'url' :
* console.log( "url: ", match.getUrl() );
*
* case 'email' :
* console.log( "email: ", match.getEmail() );
*
* case 'mention' :
* console.log( "mention: ", match.getMention() );
* }
* }
* } );
*
* See the {@link Autolinker} class for more details on using the {@link Autolinker#replaceFn replaceFn}.
*/
var Match = /** @class */ (function () {
/**
* @member Autolinker.match.Match
* @method constructor
* @param {Object} cfg The configuration properties for the Match
* instance, specified in an Object (map).
*/
function Match(cfg) {
/**
* @cfg {Autolinker.AnchorTagBuilder} tagBuilder (required)
*
* Reference to the AnchorTagBuilder instance to use to generate an anchor
* tag for the Match.
*/
// @ts-ignore
this.__jsduckDummyDocProp = null; // property used just to get the above doc comment into the ES5 output and documentation generator
/**
* @cfg {String} matchedText (required)
*
* The original text that was matched by the {@link Autolinker.matcher.Matcher}.
*/
this.matchedText = ''; // default value just to get the above doc comment in the ES5 output and documentation generator
/**
* @cfg {Number} offset (required)
*
* The offset of where the match was made in the input string.
*/
this.offset = 0; // default value just to get the above doc comment in the ES5 output and documentation generator
this.tagBuilder = cfg.tagBuilder;
this.matchedText = cfg.matchedText;
this.offset = cfg.offset;
}
/**
* Returns the original text that was matched.
*
* @return {String}
*/
Match.prototype.getMatchedText = function () {
return this.matchedText;
};
/**
* Sets the {@link #offset} of where the match was made in the input string.
*
* A {@link Autolinker.matcher.Matcher} will be fed only HTML text nodes,
* and will therefore set an original offset that is relative to the HTML
* text node itself. However, we want this offset to be relative to the full
* HTML input string, and thus if using {@link Autolinker#parse} (rather
* than calling a {@link Autolinker.matcher.Matcher} directly), then this
* offset is corrected after the Matcher itself has done its job.
*
* @param {Number} offset
*/
Match.prototype.setOffset = function (offset) {
this.offset = offset;
};
/**
* Returns the offset of where the match was made in the input string. This
* is the 0-based index of the match.
*
* @return {Number}
*/
Match.prototype.getOffset = function () {
return this.offset;
};
/**
* Returns the CSS class suffix(es) for this match.
*
* A CSS class suffix is appended to the {@link Autolinker#className} in
* the {@link Autolinker.AnchorTagBuilder} when a match is translated into
* an anchor tag.
*
* For example, if {@link Autolinker#className} was configured as 'myLink',
* and this method returns `[ 'url' ]`, the final class name of the element
* will become: 'myLink myLink-url'.
*
* The match may provide multiple CSS class suffixes to be appended to the
* {@link Autolinker#className} in order to facilitate better styling
* options for different match criteria. See {@link Autolinker.match.Mention}
* for an example.
*
* By default, this method returns a single array with the match's
* {@link #getType type} name, but may be overridden by subclasses.
*
* @return {String[]}
*/
Match.prototype.getCssClassSuffixes = function () {
return [this.getType()];
};
/**
* Builds and returns an {@link Autolinker.HtmlTag} instance based on the
* Match.
*
* This can be used to easily generate anchor tags from matches, and either
* return their HTML string, or modify them before doing so.
*
* Example Usage:
*
* var tag = match.buildTag();
* tag.addClass( 'cordova-link' );
* tag.setAttr( 'target', '_system' );
*
* tag.toAnchorString(); // <a href="http://google.com" class="cordova-link" target="_system">Google</a>
*
* Example Usage in {@link Autolinker#replaceFn}:
*
* var html = Autolinker.link( "Test google.com", {
* replaceFn : function( match ) {
* var tag = match.buildTag(); // returns an {@link Autolinker.HtmlTag} instance
* tag.setAttr( 'rel', 'nofollow' );
*
* return tag;
* }
* } );
*
* // generated html:
* // Test <a href="http://google.com" target="_blank" rel="nofollow">google.com</a>
*/
Match.prototype.buildTag = function () {
return this.tagBuilder.build(this);
};
return Match;
}());
exports.Match = Match;
//# sourceMappingURL=match.js.map

@@ -1,6 +0,6 @@

import { Match, MatchConfig } from './match';
import { MentionServices } from '../autolinker';
import { MentionService } from '../parser/mention-utils';
import { AbstractMatch, AbstractMatchConfig } from './abstract-match';
/**
* @class Autolinker.match.Mention
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -11,4 +11,13 @@ * Represents a Mention match found in an input string which should be Autolinked.

*/
export declare class MentionMatch extends Match {
export declare class MentionMatch extends AbstractMatch {
/**
* @public
* @property {'mention'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
readonly type: 'mention';
/**
* @cfg {String} serviceName

@@ -38,3 +47,3 @@ *

*/
getType(): string;
getType(): 'mention';
/**

@@ -52,3 +61,3 @@ * Returns the mention, without the '@' character.

*/
getServiceName(): MentionServices;
getServiceName(): MentionService;
/**

@@ -75,5 +84,5 @@ * Returns the anchor href that should be generated for the match.

}
export interface MentionMatchConfig extends MatchConfig {
serviceName: MentionServices;
export interface MentionMatchConfig extends AbstractMatchConfig {
serviceName: MentionService;
mention: string;
}

@@ -5,6 +5,6 @@ "use strict";

var tslib_1 = require("tslib");
var match_1 = require("./match");
var abstract_match_1 = require("./abstract-match");
/**
* @class Autolinker.match.Mention
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -25,2 +25,11 @@ * Represents a Mention match found in an input string which should be Autolinked.

/**
* @public
* @property {'mention'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
_this.type = 'mention';
/**
* @cfg {String} serviceName

@@ -111,4 +120,4 @@ *

return MentionMatch;
}(match_1.Match));
}(abstract_match_1.AbstractMatch));
exports.MentionMatch = MentionMatch;
//# sourceMappingURL=mention-match.js.map

@@ -1,5 +0,5 @@

import { Match, MatchConfig } from './match';
import { AbstractMatch, AbstractMatchConfig } from './abstract-match';
/**
* @class Autolinker.match.Phone
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -12,4 +12,13 @@ * Represents a Phone number match found in an input string which should be

*/
export declare class PhoneMatch extends Match {
export declare class PhoneMatch extends AbstractMatch {
/**
* @public
* @property {'phone'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
readonly type: 'phone';
/**
* @protected

@@ -45,3 +54,3 @@ * @property {String} number (required)

*/
getType(): string;
getType(): 'phone';
/**

@@ -78,5 +87,5 @@ * Returns the phone number that was matched as a string, without any

}
export interface PhoneMatchConfig extends MatchConfig {
export interface PhoneMatchConfig extends AbstractMatchConfig {
number: string;
plusSign: boolean;
}

@@ -5,6 +5,6 @@ "use strict";

var tslib_1 = require("tslib");
var match_1 = require("./match");
var abstract_match_1 = require("./abstract-match");
/**
* @class Autolinker.match.Phone
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -27,2 +27,11 @@ * Represents a Phone number match found in an input string which should be

/**
* @public
* @property {'phone'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
_this.type = 'phone';
/**
* @protected

@@ -98,4 +107,4 @@ * @property {String} number (required)

return PhoneMatch;
}(match_1.Match));
}(abstract_match_1.AbstractMatch));
exports.PhoneMatch = PhoneMatch;
//# sourceMappingURL=phone-match.js.map

@@ -1,6 +0,6 @@

import { Match, MatchConfig } from './match';
import { StripPrefixConfigObj, UrlMatchTypeOptions } from '../autolinker';
import { AbstractMatch, AbstractMatchConfig } from './abstract-match';
import type { StripPrefixConfigObj } from '../autolinker';
/**
* @class Autolinker.match.Url
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -11,4 +11,13 @@ * Represents a Url match found in an input string which should be Autolinked.

*/
export declare class UrlMatch extends Match {
export declare class UrlMatch extends AbstractMatch {
/**
* @public
* @property {'url'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
readonly type: 'url';
/**
* @cfg {String} url (required)

@@ -29,9 +38,2 @@ *

/**
* @cfg {Boolean} protocolUrlMatch (required)
*
* `true` if the URL is a match which already has a protocol (i.e.
* 'http://'), `false` if the match was from a 'www' or known TLD match.
*/
private readonly protocolUrlMatch;
/**
* @cfg {Boolean} protocolRelativeMatch (required)

@@ -62,25 +64,2 @@ *

* @private
* @property {RegExp} schemePrefixRegex
*
* A regular expression used to remove the 'http://' or 'https://' from
* URLs.
*/
schemePrefixRegex: RegExp;
/**
* @private
* @property {RegExp} wwwPrefixRegex
*
* A regular expression used to remove the 'www.' from URLs.
*/
wwwPrefixRegex: RegExp;
/**
* @private
* @property {RegExp} protocolRelativeRegex
*
* The regular expression used to remove the protocol-relative '//' from the {@link #url} string, for purposes
* of {@link #getAnchorText}. A protocol-relative URL is, for example, "//yahoo.com"
*/
protocolRelativeRegex: RegExp;
/**
* @private
* @property {Boolean} protocolPrepended

@@ -91,3 +70,3 @@ *

*/
protocolPrepended: boolean;
private protocolPrepended;
/**

@@ -105,3 +84,3 @@ * @method constructor

*/
getType(): string;
getType(): 'url';
/**

@@ -118,3 +97,3 @@ * Returns a string name for the type of URL match that this class

*/
getUrlMatchType(): UrlMatchTypeOptions;
getUrlMatchType(): UrlMatchType;
/**

@@ -139,55 +118,6 @@ * Returns the url that was matched, assuming the protocol to be 'http://' if the original

getAnchorText(): string;
/**
* Strips the scheme prefix (such as "http://" or "https://") from the given
* `url`.
*
* @private
* @param {String} url The text of the anchor that is being generated, for
* which to strip off the url scheme.
* @return {String} The `url`, with the scheme stripped.
*/
private stripSchemePrefix;
/**
* Strips the 'www' prefix from the given `url`.
*
* @private
* @param {String} url The text of the anchor that is being generated, for
* which to strip off the 'www' if it exists.
* @return {String} The `url`, with the 'www' stripped.
*/
private stripWwwPrefix;
/**
* Strips any protocol-relative '//' from the anchor text.
*
* @private
* @param {String} text The text of the anchor that is being generated, for which to strip off the
* protocol-relative prefix (such as stripping off "//")
* @return {String} The `anchorText`, with the protocol-relative prefix stripped.
*/
private stripProtocolRelativePrefix;
/**
* Removes any trailing slash from the given `anchorText`, in preparation for the text to be displayed.
*
* @private
* @param {String} anchorText The text of the anchor that is being generated, for which to remove any trailing
* slash ('/') that may exist.
* @return {String} The `anchorText`, with the trailing slash removed.
*/
private removeTrailingSlash;
/**
* Decodes percent-encoded characters from the given `anchorText`, in
* preparation for the text to be displayed.
*
* @private
* @param {String} anchorText The text of the anchor that is being
* generated, for which to decode any percent-encoded characters.
* @return {String} The `anchorText`, with the percent-encoded characters
* decoded.
*/
private removePercentEncoding;
}
export interface UrlMatchConfig extends MatchConfig {
export interface UrlMatchConfig extends AbstractMatchConfig {
url: string;
urlMatchType: UrlMatchTypeOptions;
protocolUrlMatch: boolean;
urlMatchType: UrlMatchType;
protocolRelativeMatch: boolean;

@@ -198,1 +128,2 @@ stripPrefix: Required<StripPrefixConfigObj>;

}
export declare type UrlMatchType = 'scheme' | 'tld' | 'ipV4';

@@ -5,6 +5,17 @@ "use strict";

var tslib_1 = require("tslib");
var match_1 = require("./match");
var abstract_match_1 = require("./abstract-match");
var uri_utils_1 = require("../parser/uri-utils");
/**
* A regular expression used to remove the 'www.' from URLs.
*/
var wwwPrefixRegex = /^(https?:\/\/)?(www\.)?/i;
/**
* The regular expression used to remove the protocol-relative '//' from a URL
* string, for purposes of formatting the anchor text. A protocol-relative URL
* is, for example, "//yahoo.com"
*/
var protocolRelativeRegex = /^\/\//;
/**
* @class Autolinker.match.Url
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -25,2 +36,11 @@ * Represents a Url match found in an input string which should be Autolinked.

/**
* @public
* @property {'url'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
_this.type = 'url';
/**
* @cfg {String} url (required)

@@ -41,9 +61,2 @@ *

/**
* @cfg {Boolean} protocolUrlMatch (required)
*
* `true` if the URL is a match which already has a protocol (i.e.
* 'http://'), `false` if the match was from a 'www' or known TLD match.
*/
_this.protocolUrlMatch = false; // default value just to get the above doc comment in the ES5 output and documentation generator
/**
* @cfg {Boolean} protocolRelativeMatch (required)

@@ -77,25 +90,2 @@ *

* @private
* @property {RegExp} schemePrefixRegex
*
* A regular expression used to remove the 'http://' or 'https://' from
* URLs.
*/
_this.schemePrefixRegex = /^(https?:\/\/)?/i;
/**
* @private
* @property {RegExp} wwwPrefixRegex
*
* A regular expression used to remove the 'www.' from URLs.
*/
_this.wwwPrefixRegex = /^(https?:\/\/)?(www\.)?/i;
/**
* @private
* @property {RegExp} protocolRelativeRegex
*
* The regular expression used to remove the protocol-relative '//' from the {@link #url} string, for purposes
* of {@link #getAnchorText}. A protocol-relative URL is, for example, "//yahoo.com"
*/
_this.protocolRelativeRegex = /^\/\//;
/**
* @private
* @property {Boolean} protocolPrepended

@@ -109,3 +99,2 @@ *

_this.url = cfg.url;
_this.protocolUrlMatch = cfg.protocolUrlMatch;
_this.protocolRelativeMatch = cfg.protocolRelativeMatch;

@@ -148,4 +137,6 @@ _this.stripPrefix = cfg.stripPrefix;

var url = this.url;
// if the url string doesn't begin with a protocol, assume 'http://'
if (!this.protocolRelativeMatch && !this.protocolUrlMatch && !this.protocolPrepended) {
// if the url string doesn't begin with a scheme, assume 'http://'
if (!this.protocolRelativeMatch &&
this.urlMatchType !== 'scheme' &&
!this.protocolPrepended) {
url = this.url = 'http://' + url;

@@ -174,100 +165,99 @@ this.protocolPrepended = true;

// Strip off any protocol-relative '//' from the anchor text
anchorText = this.stripProtocolRelativePrefix(anchorText);
anchorText = stripProtocolRelativePrefix(anchorText);
}
if (this.stripPrefix.scheme) {
anchorText = this.stripSchemePrefix(anchorText);
anchorText = stripSchemePrefix(anchorText);
}
if (this.stripPrefix.www) {
anchorText = this.stripWwwPrefix(anchorText);
anchorText = stripWwwPrefix(anchorText);
}
if (this.stripTrailingSlash) {
anchorText = this.removeTrailingSlash(anchorText); // remove trailing slash, if there is one
anchorText = removeTrailingSlash(anchorText); // remove trailing slash, if there is one
}
if (this.decodePercentEncoding) {
anchorText = this.removePercentEncoding(anchorText);
anchorText = removePercentEncoding(anchorText);
}
return anchorText;
};
// ---------------------------------------
// Utility Functionality
/**
* Strips the scheme prefix (such as "http://" or "https://") from the given
* `url`.
*
* @private
* @param {String} url The text of the anchor that is being generated, for
* which to strip off the url scheme.
* @return {String} The `url`, with the scheme stripped.
*/
UrlMatch.prototype.stripSchemePrefix = function (url) {
return url.replace(this.schemePrefixRegex, '');
};
/**
* Strips the 'www' prefix from the given `url`.
*
* @private
* @param {String} url The text of the anchor that is being generated, for
* which to strip off the 'www' if it exists.
* @return {String} The `url`, with the 'www' stripped.
*/
UrlMatch.prototype.stripWwwPrefix = function (url) {
return url.replace(this.wwwPrefixRegex, '$1'); // leave any scheme ($1), it one exists
};
/**
* Strips any protocol-relative '//' from the anchor text.
*
* @private
* @param {String} text The text of the anchor that is being generated, for which to strip off the
* protocol-relative prefix (such as stripping off "//")
* @return {String} The `anchorText`, with the protocol-relative prefix stripped.
*/
UrlMatch.prototype.stripProtocolRelativePrefix = function (text) {
return text.replace(this.protocolRelativeRegex, '');
};
/**
* Removes any trailing slash from the given `anchorText`, in preparation for the text to be displayed.
*
* @private
* @param {String} anchorText The text of the anchor that is being generated, for which to remove any trailing
* slash ('/') that may exist.
* @return {String} The `anchorText`, with the trailing slash removed.
*/
UrlMatch.prototype.removeTrailingSlash = function (anchorText) {
if (anchorText.charAt(anchorText.length - 1) === '/') {
anchorText = anchorText.slice(0, -1);
}
return anchorText;
};
/**
* Decodes percent-encoded characters from the given `anchorText`, in
* preparation for the text to be displayed.
*
* @private
* @param {String} anchorText The text of the anchor that is being
* generated, for which to decode any percent-encoded characters.
* @return {String} The `anchorText`, with the percent-encoded characters
* decoded.
*/
UrlMatch.prototype.removePercentEncoding = function (anchorText) {
// First, convert a few of the known % encodings to the corresponding
// HTML entities that could accidentally be interpretted as special
// HTML characters
var preProcessedEntityAnchorText = anchorText
.replace(/%22/gi, '&quot;') // " char
.replace(/%26/gi, '&amp;') // & char
.replace(/%27/gi, '&#39;') // ' char
.replace(/%3C/gi, '&lt;') // < char
.replace(/%3E/gi, '&gt;'); // > char
try {
// Now attempt to decode the rest of the anchor text
return decodeURIComponent(preProcessedEntityAnchorText);
}
catch (e) {
// Invalid % escape sequence in the anchor text
return preProcessedEntityAnchorText;
}
};
return UrlMatch;
}(match_1.Match));
}(abstract_match_1.AbstractMatch));
exports.UrlMatch = UrlMatch;
// Utility Functionality
/**
* Strips the scheme prefix (such as "http://" or "https://") from the given
* `url`.
*
* @private
* @param {String} url The text of the anchor that is being generated, for
* which to strip off the url scheme.
* @return {String} The `url`, with the scheme stripped.
*/
function stripSchemePrefix(url) {
return url.replace(uri_utils_1.httpSchemePrefixRe, '');
}
/**
* Strips the 'www' prefix from the given `url`.
*
* @private
* @param {String} url The text of the anchor that is being generated, for
* which to strip off the 'www' if it exists.
* @return {String} The `url`, with the 'www' stripped.
*/
function stripWwwPrefix(url) {
return url.replace(wwwPrefixRegex, '$1'); // leave any scheme ($1), it one exists
}
/**
* Strips any protocol-relative '//' from the anchor text.
*
* @private
* @param {String} text The text of the anchor that is being generated, for which to strip off the
* protocol-relative prefix (such as stripping off "//")
* @return {String} The `anchorText`, with the protocol-relative prefix stripped.
*/
function stripProtocolRelativePrefix(text) {
return text.replace(protocolRelativeRegex, '');
}
/**
* Removes any trailing slash from the given `anchorText`, in preparation for the text to be displayed.
*
* @private
* @param {String} anchorText The text of the anchor that is being generated, for which to remove any trailing
* slash ('/') that may exist.
* @return {String} The `anchorText`, with the trailing slash removed.
*/
function removeTrailingSlash(anchorText) {
if (anchorText.charAt(anchorText.length - 1) === '/') {
anchorText = anchorText.slice(0, -1);
}
return anchorText;
}
/**
* Decodes percent-encoded characters from the given `anchorText`, in
* preparation for the text to be displayed.
*
* @private
* @param {String} anchorText The text of the anchor that is being
* generated, for which to decode any percent-encoded characters.
* @return {String} The `anchorText`, with the percent-encoded characters
* decoded.
*/
function removePercentEncoding(anchorText) {
// First, convert a few of the known % encodings to the corresponding
// HTML entities that could accidentally be interpretted as special
// HTML characters
var preProcessedEntityAnchorText = anchorText
.replace(/%22/gi, '&quot;') // " char
.replace(/%26/gi, '&amp;') // & char
.replace(/%27/gi, '&#39;') // ' char
.replace(/%3C/gi, '&lt;') // < char
.replace(/%3E/gi, '&gt;'); // > char
try {
// Now attempt to decode the rest of the anchor text
return decodeURIComponent(preProcessedEntityAnchorText);
}
catch (e) {
// Invalid % escape sequence in the anchor text
return preProcessedEntityAnchorText;
}
}
//# sourceMappingURL=url-match.js.map

@@ -115,5 +115,5 @@ /**

/**
* The string form of a regular expression that would match all of the
* letters and decimal number chars in the unicode character set when placed in
* a RegExp character class (`[]`).
* The regular expression that will match all of the letters and decimal number
* chars in the unicode character set when placed in a RegExp character class
* (`[]`).
*

@@ -123,3 +123,3 @@ * These would be the characters matched by unicode regex engines

*/
export declare const alphaNumericCharsStr: string;
export declare const alphaNumericCharsRe: RegExp;
/**

@@ -139,17 +139,2 @@ * The string form of a regular expression that would match all of the

*/
export declare const alphaNumericAndMarksCharRe: RegExp;
/**
* A function to match domain names of a URL or email address.
* Ex: 'google', 'yahoo', 'some-other-company', etc.
*/
export declare const getDomainNameStr: (group: number) => string;
/**
* A regular expression to match domain names of a URL or email address.
* Ex: 'google', 'yahoo', 'some-other-company', etc.
*/
export declare const domainNameRegex: RegExp;
/**
* A regular expression that is simply the character class of the characters
* that may be used in a domain name, minus the '-' or '.'
*/
export declare const domainNameCharRegex: RegExp;
export declare const alphaNumericAndMarksRe: RegExp;

@@ -10,3 +10,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.domainNameCharRegex = exports.domainNameRegex = exports.getDomainNameStr = exports.alphaNumericAndMarksCharRe = exports.alphaNumericAndMarksCharsStr = exports.alphaNumericCharsStr = exports.decimalNumbersStr = exports.alphaCharsAndMarksStr = exports.marksStr = exports.emojiStr = exports.alphaCharsStr = exports.controlCharsRe = exports.quoteRe = exports.whitespaceRe = exports.nonDigitRe = exports.digitRe = exports.letterRe = void 0;
exports.alphaNumericAndMarksRe = exports.alphaNumericAndMarksCharsStr = exports.alphaNumericCharsRe = exports.decimalNumbersStr = exports.alphaCharsAndMarksStr = exports.marksStr = exports.emojiStr = exports.alphaCharsStr = exports.controlCharsRe = exports.quoteRe = exports.whitespaceRe = exports.nonDigitRe = exports.digitRe = exports.letterRe = void 0;
/**

@@ -133,5 +133,5 @@ * Regular expression to match upper and lowercase ASCII letters

/**
* The string form of a regular expression that would match all of the
* letters and decimal number chars in the unicode character set when placed in
* a RegExp character class (`[]`).
* The regular expression that will match all of the letters and decimal number
* chars in the unicode character set when placed in a RegExp character class
* (`[]`).
*

@@ -141,3 +141,3 @@ * These would be the characters matched by unicode regex engines

*/
exports.alphaNumericCharsStr = exports.alphaCharsAndMarksStr + exports.decimalNumbersStr;
exports.alphaNumericCharsRe = new RegExp("[".concat(exports.alphaCharsStr + exports.decimalNumbersStr, "]"));
/**

@@ -157,30 +157,3 @@ * The string form of a regular expression that would match all of the

*/
exports.alphaNumericAndMarksCharRe = new RegExp("[".concat(exports.alphaNumericAndMarksCharsStr, "]"));
// Simplified IP regular expression
var ipStr = '(?:[' + exports.decimalNumbersStr + ']{1,3}\\.){3}[' + exports.decimalNumbersStr + ']{1,3}';
// Protected domain label which do not allow "-" or "_" character on the beginning and the end of a single label
// prettier-ignore
var domainLabelStr = '[' + exports.alphaNumericAndMarksCharsStr + '](?:[' + exports.alphaNumericAndMarksCharsStr + '\\-_]{0,61}[' + exports.alphaNumericAndMarksCharsStr + '])?';
var getDomainLabelStr = function (group) {
return '(?=(' + domainLabelStr + '))\\' + group;
};
/**
* A function to match domain names of a URL or email address.
* Ex: 'google', 'yahoo', 'some-other-company', etc.
*/
// prettier-ignore
var getDomainNameStr = function (group) {
return '(?:' + getDomainLabelStr(group) + '(?:\\.' + getDomainLabelStr(group + 1) + '){0,126}|' + ipStr + ')';
};
exports.getDomainNameStr = getDomainNameStr;
/**
* A regular expression to match domain names of a URL or email address.
* Ex: 'google', 'yahoo', 'some-other-company', etc.
*/
exports.domainNameRegex = new RegExp('[' + exports.alphaNumericAndMarksCharsStr + '.\\-]*[' + exports.alphaNumericAndMarksCharsStr + '\\-]');
/**
* A regular expression that is simply the character class of the characters
* that may be used in a domain name, minus the '-' or '.'
*/
exports.domainNameCharRegex = exports.alphaNumericAndMarksCharRe;
exports.alphaNumericAndMarksRe = new RegExp("[".concat(exports.alphaNumericAndMarksCharsStr, "]"));
//# sourceMappingURL=regex-lib.js.map
/**
* Simpler helper method to check for undefined simply for the benefit of
* gaining better compression when minified by not needing to have multiple
* comparisons to the `undefined` keyword in the codebase.
*/
export declare function isUndefined(value: any): value is undefined;
/**
* Simpler helper method to check for a boolean type simply for the benefit of
* gaining better compression when minified by not needing to have multiple
* `typeof` comparisons in the codebase.
*/
export declare function isBoolean(value: any): value is boolean;
/**
* Assigns (shallow copies) the properties of `src` onto `dest`, if the

@@ -22,9 +34,11 @@ * corresponding property on `dest` === `undefined`.

/**
* Supports `Array.prototype.indexOf()` functionality for old IE (IE8 and below).
* Removes array elements by value. Mutates the input array.
*
* @param {Array} arr The array to find an element of.
* @param {*} element The element to find in the array, and return the index of.
* @return {Number} The index of the `element`, or -1 if it was not found.
* Using this instead of the ES5 Array.prototype.filter() function to prevent
* creating many new arrays in memory for removing an element.
*
* @param arr The array to remove elements from. This array is mutated.
* @param fn The element to remove.
*/
export declare function indexOf<T>(arr: T[], element: T): number;
export declare function remove<T>(arr: T[], item: T): void;
/**

@@ -34,41 +48,14 @@ * Removes array elements based on a filtering function. Mutates the input

*
* Using this instead of the ES5 Array.prototype.filter() function, to allow
* Autolinker compatibility with IE8, and also to prevent creating many new
* arrays in memory for filtering.
* Using this instead of the ES5 Array.prototype.filter() function to prevent
* creating many new arrays in memory for filtering.
*
* @param {Array} arr The array to remove elements from. This array is
* mutated.
* @param {Function} fn A function which should return `true` to
* remove an element.
* @return {Array} The mutated input `arr`.
* @param arr The array to remove elements from. This array is mutated.
* @param fn The predicate function which should return `true` to remove an
* element.
*/
export declare function remove<T>(arr: T[], fn: (item: T) => boolean): void;
export declare function removeWithPredicate<T>(arr: T[], fn: (item: T) => boolean): void;
/**
* Performs the functionality of what modern browsers do when `String.prototype.split()` is called
* with a regular expression that contains capturing parenthesis.
*
* For example:
*
* // Modern browsers:
* "a,b,c".split( /(,)/ ); // --> [ 'a', ',', 'b', ',', 'c' ]
*
* // Old IE (including IE8):
* "a,b,c".split( /(,)/ ); // --> [ 'a', 'b', 'c' ]
*
* This method emulates the functionality of modern browsers for the old IE case.
*
* @param {String} str The string to split.
* @param {RegExp} splitRegex The regular expression to split the input `str` on. The splitting
* character(s) will be spliced into the array, as in the "modern browsers" example in the
* description of this method.
* Note #1: the supplied regular expression **must** have the 'g' flag specified.
* Note #2: for simplicity's sake, the regular expression does not need
* to contain capturing parenthesis - it will be assumed that any match has them.
* @return {String[]} The split array of strings, with the splitting character(s) included.
*/
export declare function splitAndCapture(str: string, splitRegex: RegExp): string[];
/**
* Function that should never be called but is used to check that every
* enum value is handled using TypeScript's 'never' type.
*/
export declare function throwUnhandledCaseError(theValue: never): void;
export declare function assertNever(theValue: never): void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.throwUnhandledCaseError = exports.splitAndCapture = exports.remove = exports.indexOf = exports.ellipsis = exports.defaults = void 0;
exports.assertNever = exports.removeWithPredicate = exports.remove = exports.ellipsis = exports.defaults = exports.isBoolean = exports.isUndefined = void 0;
/**
* Simpler helper method to check for undefined simply for the benefit of
* gaining better compression when minified by not needing to have multiple
* comparisons to the `undefined` keyword in the codebase.
*/
function isUndefined(value) {
return value === undefined;
}
exports.isUndefined = isUndefined;
/**
* Simpler helper method to check for a boolean type simply for the benefit of
* gaining better compression when minified by not needing to have multiple
* `typeof` comparisons in the codebase.
*/
function isBoolean(value) {
return typeof value === 'boolean';
}
exports.isBoolean = isBoolean;
/**
* Assigns (shallow copies) the properties of `src` onto `dest`, if the

@@ -14,3 +32,3 @@ * corresponding property on `dest` === `undefined`.

for (var prop in src) {
if (src.hasOwnProperty(prop) && dest[prop] === undefined) {
if (src.hasOwnProperty(prop) && isUndefined(dest[prop])) {
dest[prop] = src[prop];

@@ -48,24 +66,18 @@ }

/**
* Supports `Array.prototype.indexOf()` functionality for old IE (IE8 and below).
* Removes array elements by value. Mutates the input array.
*
* @param {Array} arr The array to find an element of.
* @param {*} element The element to find in the array, and return the index of.
* @return {Number} The index of the `element`, or -1 if it was not found.
* Using this instead of the ES5 Array.prototype.filter() function to prevent
* creating many new arrays in memory for removing an element.
*
* @param arr The array to remove elements from. This array is mutated.
* @param fn The element to remove.
*/
function indexOf(arr, element) {
// @ts-ignore - As far as TypeScript is concerned, this method will always
// exist (lowest "lib" in TS is "ES5"). Hence we need to ignore this error
// to support IE8 which only implements ES3 and doesn't have this method
if (Array.prototype.indexOf) {
return arr.indexOf(element);
}
else {
for (var i = 0, len = arr.length; i < len; i++) {
if (arr[i] === element)
return i;
function remove(arr, item) {
for (var i = arr.length - 1; i >= 0; i--) {
if (arr[i] === item) {
arr.splice(i, 1);
}
return -1;
}
}
exports.indexOf = indexOf;
exports.remove = remove;
/**

@@ -75,13 +87,10 @@ * Removes array elements based on a filtering function. Mutates the input

*
* Using this instead of the ES5 Array.prototype.filter() function, to allow
* Autolinker compatibility with IE8, and also to prevent creating many new
* arrays in memory for filtering.
* Using this instead of the ES5 Array.prototype.filter() function to prevent
* creating many new arrays in memory for filtering.
*
* @param {Array} arr The array to remove elements from. This array is
* mutated.
* @param {Function} fn A function which should return `true` to
* remove an element.
* @return {Array} The mutated input `arr`.
* @param arr The array to remove elements from. This array is mutated.
* @param fn The predicate function which should return `true` to remove an
* element.
*/
function remove(arr, fn) {
function removeWithPredicate(arr, fn) {
for (var i = arr.length - 1; i >= 0; i--) {

@@ -93,47 +102,11 @@ if (fn(arr[i]) === true) {

}
exports.remove = remove;
exports.removeWithPredicate = removeWithPredicate;
/**
* Performs the functionality of what modern browsers do when `String.prototype.split()` is called
* with a regular expression that contains capturing parenthesis.
*
* For example:
*
* // Modern browsers:
* "a,b,c".split( /(,)/ ); // --> [ 'a', ',', 'b', ',', 'c' ]
*
* // Old IE (including IE8):
* "a,b,c".split( /(,)/ ); // --> [ 'a', 'b', 'c' ]
*
* This method emulates the functionality of modern browsers for the old IE case.
*
* @param {String} str The string to split.
* @param {RegExp} splitRegex The regular expression to split the input `str` on. The splitting
* character(s) will be spliced into the array, as in the "modern browsers" example in the
* description of this method.
* Note #1: the supplied regular expression **must** have the 'g' flag specified.
* Note #2: for simplicity's sake, the regular expression does not need
* to contain capturing parenthesis - it will be assumed that any match has them.
* @return {String[]} The split array of strings, with the splitting character(s) included.
*/
function splitAndCapture(str, splitRegex) {
if (!splitRegex.global)
throw new Error("`splitRegex` must have the 'g' flag set");
var result = [], lastIdx = 0, match;
while ((match = splitRegex.exec(str))) {
result.push(str.substring(lastIdx, match.index));
result.push(match[0]); // push the splitting char(s)
lastIdx = match.index + match[0].length;
}
result.push(str.substring(lastIdx));
return result;
}
exports.splitAndCapture = splitAndCapture;
/**
* Function that should never be called but is used to check that every
* enum value is handled using TypeScript's 'never' type.
*/
function throwUnhandledCaseError(theValue) {
function assertNever(theValue) {
throw new Error("Unhandled case for value: '".concat(theValue, "'"));
}
exports.throwUnhandledCaseError = throwUnhandledCaseError;
exports.assertNever = assertNever;
//# sourceMappingURL=utils.js.map

@@ -1,1 +0,1 @@

export declare const version = "3.16.2";
export declare const version = "4.0.0";

@@ -6,3 +6,3 @@ "use strict";

// edited directly
exports.version = '3.16.2';
exports.version = '4.0.0';
//# sourceMappingURL=version.js.map

@@ -1,4 +0,4 @@

import { Match } from './match/match';
import { HtmlTag } from './html-tag';
import { TruncateConfigObj } from './autolinker';
import { AbstractMatch } from './match/abstract-match';
/**

@@ -55,7 +55,6 @@ * @protected

*
* @param {Autolinker.match.Match} match The Match instance to generate an
* anchor tag from.
* @return {Autolinker.HtmlTag} The HtmlTag instance for the anchor tag.
* @param match The Match instance to generate an anchor tag from.
* @return The HtmlTag instance for the anchor tag.
*/
build(match: Match): HtmlTag;
build(match: AbstractMatch): HtmlTag;
/**

@@ -66,7 +65,6 @@ * Creates the Object (map) of the HTML attributes for the anchor (&lt;a&gt;)

* @protected
* @param {Autolinker.match.Match} match The Match instance to generate an
* anchor tag from.
* @return {Object} A key/value Object (map) of the anchor tag's attributes.
* @param match The Match instance to generate an anchor tag from.
* @return A key/value Object (map) of the anchor tag's attributes.
*/
protected createAttrs(match: Match): {
protected createAttrs(match: AbstractMatch): {
[attrName: string]: string;

@@ -88,9 +86,9 @@ };

* @protected
* @param {Autolinker.match.Match} match The Match instance to generate an
* @param match The Match instance to generate an
* anchor tag from.
* @return {String} The CSS class string for the link. Example return:
* @return The CSS class string for the link. Example return:
* "myLink myLink-url". If no {@link #className} was configured, returns
* an empty string.
*/
protected createCssClass(match: Match): string;
protected createCssClass(match: AbstractMatch): string;
/**

@@ -101,5 +99,5 @@ * Processes the `anchorText` by truncating the text according to the

* @private
* @param {String} anchorText The anchor tag's text (i.e. what will be
* @param anchorText The anchor tag's text (i.e. what will be
* displayed).
* @return {String} The processed `anchorText`.
* @return The processed `anchorText`.
*/

@@ -114,5 +112,5 @@ private processAnchorText;

* @private
* @param {String} anchorText The anchor tag's text (i.e. what will be
* @param anchorText The anchor tag's text (i.e. what will be
* displayed).
* @return {String} The truncated anchor text.
* @return The truncated anchor text.
*/

@@ -119,0 +117,0 @@ private doTruncate;

@@ -61,5 +61,4 @@ import { HtmlTag } from './html-tag';

*
* @param {Autolinker.match.Match} match The Match instance to generate an
* anchor tag from.
* @return {Autolinker.HtmlTag} The HtmlTag instance for the anchor tag.
* @param match The Match instance to generate an anchor tag from.
* @return The HtmlTag instance for the anchor tag.
*/

@@ -78,5 +77,4 @@ AnchorTagBuilder.prototype.build = function (match) {

* @protected
* @param {Autolinker.match.Match} match The Match instance to generate an
* anchor tag from.
* @return {Object} A key/value Object (map) of the anchor tag's attributes.
* @param match The Match instance to generate an anchor tag from.
* @return A key/value Object (map) of the anchor tag's attributes.
*/

@@ -116,5 +114,5 @@ AnchorTagBuilder.prototype.createAttrs = function (match) {

* @protected
* @param {Autolinker.match.Match} match The Match instance to generate an
* @param match The Match instance to generate an
* anchor tag from.
* @return {String} The CSS class string for the link. Example return:
* @return The CSS class string for the link. Example return:
* "myLink myLink-url". If no {@link #className} was configured, returns

@@ -141,5 +139,5 @@ * an empty string.

* @private
* @param {String} anchorText The anchor tag's text (i.e. what will be
* @param anchorText The anchor tag's text (i.e. what will be
* displayed).
* @return {String} The processed `anchorText`.
* @return The processed `anchorText`.
*/

@@ -157,5 +155,5 @@ AnchorTagBuilder.prototype.processAnchorText = function (anchorText) {

* @private
* @param {String} anchorText The anchor tag's text (i.e. what will be
* @param anchorText The anchor tag's text (i.e. what will be
* displayed).
* @return {String} The truncated anchor text.
* @return The truncated anchor text.
*/

@@ -162,0 +160,0 @@ AnchorTagBuilder.prototype.doTruncate = function (anchorText) {

@@ -1,15 +0,5 @@

import { AnchorTagBuilder } from './anchor-tag-builder';
import { Match } from './match/match';
import { EmailMatch } from './match/email-match';
import { HashtagMatch } from './match/hashtag-match';
import { MentionMatch } from './match/mention-match';
import { PhoneMatch } from './match/phone-match';
import { UrlMatch } from './match/url-match';
import { Matcher } from './matcher/matcher';
import { HtmlTag } from './html-tag';
import { EmailMatcher } from './matcher/email-matcher';
import { UrlMatcher } from './matcher/url-matcher';
import { HashtagMatcher, HashtagService } from './matcher/hashtag-matcher';
import { PhoneMatcher } from './matcher/phone-matcher';
import { MentionMatcher } from './matcher/mention-matcher';
import { MentionService } from './parser/mention-utils';
import { HashtagService } from './parser/hashtag-utils';
/**

@@ -130,38 +120,4 @@ * @class Autolinker

*/
static readonly version = "3.16.2";
static readonly version = "4.0.0";
/**
* For backwards compatibility with Autolinker 1.x, the AnchorTagBuilder
* class is provided as a static on the Autolinker class.
*/
static readonly AnchorTagBuilder: typeof AnchorTagBuilder;
/**
* For backwards compatibility with Autolinker 1.x, the HtmlTag class is
* provided as a static on the Autolinker class.
*/
static readonly HtmlTag: typeof HtmlTag;
/**
* For backwards compatibility with Autolinker 1.x, the Matcher classes are
* provided as statics on the Autolinker class.
*/
static readonly matcher: {
Email: typeof EmailMatcher;
Hashtag: typeof HashtagMatcher;
Matcher: typeof Matcher;
Mention: typeof MentionMatcher;
Phone: typeof PhoneMatcher;
Url: typeof UrlMatcher;
};
/**
* For backwards compatibility with Autolinker 1.x, the Match classes are
* provided as statics on the Autolinker class.
*/
static readonly match: {
Email: typeof EmailMatch;
Hashtag: typeof HashtagMatch;
Match: typeof Match;
Mention: typeof MentionMatch;
Phone: typeof PhoneMatch;
Url: typeof UrlMatch;
};
/**
* Automatically links URLs, Email addresses, Phone Numbers, Twitter handles,

@@ -227,4 +183,6 @@ * Hashtags, and Mentions found in the given chunk of HTML. Does not link URLs

* Ex: 0.25.1
*
* @property {String} version
*/
readonly version = "3.16.2";
readonly version = "4.0.0";
/**

@@ -244,4 +202,4 @@ * @cfg {Boolean/Object} [urls]

* schemeMatches : true,
* wwwMatches : true,
* tldMatches : true
* tldMatches : true,
* ipV4Matches : true
* }

@@ -256,11 +214,12 @@ *

* `false` to prevent these types of matches.
* @cfg {Boolean} [urls.wwwMatches] `true` to match urls found prefixed with
* `'www.'`, i.e. `www.google.com`. `false` to prevent these types of
* matches. Note that if the URL had a prefixed scheme, and
* `schemeMatches` is true, it will still be linked.
* @cfg {Boolean} [urls.tldMatches] `true` to match URLs with known top
* level domains (.com, .net, etc.) that are not prefixed with a scheme or
* `'www.'`. This option attempts to match anything that looks like a URL
* in the given text. Ex: `google.com`, `asdf.org/?page=1`, etc. `false`
* to prevent these types of matches.
* level domains (.com, .net, etc.) that are not prefixed with a scheme
* (such as 'http://'). This option attempts to match anything that looks
* like a URL in the given text. Ex: `google.com`, `asdf.org/?page=1`, etc.
* `false` to prevent these types of matches.
* @cfg {Boolean} [urls.ipV4Matches] `true` to match IPv4 addresses in text
* that are not prefixed with a scheme (such as 'http://'). This option
* attempts to match anything that looks like an IPv4 address in text. Ex:
* `192.168.0.1`, `10.0.0.1/?page=1`, etc. `false` to prevent these types
* of matches.
*/

@@ -304,2 +263,3 @@ private readonly urls;

* - 'soundcloud'
* - 'tiktok'
*

@@ -477,12 +437,2 @@ * Defaults to `false` to skip auto-linking of mentions.

* @private
* @property {Autolinker.matcher.Matcher[]} matchers
*
* The {@link Autolinker.matcher.Matcher} instances for this Autolinker
* instance.
*
* This is lazily created in {@link #getMatchers}.
*/
private matchers;
/**
* @private
* @property {Autolinker.AnchorTagBuilder} tagBuilder

@@ -501,35 +451,2 @@ *

/**
* Normalizes the {@link #urls} config into an Object with 3 properties:
* `schemeMatches`, `wwwMatches`, and `tldMatches`, all Booleans.
*
* See {@link #urls} config for details.
*
* @private
* @param {Boolean/Object} urls
* @return {Object}
*/
private normalizeUrlsCfg;
/**
* Normalizes the {@link #stripPrefix} config into an Object with 2
* properties: `scheme`, and `www` - both Booleans.
*
* See {@link #stripPrefix} config for details.
*
* @private
* @param {Boolean/Object} stripPrefix
* @return {Object}
*/
private normalizeStripPrefixCfg;
/**
* Normalizes the {@link #truncate} config into an Object with 2 properties:
* `length` (Number), and `location` (String).
*
* See {@link #truncate} config for details.
*
* @private
* @param {Number/Object} truncate
* @return {Object}
*/
private normalizeTruncateCfg;
/**
* Parses the input `textOrHtml` looking for URLs, email addresses, phone

@@ -652,10 +569,2 @@ * numbers, username handles, and hashtags (depending on the configuration

/**
* Lazily instantiates and returns the {@link Autolinker.matcher.Matcher}
* instances for this Autolinker instance.
*
* @private
* @return {Autolinker.matcher.Matcher[]}
*/
private getMatchers;
/**
* Returns the {@link #tagBuilder} instance for this Autolinker instance,

@@ -688,6 +597,5 @@ * lazily instantiating it if it does not yet exist.

schemeMatches?: boolean;
wwwMatches?: boolean;
tldMatches?: boolean;
ipV4Matches?: boolean;
}
export declare type UrlMatchTypeOptions = 'scheme' | 'www' | 'tld';
export declare type StripPrefixConfig = boolean | StripPrefixConfigObj;

@@ -704,5 +612,4 @@ export interface StripPrefixConfigObj {

export declare type HashtagConfig = false | HashtagService;
export declare type MentionConfig = false | MentionServices;
export declare type MentionServices = 'twitter' | 'instagram' | 'soundcloud' | 'tiktok';
export declare type MentionConfig = false | MentionService;
export declare type ReplaceFn = (match: Match) => ReplaceFnReturn;
export declare type ReplaceFnReturn = boolean | string | HtmlTag | null | undefined | void;
import { version } from './version';
import { defaults, remove, splitAndCapture } from './utils';
import { defaults, isBoolean, removeWithPredicate } from './utils';
import { AnchorTagBuilder } from './anchor-tag-builder';
import { Match } from './match/match';
import { EmailMatch } from './match/email-match';
import { HashtagMatch } from './match/hashtag-match';
import { MentionMatch } from './match/mention-match';
import { PhoneMatch } from './match/phone-match';
import { UrlMatch } from './match/url-match';
import { Matcher } from './matcher/matcher';
import { HtmlTag } from './html-tag';
import { EmailMatcher } from './matcher/email-matcher';
import { UrlMatcher } from './matcher/url-matcher';
import { HashtagMatcher, hashtagServices } from './matcher/hashtag-matcher';
import { PhoneMatcher } from './matcher/phone-matcher';
import { MentionMatcher } from './matcher/mention-matcher';
import { parseMatches } from './parser/parse-matches';
import { parseHtml } from './htmlParser/parse-html';
import { mentionServices } from './parser/mention-utils';
import { hashtagServices } from './parser/hashtag-utils';
/**

@@ -136,2 +127,4 @@ * @class Autolinker

* Ex: 0.25.1
*
* @property {String} version
*/

@@ -153,4 +146,4 @@ this.version = Autolinker.version;

* schemeMatches : true,
* wwwMatches : true,
* tldMatches : true
* tldMatches : true,
* ipV4Matches : true
* }

@@ -165,11 +158,12 @@ *

* `false` to prevent these types of matches.
* @cfg {Boolean} [urls.wwwMatches] `true` to match urls found prefixed with
* `'www.'`, i.e. `www.google.com`. `false` to prevent these types of
* matches. Note that if the URL had a prefixed scheme, and
* `schemeMatches` is true, it will still be linked.
* @cfg {Boolean} [urls.tldMatches] `true` to match URLs with known top
* level domains (.com, .net, etc.) that are not prefixed with a scheme or
* `'www.'`. This option attempts to match anything that looks like a URL
* in the given text. Ex: `google.com`, `asdf.org/?page=1`, etc. `false`
* to prevent these types of matches.
* level domains (.com, .net, etc.) that are not prefixed with a scheme
* (such as 'http://'). This option attempts to match anything that looks
* like a URL in the given text. Ex: `google.com`, `asdf.org/?page=1`, etc.
* `false` to prevent these types of matches.
* @cfg {Boolean} [urls.ipV4Matches] `true` to match IPv4 addresses in text
* that are not prefixed with a scheme (such as 'http://'). This option
* attempts to match anything that looks like an IPv4 address in text. Ex:
* `192.168.0.1`, `10.0.0.1/?page=1`, etc. `false` to prevent these types
* of matches.
*/

@@ -213,2 +207,3 @@ this.urls = {}; // default value just to get the above doc comment in the ES5 output and documentation generator

* - 'soundcloud'
* - 'tiktok'
*

@@ -392,12 +387,2 @@ * Defaults to `false` to skip auto-linking of mentions.

* @private
* @property {Autolinker.matcher.Matcher[]} matchers
*
* The {@link Autolinker.matcher.Matcher} instances for this Autolinker
* instance.
*
* This is lazily created in {@link #getMatchers}.
*/
this.matchers = null;
/**
* @private
* @property {Autolinker.AnchorTagBuilder} tagBuilder

@@ -411,22 +396,19 @@ *

// it refers to the default values set above the constructor
this.urls = this.normalizeUrlsCfg(cfg.urls);
this.email = typeof cfg.email === 'boolean' ? cfg.email : this.email;
this.phone = typeof cfg.phone === 'boolean' ? cfg.phone : this.phone;
this.urls = normalizeUrlsCfg(cfg.urls);
this.email = isBoolean(cfg.email) ? cfg.email : this.email;
this.phone = isBoolean(cfg.phone) ? cfg.phone : this.phone;
this.hashtag = cfg.hashtag || this.hashtag;
this.mention = cfg.mention || this.mention;
this.newWindow = typeof cfg.newWindow === 'boolean' ? cfg.newWindow : this.newWindow;
this.stripPrefix = this.normalizeStripPrefixCfg(cfg.stripPrefix);
this.stripTrailingSlash =
typeof cfg.stripTrailingSlash === 'boolean'
? cfg.stripTrailingSlash
: this.stripTrailingSlash;
this.decodePercentEncoding =
typeof cfg.decodePercentEncoding === 'boolean'
? cfg.decodePercentEncoding
: this.decodePercentEncoding;
this.newWindow = isBoolean(cfg.newWindow) ? cfg.newWindow : this.newWindow;
this.stripPrefix = normalizeStripPrefixCfg(cfg.stripPrefix);
this.stripTrailingSlash = isBoolean(cfg.stripTrailingSlash)
? cfg.stripTrailingSlash
: this.stripTrailingSlash;
this.decodePercentEncoding = isBoolean(cfg.decodePercentEncoding)
? cfg.decodePercentEncoding
: this.decodePercentEncoding;
this.sanitizeHtml = cfg.sanitizeHtml || false;
// Validate the value of the `mention` cfg
var mention = this.mention;
if (mention !== false &&
['twitter', 'instagram', 'soundcloud', 'tiktok'].indexOf(mention) === -1) {
if (mention !== false && mentionServices.indexOf(mention) === -1) {
throw new Error("invalid `mention` cfg '".concat(mention, "' - see docs"));

@@ -439,3 +421,3 @@ }

}
this.truncate = this.normalizeTruncateCfg(cfg.truncate);
this.truncate = normalizeTruncateCfg(cfg.truncate);
this.className = cfg.className || this.className;

@@ -509,73 +491,2 @@ this.replaceFn = cfg.replaceFn || this.replaceFn;

/**
* Normalizes the {@link #urls} config into an Object with 3 properties:
* `schemeMatches`, `wwwMatches`, and `tldMatches`, all Booleans.
*
* See {@link #urls} config for details.
*
* @private
* @param {Boolean/Object} urls
* @return {Object}
*/
Autolinker.prototype.normalizeUrlsCfg = function (urls) {
if (urls == null)
urls = true; // default to `true`
if (typeof urls === 'boolean') {
return { schemeMatches: urls, wwwMatches: urls, tldMatches: urls };
}
else {
// object form
return {
schemeMatches: typeof urls.schemeMatches === 'boolean' ? urls.schemeMatches : true,
wwwMatches: typeof urls.wwwMatches === 'boolean' ? urls.wwwMatches : true,
tldMatches: typeof urls.tldMatches === 'boolean' ? urls.tldMatches : true,
};
}
};
/**
* Normalizes the {@link #stripPrefix} config into an Object with 2
* properties: `scheme`, and `www` - both Booleans.
*
* See {@link #stripPrefix} config for details.
*
* @private
* @param {Boolean/Object} stripPrefix
* @return {Object}
*/
Autolinker.prototype.normalizeStripPrefixCfg = function (stripPrefix) {
if (stripPrefix == null)
stripPrefix = true; // default to `true`
if (typeof stripPrefix === 'boolean') {
return { scheme: stripPrefix, www: stripPrefix };
}
else {
// object form
return {
scheme: typeof stripPrefix.scheme === 'boolean' ? stripPrefix.scheme : true,
www: typeof stripPrefix.www === 'boolean' ? stripPrefix.www : true,
};
}
};
/**
* Normalizes the {@link #truncate} config into an Object with 2 properties:
* `length` (Number), and `location` (String).
*
* See {@link #truncate} config for details.
*
* @private
* @param {Number/Object} truncate
* @return {Object}
*/
Autolinker.prototype.normalizeTruncateCfg = function (truncate) {
if (typeof truncate === 'number') {
return { length: truncate, location: 'end' };
}
else {
// object, or undefined/null
return defaults(truncate || {}, {
length: Number.POSITIVE_INFINITY,
location: 'end',
});
}
};
/**
* Parses the input `textOrHtml` looking for URLs, email addresses, phone

@@ -631,4 +542,4 @@ * numbers, username handles, and hashtags (depending on the configuration

// don't emit them as "text" except for &amp; entities
var htmlCharacterEntitiesRegex = /(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi;
var textSplit = splitAndCapture(text, htmlCharacterEntitiesRegex);
var htmlCharacterEntitiesRegex = /(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi; // NOTE: capturing group is significant to include the split characters in the .split() call below
var textSplit = text.split(htmlCharacterEntitiesRegex);
var currentOffset_1 = offset;

@@ -650,4 +561,4 @@ textSplit.forEach(function (splitText, i) {

},
onComment: function (offset) { },
onDoctype: function (offset) { }, // no need to process doctype nodes
onComment: function (_offset) { },
onDoctype: function (_offset) { }, // no need to process doctype nodes
});

@@ -721,28 +632,28 @@ // After we have found all matches, remove subsequent matches that

if (!this.hashtag)
remove(matches, function (match) {
removeWithPredicate(matches, function (match) {
return match.getType() === 'hashtag';
});
if (!this.email)
remove(matches, function (match) {
removeWithPredicate(matches, function (match) {
return match.getType() === 'email';
});
if (!this.phone)
remove(matches, function (match) {
removeWithPredicate(matches, function (match) {
return match.getType() === 'phone';
});
if (!this.mention)
remove(matches, function (match) {
removeWithPredicate(matches, function (match) {
return match.getType() === 'mention';
});
if (!this.urls.schemeMatches) {
remove(matches, function (m) {
removeWithPredicate(matches, function (m) {
return m.getType() === 'url' && m.getUrlMatchType() === 'scheme';
});
}
if (!this.urls.wwwMatches) {
remove(matches, function (m) { return m.getType() === 'url' && m.getUrlMatchType() === 'www'; });
}
if (!this.urls.tldMatches) {
remove(matches, function (m) { return m.getType() === 'url' && m.getUrlMatchType() === 'tld'; });
removeWithPredicate(matches, function (m) { return m.getType() === 'url' && m.getUrlMatchType() === 'tld'; });
}
if (!this.urls.ipV4Matches) {
removeWithPredicate(matches, function (m) { return m.getType() === 'url' && m.getUrlMatchType() === 'ipV4'; });
}
return matches;

@@ -774,13 +685,16 @@ };

offset = offset || 0;
var matchers = this.getMatchers(), matches = [];
for (var i = 0, numMatchers = matchers.length; i < numMatchers; i++) {
var textMatches = matchers[i].parseMatches(text);
// Correct the offset of each of the matches. They are originally
// the offset of the match within the provided text node, but we
// need to correct them to be relative to the original HTML input
// string (i.e. the one provided to #parse).
for (var j = 0, numTextMatches = textMatches.length; j < numTextMatches; j++) {
textMatches[j].setOffset(offset + textMatches[j].getOffset());
}
matches.push.apply(matches, textMatches);
var matches = parseMatches(text, {
tagBuilder: this.getTagBuilder(),
stripPrefix: this.stripPrefix,
stripTrailingSlash: this.stripTrailingSlash,
decodePercentEncoding: this.decodePercentEncoding,
hashtagServiceName: this.hashtag,
mentionServiceName: this.mention || 'twitter',
});
// Correct the offset of each of the matches. They are originally
// the offset of the match within the provided text node, but we
// need to correct them to be relative to the original HTML input
// string (i.e. the one provided to #parse).
for (var i = 0, numTextMatches = matches.length; i < numTextMatches; i++) {
matches[i].setOffset(offset + matches[i].getOffset());
}

@@ -863,36 +777,2 @@ return matches;

/**
* Lazily instantiates and returns the {@link Autolinker.matcher.Matcher}
* instances for this Autolinker instance.
*
* @private
* @return {Autolinker.matcher.Matcher[]}
*/
Autolinker.prototype.getMatchers = function () {
if (!this.matchers) {
var tagBuilder = this.getTagBuilder();
var matchers = [
new HashtagMatcher({
tagBuilder: tagBuilder,
serviceName: this.hashtag,
}),
new EmailMatcher({ tagBuilder: tagBuilder }),
new PhoneMatcher({ tagBuilder: tagBuilder }),
new MentionMatcher({
tagBuilder: tagBuilder,
serviceName: this.mention,
}),
new UrlMatcher({
tagBuilder: tagBuilder,
stripPrefix: this.stripPrefix,
stripTrailingSlash: this.stripTrailingSlash,
decodePercentEncoding: this.decodePercentEncoding,
}),
];
return (this.matchers = matchers);
}
else {
return this.matchers;
}
};
/**
* Returns the {@link #tagBuilder} instance for this Autolinker instance,

@@ -925,39 +805,76 @@ * lazily instantiating it if it does not yet exist.

Autolinker.version = version;
/**
* For backwards compatibility with Autolinker 1.x, the AnchorTagBuilder
* class is provided as a static on the Autolinker class.
*/
Autolinker.AnchorTagBuilder = AnchorTagBuilder;
/**
* For backwards compatibility with Autolinker 1.x, the HtmlTag class is
* provided as a static on the Autolinker class.
*/
Autolinker.HtmlTag = HtmlTag;
/**
* For backwards compatibility with Autolinker 1.x, the Matcher classes are
* provided as statics on the Autolinker class.
*/
Autolinker.matcher = {
Email: EmailMatcher,
Hashtag: HashtagMatcher,
Matcher: Matcher,
Mention: MentionMatcher,
Phone: PhoneMatcher,
Url: UrlMatcher,
};
/**
* For backwards compatibility with Autolinker 1.x, the Match classes are
* provided as statics on the Autolinker class.
*/
Autolinker.match = {
Email: EmailMatch,
Hashtag: HashtagMatch,
Match: Match,
Mention: MentionMatch,
Phone: PhoneMatch,
Url: UrlMatch,
};
return Autolinker;
}());
export default Autolinker;
/**
* Normalizes the {@link #urls} config into an Object with its 2 properties:
* `schemeMatches` and `tldMatches`, both booleans.
*
* See {@link #urls} config for details.
*
* @private
* @param {Boolean/Object} urls
* @return {Object}
*/
function normalizeUrlsCfg(urls) {
if (urls == null)
urls = true; // default to `true`
if (isBoolean(urls)) {
return { schemeMatches: urls, tldMatches: urls, ipV4Matches: urls };
}
else {
// object form
return {
schemeMatches: isBoolean(urls.schemeMatches) ? urls.schemeMatches : true,
tldMatches: isBoolean(urls.tldMatches) ? urls.tldMatches : true,
ipV4Matches: isBoolean(urls.ipV4Matches) ? urls.ipV4Matches : true,
};
}
}
/**
* Normalizes the {@link #stripPrefix} config into an Object with 2
* properties: `scheme`, and `www` - both Booleans.
*
* See {@link #stripPrefix} config for details.
*
* @private
* @param {Boolean/Object} stripPrefix
* @return {Object}
*/
function normalizeStripPrefixCfg(stripPrefix) {
if (stripPrefix == null)
stripPrefix = true; // default to `true`
if (isBoolean(stripPrefix)) {
return { scheme: stripPrefix, www: stripPrefix };
}
else {
// object form
return {
scheme: isBoolean(stripPrefix.scheme) ? stripPrefix.scheme : true,
www: isBoolean(stripPrefix.www) ? stripPrefix.www : true,
};
}
}
/**
* Normalizes the {@link #truncate} config into an Object with 2 properties:
* `length` (Number), and `location` (String).
*
* See {@link #truncate} config for details.
*
* @private
* @param {Number/Object} truncate
* @return {Object}
*/
function normalizeTruncateCfg(truncate) {
if (typeof truncate === 'number') {
return { length: truncate, location: 'end' };
}
else {
// object, or undefined/null
return defaults(truncate || {}, {
length: Number.POSITIVE_INFINITY,
location: 'end',
});
}
}
//# sourceMappingURL=autolinker.js.map

@@ -99,9 +99,2 @@ /**

/**
* @protected
* @property {RegExp} whitespaceRegex
*
* Regular expression used to match whitespace in a string of CSS classes.
*/
protected whitespaceRegex: RegExp;
/**
* @method constructor

@@ -218,3 +211,3 @@ * @param {Object} [cfg] The configuration properties for this class, in an Object (map)

/**
* Override of superclass method used to generate the HTML string for the tag.
* Generates the HTML string for the tag.
*

@@ -221,0 +214,0 @@ * @return {String}

@@ -1,2 +0,2 @@

import { indexOf } from './utils';
import { whitespaceRe } from './regex-lib';
/**

@@ -105,9 +105,2 @@ * @class Autolinker.HtmlTag

this.innerHTML = ''; // default value just to get the above doc comment in the ES5 output and documentation generator
/**
* @protected
* @property {RegExp} whitespaceRegex
*
* Regular expression used to match whitespace in a string of CSS classes.
*/
this.whitespaceRegex = /\s+/; // default value just to get the above doc comment in the ES5 output and documentation generator
this.tagName = cfg.tagName || '';

@@ -190,5 +183,5 @@ this.attrs = cfg.attrs || {};

HtmlTag.prototype.addClass = function (cssClass) {
var classAttr = this.getClass(), whitespaceRegex = this.whitespaceRegex, classes = !classAttr ? [] : classAttr.split(whitespaceRegex), newClasses = cssClass.split(whitespaceRegex), newClass;
var classAttr = this.getClass(), classes = !classAttr ? [] : classAttr.split(whitespaceRe), newClasses = cssClass.split(whitespaceRe), newClass;
while ((newClass = newClasses.shift())) {
if (indexOf(classes, newClass) === -1) {
if (classes.indexOf(newClass) === -1) {
classes.push(newClass);

@@ -207,5 +200,5 @@ }

HtmlTag.prototype.removeClass = function (cssClass) {
var classAttr = this.getClass(), whitespaceRegex = this.whitespaceRegex, classes = !classAttr ? [] : classAttr.split(whitespaceRegex), removeClasses = cssClass.split(whitespaceRegex), removeClass;
var classAttr = this.getClass(), classes = !classAttr ? [] : classAttr.split(whitespaceRe), removeClasses = cssClass.split(whitespaceRe), removeClass;
while (classes.length && (removeClass = removeClasses.shift())) {
var idx = indexOf(classes, removeClass);
var idx = classes.indexOf(removeClass);
if (idx !== -1) {

@@ -272,3 +265,3 @@ classes.splice(idx, 1);

/**
* Override of superclass method used to generate the HTML string for the tag.
* Generates the HTML string for the tag.
*

@@ -275,0 +268,0 @@ * @return {String}

import { __assign } from "tslib";
import { letterRe, digitRe, whitespaceRe, quoteRe, controlCharsRe } from '../regex-lib';
import { throwUnhandledCaseError } from '../utils';
import { assertNever } from '../utils';
// For debugging: search for other "For debugging" lines

@@ -138,3 +138,3 @@ // import CliTable from 'cli-table';

default:
throwUnhandledCaseError(state);
assertNever(state);
}

@@ -141,0 +141,0 @@ // For debugging: search for other "For debugging" lines

@@ -8,2 +8,2 @@ import Autolinker from './autolinker';

export * from './match/index';
export * from './matcher/index';
export * from './parser/index';

@@ -12,3 +12,3 @@ // WARNING: This file is modified a bit when it is compiled into index.js in

export * from './match/index';
export * from './matcher/index';
export * from './parser/index';
//# sourceMappingURL=index.js.map

@@ -1,5 +0,5 @@

import { Match, MatchConfig } from './match';
import { AbstractMatchConfig, AbstractMatch } from './abstract-match';
/**
* @class Autolinker.match.Email
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -10,4 +10,13 @@ * Represents a Email match found in an input string which should be Autolinked.

*/
export declare class EmailMatch extends Match {
export declare class EmailMatch extends AbstractMatch {
/**
* @public
* @property {'email'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
readonly type: 'email';
/**
* @cfg {String} email (required)

@@ -30,3 +39,3 @@ *

*/
getType(): string;
getType(): 'email';
/**

@@ -51,4 +60,4 @@ * Returns the email address that was matched.

}
export interface EmailMatchConfig extends MatchConfig {
export interface EmailMatchConfig extends AbstractMatchConfig {
email: string;
}
import { __extends } from "tslib";
import { Match } from './match';
import { AbstractMatch } from './abstract-match';
/**
* @class Autolinker.match.Email
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -21,2 +21,11 @@ * Represents a Email match found in an input string which should be Autolinked.

/**
* @public
* @property {'email'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
_this.type = 'email';
/**
* @cfg {String} email (required)

@@ -64,4 +73,4 @@ *

return EmailMatch;
}(Match));
}(AbstractMatch));
export { EmailMatch };
//# sourceMappingURL=email-match.js.map

@@ -1,5 +0,6 @@

import { Match, MatchConfig } from './match';
import { HashtagService } from '../parser/hashtag-utils';
import { AbstractMatch, AbstractMatchConfig } from './abstract-match';
/**
* @class Autolinker.match.Hashtag
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -12,4 +13,13 @@ * Represents a Hashtag match found in an input string which should be

*/
export declare class HashtagMatch extends Match {
export declare class HashtagMatch extends AbstractMatch {
/**
* @public
* @property {'hashtag'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
readonly type: 'hashtag';
/**
* @cfg {String} serviceName

@@ -39,3 +49,3 @@ *

*/
getType(): string;
getType(): 'hashtag';
/**

@@ -47,3 +57,3 @@ * Returns the configured {@link #serviceName} to point the HashtagMatch to.

*/
getServiceName(): string;
getServiceName(): HashtagService;
/**

@@ -67,6 +77,14 @@ * Returns the matched hashtag, without the '#' character.

getAnchorText(): string;
/**
* Returns the CSS class suffixes that should be used on a tag built with
* the match. See {@link Autolinker.match.Match#getCssClassSuffixes} for
* details.
*
* @return {String[]}
*/
getCssClassSuffixes(): string[];
}
export interface HashtagMatchConfig extends MatchConfig {
serviceName: string;
export interface HashtagMatchConfig extends AbstractMatchConfig {
serviceName: HashtagService;
hashtag: string;
}
import { __extends } from "tslib";
import { Match } from './match';
import { assertNever } from '../utils';
import { AbstractMatch } from './abstract-match';
/**
* @class Autolinker.match.Hashtag
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -23,2 +24,11 @@ * Represents a Hashtag match found in an input string which should be

/**
* @public
* @property {'hashtag'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
_this.type = 'hashtag';
/**
* @cfg {String} serviceName

@@ -29,3 +39,3 @@ *

*/
_this.serviceName = ''; // default value just to get the above doc comment in the ES5 output and documentation generator
_this.serviceName = 'twitter'; // default value just to get the above doc comment in the ES5 output and documentation generator
/**

@@ -84,4 +94,5 @@ * @cfg {String} hashtag (required)

default:
// Shouldn't happen because Autolinker's constructor should block any invalid values, but just in case.
throw new Error('Unknown service name to point hashtag to: ' + serviceName);
// Shouldn't happen because Autolinker's constructor should block any invalid values, but just in case
assertNever(serviceName);
throw new Error("Invalid hashtag service: ".concat(serviceName));
}

@@ -97,5 +108,19 @@ };

};
/**
* Returns the CSS class suffixes that should be used on a tag built with
* the match. See {@link Autolinker.match.Match#getCssClassSuffixes} for
* details.
*
* @return {String[]}
*/
HashtagMatch.prototype.getCssClassSuffixes = function () {
var cssClassSuffixes = _super.prototype.getCssClassSuffixes.call(this), serviceName = this.getServiceName();
if (serviceName) {
cssClassSuffixes.push(serviceName);
}
return cssClassSuffixes;
};
return HashtagMatch;
}(Match));
}(AbstractMatch));
export { HashtagMatch };
//# sourceMappingURL=hashtag-match.js.map

@@ -0,6 +1,7 @@

export * from './match';
export * from './email-match';
export * from './hashtag-match';
export * from './match';
export * from './abstract-match';
export * from './mention-match';
export * from './phone-match';
export * from './url-match';

@@ -0,4 +1,5 @@

export * from './match';
export * from './email-match';
export * from './hashtag-match';
export * from './match';
export * from './abstract-match';
export * from './mention-match';

@@ -5,0 +6,0 @@ export * from './phone-match';

@@ -1,165 +0,7 @@

import { AnchorTagBuilder } from '../anchor-tag-builder';
/**
* @abstract
* @class Autolinker.match.Match
*
* Represents a match found in an input string which should be Autolinked. A Match object is what is provided in a
* {@link Autolinker#replaceFn replaceFn}, and may be used to query for details about the match.
*
* For example:
*
* var input = "..."; // string with URLs, Email Addresses, and Mentions (Twitter, Instagram, Soundcloud)
*
* var linkedText = Autolinker.link( input, {
* replaceFn : function( match ) {
* console.log( "href = ", match.getAnchorHref() );
* console.log( "text = ", match.getAnchorText() );
*
* switch( match.getType() ) {
* case 'url' :
* console.log( "url: ", match.getUrl() );
*
* case 'email' :
* console.log( "email: ", match.getEmail() );
*
* case 'mention' :
* console.log( "mention: ", match.getMention() );
* }
* }
* } );
*
* See the {@link Autolinker} class for more details on using the {@link Autolinker#replaceFn replaceFn}.
*/
export declare abstract class Match {
/**
* @cfg {Autolinker.AnchorTagBuilder} tagBuilder (required)
*
* Reference to the AnchorTagBuilder instance to use to generate an anchor
* tag for the Match.
*/
private __jsduckDummyDocProp;
private readonly tagBuilder;
/**
* @cfg {String} matchedText (required)
*
* The original text that was matched by the {@link Autolinker.matcher.Matcher}.
*/
protected readonly matchedText: string;
/**
* @cfg {Number} offset (required)
*
* The offset of where the match was made in the input string.
*/
private offset;
/**
* @member Autolinker.match.Match
* @method constructor
* @param {Object} cfg The configuration properties for the Match
* instance, specified in an Object (map).
*/
constructor(cfg: MatchConfig);
/**
* Returns a string name for the type of match that this class represents.
*
* @abstract
* @return {String}
*/
abstract getType(): string;
/**
* Returns the original text that was matched.
*
* @return {String}
*/
getMatchedText(): string;
/**
* Sets the {@link #offset} of where the match was made in the input string.
*
* A {@link Autolinker.matcher.Matcher} will be fed only HTML text nodes,
* and will therefore set an original offset that is relative to the HTML
* text node itself. However, we want this offset to be relative to the full
* HTML input string, and thus if using {@link Autolinker#parse} (rather
* than calling a {@link Autolinker.matcher.Matcher} directly), then this
* offset is corrected after the Matcher itself has done its job.
*
* @param {Number} offset
*/
setOffset(offset: number): void;
/**
* Returns the offset of where the match was made in the input string. This
* is the 0-based index of the match.
*
* @return {Number}
*/
getOffset(): number;
/**
* Returns the anchor href that should be generated for the match.
*
* @abstract
* @return {String}
*/
abstract getAnchorHref(): string;
/**
* Returns the anchor text that should be generated for the match.
*
* @abstract
* @return {String}
*/
abstract getAnchorText(): string;
/**
* Returns the CSS class suffix(es) for this match.
*
* A CSS class suffix is appended to the {@link Autolinker#className} in
* the {@link Autolinker.AnchorTagBuilder} when a match is translated into
* an anchor tag.
*
* For example, if {@link Autolinker#className} was configured as 'myLink',
* and this method returns `[ 'url' ]`, the final class name of the element
* will become: 'myLink myLink-url'.
*
* The match may provide multiple CSS class suffixes to be appended to the
* {@link Autolinker#className} in order to facilitate better styling
* options for different match criteria. See {@link Autolinker.match.Mention}
* for an example.
*
* By default, this method returns a single array with the match's
* {@link #getType type} name, but may be overridden by subclasses.
*
* @return {String[]}
*/
getCssClassSuffixes(): string[];
/**
* Builds and returns an {@link Autolinker.HtmlTag} instance based on the
* Match.
*
* This can be used to easily generate anchor tags from matches, and either
* return their HTML string, or modify them before doing so.
*
* Example Usage:
*
* var tag = match.buildTag();
* tag.addClass( 'cordova-link' );
* tag.setAttr( 'target', '_system' );
*
* tag.toAnchorString(); // <a href="http://google.com" class="cordova-link" target="_system">Google</a>
*
* Example Usage in {@link Autolinker#replaceFn}:
*
* var html = Autolinker.link( "Test google.com", {
* replaceFn : function( match ) {
* var tag = match.buildTag(); // returns an {@link Autolinker.HtmlTag} instance
* tag.setAttr( 'rel', 'nofollow' );
*
* return tag;
* }
* } );
*
* // generated html:
* // Test <a href="http://google.com" target="_blank" rel="nofollow">google.com</a>
*/
buildTag(): import("..").HtmlTag;
}
export interface MatchConfig {
tagBuilder: AnchorTagBuilder;
matchedText: string;
offset: number;
}
import { EmailMatch } from './email-match';
import { HashtagMatch } from './hashtag-match';
import { MentionMatch } from './mention-match';
import { PhoneMatch } from './phone-match';
import { UrlMatch } from './url-match';
export declare type Match = EmailMatch | HashtagMatch | MentionMatch | PhoneMatch | UrlMatch;
export declare type MatchType = 'email' | 'hashtag' | 'mention' | 'phone' | 'url';

@@ -1,155 +0,2 @@

/**
* @abstract
* @class Autolinker.match.Match
*
* Represents a match found in an input string which should be Autolinked. A Match object is what is provided in a
* {@link Autolinker#replaceFn replaceFn}, and may be used to query for details about the match.
*
* For example:
*
* var input = "..."; // string with URLs, Email Addresses, and Mentions (Twitter, Instagram, Soundcloud)
*
* var linkedText = Autolinker.link( input, {
* replaceFn : function( match ) {
* console.log( "href = ", match.getAnchorHref() );
* console.log( "text = ", match.getAnchorText() );
*
* switch( match.getType() ) {
* case 'url' :
* console.log( "url: ", match.getUrl() );
*
* case 'email' :
* console.log( "email: ", match.getEmail() );
*
* case 'mention' :
* console.log( "mention: ", match.getMention() );
* }
* }
* } );
*
* See the {@link Autolinker} class for more details on using the {@link Autolinker#replaceFn replaceFn}.
*/
var Match = /** @class */ (function () {
/**
* @member Autolinker.match.Match
* @method constructor
* @param {Object} cfg The configuration properties for the Match
* instance, specified in an Object (map).
*/
function Match(cfg) {
/**
* @cfg {Autolinker.AnchorTagBuilder} tagBuilder (required)
*
* Reference to the AnchorTagBuilder instance to use to generate an anchor
* tag for the Match.
*/
// @ts-ignore
this.__jsduckDummyDocProp = null; // property used just to get the above doc comment into the ES5 output and documentation generator
/**
* @cfg {String} matchedText (required)
*
* The original text that was matched by the {@link Autolinker.matcher.Matcher}.
*/
this.matchedText = ''; // default value just to get the above doc comment in the ES5 output and documentation generator
/**
* @cfg {Number} offset (required)
*
* The offset of where the match was made in the input string.
*/
this.offset = 0; // default value just to get the above doc comment in the ES5 output and documentation generator
this.tagBuilder = cfg.tagBuilder;
this.matchedText = cfg.matchedText;
this.offset = cfg.offset;
}
/**
* Returns the original text that was matched.
*
* @return {String}
*/
Match.prototype.getMatchedText = function () {
return this.matchedText;
};
/**
* Sets the {@link #offset} of where the match was made in the input string.
*
* A {@link Autolinker.matcher.Matcher} will be fed only HTML text nodes,
* and will therefore set an original offset that is relative to the HTML
* text node itself. However, we want this offset to be relative to the full
* HTML input string, and thus if using {@link Autolinker#parse} (rather
* than calling a {@link Autolinker.matcher.Matcher} directly), then this
* offset is corrected after the Matcher itself has done its job.
*
* @param {Number} offset
*/
Match.prototype.setOffset = function (offset) {
this.offset = offset;
};
/**
* Returns the offset of where the match was made in the input string. This
* is the 0-based index of the match.
*
* @return {Number}
*/
Match.prototype.getOffset = function () {
return this.offset;
};
/**
* Returns the CSS class suffix(es) for this match.
*
* A CSS class suffix is appended to the {@link Autolinker#className} in
* the {@link Autolinker.AnchorTagBuilder} when a match is translated into
* an anchor tag.
*
* For example, if {@link Autolinker#className} was configured as 'myLink',
* and this method returns `[ 'url' ]`, the final class name of the element
* will become: 'myLink myLink-url'.
*
* The match may provide multiple CSS class suffixes to be appended to the
* {@link Autolinker#className} in order to facilitate better styling
* options for different match criteria. See {@link Autolinker.match.Mention}
* for an example.
*
* By default, this method returns a single array with the match's
* {@link #getType type} name, but may be overridden by subclasses.
*
* @return {String[]}
*/
Match.prototype.getCssClassSuffixes = function () {
return [this.getType()];
};
/**
* Builds and returns an {@link Autolinker.HtmlTag} instance based on the
* Match.
*
* This can be used to easily generate anchor tags from matches, and either
* return their HTML string, or modify them before doing so.
*
* Example Usage:
*
* var tag = match.buildTag();
* tag.addClass( 'cordova-link' );
* tag.setAttr( 'target', '_system' );
*
* tag.toAnchorString(); // <a href="http://google.com" class="cordova-link" target="_system">Google</a>
*
* Example Usage in {@link Autolinker#replaceFn}:
*
* var html = Autolinker.link( "Test google.com", {
* replaceFn : function( match ) {
* var tag = match.buildTag(); // returns an {@link Autolinker.HtmlTag} instance
* tag.setAttr( 'rel', 'nofollow' );
*
* return tag;
* }
* } );
*
* // generated html:
* // Test <a href="http://google.com" target="_blank" rel="nofollow">google.com</a>
*/
Match.prototype.buildTag = function () {
return this.tagBuilder.build(this);
};
return Match;
}());
export { Match };
export {};
//# sourceMappingURL=match.js.map

@@ -1,6 +0,6 @@

import { Match, MatchConfig } from './match';
import { MentionServices } from '../autolinker';
import { MentionService } from '../parser/mention-utils';
import { AbstractMatch, AbstractMatchConfig } from './abstract-match';
/**
* @class Autolinker.match.Mention
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -11,4 +11,13 @@ * Represents a Mention match found in an input string which should be Autolinked.

*/
export declare class MentionMatch extends Match {
export declare class MentionMatch extends AbstractMatch {
/**
* @public
* @property {'mention'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
readonly type: 'mention';
/**
* @cfg {String} serviceName

@@ -38,3 +47,3 @@ *

*/
getType(): string;
getType(): 'mention';
/**

@@ -52,3 +61,3 @@ * Returns the mention, without the '@' character.

*/
getServiceName(): MentionServices;
getServiceName(): MentionService;
/**

@@ -75,5 +84,5 @@ * Returns the anchor href that should be generated for the match.

}
export interface MentionMatchConfig extends MatchConfig {
serviceName: MentionServices;
export interface MentionMatchConfig extends AbstractMatchConfig {
serviceName: MentionService;
mention: string;
}
import { __extends } from "tslib";
import { Match } from './match';
import { AbstractMatch } from './abstract-match';
/**
* @class Autolinker.match.Mention
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -21,2 +21,11 @@ * Represents a Mention match found in an input string which should be Autolinked.

/**
* @public
* @property {'mention'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
_this.type = 'mention';
/**
* @cfg {String} serviceName

@@ -107,4 +116,4 @@ *

return MentionMatch;
}(Match));
}(AbstractMatch));
export { MentionMatch };
//# sourceMappingURL=mention-match.js.map

@@ -1,5 +0,5 @@

import { Match, MatchConfig } from './match';
import { AbstractMatch, AbstractMatchConfig } from './abstract-match';
/**
* @class Autolinker.match.Phone
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -12,4 +12,13 @@ * Represents a Phone number match found in an input string which should be

*/
export declare class PhoneMatch extends Match {
export declare class PhoneMatch extends AbstractMatch {
/**
* @public
* @property {'phone'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
readonly type: 'phone';
/**
* @protected

@@ -45,3 +54,3 @@ * @property {String} number (required)

*/
getType(): string;
getType(): 'phone';
/**

@@ -78,5 +87,5 @@ * Returns the phone number that was matched as a string, without any

}
export interface PhoneMatchConfig extends MatchConfig {
export interface PhoneMatchConfig extends AbstractMatchConfig {
number: string;
plusSign: boolean;
}
import { __extends } from "tslib";
import { Match } from './match';
import { AbstractMatch } from './abstract-match';
/**
* @class Autolinker.match.Phone
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -23,2 +23,11 @@ * Represents a Phone number match found in an input string which should be

/**
* @public
* @property {'phone'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
_this.type = 'phone';
/**
* @protected

@@ -94,4 +103,4 @@ * @property {String} number (required)

return PhoneMatch;
}(Match));
}(AbstractMatch));
export { PhoneMatch };
//# sourceMappingURL=phone-match.js.map

@@ -1,6 +0,6 @@

import { Match, MatchConfig } from './match';
import { StripPrefixConfigObj, UrlMatchTypeOptions } from '../autolinker';
import { AbstractMatch, AbstractMatchConfig } from './abstract-match';
import type { StripPrefixConfigObj } from '../autolinker';
/**
* @class Autolinker.match.Url
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -11,4 +11,13 @@ * Represents a Url match found in an input string which should be Autolinked.

*/
export declare class UrlMatch extends Match {
export declare class UrlMatch extends AbstractMatch {
/**
* @public
* @property {'url'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
readonly type: 'url';
/**
* @cfg {String} url (required)

@@ -29,9 +38,2 @@ *

/**
* @cfg {Boolean} protocolUrlMatch (required)
*
* `true` if the URL is a match which already has a protocol (i.e.
* 'http://'), `false` if the match was from a 'www' or known TLD match.
*/
private readonly protocolUrlMatch;
/**
* @cfg {Boolean} protocolRelativeMatch (required)

@@ -62,25 +64,2 @@ *

* @private
* @property {RegExp} schemePrefixRegex
*
* A regular expression used to remove the 'http://' or 'https://' from
* URLs.
*/
schemePrefixRegex: RegExp;
/**
* @private
* @property {RegExp} wwwPrefixRegex
*
* A regular expression used to remove the 'www.' from URLs.
*/
wwwPrefixRegex: RegExp;
/**
* @private
* @property {RegExp} protocolRelativeRegex
*
* The regular expression used to remove the protocol-relative '//' from the {@link #url} string, for purposes
* of {@link #getAnchorText}. A protocol-relative URL is, for example, "//yahoo.com"
*/
protocolRelativeRegex: RegExp;
/**
* @private
* @property {Boolean} protocolPrepended

@@ -91,3 +70,3 @@ *

*/
protocolPrepended: boolean;
private protocolPrepended;
/**

@@ -105,3 +84,3 @@ * @method constructor

*/
getType(): string;
getType(): 'url';
/**

@@ -118,3 +97,3 @@ * Returns a string name for the type of URL match that this class

*/
getUrlMatchType(): UrlMatchTypeOptions;
getUrlMatchType(): UrlMatchType;
/**

@@ -139,55 +118,6 @@ * Returns the url that was matched, assuming the protocol to be 'http://' if the original

getAnchorText(): string;
/**
* Strips the scheme prefix (such as "http://" or "https://") from the given
* `url`.
*
* @private
* @param {String} url The text of the anchor that is being generated, for
* which to strip off the url scheme.
* @return {String} The `url`, with the scheme stripped.
*/
private stripSchemePrefix;
/**
* Strips the 'www' prefix from the given `url`.
*
* @private
* @param {String} url The text of the anchor that is being generated, for
* which to strip off the 'www' if it exists.
* @return {String} The `url`, with the 'www' stripped.
*/
private stripWwwPrefix;
/**
* Strips any protocol-relative '//' from the anchor text.
*
* @private
* @param {String} text The text of the anchor that is being generated, for which to strip off the
* protocol-relative prefix (such as stripping off "//")
* @return {String} The `anchorText`, with the protocol-relative prefix stripped.
*/
private stripProtocolRelativePrefix;
/**
* Removes any trailing slash from the given `anchorText`, in preparation for the text to be displayed.
*
* @private
* @param {String} anchorText The text of the anchor that is being generated, for which to remove any trailing
* slash ('/') that may exist.
* @return {String} The `anchorText`, with the trailing slash removed.
*/
private removeTrailingSlash;
/**
* Decodes percent-encoded characters from the given `anchorText`, in
* preparation for the text to be displayed.
*
* @private
* @param {String} anchorText The text of the anchor that is being
* generated, for which to decode any percent-encoded characters.
* @return {String} The `anchorText`, with the percent-encoded characters
* decoded.
*/
private removePercentEncoding;
}
export interface UrlMatchConfig extends MatchConfig {
export interface UrlMatchConfig extends AbstractMatchConfig {
url: string;
urlMatchType: UrlMatchTypeOptions;
protocolUrlMatch: boolean;
urlMatchType: UrlMatchType;
protocolRelativeMatch: boolean;

@@ -198,1 +128,2 @@ stripPrefix: Required<StripPrefixConfigObj>;

}
export declare type UrlMatchType = 'scheme' | 'tld' | 'ipV4';
import { __extends } from "tslib";
import { Match } from './match';
import { AbstractMatch } from './abstract-match';
import { httpSchemePrefixRe } from '../parser/uri-utils';
/**
* A regular expression used to remove the 'www.' from URLs.
*/
var wwwPrefixRegex = /^(https?:\/\/)?(www\.)?/i;
/**
* The regular expression used to remove the protocol-relative '//' from a URL
* string, for purposes of formatting the anchor text. A protocol-relative URL
* is, for example, "//yahoo.com"
*/
var protocolRelativeRegex = /^\/\//;
/**
* @class Autolinker.match.Url
* @extends Autolinker.match.Match
* @extends Autolinker.match.AbstractMatch
*

@@ -21,2 +32,11 @@ * Represents a Url match found in an input string which should be Autolinked.

/**
* @public
* @property {'url'} type
*
* A string name for the type of match that this class represents. Can be
* used in a TypeScript discriminating union to type-narrow from the
* `Match` type.
*/
_this.type = 'url';
/**
* @cfg {String} url (required)

@@ -37,9 +57,2 @@ *

/**
* @cfg {Boolean} protocolUrlMatch (required)
*
* `true` if the URL is a match which already has a protocol (i.e.
* 'http://'), `false` if the match was from a 'www' or known TLD match.
*/
_this.protocolUrlMatch = false; // default value just to get the above doc comment in the ES5 output and documentation generator
/**
* @cfg {Boolean} protocolRelativeMatch (required)

@@ -73,25 +86,2 @@ *

* @private
* @property {RegExp} schemePrefixRegex
*
* A regular expression used to remove the 'http://' or 'https://' from
* URLs.
*/
_this.schemePrefixRegex = /^(https?:\/\/)?/i;
/**
* @private
* @property {RegExp} wwwPrefixRegex
*
* A regular expression used to remove the 'www.' from URLs.
*/
_this.wwwPrefixRegex = /^(https?:\/\/)?(www\.)?/i;
/**
* @private
* @property {RegExp} protocolRelativeRegex
*
* The regular expression used to remove the protocol-relative '//' from the {@link #url} string, for purposes
* of {@link #getAnchorText}. A protocol-relative URL is, for example, "//yahoo.com"
*/
_this.protocolRelativeRegex = /^\/\//;
/**
* @private
* @property {Boolean} protocolPrepended

@@ -105,3 +95,2 @@ *

_this.url = cfg.url;
_this.protocolUrlMatch = cfg.protocolUrlMatch;
_this.protocolRelativeMatch = cfg.protocolRelativeMatch;

@@ -144,4 +133,6 @@ _this.stripPrefix = cfg.stripPrefix;

var url = this.url;
// if the url string doesn't begin with a protocol, assume 'http://'
if (!this.protocolRelativeMatch && !this.protocolUrlMatch && !this.protocolPrepended) {
// if the url string doesn't begin with a scheme, assume 'http://'
if (!this.protocolRelativeMatch &&
this.urlMatchType !== 'scheme' &&
!this.protocolPrepended) {
url = this.url = 'http://' + url;

@@ -170,100 +161,99 @@ this.protocolPrepended = true;

// Strip off any protocol-relative '//' from the anchor text
anchorText = this.stripProtocolRelativePrefix(anchorText);
anchorText = stripProtocolRelativePrefix(anchorText);
}
if (this.stripPrefix.scheme) {
anchorText = this.stripSchemePrefix(anchorText);
anchorText = stripSchemePrefix(anchorText);
}
if (this.stripPrefix.www) {
anchorText = this.stripWwwPrefix(anchorText);
anchorText = stripWwwPrefix(anchorText);
}
if (this.stripTrailingSlash) {
anchorText = this.removeTrailingSlash(anchorText); // remove trailing slash, if there is one
anchorText = removeTrailingSlash(anchorText); // remove trailing slash, if there is one
}
if (this.decodePercentEncoding) {
anchorText = this.removePercentEncoding(anchorText);
anchorText = removePercentEncoding(anchorText);
}
return anchorText;
};
// ---------------------------------------
// Utility Functionality
/**
* Strips the scheme prefix (such as "http://" or "https://") from the given
* `url`.
*
* @private
* @param {String} url The text of the anchor that is being generated, for
* which to strip off the url scheme.
* @return {String} The `url`, with the scheme stripped.
*/
UrlMatch.prototype.stripSchemePrefix = function (url) {
return url.replace(this.schemePrefixRegex, '');
};
/**
* Strips the 'www' prefix from the given `url`.
*
* @private
* @param {String} url The text of the anchor that is being generated, for
* which to strip off the 'www' if it exists.
* @return {String} The `url`, with the 'www' stripped.
*/
UrlMatch.prototype.stripWwwPrefix = function (url) {
return url.replace(this.wwwPrefixRegex, '$1'); // leave any scheme ($1), it one exists
};
/**
* Strips any protocol-relative '//' from the anchor text.
*
* @private
* @param {String} text The text of the anchor that is being generated, for which to strip off the
* protocol-relative prefix (such as stripping off "//")
* @return {String} The `anchorText`, with the protocol-relative prefix stripped.
*/
UrlMatch.prototype.stripProtocolRelativePrefix = function (text) {
return text.replace(this.protocolRelativeRegex, '');
};
/**
* Removes any trailing slash from the given `anchorText`, in preparation for the text to be displayed.
*
* @private
* @param {String} anchorText The text of the anchor that is being generated, for which to remove any trailing
* slash ('/') that may exist.
* @return {String} The `anchorText`, with the trailing slash removed.
*/
UrlMatch.prototype.removeTrailingSlash = function (anchorText) {
if (anchorText.charAt(anchorText.length - 1) === '/') {
anchorText = anchorText.slice(0, -1);
}
return anchorText;
};
/**
* Decodes percent-encoded characters from the given `anchorText`, in
* preparation for the text to be displayed.
*
* @private
* @param {String} anchorText The text of the anchor that is being
* generated, for which to decode any percent-encoded characters.
* @return {String} The `anchorText`, with the percent-encoded characters
* decoded.
*/
UrlMatch.prototype.removePercentEncoding = function (anchorText) {
// First, convert a few of the known % encodings to the corresponding
// HTML entities that could accidentally be interpretted as special
// HTML characters
var preProcessedEntityAnchorText = anchorText
.replace(/%22/gi, '&quot;') // " char
.replace(/%26/gi, '&amp;') // & char
.replace(/%27/gi, '&#39;') // ' char
.replace(/%3C/gi, '&lt;') // < char
.replace(/%3E/gi, '&gt;'); // > char
try {
// Now attempt to decode the rest of the anchor text
return decodeURIComponent(preProcessedEntityAnchorText);
}
catch (e) {
// Invalid % escape sequence in the anchor text
return preProcessedEntityAnchorText;
}
};
return UrlMatch;
}(Match));
}(AbstractMatch));
export { UrlMatch };
// Utility Functionality
/**
* Strips the scheme prefix (such as "http://" or "https://") from the given
* `url`.
*
* @private
* @param {String} url The text of the anchor that is being generated, for
* which to strip off the url scheme.
* @return {String} The `url`, with the scheme stripped.
*/
function stripSchemePrefix(url) {
return url.replace(httpSchemePrefixRe, '');
}
/**
* Strips the 'www' prefix from the given `url`.
*
* @private
* @param {String} url The text of the anchor that is being generated, for
* which to strip off the 'www' if it exists.
* @return {String} The `url`, with the 'www' stripped.
*/
function stripWwwPrefix(url) {
return url.replace(wwwPrefixRegex, '$1'); // leave any scheme ($1), it one exists
}
/**
* Strips any protocol-relative '//' from the anchor text.
*
* @private
* @param {String} text The text of the anchor that is being generated, for which to strip off the
* protocol-relative prefix (such as stripping off "//")
* @return {String} The `anchorText`, with the protocol-relative prefix stripped.
*/
function stripProtocolRelativePrefix(text) {
return text.replace(protocolRelativeRegex, '');
}
/**
* Removes any trailing slash from the given `anchorText`, in preparation for the text to be displayed.
*
* @private
* @param {String} anchorText The text of the anchor that is being generated, for which to remove any trailing
* slash ('/') that may exist.
* @return {String} The `anchorText`, with the trailing slash removed.
*/
function removeTrailingSlash(anchorText) {
if (anchorText.charAt(anchorText.length - 1) === '/') {
anchorText = anchorText.slice(0, -1);
}
return anchorText;
}
/**
* Decodes percent-encoded characters from the given `anchorText`, in
* preparation for the text to be displayed.
*
* @private
* @param {String} anchorText The text of the anchor that is being
* generated, for which to decode any percent-encoded characters.
* @return {String} The `anchorText`, with the percent-encoded characters
* decoded.
*/
function removePercentEncoding(anchorText) {
// First, convert a few of the known % encodings to the corresponding
// HTML entities that could accidentally be interpretted as special
// HTML characters
var preProcessedEntityAnchorText = anchorText
.replace(/%22/gi, '&quot;') // " char
.replace(/%26/gi, '&amp;') // & char
.replace(/%27/gi, '&#39;') // ' char
.replace(/%3C/gi, '&lt;') // < char
.replace(/%3E/gi, '&gt;'); // > char
try {
// Now attempt to decode the rest of the anchor text
return decodeURIComponent(preProcessedEntityAnchorText);
}
catch (e) {
// Invalid % escape sequence in the anchor text
return preProcessedEntityAnchorText;
}
}
//# sourceMappingURL=url-match.js.map

@@ -115,5 +115,5 @@ /**

/**
* The string form of a regular expression that would match all of the
* letters and decimal number chars in the unicode character set when placed in
* a RegExp character class (`[]`).
* The regular expression that will match all of the letters and decimal number
* chars in the unicode character set when placed in a RegExp character class
* (`[]`).
*

@@ -123,3 +123,3 @@ * These would be the characters matched by unicode regex engines

*/
export declare const alphaNumericCharsStr: string;
export declare const alphaNumericCharsRe: RegExp;
/**

@@ -139,17 +139,2 @@ * The string form of a regular expression that would match all of the

*/
export declare const alphaNumericAndMarksCharRe: RegExp;
/**
* A function to match domain names of a URL or email address.
* Ex: 'google', 'yahoo', 'some-other-company', etc.
*/
export declare const getDomainNameStr: (group: number) => string;
/**
* A regular expression to match domain names of a URL or email address.
* Ex: 'google', 'yahoo', 'some-other-company', etc.
*/
export declare const domainNameRegex: RegExp;
/**
* A regular expression that is simply the character class of the characters
* that may be used in a domain name, minus the '-' or '.'
*/
export declare const domainNameCharRegex: RegExp;
export declare const alphaNumericAndMarksRe: RegExp;

@@ -129,5 +129,5 @@ /*

/**
* The string form of a regular expression that would match all of the
* letters and decimal number chars in the unicode character set when placed in
* a RegExp character class (`[]`).
* The regular expression that will match all of the letters and decimal number
* chars in the unicode character set when placed in a RegExp character class
* (`[]`).
*

@@ -137,3 +137,3 @@ * These would be the characters matched by unicode regex engines

*/
export var alphaNumericCharsStr = alphaCharsAndMarksStr + decimalNumbersStr;
export var alphaNumericCharsRe = new RegExp("[".concat(alphaCharsStr + decimalNumbersStr, "]"));
/**

@@ -153,29 +153,3 @@ * The string form of a regular expression that would match all of the

*/
export var alphaNumericAndMarksCharRe = new RegExp("[".concat(alphaNumericAndMarksCharsStr, "]"));
// Simplified IP regular expression
var ipStr = '(?:[' + decimalNumbersStr + ']{1,3}\\.){3}[' + decimalNumbersStr + ']{1,3}';
// Protected domain label which do not allow "-" or "_" character on the beginning and the end of a single label
// prettier-ignore
var domainLabelStr = '[' + alphaNumericAndMarksCharsStr + '](?:[' + alphaNumericAndMarksCharsStr + '\\-_]{0,61}[' + alphaNumericAndMarksCharsStr + '])?';
var getDomainLabelStr = function (group) {
return '(?=(' + domainLabelStr + '))\\' + group;
};
/**
* A function to match domain names of a URL or email address.
* Ex: 'google', 'yahoo', 'some-other-company', etc.
*/
// prettier-ignore
export var getDomainNameStr = function (group) {
return '(?:' + getDomainLabelStr(group) + '(?:\\.' + getDomainLabelStr(group + 1) + '){0,126}|' + ipStr + ')';
};
/**
* A regular expression to match domain names of a URL or email address.
* Ex: 'google', 'yahoo', 'some-other-company', etc.
*/
export var domainNameRegex = new RegExp('[' + alphaNumericAndMarksCharsStr + '.\\-]*[' + alphaNumericAndMarksCharsStr + '\\-]');
/**
* A regular expression that is simply the character class of the characters
* that may be used in a domain name, minus the '-' or '.'
*/
export var domainNameCharRegex = alphaNumericAndMarksCharRe;
export var alphaNumericAndMarksRe = new RegExp("[".concat(alphaNumericAndMarksCharsStr, "]"));
//# sourceMappingURL=regex-lib.js.map
/**
* Simpler helper method to check for undefined simply for the benefit of
* gaining better compression when minified by not needing to have multiple
* comparisons to the `undefined` keyword in the codebase.
*/
export declare function isUndefined(value: any): value is undefined;
/**
* Simpler helper method to check for a boolean type simply for the benefit of
* gaining better compression when minified by not needing to have multiple
* `typeof` comparisons in the codebase.
*/
export declare function isBoolean(value: any): value is boolean;
/**
* Assigns (shallow copies) the properties of `src` onto `dest`, if the

@@ -22,9 +34,11 @@ * corresponding property on `dest` === `undefined`.

/**
* Supports `Array.prototype.indexOf()` functionality for old IE (IE8 and below).
* Removes array elements by value. Mutates the input array.
*
* @param {Array} arr The array to find an element of.
* @param {*} element The element to find in the array, and return the index of.
* @return {Number} The index of the `element`, or -1 if it was not found.
* Using this instead of the ES5 Array.prototype.filter() function to prevent
* creating many new arrays in memory for removing an element.
*
* @param arr The array to remove elements from. This array is mutated.
* @param fn The element to remove.
*/
export declare function indexOf<T>(arr: T[], element: T): number;
export declare function remove<T>(arr: T[], item: T): void;
/**

@@ -34,41 +48,14 @@ * Removes array elements based on a filtering function. Mutates the input

*
* Using this instead of the ES5 Array.prototype.filter() function, to allow
* Autolinker compatibility with IE8, and also to prevent creating many new
* arrays in memory for filtering.
* Using this instead of the ES5 Array.prototype.filter() function to prevent
* creating many new arrays in memory for filtering.
*
* @param {Array} arr The array to remove elements from. This array is
* mutated.
* @param {Function} fn A function which should return `true` to
* remove an element.
* @return {Array} The mutated input `arr`.
* @param arr The array to remove elements from. This array is mutated.
* @param fn The predicate function which should return `true` to remove an
* element.
*/
export declare function remove<T>(arr: T[], fn: (item: T) => boolean): void;
export declare function removeWithPredicate<T>(arr: T[], fn: (item: T) => boolean): void;
/**
* Performs the functionality of what modern browsers do when `String.prototype.split()` is called
* with a regular expression that contains capturing parenthesis.
*
* For example:
*
* // Modern browsers:
* "a,b,c".split( /(,)/ ); // --> [ 'a', ',', 'b', ',', 'c' ]
*
* // Old IE (including IE8):
* "a,b,c".split( /(,)/ ); // --> [ 'a', 'b', 'c' ]
*
* This method emulates the functionality of modern browsers for the old IE case.
*
* @param {String} str The string to split.
* @param {RegExp} splitRegex The regular expression to split the input `str` on. The splitting
* character(s) will be spliced into the array, as in the "modern browsers" example in the
* description of this method.
* Note #1: the supplied regular expression **must** have the 'g' flag specified.
* Note #2: for simplicity's sake, the regular expression does not need
* to contain capturing parenthesis - it will be assumed that any match has them.
* @return {String[]} The split array of strings, with the splitting character(s) included.
*/
export declare function splitAndCapture(str: string, splitRegex: RegExp): string[];
/**
* Function that should never be called but is used to check that every
* enum value is handled using TypeScript's 'never' type.
*/
export declare function throwUnhandledCaseError(theValue: never): void;
export declare function assertNever(theValue: never): void;
/**
* Simpler helper method to check for undefined simply for the benefit of
* gaining better compression when minified by not needing to have multiple
* comparisons to the `undefined` keyword in the codebase.
*/
export function isUndefined(value) {
return value === undefined;
}
/**
* Simpler helper method to check for a boolean type simply for the benefit of
* gaining better compression when minified by not needing to have multiple
* `typeof` comparisons in the codebase.
*/
export function isBoolean(value) {
return typeof value === 'boolean';
}
/**
* Assigns (shallow copies) the properties of `src` onto `dest`, if the

@@ -11,3 +27,3 @@ * corresponding property on `dest` === `undefined`.

for (var prop in src) {
if (src.hasOwnProperty(prop) && dest[prop] === undefined) {
if (src.hasOwnProperty(prop) && isUndefined(dest[prop])) {
dest[prop] = src[prop];

@@ -43,21 +59,15 @@ }

/**
* Supports `Array.prototype.indexOf()` functionality for old IE (IE8 and below).
* Removes array elements by value. Mutates the input array.
*
* @param {Array} arr The array to find an element of.
* @param {*} element The element to find in the array, and return the index of.
* @return {Number} The index of the `element`, or -1 if it was not found.
* Using this instead of the ES5 Array.prototype.filter() function to prevent
* creating many new arrays in memory for removing an element.
*
* @param arr The array to remove elements from. This array is mutated.
* @param fn The element to remove.
*/
export function indexOf(arr, element) {
// @ts-ignore - As far as TypeScript is concerned, this method will always
// exist (lowest "lib" in TS is "ES5"). Hence we need to ignore this error
// to support IE8 which only implements ES3 and doesn't have this method
if (Array.prototype.indexOf) {
return arr.indexOf(element);
}
else {
for (var i = 0, len = arr.length; i < len; i++) {
if (arr[i] === element)
return i;
export function remove(arr, item) {
for (var i = arr.length - 1; i >= 0; i--) {
if (arr[i] === item) {
arr.splice(i, 1);
}
return -1;
}

@@ -69,13 +79,10 @@ }

*
* Using this instead of the ES5 Array.prototype.filter() function, to allow
* Autolinker compatibility with IE8, and also to prevent creating many new
* arrays in memory for filtering.
* Using this instead of the ES5 Array.prototype.filter() function to prevent
* creating many new arrays in memory for filtering.
*
* @param {Array} arr The array to remove elements from. This array is
* mutated.
* @param {Function} fn A function which should return `true` to
* remove an element.
* @return {Array} The mutated input `arr`.
* @param arr The array to remove elements from. This array is mutated.
* @param fn The predicate function which should return `true` to remove an
* element.
*/
export function remove(arr, fn) {
export function removeWithPredicate(arr, fn) {
for (var i = arr.length - 1; i >= 0; i--) {

@@ -88,43 +95,8 @@ if (fn(arr[i]) === true) {

/**
* Performs the functionality of what modern browsers do when `String.prototype.split()` is called
* with a regular expression that contains capturing parenthesis.
*
* For example:
*
* // Modern browsers:
* "a,b,c".split( /(,)/ ); // --> [ 'a', ',', 'b', ',', 'c' ]
*
* // Old IE (including IE8):
* "a,b,c".split( /(,)/ ); // --> [ 'a', 'b', 'c' ]
*
* This method emulates the functionality of modern browsers for the old IE case.
*
* @param {String} str The string to split.
* @param {RegExp} splitRegex The regular expression to split the input `str` on. The splitting
* character(s) will be spliced into the array, as in the "modern browsers" example in the
* description of this method.
* Note #1: the supplied regular expression **must** have the 'g' flag specified.
* Note #2: for simplicity's sake, the regular expression does not need
* to contain capturing parenthesis - it will be assumed that any match has them.
* @return {String[]} The split array of strings, with the splitting character(s) included.
*/
export function splitAndCapture(str, splitRegex) {
if (!splitRegex.global)
throw new Error("`splitRegex` must have the 'g' flag set");
var result = [], lastIdx = 0, match;
while ((match = splitRegex.exec(str))) {
result.push(str.substring(lastIdx, match.index));
result.push(match[0]); // push the splitting char(s)
lastIdx = match.index + match[0].length;
}
result.push(str.substring(lastIdx));
return result;
}
/**
* Function that should never be called but is used to check that every
* enum value is handled using TypeScript's 'never' type.
*/
export function throwUnhandledCaseError(theValue) {
export function assertNever(theValue) {
throw new Error("Unhandled case for value: '".concat(theValue, "'"));
}
//# sourceMappingURL=utils.js.map

@@ -1,1 +0,1 @@

export declare const version = "3.16.2";
export declare const version = "4.0.0";
// Important: this file is generated from the 'build' script and should not be
// edited directly
export var version = '3.16.2';
export var version = '4.0.0';
//# sourceMappingURL=version.js.map
{
"name": "autolinker",
"version": "3.16.2",
"version": "4.0.0",
"description": "Utility to automatically link the URLs, email addresses, phone numbers, hashtags, and mentions (Twitter, Instagram) in a given block of text/HTML",

@@ -21,2 +21,3 @@ "main": "./dist/commonjs/index.js",

"test:unit": "node --require=ts-node/register node_modules/jasmine/bin/jasmine.js \"tests/**/*.spec.ts\"",
"test:unit:debug": "node --inspect-brk --require=ts-node/register node_modules/jasmine/bin/jasmine.js \"tests/**/*.spec.ts\"",
"test:integration": "ts-node scripts/test-integration.ts",

@@ -50,2 +51,3 @@ "update-tld-regex": "ts-node scripts/update-tld-regex.ts",

"@rollup/plugin-node-resolve": "^13.1.3",
"@types/cli-table": "^0.3.0",
"@types/dedent": "^0.7.0",

@@ -59,2 +61,3 @@ "@types/fs-extra": "^9.0.13",

"axios": "^0.26.0",
"cli-table": "^0.3.11",
"css-loader": "^6.6.0",

@@ -61,0 +64,0 @@ "dedent": "^0.7.0",

@@ -30,7 +30,6 @@ # Autolinker.js

## v3.0 released Jan 2019
## v4.0 released September 2022
See [Upgrading from v2.x -> v3.x (Breaking Changes)](#upgrading-from-v2x---v3x-breaking-changes) at the bottom of this readme
See [Upgrading from v3.x -> v4.x (Breaking Changes)](#upgrading-from-v3x---v4x-breaking-changes) at the bottom of this readme.
## Installation

@@ -76,3 +75,3 @@

```javascript
const Autolinker = require( 'autolinker' );
const Autolinker = require('autolinker');
// note: npm wants an all-lowercase package name, but the utility is a class and

@@ -97,3 +96,3 @@ // should be aliased with a capital letter

```javascript
var linkedText = Autolinker.link( textToAutolink[, options] );
const linkedText = Autolinker.link(textToAutolink[, options]);
```

@@ -104,5 +103,5 @@

```javascript
var autolinker = new Autolinker( [ options ] );
const autolinker = new Autolinker([ options ]);
var linkedText = autolinker.link( textToAutoLink );
const linkedText = autolinker.link(textToAutoLink);
```

@@ -119,8 +118,8 @@

```javascript
var linkedText = Autolinker.link( "Check out google.com" );
const linkedText = Autolinker.link("Check out google.com");
// Produces: "Check out <a href="http://google.com" target="_blank" rel="noopener noreferrer">google.com</a>"
var linkedText = Autolinker.link( "Check out google.com", {
const linkedText = Autolinker.link("Check out google.com", {
newWindow: false
} );
});
// Produces: "Check out <a href="http://google.com">google.com</a>"

@@ -149,11 +148,11 @@ ```

prevent these types of matches.
- wwwMatches (boolean): `true` to match urls found prefixed with `'www.'`,
i.e. `www.google.com`. `false` to prevent these types of matches. Note
that if the URL had a prefixed scheme, and `schemeMatches` is true, it
- tldMatches: `true` to match URLs with known top level domains (.com, .net,
etc.) that are not prefixed with a scheme (i.e. 'http://'). Ex: `google.com`,
`asdf.org/?page=1`, etc. Set to `false` to prevent these types of matches.
- ipV4Matches (boolean): `true` to match IPv4 addresses. Ex: `192.168.0.1`.
`false` to prevent these types of matches. Note that if the IP address had
a prefixed scheme (such as 'http://'), and `schemeMatches` is true, it
will still be linked.
- tldMatches: `true` to match URLs with known top level domains (.com, .net,
etc.) that are not prefixed with a scheme or `'www.'`. Ex: `google.com`,
`asdf.org/?page=1`, etc. `false` to prevent these types of matches.
Example usage: `urls: { schemeMatches: true, wwwMatches: true, tldMatches: false }`
Example usage: `urls: { schemeMatches: true, tldMatches: false, ipV4Matches: true }`

@@ -227,14 +226,17 @@ - [email](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-email) : boolean<br />

A CSS class name to add to the generated anchor tags. This class will be added
to all links, as well as this class plus "url"/"email"/"phone"/"hashtag"/"mention"/"twitter"/"instagram"
to all links, as well as this class plus "url"/"email"/"phone"/"hashtag"/"mention"
suffixes for styling url/email/phone/hashtag/mention links differently.
For example, if this config is provided as "myLink", then:
The name of the hashtag/mention service is also added as a CSS class for those
types of matches.
- URL links will have the CSS classes: "myLink myLink-url"
- Email links will have the CSS classes: "myLink myLink-email"
- Phone links will have the CSS classes: "myLink myLink-phone"
- Twitter mention links will have the CSS classes: "myLink myLink-mention myLink-twitter"
- Instagram mention links will have the CSS classes: "myLink myLink-mention myLink-instagram"
- Hashtag links will have the CSS classes: "myLink myLink-hashtag"
For example, if this config is provided as "my-link", then:
- URL links will have the CSS classes: "my-link my-link-url"
- Email links will have the CSS classes: "my-link my-link-email"
- Phone links will have the CSS classes: "my-link my-link-phone"
- Twitter mention links will have the CSS classes: "my-link my-link-mention my-link-twitter"
- Instagram mention links will have the CSS classes: "my-link my-link-mention my-link-instagram"
- Hashtag links will have the CSS classes: "my-link my-link-hashtag my-link-twitter"
- [decodePercentEncoding](http://gregjacobs.github.io/Autolinker.js/api/#!/api/Autolinker-cfg-decodePercentEncoding): boolean<br />

@@ -273,5 +275,5 @@ `true` to decode percent-encoded characters in URL matches, `false` to keep

```javascript
var linkedText = Autolinker.link( "Check out google.com", {
const linkedText = Autolinker.link("Check out google.com", {
newWindow: false
} );
});
// Produces: "Check out <a href="http://google.com">google.com</a>"

@@ -283,6 +285,6 @@ ```

```javascript
var linkedText = Autolinker.link( "http://www.yahoo.com/some/long/path/to/a/file", {
const linkedText = Autolinker.link("http://www.yahoo.com/some/long/path/to/a/file", {
truncate: 25,
newWindow: false
} );
});
// Produces: "<a href="http://www.yahoo.com/some/long/path/to/a/file">yahoo.com/some/long/pat..</a>"

@@ -297,4 +299,4 @@ ```

```javascript
var myTextEl = document.getElementById( 'text' );
myTextEl.innerHTML = Autolinker.link( myTextEl.innerHTML );
const myTextEl = document.getElementById('text');
myTextEl.innerHTML = Autolinker.link(myTextEl.innerHTML);
```

@@ -306,7 +308,7 @@

```javascript
var autolinker = new Autolinker( { newWindow: false, truncate: 25 } );
const autolinker = new Autolinker({ newWindow: false, truncate: 25 });
//...
autolinker.link( "Check out http://www.yahoo.com/some/long/path/to/a/file" );
autolinker.link("Check out http://www.yahoo.com/some/long/path/to/a/file");
// Produces: "Check out <a href="http://www.yahoo.com/some/long/path/to/a/file">yahoo.com/some/long/pat..</a>"

@@ -328,12 +330,12 @@

```
var matches = Autolinker.parse( "Hello google.com, I am asdf@asdf.com", {
const matches = Autolinker.parse("Hello google.com, I am asdf@asdf.com", {
urls: true,
email: true
} );
});
console.log( matches.length ); // 2
console.log( matches[ 0 ].getType() ); // 'url'
console.log( matches[ 0 ].getUrl() ); // 'google.com'
console.log( matches[ 1 ].getType() ); // 'email'
console.log( matches[ 1 ].getEmail() ); // 'asdf@asdf.com'
console.log(matches.length); // 2
console.log(matches[0].type); // 'url'
console.log(matches[0].getUrl()); // 'google.com'
console.log(matches[1].type); // 'email'
console.log(matches[1].getEmail()); // 'asdf@asdf.com'
```

@@ -351,20 +353,20 @@

```javascript
var input = "..."; // string with URLs, Email Addresses, Mentions (Twitter, Instagram), and Hashtags
const input = "..."; // string with URLs, Email Addresses, Mentions (Twitter, Instagram), and Hashtags
var linkedText = Autolinker.link( input, {
replaceFn : function( match ) {
console.log( "href = ", match.getAnchorHref() );
console.log( "text = ", match.getAnchorText() );
const linkedText = Autolinker.link(input, {
replaceFn : function(match) {
console.log("href = ", match.getAnchorHref());
console.log("text = ", match.getAnchorText());
switch( match.getType() ) {
case 'url' :
console.log( "url: ", match.getUrl() );
switch(match.type) {
case 'url':
console.log("url: ", match.getUrl());
return true; // let Autolinker perform its normal anchor tag replacement
case 'email' :
var email = match.getEmail();
console.log( "email: ", email );
case 'email':
const email = match.getEmail();
console.log("email: ", email);
if( email === "my@own.address" ) {
if(email === "my@own.address") {
return false; // don't auto-link this particular email address; leave as-is

@@ -375,15 +377,15 @@ } else {

case 'phone' :
console.log( "Phone Number: ", match.getPhoneNumber() );
case 'phone':
console.log("Phone Number: ", match.getPhoneNumber());
return '<a href="http://newplace.to.link.phone.numbers.to/">' + match.getPhoneNumber() + '</a>';
case 'mention' :
console.log( "Mention: ", match.getMention() );
console.log( "Mention Service Name: ", match.getServiceName() );
case 'mention':
console.log("Mention: ", match.getMention());
console.log("Mention Service Name: ", match.getServiceName());
return '<a href="http://newplace.to.link.mention.handles.to/">' + match.getMention() + '</a>';
case 'hashtag' :
console.log( "Hashtag: ", match.getHashtag() );
case 'hashtag':
console.log("Hashtag: ", match.getHashtag());

@@ -399,13 +401,13 @@ return '<a href="http://newplace.to.link.hashtag.handles.to/">' + match.getHashtag() + '</a>';

```javascript
var input = "..."; // string with URLs, Email Addresses, Mentions (Twitter, Instagram), and Hashtags
const input = "..."; // string with URLs, Email Addresses, Mentions (Twitter, Instagram), and Hashtags
var linkedText = Autolinker.link( input, {
const linkedText = Autolinker.link( input, {
replaceFn : function( match ) {
console.log( "href = ", match.getAnchorHref() );
console.log( "text = ", match.getAnchorText() );
console.log("href = ", match.getAnchorHref());
console.log("text = ", match.getAnchorText());
var tag = match.buildTag(); // returns an `Autolinker.HtmlTag` instance for an <a> tag
tag.setAttr( 'rel', 'nofollow' ); // adds a 'rel' attribute
tag.addClass( 'external-link' ); // adds a CSS class
tag.setInnerHtml( 'Click here!' ); // sets the inner html for the anchor tag
const tag = match.buildTag(); // returns an `Autolinker.HtmlTag` instance for an <a> tag
tag.setAttr('rel', 'nofollow'); // adds a 'rel' attribute
tag.addClass('external-link'); // adds a CSS class
tag.setInnerHtml('Click here!'); // sets the inner html for the anchor tag

@@ -447,39 +449,19 @@ return tag;

## Users of Internet Explorer 8 and Below
## Upgrading from v3.x -> 4.x (Breaking Changes)
Autolinker compiles into ES5, and uses ES5 library methods. If you need to run
Autolinker on old browsers (i.e. Internet Explorer 8 or below), you will need
some polyfills.
1. Internet Explorer support has been removed since its official demise in June
2022.
1. The `urls.wwwMatches` config has been removed. A `www.` prefix is now treated
like any other subdomain of a top level domain (TLD) match (such as
'subdomain.google.com').
1. `Match.getType()` should be replaced with `Match.type`. This allows for
TypeScript type narrowing of `Match` objects returned by the `parse()`
method or inside the `replaceFn`.
1. The `Matcher` classes have been removed in favor of a single finite state
machine parser, greatly improving the performance of Autolinker but removing
some of the customizability of the old regular expressions. Will address this customizability in a future release.
1. `Autolinker.AnchorTagBuilder`, `Autolinker.HtmlTag`, and `Autolinker.match.*`
references have been removed. These shouldn't be needed as public APIs, but
please raise a GitHub issue if these are for some reason needed.
I recommend using the [core-js](https://www.npmjs.com/package/core-js)
ES5 polyfill. You may also be able to get away with adding the following two
polyfills, but that may or may not be true in the future:
```js
if( typeof Array.prototype.forEach !== 'function' ) {
Array.prototype.forEach = function( callback, thisArg ) {
for( var i = 0; i < this.length; i++ ) {
callback.apply( thisArg || this, [ this[ i ], i, this ] );
}
};
}
if( typeof Object.assign !== 'function' ) {
Object.assign = function( target ) {
var srcObjs = Array.prototype.slice.call( arguments, 1 );
for( var i = 0, len = srcObjs.length; i < len; i++ ) {
var currentSrcObj = srcObjs[ i ];
for( var prop in currentSrcObj ) {
if( currentSrcObj.hasOwnProperty( prop ) ) {
target[ prop ] = currentSrcObj[ prop ];
}
}
}
return target;
};
}
```
## Upgrading from v2.x -> v3.x (Breaking Changes)

@@ -516,3 +498,3 @@

// Node.js
const Autolinker = require( 'autolinker' );
const Autolinker = require('autolinker');
```

@@ -557,3 +539,2 @@

## Developing / Contributing

@@ -566,6 +547,4 @@

```
npm install -g yarn # if you don't have yarn already
cd Autolinker.js # where you cloned the project
yarn install
npm install
```

@@ -576,10 +555,7 @@

```
yarn test
npm run test
```
- Make sure to add tests to cover your new functionality/bugfix
- Run the `yarn test` command to build/test
- Please use tabs for indents! Tabs are better for everybody
(individuals can set their editors to different tab sizes based on
their visual preferences).
- Make sure to add tests to check your new functionality/bugfix
- Run the `npm run test` command to test

@@ -586,0 +562,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc