1import"../chunks/DsnmJJEf.js";import{p as Qa,av as pe,s as l,c as i,t as h,g as e,a as Va,A as N,n as Q,r as a,f as u,ay as me}from"../chunks/BY0bk6Yc.js";import{s as c}from"../chunks/B6oFbeKC.js";import{f as p,a as r,t as f,c as w}from"../chunks/DXItkK2y.js";import{i as d}from"../chunks/DiSB06Pf.js";import{e as ea,i as aa}from"../chunks/BOZOuEyP.js";import{a as da,t as na}from"../chunks/z40oqvJk.js";import{r as Za}from"../chunks/kUWlVhub.js";import{s as Ie}from"../chunks/BZLnOqJO.js";import{d as $a}from"../chunks/CFtbtvCf.js";import{b as ei}from"../chunks/DhiJda7t.js";import{I as S}from"../chunks/DGiEONFf.js";/* empty css */var ai=p("<button><h5> </h5> <p> </p></button>"),ii=(ia,Te,R,V)=>{Te(),e(R)&&V()},si=p("<!> Checking SPF...",1),ri=p("<!> Check SPF Policy",1),li=p('<div class="detail-item error svelte-1ohibvx"><!> <div class="svelte-1ohibvx"><span class="detail-label svelte-1ohibvx">Allows All (+all)</span> <span class="detail-value svelte-1ohibvx">Enabled</span> <span class="detail-description svelte-1ohibvx">WARNING: Any server can send email for this domain</span></div></div>'),ti=p('<div class="deliverability-section svelte-1ohibvx"><div><!> <div class="svelte-1ohibvx"><h4 class="svelte-1ohibvx"> </h4> <p class="svelte-1ohibvx"><!></p></div></div> <div class="deliverability-details svelte-1ohibvx"><div><!> <div class="svelte-1ohibvx"><span class="detail-label svelte-1ohibvx">Hard Fail (-all)</span> <span class="detail-value svelte-1ohibvx"> </span> <span class="detail-description svelte-1ohibvx"> </span></div></div> <div><!> <div class="svelte-1ohibvx"><span class="detail-label svelte-1ohibvx">Soft Fail (~all)</span> <span class="detail-value svelte-1ohibvx"> </span> <span class="detail-description svelte-1ohibvx"> </span></div></div> <!></div></div>'),oi=p('<div class="warning-box svelte-1ohibvx"><!> <div><strong class="svelte-1ohibvx">DNS Lookup Limit Exceeded</strong> <p class="svelte-1ohibvx"> </p></div></div>'),vi=p('<div class="info-box svelte-1ohibvx"><!> <div><strong class="svelte-1ohibvx">High DNS Lookup Count</strong> <p class="svelte-1ohibvx"> </p></div></div>'),di=p('<div class="mechanism-item svelte-1ohibvx"><code class="svelte-1ohibvx"> </code> <span class="mechanism-description svelte-1ohibvx"><!></span></div>'),ni=p('<div class="mechanisms-section svelte-1ohibvx"><h5 class="svelte-1ohibvx">Direct Mechanisms</h5> <div class="mechanism-list svelte-1ohibvx"></div></div>'),ci=p('<div class="include-record svelte-1ohibvx"><code class="svelte-1ohibvx"> </code></div>'),hi=p('<div class="include-error svelte-1ohibvx"><!> <span> </span></div>'),pi=p('<div class="include-item svelte-1ohibvx"><div class="include-header svelte-1ohibvx"><!> <span class="include-domain svelte-1ohibvx"> </span></div> <!> <!></div>'),mi=p('<div class="includes-section svelte-1ohibvx"><h5 class="svelte-1ohibvx">Included SPF Policies</h5> <div class="include-list svelte-1ohibvx"></div></div>'),ui=p('<div class="analysis-section svelte-1ohibvx"><h4 class="svelte-1ohibvx">SPF Policy Breakdown</h4> <!> <!> <!></div>'),fi=p('<!> <div class="record-section svelte-1ohibvx"><h4 class="svelte-1ohibvx">SPF Record</h4> <div class="record-display svelte-1ohibvx"><div class="record-location svelte-1ohibvx"> </div> <code class="svelte-1ohibvx"> </code></div></div> <!>',1),_i=p(`<div class="no-record-section svelte-1ohibvx"><div class="no-record-content svelte-1ohibvx"><!> <div><h4 class="svelte-1ohibvx">No SPF Record Found</h4> <p class="svelte-1ohibvx">Domain <code class="svelte-1ohibvx"> </code> does not have an SPF record configured.</p> <p class="risk-warning svelte-1ohibvx">This means anyone can send email claiming to be from this domain, significantly increasing spoofing 2 risk.</p></div></div></div>`),xi=p('<div class="card results-card"><div class="card-header row"><h3>SPF Policy Analysis</h3> <button class="copy-btn"><!> </button></div> <div class="card-content"><!></div></div>'),bi=p('<div class="card error-card"><div class="card-content"><div class="error-content"><!> <div><strong>SPF Check Failed</strong> <p> </p></div></div></div></div>'),gi=p(`<div class="card"><header class="card-header"><h1>Email SPF Policy Checker</h1> <p>Check SPF (Sender Policy Framework) records for email authentication and deliverability. Analyze which servers are 3 authorized to send email for your domain and assess delivery risk.</p></header> <div class="card examples-card"><details class="examples-details"><summary class="examples-summary"><!> <h4>SPF Examples</h4></summary> <div class="examples-grid"></div></details></div> <div class="card input-card"><div class="card-header"><h3>SPF Policy Check</h3></div> <div class="card-content"><div class="form-group"><label for="domain">Domain Name <input id="domain" type="text" placeholder="example.com"/></label></div> <div class="action-section svelte-1ohibvx"><button class="check-btn lookup-btn"><!></button></div></div></div> <!> <!> <div class="card info-card"><div class="card-header"><h3>Understanding SPF for Email</h3></div> <div class="card-content"><div class="info-grid"><div class="info-section"><h4>SPF Mechanisms</h4> <div class="mechanism-explanations svelte-1ohibvx"><div class="mechanism-explanation svelte-1ohibvx"><strong class="svelte-1ohibvx">ip4/ip6:</strong> Authorize specific IP addresses or networks</div> <div class="mechanism-explanation svelte-1ohibvx"><strong class="svelte-1ohibvx">a/mx:</strong> Authorize servers from A or MX records</div> <div class="mechanism-explanation svelte-1ohibvx"><strong class="svelte-1ohibvx">include:</strong> Include another domain's SPF policy</div> <div class="mechanism-explanation svelte-1ohibvx"><strong class="svelte-1ohibvx">all:</strong> Final policy decision (+pass, ~soft fail, -hard fail)</div></div></div> <div class="info-section"><h4>Email Deliverability</h4> <ul><li><strong>Hard Fail (-all):</strong> Best security, blocks unauthorized senders</li> <li><strong>Soft Fail (~all):</strong> Marks suspicious, doesn't block delivery</li> <li><strong>No SPF:</strong> High spoofing risk, may affect deliverability</li> <li><strong>Too many lookups:</strong> Can cause delivery failures</li></ul></div> <div class="info-section"><h4>Best Practices</h4> <ul><li>Use -all for hard fail when possible</li> <li>Keep DNS lookups under 10 (preferably under 5)</li> <li>Test SPF changes before deployment</li> <li>Monitor email delivery after SPF changes</li></ul></div> <div class="info-section"><h4>Common SPF Examples</h4> <div class="spf-examples svelte-1ohibvx"><div class="spf-example svelte-1ohibvx"><code class="svelte-1ohibvx">v=spf1 include:_spf.google.com ~all</code> <span>
3Use Google Workspace with soft fail</span></div> <div class="spf-example svelte-1ohibvx"><code class="svelte-1ohibvx">v=spf1 ip4:192.168.1.1 -all</code> <span>Only allow specific IP with hard fail</span></div> <div class="spf-example svelte-1ohibvx"><code class="svelte-1ohibvx">v=spf1 a mx -all</code> <span>Allow A and MX record servers with hard fail</span></div></div></div></div></div></div></div>`);function Hi(ia,Te){Qa(Te,!0);let R=pe("gmail.com"),V=pe(!1),t=pe(null),Se=pe(null),ue=pe(!1),Me=pe(null);const ca=[{domain:"gmail.com",description:"Google Gmail SPF policy"},{domain:"outlook.com",description:"Microsoft Outlook SPF setup"},{domain:"salesforce.com",description:"Salesforce SPF configuration"},{domain:"mailchimp.com",description:"MailChimp email service SPF"},{domain:"github.com",description:"GitHub enterprise SPF policy"},{domain:"sendgrid.com",description:"SendGrid email platform SPF"}];async function We(){N(V,!0),N(Se,null),N(t,null);try{const s=await fetch("/api/internal/diagnostics/email",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"spf-check",domain:e(R).trim()})});if(!s.ok)throw new Error(`SPF check failed: ${s.status}`);N(t,await s.json(),!0)}catch(s){N(Se,s instanceof Error?s.message:"Unknown error occurred",!0)}finally{N(V,!1)}}function ha(s,v){N(R,s.domain,!0),N(Me,v,!0),We()}function pa(){N(Me,null)}function ma(s){switch(s){case"low":return"success";case"medium":return"warning";case"high":return"error";default:return"secondary"}}function ua(s){switch(s){case"low":return"shield-check";case"medium":return"shield-alert";case"high":return"shield-x";default:return"shield"}}async function fa(){if(!e(t))return;let s=`SPF Check for ${e(R)} 4`;s+=`Generated at: ${new Date().toISOString()} 5 6`,e(t).record&&(s+=`SPF Record: 7${e(t).record} 8 9`),e(t).emailAnalysis&&(s+=`Email Deliverability Analysis: 10`,s+=` Risk Level: ${e(t).emailAnalysis.deliverabilityRisk} 11`,s+=` Hard Fail (-all): ${e(t).emailAnalysis.hasHardFail?"Yes":"No"} 12`,s+=` Soft Fail (~all): ${e(t).emailAnalysis.hasSoftFail?"Yes":"No"} 13`,s+=` Allows All (+all): ${e(t).emailAnalysis.allowsAll?"Yes":"No"} 14 15`);const v=e(t);v.expanded&&(s+=`Expanded SPF Analysis: 16`,s+=` Total DNS lookups: ${v.lookupCount||0} 17`,s+=` Mechanisms: ${v.expanded.mechanisms.join(", ")} 18`,v.expanded.includes.length>0&&(s+=` Includes: ${v.expanded.includes.map(_=>_.domain).join(", ")} 19`)),await navigator.clipboard.writeText(s),N(ue,!0),setTimeout(()=>N(ue,!1),1500)}var Ue=gi(),Ge=l(i(Ue),2),sa=i(Ge),je=i(sa),_a=i(je);S(_a,{name:"chevron-right",size:"xs"}),Q(2),a(je);var ra=l(je,2);ea(ra,21,()=>ca,aa,(s,v,_)=>{var g=ai();let U;g.__click=()=>ha(e(v),_);var G=i(g),L=i(G,!0);a(G);var Z=l(G,2),Ye=i(Z,!0);a(Z),a(g),da(g,(fe,I)=>na?.(fe,I),()=>`Check SPF policy for ${e(v).domain}`),h(fe=>{U=Ie(g,1,"example-card",null,U,fe),c(L,e(v).domain),c(Ye,e(v).description)},[()=>({selected:e(Me)===_})]),r(s,g)}),a(ra),a(sa),a(Ge);var Oe=l(Ge,2),la=l(i(Oe),2),Xe=i(la),Le=i(Xe),Be=l(i(Le));Za(Be),Be.__change=[ii,pa,R,We],a(Le),da(Le,(s,v)=>na?.(s,v),()=>"Enter the domain to check SPF policy for"),a(Xe);var ta=l(Xe,2),Fe=i(ta);Fe.__click=We;var xa=i(Fe);{var ba=s=>{var v=si(),_=u(v);S(_,{name:"loader",size:"sm",animate:"spin"}),Q(),r(s,v)},ga=s=>{var v=ri(),_=u(v);S(_,{name:"mail-check",size:"sm"}),Q(),r(s,v)};d(xa,s=>{e(V)?s(ba):s(ga,!1)})}a(Fe),a(ta),a(la),a(Oe);var oa=l(Oe,2);{var ya=s=>{var v=xi(),_=i(v),g=l(i(_),2);g.__click=fa;var U=i(g);{let I=me(()=>e(ue)?"check":"copy");S(U,{get name(){return e(I)},size:"xs"})}var G=l(U);a(g),a(_);var L=l(_,2),Z=i(L);{var Ye=I=>{var $=fi(),_e=u($);{var Pe=B=>{var Y=ti(),q=i(Y),we=i(q);{let n=me(()=>ua(e(t).emailAnalysis.deliverabilityRisk));S(we,{get name(){return e(n)},size:"md"})}var Ae=l(we,2),ie=i(Ae),Je=i(ie);a(ie);var Ce=l(ie,2),Ke=i(Ce);{var m=n=>{var k=f("Strong SPF policy with hard fail - excellent email security");r(n,k)},A=n=>{var k=w(),be=u(k);{var Qe=D=>{var K=f("Moderate SPF policy with soft fail - good but could be stronger");r(D,K)},X=D=>{var K=f("Weak or missing SPF policy - high risk of email spoofing");r(D,K)};d(be,D=>
19{e(t).emailAnalysis.deliverabilityRisk==="medium"?D(Qe):D(X,!1)},!0)}r(n,k)};d(Ke,n=>{e(t).emailAnalysis.deliverabilityRisk==="low"?n(m):n(A,!1)})}a(Ce),a(Ae),a(q);var x=l(q,2),b=i(x),F=i(b);{let n=me(()=>e(t).emailAnalysis.hasHardFail?"check-circle":"alert-circle");S(F,{get name(){return e(n)},size:"sm"})}var o=l(F,2),y=l(i(o),2),C=i(y,!0);a(y);var T=l(y,2),M=i(T,!0);a(T),a(o),a(b);var j=l(b,2),J=i(j);{let n=me(()=>e(t).emailAnalysis.hasSoftFail?"alert-triangle":e(t).emailAnalysis.hasHardFail?"check-circle":"x-circle");S(J,{get name(){return e(n)},size:"sm"})}var se=l(J,2),z=l(i(se),2),O=i(z,!0);a(z);var E=l(z,2),H=i(E,!0);a(E),a(se),a(j);var W=l(j,2);{var P=n=>{var k=li(),be=i(k);S(be,{name:"alert-triangle",size:"sm"}),Q(2),a(k),r(n,k)};d(W,n=>{e(t).emailAnalysis.allowsAll&&n(P)})}a(x),a(Y),h((n,k)=>{Ie(q,1,`deliverability-overview ${n??""}`,"svelte-1ohibvx"),c(Je,`Email Deliverability Risk: ${k??""}`),Ie(b,1,`detail-item ${e(t).emailAnalysis.hasHardFail?"success":"warning"}`,"svelte-1ohibvx"),c(C,e(t).emailAnalysis.hasHardFail?"Enabled":"Disabled"),c(M,e(t).emailAnalysis.hasHardFail?"Unauthorized emails will be rejected":"Consider upgrading to -all for better security"),Ie(j,1,`detail-item ${e(t).emailAnalysis.hasSoftFail?"warning":e(t).emailAnalysis.hasHardFail?"success":"error"}`,"svelte-1ohibvx"),c(O,e(t).emailAnalysis.hasSoftFail?"Enabled":"Disabled"),c(H,e(t).emailAnalysis.hasSoftFail?"Unauthorized emails marked as suspicious":e(t).emailAnalysis.hasHardFail?"Using stronger hard fail instead":"No SPF enforcement configured")},[()=>ma(e(t).emailAnalysis.deliverabilityRisk),()=>e(t).emailAnalysis.deliverabilityRisk.toUpperCase()]),r(B,Y)};d(_e,B=>{e(t).emailAnalysis&&B(Pe)})}var ee=l(_e,2),xe=l(i(ee),2),ae=i(xe),qe=i(ae);a(ae);var va=l(ae,2),Fa=i(va,!0);a(va),a(xe),a(ee);var Pa=l(ee,2);{var wa=B=>{var Y=ui(),q=l(i(Y),2);{var we=m=>{var A=oi(),x=i(A);S(x,{name:"alert-triangle",size:"sm"});var b=l(x,2),F=l(i(b),2),o=i(F);a(F),a(b),a(A),h(()=>c(o,`This SPF record requires ${e(t).lookupCount??""} DNS lookups, which exceeds the RFC limit of 10. This 20 may cause delivery failures.`)),r(m,A)},Ae=m=>{var A=w(),x=u(A);{var b=F=>{var o=vi(),y=i(o);S(y,{name:"info",size:"sm"});var C=l(y,2),T=l(i(C),2),M=i(T);a(T),a(C),a(o),h(()=>c(M,`This SPF record requires ${e(t).lookupCount??""} DNS lookups. Consider optimizing to stay well below 21 the 10-lookup limit.`)),r(F,o)};d(x,F=>{e(t).lookupCount>6&&F(b)},!0)}r(m,A)};d(q,m=>{e(t).lookupCount>8?m(we):m(Ae,!1)})}var ie=l(q,2);{var Je=m=>{const A=me(()=>e(t).expanded);var x=ni(),b=l(i(x),2);ea(b,21,()=>e(A).mechanisms,aa,(F,o)=>{var y=di(),C=i(y),T=i(C,!0);a(C);var M=l(C,2),j=i(M);{var J=z=>{var O=f("SPF version identifier");r(z,O)},se=z=>{var O=w(),E=u(O);{var H=P=>{var n=f();h(k=>c(n,`IPv4 address or network: ${k??""}`),[()=>e(o).substring(4)]),r(P,n)},W=P=>{var n=w(),k=u(n);{var be=X=>{var D=f();h(K=>c(D,`IPv6 address or network: ${K??""}`),[()=>e(o).substring(4)]),r(X,D)},Qe=X=>{var D=w(),K=u(D);{var Aa=re=>{var ge=f();h(Ve=>c(ge,`A record lookup for: ${Ve??""}`),[()=>e(o).substring(2)]),r(re,ge)},Ca=re=>{var ge=w(),Ve=u(ge);{var za=le=>{var ze=f("A record lookup for domain itself");r(le,ze)},Ea=le=>{var ze=w(),Da=u(ze);{var Na=te=>{var ye=f();h(Ze=>c(ye,`MX record lookup for: ${Ze??""}`),[()=>e(o).substring(3)]),r(te,ye)},Ra=te=>{var ye=w(),Ze=u(ye);{var Ha=oe=>{var Ee=f("MX record lookup for domain itself");r(oe,Ee)},Ia=oe=>{var Ee=w(),Ta=u(Ee);{var Ma=ve=>{var ke=f();h($e=>c(ke,`DNS lookup test: ${$e??""}`),[()=>e(o).substring(7)]),r(ve,ke)},Wa=ve=>{var ke=w(),$e=u(ke);{var Ua=de=>{var De=f("Hard fail - reject unauthorized emails");r(de,De)},Ga=de=>{var De=w(),ja=u(De);{var Oa=ne=>{var Ne=f("Soft fail - mark unauthorized emails as suspicious");r(ne,Ne)},Xa=ne=>{var Ne=w(),La=u(Ne);{var Ba=ce=>{var Re=f("Pass all - allow any server (dangerous)");r(ce,Re)},Ya=ce=>{var Re=w(),qa=u(Re);{var Ja=he=>{var He=f("Neutral - no policy decision");r(he,He)},Ka=he=>{var He=f();h(()=>c(He,e(o))),r(he,He)};d(qa,he=>{e(o)==="?all"?he(Ja):he(Ka,!1)},!0)}r(ce,Re)};d(La,ce=>{e(o)==="+all"?ce(Ba):ce(Ya,!1)},!0)}r(ne,Ne)};d(ja,ne=>{e(o)==="~all"?ne(Oa):ne(Xa,!1)},!0)}r(de,De)};d($e,de=>{e(o)==="-all"?de(Ua):de(Ga,!1)},!0)}r(ve,ke)};d(Ta,ve=>{e(o).startsWith("exists:")?ve(Ma):ve(Wa,!1)},!0)}
21r(oe,Ee)};d(Ze,oe=>{e(o)==="mx"?oe(Ha):oe(Ia,!1)},!0)}r(te,ye)};d(Da,te=>{e(o).startsWith("mx:")?te(Na):te(Ra,!1)},!0)}r(le,ze)};d(Ve,le=>{e(o)==="a"?le(za):le(Ea,!1)},!0)}r(re,ge)};d(K,re=>{e(o).startsWith("a:")?re(Aa):re(Ca,!1)},!0)}r(X,D)};d(k,X=>{e(o).startsWith("ip6:")?X(be):X(Qe,!1)},!0)}r(P,n)};d(E,P=>{e(o).startsWith("ip4:")?P(H):P(W,!1)},!0)}r(z,O)};d(j,z=>{e(o).startsWith("v=spf1")?z(J):z(se,!1)})}a(M),a(y),h(()=>c(T,e(o))),r(F,y)}),a(b),a(x),r(m,x)};d(ie,m=>{e(t).expanded.mechanisms.length>0&&m(Je)})}var Ce=l(ie,2);{var Ke=m=>{const A=me(()=>e(t).expanded);var x=mi(),b=l(i(x),2);ea(b,21,()=>e(A).includes,aa,(F,o)=>{var y=pi(),C=i(y),T=i(C);S(T,{name:"external-link",size:"xs"});var M=l(T,2),j=i(M,!0);a(M),a(C);var J=l(C,2);{var se=E=>{var H=ci(),W=i(H),P=i(W,!0);a(W),a(H),h(()=>c(P,e(o).result.record)),r(E,H)};d(J,E=>{e(o).result.record&&E(se)})}var z=l(J,2);{var O=E=>{var H=hi(),W=i(H);S(W,{name:"alert-triangle",size:"xs"});var P=l(W,2),n=i(P,!0);a(P),a(H),h(()=>c(n,e(o).result.error)),r(E,H)};d(z,E=>{e(o).result.error&&E(O)})}a(y),h(()=>c(j,e(o).domain)),r(F,y)}),a(b),a(x),r(m,x)};d(Ce,m=>{e(t).expanded.includes.length>0&&m(Ke)})}a(Y),r(B,Y)};d(Pa,B=>{e(t).expanded&&B(wa)})}h(()=>{c(qe,`TXT record for ${e(R)??""}`),c(Fa,e(t).record)}),r(I,$)},fe=I=>{var $=_i(),_e=i($),Pe=i(_e);S(Pe,{name:"alert-triangle",size:"md"});var ee=l(Pe,2),xe=l(i(ee),2),ae=l(i(xe)),qe=i(ae,!0);a(ae),Q(),a(xe),Q(2),a(ee),a(_e),a($),h(()=>c(qe,e(R))),r(I,$)};d(Z,I=>{e(t).record?I(Ye):I(fe,!1)})}a(L),a(v),h(()=>{g.disabled=e(ue),c(G,` ${e(ue)?"Copied!":"Copy Results"}`)}),r(s,v)};d(oa,s=>{e(t)&&s(ya)})}var ka=l(oa,2);{var Sa=s=>{var v=bi(),_=i(v),g=i(_),U=i(g);S(U,{name:"alert-triangle",size:"md"});var G=l(U,2),L=l(i(G),2),Z=i(L,!0);a(L),a(G),a(g),a(_),a(v),h(()=>c(Z,e(Se))),r(s,v)};d(ka,s=>{e(Se)&&s(Sa)})}Q(2),a(Ue),h(s=>Fe.disabled=s,[()=>e(V)||!e(R).trim()]),ei(Be,()=>e(R),s=>N(R,s)),r(ia,Ue),Va()}$a(["click","change"]);export{Hi as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.