import{k as me,j as o,t as he,m as S,n as L,p as n,q as N,i as c,v as I,A as R,x as p,s as Se}from"./web.Os7kOAdY.js";import{g as Z,t as we}from"./i18n-runtime._BAkvU05.js";var Te=R('<div style=max-width:640px><div style=display:grid;gap:12px><div><label style=font-weight:600;display:block;margin-bottom:4px></label><input type=text style="width:100%;padding:8px 10px;border-radius:6px;border:1px solid var(--border,#444);background:var(--bg,#1a1a2e);color:var(--text,#eee);font-size:14px"></div><div><label style=font-weight:600;display:block;margin-bottom:4px></label><input type=text style="width:100%;padding:8px 10px;border-radius:6px;border:1px solid var(--border,#444);background:var(--bg,#1a1a2e);color:var(--text,#eee);font-size:14px"></div><div><label style=font-weight:600;display:block;margin-bottom:4px></label><textarea rows=3 style="width:100%;padding:8px 10px;border-radius:6px;border:1px solid var(--border,#444);background:var(--bg,#1a1a2e);color:var(--text,#eee);font-size:14px;resize:vertical"></textarea></div><div style=display:flex;align-items:center;gap:8px><input type=checkbox id=allday><label for=allday></label></div><div class=mobile-stack-grid style="display:grid;grid-template-columns:1fr 1fr;gap:12px"><div><label style=font-weight:600;display:block;margin-bottom:4px></label><input type=date style="width:100%;padding:8px 10px;border-radius:6px;border:1px solid var(--border,#444);background:var(--bg,#1a1a2e);color:var(--text,#eee);font-size:14px"></div><!$><!/><div><label style=font-weight:600;display:block;margin-bottom:4px></label><input type=date style="width:100%;padding:8px 10px;border-radius:6px;border:1px solid var(--border,#444);background:var(--bg,#1a1a2e);color:var(--text,#eee);font-size:14px"></div><!$><!/></div><div style=display:flex;gap:8px;margin-top:8px><button style="padding:8px 20px;border-radius:6px;border:none;background:var(--accent,#6c8);color:#000;cursor:pointer;font-weight:600"></button><button style="padding:8px 20px;border-radius:6px;border:none;background:var(--accent,#6c8);color:#000;cursor:pointer;font-weight:600"></button></div></div><!$><!/>'),ee=R('<div><label style=font-weight:600;display:block;margin-bottom:4px></label><input type=time style="width:100%;padding:8px 10px;border-radius:6px;border:1px solid var(--border,#444);background:var(--bg,#1a1a2e);color:var(--text,#eee);font-size:14px">'),De=R('<pre style="margin-top:16px;padding:12px;border-radius:8px;background:var(--bg,#1a1a2e);border:1px solid var(--border,#444);font-size:12px;overflow-x:auto;white-space:pre-wrap;color:var(--text,#ccc)">');function s(x){return x.toString().padStart(2,"0")}function te(x,g){const t=new Date(`${x}T${g}`),v=t.getFullYear(),w=s(t.getMonth()+1),f=s(t.getDate()),T=s(t.getHours()),y=s(t.getMinutes());return`${v}${w}${f}T${T}${y}00`}function Ee(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,x=>{const g=Math.random()*16|0;return(x==="x"?g:g&3|8).toString(16)})}function Ae(){const[x,g]=o(Z(),{equals:!1}),t=r=>we(r,x());he(()=>{const r=a=>{const l=a.detail?.locale;l&&g(l)};window.addEventListener("taitan:locale-change",r),g(Z()),Se(()=>window.removeEventListener("taitan:locale-change",r))});const[v,w]=o("会议"),[f,T]=o(""),[y,re]=o(""),[D,ne]=o(new Date().toISOString().slice(0,10)),[O,ae]=o("09:00"),[E,ie]=o(new Date().toISOString().slice(0,10)),[M,le]=o("10:00"),[$,oe]=o(!1),[U,se]=o(""),V=()=>{const r=Ee(),a=new Date,l=`${a.getFullYear()}${s(a.getMonth()+1)}${s(a.getDate())}T${s(a.getHours())}${s(a.getMinutes())}${s(a.getSeconds())}`;let i,b;$()?(i=D().replace(/-/g,""),b=E().replace(/-/g,"")):(i=te(D(),O()),b=te(E(),M()));const u=["BEGIN:VCALENDAR","VERSION:2.0","PRODID:-//LvOnce//ICS Generator//CN","CALSCALE:GREGORIAN","BEGIN:VEVENT",`UID:${r}@lvonce.com`,`DTSTAMP:${l}`,$()?`DTSTART;VALUE=DATE:${i}`:`DTSTART:${i}`,$()?`DTEND;VALUE=DATE:${b}`:`DTEND:${b}`,`SUMMARY:${v()}`];return f()&&u.push(`LOCATION:${f()}`),y()&&u.push(`DESCRIPTION:${y().replace(/\n/g,"\\n")}`),u.push("END:VEVENT","END:VCALENDAR"),u.join(`\r
`)},de=()=>{const r=V();se(r)},ce=()=>{const r=V(),a=new Blob([r],{type:"text/calendar;charset=utf-8"}),l=URL.createObjectURL(a),i=document.createElement("a");i.href=l,i.download=`${v()||"event"}.ics`,i.click(),URL.revokeObjectURL(l)};return(()=>{var r=S(Te),a=r.firstChild,l=a.firstChild,i=l.firstChild,b=i.nextSibling,u=l.nextSibling,z=u.firstChild,G=z.nextSibling,P=u.nextSibling,j=P.firstChild,B=j.nextSibling,H=P.nextSibling,k=H.firstChild,pe=k.nextSibling,h=H.nextSibling,Y=h.firstChild,q=Y.firstChild,F=q.nextSibling,xe=Y.nextSibling,[J,ge]=L(xe.nextSibling),K=J.nextSibling,Q=K.firstChild,W=Q.nextSibling,be=K.nextSibling,[ue,$e]=L(be.nextSibling),ve=h.nextSibling,C=ve.firstChild,X=C.nextSibling,fe=a.nextSibling,[ye,_e]=L(fe.nextSibling);return n(i,()=>t("事件标题")),b.$$input=e=>w(e.currentTarget.value),n(z,()=>t("地点")),G.$$input=e=>T(e.currentTarget.value),n(j,()=>t("描述")),B.$$input=e=>re(e.currentTarget.value),k.addEventListener("change",e=>oe(e.currentTarget.checked)),n(pe,()=>t("全天事件")),n(q,()=>t("开始日期")),F.$$input=e=>ne(e.currentTarget.value),n(h,(()=>{var e=N(()=>!$());return()=>e()&&(()=>{var d=S(ee),_=d.firstChild,m=_.nextSibling;return n(_,()=>t("开始时间")),m.$$input=A=>ae(A.currentTarget.value),c(()=>p(m,"value",O())),I(),d})()})(),J,ge),n(Q,()=>t("结束日期")),W.$$input=e=>ie(e.currentTarget.value),n(h,(()=>{var e=N(()=>!$());return()=>e()&&(()=>{var d=S(ee),_=d.firstChild,m=_.nextSibling;return n(_,()=>t("结束时间")),m.$$input=A=>le(A.currentTarget.value),c(()=>p(m,"value",M())),I(),d})()})(),ue,$e),C.$$click=de,n(C,()=>t("预览")),X.$$click=ce,n(X,()=>t("下载 .ics")),n(r,(()=>{var e=N(()=>!!U());return()=>e()&&(()=>{var d=S(De);return n(d,U),d})()})(),ye,_e),c(()=>p(b,"value",v())),c(()=>p(G,"value",f())),c(()=>p(B,"value",y())),c(()=>p(k,"checked",$())),c(()=>p(F,"value",D())),c(()=>p(W,"value",E())),I(),r})()}me(["input","click"]);export{Ae as default};
