import{k as Je,j as l,t as Ke,h as Qe,m as v,n as be,p as i,f as C,i as n,v as Ve,A as m,z as r,y as K,x as d,s as We,S as z,w as fe}from"./web.Os7kOAdY.js";import{c as Xe}from"./clipboard.BNxbz_oK.js";import{g as me,t as Ye}from"./i18n-runtime._BAkvU05.js";var Ze=m('<img alt="OG Preview"style=width:100%;height:100%;object-fit:cover>'),et=m('<div style="background:#242526;border-radius:8px;overflow:hidden;max-width:500px;border:1px solid #3a3b3c"><div style=width:100%;height:260px;background:#3a3b3c;display:flex;align-items:center;justify-content:center;overflow:hidden></div><div style="padding:10px 12px"><p style="color:#b0b3b8;font-size:12px;margin:0 0 2px;text-transform:uppercase"></p><p style="color:#e4e6eb;font-size:16px;font-weight:bold;margin:0 0 4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"></p><p style=color:#b0b3b8;font-size:14px;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap>'),tt=m('<img alt="Twitter Preview"style=width:100%;height:100%;object-fit:cover>'),it=m('<div style="background:#15202b;border-radius:12px;overflow:hidden;max-width:500px;border:1px solid #38444d"><div style=width:100%;height:250px;background:#192734;display:flex;align-items:center;justify-content:center;overflow:hidden></div><div style="padding:10px 12px"><p style="color:#8899a6;font-size:13px;margin:0 0 2px"></p><p style="color:#fff;font-size:15px;font-weight:bold;margin:0 0 4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"></p><p style=color:#8899a6;font-size:14px;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap>'),rt=m('<div style=display:flex;flex-direction:column;gap:20px><div class=mobile-stack-grid style="display:grid;grid-template-columns:1fr 1fr;gap:14px"><div><label></label><input type=text></div><div><label></label><input type=text></div><div style="grid-column:1 / -1"><label></label><textarea rows=2 style=resize:vertical></textarea></div><div><label></label><input type=text></div><div><label></label><input type=text></div><div><label>OG Type</label><select><option value=website>website</option><option value=article>article</option><option value=profile>profile</option><option value=product>product</option></select></div><div><label></label><select><option value=summary_large_image>summary_large_image</option><option value=summary>summary</option><option value=player>player</option></select></div><div><label>Twitter @site</label><input type=text></div></div><div style="border:1px solid #333;border-radius:8px;padding:16px;background:#0d0d1a"><div style=display:flex;gap:8px;margin-bottom:12px><button style="padding:4px 12px;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:12px">Facebook</button><button style="padding:4px 12px;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:12px">Twitter</button></div><!$><!/><!$><!/></div><div style=position:relative><pre style=background:#111;color:#0f0;padding:14px;border-radius:8px;font-size:12px;overflow:auto;margin:0;white-space:pre-wrap></pre><button style="position:absolute;top:8px;right:8px;padding:4px 10px;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:12px">'),he=m("<span style=color:#888>No Image");function at(){const[ye,Q]=l(me(),{equals:!1}),x=t=>Ye(t,ye());Ke(()=>{const t=T=>{const y=T.detail?.locale;y&&Q(y)};window.addEventListener("taitan:locale-change",t),Q(me()),We(()=>window.removeEventListener("taitan:locale-change",t))});const[b,we]=l("My Awesome Page"),[f,$e]=l("A description of my page that will appear in search results and social shares."),[p,_e]=l("https://example.com/og-image.jpg"),[L,Se]=l("MySite"),[h,Te]=l("https://example.com/page"),[V,ke]=l("website"),[W,Ce]=l("summary_large_image"),[E,ze]=l("@mysite"),[X,Y]=l(!1),[S,Z]=l("facebook"),ee=Qe(()=>{const t=[];return t.push("<!-- Primary Meta Tags -->"),t.push(`<title>${b()}</title>`),t.push(`<meta name="description" content="${f()}" />`),t.push(""),t.push("<!-- Open Graph / Facebook -->"),t.push(`<meta property="og:type" content="${V()}" />`),t.push(`<meta property="og:url" content="${h()}" />`),t.push(`<meta property="og:title" content="${b()}" />`),t.push(`<meta property="og:description" content="${f()}" />`),t.push(`<meta property="og:image" content="${p()}" />`),L()&&t.push(`<meta property="og:site_name" content="${L()}" />`),t.push(""),t.push("<!-- Twitter -->"),t.push(`<meta property="twitter:card" content="${W()}" />`),t.push(`<meta property="twitter:url" content="${h()}" />`),t.push(`<meta property="twitter:title" content="${b()}" />`),t.push(`<meta property="twitter:description" content="${f()}" />`),t.push(`<meta property="twitter:image" content="${p()}" />`),E()&&t.push(`<meta property="twitter:site" content="${E()}" />`),t.join(`
`)});async function Le(){await Xe(ee()),Y(!0),setTimeout(()=>Y(!1),1500)}const a={width:"100%",padding:"8px 10px",background:"#1a1a2e",color:"#fff",border:"1px solid #444","border-radius":"4px","font-size":"13px"},s={color:"#aaa","font-size":"12px",display:"block","margin-bottom":"4px"};return(()=>{var t=v(rt),T=t.firstChild,y=T.firstChild,j=y.firstChild,M=j.nextSibling,te=y.nextSibling,P=te.firstChild,U=P.nextSibling,ie=te.nextSibling,N=ie.firstChild,O=N.nextSibling,re=ie.nextSibling,R=re.firstChild,A=R.nextSibling,le=re.nextSibling,G=le.firstChild,I=G.nextSibling,ne=le.nextSibling,oe=ne.firstChild,D=oe.nextSibling,ae=ne.nextSibling,F=ae.firstChild,q=F.nextSibling,Ee=ae.nextSibling,se=Ee.firstChild,H=se.nextSibling,k=T.nextSibling,de=k.firstChild,B=de.firstChild,pe=B.nextSibling,je=de.nextSibling,[ce,Me]=be(je.nextSibling),Pe=ce.nextSibling,[Ue,Ne]=be(Pe.nextSibling),Oe=k.nextSibling,ue=Oe.firstChild,J=ue.nextSibling;return i(j,()=>x("标题 (Title)")),M.$$input=e=>we(e.currentTarget.value),i(P,()=>x("站点名 (Site Name)")),U.$$input=e=>Se(e.currentTarget.value),i(N,()=>x("描述 (Description)")),O.$$input=e=>$e(e.currentTarget.value),i(R,()=>x("页面 URL")),A.$$input=e=>Te(e.currentTarget.value),i(G,()=>x("图片 URL (OG Image)")),I.$$input=e=>_e(e.currentTarget.value),D.addEventListener("change",e=>ke(e.currentTarget.value)),i(F,()=>x("Twitter Card 类型")),q.addEventListener("change",e=>Ce(e.currentTarget.value)),H.$$input=e=>ze(e.currentTarget.value),B.$$click=()=>Z("facebook"),pe.$$click=()=>Z("twitter"),i(k,C(z,{get when(){return S()==="facebook"},get children(){var e=v(et),c=e.firstChild,w=c.nextSibling,u=w.firstChild,g=u.nextSibling,$=g.nextSibling;return i(c,C(z,{get when(){return p()},get fallback(){return v(he)},get children(){var o=v(Ze);return o.addEventListener("error",_=>{_.currentTarget.style.display="none"}),n(()=>fe(o,"src",p())),o}})),i(u,()=>new URL(h()||"https://example.com").hostname),i(g,b),i($,f),e}}),ce,Me),i(k,C(z,{get when(){return S()==="twitter"},get children(){var e=v(it),c=e.firstChild,w=c.nextSibling,u=w.firstChild,g=u.nextSibling,$=g.nextSibling;return i(c,C(z,{get when(){return p()},get fallback(){return v(he)},get children(){var o=v(tt);return o.addEventListener("error",_=>{_.currentTarget.style.display="none"}),n(()=>fe(o,"src",p())),o}})),i(u,()=>new URL(h()||"https://example.com").hostname),i(g,b),i($,f),e}}),Ue,Ne),i(ue,ee),J.$$click=Le,i(J,()=>X()?"已复制":"复制"),n(e=>{var c=s,w=a,u=s,g=a,$=s,o={...a},_=s,Re=a,Ae=s,Ge=a,Ie=s,De=a,Fe=s,qe=a,He=s,Be=a,ge=S()==="facebook"?"#1877f2":"#222",ve=S()==="twitter"?"#1da1f2":"#222",xe=X()?"#2d5a27":"#333";return e.e=r(j,c,e.e),e.t=r(M,w,e.t),e.a=r(P,u,e.a),e.o=r(U,g,e.o),e.i=r(N,$,e.i),e.n=r(O,o,e.n),e.s=r(R,_,e.s),e.h=r(A,Re,e.h),e.r=r(G,Ae,e.r),e.d=r(I,Ge,e.d),e.l=r(oe,Ie,e.l),e.u=r(D,De,e.u),e.c=r(F,Fe,e.c),e.w=r(q,qe,e.w),e.m=r(se,He,e.m),e.f=r(H,Be,e.f),ge!==e.y&&K(B,"background",e.y=ge),ve!==e.g&&K(pe,"background",e.g=ve),xe!==e.p&&K(J,"background",e.p=xe),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0,m:void 0,f:void 0,y:void 0,g:void 0,p:void 0}),n(()=>d(M,"value",b())),n(()=>d(U,"value",L())),n(()=>d(O,"value",f())),n(()=>d(A,"value",h())),n(()=>d(I,"value",p())),n(()=>d(D,"value",V())),n(()=>d(q,"value",W())),n(()=>d(H,"value",E())),Ve(),t})()}Je(["input","click"]);export{at as default};
