import{s as f}from"./chunk-LvLJmgfZ.js";import{t as w}from"./react-Bj1aDYRI.js";import{t as y}from"./compiler-runtime-B3qBwwSJ.js";import{_ as c,p as u}from"./useEventListener-BakX-tnw.js";import{r as v}from"./constants-B9JJ72XE.js";import{T as h}from"./config-BE150fVL.js";import{t as x}from"./createLucideIcon-BTp1tQDO.js";var S=x("case-sensitive",[["path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16",key:"d5nyq2"}],["path",{d:"M22 9v7",key:"pvm9v3"}],["path",{d:"M3.304 13h6.392",key:"1q3zxz"}],["circle",{cx:"18.5",cy:"12.5",r:"3.5",key:"z97x68"}]]),g=f(w(),1);const _=e=>{let t=null,n=async()=>(t||(t=e()),t);return{preload:n,Component:g.lazy(()=>n())}},k=typeof window<"u"&&window.parent!==window;function E(){new URLSearchParams(window.location.search).has(v.vscode)&&(!k||h()||(c.log("[vscode] Registering VS Code bindings"),L(),b(),C(),K()))}function b(){window.addEventListener("copy",()=>{var e;i({command:"copy",text:((e=window.getSelection())==null?void 0:e.toString())??""})}),window.addEventListener("cut",()=>{var t;let e=((t=window.getSelection())==null?void 0:t.toString())??"";u()&&document.execCommand("insertText",!1,""),i({command:"cut",text:e})}),window.addEventListener("message",async e=>{try{let t=e.data,n=u();switch(t.command){case"paste":if(c.log(`[vscode] Received paste mac=${n}`,t),n){let a=document.activeElement;if(!a){c.warn("[vscode] No active element to paste into"),document.execCommand("insertText",!1,t.text);return}let s=new DataTransfer;s.setData("text/plain",t.text),a.dispatchEvent(new ClipboardEvent("paste",{clipboardData:s}))}else c.log("[vscode] Not pasting on mac");return}}catch(t){c.error("Error in paste message handler",t)}})}function L(){document.addEventListener("keydown",e=>{var t,n;if((e.ctrlKey||e.metaKey)&&e.key==="c"){let a=((t=window.getSelection())==null?void 0:t.toString())??"";c.log("[vscode] Sending copy",a),i({command:"copy",text:a});return}if((e.ctrlKey||e.metaKey)&&e.key==="x"){let a=((n=window.getSelection())==null?void 0:n.toString())??"";u()&&document.execCommand("insertText",!1,""),c.log("[vscode] Sending cut",a),i({command:"cut",text:a});return}if((e.ctrlKey||e.metaKey)&&e.key==="v"){c.log("[vscode] Sending paste"),i({command:"paste"});return}})}function C(){document.addEventListener("click",e=>{let t=e.target;if(t.tagName!=="A")return;let n=t.getAttribute("href");n&&(n.startsWith("http://")||n.startsWith("https://"))&&(e.preventDefault(),i({command:"external_link",url:n}))})}function K(){document.addEventListener("contextmenu",e=>{e.preventDefault(),i({command:"context_menu"})})}function i(e){var t;(t=window.parent)==null||t.postMessage(e,"*")}var T=y();function D(e){let t=(0,T.c)(6),[n,a]=(0,g.useState)(e),s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o=>{var r;(r=o==null?void 0:o.stopPropagation)==null||r.call(o),a(!0)},t[0]=s):s=t[0];let m;t[1]===Symbol.for("react.memo_cache_sentinel")?(m=o=>{var r;(r=o==null?void 0:o.stopPropagation)==null||r.call(o),a(!1)},t[1]=m):m=t[1];let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=o=>{var r;(r=o==null?void 0:o.stopPropagation)==null||r.call(o),a(z)},t[2]=d):d=t[2];let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l={setTrue:s,setFalse:m,toggle:d},t[3]=l):l=t[3];let p;return t[4]===n?p=t[5]:(p=[n,l],t[4]=n,t[5]=p),p}function z(e){return!e}export{S as a,_ as i,E as n,i as r,D as t};
