cloudstudio
Version:
Run VS Code on a remote server.
6 lines (4 loc) • 15.2 kB
JavaScript
/*!--------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/(function(){var O=["require","exports","vs/base/common/platform","vs/base/common/extpath","vs/base/common/strings","vs/base/common/network","vs/base/common/uri","vs/base/common/path","vs/base/common/resources","vs/base/common/types","vs/workbench/contrib/output/common/outputLinkComputer","vs/editor/common/core/range"],S=function(k){for(var e=[],c=0,g=k.length;c<g;c++)e[c]=O[k[c]];return e};define(O[3],S([0,1,7,2,4,9]),function(k,e,c,g,h,R){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.randomPath=e.parseLineAndColumnAware=e.indexOfPath=e.getDriveLetter=e.hasDriveLetter=e.isRootOrDriveLetter=e.sanitizeFilePath=e.isWindowsDriveLetter=e.isEqualOrParent=e.isEqual=e.isValidBasename=e.isUNC=e.getRoot=e.toPosixPath=e.toSlashes=e.isPathSeparator=void 0;function y(n){return n===47||n===92}e.isPathSeparator=y;function U(n){return n.replace(/[\\/]/g,c.posix.sep)}e.toSlashes=U;function a(n){return n.indexOf("/")===-1&&(n=U(n)),/^[a-zA-Z]:(\/|$)/.test(n)&&(n="/"+n),n}e.toPosixPath=a;function u(n,o=c.posix.sep){if(!n)return"";const d=n.length,A=n.charCodeAt(0);if(y(A)){if(y(n.charCodeAt(1))&&!y(n.charCodeAt(2))){let b=3;const $=b;for(;b<d&&!y(n.charCodeAt(b));b++);if($!==b&&!y(n.charCodeAt(b+1))){for(b+=1;b<d;b++)if(y(n.charCodeAt(b)))return n.slice(0,b+1).replace(/[\\/]/g,o)}}return o}else if(l(A)&&n.charCodeAt(1)===58)return y(n.charCodeAt(2))?n.slice(0,2)+o:n.slice(0,2);let w=n.indexOf("://");if(w!==-1){for(w+=3;w<d;w++)if(y(n.charCodeAt(w)))return n.slice(0,w+1)}return""}e.getRoot=u;function C(n){if(!g.isWindows||!n||n.length<5)return!1;let o=n.charCodeAt(0);if(o!==92||(o=n.charCodeAt(1),o!==92))return!1;let d=2;const A=d;for(;d<n.length&&(o=n.charCodeAt(d),o!==92);d++);return!(A===d||(o=n.charCodeAt(d+1),isNaN(o)||o===92))}e.isUNC=C;const m=/[\\/:\*\?"<>\|]/g,v=/[\\/]/g,s=/^(con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9])(\.(.*?))?$/i;function t(n,o=g.isWindows){const d=o?m:v;return!(!n||n.length===0||/^\s+$/.test(n)||(d.lastIndex=0,d.test(n))||o&&s.test(n)||n==="."||n===".."||o&&n[n.length-1]==="."||o&&n.length!==n.trim().length||n.length>255)}e.isValidBasename=t;function i(n,o,d){const A=n===o;return!d||A?A:!n||!o?!1:(0,h.equalsIgnoreCase)(n,o)}e.isEqual=i;function r(n,o,d,A=c.sep){if(n===o)return!0;if(!n||!o||o.length>n.length)return!1;if(d){if(!(0,h.startsWithIgnoreCase)(n,o))return!1;if(o.length===n.length)return!0;let b=o.length;return o.charAt(o.length-1)===A&&b--,n.charAt(b)===A}return o.charAt(o.length-1)!==A&&(o+=A),n.indexOf(o)===0}e.isEqualOrParent=r;function l(n){return n>=65&&n<=90||n>=97&&n<=122}e.isWindowsDriveLetter=l;function f(n,o){return g.isWindows&&n.endsWith(":")&&(n+=c.sep),(0,c.isAbsolute)(n)||(n=(0,c.join)(o,n)),n=(0,c.normalize)(n),g.isWindows?(n=(0,h.rtrim)(n,c.sep),n.endsWith(":")&&(n+=c.sep)):(n=(0,h.rtrim)(n,c.sep),n||(n=c.sep)),n}e.sanitizeFilePath=f;function P(n){const o=(0,c.normalize)(n);return g.isWindows?n.length>3?!1:E(o)&&(n.length===2||o.charCodeAt(2)===92):o===c.posix.sep}e.isRootOrDriveLetter=P;function E(n,o=g.isWindows){return o?l(n.charCodeAt(0))&&n.charCodeAt(1)===58:!1}e.hasDriveLetter=E;function T(n){return E(n)?n[0]:void 0}e.getDriveLetter=T;function I(n,o,d){return o.length>n.length?-1:n===o?0:(d&&(n=n.toLowerCase(),o=o.toLowerCase()),n.indexOf(o))}e.indexOfPath=I;function q(n){const o=n.split(":");let d,A,w;for(const b of o){const $=Number(b);(0,R.isNumber)($)?A===void 0?A=$:w===void 0&&(w=$):d=d?[d,b].join(":"):b}if(!d)throw new Error("Format for `--goto` should be: `FILE:LINE(:COLUMN)`");return{path:d,line:A!==void 0?A:void 0,column:w!==void 0?w:A!==void 0?1:void 0}}e.parseLineAndColumnAware=q;const N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function L(n,o,d=8){let A="";for(let b=0;b<d;b++)A+=N.charAt(Math.floor(Math.random()*N.length));let w;return o?w=`${o}-${A}`:w=A,n?(0,c.join)(n,w):w}e.randomPath=L}),define(O[5],S([0,1,2,6]),function(k,e,c,g){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FileAccess=e.RemoteAuthorities=e.getTokenFromCurrentHref=e.connectionTokenQueryName2=e.connectionTokenQueryName=e.connectionTokenCookieName=e.Schemas=void 0;var h;(function(a){a.inMemory="inmemory",a.vscode="vscode",a.internal="private",a.walkThrough="walkThrough",a.walkThroughSnippet="walkThroughSnippet",a.http="http",a.https="https",a.file="file",a.mailto="mailto",a.untitled="untitled",a.data="data",a.command="command",a.vscodeRemote="vscode-remote",a.vscodeRemoteResource="vscode-remote-resource",a.vscodeUserData="vscode-userdata",a.vscodeCustomEditor="vscode-custom-editor",a.vscodeNotebook="vscode-notebook",a.vscodeNotebookCell="vscode-notebook-cell",a.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",a.vscodeNotebookCellOutput="vscode-notebook-cell-output",a.vscodeInteractive="vscode-interactive",a.vscodeInteractiveInput="vscode-interactive-input",a.vscodeSettings="vscode-settings",a.vscodeWorkspaceTrust="vscode-workspace-trust",a.vscodeTerminal="vscode-terminal",a.webviewPanel="webview-panel",a.vscodeWebview="vscode-webview",a.extension="extension",a.vscodeFileResource="vscode-file",a.tmp="tmp",a.vsls="vsls",a.vscodeSourceControl="vscode-scm"})(h=e.Schemas||(e.Schemas={})),e.connectionTokenCookieName="vscode-tkn",e.connectionTokenQueryName="tkn",e.connectionTokenQueryName2="token";function R(){const a=window.location.href;return new URL(a).searchParams.get("token")||""}e.getTokenFromCurrentHref=R;class y{constructor(){this._hosts=Object.create(null),this._ports=Object.create(null),this._connectionTokens=Object.create(null),this._preferredWebSchema="http",this._delegate=null,this._remoteResourcesPath=`/${h.vscodeRemoteResource}`}setPreferredWebSchema(u){this._preferredWebSchema=u}setDelegate(u){this._delegate=u}setServerRootPath(u){this._remoteResourcesPath=`/${h.vscodeRemoteResource}`}set(u,C,m){this._hosts[u]=C,this._ports[u]=m}setConnectionToken(u,C){this._connectionTokens[u]=C}getPreferredWebSchema(){return this._preferredWebSchema}rewrite(u){if(this._delegate)return this._delegate(u);const C=u.authority;let m=this._hosts[C];m&&m.indexOf(":")!==-1&&(m=`[${m}]`);const v=this._ports[C],s=this._connectionTokens[C];let t=`path=${encodeURIComponent(u.path)}`;typeof s=="string"&&(t+=`&${e.connectionTokenQueryName}=${encodeURIComponent(s)}`);const i=R();i&&(t+=`&${e.connectionTokenQueryName2}=${encodeURIComponent(i)}`);const r=document.getElementById("vscode-workbench-web-configuration"),l=r?r.getAttribute("data-settings"):void 0;if(!r||!l)throw new Error("Missing web configuration element");const f=JSON.parse(l);return g.URI.from({scheme:c.isWeb?this._preferredWebSchema:h.vscodeRemoteResource,authority:`${m}:${v}`,path:`${f.remoteAuthority?window.location.pathname.replace(/\/+$/,""):""}${this._remoteResourcesPath}`,query:t})}}e.RemoteAuthorities=new y;class U{asBrowserUri(u,C){const m=this.toUri(u,C);return m.scheme===h.vscodeRemote?e.RemoteAuthorities.rewrite(m):m.scheme===h.file&&(c.isNative||c.isWebWorker&&c.globals.origin===`${h.vscodeFileResource}://${U.FALLBACK_AUTHORITY}`)?m.with({scheme:h.vscodeFileResource,authority:m.authority||U.FALLBACK_AUTHORITY,query:null,fragment:null}):m}asFileUri(u,C){const m=this.toUri(u,C);return m.scheme===h.vscodeFileResource?m.with({scheme:h.file,authority:m.authority!==U.FALLBACK_AUTHORITY?m.authority:null,query:null,fragment:null}):m}toUri(u,C){return g.URI.isUri(u)?u:g.URI.parse(C.toUrl(u))}}U.FALLBACK_AUTHORITY="vscode-app",e.FileAccess=new U}),define(O[8],S([0,1,3,5,7,2,4,6]),function(k,e,c,g,h,R,y,U){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.toLocalResource=e.DataUri=e.distinctParents=e.addTrailingPathSeparator=e.removeTrailingPathSeparator=e.hasTrailingPathSeparator=e.isEqualAuthority=e.isAbsolutePath=e.resolvePath=e.relativePath=e.normalizePath=e.joinPath=e.dirname=e.extname=e.basename=e.basenameOrAuthority=e.getComparisonKey=e.isEqualOrParent=e.isEqual=e.extUriIgnorePathCase=e.extUriBiasedIgnorePathCase=e.extUri=e.ExtUri=e.originalFSPath=void 0;function a(s){return(0,U.uriToFsPath)(s,!0)}e.originalFSPath=a;class u{constructor(t){this._ignorePathCasing=t}compare(t,i,r=!1){return t===i?0:(0,y.compare)(this.getComparisonKey(t,r),this.getComparisonKey(i,r))}isEqual(t,i,r=!1){return t===i?!0:!t||!i?!1:this.getComparisonKey(t,r)===this.getComparisonKey(i,r)}getComparisonKey(t,i=!1){return t.with({path:this._ignorePathCasing(t)?t.path.toLowerCase():void 0,fragment:i?null:void 0}).toString()}ignorePathCasing(t){return this._ignorePathCasing(t)}isEqualOrParent(t,i,r=!1){if(t.scheme===i.scheme){if(t.scheme===g.Schemas.file)return c.isEqualOrParent(a(t),a(i),this._ignorePathCasing(t))&&t.query===i.query&&(r||t.fragment===i.fragment);if((0,e.isEqualAuthority)(t.authority,i.authority))return c.isEqualOrParent(t.path,i.path,this._ignorePathCasing(t),"/")&&t.query===i.query&&(r||t.fragment===i.fragment)}return!1}joinPath(t,...i){return U.URI.joinPath(t,...i)}basenameOrAuthority(t){return(0,e.basename)(t)||t.authority}basename(t){return h.posix.basename(t.path)}extname(t){return h.posix.extname(t.path)}dirname(t){if(t.path.length===0)return t;let i;return t.scheme===g.Schemas.file?i=U.URI.file(h.dirname(a(t))).path:(i=h.posix.dirname(t.path),t.authority&&i.length&&i.charCodeAt(0)!==47&&(console.error(`dirname("${t.toString})) resulted in a relative path`),i="/")),t.with({path:i})}normalizePath(t){if(!t.path.length)return t;let i;return t.scheme===g.Schemas.file?i=U.URI.file(h.normalize(a(t))).path:i=h.posix.normalize(t.path),t.with({path:i})}relativePath(t,i){if(t.scheme!==i.scheme||!(0,e.isEqualAuthority)(t.authority,i.authority))return;if(t.scheme===g.Schemas.file){const f=h.relative(a(t),a(i));return R.isWindows?c.toSlashes(f):f}let r=t.path||"/";const l=i.path||"/";if(this._ignorePathCasing(t)){let f=0;for(const P=Math.min(r.length,l.length);f<P&&!(r.charCodeAt(f)!==l.charCodeAt(f)&&r.charAt(f).toLowerCase()!==l.charAt(f).toLowerCase());f++);r=l.substr(0,f)+r.substr(f)}return h.posix.relative(r,l)}resolvePath(t,i){if(t.scheme===g.Schemas.file){const r=U.URI.file(h.resolve(a(t),i));return t.with({authority:r.authority,path:r.path})}return i=c.toPosixPath(i),t.with({path:h.posix.resolve(t.path,i)})}isAbsolutePath(t){return!!t.path&&t.path[0]==="/"}isEqualAuthority(t,i){return t===i||t!==void 0&&i!==void 0&&(0,y.equalsIgnoreCase)(t,i)}hasTrailingPathSeparator(t,i=h.sep){if(t.scheme===g.Schemas.file){const r=a(t);return r.length>c.getRoot(r).length&&r[r.length-1]===i}else{const r=t.path;return r.length>1&&r.charCodeAt(r.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(t.fsPath)}}removeTrailingPathSeparator(t,i=h.sep){return(0,e.hasTrailingPathSeparator)(t,i)?t.with({path:t.path.substr(0,t.path.length-1)}):t}addTrailingPathSeparator(t,i=h.sep){let r=!1;if(t.scheme===g.Schemas.file){const l=a(t);r=l!==void 0&&l.length===c.getRoot(l).length&&l[l.length-1]===i}else{i="/";const l=t.path;r=l.length===1&&l.charCodeAt(l.length-1)===47}return!r&&!(0,e.hasTrailingPathSeparator)(t,i)?t.with({path:t.path+"/"}):t}}e.ExtUri=u,e.extUri=new u(()=>!1),e.extUriBiasedIgnorePathCase=new u(s=>s.scheme===g.Schemas.file?!R.isLinux:!0),e.extUriIgnorePathCase=new u(s=>!0),e.isEqual=e.extUri.isEqual.bind(e.extUri),e.isEqualOrParent=e.extUri.isEqualOrParent.bind(e.extUri),e.getComparisonKey=e.extUri.getComparisonKey.bind(e.extUri),e.basenameOrAuthority=e.extUri.basenameOrAuthority.bind(e.extUri),e.basename=e.extUri.basename.bind(e.extUri),e.extname=e.extUri.extname.bind(e.extUri),e.dirname=e.extUri.dirname.bind(e.extUri),e.joinPath=e.extUri.joinPath.bind(e.extUri),e.normalizePath=e.extUri.normalizePath.bind(e.extUri),e.relativePath=e.extUri.relativePath.bind(e.extUri),e.resolvePath=e.extUri.resolvePath.bind(e.extUri),e.isAbsolutePath=e.extUri.isAbsolutePath.bind(e.extUri),e.isEqualAuthority=e.extUri.isEqualAuthority.bind(e.extUri),e.hasTrailingPathSeparator=e.extUri.hasTrailingPathSeparator.bind(e.extUri),e.removeTrailingPathSeparator=e.extUri.removeTrailingPathSeparator.bind(e.extUri),e.addTrailingPathSeparator=e.extUri.addTrailingPathSeparator.bind(e.extUri);function C(s,t){const i=[];for(let r=0;r<s.length;r++){const l=t(s[r]);s.some((f,P)=>P===r?!1:(0,e.isEqualOrParent)(l,t(f)))||i.push(s[r])}return i}e.distinctParents=C;var m;(function(s){s.META_DATA_LABEL="label",s.META_DATA_DESCRIPTION="description",s.META_DATA_SIZE="size",s.META_DATA_MIME="mime";function t(i){const r=new Map;i.path.substring(i.path.indexOf(";")+1,i.path.lastIndexOf(";")).split(";").forEach(P=>{const[E,T]=P.split(":");E&&T&&r.set(E,T)});const f=i.path.substring(0,i.path.indexOf(";"));return f&&r.set(s.META_DATA_MIME,f),r}s.parseMetaData=t})(m=e.DataUri||(e.DataUri={}));function v(s,t,i){if(t){let r=s.path;return r&&r[0]!==h.posix.sep&&(r=h.posix.sep+r),s.with({scheme:i,authority:t,path:r})}return s.with({scheme:i})}e.toLocalResource=v}),define(O[10],S([0,1,6,3,8,4,11,2,5]),function(k,e,c,g,h,R,y,U,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.create=e.OutputLinkComputer=void 0;class u{constructor(v,s){this.ctx=v,this.patterns=new Map,this.computePatterns(s)}computePatterns(v){const s=v.workspaceFolders.sort((t,i)=>i.length-t.length).map(t=>c.URI.parse(t));for(const t of s){const i=u.createPatterns(t);this.patterns.set(t,i)}}getModel(v){return this.ctx.getMirrorModels().find(t=>t.uri.toString()===v)}computeLinks(v){const s=this.getModel(v);if(!s)return[];const t=[],i=R.splitLines(s.getValue());for(const[r,l]of this.patterns){const f={toResource:P=>typeof P=="string"?h.joinPath(r,P):null};for(let P=0,E=i.length;P<E;P++)t.push(...u.detectLinks(i[P],P+1,l,f))}return t}static createPatterns(v){const s=[],t=v.scheme===a.Schemas.file?v.fsPath:v.path,i=[t];U.isWindows&&v.scheme===a.Schemas.file&&i.push(g.toSlashes(t));for(const r of i){const l='[^\\s\\(\\):<>"]',P=`${`(?:${l}| ${l})`}+\\.${l}+`,E=`${l}+`;s.push(new RegExp(R.escapeRegExpCharacters(r)+`(${P}) on line ((\\d+)(, column (\\d+))?)`,"gi")),s.push(new RegExp(R.escapeRegExpCharacters(r)+`(${P}):line ((\\d+)(, column (\\d+))?)`,"gi")),s.push(new RegExp(R.escapeRegExpCharacters(r)+`(${P})(\\s?\\((\\d+)(,(\\d+))?)\\)`,"gi")),s.push(new RegExp(R.escapeRegExpCharacters(r)+`(${E})(:(\\d+))?(:(\\d+))?`,"gi"))}return s}static detectLinks(v,s,t,i){const r=[];return t.forEach(l=>{l.lastIndex=0;let f,P=0;for(;(f=l.exec(v))!==null;){const E=R.rtrim(f[1],".").replace(/\\/g,"/");let T;try{const L=i.toResource(E);L&&(T=L.toString())}catch{continue}if(f[3]){const L=f[3];if(f[5]){const n=f[5];T=R.format("{0}#{1},{2}",T,L,n)}else T=R.format("{0}#{1}",T,L)}const I=R.rtrim(f[0],"."),q=v.indexOf(I,P);P=q+I.length;const N={startColumn:q+1,startLineNumber:s,endColumn:q+1+I.length,endLineNumber:s};if(r.some(L=>y.Range.areIntersectingOrTouching(L.range,N)))return;r.push({range:N,url:T})}}),r}}e.OutputLinkComputer=u;function C(m,v){return new u(m,v)}e.create=C})}).call(this);
//# sourceMappingURL=https://ticino.blob.core.windows.net/sourcemaps/a711c3b7ecbf5dae1e178a62074ae55c6a2930fe/core/vs/workbench/contrib/output/common/outputLinkComputer.js.map