1import{ae as we,af as Te,i as Re,r as d,j as t}from"./index-C6ghbvAw.js";import{r as Ee,u as Le}from"./auth-middleware-BYgpMuin.js";import{C as me,b as he,c as xe,d as fe,a as pe}from"./card-DcpNRYUu.js";import{B as ue}from"./button-BbS7p2-k.js";import{I as je}from"./input-Cbwh2FhS.js";import{L as se}from"./label-tIvJrmCc.js";import{C as Pe}from"./checkbox-CAtmi11r.js";import{T as ke,d as $e,b as le,e as $,a as Be,c as m}from"./table-Dmh-JJu7.js";import{a as Fe,b as Ie,c as De,d as ge,S as Oe}from"./select-BFGQXtCb.js";import{B as I}from"./badge-BFUr7P7F.js";import{u as Ae}from"./use-toast-C3nhwJwR.js";import{G as be}from"./gauge-C-C38vw0.js";import{L as Ge}from"./loader-circle-BDyB7zlj.js";import"./index-C2P2Lrb-.js";import"./check-Rn0oPDsL.js";import"./createLucideIcon-Dy-MC8t5.js";import"./index-C0pbmnxW.js";import"./index-BHqJpBG2.js";import"./index-DHsQl3TH.js";import"./index-C-eifxmw.js";import"./chevron-down-lfBaL0Tq.js";const He=we({method:"POST"}).middleware([Ee]).handler(Te("9da2216d327075a913e79df08e55642579aaac1dd533d452a0ac7c2784b9e423")),Me="https://www.fortmcmurrayelectrician.ca",Se=["/","/about","/contact","/pricing","/blog","/service-areas","/emergency-electrician","/ev-charger-installation","/electrical-panel-upgrade-service","/solar"],ae=e=>e==null?"â":`${Math.round(e)} ms`,_e=e=>e==null?"â":e.toFixed(3),h=(e,i)=>{if(i==null)return{label:"â",variant:"secondary"};const B={lcp:[2500,4e3],fcp:[1800,3e3],tbt:[200,600],cls:[.1,.25]},[a,X]=B[e];return i<=a?{label:"Good",variant:"default"}:i<=X?{label:"Needs work",variant:"secondary"}:{label:"Poor",variant:"destructive"}},Ue=()=>{const e=Re.c(70),{toast:i}=Ae(),B=Le(He),[a,X]=d.useState(Me),[c,ve]=d.useState("mobile");let D;e[0]===Symbol.for("react.memo_cache_sentinel")?(D=Object.fromEntries(Se.map(Ve)),e[0]=D):D=e[0];const[o,re]=d.useState(D),[f,ce]=d.useState(""),[n,Ne]=d.useState(Se),[x,ne]=d.useState(!1),[F,ie]=d.useState(null);let O;e[1]===Symbol.for("react.memo_cache_sentinel")?(O=[],e[1]=O):O=e[1];const[p,oe]=d.useState(O);let A;e[2]===Symbol.for("react.memo_cache_sentinel")?(A=s=>re(l=>({...l,[s]:!l[s]})),e[2]=A):A=e[2];const Ce=A;let G;e[3]!==f||e[4]!==n?(G=()=>{const s=f.trim();if(!s)return;const l=s.startsWith("/")?s:`/${s}`;n.includes(l)||Ne([...n,l]),re(r=>({...r,[l]:!0})),ce("")},e[3]=f,e[4]=n,e[5]=G):G=e[5];const u=G;let H;e[6]!==B||e[7]!==a||e[8]!==n||e[9]!==o||e[10]!==c||e[11]!==i?(H=async()=>{const s=n.filter(r=>o[r]);if(s.length===0){i({title:"Pick at least one route",variant:"destructive"});return}ne(!0),oe([]),ie({done:0,total:s.length});const l=[];for(let r=0;r<s.length;r++){const ye=s[r],de=`${a.replace(/\/$/,"")}${ye}`;try{const ee=await B({data:{url:de,strategy:c}});l.push(ee)}catch(ee){const te=ee;l.push({url:de,strategy:c,error:te instanceof Error?te.message:String(te)})}oe([...l]),ie({done:r+1,total:s.length})}ne(!1),i({title:"Audit complete",description:`${s.length} route(s) scanned.`})},e[6]=B,e[7]=a,e[8]=n,e[9]=o,e[10]=c,e[11]=i,e[12]=H):H=e[12];const Y=H;let M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsxs(he,{children:[t.jsxs(xe,{className:"flex items-center gap-2",children:[t.jsx(be,{className:"w-5 h-5"})," PageSpeed Insights"]}),t.jsx(fe,{children:"Run Lighthouse audits against your live site and view LCP, FCP, TBT, and CLS for each route."})]}),e[13]=M):M=e[13];let _;e[14]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(se,{htmlFor:"origin",children:"Origin"}),e[14]=_):_=e[14];let U;e[15]===Symbol.for("react.memo_cache_sentinel")?(U=s=>X(s.target.value),e[15]=U):U=e[15];let j;e[16]!==a?(j=t.jsxs("div",{className:"md:col-span-2",children:[_,t.jsx(je,{id:"origin",value:a,onChange:U})]}),e[16]=a,e[17]=j):j=e[17];let V;e[18]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsx(se,{children:"Strategy"}),e[18]=V):V=e[18];let q;e[19]===Symbol.for("react.memo_cache_sentinel")?(q=s=>ve(s),e[19]=q):q=e[19];let K;e[20]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsx(Fe,{children:t.jsx(Ie,{})}),e[20]=K):K=e[20];let W;e[21]===Symbol.for("react.memo_cache_sentinel")?(W=t.jsxs(De,{children:[t.jsx(ge,{value:"mobile",children:"Mobile"}),t.jsx(ge,{value:"desktop",children:"Desktop"})]}),e[21]=W):W=e[21];let g;e[22]!==c?(g=t.jsxs("div",{children:[V,t.jsxs(Oe,{value:c,onValueChange:q,children:[K,W]})]}),e[22]=c,e[23]=g):g=e[23];let b;e[24]!==g||e[25]!==j?(b=t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[j,g]}),e[24]=g,e[25]=j,e[26]=b):b=e[26];let z;e[27]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx(se,{className:"mb-2 block",children:"Routes"}),e[27]=z):z=e[27];let S;if(e[28]!==n||e[29]!==o){let s;e[31]!==o?(s=l=>t.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[t.jsx(Pe,{checked:!!o[l],onCheckedChange:()=>Ce(l)}),t.jsx("span",{className:"truncate",children:l})]},l),e[31]=o,e[32]=s):s=e[32],S=n.map(s),e[28]=n,e[29]=o,e[30]=S}else S=e[30];let v;e[33]!==S?(v=t.jsxs("div",{children:[z,t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 max-h-72 overflow-auto border rounded p-3",children:S})]}),e[33]=S,e[34]=v):v=e[34];let J;e[35]===Symbol.for("react.memo_cache_sentinel")?(J=s=>ce(s.target.value),e[35]=J):J=e[35];let N;e[36]!==u?(N=s=>
1s.key==="Enter"&&(s.preventDefault(),u()),e[36]=u,e[37]=N):N=e[37];let C;e[38]!==f||e[39]!==N?(C=t.jsx(je,{placeholder:"/custom-path",value:f,onChange:J,onKeyDown:N}),e[38]=f,e[39]=N,e[40]=C):C=e[40];let y;e[41]!==u?(y=t.jsx(ue,{type:"button",variant:"outline",onClick:u,children:"Add"}),e[41]=u,e[42]=y):y=e[42];let w;e[43]!==C||e[44]!==y?(w=t.jsxs("div",{className:"flex gap-2",children:[C,y]}),e[43]=C,e[44]=y,e[45]=w):w=e[45];let T;e[46]!==x?(T=x?t.jsx(Ge,{className:"w-4 h-4 mr-2 animate-spin"}):t.jsx(be,{className:"w-4 h-4 mr-2"}),e[46]=x,e[47]=T):T=e[47];const Z=x?"Runningâ¦":"Run audit";let R;e[48]!==Y||e[49]!==x||e[50]!==T||e[51]!==Z?(R=t.jsxs(ue,{onClick:Y,disabled:x,children:[T,Z]}),e[48]=Y,e[49]=x,e[50]=T,e[51]=Z,e[52]=R):R=e[52];let E;e[53]!==F?(E=F&&t.jsxs("span",{className:"text-sm text-muted-foreground",children:[F.done," / ",F.total]}),e[53]=F,e[54]=E):E=e[54];let L;e[55]!==R||e[56]!==E?(L=t.jsxs("div",{className:"flex items-center gap-4",children:[R,E]}),e[55]=R,e[56]=E,e[57]=L):L=e[57];let P;e[58]!==b||e[59]!==v||e[60]!==w||e[61]!==L?(P=t.jsxs(me,{children:[M,t.jsxs(pe,{className:"space-y-4",children:[b,v,w,L]})]}),e[58]=b,e[59]=v,e[60]=w,e[61]=L,e[62]=P):P=e[62];let k;e[63]!==a||e[64]!==p||e[65]!==c?(k=p.length>0&&t.jsxs(me,{children:[t.jsxs(he,{children:[t.jsx(xe,{children:"Results"}),t.jsxs(fe,{children:["Latest run · ",c]})]}),t.jsxs(pe,{children:[t.jsx("div",{className:"overflow-x-auto",children:t.jsxs(ke,{children:[t.jsx($e,{children:t.jsxs(le,{children:[t.jsx($,{children:"Route"}),t.jsx($,{children:"Score"}),t.jsx($,{children:"LCP"}),t.jsx($,{children:"FCP"}),t.jsx($,{children:"TBT"}),t.jsx($,{children:"CLS"})]})}),t.jsx(Be,{children:p.map((s,l)=>{const r=s.url.replace(a.replace(/\/$/,""),"")||"/";return"error"in s?t.jsxs(le,{children:[t.jsx(m,{className:"font-mono text-xs",children:r}),t.jsx(m,{colSpan:5,className:"text-destructive text-xs",children:s.error})]},l):t.jsxs(le,{children:[t.jsx(m,{className:"font-mono text-xs",children:r}),t.jsx(m,{children:s.performanceScore!=null?t.jsx(I,{variant:s.performanceScore>=90?"default":s.performanceScore>=50?"secondary":"destructive",children:s.performanceScore}):"â"}),t.jsx(m,{children:t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("span",{children:ae(s.lcp)}),t.jsx(I,{variant:h("lcp",s.lcp).variant,className:"w-fit text-xs",children:h("lcp",s.lcp).label})]})}),t.jsx(m,{children:t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("span",{children:ae(s.fcp)}),t.jsx(I,{variant:h("fcp",s.fcp).variant,className:"w-fit text-xs",children:h("fcp",s.fcp).label})]})}),t.jsx(m,{children:t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("span",{children:ae(s.tbt)}),t.jsx(I,{variant:h("tbt",s.tbt).variant,className:"w-fit text-xs",children:h("tbt",s.tbt).label})]})}),t.jsx(m,{children:t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("span",{children:_e(s.cls)}),t.jsx(I,{variant:h("cls",s.cls).variant,className:"w-fit text-xs",children:h("cls",s.cls).label})]})})]},l)})})]})}),p.some(qe)&&t.jsxs("div",{className:"mt-4 text-xs text-muted-foreground space-y-1",children:[t.jsx("p",{className:"font-semibold",children:"LCP elements:"}),p.map((s,l)=>"lcpElement"in s&&s.lcpElement?t.jsxs("p",{className:"font-mono truncate",children:[s.url.replace(a.replace(/\/$/,""),"")||"/",": ",s.lcpElement]},l):null)]})]})]}),e[63]=a,e[64]=p,e[65]=c,e[66]=k):k=e[66];let Q;return e[67]!==P||e[68]!==k?(Q=t.jsxs("div",{className:"space-y-6",children:[P,k]}),e[67]=P,e[68]=k,e[69]=Q):Q=e[69],Q};function Ve(e){return[e,e==="/"]}function qe(e){return"lcpElement"in e&&e.lcpElement}const xt=Ue;export{xt 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.