import{a as h,f as d,t as a,x as b,y as E,g as e,G as t,B as u,i,C as z,F as _,z as P,E as D,A as U,H as K,J as f,e as k}from"./vue-core-Ewsep5yp.js";import{h as B,r as V}from"./inertia-Ckpa2qIg.js";import{C as F}from"./CustomerLayout-GX-kuU1a.js";import{u as X}from"./useConfirm-BuAOQkqU.js";import{E as j,n as O,b as L,a7 as I,c as Y,p as G,aw as q}from"./heroicons-BDwnQUYs.js";import"./PwaInstallPrompt-DoLwZwXF.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./LocaleSwitcher-9HahHW1U.js";import"./app-oHOEXACs.js";import"./monaco-JW8DSIgC.js";import"./ConfirmDialog-CAAUJZjl.js";import"./OnoxLogo-CeDonOUJ.js";const J={class:"flex items-center gap-2"},Q={class:"mb-5 rounded-xl border border-indigo-200 bg-indigo-50 p-4 text-sm text-indigo-900"},W={class:"flex gap-3"},Z={key:0,class:"mb-5"},ee=["value"],le={key:1,class:"mb-5 rounded-xl border border-amber-200 bg-amber-50 p-4 text-sm text-amber-800 flex gap-3"},te=["href"],ae={class:"mb-5 flex flex-wrap gap-1 border-b border-slate-200"},se=["onClick"],oe={key:2,class:"space-y-5"},ie={class:"rounded-xl border border-slate-200 bg-white p-5 shadow-sm"},ne={class:"list-decimal list-inside space-y-2 text-sm text-slate-700"},re={class:"font-mono bg-slate-100 px-1 rounded"},de={class:"mt-3 flex items-center gap-2"},ue={class:"flex-1 rounded-lg border border-slate-200 bg-slate-50 px-3 py-2 text-xs font-mono text-slate-700 overflow-x-auto"},me={key:3,class:"space-y-5"},pe={class:"rounded-xl border border-slate-200 bg-white p-5 shadow-sm"},ve={class:"mt-3 flex items-center gap-2"},be={class:"flex-1 rounded-lg border border-slate-200 bg-slate-50 px-3 py-2 text-xs font-mono text-slate-700 overflow-x-auto"},ce={key:4,class:"space-y-5"},ye={class:"rounded-xl border border-slate-200 bg-white p-5 shadow-sm"},xe=["href"],ge={key:5},fe={class:"rounded-xl border border-slate-200 bg-white shadow-sm overflow-hidden"},ke={class:"min-w-full divide-y divide-slate-200 text-sm"},he={class:"divide-y divide-slate-100"},we={key:6,class:"space-y-5"},_e={class:"rounded-xl border border-slate-200 bg-white p-5 shadow-sm"},Ke={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4"},Se=["value"],Me={class:"rounded-lg border border-slate-200 bg-slate-50 p-3 mb-4 text-xs font-mono space-y-1 text-slate-700"},Pe={class:"flex items-center gap-3"},Ae=["disabled"],Ce={class:"rounded-xl border border-amber-200 bg-amber-50 p-4 text-sm text-amber-900"},Te={class:"flex gap-3"},Ee=["href"],A={props:["s","email"],template:`
    <div class="rounded-xl border border-slate-200 bg-white p-5 shadow-sm">
        <h4 class="font-semibold text-slate-800 mb-3 flex items-center gap-2">
            <span class="inline-block"><svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-indigo-500" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M5.25 14.25h13.5m-13.5 0a3 3 0 01-3-3m3 3a3 3 0 100 6h13.5a3 3 0 100-6m-16.5-3a3 3 0 013-3h13.5a3 3 0 013 3m-19.5 0a4.5 4.5 0 01.9-2.7L5.737 5.1a3.375 3.375 0 012.7-1.35h7.126c1.062 0 2.062.5 2.7 1.35l2.587 3.45a4.5 4.5 0 01.9 2.7m0 0a3 3 0 01-3 3m0 3h.008v.008h-.008v0zm-4.875 0h.008v.008h-.008v0zm-4.875 0h.008v.008h-.008v0z" /></svg></span>
            Sunucu Bilgileri
        </h4>
        <div class="grid grid-cols-1 md:grid-cols-2 gap-3 text-sm">
            <div class="rounded-lg border border-slate-200 bg-slate-50 p-3">
                <div class="text-xs text-slate-500 mb-1 font-medium">IMAP (SSL)</div>
                <div class="font-mono">{{ s.imap_host }}:{{ s.imap_port_ssl }}</div>
            </div>
            <div class="rounded-lg border border-slate-200 bg-slate-50 p-3">
                <div class="text-xs text-slate-500 mb-1 font-medium">SMTP (SSL/465)</div>
                <div class="font-mono">{{ s.smtp_host }}:{{ s.smtp_port_ssl }}</div>
            </div>
            <div class="rounded-lg border border-slate-200 bg-slate-50 p-3">
                <div class="text-xs text-slate-500 mb-1 font-medium">SMTP (Submission/587)</div>
                <div class="font-mono">{{ s.smtp_host }}:{{ s.smtp_port_submission }}</div>
            </div>
            <div class="rounded-lg border border-slate-200 bg-slate-50 p-3">
                <div class="text-xs text-slate-500 mb-1 font-medium">Kullanıcı Adı</div>
                <div class="font-mono">{{ email ?? 'tam-eposta@domain.com' }}</div>
            </div>
        </div>
    </div>
    `},m={props:["label","value","rowKey","copiedKey"],emits:["copy"],template:`
    <tr>
        <td class="px-4 py-2.5 text-slate-500 font-medium text-xs">{{ label }}</td>
        <td class="px-4 py-2.5 font-mono text-slate-800">{{ value }}</td>
        <td class="px-4 py-2.5 text-right">
            <button @click="$emit('copy', value, rowKey)"
                class="inline-flex items-center gap-1 rounded border border-slate-300 bg-white px-2 py-1 text-xs hover:bg-slate-50">
                <span v-if="copiedKey === rowKey" class="text-emerald-600">✓ Kopyalandı</span>
                <span v-else>Kopyala</span>
            </button>
        </td>
    </tr>
    `},Xe={__name:"SetupGuide",props:{email_accounts:Array,selected_email_id:Number,domains:Array,server_settings:Object,autoconfig_url:String,autodiscover_url:String,apple_profile_url:String},setup(g){const{ask:N}=X(),p=g,x=h("thunderbird"),S=h(p.selected_email_id??p.email_accounts[0]?.id??null),M=h(p.domains[0]?.id??null),s=h(null),w=h(!1),H=[{key:"thunderbird",label:"Thunderbird"},{key:"outlook",label:"Outlook"},{key:"apple",label:"Apple Mail / iPhone"},{key:"manual",label:"Manuel Ayarlar"},{key:"dns",label:"DNS Kayıtları"}],c=k(()=>p.email_accounts.find(n=>n.id===S.value)??p.email_accounts[0]),y=k(()=>p.domains.find(n=>n.id===M.value)??p.domains[0]),v=k(()=>p.server_settings),$=k(()=>{const n=p.apple_profile_url,l=c.value?.email??"";return n+"?email="+encodeURIComponent(l)}),C=k(()=>{const n=c.value?.domain??y.value?.name??"";return p.autoconfig_url.replace("{domain}",n)}),T=k(()=>{const n=c.value?.domain??y.value?.name??"";return p.autodiscover_url.replace("{domain}",n)});function r(n,l){navigator.clipboard.writeText(n).then(()=>{s.value=l,setTimeout(()=>{s.value=null},1800)})}async function R(){!y.value||!await N({title:"Onaylayın",message:`${y.value.name} için mail DNS kayıtları otomatik eklensin mi?`,variant:"warning",confirmText:"Onayla",cancelText:"İptal"})||(w.value=!0,V.post(route("customer.email.dns-auto",{domain:y.value.id}),{},{onFinish:()=>{w.value=!1}}))}return(n,l)=>(i(),d(_,null,[a(b(B),{title:"Mail Kurulum Sihirbazı"}),a(F,null,{header:E(()=>[e("div",J,[a(b(q),{class:"h-5 w-5 text-indigo-600"}),l[4]||(l[4]=t(" Mail Kurulum Sihirbazı ",-1))])]),default:E(()=>[e("div",Q,[e("div",W,[a(b(j),{class:"mt-0.5 h-5 w-5 flex-shrink-0 text-indigo-500"}),e("div",null,[l[5]||(l[5]=t(" Thunderbird, Outlook veya Apple Mail uygulamanızı ",-1)),e("strong",null,u(c.value?.email??"—"),1),l[6]||(l[6]=t(" hesabıyla hızlıca yapılandırın. Otomatik yapılandırma URL'leri için domain başına bir CNAME kaydı gerekir. ",-1))])])]),g.email_accounts.length>0?(i(),d("div",Z,[l[7]||(l[7]=e("label",{class:"block text-sm font-medium text-slate-700 mb-1"},"E-posta hesabı seç",-1)),z(e("select",{"onUpdate:modelValue":l[0]||(l[0]=o=>S.value=o),class:"rounded-lg border border-slate-300 px-3 py-2 text-sm w-full max-w-sm"},[(i(!0),d(_,null,P(g.email_accounts,o=>(i(),d("option",{key:o.id,value:o.id},u(o.email),9,ee))),128))],512),[[D,S.value]])])):(i(),d("div",le,[a(b(O),{class:"h-5 w-5 flex-shrink-0 text-amber-500 mt-0.5"}),l[8]||(l[8]=t(" Henüz e-posta hesabınız yok. Önce ",-1)),e("a",{href:n.route("customer.email.index"),class:"font-medium underline"},"E-posta Hesapları",8,te),l[9]||(l[9]=t(" sayfasından bir hesap oluşturun. ",-1))])),e("div",ae,[(i(),d(_,null,P(H,o=>e("button",{key:o.key,onClick:ze=>x.value=o.key,class:U(["px-4 py-2 text-sm font-medium border-b-2 transition-colors",x.value===o.key?"border-indigo-600 text-indigo-700":"border-transparent text-slate-600 hover:text-slate-900"])},u(o.label),11,se)),64))]),x.value==="thunderbird"?(i(),d("div",oe,[e("div",ie,[l[15]||(l[15]=e("h3",{class:"font-semibold text-slate-800 mb-3"},"Thunderbird Otomatik Yapılandırma",-1)),e("ol",ne,[l[12]||(l[12]=e("li",null,[t("Thunderbird'ü açın ve "),e("strong",null,"Hesap Ayarları → Hesap Ekle → E-posta"),t(" yolunu izleyin.")],-1)),e("li",null,[l[10]||(l[10]=t("E-posta adresinizi (",-1)),e("code",re,u(c.value?.email??"kullanici@domain.com"),1),l[11]||(l[11]=t(") girin.",-1))]),l[13]||(l[13]=e("li",null,[t("Thunderbird, "),e("code",{class:"font-mono bg-slate-100 px-1 rounded"},"autoconfig.domain.com"),t(" adresini otomatik sorgulayacak ve ayarları yükleyecektir.")],-1)),l[14]||(l[14]=e("li",null,`Ayarlar otomatik gelmediyse aşağıdaki URL'yi "Manuel Yapılandırma" alanına girin:`,-1))]),e("div",de,[e("code",ue,u(C.value),1),e("button",{onClick:l[1]||(l[1]=o=>r(C.value,"tb-url")),class:"rounded-lg border border-slate-300 bg-white px-3 py-2 text-xs hover:bg-slate-50 flex items-center gap-1"},[s.value==="tb-url"?(i(),K(b(L),{key:0,class:"h-3.5 w-3.5 text-emerald-600"})):(i(),K(b(I),{key:1,class:"h-3.5 w-3.5"})),t(" "+u(s.value==="tb-url"?"Kopyalandı":"Kopyala"),1)])])]),a(A,{s:v.value,email:c.value?.email},null,8,["s","email"])])):f("",!0),x.value==="outlook"?(i(),d("div",me,[e("div",pe,[l[16]||(l[16]=e("h3",{class:"font-semibold text-slate-800 mb-3"},"Outlook Otomatik Yapılandırma (Autodiscover)",-1)),l[17]||(l[17]=e("ol",{class:"list-decimal list-inside space-y-2 text-sm text-slate-700"},[e("li",null,[t("Outlook'u açın, "),e("strong",null,"Dosya → Hesap Ekle"),t("'ye tıklayın.")]),e("li",null,[t("E-posta adresinizi girin, "),e("strong",null,"Bağlan"),t("'a tıklayın.")]),e("li",null,[t("Outlook, "),e("code",{class:"font-mono bg-slate-100 px-1 rounded"},"autodiscover.domain.com"),t(" adresini sorgulayacak ve IMAP/SMTP ayarlarını otomatik dolduracaktır.")]),e("li",null,[t("Otomatik kurulum çalışmazsa "),e("strong",null,"IMAP"),t(" seçeneğini seçip aşağıdaki ayarları manuel olarak girin.")])],-1)),e("div",ve,[e("code",be,u(T.value),1),e("button",{onClick:l[2]||(l[2]=o=>r(T.value,"oc-url")),class:"rounded-lg border border-slate-300 bg-white px-3 py-2 text-xs hover:bg-slate-50 flex items-center gap-1"},[s.value==="oc-url"?(i(),K(b(L),{key:0,class:"h-3.5 w-3.5 text-emerald-600"})):(i(),K(b(I),{key:1,class:"h-3.5 w-3.5"})),t(" "+u(s.value==="oc-url"?"Kopyalandı":"Kopyala"),1)])])]),a(A,{s:v.value,email:c.value?.email},null,8,["s","email"])])):f("",!0),x.value==="apple"?(i(),d("div",ce,[e("div",ye,[l[19]||(l[19]=e("h3",{class:"font-semibold text-slate-800 mb-3"},"Apple Mail & iPhone/iPad — Profil İndir",-1)),l[20]||(l[20]=e("p",{class:"text-sm text-slate-700 mb-4"},[t(" Aşağıdaki butona tıklayarak cihazınıza bir yapılandırma profili ("),e("code",{class:"font-mono text-xs bg-slate-100 px-1 rounded"},".mobileconfig"),t(") indirin. iPhone veya iPad'de indirdikten sonra "),e("strong",null,"Ayarlar → Profil İndirildi"),t(" bölümünden yükleyin. ")],-1)),e("a",{href:$.value,class:"inline-flex items-center gap-2 rounded-lg bg-slate-800 px-4 py-2 text-sm font-medium text-white hover:bg-slate-700"},[a(b(Y),{class:"h-4 w-4"}),l[18]||(l[18]=t(" .mobileconfig Profili İndir ",-1))],8,xe)]),l[21]||(l[21]=e("div",{class:"rounded-xl border border-slate-200 bg-white p-5 shadow-sm"},[e("h3",{class:"font-semibold text-slate-800 mb-3"},"Manuel Kurulum (macOS Mail / iPhone)"),e("ol",{class:"list-decimal list-inside space-y-2 text-sm text-slate-700"},[e("li",null,[t("iPhone: "),e("strong",null,"Ayarlar → Mail → Hesaplar → Hesap Ekle → Diğer → Mail Hesabı Ekle")]),e("li",null,[t("macOS: "),e("strong",null,"Mail → Hesaplar → Hesap Ekle → Diğer Mail Hesabı")]),e("li",null,"E-posta ve parolanızı girdikten sonra aşağıdaki sunucu bilgilerini kullanın.")])],-1)),a(A,{s:v.value,email:c.value?.email},null,8,["s","email"])])):f("",!0),x.value==="manual"?(i(),d("div",ge,[e("div",fe,[e("table",ke,[l[22]||(l[22]=e("thead",{class:"bg-slate-50"},[e("tr",null,[e("th",{class:"px-4 py-3 text-left text-xs font-semibold uppercase text-slate-500 w-44"},"Ayar"),e("th",{class:"px-4 py-3 text-left text-xs font-semibold uppercase text-slate-500"},"Değer"),e("th",{class:"px-4 py-3 w-24"})])],-1)),e("tbody",he,[a(m,{label:"IMAP Sunucu",value:v.value.imap_host,rowKey:"imap_host",copiedKey:s.value,onCopy:r},null,8,["value","copiedKey"]),a(m,{label:"IMAP Port (SSL)",value:String(v.value.imap_port_ssl),rowKey:"imap_port_ssl",copiedKey:s.value,onCopy:r},null,8,["value","copiedKey"]),a(m,{label:"IMAP Port (STARTTLS)",value:String(v.value.imap_port_starttls),rowKey:"imap_port_starttls",copiedKey:s.value,onCopy:r},null,8,["value","copiedKey"]),a(m,{label:"POP3 Sunucu",value:v.value.pop3_host,rowKey:"pop3_host",copiedKey:s.value,onCopy:r},null,8,["value","copiedKey"]),a(m,{label:"POP3 Port (SSL)",value:String(v.value.pop3_port_ssl),rowKey:"pop3_port_ssl",copiedKey:s.value,onCopy:r},null,8,["value","copiedKey"]),a(m,{label:"SMTP Sunucu",value:v.value.smtp_host,rowKey:"smtp_host",copiedKey:s.value,onCopy:r},null,8,["value","copiedKey"]),a(m,{label:"SMTP Port (SSL/465)",value:String(v.value.smtp_port_ssl),rowKey:"smtp_port_ssl",copiedKey:s.value,onCopy:r},null,8,["value","copiedKey"]),a(m,{label:"SMTP Port (Submission/587)",value:String(v.value.smtp_port_submission),rowKey:"smtp_port_sub",copiedKey:s.value,onCopy:r},null,8,["value","copiedKey"]),a(m,{label:"Kullanıcı Adı",value:c.value?.email??"tam-eposta@domain.com",rowKey:"username",copiedKey:s.value,onCopy:r},null,8,["value","copiedKey"]),a(m,{label:"Kimlik Doğrulama",value:"Normal Parola",rowKey:"auth",copiedKey:s.value,onCopy:r},null,8,["copiedKey"]),a(m,{label:"Şifreleme (IMAP/POP3/SMTP 465)",value:"SSL/TLS",rowKey:"enc",copiedKey:s.value,onCopy:r},null,8,["copiedKey"]),a(m,{label:"Şifreleme (SMTP 587)",value:"STARTTLS",rowKey:"enc2",copiedKey:s.value,onCopy:r},null,8,["copiedKey"])])])])])):f("",!0),x.value==="dns"?(i(),d("div",we,[e("div",_e,[e("div",Ke,[l[23]||(l[23]=e("div",null,[e("h3",{class:"font-semibold text-slate-800"},"Otomatik DNS Kaydı Ekle"),e("p",{class:"text-sm text-slate-500 mt-0.5"},"MX, SPF, DMARC, autoconfig ve autodiscover CNAME kayıtlarını tek tıkla oluşturun.")],-1)),g.domains.length>1?z((i(),d("select",{key:0,"onUpdate:modelValue":l[3]||(l[3]=o=>M.value=o),class:"rounded-lg border border-slate-300 px-3 py-2 text-sm"},[(i(!0),d(_,null,P(g.domains,o=>(i(),d("option",{key:o.id,value:o.id},u(o.name),9,Se))),128))],512)),[[D,M.value]]):f("",!0)]),e("div",Me,[e("div",null,[l[24]||(l[24]=t("MX 10       @ → ",-1)),e("strong",null,"mail."+u(y.value?.name),1)]),e("div",null,[l[25]||(l[25]=t("A          mail → ",-1)),e("strong",null,u(g.server_settings?.smtp_host?"<MAIL_SERVER_IP>":"?"),1)]),l[28]||(l[28]=e("div",null,[t("TXT       @ → "),e("strong",null,"v=spf1 a mx ip4:... ~all")],-1)),l[29]||(l[29]=e("div",null,[t("TXT       _dmarc → "),e("strong",null,"v=DMARC1; p=quarantine; ...")],-1)),e("div",null,[l[26]||(l[26]=t("CNAME   autoconfig → ",-1)),e("strong",null,"mail."+u(y.value?.name),1)]),e("div",null,[l[27]||(l[27]=t("CNAME   autodiscover → ",-1)),e("strong",null,"mail."+u(y.value?.name),1)])]),e("div",Pe,[e("button",{onClick:R,disabled:w.value||!y.value,class:"inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 disabled:opacity-50"},[a(b(G),{class:"h-4 w-4"}),t(" "+u(w.value?"Uygulanıyor...":"DNS Kayıtlarını Otomatik Ekle"),1)],8,Ae),l[30]||(l[30]=e("span",{class:"text-xs text-slate-500"},"Mevcut kayıtlar korunur, yalnızca eksikler eklenir.",-1))])]),e("div",Ce,[e("div",Te,[a(b(O),{class:"h-5 w-5 flex-shrink-0 text-amber-500 mt-0.5"}),e("div",null,[l[31]||(l[31]=e("strong",null,"DKIM kaydı",-1)),l[32]||(l[32]=t(" bu araç ile eklenmez. DKIM yönetimi için ",-1)),e("a",{href:n.route("customer.email.deliverability.index"),class:"underline font-medium"},"Deliverability",8,Ee),l[33]||(l[33]=t(" sayfasını kullanın. ",-1))])])])])):f("",!0)]),_:1})],64))}};export{Xe as default};
