fa23-si/plugin/notes/notes.js

2 lines
56 KiB
JavaScript
Raw Normal View History

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).RevealNotes=e()}(this,(function(){"use strict";var t=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){function e(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,xhtml:!1}}t.exports={defaults:{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,xhtml:!1},getDefaults:e,changeDefaults:function(e){t.exports.defaults=e}}}));t.defaults,t.getDefaults,t.changeDefaults;const e=/[&<>"']/,n=/[&<>"']/g,i=/[<>"']|&(?!#?\w+;)/,s=/[<>"']|&(?!#?\w+;)/g,r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},a=t=>r[t];const l=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function o(t){return t.replace(l,(t,e)=>"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):"")}const c=/(^|[^\[])\^/g;const d=/[^\w:]/g,u=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;const p={},h=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,m=/^([^:]+:\/*[^/]*)[\s\S]*$/;function f(t,e){p[" "+t]||(h.test(t)?p[" "+t]=t+"/":p[" "+t]=k(t,"/",!0));const n=-1===(t=p[" "+t]).indexOf(":");return"//"===e.substring(0,2)?n?e:t.replace(g,"$1")+e:"/"===e.charAt(0)?n?e:t.replace(m,"$1")+e:t+e}function k(t,e,n){const i=t.length;if(0===i)return"";let s=0;for(;s<i;){const r=t.charAt(i-s-1);if(r!==e||n){if(r===e||!n)break;s++}else s++}return t.substr(0,i-s)}var b={escape:function(t,r){if(r){if(e.test(t))return t.replace(n,a)}else if(i.test(t))return t.replace(s,a);return t},unescape:o,edit:function(t,e){t=t.source||t,e=e||"";const n={replace:(e,i)=>(i=(i=i.source||i).replace(c,"$1"),t=t.replace(e,i),n),getRegex:()=>new RegExp(t,e)};return n},cleanUrl:function(t,e,n){if(t){let t;try{t=decodeURIComponent(o(n)).replace(d,"").toLowerCase()}catch(t){return null}if(0===t.indexOf("javascript:")||0===t.indexOf("vbscript:")||0===t.indexOf("data:"))return null}e&&!u.test(n)&&(n=f(e,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(t){return null}return n},resolveUrl:f,noopTest:{exec:function(){}},merge:function(t){let e,n,i=1;for(;i<arguments.length;i++)for(n in e=arguments[i],e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},splitCells:function(t,e){const n=t.replace(/\|/g,(t,e,n)=>{let i=!1,s=e;for(;--s>=0&&"\\"===n[s];)i=!i;return i?"|":" |"}).split(/ \|/);let i=0;if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n},rtrim:k,findClosingBracket:function(t,e){if(-1===t.indexOf(e[1]))return-1;const n=t.length;let i=0,s=0;for(;s<n;s++)if("\\"===t[s])s++;else if(t[s]===e[0])i++;else if(t[s]===e[1]&&(i--,i<0))return s;return-1},checkSanitizeDeprecation:function(t){t&&t.sanitize&&!t.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}};const{defaults:y}=t,{rtrim:w,splitCells:x,escape:v,findClosingBracket:S}=b;function z(t,e,n){const i=e.href,s=e.title?v(e.title):null;return"!"!==t[0].charAt(0)?{type:"link",raw:n,href:i,title:s,text:t[1]}:{type:"image",raw:n,text:v(t[1]),href:i,title:s}}var T=class{constructor(t){this.options=t||y}space(t){const e=this.rules.block.newline.exec(t);if(e)return e[0].length>1?{type:"space",raw:e[0]}:{raw:"\n"}}code(t,e){const n=this.rules.block.code.exec(t);if(n){const t=e[e.length-1];if(t&&"paragraph"===t.type)return e.pop(),t.text+="\n"+n[0].trimRight(),t.raw+="\n"+n[0],t;{const t=n[0].replace(/^ {4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?t:w(t,"\n")}}}}fences(t){const e=this.