ng-prism
Version:
An Angular2 codeblock highlighting component using Prismjs.
1 lines • 29.4 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@angular/common"),require("@angular/core"),require("@angular/http"),require("rxjs/Observable"),require("rxjs/Subject"),require("rxjs/add/observable/empty"),require("rxjs/add/observable/timer"),require("rxjs/add/operator/catch"),require("rxjs/add/operator/debounce"),require("rxjs/add/operator/distinctUntilChanged"),require("rxjs/add/operator/do"),require("rxjs/add/operator/filter"),require("rxjs/add/operator/map"),require("rxjs/add/operator/retry"),require("rxjs/add/operator/switchMap")):"function"==typeof define&&define.amd?define(["@angular/common","@angular/core","@angular/http","rxjs/Observable","rxjs/Subject","rxjs/add/observable/empty","rxjs/add/observable/timer","rxjs/add/operator/catch","rxjs/add/operator/debounce","rxjs/add/operator/distinctUntilChanged","rxjs/add/operator/do","rxjs/add/operator/filter","rxjs/add/operator/map","rxjs/add/operator/retry","rxjs/add/operator/switchMap"],t):"object"==typeof exports?exports["ng-prism.umd.min"]=t(require("@angular/common"),require("@angular/core"),require("@angular/http"),require("rxjs/Observable"),require("rxjs/Subject"),require("rxjs/add/observable/empty"),require("rxjs/add/observable/timer"),require("rxjs/add/operator/catch"),require("rxjs/add/operator/debounce"),require("rxjs/add/operator/distinctUntilChanged"),require("rxjs/add/operator/do"),require("rxjs/add/operator/filter"),require("rxjs/add/operator/map"),require("rxjs/add/operator/retry"),require("rxjs/add/operator/switchMap")):e["ng-prism.umd.min"]=t(e["@angular/common"],e["@angular/core"],e["@angular/http"],e["rxjs/Observable"],e["rxjs/Subject"],e["rxjs/add/observable/empty"],e["rxjs/add/observable/timer"],e["rxjs/add/operator/catch"],e["rxjs/add/operator/debounce"],e["rxjs/add/operator/distinctUntilChanged"],e["rxjs/add/operator/do"],e["rxjs/add/operator/filter"],e["rxjs/add/operator/map"],e["rxjs/add/operator/retry"],e["rxjs/add/operator/switchMap"])}(this,function(e,t,r,n,o,i,s,a,c,u,l,p,d,m,h){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,t,r){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=25)}([function(e,r){e.exports=t},function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},i=r(0);r(5),r(7),r(6),r(9),r(8),r(10);var s=/<!--template\sbindings={[^\}]*}-->/g,a=function(){function e(e){this._renderer=e}return e.prototype.render=function(){this._replaceCode(),this._highlight()},e.prototype.empty=function(){this._pre&&(this._pre.nativeElement.innerHTML="")},e.prototype._replaceCode=function(){this._renderer.setElementProperty(this._pre.nativeElement,"innerHTML",this._buildCodeElement())},e.prototype._highlight=function(){Prism.highlightElement(this._pre.nativeElement.querySelector("code"),!1,null),this.shell&&this.outputLines&&this._fixPromptOutputPadding()},Object.defineProperty(e.prototype,"_processedCode",{get:function(){return this._isMarkup(this.language)?this._processMarkup(this.code):this.code},enumerable:!0,configurable:!0}),e.prototype._processMarkup=function(e){return this._replaceTags(this._removeAngularMarkup(e))},e.prototype._replaceTags=function(e){return e.replace(/(<)([!\/A-Za-z](.|[\n\r])*?>)/g,"<$2")},e.prototype._removeAngularMarkup=function(e){e=e.replace(/\s_ng[^-]+-[^-]+-[^=]+="[^"]*"/g,"");var t=this._fixIndentation(e);return t=t.filter(function(e){if(""===e.trim())return!0;var t=e.replace(s,"").trim();return""!==t}),e=t.join("\n"),e.replace(s,"")},e.prototype._isMarkup=function(e){return"markup"===e||"markdown"===e},e.prototype._buildCodeElement=function(){return'<code class="'+this.codeClasses+'">'+this._processedCode+"</code>"},Object.defineProperty(e.prototype,"languageClass",{get:function(){return"language-"+this.language},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineNumbersClass",{get:function(){return this.lineNumbers?"line-numbers":""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shellClass",{get:function(){return this.shell?"command-line":""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"codeClasses",{get:function(){return this.languageClass+" "+this.language},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"preClasses",{get:function(){return this.lineNumbersClass+" "+this.languageClass+" "+this.shellClass},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_codeEl",{get:function(){return this._pre.nativeElement.querySelector("code")},enumerable:!0,configurable:!0}),e.prototype._fixPromptOutputPadding=function(){if(this._codeEl){var e=this._codeEl.querySelector(".command-line-prompt");if(e){var t=this._codeEl.querySelector(".command-line-prompt").clientWidth,r=parseInt(this._getStyle(this._pre.nativeElement,"padding-left").replace("px",""),10);this._pre.nativeElement.style.paddingRight=2*r+t/2+"px"}}},e.prototype._getStyle=function(e,t){var r="";return document.defaultView&&document.defaultView.getComputedStyle?r=document.defaultView.getComputedStyle(e,"").getPropertyValue(t):e.currentStyle&&(t=t.replace(/\-(\w)/g,function(e,t){return t.toUpperCase()}),r=e.currentStyle[t]),r},e.prototype._fixIndentation=function(e){var t=0,r=0,n=[],o=e.split("\n").map(function(e,o){if(""===e.trim())return t>0&&n.push(o),t=0,"";var i=e.replace(s,"").trim();if(""===i)return t=e.match(/^\s*/)[0].length,e;if(t>0){if(length=e.match(/^\s*/)[0].length,0===r&&(r=length-t),length>=t)return e.slice(r);t=0}return e});return n.forEach(function(e){o.splice(e,1)}),o},n([i.Input(),o("design:type",String)],e.prototype,"code",void 0),n([i.Input(),o("design:type",String)],e.prototype,"language",void 0),n([i.Input(),o("design:type",Boolean)],e.prototype,"lineNumbers",void 0),n([i.Input(),o("design:type",String)],e.prototype,"shell",void 0),n([i.Input(),o("design:type",String)],e.prototype,"prompt",void 0),n([i.Input(),o("design:type",String)],e.prototype,"outputLines",void 0),n([i.ViewChild("preEl"),o("design:type",Object)],e.prototype,"_pre",void 0),e=n([i.Component({selector:"code-renderer",template:'\n<pre #preEl [class]="preClasses" [attr.data-prompt]="prompt" [attr.data-output]="outputLines"></pre>\n '}),o("design:paramtypes",[i.Renderer])],e)}();t.CodeRendererComponent=a},function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},i=r(0),s=r(1),a=function(){function e(e){this.DEFAULT_THEME="standard",this.DEFAULT_SHELL_THEME="okaidia",this.prompt="$",this._code="",this._showingMessage=!1,this._languageSet=!1,this._lineNumbers=!0,this._changed=!1,this._shellType=null,this._elementRef=e}return Object.defineProperty(e.prototype,"lineNumbers",{get:function(){return this._lineNumbers},set:function(e){this._lineNumbers!==e&&(this._changed=!0,this._lineNumbers=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"language",{get:function(){return this._showingMessage?void 0:this._language},set:function(e){this.isShell()||(this._languageSet=!!(e&&e.length>0),this._language=Prism.languages[e]?e:void 0,this._changed=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"theme",{get:function(){return this._theme?this._theme:this.isShell()?this.DEFAULT_SHELL_THEME:this.DEFAULT_THEME},set:function(e){this._theme=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shell",{get:function(){return this._shellType},set:function(t){t&&e.SHELL_TYPES.indexOf(t)!==-1?(this._language=t,this._languageSet=!0,this._shellType=t,this.lineNumbers=!1,this._changed=!0):this._shellType=null},enumerable:!0,configurable:!0}),e.prototype.ngAfterContentChecked=function(){this._sourced||this._showingMessage||(this.code=this.content)},e.prototype.ngAfterViewChecked=function(){this._changed&&(this._changed=!1,this.codeRenderer.render())},Object.defineProperty(e.prototype,"content",{get:function(){return this.contentEl?this.contentEl.nativeElement.innerHTML:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"code",{get:function(){return this._code},set:function(e){this._code!==e&&(this._changed=!0,this._code=e)},enumerable:!0,configurable:!0}),e.prototype.sourceChanged=function(e){this.message("Loading ...")},e.prototype.sourceReceived=function(t){var r=t.url.match(/\.(\w+)$/)[1],n=e.EXTENSION_MAP[r]||r,o=t.text();this._languageSet||(this._language=n,"typescript"===n&&(o=this._replaceTagsInMultiline(t.text()))),this.code=o,this._showingMessage=!1,this._sourced=!0},e.prototype.sourceError=function(e){this._sourced=!1,this.message(e.message?e.message:"An error occured.")},e.prototype.isShell=function(){return null!==this._shellType},e.prototype.shouldDisplayLineNumbers=function(){return this.lineNumbers&&!this._showingMessage},e.prototype.message=function(e){this._showingMessage=!0,this.code=e},e.prototype.bind=function(e){return"{{"+e+"}}"},e.prototype._replaceTagsInMultiline=function(e){return e.replace(/`((.|[\r\n])*?)`/g,function(e){return e.replace(/(<)([!\/A-Za-z].*?>)/g,"<$2")})},e.EXTENSION_MAP={js:"javascript",ts:"typescript",html:"markup",svg:"markup",xml:"markup",md:"markdown",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell"},e.SHELL_TYPES=["bash","powershell"],e.THEMES=["standard","coy","dark","funky","okaidia","solarizedlight","tomorrow","twilight"],n([i.Input(),o("design:type",Boolean),o("design:paramtypes",[Boolean])],e.prototype,"lineNumbers",null),n([i.Input(),o("design:type",String),o("design:paramtypes",[String])],e.prototype,"language",null),n([i.Input(),o("design:type",String),o("design:paramtypes",[String])],e.prototype,"theme",null),n([i.Input(),o("design:type",String)],e.prototype,"prompt",void 0),n([i.Input(),o("design:type",String)],e.prototype,"outputLines",void 0),n([i.Input(),o("design:type",String),o("design:paramtypes",[String])],e.prototype,"shell",null),n([i.ViewChild("contentEl"),o("design:type",Object)],e.prototype,"contentEl",void 0),n([i.ViewChild(s.CodeRendererComponent),o("design:type",Object)],e.prototype,"codeRenderer",void 0),e=n([i.Component({selector:"codeblock",template:'\n <div #contentEl class="codeblock-content" style="display: none"><ng-content></ng-content></div>\n <div class="codeblock {{theme}}">\n <code-renderer\n [code]="code"\n [language]="language"\n [lineNumbers]="shouldDisplayLineNumbers()"\n [shell]="shell"\n [prompt]="prompt"\n [outputLines]="outputLines">\n </code-renderer>\n </div>\n ',encapsulation:i.ViewEncapsulation.None}),o("design:paramtypes",[i.ElementRef])],e)}();t.CodeblockComponent=a},function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},s=r(0),a=r(12),c=r(13),u=r(14);r(15),r(16),r(22),r(21),r(19),r(18),r(20),r(23),r(17),r(24),t.SourceDebounceTime=300;var l=function(){function e(e,t,r,n){this.sourceChanged=new u.Subject,this._debounceTime=300,this._firstRequest=!0,this._element=e,this._http=t,this._renderer=r,this._sourceDebounceTime=n}return Object.defineProperty(e.prototype,"src",{set:function(e){this._src=e,this.sourceChanged.next(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"debounceTime",{get:function(){return this._debounceTime},set:function(e){var t=parseInt(e,10);!isNaN(t)&&t>=0&&(this._debounceTime=t)},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.host=this._element,this.host===this&&(this.host=this._element),this._sourceDebounceTime&&(this.debounceTime=this._sourceDebounceTime),this._handleSourceChanges(),this._src&&this.sourceChanged.next(this._src)},e.prototype.ngOnDestroy=function(){this._subscription&&this._subscription.unsubscribe()},e.prototype._handleSourceChanges=function(){var e=this;this._subscription=this.sourceChanged.do(function(t){e.host.sourceChanged&&e.host.sourceChanged(t)}).filter(function(t){return e._emptySources(t)}).map(function(t){return e._addExtensionMatches(t)}).filter(function(t){return e._nonFiles(t)}).distinctUntilChanged().do(function(t){e.host.sourceLoading&&e.host.sourceLoading(t.source)}).debounce(function(){return c.Observable.timer(e._firstRequest?0:e.debounceTime)}).do(function(){return e._firstRequest=!1}).switchMap(function(t){return e._fetchSrc(t)}).catch(function(t){return e.host.sourceError&&e.host.sourceError(t),console.error(t),c.Observable.empty()}).subscribe(function(t){e.host.sourceReceived?e.host.sourceReceived(t):e._renderer.setElementProperty(e._element.nativeElement,"innerHTML",t.text())},function(t){e.host.sourceError&&e.host.sourceError(t),console.error(t)})},e.prototype._emptySources=function(e){return!(void 0===e||null===e||""===e)},e.prototype._addExtensionMatches=function(e){return{source:e,extMatches:e.match(/\.(\w+)$/)}},e.prototype._nonFiles=function(e){return!!e.extMatches||(e.source&&e.source.length>0?this.host.sourceError&&this.host.sourceError({message:e.source+" is not a file."}):this.host.sourceError&&this.host.sourceError({message:"No source file given."}),!1)},e.prototype._fetchSrc=function(e){var t=this;return this._http.get(e.source).catch(function(r){return t.host.sourceError&&t.host.sourceError({message:e.source+" not found."}),c.Observable.empty()})},n([s.Input(),o("design:type",String),o("design:paramtypes",[String])],e.prototype,"src",null),n([s.Input(),o("design:type",Object),o("design:paramtypes",[Object])],e.prototype,"debounceTime",null),e=n([s.Directive({selector:"[src]"}),i(3,s.Optional()),i(3,s.Inject(t.SourceDebounceTime)),o("design:paramtypes",[s.ElementRef,a.Http,s.Renderer,Number])],e)}();t.SrcDirective=l},function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},i=r(0),s=r(11),a=r(2),c=r(1),u=r(3),l=[c.CodeRendererComponent,a.CodeblockComponent,u.SrcDirective],p=function(){function e(){}return e=n([i.NgModule({imports:[s.CommonModule],declarations:l.slice(),exports:l.slice()}),o("design:paramtypes",[])],e)}();t.CodeblockModule=p},function(e,t){!function(e){var t={variable:[{pattern:/\$?\(\([\w\W]+?\)\)/,inside:{variable:[{pattern:/(^\$\(\([\w\W]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee]-?\d+)?)\b/,operator:/--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\([^)]+\)|`[^`]+`/,inside:{variable:/^\$\(|^`|\)$|`$/}},/\$(?:[a-z0-9_#\?\*!@]+|\{[^}]+\})/i]};e.languages.bash={shebang:{pattern:/^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/,alias:"important"},comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<\s*)(?:"|')?(\w+?)(?:"|')?\s*\r?\n(?:[\s\S])*?\r?\n\2/g,lookbehind:!0,greedy:!0,inside:t},{pattern:/(["'])(?:\\\\|\\?[^\\])*?\1/g,greedy:!0,inside:t}],variable:t.variable,function:{pattern:/(^|\s|;|\||&)(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|\s|;|\||&)/,lookbehind:!0},keyword:{pattern:/(^|\s|;|\||&)(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|\s|;|\||&)/,lookbehind:!0},boolean:{pattern:/(^|\s|;|\||&)(?:true|false)(?=$|\s|;|\||&)/,lookbehind:!0},operator:/&&?|\|\|?|==?|!=?|<<<?|>>|<=?|>=?|=~/,punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];]/};var r=t.variable[1].inside;r.function=e.languages.bash.function,r.keyword=e.languages.bash.keyword,r.boolean=e.languages.bash.boolean,r.operator=e.languages.bash.operator,r.punctuation=e.languages.bash.punctuation}(Prism)},function(e,t){Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,function:/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*\*?|\/|~|\^|%|\.{3}/}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0}}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\\\|\\?[^\\])*?`/,greedy:!0,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\w\W]*?>)[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript},function(e,t){Prism.languages.powershell={comment:[{pattern:/(^|[^`])<#[\w\W]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(`?[\w\W])*?"/,greedy:!0,inside:{function:{pattern:/[^`]\$\(.*?\)/,inside:{}}}},{pattern:/'([^']|'')*'/,greedy:!0}],namespace:/\[[a-z][\w\W]*?\]/i,boolean:/\$(true|false)\b/i,variable:/\$\w+\b/i,function:[/\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-Computer|Clear-(Content|EventLog|History|Item|ItemProperty|Variable)|Compare-Object|Complete-Transaction|Connect-PSSession|ConvertFrom-(Csv|Json|StringData)|Convert-Path|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-Process|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-PSSession|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-PSSession|Exit-PSSession|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-Object|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-Object|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-Path|Limit-EventLog|Measure-(Command|Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-Location|Push-Location|Read-Host|Receive-(Job|PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-ComputerMachinePassword|Resolve-Path|Restart-(Computer|Service)|Restore-Computer|Resume-(Job|Service)|Save-Help|Select-(Object|String|Xml)|Send-MailMessage|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-Object|Split-Path|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-Object|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-Command|Unblock-File|Undo-Transaction|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData|Help|List|TypeData)|Use-Transaction|Wait-(Event|Job|Process)|Where-Object|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning))\b/i,/\b(ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(\W?)(!|-(eq|ne|gt|ge|lt|le|sh[lr]|not|b?(and|x?or)|(Not)?(Like|Match|Contains|In)|Replace|Join|is(Not)?|as)\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/},Prism.languages.powershell.string[0].inside.boolean=Prism.languages.powershell.boolean,Prism.languages.powershell.string[0].inside.variable=Prism.languages.powershell.variable,Prism.languages.powershell.string[0].inside.function.inside=Prism.util.clone(Prism.languages.powershell)},function(e,t){!function(){"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("complete",function(e){if(e.code){var t=e.element.parentNode,r=/\s*\bcommand-line\b\s*/;if(t&&/pre/i.test(t.nodeName)&&(r.test(t.className)||r.test(e.element.className))&&!e.element.querySelector(".command-line-prompt")){r.test(e.element.className)&&(e.element.className=e.element.className.replace(r,"")),r.test(t.className)||(t.className+=" command-line");var n=function(e,r){return(t.getAttribute(e)||r).replace(/"/g,""")},o=new Array(1+e.code.split("\n").length),i=n("data-prompt","");if(""!==i)o=o.join('<span data-prompt="'+i+'"></span>');else{var s=n("data-user","user"),a=n("data-host","localhost");o=o.join('<span data-user="'+s+'" data-host="'+a+'"></span>')}var c=document.createElement("span");c.className="command-line-prompt",c.innerHTML=o;var u=t.getAttribute("data-output")||"";u=u.split(",");for(var l=0;l<u.length;l++){var p=u[l].split("-"),d=parseInt(p[0]),m=d;if(2===p.length&&(m=parseInt(p[1])),!isNaN(d)&&!isNaN(m))for(var h=d;h<=m&&h<=c.children.length;h++){var g=c.children[h-1];g.removeAttribute("data-user"),g.removeAttribute("data-host"),g.removeAttribute("data-prompt")}}e.element.innerHTML=c.outerHTML+e.element.innerHTML}}})}()},function(e,t){!function(){"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("complete",function(e){if(e.code){var t=e.element.parentNode,r=/\s*\bline-numbers\b\s*/;if(t&&/pre/i.test(t.nodeName)&&(r.test(t.className)||r.test(e.element.className))&&!e.element.querySelector(".line-numbers-rows")){r.test(e.element.className)&&(e.element.className=e.element.className.replace(r,"")),r.test(t.className)||(t.className+=" line-numbers");var n,o=e.code.match(/\n(?!$)/g),i=o?o.length+1:1,s=new Array(i+1);s=s.join("<span></span>"),n=document.createElement("span"),n.setAttribute("aria-hidden","true"),n.className="line-numbers-rows",n.innerHTML=s,t.hasAttribute("data-start")&&(t.style.counterReset="linenumber "+(parseInt(t.getAttribute("data-start"),10)-1)),e.element.appendChild(n)}}})}()},function(e,t){!function(){function e(e){this.defaults=n({},e)}function t(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})}function r(e){for(var t=0,r=0;r<e.length;++r)e.charCodeAt(r)=="\t".charCodeAt(0)&&(t+=3);return e.length+t}if("undefined"!=typeof self&&self.Prism&&self.document){var n=Object.assign||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e};e.prototype={setDefaults:function(e){this.defaults=n(this.defaults,e)},normalize:function(e,r){r=n(this.defaults,r);for(var o in r){var i=t(o);"normalize"!==o&&"setDefaults"!==i&&r[o]&&this[i]&&(e=this[i].call(this,e,r[o]))}return e},leftTrim:function(e){return e.replace(/^\s+/,"")},rightTrim:function(e){return e.replace(/\s+$/,"")},tabsToSpaces:function(e,t){return t=0|t||4,e.replace(/\t/g,new Array(++t).join(" "))},spacesToTabs:function(e,t){return t=0|t||4,e.replace(new RegExp(" {"+t+"}","g"),"\t")},removeTrailing:function(e){return e.replace(/\s*?$/gm,"")},removeInitialLineFeed:function(e){return e.replace(/^(?:\r?\n|\r)/,"")},removeIndent:function(e){var t=e.match(/^[^\S\n\r]*(?=\S)/gm);return t&&t[0].length?(t.sort(function(e,t){return e.length-t.length}),t[0].length?e.replace(new RegExp("^"+t[0],"gm"),""):e):e},indent:function(e,t){return e.replace(/^[^\S\n\r]*(?=\S)/gm,new Array(++t).join("\t")+"$&")},breakLines:function(e,t){t=t===!0?80:0|t||80;for(var n=e.split("\n"),o=0;o<n.length;++o)if(!(r(n[o])<=t)){for(var i=n[o].split(/(\s+)/g),s=0,a=0;a<i.length;++a){var c=r(i[a]);s+=c,s>t&&(i[a]="\n"+i[a],s=c)}n[o]=i.join("")}return n.join("\n")}},Prism.plugins.NormalizeWhitespace=new e({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(e){var t=e.element.parentNode,r=/\bno-whitespace-normalization\b/;if(!(!e.code||!t||"pre"!==t.nodeName.toLowerCase()||e.settings&&e.settings["whitespace-normalization"]===!1||r.test(t.className)||r.test(e.element.className))){for(var n=t.childNodes,o="",i="",s=!1,a=Prism.plugins.NormalizeWhitespace,c=0;c<n.length;++c){var u=n[c];u==e.element?s=!0:"#text"===u.nodeName&&(s?i+=u.nodeValue:o+=u.nodeValue,t.removeChild(u),--c)}if(e.element.children.length&&Prism.plugins.KeepMarkup){var l=o+e.element.innerHTML+i;e.element.innerHTML=a.normalize(l,e.settings),e.code=e.element.textContent}else e.code=o+e.code+i,e.code=a.normalize(e.code,e.settings)}})}}()},function(t,r){t.exports=e},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t){e.exports=i},function(e,t){e.exports=s},function(e,t){e.exports=a},function(e,t){e.exports=c},function(e,t){e.exports=u},function(e,t){e.exports=l},function(e,t){e.exports=p},function(e,t){e.exports=d},function(e,t){e.exports=m},function(e,t){e.exports=h},function(e,t,r){"use strict";var n=r(3);t.SourceDebounceTime=n.SourceDebounceTime,t.SrcDirective=n.SrcDirective;var o=r(1);t.CodeRendererComponent=o.CodeRendererComponent;var i=r(2);t.CodeblockComponent=i.CodeblockComponent;var s=r(4);t.CodeblockModule=s.CodeblockModule}])});