limixbot 0.3.71 → 0.3.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ActivityPanel-RhVpYfcN.js → ActivityPanel-CkKODTkn.js} +1 -1
- package/dist/assets/{App-Cw7Q97gJ.js → App-CTks_6Oy.js} +8 -8
- package/dist/assets/{AppEventEditor-Btah_c_2.js → AppEventEditor-C5dMvU0t.js} +1 -1
- package/dist/assets/{BotSettingsDialog-86CEEBqv.js → BotSettingsDialog-Ynw6f_iW.js} +1 -1
- package/dist/assets/{BrowserPanel-br1TVwLl.js → BrowserPanel-Bk5mHx71.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-CFHWN-4r.js → BrowserProfilesManager-DGg6sMtG.js} +1 -1
- package/dist/assets/{CloudAddDialog-Ir0qZH_R.js → CloudAddDialog-BQ6BnVr4.js} +1 -1
- package/dist/assets/{ComputerFilesPane-IdxcdO3R.js → ComputerFilesPane-BNAg8wf7.js} +1 -1
- package/dist/assets/{ComputerPanel-DhsVAGkk.js → ComputerPanel-m_-uoe7X.js} +2 -2
- package/dist/assets/{DataPanel-DzShkWJM.js → DataPanel-D_6jIY8B.js} +1 -1
- package/dist/assets/{FilesView-CXs0o7Ng.js → FilesView-C9AHNkLW.js} +1 -1
- package/dist/assets/{GrokMoveDialog-ByVz0ZLd.js → GrokMoveDialog-BeZxm-3r.js} +1 -1
- package/dist/assets/{InspectorPanel-HDxbq3Em.js → InspectorPanel-DAM37Y7L.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-_wmael6o.js → KeyboardShortcutsModal-Ym7Pn6--.js} +1 -1
- package/dist/assets/{LimixChannelReview-D3Vre_b5.js → LimixChannelReview-exv65AZ3.js} +1 -1
- package/dist/assets/{LiveDesktop-DUNUN3ip.js → LiveDesktop-BXweoKuo.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-r8vQozIz.js → LocalVmWorkspace-quoTXN8S.js} +1 -1
- package/dist/assets/{MacLocalControl-9eGCA-t2.js → MacLocalControl-DDTtAbHJ.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-r_b3CzP8.js → MarkdownFilePreview-CWv2KqDd.js} +1 -1
- package/dist/assets/{NewBotDialog-JY8nCL-F.js → NewBotDialog-DmwyIlKy.js} +1 -1
- package/dist/assets/{PhoneAppDialog-CquVzL0v.js → PhoneAppDialog-BPZgNeRH.js} +1 -1
- package/dist/assets/{PluginsPanel-2Li8_VD_.js → PluginsPanel-D9o8Kso2.js} +1 -1
- package/dist/assets/{ProIntroduction-BrmG7l3N.js → ProIntroduction-DTJRKc3C.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-BXvMgYlC.js → RemoteAgentSettingsPanel-DxgvH_q6.js} +1 -1
- package/dist/assets/{RoomPanel-CAVyXzip.js → RoomPanel-BpPPacIB.js} +1 -1
- package/dist/assets/{RoutinesPage-CusNYUVf.js → RoutinesPage-ChvdROGM.js} +1 -1
- package/dist/assets/{SettingsModal-BhKWJU6g.js → SettingsModal-Ds87lS1W.js} +1 -1
- package/dist/assets/{ShareTeamDialog-DyFOit3r.js → ShareTeamDialog-Czr9POTu.js} +1 -1
- package/dist/assets/{SignedInSites-CaJSD3FM.js → SignedInSites-C8I33OKl.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-BSXhXzhC.js → TeamLibraryPanel-d5Gdiy-X.js} +1 -1
- package/dist/assets/{TeamMapPage-SRWVTLku.js → TeamMapPage-D0niSUlj.js} +1 -1
- package/dist/assets/{TriggersPage-BJzUTKl-.js → TriggersPage-DFdS4DRi.js} +1 -1
- package/dist/assets/{VisibilitySection-D0dJqTuH.js → VisibilitySection-LuAbLOEn.js} +1 -1
- package/dist/assets/{WebhookTrigger-Ca8w_FmT.js → WebhookTrigger-C9RcWKqF.js} +1 -1
- package/dist/assets/{WorksOnGrid-B32J52xy.js → WorksOnGrid-DEKWYfqx.js} +1 -1
- package/dist/assets/{core-DX_0zk8q.js → core-CBGJN-JB.js} +1 -1
- package/dist/assets/{import-name-DVWIecdd.js → import-name-BxQB51Yn.js} +1 -1
- package/dist/assets/{index-DzysZUHS.js → index-BAgBrTYo.js} +2 -2
- package/dist/assets/{index-D2TZFrfq.js → index-T_84JzFg.js} +1 -1
- package/dist/assets/{mcp-servers-GF93s9SY.js → mcp-servers-D9Je8TKG.js} +1 -1
- package/dist/assets/{new-bot-BI0T02kV.js → new-bot-CIguBXZQ.js} +1 -1
- package/dist/assets/{org-library-CjxDoFor.js → org-library-CazeQ3UP.js} +1 -1
- package/dist/assets/{package-format-C42-bOdh.js → package-format-BCRjsHSJ.js} +1 -1
- package/dist/assets/{remote-desktop-panel-tFLOT6M5.js → remote-desktop-panel-DOT7_iBW.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/package.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as e,t as a,X as D,a as p,L as A,l as H}from"./styles-BkKe8nrS.js";import{c as F,B as U,L as W}from"./PlacesRail-DeL2Iwjg.js";import{b as X}from"./remote-desktop-DDRRx8uY.js";import{u as $,n as G}from"./App-
|
|
1
|
+
import{r as o,j as e,t as a,X as D,a as p,L as A,l as H}from"./styles-BkKe8nrS.js";import{c as F,B as U,L as W}from"./PlacesRail-DeL2Iwjg.js";import{b as X}from"./remote-desktop-DDRRx8uY.js";import{u as $,n as G}from"./App-CTks_6Oy.js";import"./monitor-LgR-tKnv.js";import"./index-BAgBrTYo.js";import"./MenuMotion-EDKcQmjm.js";function K(n){return{enabled:n?.enabled??!0,verificationPending:n?.verificationPending??!1}}const P=3,b=50;function J(n){const s=n.trim();if(!s)return null;if(!/^\d+$/.test(s))return;const r=Number(s);return r>=1&&r<=b?r:void 0}function E(n,s){return n.trim().split(/[.!?\n]/)[0]?.trim().slice(0,60)||`${s?.name??"Bot"} automation`}const x="w-full rounded-xl border border-hairline/60 bg-panel px-3.5 py-2.5 text-[13px] text-ink outline-none placeholder:text-ink-tertiary focus:border-accent/70";function ae({webhook:n,bots:s,initialBotId:r,onClose:l,onCredential:C}){const{state:h,dispatch:R}=$(),[d,O]=o.useState(n?.botId??(r&&s.some(t=>t.id===r)?r:s[0]?.id)??""),[f,T]=o.useState(n?.name??""),[c,I]=o.useState(n?.prompt??""),[m,g]=o.useState(n?.runOn??"maus"),[v,_]=o.useState((n?.eventTypes??[]).join(", ")),[j,B]=o.useState(n?.maxPendingRuns?.toString()??""),[y,N]=o.useState(!1),[k,u]=o.useState(""),S=o.useRef(null);F(S,l);const L=!!(h.config?.box.configured&&X(h.instances,s.find(t=>t.id===d)?.modelSelection.instanceId)?.snapshot.state==="available"),M=async()=>{const t=s.find(i=>i.id===d),w=J(j);if(w===void 0){u(a("automations.editor.app.limitError",{max:b}));return}const z={name:f.trim()||E(c,t),prompt:c.trim(),botId:d,runOn:m,...K(n),eventTypes:v.split(",").map(i=>i.trim()).filter(Boolean),maxPendingRuns:w};N(!0),u("");try{const i=await G(n?`/api/webhooks/${n.id}`:"/api/webhooks",{method:n?"PATCH":"POST",body:JSON.stringify(z)});R({type:"webhookPatched",webhook:i.webhook}),l(),i.credential&&C(i.credential,i.webhook.id)}catch(i){u(i instanceof Error?i.message:String(i))}finally{N(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-5",onMouseDown:t=>t.stopPropagation(),children:e.jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-label":n?a("automations.editor.app.editTitle"):a("automations.editor.app.title"),tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-hairline/60 bg-panel shadow-2xl",children:[e.jsxs("div",{className:"flex items-start justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[17px] font-semibold text-ink",children:n?a("automations.editor.app.editTitle"):a("automations.editor.app.title")}),e.jsx("div",{className:"mt-1 text-[12px] text-ink-secondary",children:a("automations.editor.app.subtitle")})]}),e.jsx("button",{type:"button",onClick:l,"aria-label":a("automations.newBox.cancel"),className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(D,{size:18})})]}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[13px] font-medium text-ink",children:a("automations.editor.app.who")}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:s.map(t=>e.jsxs("button",{type:"button",onClick:()=>O(t.id),className:p("flex min-w-0 items-center gap-2 rounded-xl border px-3 py-2 text-left",d===t.id?"border-accent/70 bg-accent/10":"border-hairline/50 bg-inset hover:bg-raised/60"),children:[e.jsx(U,{bot:t,state:d===t.id?"happy":"idle",size:32,animated:!1}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium text-ink",children:t.name})]},t.id))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-2 block text-[13px] font-medium text-ink",children:a("automations.editor.app.what")}),e.jsx("textarea",{autoFocus:!0,value:c,onChange:t=>I(t.target.value),rows:3,placeholder:a("automations.editor.app.whatPlaceholder"),className:p(x,"resize-y py-3 leading-relaxed")})]}),e.jsxs("details",{className:"rounded-xl border border-hairline/45 bg-inset/45 px-4 py-3",children:[e.jsx("summary",{className:"cursor-pointer text-[13px] font-medium text-ink",children:a("automations.more")}),e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-[12px] font-medium text-ink-secondary",children:a("automations.editor.app.name")}),e.jsx("input",{value:f,onChange:t=>T(t.target.value),placeholder:E(c,s.find(t=>t.id===d)),className:x})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[12px] font-medium text-ink-secondary",children:a("automations.editor.app.runOn")}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>g("maus"),className:p("flex items-center gap-2 rounded-xl border p-3 text-left text-[13px] font-medium text-ink",m==="maus"?"border-accent/70 bg-accent/10":"border-hairline/50 bg-panel hover:bg-raised/60"),children:[e.jsx(A,{size:14}),a("automations.editor.app.thisComputer")]}),e.jsxs("button",{type:"button",disabled:!L&&m!=="cloud",onClick:()=>g("cloud"),className:p("flex items-center gap-2 rounded-xl border p-3 text-left text-[13px] font-medium text-ink disabled:cursor-not-allowed disabled:opacity-45",m==="cloud"?"border-accent/70 bg-accent/10":"border-hairline/50 bg-panel hover:bg-raised/60"),children:[e.jsx(H,{size:14}),a("automations.editor.app.cloud")]})]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-[12px] font-medium text-ink-secondary",children:a("automations.editor.app.events")}),e.jsx("input",{value:v,onChange:t=>_(t.target.value),placeholder:"push, workflow_run",className:x}),e.jsx("span",{className:"mt-1.5 block text-[11px] text-ink-secondary",children:a("automations.editor.app.eventsHelp")})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-[12px] font-medium text-ink-secondary",children:a("automations.editor.app.limit")}),e.jsx("input",{type:"number",inputMode:"numeric",min:1,max:b,step:1,value:j,onChange:t=>B(t.target.value),placeholder:String(P),className:x}),e.jsx("span",{className:"mt-1.5 block text-[11px] text-ink-secondary",children:a("automations.editor.app.limitHelp",{count:P})})]})]})]}),k&&e.jsx("div",{className:"rounded-xl border border-danger/30 bg-danger/10 px-3.5 py-3 text-[12px] text-danger",children:k})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-hairline/40 px-5 py-4",children:[e.jsx("button",{type:"button",onClick:l,className:"rounded-xl px-4 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",children:a("automations.newBox.cancel")}),e.jsxs("button",{type:"button",disabled:y||!d,onClick:()=>{M()},className:"flex items-center gap-2 rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-accent-ink hover:brightness-110 disabled:opacity-40",children:[y&&e.jsx(W,{size:14,className:"animate-spin"}),n?a("automations.editor.app.save"):a("automations.editor.app.create")]})]})]})})}export{ae as WebhookEditor,E as suggestedName};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r,t,a as u,l as v,f as g}from"./styles-BkKe8nrS.js";import{u as h,a2 as k,a3 as j,G as N,a4 as w,a5 as p}from"./App-
|
|
1
|
+
import{j as r,t,a as u,l as v,f as g}from"./styles-BkKe8nrS.js";import{u as h,a2 as k,a3 as j,G as N,a4 as w,a5 as p}from"./App-CTks_6Oy.js";import{M as A}from"./monitor-LgR-tKnv.js";import{e as C}from"./PlacesRail-DeL2Iwjg.js";function z({value:s,compact:o=!1,onChange:e}){const{state:c}=h();return c.config?.cloudHome?null:r.jsxs("div",{className:"mt-3 rounded-lg bg-inset p-3",children:[r.jsx("div",{className:"text-[12px] font-medium text-ink",children:o?t("botAccess.cloud.provider"):t("botAccess.cloud.backend")}),r.jsx("div",{className:"mt-0.5 text-[12px] text-ink-secondary",children:o?s==="vps"?t("botAccess.cloud.vpsDescription"):t("botAccess.cloud.hostedDescription"):s==="vps"?t("botAccess.cloud.vpsAutoDescription"):t("botAccess.cloud.hostedBackendDescription")}),r.jsx("div",{className:"mt-2 flex overflow-hidden rounded-lg border border-hairline/40",children:["box","vps"].map((n,a)=>r.jsx("button",{onClick:()=>e(n),className:u("flex-1 py-1.5 text-[12px]",a>0&&"border-l border-hairline/40",s===n?"bg-raised text-ink":"text-ink-secondary hover:bg-raised/60 hover:text-ink"),children:n==="vps"?t("botAccess.cloud.selfHostedVps"):t("botAccess.cloud.boat")},n))})]})}const D=[[null,"vm.dest.auto","computer.dest.autoDesc",k],["cloud","place.cloud","computer.dest.cloudDesc",v],["vm","vm.dest.vm","computer.dest.vmDesc",j],["local","vm.dest.local","computer.dest.localDesc",A],["browser","vm.dest.browser","computer.dest.browserDesc",N],["off","vm.dest.off","computer.dest.offDesc",C]];function G(s,o){return D.filter(([e])=>e===null||e==="off"||w(e,s)&&!(e==="local"&&p(o)))}function H(s,o,e){return s===null?!o||o==="local"&&p(e):o===s}function M(s,o,e){const c=s==="local"?"thisComputer":s==="vm"?"localVm":s==="cloud"?o==="vps"?"vps":"box":null;return e&&c&&!e.computers[c]?t("policy.managedBy",{organization:e.organizationName}):void 0}function R({options:s,onSelect:o}){return r.jsx("div",{role:"group","aria-label":t("computer.destinationAria"),className:"mt-3 grid auto-rows-fr grid-cols-2 gap-2",children:s.map(({mode:e,labelKey:c,descriptionKey:n,Icon:a,selected:i,managedBy:m,disabled:l,unavailableTitle:x,note:f,issue:b,view:d})=>r.jsxs("button",{disabled:l,title:x,onClick:()=>o(e),type:"button","aria-pressed":i,className:u("min-w-0 rounded-lg border px-2.5 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-card",i?"border-accent/60 bg-accent/10 text-ink":"border-hairline/50 bg-panel/30 text-ink-secondary",l?"cursor-not-allowed":"hover:border-accent/40 hover:bg-control/60"),children:[r.jsxs("span",{className:"flex items-center gap-2 text-[12px] font-medium leading-4",children:[i?r.jsx(g,{size:14,className:"shrink-0 text-accent"}):r.jsx(a,{size:14,className:"shrink-0 text-ink-secondary"}),r.jsx("span",{children:t(c)})]}),r.jsx("span",{className:"mt-1.5 block text-[11px] leading-4 text-ink-secondary",children:m??f??(l?d.line:b?d.short:t(n))})]},e??"auto"))})}export{z as C,R as W,H as a,M as p,G as w};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{fc as xe,df as rt,da as Mt,fd as jt,fe as Dt,ff as Me,de as Wt}from"./App-Cw7Q97gJ.js";import"./styles-BkKe8nrS.js";import"./index-DzysZUHS.js";import"./PlacesRail-DeL2Iwjg.js";import"./monitor-LgR-tKnv.js";import"./MenuMotion-EDKcQmjm.js";const je={}.hasOwnProperty;function Ft(t,e){const n=e||{};function s(r,...i){let o=s.invalid;const c=s.handlers;if(r&&je.call(r,t)){const a=String(r[t]);o=je.call(c,a)?c[a]:s.unknown}if(o)return o.call(this,r,...i)}return s.handlers=n.handlers||{},s.invalid=n.invalid,s.unknown=n.unknown,s}var S=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function qt(t){return Le(t)}function Le(t){return Array.isArray(t)?zt(t):t instanceof RegExp?t:typeof t=="object"?Ht(t):t}function zt(t){let e=[];for(let n=0,s=t.length;n<s;n++)e[n]=Le(t[n]);return e}function Ht(t){let e={};for(let n in t)e[n]=Le(t[n]);return e}function it(t,...e){return e.forEach(n=>{for(let s in n)t[s]=n[s]}),t}function ot(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?ot(t.substring(0,t.length-1)):t.substr(~e+1)}var ge=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,U=class{static hasCaptures(t){return t===null?!1:(ge.lastIndex=0,ge.test(t))}static replaceCaptures(t,e,n){return t.replace(ge,(s,r,i,o)=>{let c=n[parseInt(r||i,10)];if(c){let a=e.substring(c.start,c.end);for(;a[0]===".";)a=a.substring(1);switch(o){case"downcase":return a.toLowerCase();case"upcase":return a.toUpperCase();default:return a}}else return s})}};function at(t,e){return t<e?-1:t>e?1:0}function ct(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,s=e.length;if(n===s){for(let r=0;r<n;r++){let i=at(t[r],e[r]);if(i!==0)return i}return 0}return n-s}function De(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function lt(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var ut=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},Q=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Vt(t),e)}static createFromParsedTheme(t,e){return Jt(t,e)}_cachedMatchRoot=new ut(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,s=this._cachedMatchRoot.get(e).find(r=>Ut(t.parent,r.parentScopes));return s?new ht(s.fontStyle,s.foreground,s.background):null}},me=class Y{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const s of n)e=new Y(e,s);return e}static from(...e){let n=null;for(let s=0;s<e.length;s++)n=new Y(n,e[s]);return n}push(e){return new Y(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let s=this;for(;s&&s!==e;)n.push(s.scopeName),s=s.parent;return s===e?n.reverse():void 0}};function Ut(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let s=e[n],r=!1;if(s===">"){if(n===e.length-1)return!1;s=e[++n],r=!0}for(;t&&!Kt(t.scopeName,s);){if(r)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Kt(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var ht=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Vt(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],s=0;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(!o.settings)continue;let c;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),c=h.split(",")}else Array.isArray(o.scope)?c=o.scope:c=[""];let a=-1;if(typeof o.settings.fontStyle=="string"){a=0;let h=o.settings.fontStyle.split(" ");for(let d=0,f=h.length;d<f;d++)switch(h[d]){case"italic":a=a|1;break;case"bold":a=a|2;break;case"underline":a=a|4;break;case"strikethrough":a=a|8;break}}let l=null;typeof o.settings.foreground=="string"&&De(o.settings.foreground)&&(l=o.settings.foreground);let u=null;typeof o.settings.background=="string"&&De(o.settings.background)&&(u=o.settings.background);for(let h=0,d=c.length;h<d;h++){let p=c[h].trim().split(" "),y=p[p.length-1],_=null;p.length>1&&(_=p.slice(0,p.length-1),_.reverse()),n[s++]=new Yt(y,_,r,a,l,u)}}return n}var Yt=class{constructor(t,e,n,s,r,i){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=s,this.foreground=r,this.background=i}},k=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(k||{});function Jt(t,e){t.sort((a,l)=>{let u=at(a.scope,l.scope);return u!==0||(u=ct(a.parentScopes,l.parentScopes),u!==0)?u:a.index-l.index});let n=0,s="#000000",r="#ffffff";for(;t.length>=1&&t[0].scope==="";){let a=t.shift();a.fontStyle!==-1&&(n=a.fontStyle),a.foreground!==null&&(s=a.foreground),a.background!==null&&(r=a.background)}let i=new Qt(e),o=new ht(n,i.getId(s),i.getId(r)),c=new Zt(new Ce(0,null,-1,0,0),[]);for(let a=0,l=t.length;a<l;a++){let u=t[a];c.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new Q(i,o,c)}var Qt=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},Xt=Object.freeze([]),Ce=class ft{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,s,r,i){this.scopeDepth=e,this.parentScopes=n||Xt,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new ft(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let s=0,r=e.length;s<r;s++)n[s]=e[s].clone();return n}acceptOverwrite(e,n,s,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),r!==0&&(this.background=r)}},Zt=class we{constructor(e,n=[],s={}){this._mainRule=e,this._children=s,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let s=0,r=0;for(;e.parentScopes[s]===">"&&s++,n.parentScopes[r]===">"&&r++,!(s>=e.parentScopes.length||r>=n.parentScopes.length);){const i=n.parentScopes[r].length-e.parentScopes[s].length;if(i!==0)return i;s++,r++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let s=e.indexOf("."),r,i;if(s===-1?(r=e,i=""):(r=e.substring(0,s),i=e.substring(s+1)),this._children.hasOwnProperty(r))return this._children[r].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(we._cmpBySpecificity),n}insert(e,n,s,r,i,o){if(n===""){this._doInsertHere(e,s,r,i,o);return}let c=n.indexOf("."),a,l;c===-1?(a=n,l=""):(a=n.substring(0,c),l=n.substring(c+1));let u;this._children.hasOwnProperty(a)?u=this._children[a]:(u=new we(this._mainRule.clone(),Ce.cloneArr(this._rulesWithParentScopes)),this._children[a]=u),u.insert(e+1,l,s,r,i,o)}_doInsertHere(e,n,s,r,i){if(n===null){this._mainRule.acceptOverwrite(e,s,r,i);return}for(let o=0,c=this._rulesWithParentScopes.length;o<c;o++){let a=this._rulesWithParentScopes[o];if(ct(a.parentScopes,n)===0){a.acceptOverwrite(e,s,r,i);return}}s===-1&&(s=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Ce(e,n,s,r,i))}},G=class v{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=v.getLanguageId(e),s=v.getTokenType(e),r=v.getFontStyle(e),i=v.getForeground(e),o=v.getBackground(e);console.log({languageId:n,tokenType:s,fontStyle:r,foreground:i,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,s,r,i,o,c){let a=v.getLanguageId(e),l=v.getTokenType(e),u=v.containsBalancedBrackets(e)?1:0,h=v.getFontStyle(e),d=v.getForeground(e),f=v.getBackground(e);return n!==0&&(a=n),s!==8&&(l=s),r!==null&&(u=r?1:0),i!==-1&&(h=i),o!==0&&(d=o),c!==0&&(f=c),(a<<0|l<<8|u<<10|h<<11|d<<15|f<<24)>>>0}};function X(t,e){const n=[],s=en(t);let r=s.next();for(;r!==null;){let a=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":a=1;break;case"L":a=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let l=o();if(n.push({matcher:l,priority:a}),r!==",")break;r=s.next()}return n;function i(){if(r==="-"){r=s.next();const a=i();return l=>!!a&&!a(l)}if(r==="("){r=s.next();const a=c();return r===")"&&(r=s.next()),a}if(We(r)){const a=[];do a.push(r),r=s.next();while(We(r));return l=>e(a,l)}return null}function o(){const a=[];let l=i();for(;l;)a.push(l),l=i();return u=>a.every(h=>h(u))}function c(){const a=[];let l=o();for(;l&&(a.push(l),r==="|"||r===",");){do r=s.next();while(r==="|"||r===",");l=o()}return u=>a.some(h=>h(u))}}function We(t){return!!t&&!!t.match(/[\w\.:]+/)}function en(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const s=n[0];return n=e.exec(t),s}}}function dt(t){typeof t.dispose=="function"&&t.dispose()}var D=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},tn=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},nn=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},sn=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new D(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new nn;for(const n of t)rn(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof D){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function rn(t,e,n,s){const r=n.lookup(t.scopeName);if(!r){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const i=n.lookup(e);t instanceof D?J({baseGrammar:i,selfGrammar:r},s):Re(t.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const o=n.injections(t.scopeName);if(o)for(const c of o)s.add(new D(c))}function Re(t,e,n){if(e.repository&&e.repository[t]){const s=e.repository[t];Z([s],e,n)}}function J(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&Z(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&Z(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Z(t,e,n){for(const s of t){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?it({},e.repository,s.repository):e.repository;Array.isArray(s.patterns)&&Z(s.patterns,{...e,repository:r},n);const i=s.include;if(!i)continue;const o=pt(i);switch(o.kind){case 0:J({...e,selfGrammar:e.baseGrammar},n);break;case 1:J(e,n);break;case 2:Re(o.ruleName,{...e,repository:r},n);break;case 3:case 4:const c=o.scopeName===e.selfGrammar.scopeName?e.selfGrammar:o.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(c){const a={baseGrammar:e.baseGrammar,selfGrammar:c,repository:r};o.kind===4?Re(o.ruleName,a,n):J(a,n)}else o.kind===4?n.add(new tn(o.scopeName,o.ruleName)):n.add(new D(o.scopeName));break}}}var on=class{kind=0},an=class{kind=1},cn=class{constructor(t){this.ruleName=t}kind=2},ln=class{constructor(t){this.scopeName=t}kind=3},un=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function pt(t){if(t==="$base")return new on;if(t==="$self")return new an;const e=t.indexOf("#");if(e===-1)return new ln(t);if(e===0)return new cn(t.substring(1));{const n=t.substring(0,e),s=t.substring(e+1);return new un(n,s)}}var hn=/\\(\d+)/,Fe=/\\(\d+)/g,fn=-1,gt=-2;var z=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,s){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=U.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=U.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${ot(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:U.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:U.replaceCaptures(this._contentName,t,e)}},dn=class extends z{retokenizeCapturedWithRuleId;constructor(t,e,n,s,r){super(t,e,n,s),this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,s){throw new Error("Not supported!")}},pn=class extends z{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,null),this._match=new W(s,this.id),this.captures=r,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new F,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},qe=class extends z{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,s),this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new F,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ne=class extends z{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r,i,o,c,a,l){super(t,e,n,s),this._begin=new W(r,this.id),this.beginCaptures=i,this._end=new W(o||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,this.applyEndPatternLast=a||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,s)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new F;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},ee=class extends z{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,s,r,i,o,c,a){super(t,e,n,s),this._begin=new W(r,this.id),this.beginCaptures=i,this.whileCaptures=c,this._while=new W(o,gt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=a.patterns,this.hasMissingPatterns=a.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new F;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,s){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,s)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new F,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||""),this._cachedCompiledWhilePatterns}},mt=class N{static createCaptureRule(e,n,s,r,i){return e.registerRule(o=>new dn(n,o,s,r,i))}static getCompiledRuleId(e,n,s){return e.id||n.registerRule(r=>{if(e.id=r,e.match)return new pn(e.$vscodeTextmateLocation,e.id,e.name,e.match,N._compileCaptures(e.captures,n,s));if(typeof e.begin>"u"){e.repository&&(s=it({},s,e.repository));let i=e.patterns;return typeof i>"u"&&e.include&&(i=[{include:e.include}]),new qe(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,N._compilePatterns(i,n,s))}return e.while?new ee(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,n,s),e.while,N._compileCaptures(e.whileCaptures||e.captures,n,s),N._compilePatterns(e.patterns,n,s)):new Ne(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,n,s),e.end,N._compileCaptures(e.endCaptures||e.captures,n,s),e.applyEndPatternLast,N._compilePatterns(e.patterns,n,s))}),e.id}static _compileCaptures(e,n,s){let r=[];if(e){let i=0;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const c=parseInt(o,10);c>i&&(i=c)}for(let o=0;o<=i;o++)r[o]=null;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const c=parseInt(o,10);let a=0;e[o].patterns&&(a=N.getCompiledRuleId(e[o],n,s)),r[c]=N.createCaptureRule(n,e[o].$vscodeTextmateLocation,e[o].name,e[o].contentName,a)}}return r}static _compilePatterns(e,n,s){let r=[];if(e)for(let i=0,o=e.length;i<o;i++){const c=e[i];let a=-1;if(c.include){const l=pt(c.include);switch(l.kind){case 0:case 1:a=N.getCompiledRuleId(s[c.include],n,s);break;case 2:let u=s[l.ruleName];u&&(a=N.getCompiledRuleId(u,n,s));break;case 3:case 4:const h=l.scopeName,d=l.kind===4?l.ruleName:null,f=n.getExternalGrammar(h,s);if(f)if(d){let p=f.repository[d];p&&(a=N.getCompiledRuleId(p,n,f.repository))}else a=N.getCompiledRuleId(f.repository.$self,n,f.repository);break}}else a=N.getCompiledRuleId(c,n,s);if(a!==-1){const l=n.getRule(a);let u=!1;if((l instanceof qe||l instanceof Ne||l instanceof ee)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;r.push(a)}}return{patterns:r,hasMissingPatterns:(e?e.length:0)!==r.length}}},W=class _t{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const s=e.length;let r=0,i=[],o=!1;for(let c=0;c<s;c++)if(e.charAt(c)==="\\"&&c+1<s){const l=e.charAt(c+1);l==="z"?(i.push(e.substring(r,c)),i.push("$(?!\\n)(?<!\\n)"),r=c+2):(l==="A"||l==="G")&&(o=!0),c++}this.hasAnchor=o,r===0?this.source=e:(i.push(e.substring(r,s)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=hn.test(this.source):this.hasBackReferences=!1}clone(){return new _t(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let s=n.map(r=>e.substring(r.start,r.end));return Fe.lastIndex=0,this.source.replace(Fe,(r,i)=>lt(s[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],s=[],r=[],i,o,c,a;for(i=0,o=this.source.length;i<o;i++)c=this.source.charAt(i),e[i]=c,n[i]=c,s[i]=c,r[i]=c,c==="\\"&&i+1<o&&(a=this.source.charAt(i+1),a==="A"?(e[i+1]="",n[i+1]="",s[i+1]="A",r[i+1]="A"):a==="G"?(e[i+1]="",n[i+1]="G",s[i+1]="",r[i+1]="G"):(e[i+1]=a,n[i+1]=a,s[i+1]=a,r[i+1]=a),i++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:r.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},F=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new ze(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let s=this._items.map(r=>r.resolveAnchors(e,n));return new ze(t,s,this._items.map(r=>r.ruleId))}},ze=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
1
|
+
import{fc as xe,df as rt,da as Mt,fd as jt,fe as Dt,ff as Me,de as Wt}from"./App-CTks_6Oy.js";import"./styles-BkKe8nrS.js";import"./index-BAgBrTYo.js";import"./PlacesRail-DeL2Iwjg.js";import"./monitor-LgR-tKnv.js";import"./MenuMotion-EDKcQmjm.js";const je={}.hasOwnProperty;function Ft(t,e){const n=e||{};function s(r,...i){let o=s.invalid;const c=s.handlers;if(r&&je.call(r,t)){const a=String(r[t]);o=je.call(c,a)?c[a]:s.unknown}if(o)return o.call(this,r,...i)}return s.handlers=n.handlers||{},s.invalid=n.invalid,s.unknown=n.unknown,s}var S=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function qt(t){return Le(t)}function Le(t){return Array.isArray(t)?zt(t):t instanceof RegExp?t:typeof t=="object"?Ht(t):t}function zt(t){let e=[];for(let n=0,s=t.length;n<s;n++)e[n]=Le(t[n]);return e}function Ht(t){let e={};for(let n in t)e[n]=Le(t[n]);return e}function it(t,...e){return e.forEach(n=>{for(let s in n)t[s]=n[s]}),t}function ot(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?ot(t.substring(0,t.length-1)):t.substr(~e+1)}var ge=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,U=class{static hasCaptures(t){return t===null?!1:(ge.lastIndex=0,ge.test(t))}static replaceCaptures(t,e,n){return t.replace(ge,(s,r,i,o)=>{let c=n[parseInt(r||i,10)];if(c){let a=e.substring(c.start,c.end);for(;a[0]===".";)a=a.substring(1);switch(o){case"downcase":return a.toLowerCase();case"upcase":return a.toUpperCase();default:return a}}else return s})}};function at(t,e){return t<e?-1:t>e?1:0}function ct(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,s=e.length;if(n===s){for(let r=0;r<n;r++){let i=at(t[r],e[r]);if(i!==0)return i}return 0}return n-s}function De(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function lt(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var ut=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},Q=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Vt(t),e)}static createFromParsedTheme(t,e){return Jt(t,e)}_cachedMatchRoot=new ut(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,s=this._cachedMatchRoot.get(e).find(r=>Ut(t.parent,r.parentScopes));return s?new ht(s.fontStyle,s.foreground,s.background):null}},me=class Y{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const s of n)e=new Y(e,s);return e}static from(...e){let n=null;for(let s=0;s<e.length;s++)n=new Y(n,e[s]);return n}push(e){return new Y(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let s=this;for(;s&&s!==e;)n.push(s.scopeName),s=s.parent;return s===e?n.reverse():void 0}};function Ut(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let s=e[n],r=!1;if(s===">"){if(n===e.length-1)return!1;s=e[++n],r=!0}for(;t&&!Kt(t.scopeName,s);){if(r)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Kt(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var ht=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Vt(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],s=0;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(!o.settings)continue;let c;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),c=h.split(",")}else Array.isArray(o.scope)?c=o.scope:c=[""];let a=-1;if(typeof o.settings.fontStyle=="string"){a=0;let h=o.settings.fontStyle.split(" ");for(let d=0,f=h.length;d<f;d++)switch(h[d]){case"italic":a=a|1;break;case"bold":a=a|2;break;case"underline":a=a|4;break;case"strikethrough":a=a|8;break}}let l=null;typeof o.settings.foreground=="string"&&De(o.settings.foreground)&&(l=o.settings.foreground);let u=null;typeof o.settings.background=="string"&&De(o.settings.background)&&(u=o.settings.background);for(let h=0,d=c.length;h<d;h++){let p=c[h].trim().split(" "),y=p[p.length-1],_=null;p.length>1&&(_=p.slice(0,p.length-1),_.reverse()),n[s++]=new Yt(y,_,r,a,l,u)}}return n}var Yt=class{constructor(t,e,n,s,r,i){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=s,this.foreground=r,this.background=i}},k=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(k||{});function Jt(t,e){t.sort((a,l)=>{let u=at(a.scope,l.scope);return u!==0||(u=ct(a.parentScopes,l.parentScopes),u!==0)?u:a.index-l.index});let n=0,s="#000000",r="#ffffff";for(;t.length>=1&&t[0].scope==="";){let a=t.shift();a.fontStyle!==-1&&(n=a.fontStyle),a.foreground!==null&&(s=a.foreground),a.background!==null&&(r=a.background)}let i=new Qt(e),o=new ht(n,i.getId(s),i.getId(r)),c=new Zt(new Ce(0,null,-1,0,0),[]);for(let a=0,l=t.length;a<l;a++){let u=t[a];c.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new Q(i,o,c)}var Qt=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},Xt=Object.freeze([]),Ce=class ft{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,s,r,i){this.scopeDepth=e,this.parentScopes=n||Xt,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new ft(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let s=0,r=e.length;s<r;s++)n[s]=e[s].clone();return n}acceptOverwrite(e,n,s,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),r!==0&&(this.background=r)}},Zt=class we{constructor(e,n=[],s={}){this._mainRule=e,this._children=s,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let s=0,r=0;for(;e.parentScopes[s]===">"&&s++,n.parentScopes[r]===">"&&r++,!(s>=e.parentScopes.length||r>=n.parentScopes.length);){const i=n.parentScopes[r].length-e.parentScopes[s].length;if(i!==0)return i;s++,r++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let s=e.indexOf("."),r,i;if(s===-1?(r=e,i=""):(r=e.substring(0,s),i=e.substring(s+1)),this._children.hasOwnProperty(r))return this._children[r].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(we._cmpBySpecificity),n}insert(e,n,s,r,i,o){if(n===""){this._doInsertHere(e,s,r,i,o);return}let c=n.indexOf("."),a,l;c===-1?(a=n,l=""):(a=n.substring(0,c),l=n.substring(c+1));let u;this._children.hasOwnProperty(a)?u=this._children[a]:(u=new we(this._mainRule.clone(),Ce.cloneArr(this._rulesWithParentScopes)),this._children[a]=u),u.insert(e+1,l,s,r,i,o)}_doInsertHere(e,n,s,r,i){if(n===null){this._mainRule.acceptOverwrite(e,s,r,i);return}for(let o=0,c=this._rulesWithParentScopes.length;o<c;o++){let a=this._rulesWithParentScopes[o];if(ct(a.parentScopes,n)===0){a.acceptOverwrite(e,s,r,i);return}}s===-1&&(s=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Ce(e,n,s,r,i))}},G=class v{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=v.getLanguageId(e),s=v.getTokenType(e),r=v.getFontStyle(e),i=v.getForeground(e),o=v.getBackground(e);console.log({languageId:n,tokenType:s,fontStyle:r,foreground:i,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,s,r,i,o,c){let a=v.getLanguageId(e),l=v.getTokenType(e),u=v.containsBalancedBrackets(e)?1:0,h=v.getFontStyle(e),d=v.getForeground(e),f=v.getBackground(e);return n!==0&&(a=n),s!==8&&(l=s),r!==null&&(u=r?1:0),i!==-1&&(h=i),o!==0&&(d=o),c!==0&&(f=c),(a<<0|l<<8|u<<10|h<<11|d<<15|f<<24)>>>0}};function X(t,e){const n=[],s=en(t);let r=s.next();for(;r!==null;){let a=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":a=1;break;case"L":a=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let l=o();if(n.push({matcher:l,priority:a}),r!==",")break;r=s.next()}return n;function i(){if(r==="-"){r=s.next();const a=i();return l=>!!a&&!a(l)}if(r==="("){r=s.next();const a=c();return r===")"&&(r=s.next()),a}if(We(r)){const a=[];do a.push(r),r=s.next();while(We(r));return l=>e(a,l)}return null}function o(){const a=[];let l=i();for(;l;)a.push(l),l=i();return u=>a.every(h=>h(u))}function c(){const a=[];let l=o();for(;l&&(a.push(l),r==="|"||r===",");){do r=s.next();while(r==="|"||r===",");l=o()}return u=>a.some(h=>h(u))}}function We(t){return!!t&&!!t.match(/[\w\.:]+/)}function en(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const s=n[0];return n=e.exec(t),s}}}function dt(t){typeof t.dispose=="function"&&t.dispose()}var D=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},tn=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},nn=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},sn=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new D(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new nn;for(const n of t)rn(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof D){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function rn(t,e,n,s){const r=n.lookup(t.scopeName);if(!r){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const i=n.lookup(e);t instanceof D?J({baseGrammar:i,selfGrammar:r},s):Re(t.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const o=n.injections(t.scopeName);if(o)for(const c of o)s.add(new D(c))}function Re(t,e,n){if(e.repository&&e.repository[t]){const s=e.repository[t];Z([s],e,n)}}function J(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&Z(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&Z(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Z(t,e,n){for(const s of t){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?it({},e.repository,s.repository):e.repository;Array.isArray(s.patterns)&&Z(s.patterns,{...e,repository:r},n);const i=s.include;if(!i)continue;const o=pt(i);switch(o.kind){case 0:J({...e,selfGrammar:e.baseGrammar},n);break;case 1:J(e,n);break;case 2:Re(o.ruleName,{...e,repository:r},n);break;case 3:case 4:const c=o.scopeName===e.selfGrammar.scopeName?e.selfGrammar:o.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(c){const a={baseGrammar:e.baseGrammar,selfGrammar:c,repository:r};o.kind===4?Re(o.ruleName,a,n):J(a,n)}else o.kind===4?n.add(new tn(o.scopeName,o.ruleName)):n.add(new D(o.scopeName));break}}}var on=class{kind=0},an=class{kind=1},cn=class{constructor(t){this.ruleName=t}kind=2},ln=class{constructor(t){this.scopeName=t}kind=3},un=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function pt(t){if(t==="$base")return new on;if(t==="$self")return new an;const e=t.indexOf("#");if(e===-1)return new ln(t);if(e===0)return new cn(t.substring(1));{const n=t.substring(0,e),s=t.substring(e+1);return new un(n,s)}}var hn=/\\(\d+)/,Fe=/\\(\d+)/g,fn=-1,gt=-2;var z=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,s){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=U.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=U.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${ot(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:U.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:U.replaceCaptures(this._contentName,t,e)}},dn=class extends z{retokenizeCapturedWithRuleId;constructor(t,e,n,s,r){super(t,e,n,s),this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,s){throw new Error("Not supported!")}},pn=class extends z{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,null),this._match=new W(s,this.id),this.captures=r,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new F,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},qe=class extends z{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r){super(t,e,n,s),this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new F,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ne=class extends z{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,s,r,i,o,c,a,l){super(t,e,n,s),this._begin=new W(r,this.id),this.beginCaptures=i,this._end=new W(o||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,this.applyEndPatternLast=a||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,s)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new F;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},ee=class extends z{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,s,r,i,o,c,a){super(t,e,n,s),this._begin=new W(r,this.id),this.beginCaptures=i,this.whileCaptures=c,this._while=new W(o,gt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=a.patterns,this.hasMissingPatterns=a.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,s){return this._getCachedCompiledPatterns(t).compileAG(t,n,s)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new F;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,s){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,s)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new F,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||""),this._cachedCompiledWhilePatterns}},mt=class N{static createCaptureRule(e,n,s,r,i){return e.registerRule(o=>new dn(n,o,s,r,i))}static getCompiledRuleId(e,n,s){return e.id||n.registerRule(r=>{if(e.id=r,e.match)return new pn(e.$vscodeTextmateLocation,e.id,e.name,e.match,N._compileCaptures(e.captures,n,s));if(typeof e.begin>"u"){e.repository&&(s=it({},s,e.repository));let i=e.patterns;return typeof i>"u"&&e.include&&(i=[{include:e.include}]),new qe(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,N._compilePatterns(i,n,s))}return e.while?new ee(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,n,s),e.while,N._compileCaptures(e.whileCaptures||e.captures,n,s),N._compilePatterns(e.patterns,n,s)):new Ne(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,n,s),e.end,N._compileCaptures(e.endCaptures||e.captures,n,s),e.applyEndPatternLast,N._compilePatterns(e.patterns,n,s))}),e.id}static _compileCaptures(e,n,s){let r=[];if(e){let i=0;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const c=parseInt(o,10);c>i&&(i=c)}for(let o=0;o<=i;o++)r[o]=null;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const c=parseInt(o,10);let a=0;e[o].patterns&&(a=N.getCompiledRuleId(e[o],n,s)),r[c]=N.createCaptureRule(n,e[o].$vscodeTextmateLocation,e[o].name,e[o].contentName,a)}}return r}static _compilePatterns(e,n,s){let r=[];if(e)for(let i=0,o=e.length;i<o;i++){const c=e[i];let a=-1;if(c.include){const l=pt(c.include);switch(l.kind){case 0:case 1:a=N.getCompiledRuleId(s[c.include],n,s);break;case 2:let u=s[l.ruleName];u&&(a=N.getCompiledRuleId(u,n,s));break;case 3:case 4:const h=l.scopeName,d=l.kind===4?l.ruleName:null,f=n.getExternalGrammar(h,s);if(f)if(d){let p=f.repository[d];p&&(a=N.getCompiledRuleId(p,n,f.repository))}else a=N.getCompiledRuleId(f.repository.$self,n,f.repository);break}}else a=N.getCompiledRuleId(c,n,s);if(a!==-1){const l=n.getRule(a);let u=!1;if((l instanceof qe||l instanceof Ne||l instanceof ee)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;r.push(a)}}return{patterns:r,hasMissingPatterns:(e?e.length:0)!==r.length}}},W=class _t{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const s=e.length;let r=0,i=[],o=!1;for(let c=0;c<s;c++)if(e.charAt(c)==="\\"&&c+1<s){const l=e.charAt(c+1);l==="z"?(i.push(e.substring(r,c)),i.push("$(?!\\n)(?<!\\n)"),r=c+2):(l==="A"||l==="G")&&(o=!0),c++}this.hasAnchor=o,r===0?this.source=e:(i.push(e.substring(r,s)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=hn.test(this.source):this.hasBackReferences=!1}clone(){return new _t(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let s=n.map(r=>e.substring(r.start,r.end));return Fe.lastIndex=0,this.source.replace(Fe,(r,i)=>lt(s[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],s=[],r=[],i,o,c,a;for(i=0,o=this.source.length;i<o;i++)c=this.source.charAt(i),e[i]=c,n[i]=c,s[i]=c,r[i]=c,c==="\\"&&i+1<o&&(a=this.source.charAt(i+1),a==="A"?(e[i+1]="",n[i+1]="",s[i+1]="A",r[i+1]="A"):a==="G"?(e[i+1]="",n[i+1]="G",s[i+1]="",r[i+1]="G"):(e[i+1]=a,n[i+1]=a,s[i+1]=a,r[i+1]=a),i++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:r.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},F=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new ze(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let s=this._items.map(r=>r.resolveAnchors(e,n));return new ze(t,s,this._items.map(r=>r.ruleId))}},ze=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
2
2
|
`)}findNextMatchSync(t,e,n){const s=this.scanner.findNextMatchSync(t,e,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},_e=class{constructor(t,e){this.languageId=t,this.tokenType=e}},gn=class ke{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new _e(e,8),this._embeddedLanguagesMatcher=new mn(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?ke._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new _e(0,0);_getBasicScopeAttributes=new ut(e=>{const n=this._scopeToLanguage(e),s=this._toStandardTokenType(e);return new _e(n,s)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(ke.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},mn=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,s])=>lt(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},He=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function yt(t,e,n,s,r,i,o,c){const a=e.content.length;let l=!1,u=-1;if(o){const f=_n(t,e,n,s,r,i);r=f.stack,s=f.linePos,n=f.isFirstLine,u=f.anchorPosition}const h=Date.now();for(;!l;){if(c!==0&&Date.now()-h>c)return new He(r,!0);d()}return new He(r,!1);function d(){const f=yn(t,e,n,s,r,u);if(!f){i.produce(r,a),l=!0;return}const p=f.captureIndices,y=f.matchedRuleId,_=p&&p.length>0?p[0].end>s:!1;if(y===fn){const m=r.getRule(t);i.produce(r,p[0].start),r=r.withContentNameScopesList(r.nameScopesList),M(t,e,n,r,i,m.endCaptures,p),i.produce(r,p[0].end);const g=r;if(r=r.parent,u=g.getAnchorPos(),!_&&g.getEnterPos()===s){r=g,i.produce(r,a),l=!0;return}}else{const m=t.getRule(y);i.produce(r,p[0].start);const g=r,b=m.getName(e.content,p),C=r.contentNameScopesList.pushAttributed(b,t);if(r=r.push(y,s,u,p[0].end===a,null,C,C),m instanceof Ne){const R=m;M(t,e,n,r,i,R.beginCaptures,p),i.produce(r,p[0].end),u=p[0].end;const A=R.getContentName(e.content,p),E=C.pushAttributed(A,t);if(r=r.withContentNameScopesList(E),R.endHasBackReferences&&(r=r.withEndRule(R.getEndWithResolvedBackReferences(e.content,p))),!_&&g.hasSameRuleAs(r)){r=r.pop(),i.produce(r,a),l=!0;return}}else if(m instanceof ee){const R=m;M(t,e,n,r,i,R.beginCaptures,p),i.produce(r,p[0].end),u=p[0].end;const A=R.getContentName(e.content,p),E=C.pushAttributed(A,t);if(r=r.withContentNameScopesList(E),R.whileHasBackReferences&&(r=r.withEndRule(R.getWhileWithResolvedBackReferences(e.content,p))),!_&&g.hasSameRuleAs(r)){r=r.pop(),i.produce(r,a),l=!0;return}}else if(M(t,e,n,r,i,m.captures,p),i.produce(r,p[0].end),r=r.pop(),!_){r=r.safePop(),i.produce(r,a),l=!0;return}}p[0].end>s&&(s=p[0].end,n=!1)}}function _n(t,e,n,s,r,i){let o=r.beginRuleCapturedEOL?0:-1;const c=[];for(let a=r;a;a=a.pop()){const l=a.getRule(t);l instanceof ee&&c.push({rule:l,stack:a})}for(let a=c.pop();a;a=c.pop()){const{ruleScanner:l,findOptions:u}=Cn(a.rule,t,a.stack.endRule,n,s===o),h=l.findNextMatchSync(e,s,u);if(h){if(h.ruleId!==gt){r=a.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(a.stack,h.captureIndices[0].start),M(t,e,n,a.stack,i,a.rule.whileCaptures,h.captureIndices),i.produce(a.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>s&&(s=h.captureIndices[0].end,n=!1))}else{r=a.stack.pop();break}}return{stack:r,linePos:s,anchorPosition:o,isFirstLine:n}}function yn(t,e,n,s,r,i){const o=bn(t,e,n,s,r,i),c=t.getInjections();if(c.length===0)return o;const a=Sn(c,t,e,n,s,r,i);if(!a)return o;if(!o)return a;const l=o.captureIndices[0].start,u=a.captureIndices[0].start;return u<l||a.priorityMatch&&u===l?a:o}function bn(t,e,n,s,r,i){const o=r.getRule(t),{ruleScanner:c,findOptions:a}=bt(o,t,r.endRule,n,s===i),l=c.findNextMatchSync(e,s,a);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function Sn(t,e,n,s,r,i,o){let c=Number.MAX_VALUE,a=null,l,u=0;const h=i.contentNameScopesList.getScopeNames();for(let d=0,f=t.length;d<f;d++){const p=t[d];if(!p.matcher(h))continue;const y=e.getRule(p.ruleId),{ruleScanner:_,findOptions:m}=bt(y,e,null,s,r===o),g=_.findNextMatchSync(n,r,m);if(!g)continue;const b=g.captureIndices[0].start;if(!(b>=c)&&(c=b,a=g.captureIndices,l=g.ruleId,u=p.priority,c===r))break}return a?{priorityMatch:u===-1,captureIndices:a,matchedRuleId:l}:null}function bt(t,e,n,s,r){return{ruleScanner:t.compileAG(e,n,s,r),findOptions:0}}function Cn(t,e,n,s,r){return{ruleScanner:t.compileWhileAG(e,n,s,r),findOptions:0}}function M(t,e,n,s,r,i,o){if(i.length===0)return;const c=e.content,a=Math.min(i.length,o.length),l=[],u=o[0].end;for(let h=0;h<a;h++){const d=i[h];if(d===null)continue;const f=o[h];if(f.length===0)continue;if(f.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=f.start;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?r.produceFromScopes(l[l.length-1].scopes,f.start):r.produce(s,f.start),d.retokenizeCapturedWithRuleId){const y=d.getName(c,o),_=s.contentNameScopesList.pushAttributed(y,t),m=d.getContentName(c,o),g=_.pushAttributed(m,t),b=s.push(d.retokenizeCapturedWithRuleId,f.start,-1,!1,null,_,g),C=t.createOnigString(c.substring(0,f.end));yt(t,C,n&&f.start===0,f.start,b,r,!1,0),dt(C);continue}const p=d.getName(c,o);if(p!==null){const _=(l.length>0?l[l.length-1].scopes:s.contentNameScopesList).pushAttributed(p,t);l.push(new wn(_,f.end))}}for(;l.length>0;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var wn=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function Rn(t,e,n,s,r,i,o,c){return new kn(t,e,n,s,r,i,o,c)}function Ue(t,e,n,s,r){const i=X(e,te),o=mt.getCompiledRuleId(n,s,r.repository);for(const c of i)t.push({debugSelector:e,matcher:c.matcher,ruleId:o,grammar:r,priority:c.priority})}function te(t,e){if(e.length<t.length)return!1;let n=0;return t.every(s=>{for(let r=n;r<e.length;r++)if(Nn(e[r],s))return n=r+1,!0;return!1})}function Nn(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var kn=class{constructor(t,e,n,s,r,i,o,c){if(this._rootScopeName=t,this.balancedBracketSelectors=i,this._onigLib=c,this._basicScopeAttributesProvider=new gn(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Ke(e,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const a of Object.keys(r)){const l=X(a,te);for(const u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:r[a]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t={lookup:r=>r===this._rootScopeName?this._grammar:this.getExternalGrammar(r),injections:r=>this._grammarRepository.injections(r)},e=[],n=this._rootScopeName,s=t.lookup(n);if(s){const r=s.injections;if(r)for(let o in r)Ue(e,o,r[o],this,s);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const c=this.getExternalGrammar(o);if(c){const a=c.injectionSelector;a&&Ue(e,a,c,this,c)}})}return e.sort((r,i)=>r.priority-i.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=Ke(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const s=this._tokenize(t,e,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(t,e,n=0){const s=this._tokenize(t,e,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(t,e,n,s){this._rootId===-1&&(this._rootId=mt.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let r;if(!e||e===Ae.NULL){r=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=G.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),d=this.getRule(this._rootId).getName(null,null);let f;d?f=j.createRootAndLookUpScopeName(d,h,this):f=j.createRoot("unknown",h),e=new Ae(null,this._rootId,-1,-1,!1,null,f,f)}else r=!1,e.reset();t=t+`
|
|
3
3
|
`;const i=this.createOnigString(t),o=i.content.length,c=new vn(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),a=yt(this,i,r,0,e,c,!0,s);return dt(i),{lineLength:o,lineTokens:c,ruleStack:a.stack,stoppedEarly:a.stoppedEarly}}};function Ke(t,e){return t=qt(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var j=class I{constructor(e,n,s){this.parent=e,this.scopePath=n,this.tokenAttributes=s}static fromExtension(e,n){let s=e,r=e?.scopePath??null;for(const i of n)r=me.push(r,i.scopeNames),s=new I(s,r,i.encodedTokenAttributes);return s}static createRoot(e,n){return new I(null,new me(null,e),n)}static createRootAndLookUpScopeName(e,n,s){const r=s.getMetadataForScope(e),i=new me(null,e),o=s.themeProvider.themeMatch(i),c=I.mergeAttributes(n,r,o);return new I(null,i,c)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return I.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,s){let r=-1,i=0,o=0;return s!==null&&(r=s.fontStyle,i=s.foregroundId,o=s.backgroundId),G.set(e,n.languageId,n.tokenType,null,r,i,o)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return I._pushAttributed(this,e,n);const s=e.split(/ /g);let r=this;for(const i of s)r=I._pushAttributed(r,i,n);return r}static _pushAttributed(e,n,s){const r=s.getMetadataForScope(n),i=e.scopePath.push(n),o=s.themeProvider.themeMatch(i),c=I.mergeAttributes(e.tokenAttributes,r,o);return new I(e,i,c)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let s=this;for(;s&&s!==e;)n.push({encodedTokenAttributes:s.tokenAttributes,scopeNames:s.scopePath.getExtensionIfDefined(s.parent?.scopePath??null)}),s=s.parent;return s===e?n.reverse():void 0}},Ae=class L{constructor(e,n,s,r,i,o,c,a){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=c,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=s,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new L(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:L._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?j.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){L._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,s,r,i,o,c){return new L(this,e,n,s,r,i,o,c)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new L(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){const s=j.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new L(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,j.fromExtension(s,n.contentNameScopesList))}},An=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):X(n,te).map(s=>s.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>X(n,te).map(s=>s.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},vn=class{constructor(t,e,n,s){this.balancedBracketSelectors=s,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let s=t?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const i=t?.getScopeNames()??[];for(const o of this._tokenTypeOverrides)o.matcher(i)&&(s=G.set(s,0,o.type,null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(i))}if(r&&(s=G.set(s,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===s){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(s),this._lastTokenEndIndex=e;return}const n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let s=0,r=this._binaryTokens.length;s<r;s++)n[s]=this._binaryTokens[s];return n}},In=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,s,r){if(!this._grammars.has(t)){let i=this._rawGrammars.get(t);if(!i)return null;this._grammars.set(t,Rn(t,i,e,n,s,r,this,this._onigLib))}return this._grammars.get(t)}},Tn=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new In(Q.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(Q.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,s){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:s})}loadGrammarWithConfiguration(e,n,s){return this._loadGrammar(e,n,s.embeddedLanguages,s.tokenTypes,new An(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,s,r,i){const o=new sn(this._syncRegistry,e);for(;o.Q.length>0;)o.Q.map(c=>this._loadSingleGrammar(c.scopeName)),o.processQueue();return this._grammarForScopeName(e,n,s,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const s=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,s)}}addGrammar(e,n=[],s=0,r=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,s,r)}_grammarForScopeName(e,n=0,s=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,n,s,r,i)}},ve=Ae.NULL;function ne(t,e){const n=typeof t=="string"?{}:{...t.colorReplacements},s=typeof t=="string"?t:t.name;for(const[r,i]of Object.entries(e?.colorReplacements||{}))typeof i=="string"?n[r]=i:r===s&&Object.assign(n,i);return n}function x(t,e){return t&&(e?.[t?.toLowerCase()]||t)}function En(t){return Array.isArray(t)?t:[t]}async function St(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function ae(t){return!t||["plaintext","txt","text","plain"].includes(t)}function xn(t){return t==="ansi"||ae(t)}function ce(t){return t==="none"}function Ln(t){return ce(t)}const Pn=/(\r?\n)/g;function le(t,e=!1){if(t.length===0)return[["",0]];const n=t.split(Pn);let s=0;const r=[];for(let i=0;i<n.length;i+=2){const o=e?n[i]+(n[i+1]||""):n[i];r.push([o,s]),s+=n[i].length,s+=n[i+1]?.length||0}return r}const Ve={light:"#333333",dark:"#bbbbbb"},Ye={light:"#fffffe",dark:"#1e1e1e"},Je="__shiki_resolved";function Pe(t){if(t?.[Je])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:s}=e;if(!n||!s){const c=e.settings?e.settings.find(a=>!a.name&&!a.scope):void 0;c?.settings?.foreground&&(s=c.settings.foreground),c?.settings?.background&&(n=c.settings.background),!s&&e?.colors?.["editor.foreground"]&&(s=e.colors["editor.foreground"]),!n&&e?.colors?.["editor.background"]&&(n=e.colors["editor.background"]),s||(s=e.type==="light"?Ve.light:Ve.dark),n||(n=e.type==="light"?Ye.light:Ye.dark),e.fg=s,e.bg=n}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let r=0;const i=new Map;function o(c){if(i.has(c))return i.get(c);r+=1;const a=`#${r.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${a}`]?o(c):(i.set(c,a),a)}e.settings=e.settings.map(c=>{const a=c.settings?.foreground&&!c.settings.foreground.startsWith("#"),l=c.settings?.background&&!c.settings.background.startsWith("#");if(!a&&!l)return c;const u={...c,settings:{...c.settings}};if(a){const h=o(c.settings.foreground);e.colorReplacements[h]=c.settings.foreground,u.settings.foreground=h}if(l){const h=o(c.settings.background);e.colorReplacements[h]=c.settings.background,u.settings.background=h}return u});for(const c of Object.keys(e.colors||{}))if((c==="editor.foreground"||c==="editor.background"||c.startsWith("terminal.ansi"))&&!e.colors[c]?.startsWith("#")){const a=o(e.colors[c]);e.colorReplacements[a]=e.colors[c],e.colors[c]=a}return Object.defineProperty(e,Je,{enumerable:!1,writable:!1,value:!0}),e}async function Ct(t){return[...new Set((await Promise.all(t.filter(e=>!xn(e)).map(async e=>await St(e).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function wt(t){return(await Promise.all(t.map(async e=>Ln(e)?null:Pe(await St(e))))).filter(e=>!!e)}function Rt(t,e){if(!e)return t;if(e[t]){const n=new Set([t]);for(;e[t];){if(t=e[t],n.has(t))throw new S(`Circular alias \`${[...n].join(" -> ")} -> ${t}\``);n.add(t)}}return t}var Gn=class extends Tn{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(t,e,n,s={}){super(t),this._resolver=t,this._themes=e,this._langs=n,this._alias=s,this._themes.map(r=>this.loadTheme(r)),this.loadLanguages(this._langs)}getTheme(t){return typeof t=="string"?this._resolvedThemes.get(t):this.loadTheme(t)}loadTheme(t){const e=Pe(t);return e.name&&(this._resolvedThemes.set(e.name,e),this._loadedThemesCache=null),e}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(t){let e=this._textmateThemeCache.get(t);e||(e=Q.createFromRawTheme(t),this._textmateThemeCache.set(t,e)),this._syncRegistry.setTheme(e)}getGrammar(t){return t=Rt(t,this._alias),this._resolvedGrammars.get(t)}loadLanguage(t){if(this.getGrammar(t.name))return;const e=new Set([...this._langMap.values()].filter(r=>r.embeddedLangsLazy?.includes(t.name)));this._resolver.addLanguage(t);const n={balancedBracketSelectors:t.balancedBracketSelectors||["*"],unbalancedBracketSelectors:t.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(t.scopeName,t);const s=this.loadGrammarWithConfiguration(t.scopeName,1,n);if(s.name=t.name,this._resolvedGrammars.set(t.name,s),t.aliases&&t.aliases.forEach(r=>{this._alias[r]=t.name}),this._loadedLanguagesCache=null,e.size)for(const r of e)this._resolvedGrammars.delete(r.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(r.scopeName),this._syncRegistry?._grammars?.delete(r.scopeName),this.loadLanguage(this._langMap.get(r.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(t){for(const s of t)this.resolveEmbeddedLanguages(s);const e=[...this._langGraph.entries()],n=e.filter(([s,r])=>!r);if(n.length){const s=e.filter(([r,i])=>i?(i.embeddedLanguages||i.embeddedLangs)?.some(o=>n.map(([c])=>c).includes(o)):!1).filter(r=>!n.includes(r));throw new S(`Missing languages ${n.map(([r])=>`\`${r}\``).join(", ")}, required by ${s.map(([r])=>`\`${r}\``).join(", ")}`)}for(const[s,r]of e)this._resolver.addLanguage(r);for(const[s,r]of e)this.loadLanguage(r)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(t){this._langMap.set(t.name,t),this._langGraph.set(t.name,t);const e=t.embeddedLanguages??t.embeddedLangs;if(e)for(const n of e)this._langGraph.set(n,this._langMap.get(n))}},On=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(t,e){this._onigLib={createOnigScanner:n=>t.createScanner(n),createOnigString:n=>t.createString(n)},e.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(e=>{this._langs.set(e,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(e=>{this._injections.get(e)||this._injections.set(e,[]),this._injections.get(e).push(t.scopeName)})}getInjections(t){const e=t.split(".");let n=[];for(let s=1;s<=e.length;s++){const r=e.slice(0,s).join(".");n=[...n,...this._injections.get(r)||[]]}return n}};let B=0;function $n(t){B+=1,t.warnings!==!1&&B>=10&&B%10===0&&console.warn(`[Shiki] ${B} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!t.engine)throw new S("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),s=(t.themes||[]).flat(1).map(Pe),r=new Gn(new On(t.engine,n),s,n,t.langAlias);let i;function o(g){return Rt(g,t.langAlias)}function c(g){_();const b=r.getGrammar(typeof g=="string"?g:g.name);if(!b)throw new S(`Language \`${g}\` not found, you may need to load it first`);return b}function a(g){if(g==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};_();const b=r.getTheme(g);if(!b)throw new S(`Theme \`${g}\` not found, you may need to load it first`);return b}function l(g){_();const b=a(g);return i!==g&&(r.setTheme(b),i=g),{theme:b,colorMap:r.getColorMap()}}function u(){return _(),r.getLoadedThemes()}function h(){return _(),r.getLoadedLanguages()}function d(...g){_(),r.loadLanguages(g.flat(1))}async function f(...g){return d(await Ct(g))}function p(...g){_();for(const b of g.flat(1))r.loadTheme(b)}async function y(...g){return _(),p(await wt(g))}function _(){if(e)throw new S("Shiki instance has been disposed")}function m(){e||(e=!0,r.dispose(),B-=1)}return{setTheme:l,getTheme:a,getLanguage:c,getLoadedThemes:u,getLoadedLanguages:h,resolveLangAlias:o,loadLanguage:f,loadLanguageSync:d,loadTheme:y,loadThemeSync:p,dispose:m,[Symbol.dispose]:m}}async function Bn(t){t.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,n,s]=await Promise.all([wt(t.themes||[]),Ct(t.langs||[]),t.engine]);return $n({...t,themes:e,langs:n,engine:s})}const Nt=new WeakMap;function ue(t,e){Nt.set(t,e)}function q(t){return Nt.get(t)}var he=class kt{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,n){return new kt(Object.fromEntries(En(n).map(s=>[s,ve])),e)}constructor(...e){if(e.length===2){const[n,s]=e;this.lang=s,this._stacks=n}else{const[n,s,r]=e;this.lang=s,this._stacks={[r]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Mn(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Mn(t){const e=[],n=new Set;function s(r){if(n.has(r))return;n.add(r);const i=r?.nameScopesList?.scopeName;i&&e.push(i),r.parent&&s(r.parent)}return s(t),e}function jn(t,e){if(!(t instanceof he))throw new S("Invalid grammar state");return t.getInternalStack(e)}const Dn=/,/,Wn=/ /;function At(t,e,n={}){const{theme:s=t.getLoadedThemes()[0]}=n;if(ae(t.resolveLangAlias(n.lang||"text"))||ce(s))return le(e).map(c=>[{content:c[0],offset:c[1]}]);const{theme:r,colorMap:i}=t.setTheme(s),o=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==o.name)throw new S(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(r.name))throw new S(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${r.name}"`)}return qn(e,o,r,i,n)}function Fn(...t){if(t.length===2)return q(t[1]);const[e,n,s={}]=t,{lang:r="text",theme:i=e.getLoadedThemes()[0]}=s;if(ae(r)||ce(i))throw new S("Plain language does not have grammar state");if(r==="ansi")throw new S("ANSI language does not have grammar state");const{theme:o,colorMap:c}=e.setTheme(i),a=e.getLanguage(r);return new he(Ge(n,a,o,c,s).stateStack,a.name,o.name)}function qn(t,e,n,s,r){const i=Ge(t,e,n,s,r),o=new he(i.stateStack,e.name,n.name);return ue(i.tokens,o),i.tokens}function Ge(t,e,n,s,r){const i=ne(n,r),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:c=500,includeExplanation:a=!1}=r,l=le(t);let u=r.grammarState?jn(r.grammarState,n.name)??ve:r.grammarContextCode!=null?Ge(r.grammarContextCode,e,n,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:ve,h=[];const d=[];for(let f=0,p=l.length;f<p;f++){const[y,_]=l[f];if(y===""){h=[],d.push([]);continue}if(o>0&&y.length>=o){h=[],d.push([{content:y,offset:_,color:"",fontStyle:0}]);continue}let m,g,b;a&&a!=="tokenType"&&(m=e.tokenizeLine(y,u,c),g=m.tokens,b=0);const C=e.tokenizeLine2(y,u,c),R=C.tokens.length/2;for(let A=0;A<R;A++){const E=C.tokens[2*A],fe=A+1<R?C.tokens[2*A+2]:y.length;if(E===fe)continue;const de=C.tokens[2*A+1],$t=x(s[G.getForeground(de)],i),Bt=G.getFontStyle(de),H={content:y.substring(E,fe),offset:_+E,color:$t,fontStyle:Bt};if(a==="tokenType")H.type=G.getTokenType(de);else if(a){const $e=[];if(a!=="scopeName")for(const T of n.settings){let O;switch(typeof T.scope){case"string":O=T.scope.split(Dn).map(pe=>pe.trim());break;case"object":O=T.scope;break;default:continue}$e.push({settings:T,selectors:O.map(pe=>pe.split(Wn))})}H.explanation=[];let Be=0;for(;E+Be<fe;){const T=g[b],O=y.substring(T.startIndex,T.endIndex);Be+=O.length,H.explanation.push({content:O,scopes:a==="scopeName"?zn(T.scopes):Hn($e,T.scopes)}),b+=1}}h.push(H)}d.push(h),h=[],u=C.ruleStack}return{tokens:d,stateStack:u}}function zn(t){return t.map(e=>({scopeName:e}))}function Hn(t,e){const n=[];for(let s=0,r=e.length;s<r;s++){const i=e[s];n[s]={scopeName:i,themeMatches:Kn(t,i,e.slice(0,s))}}return n}function Qe(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function Un(t,e,n){if(!Qe(t.at(-1),e))return!1;let s=t.length-2,r=n.length-1;for(;s>=0&&r>=0;)Qe(t[s],n[r])&&(s-=1),r-=1;return s===-1}function Kn(t,e,n){const s=[];for(const{selectors:r,settings:i}of t)for(const o of r)if(Un(o,e,n)){s.push(i);break}return s}function vt(t,e,n,s=At){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),i=r.map(l=>{const u=s(t,e,{...n,theme:l.theme});return{tokens:u,state:q(u),theme:typeof l.theme=="string"?l.theme:l.theme.name}}),o=Vn(...i.map(l=>l.tokens)),c=o[0].map((l,u)=>l.map((h,d)=>{const f={content:h.content,variants:{},offset:h.offset};return"includeExplanation"in n&&n.includeExplanation&&(f.explanation=h.explanation),o.forEach((p,y)=>{const{content:_,explanation:m,offset:g,...b}=p[u][d];f.variants[r[y].color]=b}),f})),a=i[0].state?new he(Object.fromEntries(i.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),i[0].state.lang):void 0;return a&&ue(c,a),c}function Vn(...t){const e=t.map(()=>[]),n=t.length;for(let s=0;s<t[0].length;s++){const r=t.map(a=>a[s]),i=e.map(()=>[]);e.forEach((a,l)=>a.push(i[l]));const o=r.map(()=>0),c=r.map(a=>a[0]);for(;c.every(a=>a);){const a=Math.min(...c.map(l=>l.content.length));for(let l=0;l<n;l++){const u=c[l];u.content.length===a?(i[l].push(u),o[l]+=1,c[l]=r[l][o[l]]):(i[l].push({...u,content:u.content.slice(0,a)}),c[l]={...u,content:u.content.slice(a),offset:u.offset+a})}}}return e}const Yn=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Jn=/["&'<>`]/g,Qn=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Xn=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Zn=/[|\\{}()[\]^$+*?.]/g,Xe=new WeakMap;function es(t,e){if(t=t.replace(e.subset?ts(e.subset):Jn,s),e.subset||e.escapeOnly)return t;return t.replace(Qn,n).replace(Xn,s);function n(r,i,o){return e.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),e)}function s(r,i,o){return e.format(r.charCodeAt(0),o.charCodeAt(i+1),e)}}function ts(t){let e=Xe.get(t);return e||(e=ns(t),Xe.set(t,e)),e}function ns(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Zn,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const ss=/[\dA-Fa-f]/;function rs(t,e,n){const s="&#x"+t.toString(16).toUpperCase();return n&&e&&!ss.test(String.fromCharCode(e))?s:s+";"}const is=/\d/;function os(t,e,n){const s="&#"+String(t);return n&&e&&!is.test(String.fromCharCode(e))?s:s+";"}const as=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],ye={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},cs=["cent","copy","divide","gt","lt","not","para","times"],It={}.hasOwnProperty,Ie={};let K;for(K in ye)It.call(ye,K)&&(Ie[ye[K]]=K);const ls=/[^\dA-Za-z]/;function us(t,e,n,s){const r=String.fromCharCode(t);if(It.call(Ie,r)){const i=Ie[r],o="&"+i;return n&&as.includes(i)&&!cs.includes(i)&&(!s||e&&e!==61&&ls.test(String.fromCharCode(e)))?o:o+";"}return""}function hs(t,e,n){let s=rs(t,e,n.omitOptionalSemicolons),r;if((n.useNamedReferences||n.useShortestReferences)&&(r=us(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const i=os(t,e,n.omitOptionalSemicolons);i.length<s.length&&(s=i)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function $(t,e){return es(t,Object.assign({format:hs},e))}const fs=/^>|^->|<!--|-->|--!>|<!-$/g,ds=[">"],ps=["<",">"];function gs(t,e,n,s){return s.settings.bogusComments?"<?"+$(t.value,Object.assign({},s.settings.characterReferences,{subset:ds}))+">":"<!--"+t.value.replace(fs,r)+"-->";function r(i){return $(i,Object.assign({},s.settings.characterReferences,{subset:ps}))}}function ms(t,e,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}const w=Et(1),Tt=Et(-1),_s=[];function Et(t){return e;function e(n,s,r){const i=n?n.children:_s;let o=(s||0)+t,c=i[o];if(!r)for(;c&&xe(c);)o+=t,c=i[o];return c}}const ys={}.hasOwnProperty;function xt(t){return e;function e(n,s,r){return ys.call(t,n.tagName)&&t[n.tagName](n,s,r)}}const Oe=xt({body:Ss,caption:be,colgroup:be,dd:Ns,dt:Rs,head:be,html:bs,li:ws,optgroup:ks,option:As,p:Cs,rp:Ze,rt:Ze,tbody:Is,td:et,tfoot:Ts,th:et,thead:vs,tr:Es});function be(t,e,n){const s=w(n,e,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&xe(s.value.charAt(0)))}function bs(t,e,n){const s=w(n,e);return!s||s.type!=="comment"}function Ss(t,e,n){const s=w(n,e);return!s||s.type!=="comment"}function Cs(t,e,n){const s=w(n,e);return s?s.type==="element"&&(s.tagName==="address"||s.tagName==="article"||s.tagName==="aside"||s.tagName==="blockquote"||s.tagName==="details"||s.tagName==="div"||s.tagName==="dl"||s.tagName==="fieldset"||s.tagName==="figcaption"||s.tagName==="figure"||s.tagName==="footer"||s.tagName==="form"||s.tagName==="h1"||s.tagName==="h2"||s.tagName==="h3"||s.tagName==="h4"||s.tagName==="h5"||s.tagName==="h6"||s.tagName==="header"||s.tagName==="hgroup"||s.tagName==="hr"||s.tagName==="main"||s.tagName==="menu"||s.tagName==="nav"||s.tagName==="ol"||s.tagName==="p"||s.tagName==="pre"||s.tagName==="section"||s.tagName==="table"||s.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function ws(t,e,n){const s=w(n,e);return!s||s.type==="element"&&s.tagName==="li"}function Rs(t,e,n){const s=w(n,e);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function Ns(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function Ze(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function ks(t,e,n){const s=w(n,e);return!s||s.type==="element"&&s.tagName==="optgroup"}function As(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function vs(t,e,n){const s=w(n,e);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function Is(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function Ts(t,e,n){return!w(n,e)}function Es(t,e,n){const s=w(n,e);return!s||s.type==="element"&&s.tagName==="tr"}function et(t,e,n){const s=w(n,e);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const xs=xt({body:Gs,colgroup:Os,head:Ps,html:Ls,tbody:$s});function Ls(t){const e=w(t,-1);return!e||e.type!=="comment"}function Ps(t){const e=new Set;for(const s of t.children)if(s.type==="element"&&(s.tagName==="base"||s.tagName==="title")){if(e.has(s.tagName))return!1;e.add(s.tagName)}const n=t.children[0];return!n||n.type==="element"}function Gs(t){const e=w(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&xe(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Os(t,e,n){const s=Tt(n,e),r=w(t,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&Oe(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function $s(t,e,n){const s=Tt(n,e),r=w(t,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&Oe(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const V={name:[[`
|
|
4
4
|
\f\r &/=>`.split(""),`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as a}from"./App-
|
|
1
|
+
import{n as a}from"./App-CTks_6Oy.js";async function f(s,e){const t=await a("/api/teams/import?mode=add",{method:"POST",body:JSON.stringify(s)});for(const o of t.bots)e({type:"botAdded",bot:o});for(const o of t.groups??[])e({type:"groupPatched",group:o});for(const o of t.routines??[])e({type:"routinePatched",routine:o});const r=t.bots.find(o=>!o.hidden);return r&&e({type:"select",id:r.id}),{...t,...r?{first:r}:{}}}function c(s,e,t=100){const r=s.trim().slice(0,t);let o=r;for(let n=2;e.has(o.toLowerCase());n++){const i=` ${n}`;o=`${r.slice(0,t-i.length).trimEnd()}${i}`}return e.add(o.toLowerCase()),o}export{f as a,c as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/App-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/App-CTks_6Oy.js","assets/styles-BkKe8nrS.js","assets/styles-CDO5XxMJ.css","assets/PlacesRail-DeL2Iwjg.js","assets/monitor-LgR-tKnv.js","assets/MenuMotion-EDKcQmjm.js","assets/DesktopViewer-ibFgMuIw.js","assets/desktop-connection-Dfaq6k5a.js","assets/desktop-viewer-CF-OpSo0.js","assets/minimize-B3xe7UnS.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{t as s,ar as St,s as I,as as jt,h as qe,o as be,at as Je,N as Nt,I as Et,r as u,au as Ct,y as ge,av as Ie,w as Te,aw as _e,ax as Pt,ay as It,j as r,S as Ze,X as Tt,a as $,az as _t,aA as At,l as K,L as Ot,a8 as ae,R as se,ae as Ae,p as H,aB as Lt,b as Rt,x as $t,z as Ht,A as Mt,B as Dt,aC as zt,aD as Bt,E as Ft,D as Ut,F as Wt,P as Kt,_ as Qe}from"./styles-BkKe8nrS.js";function xo(e,t){if(!t)return;if(t.kind!=="session")return t.kind==="loopback"?e:void 0;if(t.team||t.scopes.includes("admin"))return e;const n=t.email;if(n?.trim())return e?.email?.trim().toLowerCase()===n.trim().toLowerCase()?e:{email:n}}const et="omb.team-sign-in";function Vt(e){try{e&&globalThis.localStorage?.setItem(et,e)}catch{}}function Xt(){try{return globalThis.localStorage?.getItem(et)??null}catch{return null}}async function ne(e=fetch){let t;try{t=await e("/api/auth/session",{credentials:"same-origin"})}catch(a){return{kind:"unreachable",error:a instanceof Error?a.message:String(a)}}const n=await t.json().catch(()=>({})),o=Object(n);return t.status===401||t.status===403?{kind:"unauthenticated",error:typeof o.error=="string"?o.error:`${t.status}`}:t.ok?o.kind==="session"&&typeof o.id=="string"?{kind:"session",id:o.id,label:typeof o.label=="string"?o.label:"",...typeof o.email=="string"?{email:o.email}:{},scopes:Array.isArray(o.scopes)?o.scopes.filter(a=>typeof a=="string"):[],expiresAt:typeof o.expiresAt=="number"?o.expiresAt:0,...typeof o.reactor=="string"?{reactor:o.reactor}:{},...typeof o.teamSignIn=="string"?{teamSignIn:o.teamSignIn}:{},...Oe(o.team)?{team:Oe(o.team),openedThreads:Array.isArray(o.openedThreads)?o.openedThreads.filter(a=>typeof a=="string"):[]}:{},...o.cloudGuest===!0?{cloudGuest:!0,openedThreads:Array.isArray(o.openedThreads)?o.openedThreads.filter(a=>typeof a=="string"):[]}:{}}:o.trust==="service"?{kind:"loopback",trust:"service"}:{kind:"loopback"}:{kind:"unreachable",error:`${t.status} ${t.statusText}`}}function Oe(e){const t=Object(e);return typeof t.id=="string"&&typeof t.name=="string"&&typeof t.role=="string"?{id:t.id,name:t.name,role:t.role}:null}function Gt(e){return e?.kind==="session"||e?.kind==="loopback"&&e.trust!=="service"}function tt(e){return e?e.kind==="loopback"?e.trust!=="service":e.kind==="session"&&e.scopes.includes("admin"):!1}function Yt(){const e=/[#&]code=([^&]+)/.exec(location.hash);return e?(history.replaceState(null,"",location.pathname+location.search),decodeURIComponent(e[1])):null}function qt(){if(!/[#&]signin=/.test(location.hash))return null;const e=/[#&]signin=(omb_pair_[A-Za-z0-9_-]{43})(?:&|$)/.exec(location.hash);return history.replaceState(null,"",location.pathname+location.search),e?e[1]:null}function Jt(){const e=new URLSearchParams(location.search),t=e.get("email")?.trim().toLowerCase()??"";if(!t)return null;e.delete("email");const n=e.toString();return history.replaceState(null,"",location.pathname+(n?`?${n}`:"")+location.hash),/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(t)?t:null}function nt(e=navigator.userAgent){const t=/Edg\//.test(e)?"Edge":/OPR\//.test(e)?"Opera":/Chrome\//.test(e)?"Chrome":/Firefox\//.test(e)?"Firefox":/Safari\//.test(e)?"Safari":"Browser",n=/iPhone/.test(e)?"iPhone":/iPad/.test(e)?"iPad":/Android/.test(e)?"Android":/Mac OS X/.test(e)?"Mac":/Windows/.test(e)?"Windows":/Linux/.test(e)?"Linux":"";return n?`${t} on ${n}`:t}function Z(){return typeof crypto?.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,14)}`}function ot(e,t){const n=Reflect.get(Object(e),"error");return St(e,typeof n=="string"?n:`${t.status} ${t.statusText}`)}async function ue(e,t=fetch){let n;try{n=await t("/api/auth/pair",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({code:e.code,label:e.label,cookie:!0,attemptId:e.attemptId??Z(),...e.browser?{browser:!0}:{}})})}catch(a){return{ok:!1,error:s("pair.unreachable",{error:a instanceof Error?a.message:String(a)})}}const o=await n.json().catch(()=>({}));return n.ok?{ok:!0}:{ok:!1,error:ot(o,n)}}async function Zt(e,t=fetch){try{const n=await t("/api/auth/pair",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({code:e,browser:!0,preview:!0})}),o=Object(await n.json().catch(()=>({}))),a=Reflect.get(o,"owner"),i=Reflect.get(o,"team");return n.ok&&typeof a=="string"&&a?{owner:a,...typeof i=="string"&&i.trim()?{team:i.trim()}:{}}:null}catch{return null}}function Qt(e,t,n=fetch){return ue({code:e,label:nt(),attemptId:t,browser:!0},n)}function bo(e){const t=Object(e);return t.cloudHome===!0&&typeof t.owner=="string"&&t.owner?t.owner:null}async function rt(e,t,n){let o;try{o=await n(e,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}catch(i){return{ok:!1,error:s("pair.unreachable",{error:i instanceof Error?i.message:String(i)})}}const a=await o.json().catch(()=>({}));return o.ok?{ok:!0}:{ok:!1,error:ot(a,o)}}function en(e,t=fetch){return rt("/api/auth/email/start",{email:e},t)}function tn(e,t=fetch){return rt("/api/auth/email/verify",{email:e.email,code:e.code,label:e.label},t)}function Le(e){return!e||/through a proxy|loopback host required|cross-origin request|^40[13]$/i.test(e)?null:e}function nn(){window.ogb?.softwareRendering===!0&&(document.documentElement.dataset.softwareRendering="")}const on="/api/theme-assets/",rn="safe-look",at={cssChars:1e5,assetBytes:10*1024*1024},an=/^[a-z0-9][a-z0-9-]{0,47}$/,sn=/^[a-z0-9][a-z0-9_-]{0,79}\.(png|jpe?g|webp|gif|avif|svg|woff2?|ttf|otf)$/,ln=/^\/api\/theme-assets\/[a-z0-9][a-z0-9-]{0,47}\/[a-z0-9][a-z0-9_-]{0,79}\.[a-z0-9]{2,5}$/,st=["app","panel","frame","raised","raised-hover","card","inset","control","composer","composer-ring","menu","menu-hover","menu-active","hairline","edge","scrollbar","ink","ink-secondary","ink-tertiary","accent","accent-border","accent-text","accent-ink","focus","bubble-user","bubble-user-ink","success","success-ink","danger","danger-ink","warning"],Q=I().trim().regex(/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,"a hex colour such as #1a2b3c"),cn=I().trim().min(1).max(120).regex(/^[#a-z0-9(),.%\s/+-]+$/i,"a CSS colour such as #1a2b3c, rgb(…) or color-mix(…)").refine(e=>!/url|image|src|attr/i.test(e),"a colour, not a file"),it=jt(qe(st),cn),Re=be({canvas:Q.optional(),accent:Q.optional(),colors:it.optional()}).strict(),ye=be({name:I().trim().min(1).max(60),skin:qe([...Je,"system"]).optional(),canvas:Q.optional(),accent:Q.optional(),colors:it.optional(),light:Re.optional(),dark:Re.optional(),font:I().trim().max(300).regex(/^[\w\s"',.-]*$/,'a font-family list such as "Inter Variable", serif').optional(),css:I().max(at.cssChars).optional()}).strict(),un=1;be({mausbotTheme:Et(un),id:I().regex(an).optional(),theme:ye,assets:Nt(I().regex(sn),I().max(Math.ceil(at.assetBytes*1.4)).regex(/^data:[\w/+.-]+;base64,[A-Za-z0-9+/=]+$/)).optional()}).strict();function lt(e){return/^data:/i.test(e)||e.startsWith("#")||ln.test(e)&&!e.includes("..")}function ct(e){const t=e.toLowerCase(),n=[];for(let o=t.indexOf("url(");o!==-1;o=t.indexOf("url(",o+4)){let a=o+4;for(;/\s/.test(e[a]??"");)a++;const i=e[a];let c;if(i==='"'||i==="'"){const l=e.indexOf(i,a+1);if(l===-1)return null;for(c=e.slice(a+1,l),a=l+1;/\s/.test(e[a]??"");)a++;if(e[a]!==")")return null}else{const l=e.indexOf(")",a);if(l===-1||(c=e.slice(a,l).trim(),/[\s"'(]/.test(c)))return null}n.push(c.trim())}return n}const ut=/image-set\(|\bimage\(|\bsrc\(/i;function dt(e){if(e.includes("\\")||ut.test(e))return!0;const t=ct(e);return t===null||t.some(n=>!lt(n))}function dn(e){let t="";for(let n=0;n<e.length;n++){const o=e[n];if(o==="/"&&e[n+1]==="*"){const a=e.indexOf("*/",n+2);n=a===-1?e.length:a+1,t+=" "}else if(o==='"'||o==="'"){let a=n+1;for(;a<e.length&&e[a]!==o&&e[a]!==`
|
|
3
|
-
`;)a+=e[a]==="\\"?2:1;t+=`${o}${" ".repeat(Math.max(0,a-n-1))}${o}`,n=a}else t+=o}return t}function go(e){const t=dn(e);if(/@import/i.test(t))return"@import is not allowed: themes cannot load other stylesheets.";if(t.includes("\\"))return"Backslash escapes are only allowed inside quoted strings.";if(ut.test(t))return"image-set(), image() and src() are not allowed: use url() with a theme file or a data: address.";const n=e.replace(/\/\*[\s\S]*?\*\//g," "),o=ct(n);if(o===null)return'A url() could not be read. Write url("/api/theme-assets/<theme>/<file>").';const a=o.find(i=>!lt(i));return a!==void 0?`url(${a.slice(0,80)}) is not allowed: themes load only their own files (${on}<theme>/<file>), data: addresses or #ids, never the internet.`:null}function de(e=typeof document>"u"?null:document.documentElement){if(!e||typeof window>"u"||typeof window.getComputedStyle!="function")return"dark";try{return window.getComputedStyle(e).getPropertyValue("--code-color-scheme").trim()==="light"?"light":"dark"}catch{return"dark"}}function yo(){const[e,t]=u.useState(()=>de());return u.useEffect(()=>{const n=()=>t(de());if(n(),typeof MutationObserver>"u")return;const o=new MutationObserver(n);return o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-skin"]}),()=>o.disconnect()},[]),e}const N=[255,255,255],P=[0,0,0];function ee(e){const t=e.trim().replace(/^#/,""),n=t.length===3?[...t].map(a=>a+a).join(""):t,o=Number.parseInt(n.slice(0,6),16);return Number.isFinite(o)?[o>>16&255,o>>8&255,o&255]:P}const V=e=>Math.round(Math.min(255,Math.max(0,e))).toString(16).padStart(2,"0"),d=([e,t,n],o)=>`#${V(e)}${V(t)}${V(n)}${o===void 0?"":V(o*255)}`,v=(e,t,n)=>[0,1,2].map(o=>e[o]+(t[o]-e[o])*n);function te([e,t,n]){const o=a=>{const i=a/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4};return .2126*o(e)+.7152*o(t)+.0722*o(n)}function me(e,t){const[n,o]=[te(e),te(t)].sort((a,i)=>i-a);return(n+.05)/(o+.05)}const $e=e=>te(ee(e))<.2?"dark":"light";function G(e,t,n){const o=te(t)<.2?N:P;let a=e;for(let i=1;i<=20&&me(a,t)<n;i++)a=v(e,o,i/20);return a}const mt=e=>me(N,e)>=me(P,e)?N:[17,17,17];function mn(e,t){const n=ee(e),o=t==="dark",a=f=>v(n,o?N:P,f),i=o?a(.08):v(n,N,.85),c=a(o?.14:.06),l=G(v(o?N:P,n,o?.04:.1),n,12),x=a(o?.22:.07);return{app:d(n),panel:d(o?v(n,P,.25):v(n,N,.45)),frame:d(o?v(n,P,.25):v(n,N,.45)),raised:d(i),"raised-hover":d(c),card:d(o?a(.07):i),inset:d(o?a(.04):n),control:d(a(o?.12:.07)),composer:d(o?a(.07):i),"composer-ring":d(a(o?.14:.12)),menu:d(i),"menu-hover":d(l,.06),"menu-active":d(l,.09),hairline:d(a(.2)),edge:d(l,.08),scrollbar:d(a(o?.25:.22)),ink:d(l),"ink-secondary":d(G(v(l,n,o?.3:.4),c,4.5)),"ink-tertiary":d(G(v(l,n,o?.42:.5),c,4.5)),"bubble-user":d(x),"bubble-user-ink":d(o?mt(x):l)}}function pn(e,t,n){const o=ee(e),a=G(o,ee(n),4.5);return{accent:d(o),"accent-ink":d(mt(o)),"accent-border":d(t==="dark"?v(o,N,.2):v(o,P,.1)),"accent-text":d(a),focus:d(a)}}class fn extends Error{}function Y(e,t){const n=globalThis[t];return typeof n=="function"&&e instanceof n}function He(e){const t=e.style;return t&&typeof t=="object"&&typeof t.getPropertyValue=="function"?t:null}function Me(e){for(let t=e.length-1;t>=0;t--){const n=e.item(t);dt(e.getPropertyValue(n))&&e.removeProperty(n)}}const hn=e=>"cssRules"in e&&typeof e.deleteRule=="function";function De(e,t,n){try{e.deleteRule(t)}catch{if(!Y(n,"CSSNamespaceRule"))throw new fn}}function pt(e){for(let t=e.cssRules.length-1;t>=0;t--){const n=e.cssRules[t];if(!n)continue;if(Y(n,"CSSKeyframesRule")){for(const a of Array.from(n.cssRules)){const i=He(a);i&&Me(i)}continue}if(Y(n,"CSSPropertyRule")){dt(n.initialValue??"")&&De(e,t,n);continue}const o=He(n);o&&Me(o),hn(n)?pt(n):!o&&!Y(n,"CSSLayerStatementRule")&&De(e,t,n)}}let R=null,ze="";function Be(e){if(!(typeof document>"u"||typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in document))&&e!==ze){ze=e,R||(R=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,R]);try{R.replaceSync(e),pt(R)}catch{R.replaceSync("")}}}const pe="omb-theme",Fe="omb-safe-look";let A=null,F=[],ie=!1;const fe=new Set;function U(e){try{return typeof window>"u"?void 0:window[e]}catch{return}}function xn(){try{return typeof location<"u"&&new URLSearchParams(location.search).has(rn)&&U("sessionStorage")?.setItem(Fe,"1"),U("sessionStorage")?.getItem(Fe)==="1"}catch{return!1}}function ko(){return A}function wo(e){return fe.add(e),()=>{fe.delete(e)}}function bn(e){for(const t of F)e.style.removeProperty(t);F=[]}function q(){if(!(typeof document>"u"||ie)){ie=!0;try{const e=document.documentElement;bn(e);const t=xn()?null:A?.theme;if(!t){delete e.dataset.theme,Be(""),Te(_e());return}const n=t.skin??(t.canvas?Pt[$e(t.canvas)]:void 0);Te(n?It(n):_e());const o=de(e),a=t[o],i=a?.canvas??(t.canvas&&$e(t.canvas)===o?t.canvas:void 0),c=a?.accent??t.accent,l={...i?mn(i,o):{},...c?pn(c,o,i??(o==="dark"?"#121212":"#ffffff")):{},...t.colors,...a?.colors};for(const x of st){const f=l[x];f&&(e.style.setProperty(`--color-${x}`,f),F.push(`--color-${x}`))}i&&(e.style.setProperty("--code-color-scheme",o),F.push("--code-color-scheme")),t.font&&(e.style.setProperty("--font-sans",t.font),F.push("--font-sans")),e.dataset.theme=A.id,Be(t.css??"")}finally{ie=!1;for(const e of fe)e()}}}function ke(e){A=e;try{e?U("localStorage")?.setItem(pe,JSON.stringify(e)):U("localStorage")?.removeItem(pe)}catch{}q()}function gn(){try{const e=JSON.parse(U("localStorage")?.getItem(pe)??"null"),t=ye.safeParse(e?.theme);return typeof e?.id=="string"&&t.success?{id:e.id,theme:t.data}:null}catch{return null}}async function we(){try{const e=await fetch("/api/themes/active",{headers:{accept:"application/json"}});if(!e.ok)return;const t=await e.json(),n=t.theme?ye.safeParse(t.theme):null;ke(t.id&&n?.success?{id:t.id,theme:n.data}:null)}catch{}}function vo(e){const t=e.skin;(t==="system"||Je.includes(t))&&ge(t),we()}const ve=(e,t)=>fetch("/api/themes/active",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,...t?{skin:t}:{}})}).then(n=>n.ok,()=>!1);function So(){A&&(ke(null),ve(null))}async function jo(e){const t=await ve(e);return t&&await we(),t}function yn(){ge(Ie),ke(null),ve(null,Ie)}const kn=e=>e.code==="KeyR"&&e.altKey&&e.shiftKey&&(e.metaKey||e.ctrlKey);function wn(){if(!(typeof window>"u")){if(window.addEventListener("keydown",e=>{kn(e)&&(e.preventDefault(),e.stopPropagation(),yn())},{capture:!0}),Ct(q),typeof matchMedia=="function")try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",q)}catch{}A=gn(),A&&q()}}function vn({credential:e,owner:t,team:n}){const[o]=u.useState(()=>Z()),[a,i]=u.useState(!1),[c,l]=u.useState(null);async function x(){i(!0),l(null);const f=await Qt(e,o);if(f.ok){location.replace("/");return}i(!1),l(f.error)}return r.jsx("main",{className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:r.jsxs("div",{className:"w-full max-w-[420px]",children:[r.jsx("h1",{className:"text-[20px] font-semibold",children:n?s("pair.browser.teamTitle",{team:n,owner:t}):s("pair.browser.title",{owner:t})}),r.jsx("p",{className:"mt-1.5 text-[14px] text-ink-secondary",children:s("pair.browser.notYou")}),c?r.jsx("p",{role:"alert",className:"mt-3 text-[13px] text-danger",children:c}):null,r.jsx("button",{type:"button",onClick:()=>{x()},disabled:a,className:"mt-5 w-full rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink disabled:opacity-50",children:s(a?"pair.signingIn":"pair.continue")})]})})}const Se="bg-composer ring-1 ring-inset ring-ink/[0.07]",Sn="bg-composer ring-[0.5px] ring-ink/10",No=`${Sn} shadow-(--shadow-float)`,ft="transition-colors duration-[120ms] hover:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]",jn=`${ft} aria-expanded:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]`,Eo="bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]",Co="focus-visible:outline-2 focus-visible:-outline-offset-2! focus-visible:outline-focus",ht="flex size-9 shrink-0 items-center justify-center rounded-full text-ink/90",je="focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",Nn=`${ht} ${Se} ${jn} ${je}`,Po=`${ht} ${Se} ${ft} ${je}`,En=`flex size-[26px] shrink-0 items-center justify-center rounded-lg text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink aria-expanded:bg-ink/[0.06] aria-expanded:text-ink ${je}`,Io="flex size-10 shrink-0 items-center justify-center rounded-full border border-hairline bg-card text-ink hover:bg-raised focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",Cn="flex size-9 shrink-0 items-center justify-center rounded-xl text-ink-secondary hover:bg-raised/60 hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus";function To({open:e,onToggle:t,corner:n=!1,ref:o}){return r.jsx("button",{ref:o,type:"button","data-sidebar-search-toggle":!0,onClick:t,"aria-label":s("sidebar.searchAria"),"aria-expanded":e,title:s("sidebar.searchAria"),className:n?En:Nn,children:r.jsx(Ze,{size:n?17:18,strokeWidth:1.5,"aria-hidden":"true"})})}function _o({query:e,onQuery:t,onClose:n}){return r.jsx("div",{"data-sidebar-search-pill":!0,className:"px-3 pb-2 pt-0.5",children:r.jsxs("div",{className:$("flex h-[34px] items-center gap-2 rounded-full pl-3 pr-1.5 text-ink-secondary focus-within:ring-focus",Se),children:[r.jsx(Ze,{size:15,"aria-hidden":"true",className:"shrink-0"}),r.jsx("input",{autoFocus:!0,value:e,onChange:o=>t(o.target.value),onKeyDown:o=>{o.key==="Escape"&&(o.preventDefault(),n())},placeholder:s("sidebar.searchAria"),"aria-label":s("sidebar.searchAria"),className:"min-w-0 flex-1 bg-transparent text-[13px] text-ink placeholder:text-ink-tertiary focus:outline-none"}),r.jsx("button",{type:"button",onClick:n,"aria-label":s("sidebar.searchClose"),title:s("sidebar.searchClose"),className:"flex size-6 shrink-0 items-center justify-center rounded-full text-ink-tertiary hover:bg-raised hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus",children:r.jsx(Tt,{size:14,"aria-hidden":"true"})})]})})}function Pn(e,{howTo:t=!1,onClosed:n}={}){return e.menu(t?{from:"howto"}:void 0).finally(()=>{t&&n?.()})}function Ao(e){e({type:"cloudHowTo",open:!1})}function Ue({text:e}){return r.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",e]})}function In(e){return e?.sleeps===!0?!0:e?.status==="paid"?!1:null}function Tn(e){const t=e&&!window.ogb?.remoteClient?.active?window.ogb?.cloudPlan:void 0,n=e||window.ogb?.remoteClient?.active?void 0:window.ogb?.cloudAccount,[o,a]=u.useState(null),[i,c]=u.useState(!1);return u.useEffect(()=>{if(!t)return;let l=!0;return t.state().then(x=>{l&&a(In(x))}).catch(()=>{}),()=>{l=!1}},[t]),u.useEffect(()=>n?.onState(l=>c(l.waking===!0)),[n]),{sleeps:t?o:null,waking:i}}function _n({cloudHome:e=!1,howTo:t=!1,onMenuClosed:n}){const o=window.ogb?.workspaces,[a,i]=u.useState(null),[c,l]=u.useState(!1),[x,f]=u.useState("");u.useEffect(()=>{let p=!0;const k=()=>{o?.state().then(E=>{p&&i(E)}).catch(()=>{})};k();const T=o?.onChanged?.(k);return()=>{p=!1,T?.()}},[o]);const w=Tn(e||a?.home===!0),m=w.sleeps===null?"":s(w.sleeps?"cloudSetup.sleepsWhenIdle":"cloudSetup.alwaysOn"),g=w.waking?s("cloudHome.waking"):"";return{bridge:o,current:a,cloudHome:e,open:c,error:x,onLine:m,waking:g,openMenu:()=>{!o||c||(f(""),l(!0),Pn(o,{howTo:t,onClosed:n}).catch(()=>f(s("sidebar.switchServerError"))).finally(()=>l(!1)))},switchable:!!o&&a?.home!==!0}}function An(e){const t=_t(),n=r.jsx(On,{...e});return At(t)?r.jsx("div",{"data-switcher-beside-rail":!0,className:t.beside?"hidden":"contents md:hidden",children:n}):n}function On({compact:e=!1,inline:t=!1,pill:n=!1,rail:o=!1,cloudHome:a=!1,owner:i=null,howTo:c=!1,place:l,onMenuClosed:x}){const f=l||s("cloudSetup.myCloud"),{bridge:w,current:m,open:g,error:y,onLine:p,waking:k,openMenu:T}=_n({cloudHome:a,howTo:c,onMenuClosed:x}),E=b=>p?`${b} · ${p}`:b;if(!w||m?.home===!0){if(!a&&!m?.home)return null;const b=i?s("sidebar.cloudOwner",{email:i}):"",j=`${E(f)}${b?` · ${b}`:""}`;return o?r.jsx("div",{"data-cloud-home-indicator":!0,"data-workspace-switcher":"rail",role:"img","aria-label":j,title:j,className:"flex size-9 items-center justify-center text-ink-secondary",children:r.jsx(K,{size:18,"aria-hidden":"true"})}):t?r.jsxs("div",{"data-cloud-home-indicator":!0,"data-workspace-switcher":"inline",title:j,className:n?"flex h-8 min-w-0 items-center gap-1 rounded-full bg-raised/50 px-3 text-[13px] font-medium text-ink":"flex min-w-0 items-center gap-1.5 px-1.5 text-[13px] font-medium text-ink",children:[r.jsx(K,{size:n?15:14,"aria-hidden":"true",className:n?"hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block":"shrink-0 text-ink-secondary"}),r.jsx("span",{className:n?"min-w-0 truncate @max-[124px]/sidebar-top:hidden":"min-w-0 truncate",children:f}),(p||b)&&r.jsxs("span",{className:"sr-only",children:[p?` · ${p}`:"",b?` · ${b}`:""]})]}):r.jsx("div",{"data-cloud-home-indicator":!0,className:$("py-1.5",e?"px-2":"px-3"),children:r.jsxs("div",{title:j,className:$("flex items-center gap-2 py-2 text-[13px] font-medium text-ink",e?"justify-center px-1":"px-2"),children:[r.jsx(K,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-secondary"}),e?r.jsx("span",{className:"sr-only",children:j}):r.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[f,p&&r.jsx(Ue,{text:p}),b&&r.jsx("span",{className:"block truncate text-[12px] font-normal text-ink-secondary",children:b})]})]})})}const O=m?.profileName??(m?.local&&!m.localPath?s("place.local"):m?.name)??(a?f:s("sidebar.servers")),S=m?.local===!1||a&&!m?K:Ot,M=a?E(O):O,_=m?.origin?`${M} · ${m.origin}`:M,L=s("sidebar.switchServer",{name:M});return o?r.jsxs("div",{"data-workspace-switcher":"rail",className:"relative",children:[r.jsx("button",{type:"button","aria-label":L,"aria-haspopup":"menu","aria-expanded":g,"data-cloud-home-indicator":a||void 0,"data-tour":"server-switcher",title:_,onClick:T,className:$(Cn,"aria-expanded:bg-raised"),style:{WebkitAppRegion:"no-drag"},children:ae(m?.color)?r.jsx(se,{color:m?.color,size:18}):r.jsx(S,{size:18,"aria-hidden":"true"})}),y&&r.jsx("p",{role:"alert",className:"absolute bottom-0 left-full z-40 ml-2 w-56 rounded-md bg-menu px-2 py-1 text-[11px] text-danger shadow-lg",children:y}),k&&!y&&r.jsx("p",{role:"status","data-cloud-waking":!0,className:"absolute bottom-0 left-full z-40 ml-2 w-56 rounded-md bg-menu px-2 py-1 text-[11px] text-ink-secondary shadow-lg",children:k})]}):t?r.jsxs("div",{"data-workspace-switcher":"inline",className:"flex min-w-0",children:[r.jsxs("button",{type:"button","aria-label":L,"aria-haspopup":"menu","aria-expanded":g,"data-cloud-home-indicator":a||void 0,"data-tour":"server-switcher",title:_,onClick:T,className:n?"flex h-8 min-w-0 max-w-full items-center gap-1 overflow-hidden rounded-full bg-raised/50 pl-2.5 pr-1.5 text-left text-[13px] font-medium text-ink hover:bg-raised aria-expanded:bg-raised focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"flex h-7 min-w-0 max-w-full items-center gap-1.5 overflow-hidden rounded-md px-1.5 text-left text-[13px] font-medium text-ink hover:bg-control focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",style:{WebkitAppRegion:"no-drag"},children:[ae(m?.color)?r.jsx(se,{color:m?.color,size:16}):r.jsx(S,{size:n?15:14,"aria-hidden":"true","data-switcher-icon":!0,className:n?"hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block":"shrink-0 text-ink-secondary"}),r.jsx("span",{className:n?"min-w-0 truncate @max-[124px]/sidebar-top:hidden":"min-w-0 truncate @max-[96px]/sidebar-top:hidden",children:O}),r.jsx(Ae,{size:n?12:11,"aria-hidden":"true",className:n?"shrink-0 text-ink-tertiary":"shrink-0 text-ink-secondary"})]}),y&&r.jsx("p",{role:"alert",className:"absolute right-2 top-full z-40 mt-1 w-56 max-w-[calc(100%-1rem)] rounded-md bg-menu px-2 py-1 text-[11px] text-danger shadow-lg",children:y}),k&&!y&&r.jsx("p",{role:"status","data-cloud-waking":!0,className:"absolute right-2 top-full z-40 mt-1 w-56 max-w-[calc(100%-1rem)] rounded-md bg-menu px-2 py-1 text-[11px] text-ink-secondary shadow-lg",children:k})]}):r.jsxs("div",{className:$("py-1.5",e?"px-2":"px-3"),children:[r.jsxs("button",{type:"button","aria-label":L,"aria-haspopup":"menu","aria-expanded":g,"data-cloud-home-indicator":a||void 0,"data-tour":"server-switcher",title:_,onClick:T,className:$("flex w-full items-center gap-2 rounded-lg py-2 text-left text-[13px] font-medium text-ink hover:bg-control focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",e?"justify-center px-1":"px-2"),style:{WebkitAppRegion:"no-drag"},children:[ae(m?.color)?r.jsx(se,{color:m?.color,size:20}):r.jsx(S,{size:16,className:"shrink-0 text-ink-secondary"}),!e&&r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[O,a&&p&&r.jsx(Ue,{text:p})]}),r.jsx(Ae,{size:13,className:"shrink-0 text-ink-secondary"})]})]}),y&&r.jsx("p",{role:"alert",className:"mt-1 text-[11px] text-danger",children:y}),k&&!y&&r.jsx("p",{role:"status","data-cloud-waking":!0,className:"mt-1 text-[11px] text-ink-secondary",children:k})]})}function Ln(e){const t=e&&typeof e=="object"?e.membership:void 0,n=t&&typeof t=="object"?t:{};let o=null;if(typeof n.peopleUrl=="string")try{new URL(n.peopleUrl).protocol==="https:"&&(o=n.peopleUrl)}catch{o=null}return{authority:n.authority==="portal"?"portal":"local",pairingCodes:n.pairingCodes!==!1,peopleUrl:o}}const Oo=()=>({type:"toggleAppSettings",open:!0,section:"companion",phonePairing:!0});function Lo(e){const t=typeof window>"u"?void 0:window.ogb;return Rn({companion:!!t?.companion,remoteClient:t?.remoteClient?.active===!0,cloudHome:e})}function Rn(e){return e.cloudHome?"cloud":e.companion&&!e.remoteClient?"computer":"server"}const $n={computer:"sidebar.menu.connectPhone.computer",cloud:"sidebar.menu.connectPhone.cloud",server:"sidebar.menu.connectPhone.server"};function Ro(e,t){const n=t?.session?.kind==="session"?t.session.team?.name:void 0;return n?{target:e,subtitleKey:"sidebar.menu.connectPhone.team",team:n}:e!=="computer"&&!(t&&t.pairingCodes&&tt(t.session))?null:{target:e,subtitleKey:$n[e]}}function $o(e,t){if(!e)return[];const n={...e,id:"here"};return e.target,[n]}let We=null;function Ho(e=fetch){return We??=ne(e).then(async t=>{if(!tt(t))return{session:t,pairingCodes:!1};const n=await e("/api/config",{credentials:"same-origin"}).then(o=>o.ok?o.json():null).catch(()=>null);return{session:t,pairingCodes:Ln(n).pairingCodes}}),We}const Hn="data-phone-pairing-action";function Mo(e,t=n=>window.requestAnimationFrame(n)){return e?(t(()=>{e.scrollIntoView?.({block:"start"}),(e.querySelector(`[${Hn}]:not([disabled])`)??e).focus({preventScroll:!0})}),!0):!1}function Do(e){const t=new URL(e);return t.searchParams.get("desktop-settings")!=="phone"?null:(t.searchParams.delete("desktop-settings"),`${t.pathname}${t.search}${t.hash}`)}function le(e){const t=new URLSearchParams(e);if(t.get("desktop-settings")==="phone")return"/?desktop-settings=phone";const n=t.get("next");return n&&/^\/(?!\/)/.test(n)&&!n.startsWith("/pair")&&!/[\\\s]/.test(n)?n:"/"}const Mn="23456789ABCDEFGHJKLMNPQRSTUVWXYZ",Dn=12,zn="omb_pair_",Bn=/^omb_pair_[A-Za-z0-9_-]{43}$/;function xt(e){return e.toUpperCase().replace(/[^A-Z0-9]/g,"").replace(/0/g,"O").replace(/1/g,"I")}function Fn(e){return xt(e).match(/.{1,4}/g)?.join("-")??e}const Un={emailCode:"serverError.pair.emailCode",oldCode:"serverError.pair.oldCode",scriptKey:"serverError.pair.scriptKey",notACode:"serverError.pair.notACode"};function Wn(e){let t;try{t=new URL(e)}catch{return null}const n=new URLSearchParams(t.hash.replace(/^#/,""));return t.searchParams.get("token")??t.searchParams.get("code")??n.get("code")}function Ne(e){let t=e.trim();if(!t)return{kind:"empty"};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(t)){const a=Wn(t);if(!a)return{kind:"wrong",problem:"notACode"};t=a.trim()}if(t.startsWith("omb_sess_"))return{kind:"wrong",problem:"scriptKey"};if(t.startsWith(zn))return Bn.test(t)?{kind:"credential",credential:t}:{kind:"wrong",problem:"notACode"};const n=t.replace(/[\s-]/g,"");if(/^\d{8}$/.test(n))return{kind:"wrong",problem:"emailCode"};if(/^\d{6}$/.test(n))return{kind:"wrong",problem:"oldCode"};const o=xt(t);return o.length!==Dn||[...o].some(a=>!Mn.includes(a))?{kind:"wrong",problem:"notACode"}:{kind:"code",code:o}}const z="mt-1 w-full rounded-md border border-hairline/40 bg-inset px-3 py-2 text-[14px] text-ink outline-none focus:border-accent-border",Ke="mt-5 w-full rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink disabled:opacity-50",B="mt-4 block text-[12px] font-medium text-ink-secondary";function Kn(e,t=typeof window<"u"&&!!window.ogb?.workspaces){return!!e&&t}function Vn({mode:e,sent:t,email:n,cloudHome:o}){return e==="email"?t?s("pair.intro.emailSent",{email:n}):s("pair.intro.email"):o?s("pair.intro.cloud",{app:H(),open:s("cloudHome.connect"),section:s("settings.section.cloudAccount")}):s("pair.intro.code")}function Xn(e){const t=Ne(e);return t.kind==="wrong"&&t.problem!=="notACode"?s(Un[t.problem]):null}function Gn(e){const t=Ne(e).kind;return t==="code"||t==="credential"}function Yn(e,t){const n=Ne(t),o=n.kind==="code"?`&code=${encodeURIComponent(Fn(n.code))}`:"";return`openmausbot://pair?address=${encodeURIComponent(e)}${o}`}function qn(e){return e.protocol==="http:"&&!Lt(e.hostname)}function Ve(e,t=Xt()){if(!e?.capabilities.cloudTeam||typeof t!="string")return null;try{const n=new URL(t),o=n.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(n.hostname);return(n.protocol==="https:"||o)&&!n.username&&!n.password&&!n.hash?n.href:null}catch{return null}}function Jn(e,t){return e?.capabilities.cloudTeam?e.label:e?.capabilities.cloudHome?s("pair.myCloud"):s(t==="email"?"pair.signInTo":"pair.connectTo",{name:e?.label??s("pair.thisOpenMausBot",{app:H()})})}function Zn({team:e}){return r.jsx("main",{"data-team-left":!0,className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:r.jsx("p",{role:"status",className:"max-w-[420px] text-[16px]",children:s("homeLine.left",{name:e??s("pair.thisOpenMausBot",{app:H()})})})})}function X({initialCode:e,initialEmail:t=null,reason:n}){const[o,a]=u.useState(e??""),[i,c]=u.useState(nt()),[l,x]=u.useState(null),[f,w]=u.useState(null),[m,g]=u.useState(!1),[y,p]=u.useState(null),[k,T]=u.useState(()=>Z()),[E,O]=u.useState(t&&!e?"email":"code"),[S,M]=u.useState(t??""),[_,L]=u.useState(""),[b,j]=u.useState(!1),[oe,gt]=u.useState(()=>Kn(e));u.useEffect(()=>{if(!oe||!e)return;let h=!0;return ue({code:e,label:i,attemptId:k}).then(C=>{if(h){if(C.ok){location.replace(le(location.search));return}gt(!1),p(C.error)}}),()=>{h=!1}},[]),u.useEffect(()=>{fetch("/.well-known/openmausbot/environment").then(h=>h.ok?h.json():null).then(h=>{x(h)}).catch(()=>{x(null)}),ne().then(w)},[]);const re=Gt(f),yt=l?.capabilities.emailSignIn===!0,D=l?.capabilities.cloudHome===!0,kt=!D&&l?.capabilities.cloudTeam!==!0,Ce=Xn(o),W=typeof location<"u"&&typeof location.protocol=="string"?location:null;async function wt(h){h.preventDefault(),g(!0),p(null);const C=await ue({code:o,label:i,attemptId:k});if(g(!1),C.ok){location.replace(le(location.search));return}p(C.error)}async function vt(h){h.preventDefault(),g(!0),p(null);const C=b?await tn({email:S,code:_,label:i}):await en(S);if(g(!1),!C.ok){p(C.error);return}if(b){location.replace(le(location.search));return}j(!0)}function Pe(h){O(h),p(null)}return r.jsxs("main",{className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:[r.jsx("div",{className:"absolute left-3 top-12 max-w-[280px]",children:r.jsx(An,{})}),r.jsxs("div",{className:"w-full max-w-[420px]",children:[W&&qn(W)?r.jsx("p",{role:"alert",className:"mb-4 rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-[13px] text-warning",children:s("pair.notEncrypted")}):null,oe?r.jsx("p",{role:"status",className:"text-[20px] font-semibold",children:D?s("pair.openingCloud"):s("pair.connectingTo",{name:l?.label??s("pair.thisOpenMausBot")})}):r.jsxs(r.Fragment,{children:[r.jsx("h1",{className:"text-[20px] font-semibold",children:Jn(l,E)}),r.jsxs("p",{className:"mt-1.5 text-[14px] leading-relaxed text-ink-secondary",children:[l&&!D?`${s("pair.version",{version:l.version,platform:l.platform})} `:"",Vn({mode:E,sent:b,email:S,cloudHome:D})]}),Le(n)&&!re?r.jsx("p",{className:"mt-3 text-[13px] text-ink-secondary",children:Le(n)}):null,y&&D&&e?r.jsx("p",{className:"mt-3 text-[13px] text-ink-secondary",children:s("pair.expired",{app:H(),open:s("cloudHome.connect"),section:s("settings.section.cloudAccount")})}):null,!re&&Ve(l)?r.jsxs("div",{"data-team-sign-in":!0,className:"mt-4 flex flex-col items-start gap-1.5",children:[r.jsx("a",{href:Ve(l),className:"rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink",children:s("pair.team.open",{team:l.label})}),r.jsx("p",{className:"text-[13px] text-ink-secondary",children:s("pair.team.openHint")})]}):null]}),oe?null:re?r.jsxs("p",{className:"mt-4 text-[14px]",children:[s("pair.alreadyConnected")," ",r.jsx("a",{href:"/",className:"text-accent underline",children:s("pair.openApp")})]}):E==="email"?r.jsxs("form",{onSubmit:vt,children:[r.jsx("label",{className:B,htmlFor:"signin-email",children:s("cloudBuy.signIn.email")}),r.jsx("input",{id:"signin-email",type:"email",value:S,onChange:h=>{M(h.target.value),j(!1),L("")},autoComplete:"email",inputMode:"email",spellCheck:!1,className:z}),b?r.jsxs(r.Fragment,{children:[r.jsx("label",{className:B,htmlFor:"signin-code",children:s("pair.emailCode")}),r.jsx("input",{id:"signin-code",value:_,onChange:h=>L(h.target.value),placeholder:"12345678",autoComplete:"one-time-code",inputMode:"numeric",spellCheck:!1,className:`${z} font-mono text-[15px] tracking-[0.12em]`}),r.jsx("label",{className:B,htmlFor:"signin-label",children:s("pair.deviceLabel")}),r.jsx("input",{id:"signin-label",value:i,onChange:h=>c(h.target.value),maxLength:80,className:z})]}):null,y?r.jsx("p",{className:"mt-3 text-[13px] text-danger",children:y}):null,r.jsx("button",{type:"submit",disabled:m||!S.includes("@")||b&&_.replace(/\D/g,"").length<8,className:Ke,children:s(m?b?"pair.signingIn":"pair.sending":b?"pair.signIn":"cloudBuy.signIn.send")}),b?r.jsx("button",{type:"button",onClick:()=>j(!1),className:"mt-3 w-full text-[13px] text-ink-secondary underline",children:s("pair.resend")}):null,r.jsx("button",{type:"button",onClick:()=>Pe("code"),className:"mt-3 w-full text-[13px] text-ink-secondary underline",children:s("pair.useCode")})]}):r.jsxs("form",{onSubmit:wt,children:[r.jsx("label",{className:B,htmlFor:"pair-code",children:s("pair.code")}),r.jsx("input",{id:"pair-code",value:o,onChange:h=>{a(h.target.value),T(Z())},placeholder:"XXXX-XXXX-XXXX","aria-describedby":e&&o===e?"pair-code-from-link":void 0,autoComplete:"one-time-code",autoCapitalize:"characters",spellCheck:!1,className:`${z} font-mono text-[15px] tracking-[0.12em]`}),e&&o===e?r.jsx("p",{id:"pair-code-from-link",className:"mt-1 text-[12px] text-ink-secondary",children:s("pair.fromLink")}):null,r.jsx("label",{className:B,htmlFor:"pair-label",children:s("pair.deviceLabel")}),r.jsx("input",{id:"pair-label",value:i,onChange:h=>c(h.target.value),maxLength:80,className:z}),Ce?r.jsx("p",{role:"alert",className:"mt-3 text-[13px] text-danger",children:Ce}):y?r.jsx("p",{className:"mt-3 text-[13px] text-danger",children:y}):null,r.jsx("button",{type:"submit",disabled:m||!Gn(o),className:Ke,children:s(m?"pair.connecting":"pair.connect")}),W?.origin?r.jsxs("p",{className:"mt-3 text-[13px] text-ink-secondary",children:[s("pair.onPhone")," ",r.jsx("a",{href:Yn(W.origin,o),className:"text-accent underline",children:s("pair.openInApp",{app:H()})})]}):null,kt?r.jsxs("p",{className:"mt-3 text-[13px] text-ink-secondary",children:[s("pair.noCode")," ",r.jsx("code",{className:"select-all rounded bg-inset px-1.5 py-0.5 text-[12px] text-ink",children:"npx limixbot pair"})]}):null,yt?r.jsxs("p",{className:"mt-5 border-t border-hairline/40 pt-4 text-[13px] text-ink-secondary",children:[s("pair.invitedByEmail")," ",r.jsx("button",{type:"button",onClick:()=>Pe("email"),className:"text-accent underline",children:s("pair.useEmail")})]}):null]})]})]})}const zo="cloud-welcome-done",Qn="unauthorized: you are no longer in this team",Xe=[["reserving","cloudHome.step.reserving"],["storage","cloudHome.step.storage"],["starting","cloudHome.step.starting"],["checking","cloudHome.step.checking"]];function eo({step:e}){const t=Xe.findIndex(([n])=>n===e);return r.jsx("ol",{"data-cloud-setup":e,className:"flex flex-col gap-1 text-[13px]",children:Xe.map(([n,o],a)=>r.jsx("li",{"aria-current":a===t?"step":void 0,className:a===t?"font-medium text-ink":a<t?"text-ink-secondary line-through decoration-ink-secondary/40":"text-ink-secondary",children:s(o)},n))})}const to={stopped:"cloudHome.stopped","payment-problem":"cloudHome.paymentProblem",failed:"cloudHome.failed"},Ge={host:"cloudHome.unreachableHost",no_answer:"cloudHome.unreachable"};function no(e,t=Date.now()){const n=new Date(e).getFullYear()!==new Date(t).getFullYear();return new Intl.DateTimeFormat(Rt(),{day:"numeric",month:"long",...n?{year:"numeric"}:{}}).format(new Date(e))}function oo(e,t=Date.now()){const n=e?.name??null,o=(a,i)=>n?s(i,{name:n}):s(a);return e?.screen==="setup"?{title:o("homeScreen.setup","homeScreen.setupNamed"),body:s(e.slow?"cloudHome.slow":"homeScreen.setupBody"),reason:null,action:null,busy:!0}:e?.screen==="offline"?{title:o("homeScreen.offline","homeScreen.offlineNamed"),body:s("homeScreen.offlineBack"),reason:e.cause&&Object.hasOwn(Ge,e.cause)?s(Ge[e.cause]):e.reason??null,action:"retry",busy:!1}:e?.screen==="signin"?{title:o("homeScreen.signIn","homeScreen.signInNamed"),body:s(e.other?"homeScreen.signInOther":"homeScreen.signInEnded"),reason:null,action:"sign-in",busy:!1}:e?.screen==="plan"&&e.member&&e.machine!=="failed"?{title:o("homeScreen.plan","homeScreen.planNamed"),body:s("cloudHome.stoppedMember"),reason:null,action:null,busy:!1}:e?.screen==="plan"?{title:o("homeScreen.plan","homeScreen.planNamed"),body:s(to[e.machine]??"cloudHome.failed"),reason:null,action:e.machine==="failed"?null:"manage",busy:!1}:e?.screen==="ended"?{title:o("cloudHome.ended","cloudHome.endedNamed"),body:e.deleteAt?s("cloudHome.endedFiles",{date:no(e.deleteAt,t)}):null,reason:null,action:"buy",busy:!1}:e?.screen==="checkout"?{title:o("cloudHome.checkout","cloudHome.checkoutNamed"),body:null,reason:null,action:"continue",busy:!1}:e?.screen==="payment"?{title:o("cloudHome.payment","cloudHome.paymentNamed"),body:s("cloudHome.paymentBody"),reason:null,action:"card",busy:!1}:e?.screen==="waking"?{title:s("homeScreen.waking"),body:null,reason:null,action:null,busy:!0}:e?.screen==="moving"?{title:o("homeScreen.moving","homeScreen.movingNamed"),body:null,reason:null,action:null,busy:!0}:{title:o("homeScreen.opening","homeScreen.openingNamed"),body:null,reason:null,action:null,busy:!0}}const ro={retry:"cloudHome.tryAgain",buy:"cloudHome.buyAgain",continue:"cloudHome.continue",card:"cloudHome.updateCard"};function ao({name:e,remove:t}){const[n,o]=u.useState(!1),[a,i]=u.useState(!1),[c,l]=u.useState(null),x=()=>{i(!0),l(null),t().then(f=>{i(!1),f!=="removed"&&f!=="gone"&&(o(!1),l(f==="refused"?"refused":"failed"))},()=>{i(!1),o(!1),l("failed")})};return r.jsxs("div",{"data-home-remove":!0,className:"flex flex-col items-start gap-2",children:[n?r.jsxs("div",{role:"alertdialog","aria-label":s("rail.remove"),className:"flex flex-col gap-2 rounded-xl border border-hairline/70 bg-card/70 px-4 py-3",children:[r.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:s("rail.removeAsk",{name:e})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{type:"button","data-home-remove-confirm":!0,className:"ui-button ui-button-primary",disabled:a,onClick:x,children:s("rail.removeYes")}),r.jsx("button",{type:"button",className:"ui-button",disabled:a,onClick:()=>o(!1),children:s("rail.removeNo")})]})]}):r.jsx("button",{type:"button","data-home-remove-ask":!0,className:"text-[13px] text-ink-secondary underline-offset-2 hover:text-ink hover:underline",onClick:()=>{l(null),o(!0)},children:s("rail.remove")}),c&&r.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:s(c==="refused"?"rail.removeRefused":"rail.removeFailed")})]})}function so({bridge:e,manage:t}){const[n,o]=u.useState(null),[a,i]=u.useState(!1);u.useEffect(()=>{let g=!0;const y=e.onState(k=>o(k)),p=()=>{e.retry().then(k=>{g&&o(k)}).catch(()=>{})};return e.state().then(k=>{g&&o(k)}).catch(()=>{}).then(p),window.addEventListener("online",p),window.addEventListener("focus",p),()=>{g=!1,y(),window.removeEventListener("online",p),window.removeEventListener("focus",p)}},[e]);const c=oo(n),l=g=>{i(!1),g().catch(()=>i(!0))},x=window.ogb?.cloudAdd?.reopen,f={retry:()=>e.retry().then(g=>o(g)),...t?{manage:t,buy:t,card:t,continue:async()=>{x&&await x().catch(()=>!1)||await t()}}:{}},w=c.action&&c.action!=="sign-in"&&c.action!=="manage"?c.action:null,m=(n?.screen==="ended"||n?.screen==="payment")&&n.removable===!0&&typeof e.remove=="function";return r.jsx("main",{"data-home-screen":n?.screen??"opening",className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",style:{WebkitAppRegion:"drag"},children:r.jsxs("div",{className:"flex w-full max-w-[420px] flex-col items-start gap-3",style:{WebkitAppRegion:"no-drag"},children:[r.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[20px] font-semibold",children:[c.busy&&r.jsx("span",{"aria-hidden":"true",className:"size-3.5 shrink-0 animate-spin rounded-full border-2 border-hairline border-t-accent"}),c.title]}),c.body&&r.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:c.body}),n?.screen==="setup"&&r.jsx(eo,{step:n.step??"reserving"}),c.reason&&r.jsx("p",{"data-home-reason":!0,className:"text-[13px] leading-relaxed text-ink-secondary",children:c.reason}),c.action==="sign-in"&&r.jsx("button",{type:"button",className:"ui-button ui-button-primary mt-2",onClick:()=>l(()=>e.signIn()),children:s("homeScreen.signInButton")}),c.action==="manage"&&t&&r.jsx("button",{type:"button",className:"ui-button mt-2",onClick:()=>l(t),children:s("cloudAccount.manageInBrowser")}),w&&f[w]&&r.jsx("button",{type:"button","data-home-action":w,className:w==="retry"?"ui-button mt-2":"ui-button ui-button-primary mt-2",onClick:()=>l(f[w]),children:s(ro[w])}),m&&r.jsx(ao,{name:n.name??s("cloudSetup.myCloud"),remove:()=>e.remove()}),a&&r.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:s("cloudAccount.actionFailed")})]})})}function io({bridge:e,fallback:t}){const[n,o]=u.useState(!1);return u.useEffect(()=>{e.repair().catch(()=>o(!0))},[e]),n?r.jsx(r.Fragment,{children:t}):r.jsx("main",{"data-home-screen":"opening",className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:r.jsx("p",{role:"status",className:"w-full max-w-[420px] text-[20px] font-semibold",children:s("homeScreen.opening")})})}const Ee="omb.session-ended";let he=!1,ce=null;const xe=new Set;function Bo(){he||ce||(ce=ne().then(e=>{if(e.kind==="unauthenticated"){he=!0;try{sessionStorage.setItem(Ee,"1")}catch{}for(const t of xe)t()}}).finally(()=>{ce=null}))}function Ye(){return he}function Fo(){return u.useSyncExternalStore(e=>(xe.add(e),()=>xe.delete(e)),Ye,Ye)}function lo(){try{return sessionStorage.getItem(Ee)==="1"}catch{return!1}}function co(){try{sessionStorage.removeItem(Ee)}catch{}}$t();ge(Ht());Mt(Dt());nn();zt(Bt());wn();const J=Ft(),uo=new Set(["/home","/pair","/desktop-viewer"]),bt=()=>Qe(()=>import("./App-Cw7Q97gJ.js").then(e=>e.jV),__vite__mapDeps([0,1,2,3,4,5])).catch(e=>({default:()=>{throw e}})),mo=uo.has(location.pathname)?null:bt(),po=()=>fetch("/.well-known/openmausbot/environment").then(e=>e.json()).then(e=>e.capabilities?.cloudTeam===!0&&typeof e.label=="string"?e.label:null,()=>null);async function fo(){const e=window.ogb?.home;if(location.pathname==="/home"&&e)return r.jsx(so,{bridge:e,manage:window.ogb?.cloudPlan?.manage});if(location.pathname==="/pair"){const o=qt();if(o){const a=await Zt(o);return await J,a?r.jsx(vn,{credential:o,owner:a.owner,team:a.team}):r.jsx(X,{initialCode:null,reason:s("pair.browser.signInFailed")})}return r.jsx(X,{initialCode:Yt(),initialEmail:Jt()})}const t=await ne();if(t.kind==="unauthenticated"){if(await J,t.error===Qn)return r.jsx(Zn,{team:await po()});const o=r.jsx(X,{initialCode:null,reason:lo()?s("pair.sessionEnded"):t.error});return e?r.jsx(io,{bridge:e,fallback:o}):o}if(co(),t.kind==="session"&&Vt(t.teamSignIn),t.kind==="loopback"&&t.trust==="service")return await J,r.jsx(X,{initialCode:null,reason:s("pair.serviceTrust")});if(location.pathname==="/desktop-viewer"){const{DesktopViewer:o}=await Qe(async()=>{const{DesktopViewer:a}=await import("./DesktopViewer-ibFgMuIw.js");return{DesktopViewer:a}},__vite__mapDeps([6,1,2,7,8,5,4,9]));return r.jsx(o,{})}const{default:n}=await(mo??bt());return we(),r.jsx(n,{})}document.title=H();Promise.all([Ut(),fo(),J]).then(([,e])=>{Wt.createRoot(document.getElementById("root")).render(r.jsx(u.StrictMode,{children:r.jsx(Kt,{children:e})}))});export{Po as A,bo as B,eo as C,Co as D,No as E,En as F,An as G,To as H,_o as I,Sn as J,de as K,Eo as L,zo as M,Fo as N,X as O,Io as P,Do as Q,Nn as S,at as T,Ln as a,Mo as b,xn as c,yn as d,jo as e,So as f,Lo as g,vo as h,tt as i,jn as j,Se as k,we as l,$o as m,Bo as n,Pn as o,Oo as p,xo as q,ne as r,wo as s,go as t,yo as u,Ho as v,ko as w,Ro as x,_n as y,Ao as z};
|
|
3
|
+
`;)a+=e[a]==="\\"?2:1;t+=`${o}${" ".repeat(Math.max(0,a-n-1))}${o}`,n=a}else t+=o}return t}function go(e){const t=dn(e);if(/@import/i.test(t))return"@import is not allowed: themes cannot load other stylesheets.";if(t.includes("\\"))return"Backslash escapes are only allowed inside quoted strings.";if(ut.test(t))return"image-set(), image() and src() are not allowed: use url() with a theme file or a data: address.";const n=e.replace(/\/\*[\s\S]*?\*\//g," "),o=ct(n);if(o===null)return'A url() could not be read. Write url("/api/theme-assets/<theme>/<file>").';const a=o.find(i=>!lt(i));return a!==void 0?`url(${a.slice(0,80)}) is not allowed: themes load only their own files (${on}<theme>/<file>), data: addresses or #ids, never the internet.`:null}function de(e=typeof document>"u"?null:document.documentElement){if(!e||typeof window>"u"||typeof window.getComputedStyle!="function")return"dark";try{return window.getComputedStyle(e).getPropertyValue("--code-color-scheme").trim()==="light"?"light":"dark"}catch{return"dark"}}function yo(){const[e,t]=u.useState(()=>de());return u.useEffect(()=>{const n=()=>t(de());if(n(),typeof MutationObserver>"u")return;const o=new MutationObserver(n);return o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-skin"]}),()=>o.disconnect()},[]),e}const N=[255,255,255],P=[0,0,0];function ee(e){const t=e.trim().replace(/^#/,""),n=t.length===3?[...t].map(a=>a+a).join(""):t,o=Number.parseInt(n.slice(0,6),16);return Number.isFinite(o)?[o>>16&255,o>>8&255,o&255]:P}const V=e=>Math.round(Math.min(255,Math.max(0,e))).toString(16).padStart(2,"0"),d=([e,t,n],o)=>`#${V(e)}${V(t)}${V(n)}${o===void 0?"":V(o*255)}`,v=(e,t,n)=>[0,1,2].map(o=>e[o]+(t[o]-e[o])*n);function te([e,t,n]){const o=a=>{const i=a/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4};return .2126*o(e)+.7152*o(t)+.0722*o(n)}function me(e,t){const[n,o]=[te(e),te(t)].sort((a,i)=>i-a);return(n+.05)/(o+.05)}const $e=e=>te(ee(e))<.2?"dark":"light";function G(e,t,n){const o=te(t)<.2?N:P;let a=e;for(let i=1;i<=20&&me(a,t)<n;i++)a=v(e,o,i/20);return a}const mt=e=>me(N,e)>=me(P,e)?N:[17,17,17];function mn(e,t){const n=ee(e),o=t==="dark",a=f=>v(n,o?N:P,f),i=o?a(.08):v(n,N,.85),c=a(o?.14:.06),l=G(v(o?N:P,n,o?.04:.1),n,12),x=a(o?.22:.07);return{app:d(n),panel:d(o?v(n,P,.25):v(n,N,.45)),frame:d(o?v(n,P,.25):v(n,N,.45)),raised:d(i),"raised-hover":d(c),card:d(o?a(.07):i),inset:d(o?a(.04):n),control:d(a(o?.12:.07)),composer:d(o?a(.07):i),"composer-ring":d(a(o?.14:.12)),menu:d(i),"menu-hover":d(l,.06),"menu-active":d(l,.09),hairline:d(a(.2)),edge:d(l,.08),scrollbar:d(a(o?.25:.22)),ink:d(l),"ink-secondary":d(G(v(l,n,o?.3:.4),c,4.5)),"ink-tertiary":d(G(v(l,n,o?.42:.5),c,4.5)),"bubble-user":d(x),"bubble-user-ink":d(o?mt(x):l)}}function pn(e,t,n){const o=ee(e),a=G(o,ee(n),4.5);return{accent:d(o),"accent-ink":d(mt(o)),"accent-border":d(t==="dark"?v(o,N,.2):v(o,P,.1)),"accent-text":d(a),focus:d(a)}}class fn extends Error{}function Y(e,t){const n=globalThis[t];return typeof n=="function"&&e instanceof n}function He(e){const t=e.style;return t&&typeof t=="object"&&typeof t.getPropertyValue=="function"?t:null}function Me(e){for(let t=e.length-1;t>=0;t--){const n=e.item(t);dt(e.getPropertyValue(n))&&e.removeProperty(n)}}const hn=e=>"cssRules"in e&&typeof e.deleteRule=="function";function De(e,t,n){try{e.deleteRule(t)}catch{if(!Y(n,"CSSNamespaceRule"))throw new fn}}function pt(e){for(let t=e.cssRules.length-1;t>=0;t--){const n=e.cssRules[t];if(!n)continue;if(Y(n,"CSSKeyframesRule")){for(const a of Array.from(n.cssRules)){const i=He(a);i&&Me(i)}continue}if(Y(n,"CSSPropertyRule")){dt(n.initialValue??"")&&De(e,t,n);continue}const o=He(n);o&&Me(o),hn(n)?pt(n):!o&&!Y(n,"CSSLayerStatementRule")&&De(e,t,n)}}let R=null,ze="";function Be(e){if(!(typeof document>"u"||typeof CSSStyleSheet>"u"||!("adoptedStyleSheets"in document))&&e!==ze){ze=e,R||(R=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,R]);try{R.replaceSync(e),pt(R)}catch{R.replaceSync("")}}}const pe="omb-theme",Fe="omb-safe-look";let A=null,F=[],ie=!1;const fe=new Set;function U(e){try{return typeof window>"u"?void 0:window[e]}catch{return}}function xn(){try{return typeof location<"u"&&new URLSearchParams(location.search).has(rn)&&U("sessionStorage")?.setItem(Fe,"1"),U("sessionStorage")?.getItem(Fe)==="1"}catch{return!1}}function ko(){return A}function wo(e){return fe.add(e),()=>{fe.delete(e)}}function bn(e){for(const t of F)e.style.removeProperty(t);F=[]}function q(){if(!(typeof document>"u"||ie)){ie=!0;try{const e=document.documentElement;bn(e);const t=xn()?null:A?.theme;if(!t){delete e.dataset.theme,Be(""),Te(_e());return}const n=t.skin??(t.canvas?Pt[$e(t.canvas)]:void 0);Te(n?It(n):_e());const o=de(e),a=t[o],i=a?.canvas??(t.canvas&&$e(t.canvas)===o?t.canvas:void 0),c=a?.accent??t.accent,l={...i?mn(i,o):{},...c?pn(c,o,i??(o==="dark"?"#121212":"#ffffff")):{},...t.colors,...a?.colors};for(const x of st){const f=l[x];f&&(e.style.setProperty(`--color-${x}`,f),F.push(`--color-${x}`))}i&&(e.style.setProperty("--code-color-scheme",o),F.push("--code-color-scheme")),t.font&&(e.style.setProperty("--font-sans",t.font),F.push("--font-sans")),e.dataset.theme=A.id,Be(t.css??"")}finally{ie=!1;for(const e of fe)e()}}}function ke(e){A=e;try{e?U("localStorage")?.setItem(pe,JSON.stringify(e)):U("localStorage")?.removeItem(pe)}catch{}q()}function gn(){try{const e=JSON.parse(U("localStorage")?.getItem(pe)??"null"),t=ye.safeParse(e?.theme);return typeof e?.id=="string"&&t.success?{id:e.id,theme:t.data}:null}catch{return null}}async function we(){try{const e=await fetch("/api/themes/active",{headers:{accept:"application/json"}});if(!e.ok)return;const t=await e.json(),n=t.theme?ye.safeParse(t.theme):null;ke(t.id&&n?.success?{id:t.id,theme:n.data}:null)}catch{}}function vo(e){const t=e.skin;(t==="system"||Je.includes(t))&&ge(t),we()}const ve=(e,t)=>fetch("/api/themes/active",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,...t?{skin:t}:{}})}).then(n=>n.ok,()=>!1);function So(){A&&(ke(null),ve(null))}async function jo(e){const t=await ve(e);return t&&await we(),t}function yn(){ge(Ie),ke(null),ve(null,Ie)}const kn=e=>e.code==="KeyR"&&e.altKey&&e.shiftKey&&(e.metaKey||e.ctrlKey);function wn(){if(!(typeof window>"u")){if(window.addEventListener("keydown",e=>{kn(e)&&(e.preventDefault(),e.stopPropagation(),yn())},{capture:!0}),Ct(q),typeof matchMedia=="function")try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",q)}catch{}A=gn(),A&&q()}}function vn({credential:e,owner:t,team:n}){const[o]=u.useState(()=>Z()),[a,i]=u.useState(!1),[c,l]=u.useState(null);async function x(){i(!0),l(null);const f=await Qt(e,o);if(f.ok){location.replace("/");return}i(!1),l(f.error)}return r.jsx("main",{className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:r.jsxs("div",{className:"w-full max-w-[420px]",children:[r.jsx("h1",{className:"text-[20px] font-semibold",children:n?s("pair.browser.teamTitle",{team:n,owner:t}):s("pair.browser.title",{owner:t})}),r.jsx("p",{className:"mt-1.5 text-[14px] text-ink-secondary",children:s("pair.browser.notYou")}),c?r.jsx("p",{role:"alert",className:"mt-3 text-[13px] text-danger",children:c}):null,r.jsx("button",{type:"button",onClick:()=>{x()},disabled:a,className:"mt-5 w-full rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink disabled:opacity-50",children:s(a?"pair.signingIn":"pair.continue")})]})})}const Se="bg-composer ring-1 ring-inset ring-ink/[0.07]",Sn="bg-composer ring-[0.5px] ring-ink/10",No=`${Sn} shadow-(--shadow-float)`,ft="transition-colors duration-[120ms] hover:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]",jn=`${ft} aria-expanded:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]`,Eo="bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]",Co="focus-visible:outline-2 focus-visible:-outline-offset-2! focus-visible:outline-focus",ht="flex size-9 shrink-0 items-center justify-center rounded-full text-ink/90",je="focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",Nn=`${ht} ${Se} ${jn} ${je}`,Po=`${ht} ${Se} ${ft} ${je}`,En=`flex size-[26px] shrink-0 items-center justify-center rounded-lg text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink aria-expanded:bg-ink/[0.06] aria-expanded:text-ink ${je}`,Io="flex size-10 shrink-0 items-center justify-center rounded-full border border-hairline bg-card text-ink hover:bg-raised focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",Cn="flex size-9 shrink-0 items-center justify-center rounded-xl text-ink-secondary hover:bg-raised/60 hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus";function To({open:e,onToggle:t,corner:n=!1,ref:o}){return r.jsx("button",{ref:o,type:"button","data-sidebar-search-toggle":!0,onClick:t,"aria-label":s("sidebar.searchAria"),"aria-expanded":e,title:s("sidebar.searchAria"),className:n?En:Nn,children:r.jsx(Ze,{size:n?17:18,strokeWidth:1.5,"aria-hidden":"true"})})}function _o({query:e,onQuery:t,onClose:n}){return r.jsx("div",{"data-sidebar-search-pill":!0,className:"px-3 pb-2 pt-0.5",children:r.jsxs("div",{className:$("flex h-[34px] items-center gap-2 rounded-full pl-3 pr-1.5 text-ink-secondary focus-within:ring-focus",Se),children:[r.jsx(Ze,{size:15,"aria-hidden":"true",className:"shrink-0"}),r.jsx("input",{autoFocus:!0,value:e,onChange:o=>t(o.target.value),onKeyDown:o=>{o.key==="Escape"&&(o.preventDefault(),n())},placeholder:s("sidebar.searchAria"),"aria-label":s("sidebar.searchAria"),className:"min-w-0 flex-1 bg-transparent text-[13px] text-ink placeholder:text-ink-tertiary focus:outline-none"}),r.jsx("button",{type:"button",onClick:n,"aria-label":s("sidebar.searchClose"),title:s("sidebar.searchClose"),className:"flex size-6 shrink-0 items-center justify-center rounded-full text-ink-tertiary hover:bg-raised hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus",children:r.jsx(Tt,{size:14,"aria-hidden":"true"})})]})})}function Pn(e,{howTo:t=!1,onClosed:n}={}){return e.menu(t?{from:"howto"}:void 0).finally(()=>{t&&n?.()})}function Ao(e){e({type:"cloudHowTo",open:!1})}function Ue({text:e}){return r.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",e]})}function In(e){return e?.sleeps===!0?!0:e?.status==="paid"?!1:null}function Tn(e){const t=e&&!window.ogb?.remoteClient?.active?window.ogb?.cloudPlan:void 0,n=e||window.ogb?.remoteClient?.active?void 0:window.ogb?.cloudAccount,[o,a]=u.useState(null),[i,c]=u.useState(!1);return u.useEffect(()=>{if(!t)return;let l=!0;return t.state().then(x=>{l&&a(In(x))}).catch(()=>{}),()=>{l=!1}},[t]),u.useEffect(()=>n?.onState(l=>c(l.waking===!0)),[n]),{sleeps:t?o:null,waking:i}}function _n({cloudHome:e=!1,howTo:t=!1,onMenuClosed:n}){const o=window.ogb?.workspaces,[a,i]=u.useState(null),[c,l]=u.useState(!1),[x,f]=u.useState("");u.useEffect(()=>{let p=!0;const k=()=>{o?.state().then(E=>{p&&i(E)}).catch(()=>{})};k();const T=o?.onChanged?.(k);return()=>{p=!1,T?.()}},[o]);const w=Tn(e||a?.home===!0),m=w.sleeps===null?"":s(w.sleeps?"cloudSetup.sleepsWhenIdle":"cloudSetup.alwaysOn"),g=w.waking?s("cloudHome.waking"):"";return{bridge:o,current:a,cloudHome:e,open:c,error:x,onLine:m,waking:g,openMenu:()=>{!o||c||(f(""),l(!0),Pn(o,{howTo:t,onClosed:n}).catch(()=>f(s("sidebar.switchServerError"))).finally(()=>l(!1)))},switchable:!!o&&a?.home!==!0}}function An(e){const t=_t(),n=r.jsx(On,{...e});return At(t)?r.jsx("div",{"data-switcher-beside-rail":!0,className:t.beside?"hidden":"contents md:hidden",children:n}):n}function On({compact:e=!1,inline:t=!1,pill:n=!1,rail:o=!1,cloudHome:a=!1,owner:i=null,howTo:c=!1,place:l,onMenuClosed:x}){const f=l||s("cloudSetup.myCloud"),{bridge:w,current:m,open:g,error:y,onLine:p,waking:k,openMenu:T}=_n({cloudHome:a,howTo:c,onMenuClosed:x}),E=b=>p?`${b} · ${p}`:b;if(!w||m?.home===!0){if(!a&&!m?.home)return null;const b=i?s("sidebar.cloudOwner",{email:i}):"",j=`${E(f)}${b?` · ${b}`:""}`;return o?r.jsx("div",{"data-cloud-home-indicator":!0,"data-workspace-switcher":"rail",role:"img","aria-label":j,title:j,className:"flex size-9 items-center justify-center text-ink-secondary",children:r.jsx(K,{size:18,"aria-hidden":"true"})}):t?r.jsxs("div",{"data-cloud-home-indicator":!0,"data-workspace-switcher":"inline",title:j,className:n?"flex h-8 min-w-0 items-center gap-1 rounded-full bg-raised/50 px-3 text-[13px] font-medium text-ink":"flex min-w-0 items-center gap-1.5 px-1.5 text-[13px] font-medium text-ink",children:[r.jsx(K,{size:n?15:14,"aria-hidden":"true",className:n?"hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block":"shrink-0 text-ink-secondary"}),r.jsx("span",{className:n?"min-w-0 truncate @max-[124px]/sidebar-top:hidden":"min-w-0 truncate",children:f}),(p||b)&&r.jsxs("span",{className:"sr-only",children:[p?` · ${p}`:"",b?` · ${b}`:""]})]}):r.jsx("div",{"data-cloud-home-indicator":!0,className:$("py-1.5",e?"px-2":"px-3"),children:r.jsxs("div",{title:j,className:$("flex items-center gap-2 py-2 text-[13px] font-medium text-ink",e?"justify-center px-1":"px-2"),children:[r.jsx(K,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-secondary"}),e?r.jsx("span",{className:"sr-only",children:j}):r.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[f,p&&r.jsx(Ue,{text:p}),b&&r.jsx("span",{className:"block truncate text-[12px] font-normal text-ink-secondary",children:b})]})]})})}const O=m?.profileName??(m?.local&&!m.localPath?s("place.local"):m?.name)??(a?f:s("sidebar.servers")),S=m?.local===!1||a&&!m?K:Ot,M=a?E(O):O,_=m?.origin?`${M} · ${m.origin}`:M,L=s("sidebar.switchServer",{name:M});return o?r.jsxs("div",{"data-workspace-switcher":"rail",className:"relative",children:[r.jsx("button",{type:"button","aria-label":L,"aria-haspopup":"menu","aria-expanded":g,"data-cloud-home-indicator":a||void 0,"data-tour":"server-switcher",title:_,onClick:T,className:$(Cn,"aria-expanded:bg-raised"),style:{WebkitAppRegion:"no-drag"},children:ae(m?.color)?r.jsx(se,{color:m?.color,size:18}):r.jsx(S,{size:18,"aria-hidden":"true"})}),y&&r.jsx("p",{role:"alert",className:"absolute bottom-0 left-full z-40 ml-2 w-56 rounded-md bg-menu px-2 py-1 text-[11px] text-danger shadow-lg",children:y}),k&&!y&&r.jsx("p",{role:"status","data-cloud-waking":!0,className:"absolute bottom-0 left-full z-40 ml-2 w-56 rounded-md bg-menu px-2 py-1 text-[11px] text-ink-secondary shadow-lg",children:k})]}):t?r.jsxs("div",{"data-workspace-switcher":"inline",className:"flex min-w-0",children:[r.jsxs("button",{type:"button","aria-label":L,"aria-haspopup":"menu","aria-expanded":g,"data-cloud-home-indicator":a||void 0,"data-tour":"server-switcher",title:_,onClick:T,className:n?"flex h-8 min-w-0 max-w-full items-center gap-1 overflow-hidden rounded-full bg-raised/50 pl-2.5 pr-1.5 text-left text-[13px] font-medium text-ink hover:bg-raised aria-expanded:bg-raised focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"flex h-7 min-w-0 max-w-full items-center gap-1.5 overflow-hidden rounded-md px-1.5 text-left text-[13px] font-medium text-ink hover:bg-control focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",style:{WebkitAppRegion:"no-drag"},children:[ae(m?.color)?r.jsx(se,{color:m?.color,size:16}):r.jsx(S,{size:n?15:14,"aria-hidden":"true","data-switcher-icon":!0,className:n?"hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block":"shrink-0 text-ink-secondary"}),r.jsx("span",{className:n?"min-w-0 truncate @max-[124px]/sidebar-top:hidden":"min-w-0 truncate @max-[96px]/sidebar-top:hidden",children:O}),r.jsx(Ae,{size:n?12:11,"aria-hidden":"true",className:n?"shrink-0 text-ink-tertiary":"shrink-0 text-ink-secondary"})]}),y&&r.jsx("p",{role:"alert",className:"absolute right-2 top-full z-40 mt-1 w-56 max-w-[calc(100%-1rem)] rounded-md bg-menu px-2 py-1 text-[11px] text-danger shadow-lg",children:y}),k&&!y&&r.jsx("p",{role:"status","data-cloud-waking":!0,className:"absolute right-2 top-full z-40 mt-1 w-56 max-w-[calc(100%-1rem)] rounded-md bg-menu px-2 py-1 text-[11px] text-ink-secondary shadow-lg",children:k})]}):r.jsxs("div",{className:$("py-1.5",e?"px-2":"px-3"),children:[r.jsxs("button",{type:"button","aria-label":L,"aria-haspopup":"menu","aria-expanded":g,"data-cloud-home-indicator":a||void 0,"data-tour":"server-switcher",title:_,onClick:T,className:$("flex w-full items-center gap-2 rounded-lg py-2 text-left text-[13px] font-medium text-ink hover:bg-control focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",e?"justify-center px-1":"px-2"),style:{WebkitAppRegion:"no-drag"},children:[ae(m?.color)?r.jsx(se,{color:m?.color,size:20}):r.jsx(S,{size:16,className:"shrink-0 text-ink-secondary"}),!e&&r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[O,a&&p&&r.jsx(Ue,{text:p})]}),r.jsx(Ae,{size:13,className:"shrink-0 text-ink-secondary"})]})]}),y&&r.jsx("p",{role:"alert",className:"mt-1 text-[11px] text-danger",children:y}),k&&!y&&r.jsx("p",{role:"status","data-cloud-waking":!0,className:"mt-1 text-[11px] text-ink-secondary",children:k})]})}function Ln(e){const t=e&&typeof e=="object"?e.membership:void 0,n=t&&typeof t=="object"?t:{};let o=null;if(typeof n.peopleUrl=="string")try{new URL(n.peopleUrl).protocol==="https:"&&(o=n.peopleUrl)}catch{o=null}return{authority:n.authority==="portal"?"portal":"local",pairingCodes:n.pairingCodes!==!1,peopleUrl:o}}const Oo=()=>({type:"toggleAppSettings",open:!0,section:"companion",phonePairing:!0});function Lo(e){const t=typeof window>"u"?void 0:window.ogb;return Rn({companion:!!t?.companion,remoteClient:t?.remoteClient?.active===!0,cloudHome:e})}function Rn(e){return e.cloudHome?"cloud":e.companion&&!e.remoteClient?"computer":"server"}const $n={computer:"sidebar.menu.connectPhone.computer",cloud:"sidebar.menu.connectPhone.cloud",server:"sidebar.menu.connectPhone.server"};function Ro(e,t){const n=t?.session?.kind==="session"?t.session.team?.name:void 0;return n?{target:e,subtitleKey:"sidebar.menu.connectPhone.team",team:n}:e!=="computer"&&!(t&&t.pairingCodes&&tt(t.session))?null:{target:e,subtitleKey:$n[e]}}function $o(e,t){if(!e)return[];const n={...e,id:"here"};return e.target,[n]}let We=null;function Ho(e=fetch){return We??=ne(e).then(async t=>{if(!tt(t))return{session:t,pairingCodes:!1};const n=await e("/api/config",{credentials:"same-origin"}).then(o=>o.ok?o.json():null).catch(()=>null);return{session:t,pairingCodes:Ln(n).pairingCodes}}),We}const Hn="data-phone-pairing-action";function Mo(e,t=n=>window.requestAnimationFrame(n)){return e?(t(()=>{e.scrollIntoView?.({block:"start"}),(e.querySelector(`[${Hn}]:not([disabled])`)??e).focus({preventScroll:!0})}),!0):!1}function Do(e){const t=new URL(e);return t.searchParams.get("desktop-settings")!=="phone"?null:(t.searchParams.delete("desktop-settings"),`${t.pathname}${t.search}${t.hash}`)}function le(e){const t=new URLSearchParams(e);if(t.get("desktop-settings")==="phone")return"/?desktop-settings=phone";const n=t.get("next");return n&&/^\/(?!\/)/.test(n)&&!n.startsWith("/pair")&&!/[\\\s]/.test(n)?n:"/"}const Mn="23456789ABCDEFGHJKLMNPQRSTUVWXYZ",Dn=12,zn="omb_pair_",Bn=/^omb_pair_[A-Za-z0-9_-]{43}$/;function xt(e){return e.toUpperCase().replace(/[^A-Z0-9]/g,"").replace(/0/g,"O").replace(/1/g,"I")}function Fn(e){return xt(e).match(/.{1,4}/g)?.join("-")??e}const Un={emailCode:"serverError.pair.emailCode",oldCode:"serverError.pair.oldCode",scriptKey:"serverError.pair.scriptKey",notACode:"serverError.pair.notACode"};function Wn(e){let t;try{t=new URL(e)}catch{return null}const n=new URLSearchParams(t.hash.replace(/^#/,""));return t.searchParams.get("token")??t.searchParams.get("code")??n.get("code")}function Ne(e){let t=e.trim();if(!t)return{kind:"empty"};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(t)){const a=Wn(t);if(!a)return{kind:"wrong",problem:"notACode"};t=a.trim()}if(t.startsWith("omb_sess_"))return{kind:"wrong",problem:"scriptKey"};if(t.startsWith(zn))return Bn.test(t)?{kind:"credential",credential:t}:{kind:"wrong",problem:"notACode"};const n=t.replace(/[\s-]/g,"");if(/^\d{8}$/.test(n))return{kind:"wrong",problem:"emailCode"};if(/^\d{6}$/.test(n))return{kind:"wrong",problem:"oldCode"};const o=xt(t);return o.length!==Dn||[...o].some(a=>!Mn.includes(a))?{kind:"wrong",problem:"notACode"}:{kind:"code",code:o}}const z="mt-1 w-full rounded-md border border-hairline/40 bg-inset px-3 py-2 text-[14px] text-ink outline-none focus:border-accent-border",Ke="mt-5 w-full rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink disabled:opacity-50",B="mt-4 block text-[12px] font-medium text-ink-secondary";function Kn(e,t=typeof window<"u"&&!!window.ogb?.workspaces){return!!e&&t}function Vn({mode:e,sent:t,email:n,cloudHome:o}){return e==="email"?t?s("pair.intro.emailSent",{email:n}):s("pair.intro.email"):o?s("pair.intro.cloud",{app:H(),open:s("cloudHome.connect"),section:s("settings.section.cloudAccount")}):s("pair.intro.code")}function Xn(e){const t=Ne(e);return t.kind==="wrong"&&t.problem!=="notACode"?s(Un[t.problem]):null}function Gn(e){const t=Ne(e).kind;return t==="code"||t==="credential"}function Yn(e,t){const n=Ne(t),o=n.kind==="code"?`&code=${encodeURIComponent(Fn(n.code))}`:"";return`openmausbot://pair?address=${encodeURIComponent(e)}${o}`}function qn(e){return e.protocol==="http:"&&!Lt(e.hostname)}function Ve(e,t=Xt()){if(!e?.capabilities.cloudTeam||typeof t!="string")return null;try{const n=new URL(t),o=n.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(n.hostname);return(n.protocol==="https:"||o)&&!n.username&&!n.password&&!n.hash?n.href:null}catch{return null}}function Jn(e,t){return e?.capabilities.cloudTeam?e.label:e?.capabilities.cloudHome?s("pair.myCloud"):s(t==="email"?"pair.signInTo":"pair.connectTo",{name:e?.label??s("pair.thisOpenMausBot",{app:H()})})}function Zn({team:e}){return r.jsx("main",{"data-team-left":!0,className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:r.jsx("p",{role:"status",className:"max-w-[420px] text-[16px]",children:s("homeLine.left",{name:e??s("pair.thisOpenMausBot",{app:H()})})})})}function X({initialCode:e,initialEmail:t=null,reason:n}){const[o,a]=u.useState(e??""),[i,c]=u.useState(nt()),[l,x]=u.useState(null),[f,w]=u.useState(null),[m,g]=u.useState(!1),[y,p]=u.useState(null),[k,T]=u.useState(()=>Z()),[E,O]=u.useState(t&&!e?"email":"code"),[S,M]=u.useState(t??""),[_,L]=u.useState(""),[b,j]=u.useState(!1),[oe,gt]=u.useState(()=>Kn(e));u.useEffect(()=>{if(!oe||!e)return;let h=!0;return ue({code:e,label:i,attemptId:k}).then(C=>{if(h){if(C.ok){location.replace(le(location.search));return}gt(!1),p(C.error)}}),()=>{h=!1}},[]),u.useEffect(()=>{fetch("/.well-known/openmausbot/environment").then(h=>h.ok?h.json():null).then(h=>{x(h)}).catch(()=>{x(null)}),ne().then(w)},[]);const re=Gt(f),yt=l?.capabilities.emailSignIn===!0,D=l?.capabilities.cloudHome===!0,kt=!D&&l?.capabilities.cloudTeam!==!0,Ce=Xn(o),W=typeof location<"u"&&typeof location.protocol=="string"?location:null;async function wt(h){h.preventDefault(),g(!0),p(null);const C=await ue({code:o,label:i,attemptId:k});if(g(!1),C.ok){location.replace(le(location.search));return}p(C.error)}async function vt(h){h.preventDefault(),g(!0),p(null);const C=b?await tn({email:S,code:_,label:i}):await en(S);if(g(!1),!C.ok){p(C.error);return}if(b){location.replace(le(location.search));return}j(!0)}function Pe(h){O(h),p(null)}return r.jsxs("main",{className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:[r.jsx("div",{className:"absolute left-3 top-12 max-w-[280px]",children:r.jsx(An,{})}),r.jsxs("div",{className:"w-full max-w-[420px]",children:[W&&qn(W)?r.jsx("p",{role:"alert",className:"mb-4 rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-[13px] text-warning",children:s("pair.notEncrypted")}):null,oe?r.jsx("p",{role:"status",className:"text-[20px] font-semibold",children:D?s("pair.openingCloud"):s("pair.connectingTo",{name:l?.label??s("pair.thisOpenMausBot")})}):r.jsxs(r.Fragment,{children:[r.jsx("h1",{className:"text-[20px] font-semibold",children:Jn(l,E)}),r.jsxs("p",{className:"mt-1.5 text-[14px] leading-relaxed text-ink-secondary",children:[l&&!D?`${s("pair.version",{version:l.version,platform:l.platform})} `:"",Vn({mode:E,sent:b,email:S,cloudHome:D})]}),Le(n)&&!re?r.jsx("p",{className:"mt-3 text-[13px] text-ink-secondary",children:Le(n)}):null,y&&D&&e?r.jsx("p",{className:"mt-3 text-[13px] text-ink-secondary",children:s("pair.expired",{app:H(),open:s("cloudHome.connect"),section:s("settings.section.cloudAccount")})}):null,!re&&Ve(l)?r.jsxs("div",{"data-team-sign-in":!0,className:"mt-4 flex flex-col items-start gap-1.5",children:[r.jsx("a",{href:Ve(l),className:"rounded-md bg-accent px-4 py-2 text-[14px] font-medium text-accent-ink",children:s("pair.team.open",{team:l.label})}),r.jsx("p",{className:"text-[13px] text-ink-secondary",children:s("pair.team.openHint")})]}):null]}),oe?null:re?r.jsxs("p",{className:"mt-4 text-[14px]",children:[s("pair.alreadyConnected")," ",r.jsx("a",{href:"/",className:"text-accent underline",children:s("pair.openApp")})]}):E==="email"?r.jsxs("form",{onSubmit:vt,children:[r.jsx("label",{className:B,htmlFor:"signin-email",children:s("cloudBuy.signIn.email")}),r.jsx("input",{id:"signin-email",type:"email",value:S,onChange:h=>{M(h.target.value),j(!1),L("")},autoComplete:"email",inputMode:"email",spellCheck:!1,className:z}),b?r.jsxs(r.Fragment,{children:[r.jsx("label",{className:B,htmlFor:"signin-code",children:s("pair.emailCode")}),r.jsx("input",{id:"signin-code",value:_,onChange:h=>L(h.target.value),placeholder:"12345678",autoComplete:"one-time-code",inputMode:"numeric",spellCheck:!1,className:`${z} font-mono text-[15px] tracking-[0.12em]`}),r.jsx("label",{className:B,htmlFor:"signin-label",children:s("pair.deviceLabel")}),r.jsx("input",{id:"signin-label",value:i,onChange:h=>c(h.target.value),maxLength:80,className:z})]}):null,y?r.jsx("p",{className:"mt-3 text-[13px] text-danger",children:y}):null,r.jsx("button",{type:"submit",disabled:m||!S.includes("@")||b&&_.replace(/\D/g,"").length<8,className:Ke,children:s(m?b?"pair.signingIn":"pair.sending":b?"pair.signIn":"cloudBuy.signIn.send")}),b?r.jsx("button",{type:"button",onClick:()=>j(!1),className:"mt-3 w-full text-[13px] text-ink-secondary underline",children:s("pair.resend")}):null,r.jsx("button",{type:"button",onClick:()=>Pe("code"),className:"mt-3 w-full text-[13px] text-ink-secondary underline",children:s("pair.useCode")})]}):r.jsxs("form",{onSubmit:wt,children:[r.jsx("label",{className:B,htmlFor:"pair-code",children:s("pair.code")}),r.jsx("input",{id:"pair-code",value:o,onChange:h=>{a(h.target.value),T(Z())},placeholder:"XXXX-XXXX-XXXX","aria-describedby":e&&o===e?"pair-code-from-link":void 0,autoComplete:"one-time-code",autoCapitalize:"characters",spellCheck:!1,className:`${z} font-mono text-[15px] tracking-[0.12em]`}),e&&o===e?r.jsx("p",{id:"pair-code-from-link",className:"mt-1 text-[12px] text-ink-secondary",children:s("pair.fromLink")}):null,r.jsx("label",{className:B,htmlFor:"pair-label",children:s("pair.deviceLabel")}),r.jsx("input",{id:"pair-label",value:i,onChange:h=>c(h.target.value),maxLength:80,className:z}),Ce?r.jsx("p",{role:"alert",className:"mt-3 text-[13px] text-danger",children:Ce}):y?r.jsx("p",{className:"mt-3 text-[13px] text-danger",children:y}):null,r.jsx("button",{type:"submit",disabled:m||!Gn(o),className:Ke,children:s(m?"pair.connecting":"pair.connect")}),W?.origin?r.jsxs("p",{className:"mt-3 text-[13px] text-ink-secondary",children:[s("pair.onPhone")," ",r.jsx("a",{href:Yn(W.origin,o),className:"text-accent underline",children:s("pair.openInApp",{app:H()})})]}):null,kt?r.jsxs("p",{className:"mt-3 text-[13px] text-ink-secondary",children:[s("pair.noCode")," ",r.jsx("code",{className:"select-all rounded bg-inset px-1.5 py-0.5 text-[12px] text-ink",children:"npx limixbot pair"})]}):null,yt?r.jsxs("p",{className:"mt-5 border-t border-hairline/40 pt-4 text-[13px] text-ink-secondary",children:[s("pair.invitedByEmail")," ",r.jsx("button",{type:"button",onClick:()=>Pe("email"),className:"text-accent underline",children:s("pair.useEmail")})]}):null]})]})]})}const zo="cloud-welcome-done",Qn="unauthorized: you are no longer in this team",Xe=[["reserving","cloudHome.step.reserving"],["storage","cloudHome.step.storage"],["starting","cloudHome.step.starting"],["checking","cloudHome.step.checking"]];function eo({step:e}){const t=Xe.findIndex(([n])=>n===e);return r.jsx("ol",{"data-cloud-setup":e,className:"flex flex-col gap-1 text-[13px]",children:Xe.map(([n,o],a)=>r.jsx("li",{"aria-current":a===t?"step":void 0,className:a===t?"font-medium text-ink":a<t?"text-ink-secondary line-through decoration-ink-secondary/40":"text-ink-secondary",children:s(o)},n))})}const to={stopped:"cloudHome.stopped","payment-problem":"cloudHome.paymentProblem",failed:"cloudHome.failed"},Ge={host:"cloudHome.unreachableHost",no_answer:"cloudHome.unreachable"};function no(e,t=Date.now()){const n=new Date(e).getFullYear()!==new Date(t).getFullYear();return new Intl.DateTimeFormat(Rt(),{day:"numeric",month:"long",...n?{year:"numeric"}:{}}).format(new Date(e))}function oo(e,t=Date.now()){const n=e?.name??null,o=(a,i)=>n?s(i,{name:n}):s(a);return e?.screen==="setup"?{title:o("homeScreen.setup","homeScreen.setupNamed"),body:s(e.slow?"cloudHome.slow":"homeScreen.setupBody"),reason:null,action:null,busy:!0}:e?.screen==="offline"?{title:o("homeScreen.offline","homeScreen.offlineNamed"),body:s("homeScreen.offlineBack"),reason:e.cause&&Object.hasOwn(Ge,e.cause)?s(Ge[e.cause]):e.reason??null,action:"retry",busy:!1}:e?.screen==="signin"?{title:o("homeScreen.signIn","homeScreen.signInNamed"),body:s(e.other?"homeScreen.signInOther":"homeScreen.signInEnded"),reason:null,action:"sign-in",busy:!1}:e?.screen==="plan"&&e.member&&e.machine!=="failed"?{title:o("homeScreen.plan","homeScreen.planNamed"),body:s("cloudHome.stoppedMember"),reason:null,action:null,busy:!1}:e?.screen==="plan"?{title:o("homeScreen.plan","homeScreen.planNamed"),body:s(to[e.machine]??"cloudHome.failed"),reason:null,action:e.machine==="failed"?null:"manage",busy:!1}:e?.screen==="ended"?{title:o("cloudHome.ended","cloudHome.endedNamed"),body:e.deleteAt?s("cloudHome.endedFiles",{date:no(e.deleteAt,t)}):null,reason:null,action:"buy",busy:!1}:e?.screen==="checkout"?{title:o("cloudHome.checkout","cloudHome.checkoutNamed"),body:null,reason:null,action:"continue",busy:!1}:e?.screen==="payment"?{title:o("cloudHome.payment","cloudHome.paymentNamed"),body:s("cloudHome.paymentBody"),reason:null,action:"card",busy:!1}:e?.screen==="waking"?{title:s("homeScreen.waking"),body:null,reason:null,action:null,busy:!0}:e?.screen==="moving"?{title:o("homeScreen.moving","homeScreen.movingNamed"),body:null,reason:null,action:null,busy:!0}:{title:o("homeScreen.opening","homeScreen.openingNamed"),body:null,reason:null,action:null,busy:!0}}const ro={retry:"cloudHome.tryAgain",buy:"cloudHome.buyAgain",continue:"cloudHome.continue",card:"cloudHome.updateCard"};function ao({name:e,remove:t}){const[n,o]=u.useState(!1),[a,i]=u.useState(!1),[c,l]=u.useState(null),x=()=>{i(!0),l(null),t().then(f=>{i(!1),f!=="removed"&&f!=="gone"&&(o(!1),l(f==="refused"?"refused":"failed"))},()=>{i(!1),o(!1),l("failed")})};return r.jsxs("div",{"data-home-remove":!0,className:"flex flex-col items-start gap-2",children:[n?r.jsxs("div",{role:"alertdialog","aria-label":s("rail.remove"),className:"flex flex-col gap-2 rounded-xl border border-hairline/70 bg-card/70 px-4 py-3",children:[r.jsx("p",{className:"text-[13px] leading-relaxed text-ink",children:s("rail.removeAsk",{name:e})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{type:"button","data-home-remove-confirm":!0,className:"ui-button ui-button-primary",disabled:a,onClick:x,children:s("rail.removeYes")}),r.jsx("button",{type:"button",className:"ui-button",disabled:a,onClick:()=>o(!1),children:s("rail.removeNo")})]})]}):r.jsx("button",{type:"button","data-home-remove-ask":!0,className:"text-[13px] text-ink-secondary underline-offset-2 hover:text-ink hover:underline",onClick:()=>{l(null),o(!0)},children:s("rail.remove")}),c&&r.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:s(c==="refused"?"rail.removeRefused":"rail.removeFailed")})]})}function so({bridge:e,manage:t}){const[n,o]=u.useState(null),[a,i]=u.useState(!1);u.useEffect(()=>{let g=!0;const y=e.onState(k=>o(k)),p=()=>{e.retry().then(k=>{g&&o(k)}).catch(()=>{})};return e.state().then(k=>{g&&o(k)}).catch(()=>{}).then(p),window.addEventListener("online",p),window.addEventListener("focus",p),()=>{g=!1,y(),window.removeEventListener("online",p),window.removeEventListener("focus",p)}},[e]);const c=oo(n),l=g=>{i(!1),g().catch(()=>i(!0))},x=window.ogb?.cloudAdd?.reopen,f={retry:()=>e.retry().then(g=>o(g)),...t?{manage:t,buy:t,card:t,continue:async()=>{x&&await x().catch(()=>!1)||await t()}}:{}},w=c.action&&c.action!=="sign-in"&&c.action!=="manage"?c.action:null,m=(n?.screen==="ended"||n?.screen==="payment")&&n.removable===!0&&typeof e.remove=="function";return r.jsx("main",{"data-home-screen":n?.screen??"opening",className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",style:{WebkitAppRegion:"drag"},children:r.jsxs("div",{className:"flex w-full max-w-[420px] flex-col items-start gap-3",style:{WebkitAppRegion:"no-drag"},children:[r.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[20px] font-semibold",children:[c.busy&&r.jsx("span",{"aria-hidden":"true",className:"size-3.5 shrink-0 animate-spin rounded-full border-2 border-hairline border-t-accent"}),c.title]}),c.body&&r.jsx("p",{className:"text-[14px] leading-relaxed text-ink-secondary",children:c.body}),n?.screen==="setup"&&r.jsx(eo,{step:n.step??"reserving"}),c.reason&&r.jsx("p",{"data-home-reason":!0,className:"text-[13px] leading-relaxed text-ink-secondary",children:c.reason}),c.action==="sign-in"&&r.jsx("button",{type:"button",className:"ui-button ui-button-primary mt-2",onClick:()=>l(()=>e.signIn()),children:s("homeScreen.signInButton")}),c.action==="manage"&&t&&r.jsx("button",{type:"button",className:"ui-button mt-2",onClick:()=>l(t),children:s("cloudAccount.manageInBrowser")}),w&&f[w]&&r.jsx("button",{type:"button","data-home-action":w,className:w==="retry"?"ui-button mt-2":"ui-button ui-button-primary mt-2",onClick:()=>l(f[w]),children:s(ro[w])}),m&&r.jsx(ao,{name:n.name??s("cloudSetup.myCloud"),remove:()=>e.remove()}),a&&r.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:s("cloudAccount.actionFailed")})]})})}function io({bridge:e,fallback:t}){const[n,o]=u.useState(!1);return u.useEffect(()=>{e.repair().catch(()=>o(!0))},[e]),n?r.jsx(r.Fragment,{children:t}):r.jsx("main",{"data-home-screen":"opening",className:"flex min-h-screen items-center justify-center bg-app px-6 text-ink",children:r.jsx("p",{role:"status",className:"w-full max-w-[420px] text-[20px] font-semibold",children:s("homeScreen.opening")})})}const Ee="omb.session-ended";let he=!1,ce=null;const xe=new Set;function Bo(){he||ce||(ce=ne().then(e=>{if(e.kind==="unauthenticated"){he=!0;try{sessionStorage.setItem(Ee,"1")}catch{}for(const t of xe)t()}}).finally(()=>{ce=null}))}function Ye(){return he}function Fo(){return u.useSyncExternalStore(e=>(xe.add(e),()=>xe.delete(e)),Ye,Ye)}function lo(){try{return sessionStorage.getItem(Ee)==="1"}catch{return!1}}function co(){try{sessionStorage.removeItem(Ee)}catch{}}$t();ge(Ht());Mt(Dt());nn();zt(Bt());wn();const J=Ft(),uo=new Set(["/home","/pair","/desktop-viewer"]),bt=()=>Qe(()=>import("./App-CTks_6Oy.js").then(e=>e.jV),__vite__mapDeps([0,1,2,3,4,5])).catch(e=>({default:()=>{throw e}})),mo=uo.has(location.pathname)?null:bt(),po=()=>fetch("/.well-known/openmausbot/environment").then(e=>e.json()).then(e=>e.capabilities?.cloudTeam===!0&&typeof e.label=="string"?e.label:null,()=>null);async function fo(){const e=window.ogb?.home;if(location.pathname==="/home"&&e)return r.jsx(so,{bridge:e,manage:window.ogb?.cloudPlan?.manage});if(location.pathname==="/pair"){const o=qt();if(o){const a=await Zt(o);return await J,a?r.jsx(vn,{credential:o,owner:a.owner,team:a.team}):r.jsx(X,{initialCode:null,reason:s("pair.browser.signInFailed")})}return r.jsx(X,{initialCode:Yt(),initialEmail:Jt()})}const t=await ne();if(t.kind==="unauthenticated"){if(await J,t.error===Qn)return r.jsx(Zn,{team:await po()});const o=r.jsx(X,{initialCode:null,reason:lo()?s("pair.sessionEnded"):t.error});return e?r.jsx(io,{bridge:e,fallback:o}):o}if(co(),t.kind==="session"&&Vt(t.teamSignIn),t.kind==="loopback"&&t.trust==="service")return await J,r.jsx(X,{initialCode:null,reason:s("pair.serviceTrust")});if(location.pathname==="/desktop-viewer"){const{DesktopViewer:o}=await Qe(async()=>{const{DesktopViewer:a}=await import("./DesktopViewer-ibFgMuIw.js");return{DesktopViewer:a}},__vite__mapDeps([6,1,2,7,8,5,4,9]));return r.jsx(o,{})}const{default:n}=await(mo??bt());return we(),r.jsx(n,{})}document.title=H();Promise.all([Ut(),fo(),J]).then(([,e])=>{Wt.createRoot(document.getElementById("root")).render(r.jsx(u.StrictMode,{children:r.jsx(Kt,{children:e})}))});export{Po as A,bo as B,eo as C,Co as D,No as E,En as F,An as G,To as H,_o as I,Sn as J,de as K,Eo as L,zo as M,Fo as N,X as O,Io as P,Do as Q,Nn as S,at as T,Ln as a,Mo as b,xn as c,yn as d,jo as e,So as f,Lo as g,vo as h,tt as i,jn as j,Se as k,we as l,$o as m,Bo as n,Pn as o,Oo as p,xo as q,ne as r,wo as s,go as t,yo as u,Ho as v,ko as w,Ro as x,_n as y,Ao as z};
|