hz-zhhq-web/node_modules/to-mark/dist/to-mark.min.js

1 line
11 KiB
JavaScript
Raw Normal View History

2025-02-25 13:47:09 +08:00
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["to-mark"]=t():e.toMark=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,n){"use strict";var r=n(1),o=/\n$/g,i=/[ \xA0]+\n\n/g,a=/([ \xA0]+\n){2,}/g,u=/href\=\"(.*?)\"/,c=/^/gm,s=r.factory({TEXT_NODE:function(e){var t=this.trim(this.getSpaceCollapsedText(e.nodeValue));return this._isNeedEscapeBackSlash(t)&&(t=this.escapeTextBackSlash(t)),t=this.escapePairedCharacters(t),this._isNeedEscapeHtml(t)&&(t=this.escapeTextHtml(t)),this._isNeedEscape(t)&&(t=this.escapeText(t)),this.getSpaceControlled(t,e)},"CODE TEXT_NODE":function(e){return e.nodeValue},"EM, I":function(e,t){var n="";return this.isEmptyText(t)||(n="*"+t+"*"),n},"STRONG, B":function(e,t){var n="";return this.isEmptyText(t)||(n="**"+t+"**"),n},A:function(e,t){var n,r,o=t,i="";return n=u.exec(e.outerHTML),n&&(r=n[1].replace(/&/g,"&")),e.title&&(i=' "'+e.title+'"'),!this.isEmptyText(t)&&r&&(o="["+this.escapeTextForLink(t)+"]("+r+i+")"),o},IMG:function(e){var t="",n=e.getAttribute("src"),r=e.alt;return n&&(t="!["+this.escapeTextForLink(r)+"]("+n+")"),t},BR:function(){return" \n"},CODE:function(e,t){var n,r,o="";return this.isEmptyText(t)||(r=parseInt(e.getAttribute("data-backticks"),10),n=isNaN(r)?"`":Array(r+1).join("`"),o=n+t+n),o},P:function(e,t){var n="";return t=t.replace(a," \n"),this.isEmptyText(t)||(n="\n\n"+t+"\n\n"),n},"BLOCKQUOTE P":function(e,t){return t},"LI P":function(e,t){var n="";return this.isEmptyText(t)||(n=t),n},"H1, H2, H3, H4, H5, H6":function(e,t){for(var n="",r=parseInt(e.tagName.charAt(1),10);r;)n+="#",r-=1;return n+=" ",n+=t,"\n\n"+n+"\n\n"},"LI H1, LI H2, LI H3, LI H4, LI H5, LI H6":function(e,t){var n=parseInt(e.tagName.charAt(1),10);return Array(n+1).join("#")+" "+t},"UL, OL":function(e,t){return"\n\n"+t+"\n\n"},"LI OL, LI UL":function(e,t){var n,r;return r=t.replace(i,"\n"),r=r.replace(o,""),n=r.replace(c," "),"\n"+n},"UL LI":function(e,t){var n="";return t=t.replace(a," \n"),e.firstChild&&"P"===e.firstChild.tagName&&(n+="\n"),n+="* "+t+"\n"},"OL LI":function(e,t){for(var n="",r=parseInt(e.parentNode.getAttribute("start")||1,10);e.previousSibling;)e=e.previousSibling,1===e.nodeType&&"LI"===e.tagName&&(r+=1);return t=t.replace(a," \n"),e.firstChild&&"P"===e.firstChild.tagName&&(n+="\n"),n+=r+". "+t+"\n"},HR:function(){return"\n\n- - -\n\n"},BLOCKQUOTE:function(e,t){var n,r;return t=t.replace(a,"\n\n"),r=this.trim(t),n=r.replace(c,"> "),"\n\n"+n+"\n\n"},"PRE CODE":function(e,t){var n,r;return r=t.replace(o,""),n=r.replace(c," "),"\n\n"+n+"\n\n"}});e.exports=s},function(e,t,n){"use strict";function r(e,t,n){var r;n=n||null;for(r in e)if(e.hasOwnProperty(r)&&t.call(n,e[r],r,e)===!1)break}function o(e){this.rules={},e&&this.addRules(e)}function i(e){var t=e.tagName;return"S"===t||"B"===t||"I"===t||"EM"===t||"STRONG"===t||"A"===t||"IMG"===t||"CODE"===t}function a(e,t){var n=e.cloneNode(!1);return n.innerHTML=t,n.outerHTML}function u(e,t){r(t,function(t,n){"converter"!==n?(e[n]||(e[n]={}),u(e[n],t)):e[n]=t})}var c=/^\u0020/,s=/.+\u0020$/,p=/[\n\s\t]+/g,l=/^[\u0020\r\n\t]+|[\u0020\r\n\t]+$/g,f=/[\u0020]+/g,d=/[>(){}\[\]+-.!#|]/g,h=/[\[\]]/g,g=/!\[.*\]\(.*\)/g,x=3;o.prototype.lineFeedReplacement="",o.prototype.addRule=function(e,t){var n=e.split(", "),r=n.pop();for(t.fname=e;r;)this._setConverterWithSelector(r,t),r=n.pop()},o.prototype.addRules=function(e){r(e,function(e,t){this.addRule(t,e)},this)},o.prototype.getSpaceControlled=function(e,t){var n,r="",o="";return t.previousS