import{_ as g,d as y,k as c,s as S,C as w,o as l,c as p,f as k,w as x,h as B,D as T,a as C,b as f,j as I,i as $}from"./entry-d195bacb.mjs";import{u as j}from"./composables-6b84c7c1.mjs";const N=y({name:"Sandbox",props:{src:{type:String,default:""},repo:{type:String,default:""},branch:{type:String,default:""},dir:{type:String,default:""},file:{type:String,default:"app.vue"}},setup(u,{expose:_}){_();const e=u,t=j(),o={CodeSandBox:()=>`https://codesandbox.io/embed/github/${e.repo}/tree/${e.branch}/${e.dir}?hidenavigation=1&theme=${t.value}`,StackBlitz:()=>`https://stackblitz.com/github/${e.repo}/tree/${e.branch}/${e.dir}?embed=1&file=${e.file}&theme=${t.value}`},d=Object.keys(o).map(a=>({label:a})),r=c(-1),i=c(),s=c(""),n=c(""),b=a=>{n.value=a,s.value=e.src||o[n.value](),localStorage.setItem("docus_sandbox",a)},v=S(()=>{var a;return(a=s.value)==null?void 0:a.replace("?embed=1&","?").replace("/embed/","/s/")}),h=a=>{r.value=a,b(d[a].label)};w(()=>{n.value=window.localStorage.getItem("docus_sandbox")||"CodeSandBox",s.value=e.src||o[n.value](),r.value=Object.keys(o).indexOf(n.value)});const m={props:e,colorMode:t,providers:o,providersTabs:d,activeTabIndex:r,tabs:i,url:s,provider:n,changeProvider:b,sandBoxUrl:v,updateTab:h};return Object.defineProperty(m,"__isScriptSetup",{enumerable:!1,value:!0}),m}}),O={class:"sandbox my-4 min-h-[500px] w-full"},M={class:"absolute top-1/2 right-0 -translate-y-1/2 transform px-4"},U=["src"],V={key:2,class:"flex-1 text-white"};function z(u,_,e,t,o,d){const r=I,i=$,s=T;return l(),p("div",O,[e.src?B("",!0):(l(),k(s,{key:0,ref:"tabs","active-tab-index":t.activeTabIndex,tabs:t.providersTabs,"onUpdate:activeTabIndex":t.updateTab},{footer:x(()=>[C("div",M,[f(i,{class:"flex text-secondary hover:text-secondary-hover transition-colors transition-base items-center text-gray-500 dark:text-gray-400",to:t.sandBoxUrl,target:"_blank"},{default:x(()=>[f(r,{name:"heroicons-outline:arrows-expand",class:"h-6 w-6"})]),_:1},8,["to"])])]),_:1},8,["active-tab-index","tabs"])),t.url?(l(),p("iframe",{key:1,src:t.url,title:"Sandbox editor",sandbox:"allow-modals allow-forms allow-popups allow-scripts allow-same-origin",class:"h-full min-h-[700px] w-full overflow-hidden"},null,8,U)):(l(),p("span",V,"Loading Sandbox..."))])}var D=g(N,[["render",z],["__scopeId","data-v-90a199c8"]]);export{D as default};
