Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-syntax-highlighter

Package Overview
Dependencies
Maintainers
0
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-syntax-highlighter - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3

4

dist/sshpre.cjs.js

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

"use strict";const c=require("vue");const y=(t,e)=>{const n=t.__vccOpts||t;for(const[o,a]of e)n[o]=a;return n},i={quote:/("(?:\\"|[^"])*")|('(?:\\'|[^'])*')/,comment:/(\/\/.*?(?:\n|$)|\/\*.*?(?:\*\/|$))/,doctype:/(&lt;\!DOCTYPE.*?&gt;)/,htmlTag:/&lt;(?:([a-z][\w\d-]*)((?:[\w\d\- ]+=(?:"[^"]*"|'[^']*'))*|(?:(?!&(?:lt|amp);).)*?)(\s*\/?)|(\/?)([a-z][\w\d-]*))&gt;/,htmlentity:/(&amp;(?:[a-z]+|#x?\d+);)/,punctuation:new RegExp("(!==?|(?:[[\\](){}.:,+\\-?=!])+|(?<!&(?:[a-z]+|#x?\\d+));|\\|\\||&lt;|&gt;|&amp;)"),number:/(-?(?:\.\d+|\d+(?:\.\d+)?))/,boolean:/\b(true|false)\b/},h={shell:{quote:i.quote,comment:/(#.*?)(?:\n|$)/,keyword:/\b(p?npm|yarn|i(?:nstall)?|run|audit|outdated|update|publish|whoami|cd|sudo|chmod|chown|ls|cat|vim?|scp|rm|mv|mkdir|ln|open|cwd|which|clear|curl|ping|systemctl|echo|export|open|bash|exit)\b/,param:/( --(?:save|save-dev))(?:\s|$)/},xml:{doctype:i.doctype,quote:i.quote,comment:/(&lt;!--.*?(?:--&gt;|$))/,htmlentity:i.htmlentity,tag:i.htmlTag},html:{doctype:i.doctype,quote:i.quote,comment:/(&lt;!--.*?(?:--&gt;|$))/,htmlentity:i.htmlentity,tag:i.htmlTag},"html-vue":{doctype:i.doctype,quote:i.quote,comment:/(&lt;!--.*?(?:--&gt;|$))/,htmlentity:i.htmlentity,tag:i.htmlTag},pug:{text:/((?:^|\n)[ \t]*|^)\|([ \t]*)([^\n]+(?=\s*(?:\n|$)))/,text2:/([ \t]*)([.#\-\w\d]+(?:\([^)]*\))*)\.\n((?:\n+(?=\4[ \t]+)|(?=\4[ \t]+).+?(?:\n|$)*?)*)(?=\s*(?:\n|$))/,quote:i.quote,comment:/(^|\n)([ \t]*|^)(\/\/-[ \t]*(?:[^\n]*?(?:\n\10[ \t]+[^\n]*)+|[^\n]+(?=\n|$)))/,tag:/([a-z][\w\d-]*|)([.#][a-z][-.\w\d]*|)\b(?:\(((?:[\w\d\- ]+=(?:"[^"]*"|'[^']*'))*|(?:(?!&(?:lt|amp);).)*?)\))?(\.?)([ \t]*)([^\n]+)?(?=\n|$)/,"inline-tag":/#\[([^\[\]]+)\]/},css:{comment:/(\/\*.+?(?:\*\/|$))/,quote:/("(?:\\"|[^"])*")|('(?:\\'|[^'])*')/,pseudo:/(:(?:hover|active|focus|visited|not|before|after|(?:first|last|nth)-child))/,"selector keyword vendor":/(@-(?:moz|o|webkit|ms)-(?=keyframes\s))/,"selector keyword":/((?:@(?:import|media|font-face|keyframes)|screen|print|and)(?=[\s({])|keyframes|\s(?:ul|ol|li|table|div|pre|p|a|img|br|hr|h[1-6]|em|strong|span|html|body|iframe|video|audio|input|button|form|label|fieldset|small|abbr|i|dd|dt)\b)(?=.*\{})/,variable:/(--[a-z0-9\-]+)/,selector:/((?:[.#-\w*+ >:,[\]="~\n]|&gt;)+)(?=\s*\{)/,"attribute keyword vendor":/(-(?:moz|o|webkit|ms)-(?=transform|transition|user-select|tap-highlight-color|animation|background-size|box-shadow))/,"attribute keyword":/\b(content|float|display|position|top|left|right|bottom|(?:(?:max|min)-)?width|(?:(?:max|min|line)-)?height|font(?:-(?:family|style|size|weight|variant|stretch))?|vertical-align|color|opacity|visibility|z-index|pointer-events|user-select|transform(?:-(?:origin|style|delay|duration|property|timing-function))?|transition(?:-(?:delay|duration))?|animation(?:-(?:name|delay|duration|direction|fill-mode))?|backface-visibility|backdrop-filter|background(?:-(?:color|position|image|repeat|size|attachment|origin|clip|blend-mode))?|(?:padding|margin|border)(?:-(?:top|left|right|bottom))?|border(?:-(?:radius|color|width|style|spacing))|white-space|text-(?:align|transform|decoration|shadow|indent)|overflow(?:-(?:x|y))?|(?:letter|word)-spacing|word-break|box-(?:sizing|shadow)|stroke(?:-(?:width|opacity|dasharray|dashoffset|linecap|linejoin))?|fill|speak|outline|user-select|cursor|flex(?:-(?:direction|flow|grow|shrink|basis|wrap))?|(?:justify|align)-(?:content|self|items))(?=\s*:)/,"value keyword vendor":/(-(?:moz|o|webkit|ms)-(?=linear-gradient))/,"value keyword":/\b(inherit|initial|normal|none|unset|auto|inline(?:-(?:block|flex))?|block|flex|absolute|relative|static|fixed|sticky|hidden|visible|top|left|right|bottom|center|middle|baseline|solid|dotted|dashed|line-through|(?:over|under)line|wavy|double|(?:pre-|no)?wrap|pre|break-word|(?:upper|lower)case|capitalize|italic|bold|attr\(.*?\)|linear|ease(?:-in)?(?:-out)?|all|infinite|cubic-bezier|(?:translate|rotate)(?:[X-Z]|3d)?|skew[XY]?|scale|(?:no-)?repeat|repeat(?:-x|-y)|contain|cover|url|(?:repeating-)?(?:linear|radial)-gradient|inset|pointer|(?:flex-)?(?:start|end)|space-(?:between|evenly|around)|stretch|revert|row(?:-reverse)?|column(?:-reverse)?)(?=\s*[,;}(]|\s+[\da-z!])/,"value keyword important":/( ?!important)/,number:i.number,color:/(transparent|#(?:[\da-f]{6}|[\da-f]{3})|rgba?\([\d., ]*\))/,htmlentity:i.htmlentity,punctuation:/([:,;{}@#()!]+)/,attribute:/([a-z-]+)(?=\s*:)/,unit:/(px|pt|cm|%|r?em|m?s|deg|vh|vw|vmin|vmax)(?=(?:\s*[;,{}})]|\s+[-\da-z#]))/,error:/([:,;{}@#()!]+|&lt;|&gt;|&amp;)/},json:{quote:/("(?:\\"|[^"])*")/,number:i.number,boolean:i.boolean,punctuation:/([[\](){}:,]+)/,error:/(&(:?lt|gt|amp);|(?!\s).)/},js:{quote:i.quote,comment:i.comment,number:/\b(\d+(?:\.\d+)?|null)\b/,boolean:i.boolean,this:/\b(this)(?=\W)/,keyword:/\b(new|getElementsBy(?:Tag|Class|)Name|getElementById|querySelector|querySelectorAll|arguments|if|else|do|return|case|default|(?:f|F)unction|typeof|instanceof|undefined|document(?:Element)?|window|console|while|for|forEach|switch|in|break|continue|delete|length|var|let|const|export|import|as|require|from|Class|constructor|Number|Boolean|String|Array|Object|RegExp|Integer|Date|Promise|Proxy|WeakMap|WeakSet|Symbol|SyncManager|File(?:Reader)?|DataTransfer|DocumentFragment|async|await|(?:clear|set)(?:Timeout|Interval)|parse(?:Int|Float)|Math(?=\.)|isNaN|atob|btoa|getComputedStyle)(?=\W)/,htmlentity:i.htmlentity,punctuation:/(!==?|[[\]!(){}:;,+\-%*/?=]+|\.+(?![a-z])|\|\||&lt;|&gt;|&amp;)/,variable:/(\.?[a-z_][\w\d]*)/,"external-var":/(\$|jQuery|JSON)(?=\W|$)/},php:{quote:i.quote,comment:i.comment,special:/(&lt;\?(?:php)?|\?&gt;|__(?:DIR|FILE|LINE|CLASS|METHOD|FUNCTION|NAMESPACE|TRAIT)__)/,punctuation:i.punctuation,number:i.number,boolean:i.boolean,variable:/(\$[\w\d_]+)/,keyword:/\b(define|echo|die|exit|print_r|var_dump|if|else|elseif|do|return|case|default|function|\$this|while|foreach|for|switch|in|break|continue|empty|isset|unset|parse_ini_file|session_(?:start|destroy|id)|header|json_(?:encode|decode)|error_log|(require|include)(:?_once)?|try|throw|new|Exception|catch|finally|preg_(?:match|replace)|list|strlen|substr|str_replace|array_(?:keys|values))(?=\W|$)/},sql:{quote:i.quote,comment:/((?:\-\-|#)\s.*?(?:\n|$)|\/\*.*?\*\/)/,punctuation:i.punctuation,number:/\b(\d+(?:\.\d+)?|null)\b/,boolean:i.boolean,keyword:/\b(\*|DECLARE|BEGIN|END|RETURNS|FUNCTION|CREATE|DATABASE|TABLE|VIEW|COLUMN|INDEX|GRANT|REVOKE|ALL|PRIVILEGES|IDENTIFIED|FLUSH|ALTER|MODIFY|DROP|TRUNCATE|CONSTRAINT|ADD|CHECK|(?:(?:PRIMARY|FOREIGN|UNIQUE) )?KEY|REFERENCES|AUTO_INCREMENT|COMMENT|DEFAULT|UNSIGNED|CHARSET|COLLATE|CHARACTER|ENGINE|SQL_MODE|USE|IF|THEN|NULL|EXISTS|UNIQUE|SELECT|UPDATE|DELETE|(?:INSERT|REPLACE)(?: INTO)?|VALUES|SET|FROM|WHERE|(?:ORDER|GROUP) BY|LIMIT|(?:(?:LEFT|RIGHT|INNER|OUTER|CROSS) |)JOIN|AS|ON|COUNT|AVG|SUM|MIN|MAX|CASE|TO|WHEN|BETWEEN|AND|OR|NOT|IN|LIKE|IS|CONCAT|SUBSTRING|CURRENT_(?:DATE|TIMESTAMP)|USING|HAVING?)(?=\W|$)/,"var-type":/\b((?:var)?char|(?:tiny|small|medium|big)?int|decimal|float|double|real|bit|boolean|date(?:time)?|time(?:stamp)?|year|(?:tiny|medium|long)?(?:text|blob)|enum)\b/}},f={xml:/(\s*)([a-z\d\-:]+)(?:=("|')(.*?)\3)?/g,html:/(\s*)([a-z-]+)(?:=("|')(.*?)\3)?/g,"html-vue":/(\s*)([@:#]?[a-z\d-]+)(?:(?:=("|')(.*?)\3)|)/g,pug:/(\s*|,)([@:#]?[a-z\d-]+)(?:(?:=("|')(.*?)\3)|)/g},E={shell:{quote:2},xml:{quote:2,tag:5},html:{quote:2,tag:5},"html-vue":{quote:2,tag:5},pug:{text:3,text2:3,quote:2,comment:3,tag:6},json:{},php:{quote:2},sql:{quote:2},css:{quote:2},js:{quote:2}},m=t=>t.map(e=>{if(!e.children||typeof e.children=="string")return e.children||"";if(Array.isArray(e.children))return m(e.children);if(e.children.default)return m(e.children.default())}).join(""),x={name:"sshpre",props:{language:{type:String,default:""},label:{type:[String,Boolean],default:!1},tab:{type:[Boolean,String],default:" "},dark:{type:Boolean,default:!1},copyButton:{type:Boolean,default:!1},editable:{type:Boolean,default:!1}},data:()=>({knownLanguages:Object.keys(h),content:"",slotTexts:""}),methods:{htmlize(t){return t.replace(/&(lt|gt|amp);/g,(e,n)=>({lt:"<",gt:">",amp:"&"})[n])},unhtmlize(t){return t.replace(/[<>]/g,e=>({"<":"&lt;",">":"&gt;"})[e])},isColorDark(t){let e,n,o,a,s,r;if(e=t.match(/rgba?\((.*),\s*(.*),\s*(.*?)(?:,\s*([^)]*))\)/))o=parseInt(e[1])<=100,a=parseInt(e[2])<=100,s=parseInt(e[3])<=100,r=parseFloat(e[4])<.3;else if(n=t.match(/#([\da-f]{3}(?:[\da-f]{3})?)/)){const l=n[1].length===3;o=parseInt(n[1][0])<=9,a=parseInt(n[1][l?1:2])<=9,s=parseInt(n[1][l?2:4])<=9}return(o&&a&&s||o&&a&&!s||!o&&a&&s)&&!r},createRegexPattern(){let t="";const e=[];for(const n in h[this.language]){const o=E[this.language][n]||1;for(let a=0;a<o;a++)e.push(n);t+=(t?"|":"")+h[this.language][n].source}return[t,e]},syntaxHighlightHtmlTag(t){const e=(n,o,a,s,r)=>`${o}<span class="attribute">${a}</span>`+(s||r?'<span class="punctuation">=</span>':"")+(s||r?`<span class="quote">${s||""}${r||""}${s||""}</span>`:"");if(this.language==="pug"){let[n,o="",a="",s="",r="",l=""]=t;return o=o.replace(/#[a-z\d-]+/g,p=>`<span class="id">${p}</span>`).replace(/\.[a-z\d-]+/g,p=>`<span class="class">${p}</span>`),a&&(a=a.replace(f.pug,e),a='<span class="punctuation">(</span>'+a+'<span class="punctuation">)</span>'),l&&(l=this.highlightPugInlineTag(l)),`<span class="tag-name">${n}</span>${o}${a}`+(s?'<span class="punctuation">.</span>':"")+(r||"")+(l?`<span class="text">${l}</span>`:"")}else{const[n,o="",a="",s="",r]=t,l=o.replace(f[this.language],e);return`<span class="punctuation">&lt;${s}</span><span class="tag-name">${n||r}</span>`+l+`<span class="punctuation">${a}&gt;</span>`}},highlightPugInlineTag(t){return t.replace(new RegExp(h.pug["inline-tag"],"gsi"),(e,n)=>'<span class="inline-tag">#[</span>'+n.replace(new RegExp(h.pug.tag,"si"),(o,...a)=>(a=a.slice(0,a.length-2),this.syntaxHighlightHtmlTag(a)))+'<span class="inline-tag">]</span>')},highlightInPre(){if(this.knownLanguages.includes(this.language)){const t=this.getCaretPositionInPlainText();this.$refs.code.innerHTML=this.syntaxHighlightContent(this.$refs.code.innerText),this.reinjectCaret(this.$refs.code.childNodes,t)}},getCaretPositionInPlainText(){const t=window.getSelection();t.collapseToEnd();const e=new Range;return e.setStart(this.$refs.code,0),e.setEnd(t.extentNode,t.extentOffset),e.toString().length},reinjectCaret(t,e){var o,a;let n=0;for(const s of t){const r=((o=s.innerText)==null?void 0:o.length)||s.length;if(n+r>=e){s.childNodes.length>1?this.reinjectCaret(s.childNodes,e-n):document.getSelection().setPosition(((a=s.childNodes)==null?void 0:a[0])||s,e-n);break}n+=r}},onKeydown(t){switch(t.which){case 9:this.injectAtCaret(this.tab),t.preventDefault();break;case 13:this.injectAtCaret(`
"use strict";const c=require("vue");const y=(t,e)=>{const n=t.__vccOpts||t;for(const[o,a]of e)n[o]=a;return n},i={quote:/("(?:\\"|[^"])*")|('(?:\\'|[^'])*')/,comment:/(\/\/.*?(?:\n|$)|\/\*.*?(?:\*\/|$))/,doctype:/(&lt;!DOCTYPE.*?&gt;)/,htmlTag:/&lt;(?:([a-z][\w\d-]*)((?:[\w\d\- ]+=(?:"[^"]*"|'[^']*'))*|(?:(?!&(?:lt|amp);).)*?)(\s*\/?)|(\/?)([a-z][\w\d-]*))&gt;/,htmlentity:/(&amp;(?:[a-z]+|#x?\d+);)/,punctuation:new RegExp("(!==?|(?:[[\\](){}.:,+\\-?=!])+|(?<!&(?:[a-z]+|#x?\\d+));|\\|\\||&lt;|&gt;|&amp;)"),number:/(-?(?:\.\d+|\d+(?:\.\d+)?))/,boolean:/\b(true|false)\b/},h={shell:{quote:i.quote,comment:/(#.*?)(?:\n|$)/,keyword:/\b(p?npm|yarn|i(?:nstall)?|run|audit|outdated|update|publish|whoami|cd|sudo|chmod|chown|ls|cat|vim?|scp|rm|mv|mkdir|ln|open|cwd|which|clear|curl|ping|systemctl|echo|export|open|bash|exit)\b/,param:/( --(?:save|save-dev))(?:\s|$)/},xml:{doctype:i.doctype,quote:i.quote,comment:/(&lt;!--.*?(?:--&gt;|$))/,htmlentity:i.htmlentity,tag:i.htmlTag},html:{doctype:i.doctype,quote:i.quote,comment:/(&lt;!--.*?(?:--&gt;|$))/,htmlentity:i.htmlentity,tag:i.htmlTag},"html-vue":{doctype:i.doctype,quote:i.quote,comment:/(&lt;!--.*?(?:--&gt;|$))/,htmlentity:i.htmlentity,tag:i.htmlTag},pug:{text:/((?:^|\n)[ \t]*|^)\|([ \t]*)([^\n]+(?=\s*(?:\n|$)))/,text2:/([ \t]*)([.#\-\w\d]+(?:\([^)]*\))*)\.\n((?:\n+(?=\4[ \t]+)|(?=\4[ \t]+).+?(?:\n|$)*?)*)(?=\s*(?:\n|$))/,quote:i.quote,comment:/(^|\n)([ \t]*|^)(\/\/-[ \t]*(?:[^\n]*?(?:\n\10[ \t]+[^\n]*)+|[^\n]+(?=\n|$)))/,tag:/([a-z][\w\d-]*|)([.#][a-z][-.\w\d]*|)\b(?:\(((?:[\w\d\- ]+=(?:"[^"]*"|'[^']*'))*|(?:(?!&(?:lt|amp);).)*?)\))?(\.?)([ \t]*)([^\n]+)?(?=\n|$)/,"inline-tag":/#\[([^[\]]+)\]/},css:{comment:/(\/\*.+?(?:\*\/|$))/,quote:/("(?:\\"|[^"])*")|('(?:\\'|[^'])*')/,pseudo:/(:(?:hover|active|focus|visited|not|before|after|(?:first|last|nth)-child))/,"selector keyword vendor":/(@-(?:moz|o|webkit|ms)-(?=keyframes\s))/,"selector keyword":/((?:@(?:import|media|font-face|keyframes)|screen|print|and)(?=[\s({])|keyframes|\s(?:ul|ol|li|table|div|pre|p|a|img|br|hr|h[1-6]|em|strong|span|html|body|iframe|video|audio|input|button|form|label|fieldset|small|abbr|i|dd|dt)\b)(?=.*\{})/,variable:/(--[a-z0-9-]+)/,selector:/((?:[.#-\w*+ >:,[\]="~\n]|&gt;)+)(?=\s*\{)/,"attribute keyword vendor":/(-(?:moz|o|webkit|ms)-(?=transform|transition|user-select|tap-highlight-color|animation|background-size|box-shadow))/,"attribute keyword":/\b(content|float|display|position|top|left|right|bottom|(?:(?:max|min)-)?width|(?:(?:max|min|line)-)?height|font(?:-(?:family|style|size|weight|variant|stretch))?|vertical-align|color|opacity|visibility|z-index|pointer-events|user-select|transform(?:-(?:origin|style|delay|duration|property|timing-function))?|transition(?:-(?:delay|duration))?|animation(?:-(?:name|delay|duration|direction|fill-mode))?|backface-visibility|backdrop-filter|background(?:-(?:color|position|image|repeat|size|attachment|origin|clip|blend-mode))?|(?:padding|margin|border)(?:-(?:top|left|right|bottom))?|border(?:-(?:radius|color|width|style|spacing))|white-space|text-(?:align|transform|decoration|shadow|indent)|overflow(?:-(?:x|y))?|(?:letter|word)-spacing|word-break|box-(?:sizing|shadow)|stroke(?:-(?:width|opacity|dasharray|dashoffset|linecap|linejoin))?|fill|speak|outline|user-select|cursor|flex(?:-(?:direction|flow|grow|shrink|basis|wrap))?|(?:justify|align)-(?:content|self|items))(?=\s*:)/,"value keyword vendor":/(-(?:moz|o|webkit|ms)-(?=linear-gradient))/,"value keyword":/\b(inherit|initial|normal|none|unset|auto|inline(?:-(?:block|flex))?|block|flex|absolute|relative|static|fixed|sticky|hidden|visible|top|left|right|bottom|center|middle|baseline|solid|dotted|dashed|line-through|(?:over|under)line|wavy|double|(?:pre-|no)?wrap|pre|break-word|(?:upper|lower)case|capitalize|italic|bold|attr\(.*?\)|linear|ease(?:-in)?(?:-out)?|all|infinite|cubic-bezier|(?:translate|rotate)(?:[X-Z]|3d)?|skew[XY]?|scale|(?:no-)?repeat|repeat(?:-x|-y)|contain|cover|url|(?:repeating-)?(?:linear|radial)-gradient|inset|pointer|(?:flex-)?(?:start|end)|space-(?:between|evenly|around)|stretch|revert|row(?:-reverse)?|column(?:-reverse)?)(?=\s*[,;}(]|\s+[\da-z!])/,"value keyword important":/( ?!important)/,number:i.number,color:/(transparent|#(?:[\da-f]{6}|[\da-f]{3})|rgba?\([\d., ]*\))/,htmlentity:i.htmlentity,punctuation:/([:,;{}@#()!]+)/,attribute:/([a-z-]+)(?=\s*:)/,unit:/(px|pt|cm|%|r?em|m?s|deg|vh|vw|vmin|vmax)(?=(?:\s*[;,{}})]|\s+[-\da-z#]))/,error:/([:,;{}@#()!]+|&lt;|&gt;|&amp;)/},json:{quote:/("(?:\\"|[^"])*")/,number:i.number,boolean:i.boolean,punctuation:/([[\](){}:,]+)/,error:/(&(:?lt|gt|amp);|(?!\s).)/},js:{quote:i.quote,comment:i.comment,number:/\b(\d+(?:\.\d+)?|null)\b/,boolean:i.boolean,this:/\b(this)(?=\W)/,keyword:/\b(new|getElementsBy(?:Tag|Class|)Name|getElementById|querySelector|querySelectorAll|arguments|if|else|do|return|case|default|(?:f|F)unction|typeof|instanceof|undefined|document(?:Element)?|window|console|while|for|forEach|switch|in|break|continue|delete|length|var|let|const|export|import|as|require|from|Class|constructor|Number|Boolean|String|Array|Object|RegExp|Integer|Date|Promise|Proxy|WeakMap|WeakSet|Symbol|SyncManager|File(?:Reader)?|DataTransfer|DocumentFragment|async|await|(?:clear|set)(?:Timeout|Interval)|parse(?:Int|Float)|Math(?=\.)|isNaN|atob|btoa|getComputedStyle)(?=\W)/,htmlentity:i.htmlentity,punctuation:/(!==?|[[\]!(){}:;,+\-%*/?=]+|\.+(?![a-z])|\|\||&lt;|&gt;|&amp;)/,variable:/(\.?[a-z_][\w\d]*)/,"external-var":/(\$|jQuery|JSON)(?=\W|$)/},php:{quote:i.quote,comment:i.comment,special:/(&lt;\?(?:php)?|\?&gt;|__(?:DIR|FILE|LINE|CLASS|METHOD|FUNCTION|NAMESPACE|TRAIT)__)/,punctuation:i.punctuation,number:i.number,boolean:i.boolean,variable:/(\$[\w\d_]+)/,keyword:/\b(define|echo|die|exit|print_r|var_dump|if|else|elseif|do|return|case|default|function|\$this|while|foreach|for|switch|in|break|continue|empty|isset|unset|parse_ini_file|session_(?:start|destroy|id)|header|json_(?:encode|decode)|error_log|(require|include)(:?_once)?|try|throw|new|Exception|catch|finally|preg_(?:match|replace)|list|strlen|substr|str_replace|array_(?:keys|values))(?=\W|$)/},sql:{quote:i.quote,comment:/((?:--|#)\s.*?(?:\n|$)|\/\*.*?\*\/)/,punctuation:i.punctuation,number:/\b(\d+(?:\.\d+)?|null)\b/,boolean:i.boolean,keyword:/\b(\*|DECLARE|BEGIN|END|RETURNS|FUNCTION|CREATE|DATABASE|TABLE|VIEW|COLUMN|INDEX|GRANT|REVOKE|ALL|PRIVILEGES|IDENTIFIED|FLUSH|ALTER|MODIFY|DROP|TRUNCATE|CONSTRAINT|ADD|CHECK|(?:(?:PRIMARY|FOREIGN|UNIQUE) )?KEY|REFERENCES|AUTO_INCREMENT|COMMENT|DEFAULT|UNSIGNED|CHARSET|COLLATE|CHARACTER|ENGINE|SQL_MODE|USE|IF|THEN|NULL|EXISTS|UNIQUE|SELECT|UPDATE|DELETE|(?:INSERT|REPLACE)(?: INTO)?|VALUES|SET|FROM|WHERE|(?:ORDER|GROUP) BY|LIMIT|(?:(?:LEFT|RIGHT|INNER|OUTER|CROSS) |)JOIN|AS|ON|COUNT|AVG|SUM|MIN|MAX|CASE|TO|WHEN|BETWEEN|AND|OR|NOT|IN|LIKE|IS|CONCAT|SUBSTRING|CURRENT_(?:DATE|TIMESTAMP)|USING|HAVING?)(?=\W|$)/,"var-type":/\b((?:var)?char|(?:tiny|small|medium|big)?int|decimal|float|double|real|bit|boolean|date(?:time)?|time(?:stamp)?|year|(?:tiny|medium|long)?(?:text|blob)|enum)\b/}},f={xml:/(\s*)([a-z\d\-:]+)(?:=("|')(.*?)\3)?/g,html:/(\s*)([a-z-]+)(?:=("|')(.*?)\3)?/g,"html-vue":/(\s*)([@:#]?[a-z\d-]+)(?:(?:=("|')(.*?)\3)|)/g,pug:/(\s*|,)([@:#]?[a-z\d-]+)(?:(?:=("|')(.*?)\3)|)/g},E={shell:{quote:2},xml:{quote:2,tag:5},html:{quote:2,tag:5},"html-vue":{quote:2,tag:5},pug:{text:3,text2:3,quote:2,comment:3,tag:6},json:{},php:{quote:2},sql:{quote:2},css:{quote:2},js:{quote:2}},m=t=>t.map(e=>{if(!e.children||typeof e.children=="string")return e.children||"";if(Array.isArray(e.children))return m(e.children);if(e.children.default)return m(e.children.default())}).join(""),x={name:"sshpre",props:{language:{type:String,default:""},label:{type:[String,Boolean],default:!1},tab:{type:[Boolean,String],default:" "},dark:{type:Boolean,default:!1},copyButton:{type:Boolean,default:!1},editable:{type:Boolean,default:!1}},data:()=>({knownLanguages:Object.keys(h),content:"",slotTexts:""}),methods:{htmlize(t){return t.replace(/&(lt|gt|amp);/g,(e,n)=>({lt:"<",gt:">",amp:"&"})[n])},unhtmlize(t){return t.replace(/[<>]/g,e=>({"<":"&lt;",">":"&gt;"})[e])},isColorDark(t){let e,n,o,a,s,r;if(e=t.match(/rgba?\((.*),\s*(.*),\s*(.*?)(?:,\s*([^)]*))\)/))o=parseInt(e[1])<=100,a=parseInt(e[2])<=100,s=parseInt(e[3])<=100,r=parseFloat(e[4])<.3;else if(n=t.match(/#([\da-f]{3}(?:[\da-f]{3})?)/)){const l=n[1].length===3;o=parseInt(n[1][0])<=9,a=parseInt(n[1][l?1:2])<=9,s=parseInt(n[1][l?2:4])<=9}return(o&&a&&s||o&&a&&!s||!o&&a&&s)&&!r},createRegexPattern(){let t="";const e=[];for(const n in h[this.language]){const o=E[this.language][n]||1;for(let a=0;a<o;a++)e.push(n);t+=(t?"|":"")+h[this.language][n].source}return[t,e]},syntaxHighlightHtmlTag(t){const e=(n,o,a,s,r)=>`${o}<span class="attribute">${a}</span>`+(s||r?'<span class="punctuation">=</span>':"")+(s||r?`<span class="quote">${s||""}${r||""}${s||""}</span>`:"");if(this.language==="pug"){let[n,o="",a="",s="",r="",l=""]=t;return o=o.replace(/#[a-z\d-]+/g,p=>`<span class="id">${p}</span>`).replace(/\.[a-z\d-]+/g,p=>`<span class="class">${p}</span>`),a&&(a=a.replace(f.pug,e),a='<span class="punctuation">(</span>'+a+'<span class="punctuation">)</span>'),l&&(l=this.highlightPugInlineTag(l)),`<span class="tag-name">${n}</span>${o}${a}`+(s?'<span class="punctuation">.</span>':"")+(r||"")+(l?`<span class="text">${l}</span>`:"")}else{const[n,o="",a="",s="",r]=t,l=o.replace(f[this.language],e);return`<span class="punctuation">&lt;${s}</span><span class="tag-name">${n||r}</span>`+l+`<span class="punctuation">${a}&gt;</span>`}},highlightPugInlineTag(t){return t.replace(new RegExp(h.pug["inline-tag"],"gsi"),(e,n)=>'<span class="inline-tag">#[</span>'+n.replace(new RegExp(h.pug.tag,"si"),(o,...a)=>(a=a.slice(0,a.length-2),this.syntaxHighlightHtmlTag(a)))+'<span class="inline-tag">]</span>')},highlightInPre(){if(this.knownLanguages.includes(this.language)){const t=this.getCaretPositionInPlainText();this.$refs.code.innerHTML=this.syntaxHighlightContent(this.$refs.code.innerText),this.reinjectCaret(this.$refs.code.childNodes,t)}},getCaretPositionInPlainText(){const t=window.getSelection();t.collapseToEnd();const e=new Range;return e.setStart(this.$refs.code,0),e.setEnd(t.extentNode,t.extentOffset),e.toString().length},reinjectCaret(t,e){var o,a;let n=0;for(const s of t){const r=((o=s.innerText)==null?void 0:o.length)||s.length;if(n+r>=e){s.childNodes.length>1?this.reinjectCaret(s.childNodes,e-n):document.getSelection().setPosition(((a=s.childNodes)==null?void 0:a[0])||s,e-n);break}n+=r}},onKeydown(t){switch(t.which){case 9:this.injectAtCaret(this.tab),t.preventDefault();break;case 13:this.injectAtCaret(`
`),t.preventDefault();break}},injectAtCaret(t){const e=window.getSelection(),n=e.getRangeAt(0),o=document.createTextNode(t);n.insertNode(o),e.collapseToEnd()},syntaxHighlightContent(t){if(!this.knownLanguages.includes(this.language))return t;const[e,n]=this.createRegexPattern();return this.unhtmlize(t.replace(/&/g,"&amp;")).replace(new RegExp(e,"gsi"),(o,...a)=>{a=a.slice(0,a.length-2);let s;const r=this.language==="pug";let l=a.find((u,d)=>u&&(s=n[d])&&u);if(["punctuation","quote","htmlentity"].includes(s))l=this.unhtmlize(l);else if(s==="comment")if(r){const[u,d,g]=a.slice(n.indexOf("comment"));l=`${u}${d}${this.unhtmlize(g)}`}else l=this.unhtmlize(l);else if(s==="text"&&r){let[u,d,g]=a;return g=this.highlightPugInlineTag(g),`${u}<span class="punctuation">|</span>${d}<span class="text">${g}</span>`}else if(s==="text2"&&r){const[,,,u,d,g]=a,b=this.syntaxHighlightContent(d);return`${u}${b}<span class="punctuation">.</span>
<span class="text">${g}</span>`}else{if(s==="tag"&&["xml","html","html-vue","pug"].includes(this.language))return this.syntaxHighlightHtmlTag(a.slice(n.indexOf("tag")));if(s==="variable"&&l[0]==="."&&this.language==="js")return`<span class="punctuation">.</span><span class="obj-attr">${l.substr(1)}</span>`}let p="";return s==="color"&&this.language==="css"&&(p=` style="background-color: ${l};color: #${this.isColorDark(l)?"fff":"000"}"`),s&&`<span class="${s}"${p}>${l}</span>`||""})},getSlotContent(){return this.$slots.default&&m(this.$slots.default())||""},copyCode(t){t.target.insertAdjacentHTML("afterend",`<textarea id="clipboard-textarea">${this.$refs.code.innerText}</textarea>`);const e=document.getElementById("clipboard-textarea");e.select(),e.setSelectionRange(0,99999),document.execCommand("copy"),e.remove(),this.$emit("copied",this.$refs.code.innerText)}},mounted(){const t=this.getSlotContent();this.$refs.code.innerText=t,this.$refs.code.innerHTML=this.syntaxHighlightContent(this.$refs.code.innerText)},beforeUpdate(){this.$refs.code.innerHTML=this.syntaxHighlightContent(this.getSlotContent())}},T=["data-type","data-label"],w=["contenteditable"],N={class:"ssh-pre__original"};function C(t,e,n,o,a,s){return c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["ssh-pre",{"ssh-pre--dark":n.dark}]),"data-type":n.language,"data-label":n.label||null},[n.copyButton?(c.openBlock(),c.createElementBlock("button",{key:0,class:"ssh-pre__copy",onClick:e[0]||(e[0]=(...r)=>s.copyCode&&s.copyCode(...r))},[c.renderSlot(t.$slots,"copy-button",{},()=>[c.createTextVNode("Copy")])])):c.createCommentVNode("",!0),c.createTextVNode(),c.createElementVNode("pre",{ref:"code",class:"ssh-pre__content",contenteditable:n.editable?"true":"false",onKeydown:e[1]||(e[1]=r=>n.editable&&s.onKeydown(r)),onInput:e[2]||(e[2]=(...r)=>s.highlightInPre&&s.highlightInPre(...r))}," ",40,w),c.createTextVNode(),c.createElementVNode("div",N,[c.renderSlot(t.$slots,"default")])],10,T)}const v=y(x,[["render",C]]);module.exports=v;
<span class="text">${g}</span>`}else{if(s==="tag"&&["xml","html","html-vue","pug"].includes(this.language))return this.syntaxHighlightHtmlTag(a.slice(n.indexOf("tag")));if(s==="variable"&&l[0]==="."&&this.language==="js")return`<span class="punctuation">.</span><span class="obj-attr">${l.substr(1)}</span>`}let p="";return s==="color"&&this.language==="css"&&(p=` style="background-color: ${l};color: #${this.isColorDark(l)?"fff":"000"}"`),s&&`<span class="${s}"${p}>${l}</span>`||""})},getSlotContent(){return this.$slots.default&&m(this.$slots.default())||""},copyCode(t){t.target.insertAdjacentHTML("afterend",`<textarea id="clipboard-textarea">${this.$refs.code.innerText}</textarea>`);const e=document.getElementById("clipboard-textarea");e.select(),e.setSelectionRange(0,99999),document.execCommand("copy"),e.remove(),this.$emit("copied",this.$refs.code.innerText)}},mounted(){const t=this.getSlotContent();this.$refs.code.innerText=t,this.$refs.code.innerHTML=this.syntaxHighlightContent(this.$refs.code.innerText)},beforeUpdate(){this.$refs.code&&(this.$refs.code.innerHTML=this.syntaxHighlightContent(this.getSlotContent()))}},T=["data-type","data-label"],w=["contenteditable"],N={class:"ssh-pre__original"};function C(t,e,n,o,a,s){return c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["ssh-pre",{"ssh-pre--dark":n.dark}]),"data-type":n.language,"data-label":n.label||null},[n.copyButton?(c.openBlock(),c.createElementBlock("button",{key:0,class:"ssh-pre__copy",onClick:e[0]||(e[0]=(...r)=>s.copyCode&&s.copyCode(...r))},[c.renderSlot(t.$slots,"copy-button",{},()=>[c.createTextVNode("Copy")])])):c.createCommentVNode("",!0),c.createTextVNode(),c.createElementVNode("pre",{ref:"code",class:"ssh-pre__content",contenteditable:n.editable?"true":"false",onKeydown:e[1]||(e[1]=r=>n.editable&&s.onKeydown(r)),onInput:e[2]||(e[2]=(...r)=>s.highlightInPre&&s.highlightInPre(...r))}," ",40,w),c.createTextVNode(),c.createElementVNode("div",N,[c.renderSlot(t.$slots,"default")])],10,T)}const v=y(x,[["render",C]]);module.exports=v;

@@ -10,3 +10,3 @@ import { openBlock as f, createElementBlock as b, normalizeClass as w, renderSlot as y, createTextVNode as h, createCommentVNode as C, createElementVNode as E } from "vue";

comment: /(\/\/.*?(?:\n|$)|\/\*.*?(?:\*\/|$))/,
doctype: /(&lt;\!DOCTYPE.*?&gt;)/,
doctype: /(&lt;!DOCTYPE.*?&gt;)/,
htmlTag: /&lt;(?:([a-z][\w\d-]*)((?:[\w\d\- ]+=(?:"[^"]*"|'[^']*'))*|(?:(?!&(?:lt|amp);).)*?)(\s*\/?)|(\/?)([a-z][\w\d-]*))&gt;/,

@@ -51,3 +51,3 @@ htmlentity: /(&amp;(?:[a-z]+|#x?\d+);)/,

tag: /([a-z][\w\d-]*|)([.#][a-z][-.\w\d]*|)\b(?:\(((?:[\w\d\- ]+=(?:"[^"]*"|'[^']*'))*|(?:(?!&(?:lt|amp);).)*?)\))?(\.?)([ \t]*)([^\n]+)?(?=\n|$)/,
"inline-tag": /#\[([^\[\]]+)\]/
"inline-tag": /#\[([^[\]]+)\]/
},

@@ -60,3 +60,3 @@ css: {

"selector keyword": /((?:@(?:import|media|font-face|keyframes)|screen|print|and)(?=[\s({])|keyframes|\s(?:ul|ol|li|table|div|pre|p|a|img|br|hr|h[1-6]|em|strong|span|html|body|iframe|video|audio|input|button|form|label|fieldset|small|abbr|i|dd|dt)\b)(?=.*\{})/,
variable: /(--[a-z0-9\-]+)/,
variable: /(--[a-z0-9-]+)/,
selector: /((?:[.#-\w*+ >:,[\]="~\n]|&gt;)+)(?=\s*\{)/,

@@ -107,3 +107,3 @@ "attribute keyword vendor": /(-(?:moz|o|webkit|ms)-(?=transform|transition|user-select|tap-highlight-color|animation|background-size|box-shadow))/,

quote: i.quote,
comment: /((?:\-\-|#)\s.*?(?:\n|$)|\/\*.*?\*\/)/,
comment: /((?:--|#)\s.*?(?:\n|$)|\/\*.*?\*\/)/,
punctuation: i.punctuation,

@@ -284,3 +284,3 @@ number: /\b(\d+(?:\.\d+)?|null)\b/,

beforeUpdate() {
this.$refs.code.innerHTML = this.syntaxHighlightContent(this.getSlotContent());
this.$refs.code && (this.$refs.code.innerHTML = this.syntaxHighlightContent(this.getSlotContent()));
}

@@ -287,0 +287,0 @@ }, $ = ["data-type", "data-label"], k = ["contenteditable"], S = { class: "ssh-pre__original" };

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

(function(c,m){typeof exports=="object"&&typeof module<"u"?module.exports=m(require("vue")):typeof define=="function"&&define.amd?define(["vue"],m):(c=typeof globalThis<"u"?globalThis:c||self,c.sshpre=m(c.Vue))})(this,function(c){"use strict";const m="",y=(t,e)=>{const n=t.__vccOpts||t;for(const[o,a]of e)n[o]=a;return n},i={quote:/("(?:\\"|[^"])*")|('(?:\\'|[^'])*')/,comment:/(\/\/.*?(?:\n|$)|\/\*.*?(?:\*\/|$))/,doctype:/(&lt;\!DOCTYPE.*?&gt;)/,htmlTag:/&lt;(?:([a-z][\w\d-]*)((?:[\w\d\- ]+=(?:"[^"]*"|'[^']*'))*|(?:(?!&(?:lt|amp);).)*?)(\s*\/?)|(\/?)([a-z][\w\d-]*))&gt;/,htmlentity:/(&amp;(?:[a-z]+|#x?\d+);)/,punctuation:new RegExp("(!==?|(?:[[\\](){}.:,+\\-?=!])+|(?<!&(?:[a-z]+|#x?\\d+));|\\|\\||&lt;|&gt;|&amp;)"),number:/(-?(?:\.\d+|\d+(?:\.\d+)?))/,boolean:/\b(true|false)\b/},h={shell:{quote:i.quote,comment:/(#.*?)(?:\n|$)/,keyword:/\b(p?npm|yarn|i(?:nstall)?|run|audit|outdated|update|publish|whoami|cd|sudo|chmod|chown|ls|cat|vim?|scp|rm|mv|mkdir|ln|open|cwd|which|clear|curl|ping|systemctl|echo|export|open|bash|exit)\b/,param:/( --(?:save|save-dev))(?:\s|$)/},xml:{doctype:i.doctype,quote:i.quote,comment:/(&lt;!--.*?(?:--&gt;|$))/,htmlentity:i.htmlentity,tag:i.htmlTag},html:{doctype:i.doctype,quote:i.quote,comment:/(&lt;!--.*?(?:--&gt;|$))/,htmlentity:i.htmlentity,tag:i.htmlTag},"html-vue":{doctype:i.doctype,quote:i.quote,comment:/(&lt;!--.*?(?:--&gt;|$))/,htmlentity:i.htmlentity,tag:i.htmlTag},pug:{text:/((?:^|\n)[ \t]*|^)\|([ \t]*)([^\n]+(?=\s*(?:\n|$)))/,text2:/([ \t]*)([.#\-\w\d]+(?:\([^)]*\))*)\.\n((?:\n+(?=\4[ \t]+)|(?=\4[ \t]+).+?(?:\n|$)*?)*)(?=\s*(?:\n|$))/,quote:i.quote,comment:/(^|\n)([ \t]*|^)(\/\/-[ \t]*(?:[^\n]*?(?:\n\10[ \t]+[^\n]*)+|[^\n]+(?=\n|$)))/,tag:/([a-z][\w\d-]*|)([.#][a-z][-.\w\d]*|)\b(?:\(((?:[\w\d\- ]+=(?:"[^"]*"|'[^']*'))*|(?:(?!&(?:lt|amp);).)*?)\))?(\.?)([ \t]*)([^\n]+)?(?=\n|$)/,"inline-tag":/#\[([^\[\]]+)\]/},css:{comment:/(\/\*.+?(?:\*\/|$))/,quote:/("(?:\\"|[^"])*")|('(?:\\'|[^'])*')/,pseudo:/(:(?:hover|active|focus|visited|not|before|after|(?:first|last|nth)-child))/,"selector keyword vendor":/(@-(?:moz|o|webkit|ms)-(?=keyframes\s))/,"selector keyword":/((?:@(?:import|media|font-face|keyframes)|screen|print|and)(?=[\s({])|keyframes|\s(?:ul|ol|li|table|div|pre|p|a|img|br|hr|h[1-6]|em|strong|span|html|body|iframe|video|audio|input|button|form|label|fieldset|small|abbr|i|dd|dt)\b)(?=.*\{})/,variable:/(--[a-z0-9\-]+)/,selector:/((?:[.#-\w*+ >:,[\]="~\n]|&gt;)+)(?=\s*\{)/,"attribute keyword vendor":/(-(?:moz|o|webkit|ms)-(?=transform|transition|user-select|tap-highlight-color|animation|background-size|box-shadow))/,"attribute keyword":/\b(content|float|display|position|top|left|right|bottom|(?:(?:max|min)-)?width|(?:(?:max|min|line)-)?height|font(?:-(?:family|style|size|weight|variant|stretch))?|vertical-align|color|opacity|visibility|z-index|pointer-events|user-select|transform(?:-(?:origin|style|delay|duration|property|timing-function))?|transition(?:-(?:delay|duration))?|animation(?:-(?:name|delay|duration|direction|fill-mode))?|backface-visibility|backdrop-filter|background(?:-(?:color|position|image|repeat|size|attachment|origin|clip|blend-mode))?|(?:padding|margin|border)(?:-(?:top|left|right|bottom))?|border(?:-(?:radius|color|width|style|spacing))|white-space|text-(?:align|transform|decoration|shadow|indent)|overflow(?:-(?:x|y))?|(?:letter|word)-spacing|word-break|box-(?:sizing|shadow)|stroke(?:-(?:width|opacity|dasharray|dashoffset|linecap|linejoin))?|fill|speak|outline|user-select|cursor|flex(?:-(?:direction|flow|grow|shrink|basis|wrap))?|(?:justify|align)-(?:content|self|items))(?=\s*:)/,"value keyword vendor":/(-(?:moz|o|webkit|ms)-(?=linear-gradient))/,"value keyword":/\b(inherit|initial|normal|none|unset|auto|inline(?:-(?:block|flex))?|block|flex|absolute|relative|static|fixed|sticky|hidden|visible|top|left|right|bottom|center|middle|baseline|solid|dotted|dashed|line-through|(?:over|under)line|wavy|double|(?:pre-|no)?wrap|pre|break-word|(?:upper|lower)case|capitalize|italic|bold|attr\(.*?\)|linear|ease(?:-in)?(?:-out)?|all|infinite|cubic-bezier|(?:translate|rotate)(?:[X-Z]|3d)?|skew[XY]?|scale|(?:no-)?repeat|repeat(?:-x|-y)|contain|cover|url|(?:repeating-)?(?:linear|radial)-gradient|inset|pointer|(?:flex-)?(?:start|end)|space-(?:between|evenly|around)|stretch|revert|row(?:-reverse)?|column(?:-reverse)?)(?=\s*[,;}(]|\s+[\da-z!])/,"value keyword important":/( ?!important)/,number:i.number,color:/(transparent|#(?:[\da-f]{6}|[\da-f]{3})|rgba?\([\d., ]*\))/,htmlentity:i.htmlentity,punctuation:/([:,;{}@#()!]+)/,attribute:/([a-z-]+)(?=\s*:)/,unit:/(px|pt|cm|%|r?em|m?s|deg|vh|vw|vmin|vmax)(?=(?:\s*[;,{}})]|\s+[-\da-z#]))/,error:/([:,;{}@#()!]+|&lt;|&gt;|&amp;)/},json:{quote:/("(?:\\"|[^"])*")/,number:i.number,boolean:i.boolean,punctuation:/([[\](){}:,]+)/,error:/(&(:?lt|gt|amp);|(?!\s).)/},js:{quote:i.quote,comment:i.comment,number:/\b(\d+(?:\.\d+)?|null)\b/,boolean:i.boolean,this:/\b(this)(?=\W)/,keyword:/\b(new|getElementsBy(?:Tag|Class|)Name|getElementById|querySelector|querySelectorAll|arguments|if|else|do|return|case|default|(?:f|F)unction|typeof|instanceof|undefined|document(?:Element)?|window|console|while|for|forEach|switch|in|break|continue|delete|length|var|let|const|export|import|as|require|from|Class|constructor|Number|Boolean|String|Array|Object|RegExp|Integer|Date|Promise|Proxy|WeakMap|WeakSet|Symbol|SyncManager|File(?:Reader)?|DataTransfer|DocumentFragment|async|await|(?:clear|set)(?:Timeout|Interval)|parse(?:Int|Float)|Math(?=\.)|isNaN|atob|btoa|getComputedStyle)(?=\W)/,htmlentity:i.htmlentity,punctuation:/(!==?|[[\]!(){}:;,+\-%*/?=]+|\.+(?![a-z])|\|\||&lt;|&gt;|&amp;)/,variable:/(\.?[a-z_][\w\d]*)/,"external-var":/(\$|jQuery|JSON)(?=\W|$)/},php:{quote:i.quote,comment:i.comment,special:/(&lt;\?(?:php)?|\?&gt;|__(?:DIR|FILE|LINE|CLASS|METHOD|FUNCTION|NAMESPACE|TRAIT)__)/,punctuation:i.punctuation,number:i.number,boolean:i.boolean,variable:/(\$[\w\d_]+)/,keyword:/\b(define|echo|die|exit|print_r|var_dump|if|else|elseif|do|return|case|default|function|\$this|while|foreach|for|switch|in|break|continue|empty|isset|unset|parse_ini_file|session_(?:start|destroy|id)|header|json_(?:encode|decode)|error_log|(require|include)(:?_once)?|try|throw|new|Exception|catch|finally|preg_(?:match|replace)|list|strlen|substr|str_replace|array_(?:keys|values))(?=\W|$)/},sql:{quote:i.quote,comment:/((?:\-\-|#)\s.*?(?:\n|$)|\/\*.*?\*\/)/,punctuation:i.punctuation,number:/\b(\d+(?:\.\d+)?|null)\b/,boolean:i.boolean,keyword:/\b(\*|DECLARE|BEGIN|END|RETURNS|FUNCTION|CREATE|DATABASE|TABLE|VIEW|COLUMN|INDEX|GRANT|REVOKE|ALL|PRIVILEGES|IDENTIFIED|FLUSH|ALTER|MODIFY|DROP|TRUNCATE|CONSTRAINT|ADD|CHECK|(?:(?:PRIMARY|FOREIGN|UNIQUE) )?KEY|REFERENCES|AUTO_INCREMENT|COMMENT|DEFAULT|UNSIGNED|CHARSET|COLLATE|CHARACTER|ENGINE|SQL_MODE|USE|IF|THEN|NULL|EXISTS|UNIQUE|SELECT|UPDATE|DELETE|(?:INSERT|REPLACE)(?: INTO)?|VALUES|SET|FROM|WHERE|(?:ORDER|GROUP) BY|LIMIT|(?:(?:LEFT|RIGHT|INNER|OUTER|CROSS) |)JOIN|AS|ON|COUNT|AVG|SUM|MIN|MAX|CASE|TO|WHEN|BETWEEN|AND|OR|NOT|IN|LIKE|IS|CONCAT|SUBSTRING|CURRENT_(?:DATE|TIMESTAMP)|USING|HAVING?)(?=\W|$)/,"var-type":/\b((?:var)?char|(?:tiny|small|medium|big)?int|decimal|float|double|real|bit|boolean|date(?:time)?|time(?:stamp)?|year|(?:tiny|medium|long)?(?:text|blob)|enum)\b/}},b={xml:/(\s*)([a-z\d\-:]+)(?:=("|')(.*?)\3)?/g,html:/(\s*)([a-z-]+)(?:=("|')(.*?)\3)?/g,"html-vue":/(\s*)([@:#]?[a-z\d-]+)(?:(?:=("|')(.*?)\3)|)/g,pug:/(\s*|,)([@:#]?[a-z\d-]+)(?:(?:=("|')(.*?)\3)|)/g},E={shell:{quote:2},xml:{quote:2,tag:5},html:{quote:2,tag:5},"html-vue":{quote:2,tag:5},pug:{text:3,text2:3,quote:2,comment:3,tag:6},json:{},php:{quote:2},sql:{quote:2},css:{quote:2},js:{quote:2}},f=t=>t.map(e=>{if(!e.children||typeof e.children=="string")return e.children||"";if(Array.isArray(e.children))return f(e.children);if(e.children.default)return f(e.children.default())}).join(""),x={name:"sshpre",props:{language:{type:String,default:""},label:{type:[String,Boolean],default:!1},tab:{type:[Boolean,String],default:" "},dark:{type:Boolean,default:!1},copyButton:{type:Boolean,default:!1},editable:{type:Boolean,default:!1}},data:()=>({knownLanguages:Object.keys(h),content:"",slotTexts:""}),methods:{htmlize(t){return t.replace(/&(lt|gt|amp);/g,(e,n)=>({lt:"<",gt:">",amp:"&"})[n])},unhtmlize(t){return t.replace(/[<>]/g,e=>({"<":"&lt;",">":"&gt;"})[e])},isColorDark(t){let e,n,o,a,s,r;if(e=t.match(/rgba?\((.*),\s*(.*),\s*(.*?)(?:,\s*([^)]*))\)/))o=parseInt(e[1])<=100,a=parseInt(e[2])<=100,s=parseInt(e[3])<=100,r=parseFloat(e[4])<.3;else if(n=t.match(/#([\da-f]{3}(?:[\da-f]{3})?)/)){const l=n[1].length===3;o=parseInt(n[1][0])<=9,a=parseInt(n[1][l?1:2])<=9,s=parseInt(n[1][l?2:4])<=9}return(o&&a&&s||o&&a&&!s||!o&&a&&s)&&!r},createRegexPattern(){let t="";const e=[];for(const n in h[this.language]){const o=E[this.language][n]||1;for(let a=0;a<o;a++)e.push(n);t+=(t?"|":"")+h[this.language][n].source}return[t,e]},syntaxHighlightHtmlTag(t){const e=(n,o,a,s,r)=>`${o}<span class="attribute">${a}</span>`+(s||r?'<span class="punctuation">=</span>':"")+(s||r?`<span class="quote">${s||""}${r||""}${s||""}</span>`:"");if(this.language==="pug"){let[n,o="",a="",s="",r="",l=""]=t;return o=o.replace(/#[a-z\d-]+/g,g=>`<span class="id">${g}</span>`).replace(/\.[a-z\d-]+/g,g=>`<span class="class">${g}</span>`),a&&(a=a.replace(b.pug,e),a='<span class="punctuation">(</span>'+a+'<span class="punctuation">)</span>'),l&&(l=this.highlightPugInlineTag(l)),`<span class="tag-name">${n}</span>${o}${a}`+(s?'<span class="punctuation">.</span>':"")+(r||"")+(l?`<span class="text">${l}</span>`:"")}else{const[n,o="",a="",s="",r]=t,l=o.replace(b[this.language],e);return`<span class="punctuation">&lt;${s}</span><span class="tag-name">${n||r}</span>`+l+`<span class="punctuation">${a}&gt;</span>`}},highlightPugInlineTag(t){return t.replace(new RegExp(h.pug["inline-tag"],"gsi"),(e,n)=>'<span class="inline-tag">#[</span>'+n.replace(new RegExp(h.pug.tag,"si"),(o,...a)=>(a=a.slice(0,a.length-2),this.syntaxHighlightHtmlTag(a)))+'<span class="inline-tag">]</span>')},highlightInPre(){if(this.knownLanguages.includes(this.language)){const t=this.getCaretPositionInPlainText();this.$refs.code.innerHTML=this.syntaxHighlightContent(this.$refs.code.innerText),this.reinjectCaret(this.$refs.code.childNodes,t)}},getCaretPositionInPlainText(){const t=window.getSelection();t.collapseToEnd();const e=new Range;return e.setStart(this.$refs.code,0),e.setEnd(t.extentNode,t.extentOffset),e.toString().length},reinjectCaret(t,e){var o,a;let n=0;for(const s of t){const r=((o=s.innerText)==null?void 0:o.length)||s.length;if(n+r>=e){s.childNodes.length>1?this.reinjectCaret(s.childNodes,e-n):document.getSelection().setPosition(((a=s.childNodes)==null?void 0:a[0])||s,e-n);break}n+=r}},onKeydown(t){switch(t.which){case 9:this.injectAtCaret(this.tab),t.preventDefault();break;case 13:this.injectAtCaret(`
(function(c,m){typeof exports=="object"&&typeof module<"u"?module.exports=m(require("vue")):typeof define=="function"&&define.amd?define(["vue"],m):(c=typeof globalThis<"u"?globalThis:c||self,c.sshpre=m(c.Vue))})(this,function(c){"use strict";const m="",y=(t,e)=>{const n=t.__vccOpts||t;for(const[o,a]of e)n[o]=a;return n},i={quote:/("(?:\\"|[^"])*")|('(?:\\'|[^'])*')/,comment:/(\/\/.*?(?:\n|$)|\/\*.*?(?:\*\/|$))/,doctype:/(&lt;!DOCTYPE.*?&gt;)/,htmlTag:/&lt;(?:([a-z][\w\d-]*)((?:[\w\d\- ]+=(?:"[^"]*"|'[^']*'))*|(?:(?!&(?:lt|amp);).)*?)(\s*\/?)|(\/?)([a-z][\w\d-]*))&gt;/,htmlentity:/(&amp;(?:[a-z]+|#x?\d+);)/,punctuation:new RegExp("(!==?|(?:[[\\](){}.:,+\\-?=!])+|(?<!&(?:[a-z]+|#x?\\d+));|\\|\\||&lt;|&gt;|&amp;)"),number:/(-?(?:\.\d+|\d+(?:\.\d+)?))/,boolean:/\b(true|false)\b/},h={shell:{quote:i.quote,comment:/(#.*?)(?:\n|$)/,keyword:/\b(p?npm|yarn|i(?:nstall)?|run|audit|outdated|update|publish|whoami|cd|sudo|chmod|chown|ls|cat|vim?|scp|rm|mv|mkdir|ln|open|cwd|which|clear|curl|ping|systemctl|echo|export|open|bash|exit)\b/,param:/( --(?:save|save-dev))(?:\s|$)/},xml:{doctype:i.doctype,quote:i.quote,comment:/(&lt;!--.*?(?:--&gt;|$))/,htmlentity:i.htmlentity,tag:i.htmlTag},html:{doctype:i.doctype,quote:i.quote,comment:/(&lt;!--.*?(?:--&gt;|$))/,htmlentity:i.htmlentity,tag:i.htmlTag},"html-vue":{doctype:i.doctype,quote:i.quote,comment:/(&lt;!--.*?(?:--&gt;|$))/,htmlentity:i.htmlentity,tag:i.htmlTag},pug:{text:/((?:^|\n)[ \t]*|^)\|([ \t]*)([^\n]+(?=\s*(?:\n|$)))/,text2:/([ \t]*)([.#\-\w\d]+(?:\([^)]*\))*)\.\n((?:\n+(?=\4[ \t]+)|(?=\4[ \t]+).+?(?:\n|$)*?)*)(?=\s*(?:\n|$))/,quote:i.quote,comment:/(^|\n)([ \t]*|^)(\/\/-[ \t]*(?:[^\n]*?(?:\n\10[ \t]+[^\n]*)+|[^\n]+(?=\n|$)))/,tag:/([a-z][\w\d-]*|)([.#][a-z][-.\w\d]*|)\b(?:\(((?:[\w\d\- ]+=(?:"[^"]*"|'[^']*'))*|(?:(?!&(?:lt|amp);).)*?)\))?(\.?)([ \t]*)([^\n]+)?(?=\n|$)/,"inline-tag":/#\[([^[\]]+)\]/},css:{comment:/(\/\*.+?(?:\*\/|$))/,quote:/("(?:\\"|[^"])*")|('(?:\\'|[^'])*')/,pseudo:/(:(?:hover|active|focus|visited|not|before|after|(?:first|last|nth)-child))/,"selector keyword vendor":/(@-(?:moz|o|webkit|ms)-(?=keyframes\s))/,"selector keyword":/((?:@(?:import|media|font-face|keyframes)|screen|print|and)(?=[\s({])|keyframes|\s(?:ul|ol|li|table|div|pre|p|a|img|br|hr|h[1-6]|em|strong|span|html|body|iframe|video|audio|input|button|form|label|fieldset|small|abbr|i|dd|dt)\b)(?=.*\{})/,variable:/(--[a-z0-9-]+)/,selector:/((?:[.#-\w*+ >:,[\]="~\n]|&gt;)+)(?=\s*\{)/,"attribute keyword vendor":/(-(?:moz|o|webkit|ms)-(?=transform|transition|user-select|tap-highlight-color|animation|background-size|box-shadow))/,"attribute keyword":/\b(content|float|display|position|top|left|right|bottom|(?:(?:max|min)-)?width|(?:(?:max|min|line)-)?height|font(?:-(?:family|style|size|weight|variant|stretch))?|vertical-align|color|opacity|visibility|z-index|pointer-events|user-select|transform(?:-(?:origin|style|delay|duration|property|timing-function))?|transition(?:-(?:delay|duration))?|animation(?:-(?:name|delay|duration|direction|fill-mode))?|backface-visibility|backdrop-filter|background(?:-(?:color|position|image|repeat|size|attachment|origin|clip|blend-mode))?|(?:padding|margin|border)(?:-(?:top|left|right|bottom))?|border(?:-(?:radius|color|width|style|spacing))|white-space|text-(?:align|transform|decoration|shadow|indent)|overflow(?:-(?:x|y))?|(?:letter|word)-spacing|word-break|box-(?:sizing|shadow)|stroke(?:-(?:width|opacity|dasharray|dashoffset|linecap|linejoin))?|fill|speak|outline|user-select|cursor|flex(?:-(?:direction|flow|grow|shrink|basis|wrap))?|(?:justify|align)-(?:content|self|items))(?=\s*:)/,"value keyword vendor":/(-(?:moz|o|webkit|ms)-(?=linear-gradient))/,"value keyword":/\b(inherit|initial|normal|none|unset|auto|inline(?:-(?:block|flex))?|block|flex|absolute|relative|static|fixed|sticky|hidden|visible|top|left|right|bottom|center|middle|baseline|solid|dotted|dashed|line-through|(?:over|under)line|wavy|double|(?:pre-|no)?wrap|pre|break-word|(?:upper|lower)case|capitalize|italic|bold|attr\(.*?\)|linear|ease(?:-in)?(?:-out)?|all|infinite|cubic-bezier|(?:translate|rotate)(?:[X-Z]|3d)?|skew[XY]?|scale|(?:no-)?repeat|repeat(?:-x|-y)|contain|cover|url|(?:repeating-)?(?:linear|radial)-gradient|inset|pointer|(?:flex-)?(?:start|end)|space-(?:between|evenly|around)|stretch|revert|row(?:-reverse)?|column(?:-reverse)?)(?=\s*[,;}(]|\s+[\da-z!])/,"value keyword important":/( ?!important)/,number:i.number,color:/(transparent|#(?:[\da-f]{6}|[\da-f]{3})|rgba?\([\d., ]*\))/,htmlentity:i.htmlentity,punctuation:/([:,;{}@#()!]+)/,attribute:/([a-z-]+)(?=\s*:)/,unit:/(px|pt|cm|%|r?em|m?s|deg|vh|vw|vmin|vmax)(?=(?:\s*[;,{}})]|\s+[-\da-z#]))/,error:/([:,;{}@#()!]+|&lt;|&gt;|&amp;)/},json:{quote:/("(?:\\"|[^"])*")/,number:i.number,boolean:i.boolean,punctuation:/([[\](){}:,]+)/,error:/(&(:?lt|gt|amp);|(?!\s).)/},js:{quote:i.quote,comment:i.comment,number:/\b(\d+(?:\.\d+)?|null)\b/,boolean:i.boolean,this:/\b(this)(?=\W)/,keyword:/\b(new|getElementsBy(?:Tag|Class|)Name|getElementById|querySelector|querySelectorAll|arguments|if|else|do|return|case|default|(?:f|F)unction|typeof|instanceof|undefined|document(?:Element)?|window|console|while|for|forEach|switch|in|break|continue|delete|length|var|let|const|export|import|as|require|from|Class|constructor|Number|Boolean|String|Array|Object|RegExp|Integer|Date|Promise|Proxy|WeakMap|WeakSet|Symbol|SyncManager|File(?:Reader)?|DataTransfer|DocumentFragment|async|await|(?:clear|set)(?:Timeout|Interval)|parse(?:Int|Float)|Math(?=\.)|isNaN|atob|btoa|getComputedStyle)(?=\W)/,htmlentity:i.htmlentity,punctuation:/(!==?|[[\]!(){}:;,+\-%*/?=]+|\.+(?![a-z])|\|\||&lt;|&gt;|&amp;)/,variable:/(\.?[a-z_][\w\d]*)/,"external-var":/(\$|jQuery|JSON)(?=\W|$)/},php:{quote:i.quote,comment:i.comment,special:/(&lt;\?(?:php)?|\?&gt;|__(?:DIR|FILE|LINE|CLASS|METHOD|FUNCTION|NAMESPACE|TRAIT)__)/,punctuation:i.punctuation,number:i.number,boolean:i.boolean,variable:/(\$[\w\d_]+)/,keyword:/\b(define|echo|die|exit|print_r|var_dump|if|else|elseif|do|return|case|default|function|\$this|while|foreach|for|switch|in|break|continue|empty|isset|unset|parse_ini_file|session_(?:start|destroy|id)|header|json_(?:encode|decode)|error_log|(require|include)(:?_once)?|try|throw|new|Exception|catch|finally|preg_(?:match|replace)|list|strlen|substr|str_replace|array_(?:keys|values))(?=\W|$)/},sql:{quote:i.quote,comment:/((?:--|#)\s.*?(?:\n|$)|\/\*.*?\*\/)/,punctuation:i.punctuation,number:/\b(\d+(?:\.\d+)?|null)\b/,boolean:i.boolean,keyword:/\b(\*|DECLARE|BEGIN|END|RETURNS|FUNCTION|CREATE|DATABASE|TABLE|VIEW|COLUMN|INDEX|GRANT|REVOKE|ALL|PRIVILEGES|IDENTIFIED|FLUSH|ALTER|MODIFY|DROP|TRUNCATE|CONSTRAINT|ADD|CHECK|(?:(?:PRIMARY|FOREIGN|UNIQUE) )?KEY|REFERENCES|AUTO_INCREMENT|COMMENT|DEFAULT|UNSIGNED|CHARSET|COLLATE|CHARACTER|ENGINE|SQL_MODE|USE|IF|THEN|NULL|EXISTS|UNIQUE|SELECT|UPDATE|DELETE|(?:INSERT|REPLACE)(?: INTO)?|VALUES|SET|FROM|WHERE|(?:ORDER|GROUP) BY|LIMIT|(?:(?:LEFT|RIGHT|INNER|OUTER|CROSS) |)JOIN|AS|ON|COUNT|AVG|SUM|MIN|MAX|CASE|TO|WHEN|BETWEEN|AND|OR|NOT|IN|LIKE|IS|CONCAT|SUBSTRING|CURRENT_(?:DATE|TIMESTAMP)|USING|HAVING?)(?=\W|$)/,"var-type":/\b((?:var)?char|(?:tiny|small|medium|big)?int|decimal|float|double|real|bit|boolean|date(?:time)?|time(?:stamp)?|year|(?:tiny|medium|long)?(?:text|blob)|enum)\b/}},b={xml:/(\s*)([a-z\d\-:]+)(?:=("|')(.*?)\3)?/g,html:/(\s*)([a-z-]+)(?:=("|')(.*?)\3)?/g,"html-vue":/(\s*)([@:#]?[a-z\d-]+)(?:(?:=("|')(.*?)\3)|)/g,pug:/(\s*|,)([@:#]?[a-z\d-]+)(?:(?:=("|')(.*?)\3)|)/g},E={shell:{quote:2},xml:{quote:2,tag:5},html:{quote:2,tag:5},"html-vue":{quote:2,tag:5},pug:{text:3,text2:3,quote:2,comment:3,tag:6},json:{},php:{quote:2},sql:{quote:2},css:{quote:2},js:{quote:2}},f=t=>t.map(e=>{if(!e.children||typeof e.children=="string")return e.children||"";if(Array.isArray(e.children))return f(e.children);if(e.children.default)return f(e.children.default())}).join(""),x={name:"sshpre",props:{language:{type:String,default:""},label:{type:[String,Boolean],default:!1},tab:{type:[Boolean,String],default:" "},dark:{type:Boolean,default:!1},copyButton:{type:Boolean,default:!1},editable:{type:Boolean,default:!1}},data:()=>({knownLanguages:Object.keys(h),content:"",slotTexts:""}),methods:{htmlize(t){return t.replace(/&(lt|gt|amp);/g,(e,n)=>({lt:"<",gt:">",amp:"&"})[n])},unhtmlize(t){return t.replace(/[<>]/g,e=>({"<":"&lt;",">":"&gt;"})[e])},isColorDark(t){let e,n,o,a,s,r;if(e=t.match(/rgba?\((.*),\s*(.*),\s*(.*?)(?:,\s*([^)]*))\)/))o=parseInt(e[1])<=100,a=parseInt(e[2])<=100,s=parseInt(e[3])<=100,r=parseFloat(e[4])<.3;else if(n=t.match(/#([\da-f]{3}(?:[\da-f]{3})?)/)){const l=n[1].length===3;o=parseInt(n[1][0])<=9,a=parseInt(n[1][l?1:2])<=9,s=parseInt(n[1][l?2:4])<=9}return(o&&a&&s||o&&a&&!s||!o&&a&&s)&&!r},createRegexPattern(){let t="";const e=[];for(const n in h[this.language]){const o=E[this.language][n]||1;for(let a=0;a<o;a++)e.push(n);t+=(t?"|":"")+h[this.language][n].source}return[t,e]},syntaxHighlightHtmlTag(t){const e=(n,o,a,s,r)=>`${o}<span class="attribute">${a}</span>`+(s||r?'<span class="punctuation">=</span>':"")+(s||r?`<span class="quote">${s||""}${r||""}${s||""}</span>`:"");if(this.language==="pug"){let[n,o="",a="",s="",r="",l=""]=t;return o=o.replace(/#[a-z\d-]+/g,g=>`<span class="id">${g}</span>`).replace(/\.[a-z\d-]+/g,g=>`<span class="class">${g}</span>`),a&&(a=a.replace(b.pug,e),a='<span class="punctuation">(</span>'+a+'<span class="punctuation">)</span>'),l&&(l=this.highlightPugInlineTag(l)),`<span class="tag-name">${n}</span>${o}${a}`+(s?'<span class="punctuation">.</span>':"")+(r||"")+(l?`<span class="text">${l}</span>`:"")}else{const[n,o="",a="",s="",r]=t,l=o.replace(b[this.language],e);return`<span class="punctuation">&lt;${s}</span><span class="tag-name">${n||r}</span>`+l+`<span class="punctuation">${a}&gt;</span>`}},highlightPugInlineTag(t){return t.replace(new RegExp(h.pug["inline-tag"],"gsi"),(e,n)=>'<span class="inline-tag">#[</span>'+n.replace(new RegExp(h.pug.tag,"si"),(o,...a)=>(a=a.slice(0,a.length-2),this.syntaxHighlightHtmlTag(a)))+'<span class="inline-tag">]</span>')},highlightInPre(){if(this.knownLanguages.includes(this.language)){const t=this.getCaretPositionInPlainText();this.$refs.code.innerHTML=this.syntaxHighlightContent(this.$refs.code.innerText),this.reinjectCaret(this.$refs.code.childNodes,t)}},getCaretPositionInPlainText(){const t=window.getSelection();t.collapseToEnd();const e=new Range;return e.setStart(this.$refs.code,0),e.setEnd(t.extentNode,t.extentOffset),e.toString().length},reinjectCaret(t,e){var o,a;let n=0;for(const s of t){const r=((o=s.innerText)==null?void 0:o.length)||s.length;if(n+r>=e){s.childNodes.length>1?this.reinjectCaret(s.childNodes,e-n):document.getSelection().setPosition(((a=s.childNodes)==null?void 0:a[0])||s,e-n);break}n+=r}},onKeydown(t){switch(t.which){case 9:this.injectAtCaret(this.tab),t.preventDefault();break;case 13:this.injectAtCaret(`
`),t.preventDefault();break}},injectAtCaret(t){const e=window.getSelection(),n=e.getRangeAt(0),o=document.createTextNode(t);n.insertNode(o),e.collapseToEnd()},syntaxHighlightContent(t){if(!this.knownLanguages.includes(this.language))return t;const[e,n]=this.createRegexPattern();return this.unhtmlize(t.replace(/&/g,"&amp;")).replace(new RegExp(e,"gsi"),(o,...a)=>{a=a.slice(0,a.length-2);let s;const r=this.language==="pug";let l=a.find((d,u)=>d&&(s=n[u])&&d);if(["punctuation","quote","htmlentity"].includes(s))l=this.unhtmlize(l);else if(s==="comment")if(r){const[d,u,p]=a.slice(n.indexOf("comment"));l=`${d}${u}${this.unhtmlize(p)}`}else l=this.unhtmlize(l);else if(s==="text"&&r){let[d,u,p]=a;return p=this.highlightPugInlineTag(p),`${d}<span class="punctuation">|</span>${u}<span class="text">${p}</span>`}else if(s==="text2"&&r){const[,,,d,u,p]=a,I=this.syntaxHighlightContent(u);return`${d}${I}<span class="punctuation">.</span>
<span class="text">${p}</span>`}else{if(s==="tag"&&["xml","html","html-vue","pug"].includes(this.language))return this.syntaxHighlightHtmlTag(a.slice(n.indexOf("tag")));if(s==="variable"&&l[0]==="."&&this.language==="js")return`<span class="punctuation">.</span><span class="obj-attr">${l.substr(1)}</span>`}let g="";return s==="color"&&this.language==="css"&&(g=` style="background-color: ${l};color: #${this.isColorDark(l)?"fff":"000"}"`),s&&`<span class="${s}"${g}>${l}</span>`||""})},getSlotContent(){return this.$slots.default&&f(this.$slots.default())||""},copyCode(t){t.target.insertAdjacentHTML("afterend",`<textarea id="clipboard-textarea">${this.$refs.code.innerText}</textarea>`);const e=document.getElementById("clipboard-textarea");e.select(),e.setSelectionRange(0,99999),document.execCommand("copy"),e.remove(),this.$emit("copied",this.$refs.code.innerText)}},mounted(){const t=this.getSlotContent();this.$refs.code.innerText=t,this.$refs.code.innerHTML=this.syntaxHighlightContent(this.$refs.code.innerText)},beforeUpdate(){this.$refs.code.innerHTML=this.syntaxHighlightContent(this.getSlotContent())}},T=["data-type","data-label"],w=["contenteditable"],N={class:"ssh-pre__original"};function C(t,e,n,o,a,s){return c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["ssh-pre",{"ssh-pre--dark":n.dark}]),"data-type":n.language,"data-label":n.label||null},[n.copyButton?(c.openBlock(),c.createElementBlock("button",{key:0,class:"ssh-pre__copy",onClick:e[0]||(e[0]=(...r)=>s.copyCode&&s.copyCode(...r))},[c.renderSlot(t.$slots,"copy-button",{},()=>[c.createTextVNode("Copy")])])):c.createCommentVNode("",!0),c.createTextVNode(),c.createElementVNode("pre",{ref:"code",class:"ssh-pre__content",contenteditable:n.editable?"true":"false",onKeydown:e[1]||(e[1]=r=>n.editable&&s.onKeydown(r)),onInput:e[2]||(e[2]=(...r)=>s.highlightInPre&&s.highlightInPre(...r))}," ",40,w),c.createTextVNode(),c.createElementVNode("div",N,[c.renderSlot(t.$slots,"default")])],10,T)}return y(x,[["render",C]])});
<span class="text">${p}</span>`}else{if(s==="tag"&&["xml","html","html-vue","pug"].includes(this.language))return this.syntaxHighlightHtmlTag(a.slice(n.indexOf("tag")));if(s==="variable"&&l[0]==="."&&this.language==="js")return`<span class="punctuation">.</span><span class="obj-attr">${l.substr(1)}</span>`}let g="";return s==="color"&&this.language==="css"&&(g=` style="background-color: ${l};color: #${this.isColorDark(l)?"fff":"000"}"`),s&&`<span class="${s}"${g}>${l}</span>`||""})},getSlotContent(){return this.$slots.default&&f(this.$slots.default())||""},copyCode(t){t.target.insertAdjacentHTML("afterend",`<textarea id="clipboard-textarea">${this.$refs.code.innerText}</textarea>`);const e=document.getElementById("clipboard-textarea");e.select(),e.setSelectionRange(0,99999),document.execCommand("copy"),e.remove(),this.$emit("copied",this.$refs.code.innerText)}},mounted(){const t=this.getSlotContent();this.$refs.code.innerText=t,this.$refs.code.innerHTML=this.syntaxHighlightContent(this.$refs.code.innerText)},beforeUpdate(){this.$refs.code&&(this.$refs.code.innerHTML=this.syntaxHighlightContent(this.getSlotContent()))}},T=["data-type","data-label"],w=["contenteditable"],N={class:"ssh-pre__original"};function C(t,e,n,o,a,s){return c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["ssh-pre",{"ssh-pre--dark":n.dark}]),"data-type":n.language,"data-label":n.label||null},[n.copyButton?(c.openBlock(),c.createElementBlock("button",{key:0,class:"ssh-pre__copy",onClick:e[0]||(e[0]=(...r)=>s.copyCode&&s.copyCode(...r))},[c.renderSlot(t.$slots,"copy-button",{},()=>[c.createTextVNode("Copy")])])):c.createCommentVNode("",!0),c.createTextVNode(),c.createElementVNode("pre",{ref:"code",class:"ssh-pre__content",contenteditable:n.editable?"true":"false",onKeydown:e[1]||(e[1]=r=>n.editable&&s.onKeydown(r)),onInput:e[2]||(e[2]=(...r)=>s.highlightInPre&&s.highlightInPre(...r))}," ",40,w),c.createTextVNode(),c.createElementVNode("div",N,[c.renderSlot(t.$slots,"default")])],10,T)}return y(x,[["render",C]])});
{
"name": "simple-syntax-highlighter",
"version": "3.0.2",
"version": "3.0.3",
"description": "No chi-chi syntax highlighter for Vue.js (2 and 3).",

@@ -41,12 +41,12 @@ "author": "Antoni Andre <antoniandre.web@gmail.com>",

"devDependencies": {
"@babel/eslint-parser": "^7.19.1",
"@eslint/js": "^9.8.0",
"@vitejs/plugin-vue": "^3.2.0",
"@vue/compiler-sfc": "^3.2.47",
"@vue/eslint-config-standard": "^6.1.0",
"autoprefixer": "^10.4.13",
"eslint": "^7.32.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-vue": "^7.20.0",
"eslint": "9.x",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^17.10.1",
"eslint-plugin-promise": "^7.0.0",
"eslint-plugin-vue": "^9.27.0",
"globals": "^15.8.0",
"postcss": "^8.4.21",

@@ -56,2 +56,3 @@ "pug": "^3.0.2",

"sass": "^1.58.0",
"standard": "^17.1.0",
"vite": "^3.2.5",

@@ -58,0 +59,0 @@ "vue": "^3.2.47",

@@ -6,4 +6,5 @@ # Simple Syntax Highlighter

[![npm](https://img.shields.io/npm/dt/simple-syntax-highlighter.svg)](https://www.npmjs.com/package/simple-syntax-highlighter)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
<!-- [![npm](https://img.shields.io/npm/dw/simple-syntax-highlighter.svg)](https://www.npmjs.com/package/simple-syntax-highlighter) -->
> No chi-chi syntax highlighter for Vue.js (2 and 3).
> No chi-chi syntax highlighter for Vue.js 3 (and 2).

@@ -10,0 +11,0 @@ ___

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