|
|
import{d as T,aq as re,ay as Z,i as _,a7 as le,c as p,a as P,o as a,b as r,F as z,s as F,n as M,u as s,t as x,q as A,a6 as ae,e as S,w as C,y as X,r as L,M as Q,T as E,ak as Y,az as ue,av as se,Y as de,aA as H,aa as ce,p as D,S as ne,f as ee,U as q,a3 as oe,aB as pe,ax as K,A as G,aj as te,a8 as he,aC as fe,aD as me,aw as ve,a1 as ye,z as ge,B as be,at as we,V as _e}from"./index-CtdYRAx7.js";import{_ as $e}from"./SectionBlock-BrHcKx8P.js";import{_ as xe}from"./IconTitle.vue_vue_type_script_setup_true_lang-B9Nj8PlY.js";const ke={key:0,relative:"","code-block":""},Be={flex:"~ wrap","w-full":""},Ae=["onClick"],Ce={flex:"~ gap-2",px3:"",pb3:""},Pe=T({__name:"CodeSnippets",props:{codeSnippets:{},eventType:{}},setup(f){const n=f,e=re(n.codeSnippets[0]),{copy:t}=Z(),i=_(()=>e.value?.lang||"text");return le(()=>{n.codeSnippets.includes(e.value)||(e.value=n.codeSnippets[0])}),(o,l)=>o.codeSnippets.length?(a(),p("div",ke,[r("div",Be,[(a(!0),p(z,null,F(o.codeSnippets,(d,m)=>(a(),p("button",{key:m,px4:"",py2:"",border:"r base",hover:"bg-active",class:M(d===s(e)?"":"border-b"),onClick:v=>e.value=d},[r("div",{class:M(d===s(e)?"":"op30"),"font-mono":""},x(d.name),3)],10,Ae))),128)),l[1]||(l[1]=r("div",{border:"b base","flex-auto":""},null,-1))]),s(e)?(a(),p(z,{key:0},[A(s(ae),{code:s(e).code,lang:s(i),lines:!1,"w-full":"","of-auto":"",p3:""},null,8,["code","lang"]),r("div",Ce,[A(s(Q),{onClick:l[0]||(l[0]=d=>s(t)(s(e).code,{silent:!1,type:o.eventType||`code-snippet-${s(e).name}`}))},{icon:C(()=>[L(o.$slots,"i-carbon-copy")]),default:C(()=>[l[2]||(l[2]=X(" Copy ",-1))]),_:3}),s(e)?.docs?(a(),S(s(Q),{key:0,to:s(e).docs,target:"_blank"},{icon:C(()=>[L(o.$slots,"i-carbon-catalog")]),default:C(()=>[l[3]||(l[3]=X(" Docs ",-1))]),_:3},8,["to"])):P("",!0)])],64)):P("",!0)])):P("",!0)}}),Se=["title"],ze=T({__name:"FilepathItem",props:{filepath:{},lineBreak:{type:Boolean},subpath:{type:Boolean}},setup(f){const n=f,e=_(()=>({path:n.filepath})),{copy:t}=Z();return(i,o)=>E((a(),p("button",{"font-mono":"","hover:underline":"",class:M(i.lineBreak?"":"ws-nowrap of-hidden truncate"),title:i.filepath,onClick:o[0]||(o[0]=l=>s(t)(i.filepath))},[X(x(s(e).path),1)],10,Se)),[[s(Y),"Copy file path"]])}});function je(f){return typeof f=="string"?`'${f}'`:new Ve().serialize(f)}const Ve=(function(){class f{#e=new Map;compare(e,t){const i=typeof e,o=typeof t;return i==="string"&&o==="string"?e.localeCompare(t):i==="number"&&o==="number"?e-t:String.prototype.localeCompare.call(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return"null";switch(typeof e){case"string":return t?e:`'${e}'`;case"bigint":return`${e}n`;case"object":return this.$object(e);case"function":return this.$function(e)}return String(e)}serializeObject(e){const t=Object.prototype.toString.call(e);if(t!=="[object Object]")return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);const i=e.constructor,o=i===Object||i===void 0?"":i.name;if(o!==""&&globalThis[o]===i)return this.serializeBuiltInType(o,e);if(typeof e.toJSON=="function"){const l=e.toJSON();return o+(l!==null&&typeof l=="object"?this.$object(l):`(${this.serialize(l)})`)}return this.serializeObjectEntries(o,Object.entries(e))}serializeBuiltInType(e,t){const i=this["$"+e];if(i)return i.call(this,t);if(typeof t?.entries=="function")return this.serializeObjectEntries(e,t.entries());throw new Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){const i=Array.from(t).sort((l,d)=>this.compare(l[0],d[0]));let o=`${e}{`;for(let l=0;l<i.length;l++){const[d,m]=i[l];o+=`${this.serialize(d,!0)}:${this.serialize(m)}`,l<i.length-1&&(o+=",")}return o+"}"}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){const t=Function.prototype.toString.call(e);return t.slice(-15)==="[native code] }"?`${e.name||""}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,"")}`}$Array(e){let t="[";for(let i=0;i<e.length;i++)t+=this.serialize(e[i]),i<e.length-1&&(t+=",");return t+"]"}$Date(e){try{return`Date(${e.toISOString()})`}c @font-face { font-family: '${e.value}'; src: url('${n.asset.publicPath}'); }`)),(t,i)=>(a(),p("div",{"of-hidden":"",style:se({fontFamily:`'${s(e)}'`})}," Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz ",4))}}),Me={flex:"","items-center":"","justify-center":"","of-hidden":"","bg-active":"","object-cover":"",p1:""},Le=["src"],Re={key:2,"i-carbon-document":"","text-3xl":"",op20:""},Ne={key:3,"w-full":"","self-start":"",p4:""},qe=["textContent"],Ge={key:4},Je=["src","autoplay","controls"],Xe={key:5},Ke={key:0,"i-carbon-volume-up":"","text-3xl":"",op20:""},We=["src"],Ye={key:6,"i-vscode-icons-file-type-wasm":"","text-3xl":""},He={key:7,"i-carbon-help":"","text-3xl":"",op20:""},ie=T({__name:"AssetPreview",props:{asset:{},textContent:{},detail:{type:Boolean}},setup(f){return(n,e)=>{const t=Ee;return a(),p("div",Me,[n.asset.type==="image"?(a(),p("img",{key:0,src:n.asset.publicPath},null,8,Le)):n.asset.type==="font"?(a(),S(t,{key:n.asset.publicPath,asset:n.asset,"self-stretch":"",p2:"","text-2xl":""},null,8,["asset"])):n.asset.type==="text"&&!n.textContent?(a(),p("div",Re)):n.asset.type==="text"&&n.textContent?(a(),p("div",Ne,[r("pre",{"max-h-10rem":"","of-hidden":"","text-xs":"","font-mono":"",textContent:x(n.textContent)},null,8,qe)])):n.asset.type==="video"?(a(),p("div",Ge,[r("video",{src:n.asset.publicPath,autoplay:n.detail,controls:n.detail},null,8,Je)])):n.asset.type==="audio"?(a(),p("div",Xe,[n.detail?(a(),p("audio",{key:1,src:n.asset.publicPath,controls:""},null,8,We)):(a(),p("div",Ke))])):n.asset.type==="wasm"?(a(),p("div",Ye)):(a(),p("div",He))])}}}),Qe={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p4:""},Ze={flex:"~","items-center":"","justify-center":""},et={"max-w-full":"","w-full":"","table-fixed":""},tt={flex:"~ gap-1","w-full":"","items-center":""},st={flex:"~ gap-1","w-full":"","items-center":"","of-hidden":""},nt={"flex-auto":"","of-hidden":"",truncate:"","ws-pre":"","font-mono":""},ot={capitalize:""},it={key:0},rt={op70:""},lt={flex:"~ gap2 wrap"},at=T({__name:"AssetDetails",props:{modelValue:{}},setup(f,{emit:n}){const e=f,t=n,i=de(),o=ne(e,"modelValue",t,{passive:!0}),l=_(()=>i.vitePluginDetected.value),d=H(()=>K.value.getAssetImporters(o.value.publicPath).then(c=>c),[]),m=_(()=>ce.value),v=H(()=>{if(o.value.type==="image")return K.value.getImageMeta(o.value.filePath).then(c=>c)}),j=D(),V=D(0),w=H(async()=>{if(o.value.type!=="text")return;V.value;const c=await K.value.getTextAssetContent(o.value.filePath).then(u=>u);return j.value=c,c}),U=_(()=>{const c=[];if(o.value.type==="image"){const u=v.value?.width?` width="${v.value.width}" height="${v.value.height}" `:" ";return c.push({lang:"vue-html",code:`<img${u} src="${o.value.publicPath}"/>`,name:"Plain Image"}),c}return c.push({lang:"html",code:`<a download href="${o.value.publicPath}"> Download ${o.value.path.split("/").slice(-1)[0]}</a>`,name:"Download link"}),c}),{copy:W}=Z(),g=pe(()=>o.value.mtime),h=_(()=>{const c=o.value.size;return c<1024?`${c} B`:c<1024*1024?`${(c/1024).toFixed(2)} KB`:`${(c/1024/1024).toFixed(2)} MB`}),y=_(()=>{if(!v.value?.width||!v.value?.height)return"";const c=($,k)=>k?c(k,$%k):$,u=c(v.value.width,v.value.height);return u>3?`${v.value.width/u}:${v.value.height/u}`:""}),I=_(()=>["image","text","video","audio","font"].includes(o.value.type));return(c,u)=>{const $=ie,k=ze,R=oe("RouterLink"),b=Pe;return a(),p("div",Qe,[s(I)?(a(),p(z,{key:0},[u[2]||(u[2]=r("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[r("div",{"x-divider":""}),r("div",{"flex-none":""}," Preview "),r("div",{"x-divider":""})],-1)),r("div",Ze,[A($,{detail:"","max-h-80":"","min-h-20":"","min-w-20":"","w-auto":"",rounded:"",border:"~ base",asset:s(o),"text-content":s(w)},null,8,["asset","text-content"])])],64)):P("",!0),u[12]||(u[12]=r("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[r("div",{"x-divider":""}),r("div",{"flex-none":""}," Details "),r("div",{"x-divider":""})],-1)),r("table",et,[r("tbody",null,[r("tr",null,[u[3]||(u[3]=r("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Filepath ",-1)),r("td",null,[r("div",tt,[A(k,{filepath:s(o).filePath,"text-left":""},null,8,["filepath"]),s(l)&&s(m)?E((a(),S(s(q),{key:0,title:"Open in Editor",icon:"i-carbon-launch",action:"","flex-none":"",border:!1,onClick:u[0]||(u[0]=B=>s(ee)(s(o).filePath))},null,512)),[[s(Y),"Open in Editor"]]):P("",!0)])])]),r("tr",null,[u[4]||(u[4]=r("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Public Path ",-1)),r("td",null,[r("div",st,[r("div",nt,x(s(o).publicPath),1),E(A(s(q),{title:"Copy public path",icon:"i-carbon-copy",action:"",mr1:"","mt--2px":"","flex-none":"",border:!1,onClick:u[1]||(u[1]=B=>s(W)(s(o).publicPath,{type:"assets-public-path"}))},null,512),[[s(Y),"Copy public path"]]),A(R,{to:s(o).publicPath,target:"_blank"},{default:C(()=>[E(A(s(q),{icon:"i-carbon-launch",action:"","flex-none":"",border:!1,title:"Open in Browser"},null,512),[[s(Y),"Open in Browser"]])]),_:1},8,["to"])])])]),r("tr",null,[u[5]||(u[5]=r("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Type ",-1)),r("td",ot,x(s(o).type),1)]),s(v)?.width?(a(),p(z,{key:0},[r("tr",null,[u[6]||(u[6]=r("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Image Size ",-1)),r("td",null,x(s(v).width)+" x "+x(s(v).height),1)]),s(y)?(a(),p("tr",it,[u[7]||(u[7]=r("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Aspect Ratio ",-1)),r("td",null,x(s(y)),1)])):P("",!0)],64)):P("",!0),r("tr",null,[u[8]||(u[8]=r("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," File size ",-1)),r("td",null,x(s(h)),1)]),r("tr",null,[u[9]||(u[9]=r("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Last modified ",-1)),r("td",null,[X(x(new Date(s(o).mtime).toLocaleString())+" ",1),r("span",rt,"("+x(s(g))+")",1)])]),r("tr",null,[u[10]||(u[10]=r("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"","align-top":"",op50:""}," Importers ",-1)),r("td",null,[s(d).length>0?(a(!0),p(z,{key:0},F(s(d),B=>(a(),p("div",{key:B.url,flex:"~ gap-1","w-full":"","items-center":""},[A(k,{filepath:B.id||B.url,"text-left":""},null,8,["filepath"]),s(i).vitePluginDetected.value&&s(m)&&B.id?E((a(),S(s(q),{key:0,title:"Open in Editor",icon:"i-carbon-launch",action:"","flex-none":"",border:!1,onClick:N=>s(ee)(B.id)},null,8,["onClick"])),[[s(Y),"Open in Editor"]]):P("",!0)]))),128)):(a(),p(z,{key:1},[X(" None ")],64))])])])]),u[13]||(u[13]=r("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[r("div",{"x-divider":""}),r("div",{"flex-none":""}," Actions "),r("div",{"x-divider":""})],-1)),r("div",lt,[A(s(Q),{to:s(o).publicPath,download:"",target:"_blank"},{icon:C(()=>[L(c.$slots,"i-carbon-download")]),default:C(()=>[u[11]||(u[11]=X(" Download ",-1))]),_:3},8,["to"])]),u[14]||(u[14]=r("div",{"flex-auto":""},null,-1)),s(U).length?(a(),S(b,{key:1,border:"t base","mx--4":"","mb--4":"","code-snippets":s(U)},null,8,["code-snippets"])):P("",!0)])}}}),ut=T({
|