/*!-------------------------------------------------------- * Copyright (C) Microsoft Corporation. All rights reserved. *--------------------------------------------------------*/(function(){var R=["vs/code/browser/workbench/workbench","require","exports","vs/base/browser/browser","vs/base/browser/window","vs/base/common/buffer","vs/base/common/event","vs/base/common/lifecycle","vs/base/common/marshalling","vs/base/common/network","vs/base/common/path","vs/base/common/resources","vs/base/common/strings","vs/base/common/uri","vs/platform/product/common/product","vs/platform/window/common/window","vs/workbench/workbench.web.main"],I=function(l){for(var f=[],y=0,o=l.length;ysetTimeout(s,e*e*100))}throw t}}class w{constructor(e){this.c=e,this.a="secrets.provider",this.b=this.d(),this.type="persisted"}async d(){const e=this.f(),t=localStorage.getItem(this.a);if(t)try{const r=JSON.parse(await this.c.unseal(t));return{...e,...r}}catch(r){console.error("Failed to decrypt secrets from localStorage",r),localStorage.removeItem(this.a)}return e}f(){let e;const t=o.$ZR.document.getElementById("vscode-workbench-auth-session"),r=t?t.getAttribute("data-settings"):void 0;if(r)try{e=JSON.parse(r)}catch{}if(!e)return{};const s={};if(s[`${$.default.urlProtocol}.loginAccount`]=JSON.stringify(e),e.providerId!=="github")return console.error(`Unexpected auth provider: ${e.providerId}. Expected 'github'.`),s;const h=JSON.stringify({extensionId:"vscode.github-authentication",key:"github.auth"});return s[h]=JSON.stringify(e.scopes.map(c=>({id:e.id,scopes:c,accessToken:e.accessToken}))),s}async get(e){return(await this.b)[e]}async set(e,t){const r=await this.b;r[e]=t,this.b=Promise.resolve(r),this.g()}async delete(e){const t=await this.b;delete t[e],this.b=Promise.resolve(t),this.g()}async g(){try{const e=await this.c.seal(JSON.stringify(await this.b));localStorage.setItem(this.a,e)}catch(e){console.error(e)}}}f.LocalStorageSecretStorageProvider=w;class v extends L.$Xc{static{this.a=0}static{this.b=["scheme","authority","path","query","fragment"]}constructor(e){super(),this.m=e,this.c=this.B(new k.$ne),this.onCallback=this.c.event,this.f=new Set,this.g=Date.now(),this.h=void 0}create(e={}){const t=++v.a,r=[`vscode-reqid=${t}`];for(const s of v.b){const h=e[s];h&&r.push(`vscode-${s}=${encodeURIComponent(h)}`)}if(!(e.authority==="vscode.github-authentication"&&e.path==="/dummy")){const s=`vscode-web.url-callbacks[${t}]`;localStorage.removeItem(s),this.f.add(t),this.n()}return u.URI.parse(o.$ZR.location.href).with({path:this.m,query:r.join("&")})}n(){if(this.j)return;const e=()=>this.s();o.$ZR.addEventListener("storage",e),this.j={dispose:()=>o.$ZR.removeEventListener("storage",e)}}r(){this.j?.dispose(),this.j=void 0}async s(){const e=Date.now()-this.g;e>1e3?this.t():this.h===void 0&&(this.h=setTimeout(()=>{this.h=void 0,this.t()},1e3-e))}t(){let e;for(const t of this.f){const r=`vscode-web.url-callbacks[${t}]`,s=localStorage.getItem(r);if(s!==null){try{this.c.fire(u.URI.revive(JSON.parse(s)))}catch(h){console.error(h)}e=e??new Set(this.f),e.delete(t),localStorage.removeItem(r)}}e&&(this.f=e,this.f.size===0&&this.r()),this.g=Date.now()}}class i{static{this.a="ew"}static{this.b="folder"}static{this.c="workspace"}static{this.d="payload"}static create(e){let t=!1,r,s=Object.create(null);return new URL(document.location.href).searchParams.forEach((c,b)=>{switch(b){case i.b:e.remoteAuthority&&c.startsWith(g.$jc.sep)?r={folderUri:u.URI.from({scheme:m.Schemas.vscodeRemote,path:c,authority:e.remoteAuthority})}:r={folderUri:u.URI.parse(c)},t=!0;break;case i.c:e.remoteAuthority&&c.startsWith(g.$jc.sep)?r={workspaceUri:u.URI.from({scheme:m.Schemas.vscodeRemote,path:c,authority:e.remoteAuthority})}:r={workspaceUri:u.URI.parse(c)},t=!0;break;case i.a:r=void 0,t=!0;break;case i.d:try{s=(0,N.$ci)(c)}catch(p){console.error(p)}break}}),t||(e.folderUri?r={folderUri:u.URI.revive(e.folderUri)}:e.workspaceUri&&(r={workspaceUri:u.URI.revive(e.workspaceUri)})),new i(r,s,e)}constructor(e,t,r){this.workspace=e,this.payload=t,this.f=r,this.trusted=!0}async open(e,t){if(t?.reuse&&!t.payload&&this.j(this.workspace,e))return!0;const r=this.g(e,t);if(r){if(t?.reuse)return o.$ZR.location.href=r,!0;{let s;return(0,y.$gS)()?s=o.$ZR.open(r,"_blank","toolbar=no"):s=o.$ZR.open(r),!!s}}return!1}g(e,t){let r;if(!e)r=`${document.location.origin}${document.location.pathname}?${i.a}=true`;else if((0,d.$1D)(e)){const s=this.h(e.folderUri);r=`${document.location.origin}${document.location.pathname}?${i.b}=${s}`}else if((0,d.$ZD)(e)){const s=this.h(e.workspaceUri);r=`${document.location.origin}${document.location.pathname}?${i.c}=${s}`}return t?.payload&&(r+=`&${i.d}=${encodeURIComponent(JSON.stringify(t.payload))}`),r}h(e){return this.f.remoteAuthority&&e.scheme===m.Schemas.vscodeRemote?encodeURIComponent(`${g.$jc.sep}${(0,A.$of)(e.path,g.$jc.sep)}`).replaceAll("%2F","/"):encodeURIComponent(e.toString(!0))}j(e,t){return!e||!t?e===t:(0,d.$1D)(e)&&(0,d.$1D)(t)?(0,U.$ah)(e.folderUri,t.folderUri):(0,d.$ZD)(e)&&(0,d.$ZD)(t)?(0,U.$ah)(e.workspaceUri,t.workspaceUri):!1}hasRemote(){if(this.workspace){if((0,d.$1D)(this.workspace))return this.workspace.folderUri.scheme===m.Schemas.vscodeRemote;if((0,d.$ZD)(this.workspace))return this.workspace.workspaceUri.scheme===m.Schemas.vscodeRemote}return!0}}function G(a){const e=document.cookie.split("; ");for(const t of e)if(t.startsWith(a+"="))return t.substring(a.length+1)}(function(){const a=o.$ZR.document.getElementById("vscode-workbench-web-configuration"),e=a?a.getAttribute("data-settings"):void 0;if(!a||!e)throw new Error("Missing web configuration element");const t=JSON.parse(e),r=G("vscode-secret-key-path"),s=r&&E.supported()?new E(r):new O;(0,H.create)(o.$ZR.document.body,{...t,windowIndicator:t.windowIndicator??{label:"$(remote)",tooltip:`${$.default.nameShort} Web`},settingsSyncOptions:t.settingsSyncOptions?{enabled:t.settingsSyncOptions.enabled}:void 0,workspaceProvider:i.create(t),urlCallbackProvider:new v(t.callbackRoute),secretStorageProvider:t.remoteAuthority&&!r?void 0:new w(s)})})()})}).call(this); //# sourceMappingURL=https://main.vscode-cdn.net/sourcemaps/ea1445cc7016315d0f5728f8e8b12a45dc0a7286/core/vs/code/browser/workbench/workbench.js.map