"use strict";var n=Object.defineProperty;var c=(r,t,e)=>t in r?n(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var s=(r,t,e)=>(c(r,typeof t!="symbol"?t+"":t,e),e);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../blots/inline.js");class i extends u.default{static create(t){const e=super.create(t);return e.setAttribute("href",this.sanitize(t)),e.setAttribute("rel","noopener noreferrer"),e.setAttribute("target","_blank"),e}static formats(t){return t.getAttribute("href")}static sanitize(t){return a(t,this.PROTOCOL_WHITELIST)?t:this.SANITIZED_URL}format(t,e){t!==this.statics.blotName||!e?super.format(t,e):this.domNode.setAttribute("href",this.constructor.sanitize(e))}}s(i,"blotName","link"),s(i,"tagName","A"),s(i,"SANITIZED_URL","about:blank"),s(i,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]);function a(r,t){const e=document.createElement("a");e.href=r;const o=e.href.slice(0,e.href.indexOf(":"));return t.indexOf(o)>-1}exports.default=i;exports.sanitize=a;
