1var vo=Object.defineProperty;var wo=(s,t,r)=>t in s?vo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r;var n=(s,t,r)=>wo(s,typeof t!="symbol"?t+"":t,r);import{j as e}from"./motion-vendor-BE-GCbLH.js";import{r as T}from"./charts-vendor-DVOtnI0g.js";import{J as So,K as To,N as _o,O as Co,Q as Ao,R as ko,U as Po,Z as ft,V as Io,W as Do,X as Uo,Y as Lo,_ as Oo,$ as zo,a0 as Fo,a1 as Bo,a2 as Mo,a3 as Jt,a4 as Eo,a5 as Ro,a6 as Vo,a7 as qo,a8 as $o,a9 as Qo,aa as Wo,ab as Go,ac as Zo,ad as Ko,ae as Xo,af as Yo,ag as Ho,ah as Jo,ai as ec,aj as tc,ak as sc,al as rc,am as ic,an as nc,ao as ac,ap as lc,aq as oc,ar as cc,as as dc,at as mc,au as uc,av as pc,aw as xc,ax as hc,ay as gc,az as it,aA as Ot,aB as fc,aC as zt,aD as bc,aE as oa,aF as yc,aG as Nc,aH as jc,aI as vc,aJ as es,aK as ca,aL as wc,aM as Sc,aN as Tc,aO as _c,aP as Cc,aQ as Ac,aR as kc,aS as Pc,aT as Ic,aU as Dc,aV as Uc,aW as Lc,aX as Oc,aY as zc,aZ as Fc,a_ as Bc,a$ as Mc,b0 as da,b1 as Ec,b2 as nt,b3 as ae,b4 as Rc,b5 as Vc,b6 as qc,b7 as $c,b8 as Qc,b9 as Wc,ba as Fe,bb as Gc,bc as Zc,bd as ma,be as Kc,bf as Xc,bg as Yc,bh as $,bi as Hc,bj as Jc,bk as ed,bl as Ft,bm as td,bn as sd,bo as rd,h as R,B as L,u as Bt,j as ze,o as id,a as nd,i as ua,n as ad,bp as Qe,bq as We,b as Ge,br as ld,bs as ts,I as be,bt as pa,A as od,F as cd,bu as dd,bv as md,bw as bt,bx as ud,by as pd,bz as xd,bA as hd,bB as gd,m as fd,bC as bd,k as Ze,bD as yd,bE as Nd,bF as jd,bG as vd}from"./index-D0VHnXG-.js";import{F as Ke,a as ce,b as de,c as me,d as ue,e as Oe}from"./form-g01cvF75.js";import{T as wd,a as Sd,b as Xe,c as Ye}from"./tabs-Cf5j_Yz4.js";import{C as Td,a as _d}from"./card-DJZYedW7.js";import{R as Cd}from"./report-card-D2hqagtC.js";import{C as Ad,a as kd,b as Pd}from"./collapsible-Bk7w1MfX.js";import{P as ye}from"./panel-Cz4GPedQ.js";import{r as se,a3 as ss,G as rs,D as xa,a4 as Mt,e as ha,C as Id,a5 as Me,S as ga,a6 as Dd,a7 as fa,a8 as Je,k as Ud,T as Et,a9 as Ld,aa as Od,ab as zd,c as Fd,R as Bd,ac as yt,ad as _t,W as Md,ae as et,af as Ct,a1 as Nt,ag as Ed,t as Rd,A as ba,N as Vd,i as qd,q as $d,ah as Qd,ai as Wd,Q as Gd,aj as Zd,ak as Kd,al as Xd,am as is,an as Yd,ao as ns,a as Hd}from"./icons-vendor-MwoZ9gsP.js";import{B as Te}from"./badge-DSbx8gFl.js";import Jd from"./enhanced-loading-D66OmnVf.js";import em from"./analysis-retry-modal-BH5I_y-v.js";import tm from"./upgrade-modal-DwbARWPF.js";import{EmailGateModal as sm}from"./email-gate-modal-Ahl3gfnD.js";import{MagicLinkModal as rm}from"./magic-link-modal-4kcOE-KA.js";import{A as im,P as nm}from"./app-shell-DgUhP9bR.js";import{p as am}from"./page-faqs-FPeTQZiw.js";import"./relative-time-CthbuWCB.js";import"./funnel-BSxoEh2h.js";import"./textarea-wZSVc9F2.js";import"./index-T_uoFYHL.js";import"./select-DlcrllX_.js";import"./promo-config-DOdn3Wkh.js";import"./feedback-widget-D0j_ZUso.js";const lm=Object.freeze(Object.defineProperty({__proto__:null,BRAND:So,DIRTY:To,EMPTY_PATH:_o,INVALID:Co,NEVER:Ao,OK:ko,ParseStatus:Po,Schema:ft,ZodAny:Io,ZodArray:Do,ZodBigInt:Uo,ZodBoolean:Lo,ZodBranded:Oo,ZodCatch:zo,ZodDate:Fo,ZodDefault:Bo,ZodDiscriminatedUnion:Mo,ZodEffects:Jt,ZodEnum:Eo,ZodError:Ro,get ZodFirstPartyTypeKind(){return Vo},ZodFunction:qo,ZodIntersection:$o,ZodIssueCode:Qo,ZodLazy:Wo,ZodLiteral:Go,ZodMap:Zo,ZodNaN:Ko,ZodNativeEnum:Xo,ZodNever:Yo,ZodNull:Ho,ZodNullable:Jo,ZodNumber:ec,ZodObject:tc,ZodOptional:sc,ZodParsedType:rc,ZodPipeline:ic,ZodPromise:nc,ZodReadonly:ac,ZodRecord:lc,ZodSchema:ft,ZodSet:oc,ZodString:cc,ZodSymbol:dc,ZodTransformer:Jt,ZodTuple:mc,ZodType:ft,ZodUndefined:uc,ZodUnion:pc,ZodUnknown:xc,ZodVoid:hc,addIssueToContext:gc,any:it,array:Ot,bigint:fc,boolean:zt,coerce:bc,custom:oa,date:yc,datetimeRegex:Nc,defaultErrorMap:jc,discriminatedUnion:vc,effect:es,enum:ca,function:wc,getErrorMap:Sc,getParsedType:Tc,instanceof:_c,intersection:Cc,isAborted:Ac,isAsync:kc,isDirty:Pc,isValid:Ic,late:Dc,lazy:Uc,literal:Lc,makeIssue:Oc,map:zc,nan:Fc,nativeEnum:Bc,never:Mc,null:da,nullable:Ec,number:nt,object:ae,get objectUtil(){return Rc},oboolean:Vc,onumber:qc,optional:$c,ostring:Qc,pipeline:Wc,preprocess:Fe,promise:G
1c,quotelessJson:Zc,record:ma,set:Kc,setErrorMap:Xc,strictObject:Yc,string:$,symbol:Hc,transformer:es,tuple:Jc,undefined:ed,union:Ft,unknown:td,get util(){return sd},void:rd},Symbol.toStringTag,{value:"Module"})),o=Symbol.for("drizzle:entityKind");function I(s,t){if(!s||typeof s!="object")return!1;if(s instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,o))throw new Error(`Class "${t.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let r=Object.getPrototypeOf(s).constructor;if(r)for(;r;){if(o in r&&r[o]===t[o])return!0;r=Object.getPrototypeOf(r)}return!1}var ys;ys=o;class Ae{constructor(t,r){n(this,"name");n(this,"keyAsName");n(this,"primary");n(this,"notNull");n(this,"default");n(this,"defaultFn");n(this,"onUpdateFn");n(this,"hasDefault");n(this,"isUnique");n(this,"uniqueName");n(this,"uniqueType");n(this,"dataType");n(this,"columnType");n(this,"enumValues");n(this,"generated");n(this,"generatedIdentity");n(this,"config");this.table=t,this.config=r,this.name=r.name,this.keyAsName=r.keyAsName,this.notNull=r.notNull,this.default=r.default,this.defaultFn=r.defaultFn,this.onUpdateFn=r.onUpdateFn,this.hasDefault=r.hasDefault,this.primary=r.primaryKey,this.isUnique=r.isUnique,this.uniqueName=r.uniqueName,this.uniqueType=r.uniqueType,this.dataType=r.dataType,this.columnType=r.columnType,this.generated=r.generated,this.generatedIdentity=r.generatedIdentity}mapFromDriverValue(t){return t}mapToDriverValue(t){return t}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}n(Ae,ys,"Column");var Ns;Ns=o;class ya{constructor(t,r,i){n(this,"config");n(this,"$default",this.$defaultFn);n(this,"$onUpdate",this.$onUpdateFn);this.config={name:t,keyAsName:t==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:r,columnType:i,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(t){return this.config.default=t,this.config.hasDefault=!0,this}$defaultFn(t){return this.config.defaultFn=t,this.config.hasDefault=!0,this}$onUpdateFn(t){return this.config.onUpdateFn=t,this.config.hasDefault=!0,this}primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(t){this.config.name===""&&(this.config.name=t)}}n(ya,Ns,"ColumnBuilder");const _e=Symbol.for("drizzle:Name");var js;js=o;class Na{constructor(t,r){n(this,"reference");n(this,"_onUpdate","no action");n(this,"_onDelete","no action");this.reference=()=>{const{name:i,columns:a,foreignColumns:c}=t();return{name:i,columns:a,foreignTable:c[0].table,foreignColumns:c}},r&&(this._onUpdate=r.onUpdate,this._onDelete=r.onDelete)}onUpdate(t){return this._onUpdate=t===void 0?"no action":t,this}onDelete(t){return this._onDelete=t===void 0?"no action":t,this}build(t){return new ja(t,this)}}n(Na,js,"PgForeignKeyBuilder");var vs;vs=o;class ja{constructor(t,r){n(this,"reference");n(this,"onUpdate");n(this,"onDelete");this.table=t,this.reference=r.reference,this.onUpdate=r._onUpdate,this.onDelete=r._onDelete}getName(){const{name:t,columns:r,foreignColumns:i}=this.reference(),a=r.map(b=>b.name),c=i.map(b=>b.name),x=[this.table[_e],...a,i[0].table[_e],...c];return t??`${x.join("_")}_fk`}}n(ja,vs,"PgForeignKey");function om(s,...t){return s(...t)}function cm(s,t){return`${s[_e]}_${t.join("_")}_unique`}function as(s,t,r){for(let i=t;i<s.length;i++){const a=s[i];if(a==="\\"){i++;continue}if(a==='"')return[s.slice(t,i).replace(/\\/g,""),i+1];if(!r&&(a===","||a==="}"))return[s.slice(t,i).replace(/\\/g,""),i]}return[s.slice(t).replace(/\\/g,""),s.length]}function va(s,t=0){const r=[];let i=t,a=!1;for(;i<s.length;){const c=s[i];if(c===","){(a||i===t)&&r.push(""),a=!0,i++;continue}if(a=!1,c==="\\"){i+=2;continue}if(c==='"'){const[h,j]=as(s,i+1,!0);r.push(h),i=j;continue}if(c==="}")return[r,i+1];if(c==="{"){const[h,j]=va(s,i+1);r.push(h),i=j;continue}const[x,b]=as(s,i,!1);r.push(x),i=b}return[r,i]}function dm(s){const[t]=va(s,1);return t}function wa(s){return`{${s.map(t=>
1Array.isArray(t)?wa(t):typeof t=="string"?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${t}`).join(",")}}`}var ws,Ss;class v extends(Ss=ya,ws=o,Ss){constructor(){super(...arguments);n(this,"foreignKeyConfigs",[])}array(r){return new Ta(this.config.name,this,r)}references(r,i={}){return this.foreignKeyConfigs.push({ref:r,actions:i}),this}unique(r,i){return this.config.isUnique=!0,this.config.uniqueName=r,this.config.uniqueType=i==null?void 0:i.nulls,this}generatedAlwaysAs(r){return this.config.generated={as:r,type:"always",mode:"stored"},this}buildForeignKeys(r,i){return this.foreignKeyConfigs.map(({ref:a,actions:c})=>om((x,b)=>{const h=new Na(()=>{const j=x();return{columns:[r],foreignColumns:[j]}});return b.onUpdate&&h.onUpdate(b.onUpdate),b.onDelete&&h.onDelete(b.onDelete),h.build(i)},a,c))}buildExtraConfigColumn(r){return new Sa(r,this.config)}}n(v,ws,"PgColumnBuilder");var Ts,_s;class N extends(_s=Ae,Ts=o,_s){constructor(t,r){r.uniqueName||(r.uniqueName=cm(t,[r.name])),super(t,r),this.table=t}}n(N,Ts,"PgColumn");var Cs,As;class Sa extends(As=N,Cs=o,As){constructor(){super(...arguments);n(this,"indexConfig",{order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass});n(this,"defaultConfig",{order:"asc",nulls:"last",opClass:void 0})}getSQLType(){return this.getSQLType()}asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(r){return this.indexConfig.opClass=r,this}}n(Sa,Cs,"ExtraConfigColumn");var ks;ks=o;class tt{constructor(t,r,i,a){n(this,"name");n(this,"keyAsName");n(this,"type");n(this,"indexConfig");this.name=t,this.keyAsName=r,this.type=i,this.indexConfig=a}}n(tt,ks,"IndexedColumn");var Ps,Is;class Ta extends(Is=v,Ps=o,Is){constructor(t,r,i){super(t,"array","PgArray"),this.config.baseBuilder=r,this.config.size=i}build(t){const r=this.config.baseBuilder.build(t);return new At(t,this.config,r)}}n(Ta,Ps,"PgArrayBuilder");var Ds,Us;const ct=class ct extends(Us=N,Ds=o,Us){constructor(r,i,a,c){super(r,i);n(this,"size");this.baseColumn=a,this.range=c,this.size=i.size}getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size=="number"?this.size:""}]`}mapFromDriverValue(r){return typeof r=="string"&&(r=dm(r)),r.map(i=>this.baseColumn.mapFromDriverValue(i))}mapToDriverValue(r,i=!1){const a=r.map(c=>c===null?null:I(this.baseColumn,ct)?this.baseColumn.mapToDriverValue(c,!0):this.baseColumn.mapToDriverValue(c));return i?a:wa(a)}};n(ct,Ds,"PgArray");let At=ct;const ls=Symbol.for("drizzle:isPgEnum");function mm(s){return!!s&&typeof s=="function"&&ls in s&&s[ls]===!0}var Ls;Ls=o;class Rt{constructor(t,r,i,a=!1){this._={brand:"Subquery",sql:t,selectedFields:r,alias:i,isWith:a}}}n(Rt,Ls,"Subquery");const um={startActiveSpan(s,t){return t()}},Ce=Symbol.for("drizzle:ViewBaseConfig"),jt=Symbol.for("drizzle:Schema"),os=Symbol.for("drizzle:Columns"),cs=Symbol.for("drizzle:ExtraConfigColumns"),vt=Symbol.for("drizzle:OriginalName"),wt=Symbol.for("drizzle:BaseName"),at=Symbol.for("drizzle:IsAlias"),ds=Symbol.for("drizzle:ExtraConfigBuilder"),_a=Symbol.for("drizzle:IsDrizzleTable");var Os,zs,Fs,Bs,Ms,Es,Rs,Vs,qs,$s;$s=o,qs=_e,Vs=vt,Rs=jt,Es=os,Ms=cs,Bs=wt,Fs=at,zs=_a,Os=ds;class V{constructor(t,r,i){n(this,qs);n(this,Vs);n(this,Rs);n(this,Es);n(this,Ms);n(this,Bs);n(this,Fs,!1);n(this,zs,!0);n(this,Os);this[_e]=this[vt]=t,this[jt]=r,this[wt]=i}}n(V,$s,"Table"),n(V,"Symbol",{Name:_e,Schema:jt,OriginalName:vt,Columns:os,ExtraConfigColumns:cs,BaseName:wt,IsAlias:at,ExtraConfigBuilder:ds});function Ca(s){return typeof s=="object"&&s!==null&&_a in s}function pm(s){return s!=null&&typeof s.getSQL=="function"}function xm(s){var r;const t={sql:"",params:[]};for(const i of s)t.sql+=i.sql,t.params.push(...i.params),(r=i.typings)!=null&&r.length&&(t.typings||(t.typings=[]),t.typings.push(...i.typings));return t}var Qs;Qs=o;class Y{constructor(t){n(this,"value");this.value=Array.isArray(t)?t:[t]}getSQL(){return new k([this])}}n(Y,Qs,"StringChunk");var Ws;Ws=o;const Ne=class Ne{constructor(t){n(this,"decoder",Aa);n(this,"shouldInlineParams",!1);this.queryChunks=t}append(t){return this.queryChunks.push(...t.queryChunks),this}toQuery(t){return um.startActiveSpan("drizzle.buildSQL",r=>{const i=this.buildQueryFromSourceParams(this.queryChunks,t);return r==null||r.setAttributes({"drizzle.query.text":i.sql,"drizzle.query.params":JSON.stringify(i.params)}),i})}buildQueryFromSourceParams(t,r){const i=Object.assign({},r,{inlineParams:r.inlineParams||this.shouldInlineParams,paramStartIndex:r.paramStartIndex||{value:0}}),{casing:a,escapeName:c,escapeParam:x,prepareTyping:b,inlineParams:h,paramStartIndex:j}=i;return xm(t.map(d=>{var y;if(I(d,Y))return{sql:d.value.join(""),params:[]};if(I(d,lt))return{sql:c(d.value),params:[]};if(d===void 0)return{sql:"",params:[]};if(Array.isArray(d)){const m=[new Y("(")];for(const[p,w]of d.entries())m.push(w),p<d.length-1&&m.push(new Y(", "));return m.push(new Y(")")),this.buildQueryFromSourceParams(m,i)}if(I(d,Ne))return this.buildQueryFromSourceParams(d.queryChunks,{...i,inlineParams:h||d.shouldInlineParams});if(I(d,V)){const m=d[V.Symbol.Schema],p=d[V.Symbol.Name];return{sql:m===void 0||d[at]?c(p):c(m)+"."+c(p),params:[]}}if(I(d,Ae)){const m=a.getColumnCasing(d);if(r.invokeSource==="indexes")return{sql:c(m),params:[]};const p=d.table[V.Symbol.Schema];return{sql:d.table[at]||p===void 0?c(d.table[V.Symbol.Name])+"."+c(m):c(p)+"."+c(d.table[V.Symbol.Name])+"."+c(m),params:[]}}if(I(d,Ia)){const m=d[Ce].schema,p=d[Ce].name;return{sql:m===void 0||d[Ce].isAlias?c(p):c(m)+"."+c(p),params:[]}}if(I(d,Vt)){if(I(d.value,ot))return{sql:x(j.value++,d),params:[d],typings:["none"]};const m=d.value===null?null:d.encoder.mapToDriverValue(d.value);if(I(m,Ne))return this.buildQueryFromSourceParams([m],i);if(h)return{sql:this.mapInlineParam(m,i),params:[]};let p=["none"];return b&&(p=[b(d.encoder)]),{sql:x(j.value++,m),params:[m],typings:p}}return I(d,ot)?{sql:x(j.value++,d),params:[d],typings:["none"]}:I(d,Ne.Aliased)&&d.fieldAlias!==void 0?{sql:c(d.fieldAlias),params:[]}:I(d,Rt)?d._.isWith?{sql:c(d._.alias),params:[]}:this.buildQueryFromSourceParams([new Y("("),d._.sql,new Y(") "),new lt(d._.alias)],i):mm(d)?d.schema?{sql:c(d.schema)+"."+c(d.enumName),params:[]}:{sql:c(d.enumName),params:[]}:pm(d)?(y=d.shouldOmitSQLParens)!=null&&y.call(d)?this.buildQueryFromSourceParams([d.getSQL()],i):this.buildQueryFromSourceParams([new Y("("),d.getSQL(),new Y(")")],i):h?{sql:this.mapInlineParam(d,i),params:[]}:{sql:x(j.value++,d),params:[d],typings:["none"]}}))}mapInlineParam(t,{escapeString:r}){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return t.toString();if(typeof t=="string")return r(t);if(typeof t=="object"){const i=t.toString();return r(i==="[object Object]"?JSON.stringify(t):i)}throw new Error("Unexpected param value: "+t)}getSQL(){return this}as(t){return t===void 0?this:new Ne.Aliased(this,t)}mapWith(t){return this.decoder=typeof t=="function"?{mapFromDriverValue:t}:t,this}inlineParams(){return this.shouldInlineParams=!0,this}if(t){return t?this:void 0}};n(Ne,Ws,"SQL");let k=Ne;var Gs;Gs=o;class lt{constructor(t){n(this,"brand");this.value=t}getSQL(){return new k([this])}}n(lt,Gs,"Name");const Aa={mapFromDriverValue:s=>s},ka={mapToDriverValue:s=>s};({...Aa,...ka});var Zs;Zs=o;class Vt{constructor(t,r=ka){n(this,"brand");this.value=t,this.encoder=r}getSQL(){return new k([this])}}n(Vt,Zs,"Param");function pe(s,...t){const r=[];(t.length>0||s.length>0&&s[0]!=="")&&r.push(new Y(s[0]));
1for(const[i,a]of t.entries())r.push(a,new Y(s[i+1]));return new k(r)}(s=>{function t(){return new k([])}s.empty=t;function r(h){return new k(h)}s.fromList=r;function i(h){return new k([new Y(h)])}s.raw=i;function a(h,j){const d=[];for(const[y,m]of h.entries())y>0&&j!==void 0&&d.push(j),d.push(m);return new k(d)}s.join=a;function c(h){return new lt(h)}s.identifier=c;function x(h){return new ot(h)}s.placeholder=x;function b(h,j){return new Vt(h,j)}s.param=b})(pe||(pe={}));(s=>{var r;r=o;const i=class i{constructor(c,x){n(this,"isSelectionField",!1);this.sql=c,this.fieldAlias=x}getSQL(){return this.sql}clone(){return new i(this.sql,this.fieldAlias)}};n(i,r,"SQL.Aliased");let t=i;s.Aliased=t})(k||(k={}));var Ks;Ks=o;class ot{constructor(t){this.name=t}getSQL(){return new k([this])}}n(ot,Ks,"Placeholder");const Pa=Symbol.for("drizzle:IsDrizzleView");var Xs,Ys,Hs;Hs=o,Ys=Ce,Xs=Pa;class Ia{constructor({name:t,schema:r,selectedFields:i,query:a}){n(this,Ys);n(this,Xs,!0);this[Ce]={name:t,originalName:t,schema:r,selectedFields:i,query:a,isExisting:!a,isAlias:!1}}getSQL(){return new k([this])}}n(Ia,Hs,"View");function hm(s){return typeof s=="object"&&s!==null&&Pa in s}Ae.prototype.getSQL=function(){return new k([this])};V.prototype.getSQL=function(){return new k([this])};Rt.prototype.getSQL=function(){return new k([this])};var Js;Js=o;class Da{constructor(t,r){n(this,"brand");this.name=t,this.value=r}build(t){return new Ua(t,this)}}n(Da,Js,"PgCheckBuilder");var er;er=o;class Ua{constructor(t,r){n(this,"name");n(this,"value");this.table=t,this.name=r.name,this.value=r.value}}n(Ua,er,"PgCheck");function st(s,t){return new Da(s,t)}function gm(s){return s[V.Symbol.Columns]}function fm(s){return s[Ce].selectedFields}function O(s,t){return{name:typeof s=="string"&&s.length>0?s:"",config:typeof s=="object"?s:t}}var tr,sr;class Ee extends(sr=v,tr=o,sr){generatedAlwaysAsIdentity(t){if(t){const{name:r,...i}=t;this.config.generatedIdentity={type:"always",sequenceName:r,sequenceOptions:i}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(t){if(t){const{name:r,...i}=t;this.config.generatedIdentity={type:"byDefault",sequenceName:r,sequenceOptions:i}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}n(Ee,tr,"PgIntColumnBaseBuilder");var rr,ir;class La extends(ir=Ee,rr=o,ir){constructor(t){super(t,"number","PgBigInt53")}build(t){return new Oa(t,this.config)}}n(La,rr,"PgBigInt53Builder");var nr,ar;class Oa extends(ar=N,nr=o,ar){getSQLType(){return"bigint"}mapFromDriverValue(t){return typeof t=="number"?t:Number(t)}}n(Oa,nr,"PgBigInt53");var lr,or;class za extends(or=Ee,lr=o,or){constructor(t){super(t,"bigint","PgBigInt64")}build(t){return new Fa(t,this.config)}}n(za,lr,"PgBigInt64Builder");var cr,dr;class Fa extends(dr=N,cr=o,dr){getSQLType(){return"bigint"}mapFromDriverValue(t){return BigInt(t)}}n(Fa,cr,"PgBigInt64");function bm(s,t){const{name:r,config:i}=O(s,t);return i.mode==="number"?new La(r):new za(r)}var mr,ur;class Ba extends(ur=v,mr=o,ur){constructor(t){super(t,"number","PgBigSerial53"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new Ma(t,this.config)}}n(Ba,mr,"PgBigSerial53Builder");var pr,xr;class Ma extends(xr=N,pr=o,xr){getSQLType(){return"bigserial"}mapFromDriverValue(t){return typeof t=="number"?t:Number(t)}}n(Ma,pr,"PgBigSerial53");var hr,gr;class Ea extends(gr=v,hr=o,gr){constructor(t){super(t,"bigint","PgBigSerial64"),this.config.hasDefault=!0}build(t){return new Ra(t,this.config)}}n(Ea,hr,"PgBigSerial64Builder");var fr,br;class Ra extends(br=N,fr=o,br){getSQLType(){return"bigserial"}mapFromDriverValue(t){return BigInt(t)}}n(Ra,fr,"PgBigSerial64");function ym(s,t){const{name:r,config:i}=O(s,t);return i.mode==="number"?new Ba(r):new Ea(r)}var yr,Nr;class Va extends(Nr=v,yr=o,Nr){constructor(t){super(t,"boolean","PgBoolean")}build(t){return new qa(t,this.config)}}n(Va,yr,"PgBooleanBuilder");var jr,vr;class qa extends(vr=N,jr=o,vr){getSQLType(){return"boolean"}}n(qa,jr,"PgBoolean");function Re(s){return new Va(s??"")}var wr,Sr;class $a extends(Sr=v,wr=o,Sr){constructor(t,r){super(t,"string","PgChar"),this.config.length=r.length,this.config.enumValues=r.enum}build(t){return new Qa(t,this.config)}}n($a,wr,"PgCharBuilder");var Tr,_r;class Qa extends(_r=N,Tr=o,_r){constructor(){super(...arguments);n(this,"length",this.config.length);n(this,"enumValues",this.config.enumValues)}getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}n(Qa,Tr,"PgChar");function Nm(s,t={}){const{name:r,config:i}=O(s,t);return new $a(r,i)}var Cr,Ar;class Wa extends(Ar=v,Cr=o,Ar){constructor(t){super(t,"string","PgCidr")}build(t){return new Ga(t,this.config)}}n(Wa,Cr,"PgCidrBuilder");var kr,Pr;class Ga extends(Pr=N,kr=o,Pr){getSQLType(){return"cidr"}}n(Ga,kr,"PgCidr");function jm(s){return new Wa(s??"")}var Ir,Dr;class Za extends(Dr=v,Ir=o,Dr){constructor(t,r,i){super(t,"custom","PgCustomColumn"),this.config.fieldConfig=r,this.config.customTypeParams=i}build(t){return new Ka(t,this.config)}}n(Za,Ir,"PgCustomColumnBuilder");var Ur,Lr;class Ka extends(Lr=N,Ur=o,Lr){constructor(r,i){super(r,i);n(this,"sqlName");n(this,"mapTo");n(this,"mapFrom");this.sqlName=i.customTypeParams.dataType(i.fieldConfig),this.mapTo=i.customTypeParams.toDriver,this.mapFrom=i.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(r){return typeof this.mapFrom=="function"?this.mapFrom(r):r}mapToDriverValue(r){return typeof this.mapTo=="function"?this.mapTo(r):r}}n(Ka,Ur,"PgCustomColumn");function vm(s){return(t,r)=>{const{name:i,config:a}=O(t,r);return new Za(i,a,s)}}var Or,zr;class ke extends(zr=v,Or=o,zr){defaultNow(){return this.default(pe`now()`)}}n(ke,Or,"PgDateColumnBaseBuilder");var Fr,Br;class Xa extends(Br=ke,Fr=o,Br){constructor(t){super(t,"date","PgDate")}build(t){return new Ya(t,this.config)}}n(Xa,Fr,"PgDateBuilder");var Mr,Er;class Ya extends(Er=N,Mr=o,Er){getSQLType(){return"date"}mapFromDriverValue(t){return new Date(t)}mapToDriverValue(t){return t.toISOString()}}n(Ya,Mr,"PgDate");var Rr,Vr;class Ha extends(Vr=ke,Rr=o,Vr){constructor(t){super(t,"string","PgDateString")}build(t){return new Ja(t,this.config)}}n(Ha,Rr,"PgDateStringBuilder");var qr,$r;class Ja extends($r=N,qr=o,$r){getSQLType(){return"date"}}n(Ja,qr,"PgDateString");function wm(s,t){const{name:r,config:i}=O(s,t);return(i==null?void 0:i.mode)==="date"?new Xa(r):new Ha(r)}var Qr,Wr;class el extends(Wr=v,Qr=o,Wr){constructor(t){super(t,"number","PgDoublePrecision")}build(t){return new tl(t,this.config)}}n(el,Qr,"PgDoublePrecisionBuilder");var Gr,Zr;class tl extends(Zr=N,Gr=o,Zr){getSQLType(){return"double precision"}mapFromDriverValue(t){return typeof t=="string"?Number.parseFloat(t):t}}n(tl,Gr,"PgDoublePrecision");function Sm(s){return new el(s??"")}var Kr,Xr;class sl extends(Xr=v,Kr=o,Xr){constructor(t){super(t,"string","PgInet")}build(t){return new rl(t,this.config)}}n(sl,Kr,"PgInetBuilder");var Yr,Hr;class rl extends(Hr=N,Yr=o,Hr){getSQLType(){return"inet"}}n(rl,Yr,"PgInet");function Tm(s){return new sl(s??"")}var Jr,ei;class il extends(ei=Ee,Jr=o,ei){constructor(t){super(t,"number","PgInteger")}build(t){return new nl(t,this.config)}}n(il,Jr,"PgIntegerBuilder");var ti,si;class nl extends(si=N,ti=o,si){getSQLType(){return"integer"}mapFromDriverValue(t){return typeof t=="string"?Number.parseInt(t):t}}n(nl,ti,"PgInteger");function dt(s){return new il(s??"")}var ri,ii;class al extends(ii=v,ri=o,ii){constructor(t,r){super(t,"string","PgInterval"),this.config.intervalConfig=r}build(t){return new ll(t,this.config)}}n(al,ri,"PgIntervalBuilder");var ni,ai;class ll extends(ai=N,ni=o,ai){constructor(){super(...arguments);n(this,"fields",this.config.intervalConfig.fields);n(this,"precision",this.config.intervalConfig.precision)}getSQLType(){const r=this.fields?` ${this.fields}`:"",i=this.precision?`(${this.precision})`:"";return`interval${r}${i}`}}n(ll,ni,"PgInterval");function _m(s,t={}){const{name:r,config:i}=O(s,t);return new al(r,i)}var li,oi;class ol extends(oi=v,li=o,oi){constructor(t){super(t,"json","PgJson")}build(t){return new cl(t,this.config)}}n(ol,li,"PgJsonBuilder");var ci,di;class cl extends(di=N,ci=o,di){constructor(t,r){super(t,r)}getSQLType(){return"json"}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}}n(cl,ci,"PgJson");function Cm(s){return new ol(s??"")}var mi,ui;class dl extends(ui=v,mi=o,ui){constructor(t){super(t,"json","PgJsonb")}build(t){return new ml(t,this.config)}}n(dl,mi,"PgJsonbBuilder");var pi,xi;class ml extends(xi=N,pi=o,xi){constructor(t,r){super(t,r)}getSQLType(){return"jsonb"}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}}n(ml,pi,"PgJsonb");function Z(s){return new dl(s??"")}var hi,gi;class ul extends(gi=v,hi=o,gi){constructor(t){super(t,"array","PgLine")}build(t){return new pl(t,this.config)}}
1n(ul,hi,"PgLineBuilder");var fi,bi;class pl extends(bi=N,fi=o,bi){getSQLType(){return"line"}mapFromDriverValue(t){const[r,i,a]=t.slice(1,-1).split(",");return[Number.parseFloat(r),Number.parseFloat(i),Number.parseFloat(a)]}mapToDriverValue(t){return`{${t[0]},${t[1]},${t[2]}}`}}n(pl,fi,"PgLine");var yi,Ni;class xl extends(Ni=v,yi=o,Ni){constructor(t){super(t,"json","PgLineABC")}build(t){return new hl(t,this.config)}}n(xl,yi,"PgLineABCBuilder");var ji,vi;class hl extends(vi=N,ji=o,vi){getSQLType(){return"line"}mapFromDriverValue(t){const[r,i,a]=t.slice(1,-1).split(",");return{a:Number.parseFloat(r),b:Number.parseFloat(i),c:Number.parseFloat(a)}}mapToDriverValue(t){return`{${t.a},${t.b},${t.c}}`}}n(hl,ji,"PgLineABC");function Am(s,t){const{name:r,config:i}=O(s,t);return!(i!=null&&i.mode)||i.mode==="tuple"?new ul(r):new xl(r)}var wi,Si;class gl extends(Si=v,wi=o,Si){constructor(t){super(t,"string","PgMacaddr")}build(t){return new fl(t,this.config)}}n(gl,wi,"PgMacaddrBuilder");var Ti,_i;class fl extends(_i=N,Ti=o,_i){getSQLType(){return"macaddr"}}n(fl,Ti,"PgMacaddr");function km(s){return new gl(s??"")}var Ci,Ai;class bl extends(Ai=v,Ci=o,Ai){constructor(t){super(t,"string","PgMacaddr8")}build(t){return new yl(t,this.config)}}n(bl,Ci,"PgMacaddr8Builder");var ki,Pi;class yl extends(Pi=N,ki=o,Pi){getSQLType(){return"macaddr8"}}n(yl,ki,"PgMacaddr8");function Pm(s){return new bl(s??"")}var Ii,Di;class Nl extends(Di=v,Ii=o,Di){constructor(t,r,i){super(t,"string","PgNumeric"),this.config.precision=r,this.config.scale=i}build(t){return new jl(t,this.config)}}n(Nl,Ii,"PgNumericBuilder");var Ui,Li;class jl extends(Li=N,Ui=o,Li){constructor(r,i){super(r,i);n(this,"precision");n(this,"scale");this.precision=i.precision,this.scale=i.scale}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}n(jl,Ui,"PgNumeric");function Im(s,t){const{name:r,config:i}=O(s,t);return new Nl(r,i==null?void 0:i.precision,i==null?void 0:i.scale)}var Oi,zi;class vl extends(zi=v,Oi=o,zi){constructor(t){super(t,"array","PgPointTuple")}build(t){return new wl(t,this.config)}}n(vl,Oi,"PgPointTupleBuilder");var Fi,Bi;class wl extends(Bi=N,Fi=o,Bi){getSQLType(){return"point"}mapFromDriverValue(t){if(typeof t=="string"){const[r,i]=t.slice(1,-1).split(",");return[Number.parseFloat(r),Number.parseFloat(i)]}return[t.x,t.y]}mapToDriverValue(t){return`(${t[0]},${t[1]})`}}n(wl,Fi,"PgPointTuple");var Mi,Ei;class Sl extends(Ei=v,Mi=o,Ei){constructor(t){super(t,"json","PgPointObject")}build(t){return new Tl(t,this.config)}}n(Sl,Mi,"PgPointObjectBuilder");var Ri,Vi;class Tl extends(Vi=N,Ri=o,Vi){getSQLType(){return"point"}mapFromDriverValue(t){if(typeof t=="string"){const[r,i]=t.slice(1,-1).split(",");return{x:Number.parseFloat(r),y:Number.parseFloat(i)}}return t}mapToDriverValue(t){return`(${t.x},${t.y})`}}n(Tl,Ri,"PgPointObject");function Dm(s,t){const{name:r,config:i}=O(s,t);return!(i!=null&&i.mode)||i.mode==="tuple"?new vl(r):new Sl(r)}function Um(s){const t=[];for(let r=0;r<s.length;r+=2)t.push(Number.parseInt(s.slice(r,r+2),16));return new Uint8Array(t)}function ms(s,t){const r=new ArrayBuffer(8),i=new DataView(r);for(let a=0;a<8;a++)i.setUint8(a,s[t+a]);return i.getFloat64(0,!0)}function _l(s){const t=Um(s);let r=0;const i=t[r];r+=1;const a=new DataView(t.buffer),c=a.getUint32(r,i===1);if(r+=4,c&536870912&&(a.getUint32(r,i===1),r+=4),(c&65535)===1){const x=ms(t,r);r+=8;const b=ms(t,r);return r+=8,[x,b]}throw new Error("Unsupported geometry type")}var qi,$i;class Cl extends($i=v,qi=o,$i){constructor(t){super(t,"array","PgGeometry")}build(t){return new Al(t,this.config)}}n(Cl,qi,"PgGeometryBuilder");var Qi,Wi;class Al extends(Wi=N,Qi=o,Wi){getSQLType(){return"geometry(point)"}mapFromDriverValue(t){return _l(t)}mapToDriverValue(t){return`point(${t[0]} ${t[1]})`}}n(Al,Qi,"PgGeometry");var Gi,Zi;class kl extends(Zi=v,Gi=o,Zi){constructor(t){super(t,"json","PgGeometryObject")}build(t){return new Pl(t,this.config)}}n(kl,Gi,"PgGeometryObjectBuilder");var Ki,Xi;class Pl extends(Xi=N,Ki=o,Xi){getSQLType(){return"geometry(point)"}mapFromDriverValue(t){const r=_l(t);return{x:r[0],y:r[1]}}mapToDriverValue(t){return`point(${t.x} ${t.y})`}}n(Pl,Ki,"PgGeometryObject");function Lm(s,t){const{name:r,config:i}=O(s,t);return!(i!=null&&i.mode)||i.mode==="tuple"?new Cl(r):new kl(r)}var Yi,Hi;class Il extends(Hi=v,Yi=o,Hi){constructor(t,r){super(t,"number","PgReal"),this.config.length=r}build(t){return new Dl(t,this.config)}}n(Il,Yi,"PgRealBuilder");var Ji,en;class Dl extends(en=N,Ji=o,en){constructor(r,i){super(r,i);n(this,"mapFromDriverValue",r=>typeof r=="string"?Number.parseFloat(r):r)}getSQLType(){return"real"}}n(Dl,Ji,"PgReal");function kt(s){return new Il(s??"")}var tn,sn;class Ul extends(sn=v,tn=o,sn){constructor(t){super(t,"number","PgSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new Ll(t,this.config)}}n(Ul,tn,"PgSerialBuilder");var rn,nn;
1class Ll extends(nn=N,rn=o,nn){getSQLType(){return"serial"}}n(Ll,rn,"PgSerial");function ee(s){return new Ul(s??"")}var an,ln;class Ol extends(ln=Ee,an=o,ln){constructor(t){super(t,"number","PgSmallInt")}build(t){return new zl(t,this.config)}}n(Ol,an,"PgSmallIntBuilder");var on,cn;class zl extends(cn=N,on=o,cn){constructor(){super(...arguments);n(this,"mapFromDriverValue",r=>typeof r=="string"?Number(r):r)}getSQLType(){return"smallint"}}n(zl,on,"PgSmallInt");function Om(s){return new Ol(s??"")}var dn,mn;class Fl extends(mn=v,dn=o,mn){constructor(t){super(t,"number","PgSmallSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(t){return new Bl(t,this.config)}}n(Fl,dn,"PgSmallSerialBuilder");var un,pn;class Bl extends(pn=N,un=o,pn){getSQLType(){return"smallserial"}}n(Bl,un,"PgSmallSerial");function zm(s){return new Fl(s??"")}var xn,hn;class Ml extends(hn=v,xn=o,hn){constructor(t,r){super(t,"string","PgText"),this.config.enumValues=r.enum}build(t){return new El(t,this.config)}}n(Ml,xn,"PgTextBuilder");var gn,fn;class El extends(fn=N,gn=o,fn){constructor(){super(...arguments);n(this,"enumValues",this.config.enumValues)}getSQLType(){return"text"}}n(El,gn,"PgText");function H(s,t={}){const{name:r,config:i}=O(s,t);return new Ml(r,i)}var bn,yn;class Rl extends(yn=ke,bn=o,yn){constructor(t,r,i){super(t,"string","PgTime"),this.withTimezone=r,this.precision=i,this.config.withTimezone=r,this.config.precision=i}build(t){return new Vl(t,this.config)}}n(Rl,bn,"PgTimeBuilder");var Nn,jn;class Vl extends(jn=N,Nn=o,jn){constructor(r,i){super(r,i);n(this,"withTimezone");n(this,"precision");this.withTimezone=i.withTimezone,this.precision=i.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}n(Vl,Nn,"PgTime");function Fm(s,t={}){const{name:r,config:i}=O(s,t);return new Rl(r,i.withTimezone??!1,i.precision)}var vn,wn;class ql extends(wn=ke,vn=o,wn){constructor(t,r,i){super(t,"date","PgTimestamp"),this.config.withTimezone=r,this.config.precision=i}build(t){return new $l(t,this.config)}}n(ql,vn,"PgTimestampBuilder");var Sn,Tn;class $l extends(Tn=N,Sn=o,Tn){constructor(r,i){super(r,i);n(this,"withTimezone");n(this,"precision");n(this,"mapFromDriverValue",r=>new Date(this.withTimezone?r:r+"+0000"));n(this,"mapToDriverValue",r=>r.toISOString());this.withTimezone=i.withTimezone,this.precision=i.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}}n($l,Sn,"PgTimestamp");var _n,Cn;class Ql extends(Cn=ke,_n=o,Cn){constructor(t,r,i){super(t,"string","PgTimestampString"),this.config.withTimezone=r,this.config.precision=i}build(t){return new Wl(t,this.config)}}n(Ql,_n,"PgTimestampStringBuilder");var An,kn;class Wl extends(kn=N,An=o,kn){constructor(r,i){super(r,i);n(this,"withTimezone");n(this,"precision");this.withTimezone=i.withTimezone,this.precision=i.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}n(Wl,An,"PgTimestampString");function S(s,t={}){const{name:r,config:i}=O(s,t);return(i==null?void 0:i.mode)==="string"?new Ql(r,i.withTimezone??!1,i.precision):new ql(r,(i==null?void 0:i.withTimezone)??!1,i==null?void 0:i.precision)}var Pn,In;class Gl extends(In=v,Pn=o,In){constructor(t){super(t,"string","PgUUID")}defaultRandom(){return this.default(pe`gen_random_uuid()`)}build(t){return new Zl(t,this.config)}}n(Gl,Pn,"PgUUIDBuilder");var Dn,Un;class Zl extends(Un=N,Dn=o,Un){getSQLType(){return"uuid"}}n(Zl,Dn,"PgUUID");function qt(s){return new Gl(s??"")}var Ln,On;class Kl extends(On=v,Ln=o,On){constructor(t,r){super(t,"string","PgVarchar"),this.config.length=r.length,this.config.enumValues=r.enum}build(t){return new Xl(t,this.config)}}n(Kl,Ln,"PgVarcharBuilder");var zn,Fn;class Xl extends(Fn=N,zn=o,Fn){constructor(){super(...arguments);n(this,"length",this.config.length);n(this,"enumValues",this.config.enumValues)}getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}n(Xl,zn,"PgVarchar");function u(s,t={}){const{name:r,config:i}=O(s,t);return new Kl(r,i)}var Bn,Mn;class Yl extends(Mn=v,Bn=o,Mn){constructor(t,r){super(t,"string","PgBinaryVector"),this.config.dimensions=r.dimensions}build(t){return new Hl(t,this.config)}}n(Yl,Bn,"PgBinaryVectorBuilder");var En,Rn;class Hl extends(Rn=N,En=o,Rn){constructor(){super(...arguments);n(this,"dimensions",this.config.dimensions)}getSQLType(){return`bit(${this.dimensions})`}}
1n(Hl,En,"PgBinaryVector");function Bm(s,t){const{name:r,config:i}=O(s,t);return new Yl(r,i)}var Vn,qn;class Jl extends(qn=v,Vn=o,qn){constructor(t,r){super(t,"array","PgHalfVector"),this.config.dimensions=r.dimensions}build(t){return new eo(t,this.config)}}n(Jl,Vn,"PgHalfVectorBuilder");var $n,Qn;class eo extends(Qn=N,$n=o,Qn){constructor(){super(...arguments);n(this,"dimensions",this.config.dimensions)}getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(r){return JSON.stringify(r)}mapFromDriverValue(r){return r.slice(1,-1).split(",").map(i=>Number.parseFloat(i))}}n(eo,$n,"PgHalfVector");function Mm(s,t){const{name:r,config:i}=O(s,t);return new Jl(r,i)}var Wn,Gn;class to extends(Gn=v,Wn=o,Gn){constructor(t,r){super(t,"string","PgSparseVector"),this.config.dimensions=r.dimensions}build(t){return new so(t,this.config)}}n(to,Wn,"PgSparseVectorBuilder");var Zn,Kn;class so extends(Kn=N,Zn=o,Kn){constructor(){super(...arguments);n(this,"dimensions",this.config.dimensions)}getSQLType(){return`sparsevec(${this.dimensions})`}}n(so,Zn,"PgSparseVector");function Em(s,t){const{name:r,config:i}=O(s,t);return new to(r,i)}var Xn,Yn;class ro extends(Yn=v,Xn=o,Yn){constructor(t,r){super(t,"array","PgVector"),this.config.dimensions=r.dimensions}build(t){return new io(t,this.config)}}n(ro,Xn,"PgVectorBuilder");var Hn,Jn;class io extends(Jn=N,Hn=o,Jn){constructor(){super(...arguments);n(this,"dimensions",this.config.dimensions)}getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(r){return JSON.stringify(r)}mapFromDriverValue(r){return r.slice(1,-1).split(",").map(i=>Number.parseFloat(i))}}n(io,Hn,"PgVector");function Rm(s,t){const{name:r,config:i}=O(s,t);return new ro(r,i)}function Vm(){return{bigint:bm,bigserial:ym,boolean:Re,char:Nm,cidr:jm,customType:vm,date:wm,doublePrecision:Sm,inet:Tm,integer:dt,interval:_m,json:Cm,jsonb:Z,line:Am,macaddr:km,macaddr8:Pm,numeric:Im,point:Dm,geometry:Lm,real:kt,serial:ee,smallint:Om,smallserial:zm,text:H,time:Fm,timestamp:S,uuid:qt,varchar:u,bit:Bm,halfvec:Mm,sparsevec:Em,vector:Rm}}const Pt=Symbol.for("drizzle:PgInlineForeignKeys"),us=Symbol.for("drizzle:EnableRLS");var ea,ta,sa,ra,ia;class Be extends(ia=V,ra=o,sa=Pt,ta=us,ea=V.Symbol.ExtraConfigBuilder,ia){constructor(){super(...arguments);n(this,sa,[]);n(this,ta,!1);n(this,ea)}}n(Be,ra,"PgTable"),n(Be,"Symbol",Object.assign({},V.Symbol,{InlineForeignKeys:Pt,EnableRLS:us}));function qm(s,t,r,i,a=s){const c=new Be(s,i,a),x=typeof t=="function"?t(Vm()):t,b=Object.fromEntries(Object.entries(x).map(([d,y])=>{const m=y;m.setName(d);const p=m.build(c);return c[Pt].push(...m.buildForeignKeys(p,c)),[d,p]})),h=Object.fromEntries(Object.entries(x).map(([d,y])=>{const m=y;m.setName(d);const p=m.buildExtraConfigColumn(c);return[d,p]})),j=Object.assign(c,b);return j[V.Symbol.Columns]=b,j[V.Symbol.ExtraConfigColumns]=h,r&&(j[Be.Symbol.ExtraConfigBuilder]=r),Object.assign(j,{enableRLS:()=>(j[Be.Symbol.EnableRLS]=!0,j)})}const Q=(s,t,r)=>qm(s,t,r,void 0);var na;na=o;class $t{constructor(t,r){this.unique=t,this.name=r}on(...t){return new rt(t.map(r=>{if(I(r,k))return r;r=r;const i=new tt(r.name,!!r.keyAsName,r.columnType,r.indexConfig);return r.indexConfig=JSON.parse(JSON.stringify(r.defaultConfig)),i}),this.unique,!1,this.name)}onOnly(...t){return new rt(t.map(r=>{if(I(r,k))return r;r=r;const i=new tt(r.name,!!r.keyAsName,r.columnType,r.indexConfig);return r.indexConfig=r.defaultConfig,i}),this.unique,!0,this.name)}using(t,...r){return new rt(r.map(i=>{if(I(i,k))return i;i=i;const a=new tt(i.name,!!i.keyAsName,i.columnType,i.indexConfig);return i.indexConfig=JSON.parse(JSON.stringify(i.defaultConfig)),a}),this.unique,!0,this.name,t)}}n($t,na,"PgIndexBuilderOn");var aa;aa=o;class rt{constructor(t,r,i,a,c="btree"){n(this,"config");this.config={name:a,columns:t,unique:r,only:i,method:c}}concurrently(){return this.config.concurrently=!0,this}with(t){return this.config.with=t,this}where(t){return this.config.where=t,this}build(t){return new no(this.config,t)}}n(rt,aa,"PgIndexBuilder");var la;la=o;class no{constructor(t,r){n(this,"config");this.config={...t,table:r}}}n(no,la,"PgIndex");function F(s){return new $t(!1,s)}function ao(s){return new $t(!0,s)}const C={INT8_MIN:-128,INT8_MAX:127,INT8_UNSIGNED_MAX:255,INT16_MIN:-32768,INT16_MAX:32767,INT16_UNSIGNED_MAX:65535,INT24_MIN:-8388608,INT24_MAX:8388607,INT24_UNSIGNED_MAX:16777215,INT32_MIN:-2147483648,INT32_MAX:2147483647,INT32_UNSIGNED_MAX:4294967295,INT48_MIN:-0x800000000000,INT48_MAX:0x7fffffffffff,INT48_UNSIGNED_MAX:0xffffffffffff,INT64_MIN:-9223372036854775808n,INT64_MAX:9223372036854775807n,INT64_UNSIGNED_MAX:18446744073709551615n};function P(s,t){return t.includes(s.columnType)}
1function $m(s){return"enumValues"in s&&Array.isArray(s.enumValues)&&s.enumValues.length>0}const Qm=Ft([$(),nt(),zt(),da()]),Wm=Ft([Qm,ma(it()),Ot(it())]),Gm=oa(s=>s instanceof Buffer);function lo(s,t){const r=(t==null?void 0:t.zodInstance)??lm,i=(t==null?void 0:t.coerce)??{};let a;return $m(s)&&(a=s.enumValues.length?r.enum(s.enumValues):r.string()),a||(P(s,["PgGeometry","PgPointTuple"])?a=r.tuple([r.number(),r.number()]):P(s,["PgGeometryObject","PgPointObject"])?a=r.object({x:r.number(),y:r.number()}):P(s,["PgHalfVector","PgVector"])?(a=r.array(r.number()),a=s.dimensions?a.length(s.dimensions):a):P(s,["PgLine"])?a=r.tuple([r.number(),r.number(),r.number()]):P(s,["PgLineABC"])?a=r.object({a:r.number(),b:r.number(),c:r.number()}):P(s,["PgArray"])?(a=r.array(lo(s.baseColumn,r)),a=s.size?a.length(s.size):a):s.dataType==="array"?a=r.array(r.any()):s.dataType==="number"?a=Zm(s,r,i):s.dataType==="bigint"?a=Km(s,r,i):s.dataType==="boolean"?a=i===!0||i.boolean?r.coerce.boolean():r.boolean():s.dataType==="date"?a=i===!0||i.date?r.coerce.date():r.date():s.dataType==="string"?a=Xm(s,r,i):s.dataType==="json"?a=Wm:s.dataType==="custom"?a=r.any():s.dataType==="buffer"&&(a=Gm)),a||(a=r.any()),a}function Zm(s,t,r){let i=s.getSQLType().includes("unsigned"),a,c,x=!1;P(s,["MySqlTinyInt","SingleStoreTinyInt"])?(a=i?0:C.INT8_MIN,c=i?C.INT8_UNSIGNED_MAX:C.INT8_MAX,x=!0):P(s,["PgSmallInt","PgSmallSerial","MySqlSmallInt","SingleStoreSmallInt"])?(a=i?0:C.INT16_MIN,c=i?C.INT16_UNSIGNED_MAX:C.INT16_MAX,x=!0):P(s,["PgReal","MySqlFloat","MySqlMediumInt","SingleStoreMediumInt","SingleStoreFloat"])?(a=i?0:C.INT24_MIN,c=i?C.INT24_UNSIGNED_MAX:C.INT24_MAX,x=P(s,["MySqlMediumInt","SingleStoreMediumInt"])):P(s,["PgInteger","PgSerial","MySqlInt","SingleStoreInt"])?(a=i?0:C.INT32_MIN,c=i?C.INT32_UNSIGNED_MAX:C.INT32_MAX,x=!0):P(s,["PgDoublePrecision","MySqlReal","MySqlDouble","SingleStoreReal","SingleStoreDouble","SQLiteReal"])?(a=i?0:C.INT48_MIN,c=i?C.INT48_UNSIGNED_MAX:C.INT48_MAX):P(s,["PgBigInt53","PgBigSerial53","MySqlBigInt53","MySqlSerial","SingleStoreBigInt53","SingleStoreSerial","SQLiteInteger"])?(i=i||P(s,["MySqlSerial","SingleStoreSerial"]),a=i?0:Number.MIN_SAFE_INTEGER,c=Number.MAX_SAFE_INTEGER,x=!0):P(s,["MySqlYear","SingleStoreYear"])?(a=1901,c=2155,x=!0):(a=Number.MIN_SAFE_INTEGER,c=Number.MAX_SAFE_INTEGER);let b=r===!0||r!=null&&r.number?t.coerce.number():t.number();return b=b.min(a).max(c),x?b.int():b}function Km(s,t,r){const i=s.getSQLType().includes("unsigned"),a=i?0n:C.INT64_MIN,c=i?C.INT64_UNSIGNED_MAX:C.INT64_MAX;return(r===!0||r!=null&&r.bigint?t.coerce.bigint():t.bigint()).min(a).max(c)}function Xm(s,t,r){if(P(s,["PgUUID"]))return t.string().uuid();let i,a,c=!1;P(s,["PgVarchar","SQLiteText"])?i=s.length:P(s,["MySqlVarChar","SingleStoreVarChar"])?i=s.length??C.INT16_UNSIGNED_MAX:P(s,["MySqlText","SingleStoreText"])&&(s.textType==="longtext"?i=C.INT32_UNSIGNED_MAX:s.textType==="mediumtext"?i=C.INT24_UNSIGNED_MAX:s.textType==="text"?i=C.INT16_UNSIGNED_MAX:i=C.INT8_UNSIGNED_MAX),P(s,["PgChar","MySqlChar","SingleStoreChar"])&&(i=s.length,c=!0),P(s,["PgBinaryVector"])&&(a=/^[01]+$/,i=s.dimensions);let x=r===!0||r!=null&&r.string?t.coerce.string():t.string();return x=a?x.regex(a):x,i&&c?x.length(i):i?x.max(i):x}function oo(s){return Ca(s)?gm(s):fm(s)}function co(s,t,r,i){const a={};for(const[c,x]of Object.entries(s)){if(!I(x,Ae)&&!I(x,k)&&!I(x,k.Aliased)&&typeof x=="object"){const y=Ca(x)||hm(x)?oo(x):x;a[c]=co(y,t[c]??{},r,i);continue}const b=t[c];if(b!==void 0&&typeof b!="function"){a[c]=b;continue}const h=I(x,Ae)?x:void 0,j=h?lo(h,i):it(),d=typeof b=="function"?b(j):j;r.never(h)||(a[c]=d,h&&(r.nullable(h)&&(a[c]=a[c].nullable()),r.optional(h)&&(a[c]=a[c].optional())))}return ae(a)}const Ym={never:s=>{var t,r;return((t=s==null?void 0:s.generated)==null?void 0:t.type)==="always"||((r=s==null?void 0:s.generatedIdentity)==null?void 0:r.type)==="always"},optional:s=>!s.notNull||s.notNull&&s.hasDefault,nullable:s=>!s.notNull},mo=(s,t)=>{const r=oo(s);return co(r,{},Ym)};Q("sessions",{sid:u("sid").primaryKey(),sess:Z("sess").notNull(),expire:S("expire").notNull()},s=>[F("IDX_session_expire").on(s.expire)]);const uo=Q("users",{id:u("id").primaryKey().notNull(),email:u("email").unique(),password:u("password"),firstName:u("first_name"),lastName:u("last_name"),profileImageUrl:u("profile_image_url"),emailOptIn:Re("email_opt_in"),authProvider:u("auth_provider").notNull().default("email"),googleId:u("google_id"),facebookId:u("facebook_id"),replitId:u("replit_id"),stripeCustomerId:u("stripe_customer_id"),stripeSubscriptionId:u("stripe_subscription_id"),planInterval:u("plan_interval"),subscriptionStatus:u("subscription_status").default("free"),subscriptionTier:u("subscription_tier").default("free"),agencyBranding:Z("agency_branding"),planType:u("plan_type"),subscriptionStartedAt:S("subscription_started_at"),subscriptionEndsAt:S("subscription_ends_at"),note:H("note"),createdAt:S("created_at").defaultNow(),updatedAt:S("updated_at").defaultNow()}),po=Q("reports",{id:ee("id").primaryKey(),secureId:qt("secure_id").defaultRandom().notNull().unique(),userId:u("user_id").notNull().references(()=>uo.id),url:u("url"),title:u("title").notNull(),inputType:u("input_type").notNull(),inputData:Z("input_data").notNull(),analysisResults:Z("analysis_results").notNull(),overallScore:u("overall_score").notNull(),scores:Z("scores").notNull(),recommendations:Z("recommendations").notNull(),pageType:Z("page_type"),pageTypeInsights:Z("page_type_insights"),examplePageUrl:u("example_page_url"),createdAt:S("created_at").defaultNow(),preOptimizationCvr:kt("pre_optimization_cvr"),postOptimizationCvr:kt("post_optimization_cvr"),isOptimized:Re("is_optimized").default(!1),optimizedAt:S("optimized_at"),cvrTrackedAt:S("cvr_tracked_at"),cvrReminderDismissedAt:S("cvr_reminder_dismissed_at"),optimizationStatus:u("optimization_status").default("action_required")});Q("feedback",{id:ee("id").primaryKey(),userId:u("user_id"),type:u("type").notNull(),title:u("title"),description:H("description"),priority:u("priority").default("medium"),category:u("category"),browserInfo:Z("browser_info"),message:H("message"),attachmentUrl:u("attachment_url"),attachmentName:u("attachment_name"),currentPage:u("current_page"),userAgent:H("user_agent"),status:u("status").default("open"),adminNotes:H("admin_notes"),resolvedAt:S("resolved_at"),createdAt:S("created_at").defaultNow(),updatedAt:S("updated_at").defaultNow()},s=>[st("feedback_type_check",pe`(${s.type})::text = ANY ((ARRAY['bug'::character varying, 'feature'::character varying])::text[])`),st("feedback_status_check",pe`(${s.status})::text = ANY ((ARRAY['open'::character varying, 'in-progress'::character varying, 'resolved'::character varying, 'closed'::character varying])::text[])`),st("feedback_priority_check",pe`(${s.priority})::text = ANY ((ARRAY['low'::character varying, 'medium'::character varying, 'high'::character varying, 'critical'::character varying])::text[])`)]);Q("analytics",{id:ee("id").primaryKey(),userId:u("user_id"),event:u("event").notNull(),properties:Z("properties"),sessionId:u("session_id"),createdAt:S("created_at").defaultNow(),timestamp:S("timestamp").defaultNow()});const Hm=Q("ratings",{id:ee("id").primaryKey(),reportId:u("report_id").notNull(),userId:u("user_id"),rating:dt("rating").notNull(),feedback:H("feedback"),ipAddress:u("ip_address"),userAgent:H("user_agent"),createdAt:S("created_at").defaultNow(),updatedAt:S("updated_at").defaultNow()},s=>[st("ratings_rating_check",pe`(${s.rating} >= 1) AND (${s.rating} <= 5)`)]);Q("audit_quota",{id:ee("id").primaryKey(),identifier:u("identifier",{length:255}).notNull(),identifierType:u("identifier_type",{length:16}).notNull(),monthKey:u("month_key",{length:7}).notNull(),count:dt("count").notNull().default(0),lastUsedAt:S("last_used_at").defaultNow(),createdAt:S("created_at").defaultNow()},s=>[ao("audit_quota_identifier_month_unique").on(s.identifier,s.identifierType,s.monthKey),F("audit_quota_month_idx").on(s.monthKey)]);Q("api_keys",{id:ee("id").primaryKey(),userId:u("user_id",{length:255}).notNull(),name:u("name",{length:120}).notNull(),prefix:u("prefix",{length:16}).notNull(),keyHash:u("key_hash",{length:64}).notNull(),lastUsedAt:S("last_used_at"),createdAt:S("created_at").defaultNow(),revokedAt:S("revoked_at")},s=>[ao("api_keys_prefix_unique").on(s.prefix),F("api_keys_user_idx").on(s.userId)]);Q("funnel_events",{id:ee("id").primaryKey(),event:u("event",{length:48}).notNull(),source:u("source",{length:64}),userId:u("user_id",{length:64}),reportId:u("report_id",{length:64}),visitorId:u("visitor_id",{length:64}),metadata:Z("metadata"),createdAt:S("created_at").defaultNow().notNull()},s=>[F("funnel_events_event_idx").on(s.event),F("funnel_events_created_at_idx").on(s.createdAt),F("funnel_events_event_created_idx").on(s.event,s.createdAt),F("funnel_events_user_id_idx").on(s.userId)]);Q("magic_link_tokens",{id:ee("id").primaryKey(),tokenHash:u("token_hash",{length:64}).notNull().unique(),email:u("email",{length:255}).notNull(),purpose:u("purpose",{length:32}).notNull().default("login"),expiresAt:S("expires_at").notNull(),consumedAt:S("consumed_at"),createdAt:S("created_at").defaultNow(),ipAddress:u("ip_address",{length:64}),userAgent:H("user_agent")},s=>[F("magic_link_email_idx").on(s.email),F("magic_link_expiry_idx").on(s.expiresAt)]);Q("report_purchases",{id:ee("id").primaryKey(),reportSecureId:qt("report_secure_id").notNull().references(()=>po.secureId),userId:u("user_id").references(()=>uo.id),email:u("email",{length:255}),purchaseType:u("purchase_type",{length:32}).notNull(),stripeSessionId:u("stripe_session_id",{length:255}),stripePaymentIntentId:u("stripe_payment_intent_id",{length:255}),amountCents:dt("amount_cents").notNull(),currency:u("currency",{length:8}).notNull().default("usd"),createdAt:S("created_at").defaultNow()},s=>[F("report_purchases_report_idx").on(s.reportSecureId),F("report_purchases_user_idx").on(s.userId),F("report_purchases_email_idx").on(s.email)]);Q("email_events",{id:ee("id").primaryKey(),templateId:u("template_id",{length:64}).notNull(),recipientEmail:u("recipient_email",{length:320}).notNull(),eventType:u("event_type",{length:32}).notNull(),subject:H("subject"),resendId:u("resend_id",{length:128}),metadata:Z("metadata"),createdAt:S("created_at").defaultNow().notNull()},s=>[F("email_events_template_id_idx").on(s.templateId),F("email_events_created_at_idx").on(s.createdAt),F("email_events_recipient_email_idx").on(s.recipientEmail),F("email_events_resend_id_idx").on(s.resendId),F("email_events_template_event_idx").on(s.templateId,s.eventType)]);Q("email_overrides",{templateId:u("template_id",{length:64}).primaryKey(),subject:H("subject"),html:H("html"),enabled:Re("enabled"),updatedBy:u("updated_by",{length:320}),updatedAt:S("updated_at").defaultNow().notNull()});Q("email_campaigns",{campaignId:u("campaign_id",{length:64}).primaryKey(),enabled:Re("enabled").notNull(),updatedBy:u("updated_by",{length:320}),updatedAt:S("updated_at").defaultNow().notNull()});mo(po).omit({id:!0,createdAt:!0});mo(Hm).omit({id:!0,createdAt:!0,updatedAt:!0});const St=s=>typeof s=="string"&&s.trim()===""?void 0:s,Jm=ae({audience:Fe(St,$().trim().max(160).optional()),trafficSource:Fe(St,ca(["paid_ads","search","social","email","referral","mixed"]).optional()),goal:Fe(St,$().trim().max(160).optional())}),eu=ae({url:$().min(1,"URL is required").url("Please enter a valid URL (e.g., https://example.com)").refine(s=>{try{const t=new URL(s);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}},"URL must start with http:// or https://"),email:Fe(s=>typeof s=="string"&&s.trim()===""?void 0:s,$().email("Please enter a valid email address").optional()),clientToken:$().min(8).max(128).optional(),context:Jm.optional()}),tu=ae({primaryUrl:$().min(1,"Your website URL is required").url("Please enter a valid URL for your website (e.g., https://yoursite.com)"),competitorUrls:Ot($().min(1,"Competitor URL cannot be empty").url
1("Please enter valid competitor URLs (e.g., https://competitor.com)")).min(1,"At least one competitor URL is required").max(1,"Only 1 competitor URL allowed")});ae({headline:$().min(1,"Headline is required"),offer:$().min(1,"Offer/Value proposition is required"),copy:$().optional()});ae({preOptimizationCvr:nt().min(0).max(100).optional(),postOptimizationCvr:nt().min(0).max(100).optional(),isOptimized:zt().optional()});function ps(s){return s?s.startsWith("A")?{text:"text-good-text",border:"border-good-line",bg:"bg-good-subtle"}:s.startsWith("B")?{text:"text-primary",border:"border-primary-muted",bg:"bg-primary-subtle"}:s.startsWith("C")?{text:"text-warning-text",border:"border-warning-line",bg:"bg-warning-subtle"}:{text:"text-critical-text",border:"border-critical-line",bg:"bg-critical-subtle"}:{text:"text-ink-muted",border:"border-line-strong",bg:"bg-surface"}}function Se(s){return s>=80?"text-good-text":s>=70?"text-primary":s>=60?"text-warning-text":"text-critical-text"}function xs(s){return s>=80||s>=60,"bg-primary"}function He(s){return{clarityValue:"Clarity & Value",offerStrength:"Offer Strength",trustCredibility:"Trust & Credibility",frictionUsability:"Friction & Usability",urgencyMotivation:"Urgency & Motivation",visualExperience:"Visual Experience"}[s]??s.replace(/([A-Z])/g," $1").replace(/^./,r=>r.toUpperCase())}function su(s){return s==="critical"||s==="competitive-improvement"?{border:"border-critical-line",bg:"bg-critical-subtle",iconBg:"bg-critical-subtle",iconText:"text-critical-text",badge:"border-critical-line text-critical-text bg-critical-subtle",Icon:Je}:s==="improve"?{border:"border-warning-line",bg:"bg-warning-subtle",iconBg:"bg-warning-subtle",iconText:"text-warning-text",badge:"border-warning-line text-warning-text bg-warning-subtle",Icon:Ud}:{border:"border-good-line",bg:"bg-good-subtle",iconBg:"bg-good-subtle",iconText:"text-good-text",badge:"border-good-line text-good-text bg-good-subtle",Icon:Et}}function ru({data:s}){var d,y,m;if(!s||!s.primary)return e.jsx("div",{className:"relative min-h-[60vh] flex items-center justify-center p-8 text-center",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(se,{className:"mx-auto h-10 w-10 text-warning-text"}),e.jsx("p",{className:"text-ink-muted",children:"No competitor analysis data available"}),e.jsx("p",{className:"text-sm text-ink-subtle",children:"Run an analysis first to see results"})]})});const t=s.primary||{},r=s.competitors||[],i=s.insights||{},[a,c]=T.useState(new Set),x=p=>{const w=new Set(a);w.has(p)?w.delete(p):w.add(p),c(w)},b=ps(t==null?void 0:t.overallScore),h=r[0],j=ps((d=h==null?void 0:h.analysis)==null?void 0:d.overallScore);return e.jsx("div",{className:"relative min-h-screen bg-canvas",children:e.jsxs("div",{className:"relative z-10 mx-auto max-w-6xl px-3 sm:px-6 lg:px-8 py-6 sm:py-10 space-y-6 sm:space-y-8",children:[e.jsx(ye,{className:"p-6 sm:p-8",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-good","aria-hidden":!0}),e.jsx("span",{className:"text-label text-ink-subtle",children:"Competitive intelligence report"})]}),e.jsx("h1",{className:"text-2xl sm:text-4xl font-semibold tracking-tight text-ink",children:"AI-powered competitive analysis with market positioning insights"}),e.jsx("p",{className:"max-w-2xl text-sm sm:text-base text-ink-muted",children:"Side-by-side scoring across all six conversion pillars, with prioritized actions to help you outperform the market."})]})}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2",children:[e.jsxs(ye,{className:"overflow-hidden p-6 sm:p-7",children:[e.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl border border-primary-muted bg-primary-subtle",children:e.jsx(ss,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-label text-ink-subtle",children:"Your website"}),e.jsx("div",{className:"text-base font-semibold text-ink",children:"Primary analysis target"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-lg font-semibold text-ink",children:t.title||"Your Website"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm text-ink-muted",children:"Overall grade"}),e.jsx("span",{className:R("rounded-md border px-3 py-1 text-sm font-semibold num",b.text,b.border,b.bg),children:(t==null?void 0:t.overallScore)||"N/A"})]}),t.url&&e.jsxs("div",{className:"flex items-center gap-2 truncate rounded-lg border border-line bg-surface px-3 py-2 text-xs text-ink-muted",children:[e.jsx(rs,{className:"h-3.5 w-3.5 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:t.url})]})]})]}),e.jsxs(ye,{className:"p-6 sm:p-7",children:[e.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl border border-primary-muted bg-primary-subtle",children:e.jsx(se,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-label text-ink-subtle",children:"Market landscape"}),e.jsxs("div",{className:"text-base font-semibold text-ink",children:[r.length," competitor",r.length!==1?"s":""," analyzed"]})]})]}),e.jsx("div",{className:"space-y-3",children:h?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-lg font-semibold text-ink",children:h.title}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm text-ink-muted",children:"Overall grade"}),e.jsx("span",{className:R("rounded-md border px-3 py-1 text-sm font-semibold num",j.text,j.border,j.bg),children:((y=h==null?void 0:h.analysis)==null?void 0:y.overallScore)||"N/A"})]}),h.url&&e.jsxs("div",{className:"flex items-center gap-2 truncate rounded-lg border border-line bg-surface px-3 py-2 text-xs text-ink-muted",children:[e.jsx(rs,{className:"h-3.5 w-3.5 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:h.url})]})]}):e.jsx("div",{className:"text-sm text-ink-subtle",children:"No competitors analyzed"})})]})]}),(i==null?void 0:i.categoryComparisons)&&e.jsxs(ye,{className:"p-6 sm:p-7",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl border border-primary-muted bg-primary-subtle",children:e.jsx(xa,{
1className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-label text-ink-subtle",children:"Pillar narratives"}),e.jsx("div",{className:"text-base font-semibold text-ink",children:"Category-by-category comparisons"})]})]}),e.jsx("div",{className:"space-y-3",children:Object.entries(i.categoryComparisons).map(([p,w])=>{var z;const _=Number((z=t.scores)==null?void 0:z[p])||0,D=r.length?Math.max(...r.map(W=>{var B;return Number((B=W.analysis.scores)==null?void 0:B[p])||0})):0,q=_-D,A=q>0?"Ahead":q<0?"Behind":"Tied",le=A==="Ahead"?"border-good-line text-good-text bg-good-subtle":A==="Behind"?"border-critical-line text-critical-text bg-critical-subtle":"border-warning-line text-warning-text bg-warning-subtle";return e.jsxs("div",{className:"rounded-xl border border-line bg-surface p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[e.jsx("h3",{className:"text-base font-semibold text-ink",children:He(p)}),e.jsx("span",{className:R("rounded-md border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider",le),children:A})]}),e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-x-5 gap-y-1 text-sm",children:[e.jsxs("span",{className:"text-ink-muted",children:["You"," ",e.jsxs("span",{className:R("font-bold num",Se(_)),children:[_,"%"]})]}),e.jsxs("span",{className:"text-ink-muted",children:["Best competitor"," ",e.jsxs("span",{className:R("font-bold num",Se(D)),children:[D,"%"]})]})]}),e.jsx("p",{className:"text-sm leading-relaxed text-ink-muted",children:String(w)})]},p)})})]}),!(i!=null&&i.categoryComparisons)&&e.jsxs(ye,{className:"p-6 sm:p-7",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl border border-warning-line bg-warning-subtle",children:e.jsx(Mt,{className:"h-5 w-5 text-warning-text"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-label text-ink-subtle",children:"Pillar-by-pillar"}),e.jsx("div",{className:"text-base font-semibold text-ink",children:"Performance matrix"})]})]}),t!=null&&t.scores&&Object.keys(t.scores).length>0?e.jsx("div",{className:"space-y-3",children:Object.entries(t.scores).map(([p,w])=>{var le;const _=a.has(p),D=r.map(z=>{var W,B;return Number((B=(W=z==null?void 0:z.analysis)==null?void 0:W.scores)==null?void 0:B[p])||0}),q=D.length?Math.max(...D):0,A=typeof w=="number"?w:0;return e.jsxs(Ad,{open:_,onOpenChange:()=>x(p),children:[e.jsx(kd,{asChild:!0,children:e.jsx("button",{type:"button",className:"group w-full rounded-xl border border-line bg-surface p-4 text-left transition hover:border-line-strong hover:bg-subtle",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[_?e.jsx(ha,{className:"h-4 w-4 text-ink-muted"}):e.jsx(Id,{className:"h-4 w-4 text-ink-muted"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-ink",children:He(p)}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-3 text-xs text-ink-muted",children:[e.jsxs("span",{children:["Your score"," ",e.jsxs("span",{className:R("font-bold num",Se(A)),children:[A,"%"]})]}),q>0&&e.jsxs("span",{children:["vs ",q,"% best"]})]})]})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1",children:[e.jsx("div",{className:"relative h-1.5 w-24 overflow-hidden rounded-full bg-surface",children:e.jsx("div",{className:R("absolute inset-y-0 left-0 rounded-full transition-all",xs(A)),style:{width:`${Math.min(100,Math.max(0,A))}%`}})}),q>0&&e.jsxs("div",{className:"text-[10px] text-ink-subtle num",children:[A>q?"+":"",A-q,"% vs best"]})]})]})})}),e.jsx(Pd,{children:e.jsxs("div",{className:"mt-3 space-y-3 pl-7",children:[e.jsxs("div",{className:"rounded-lg border border-primary-muted bg-primary-subtle p-4",children:[e.jsx("div",{className:"text-label text-ink-subtle mb-1 text-primary",children:"Your website"}),e.jsx("p",{className:"text-sm leading-relaxed text-ink",children:((le=t==null?void 0:t.categoryInsights)==null?void 0:le[p])||"Detailed analysis insights available."})]}),r.length>0&&e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:r.map((z,W)=>{var xe,mt;const B=Number((mt=(xe=z==null?void 0:z.analysis)==null?void 0:xe.scores)==null?void 0:mt[p])||0;return e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-3",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsxs("span",{className:"text-label text-ink-subtle text-primary truncate",children:["Competitor ",W+1]}),e.jsxs("span",{className:R("text-sm font-semibold num",Se(B)),children:[B,"%"]})]}),e.jsx("div",{className:"relative h-1 overflow-hidden rounded-full bg-surface",children:e.jsx("div",{className:R("absolute inset-y-0 left-0 rounded-full",xs(B)),style:{width:`${Math.min(100,B)}%`}})})]},W)})})]})})]},p)})}):e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(se,{className:"mx-auto mb-3 h-10 w-10 text-ink-subtle"}),e.jsx("h3",{className:"mb-1 text-base font-semibold text-ink",children:"No performance data available"}),e.jsx("p",{className:"text-sm text-ink-muted",children:"Scores are being generated. Please wait for the analysis to complete."})]}),(t==null?void 0:t.scores)&&Object.keys(t.scores).length>0&&e.jsx("div",{className:"mt-5 rounded-xl border border-primary-muted bg-primary-subtle p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5 flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-full border border-primary-muted bg-primary-subtle",children:e.jsx(Me,{className:"h-3.5 w-3.5 text-primary"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-label text-ink-subtle text-primary",children:"Understanding your scores"}),e.jsxs("p",{className:"text-sm leading-relaxed text-ink-muted",children:["Scores range from 0â100%. Low scores indicate significant optimization opportunities. Even small improvements in key areas can lead to substantial conversion-rate increases.",r.length>0&&e.jsxs("span",{className:"mt-2 block",children:[e.jsx("span",{className:"font-semibold text-ink",children:"Competitive edge: "}),"Areas where you outperform competitors represent your current strengths to leverage and defend."]})]})]})]})})]}),r.length>0&&(t==null?void 0:t.scores)&&e.jsxs(ye,{className:"p-6 sm:p-7",children:[e.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl border border-primary-muted bg-primary-subtle",children:e.jsx(ss,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-label text-ink-subtle",children:"At a glance"}),e.jsx("div",{className:"text-base font-semibold text-ink",children:"Competitive summary"})]})]}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:Object.entries(t.scores).map(([p,w])=>{const _=r.map(W=>{var B,xe;return Number((xe=(B=W==null?void 0:W.analysis)==null?void 0:B.scores)==null?void 0:xe[p])||0}),D=_.length?Math.max(..._):0,q=typeof w=="number"?w:0,A=q-D,le=A>0?"border-good-line text-good-text bg-good-subtle":A<0?"border-critical-line text-critical-text bg-critical-subtle":"border-warning-line text-warning-text bg-warning-subtle",z=A>0?`+${A}% ahead`:A<0?`${A}% behind`:"Tied";return e.jsxs("div",{className:"rounded-xl border border-line bg-surface p-4",children:[e.jsx("h3",{className:"mb-3 text-sm font-semibold text-ink",children:He(p)}),e.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-ink-muted",children:"You"}),e.jsxs("span",{className:R("font-bold num",Se(q)),children:[q,"%"]})]}),e.jsxs("div",{className:"mb-3 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-ink-muted",children:"Best competitor"}),e.jsxs("span",{className:R("font-bold num",Se(D)),children:[D,"%"]})]}),e.jsx("div",{className:"text-center",children:e.jsx("span",{className:R("inline-block rounded-md border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider",le),children:z})})]},p)})})]}),((m=i==null?void 0:i.recommendations)==null?void 0:m.length)>0&&e.jsxs(ye,{className:"p-6 sm:p-7",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl border border-good-line bg-good-subtle",children:e.jsx(Me,{className:"h-5 w-5 text-good-text"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-label text-ink-subtle",children:"Strategy"}),e.jsx("div",{className:"text-base font-semibold text-ink",children:"Strategic recommendations"})]})]}),e.jsx("div",{className:"grid gap-3",children:i.recommendations.map((p,w)=>{const _=su(p.type),D=_.Icon;return e.jsx("div",{className:R("rounded-xl border p-5 transition hover:bg-subtle",_.border,_.bg),children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:R("flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-xl",_.iconBg,_.iconText),children:e.jsx(D,{className:"h-5 w-5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[e.jsx("h3",{className:"text-base font-semibold text-ink",children:p.title}),p.category&&e.jsx("span",{className:"rounded-md border border-primary-muted bg-primary-subtle px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-primary",children:He(String(p.category))}),p.type&&e.jsx("span",{className:R("rounded-md border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider",_.badge),children:String(p.type)})]}),e.jsx("p",{className:"text-sm leading-relaxed text-ink-muted",children:p.description}),p.competitorExample&&e.jsxs("div",{className:"mt-3 rounded-lg border border-warning-line bg-warning-subtle p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[e.jsx(ga,{className:"h-3 w-3 text-warning-text"}),e.jsx("span",{className:"text-label text-ink-subtle text-warning-text",children:"What c
1ompetitors do better"})]}),e.jsx("p",{className:"text-xs leading-relaxed text-ink-muted",children:p.competitorExample})]}),p.implementation&&e.jsxs("div",{className:"mt-2 rounded-lg border border-primary-muted bg-primary-subtle p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[e.jsx(Dd,{className:"h-3 w-3 text-primary"}),e.jsx("span",{className:"text-label text-ink-subtle text-primary",children:"Implementation steps"})]}),e.jsx("p",{className:"text-xs leading-relaxed text-ink-muted",children:p.implementation})]})]})]})},w)})})]}),e.jsxs("div",{className:"flex flex-col gap-3 pt-2 sm:flex-row sm:justify-center",children:[e.jsxs(L,{onClick:()=>window.print(),variant:"outline",className:"border-line-strong bg-surface text-ink hover:border-line-strong hover:bg-subtle hover:text-ink",children:[e.jsx(fa,{className:"mr-2 h-4 w-4"}),"Export report"]}),e.jsxs(L,{onClick:()=>window.location.href="/",className:"bg-primary text-white shadow-lg hover:bg-primary-hover",children:[e.jsx(se,{className:"mr-2 h-4 w-4"}),"New analysis"]})]})]})})}function Tt(s){switch(s){case"high":return"bg-critical-subtle text-critical-text border-critical-line";case"medium":return"bg-warning-subtle text-warning-text border-warning-line";case"low":return"bg-good-subtle text-good-text border-good-line";default:return"bg-ink-faint text-ink-muted border-line"}}function iu(s){switch(s){case"high":return"bg-good-subtle text-good-text border-good-line";case"medium":return"bg-warning-subtle text-warning-text border-warning-line";case"low":return"bg-critical-subtle text-critical-text border-critical-line";default:return"bg-ink-faint text-ink-muted border-line"}}function nu({data:s,url:t,title:r}){const i=(s==null?void 0:s.strengths)||[],a=(s==null?void 0:s.weaknesses)||[],c=(s==null?void 0:s.opportunities)||[],x=(s==null?void 0:s.threats)||[],[b,h]=T.useState(!1),{toast:j}=Bt();if(!s||!i.length&&!a.length&&!c.length&&!x.length)return e.jsx("div",{className:"flex items-center justify-center p-8 text-center",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(Je,{className:"h-8 w-8 text-warning-text mx-auto"}),e.jsx("p",{className:"text-ink-muted",children:"No SWOT analysis data available"}),e.jsx("p",{className:"text-sm text-ink-subtle",children:"Run an analysis first to see results"})]})});const d=async()=>{h(!0);try{const m=await ze("POST","/api/reports/download-pdf",{type:"swot-analysis",data:s,title:r||"SWOT Analysis Report",url:t});if(!m.ok)throw new Error("Download failed");const p=await m.blob(),w=window.URL.createObjectURL(p),_=document.createElement("a");_.href=w,_.download=`swot-analysis-${new Date().toISOString().split("T")[0]}.pdf`,document.body.appendChild(_),_.click(),window.URL.revokeObjectURL(w),document.body.removeChild(_),j({title:"Download Complete",description:"Your SWOT analysis report has been downloaded."})}catch{j({title:"Download Failed",description:"Unable to download PDF. Please try again.",variant:"destructive"})}finally{h(!1)}},y=async()=>{try{await navigator.share({title:"SWOT Analysis Report",text:"Check out this SWOT analysis report from ConversionScore",url:window.location.href})}catch{await navigator.clipboard.writeText(window.location.href),j({title:"Link Copied",description:"Report link copied to clipboard"})}};return e.jsx("div",{className:"min-h-screen bg-canvas",children:e.jsxs("div",{className:"space-y-8 p-6",children:[e.jsx("div",{className:"rounded-2xl border border-line bg-surface p-8",children:e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-3xl font-bold text-ink",children:"SWOT Strategic Analysis"}),e.jsx("p",{className:"text-ink-muted",children:"AI-powered strategic assessment of your landing page's market position"}),t&&e.jsx("div",{className:"flex items-center gap-2 text-ink-muted",children:e.jsx("span",{className:"text-sm truncate",children:t})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(L,{onClick:d,disabled:b,className:"bg-primary hover:bg-primary-hover text-white border-0 shadow-lg",children:[b?e.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-line-strong border-t-transparent roun
1ded-full mr-2"}):e.jsx(Ld,{className:"w-4 h-4 mr-2"}),b?"Generating...":"Download PDF"]}),e.jsxs(L,{onClick:y,variant:"outline",className:"border-line bg-surface text-ink hover:bg-subtle hover:text-ink",children:[e.jsx(Od,{className:"w-4 h-4 mr-2"}),"Share"]})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 lg:gap-8",children:[e.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-good-line bg-surface p-8",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-good-subtle rounded-full -mr-16 -mt-16"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-good-subtle border border-good-line flex items-center justify-center",children:e.jsx(Et,{className:"h-7 w-7 text-good-text"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-bold text-good-text",children:"Strengths"}),e.jsx("p",{className:"text-ink-muted text-sm",children:"Competitive Advantages"})]})]}),e.jsx("div",{className:"space-y-4",children:i.map((m,p)=>e.jsxs("div",{className:"rounded-xl border border-line bg-surface p-5 hover:border-good-line transition-colors",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[e.jsx("h4",{className:"font-semibold text-ink",children:m.title}),e.jsxs(Te,{className:`${Tt(m.impact)} border whitespace-nowrap`,children:[e.jsx(Mt,{className:"h-3 w-3 mr-1"}),m.impact," impact"]})]}),e.jsx("p",{className:"text-ink-muted text-sm leading-relaxed",children:m.description})]},p))})]})]}),e.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-critical-line bg-surface p-8",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-critical-subtle rounded-full -mr-16 -mt-16"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-critical-subtle border border-critical-line flex items-center justify-center",children:e.jsx(Je,{className:"h-7 w-7 text-critical-text"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-bold text-critical-text",children:"Weaknesses"}),e.jsx("p",{className:"text-ink-muted text-sm",children:"Areas for Improvement"})]})]}),e.jsx("div",{className:"space-y-4",children:a.map((m,p)=>e.jsxs("div",{className:"rounded-xl border border-line bg-surface p-5 hover:border-critical-line transition-colors",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[e.jsx("h4",{className:"font-semibold text-ink",children:m.title}),e.jsxs(Te,{className:`${Tt(m.severity)} border whitespace-nowrap`,children:[e.jsx(Je,{className:"h-3 w-3 mr-1"}),m.severity," severity"]})]}),e.jsx("p",{className:"text-ink-muted text-sm leading-relaxed mb-4",children:m.description}),e.jsx("div",{className:"rounded-lg border border-primary-muted bg-primary-subtle p-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(zd,{className:"h-4 w-4 text-primary mt-0.5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-primary mb-1 uppercase tracking-wide",children:"Strategic Solution"}),e.jsx("p",{className:"text-sm text-ink leading-relaxed",children:m.suggestion})]})]})})]},p))})]})]}),e.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-primary-muted bg-surface p-8",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-primary-subtle rounded-full -mr-16 -mt-16"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary-subtle border border-primary-muted flex items-center justify-center",children:e.jsx(se,{className:"h-7 w-7 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-bold text-primary",children:"Opportunities"}),e.jsx("p",{className:"text-ink-muted text-sm",children:"Growth Potential"})]})]}),e.jsx("div",{className:"space-y-4",children:c.map((m,p)=>e.jsxs("div",{className:"rounded-xl border border-line bg-surface p-5 hover:border-primary-muted transition-colors",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[e.jsx("h4",{className:"font-semibold text-ink",children:m.title}),e.jsxs(Te,{className:`${iu(m.potential)} border whitespace-nowrap`,children:[e.jsx(Fd,{className:"h-3 w-3 mr-1"}),m.potential," potential"]})]}),e.jsx("p",{className:"text-ink-muted text-sm leading-relaxed mb-4",children:m.description}),e.jsx("div",{className:"rounded-lg border border-good-line bg-good-subtle p-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Bd,{className:"h-4 w-4 text-good-text mt-0.5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-good-text mb-1 uppercase tracking-wide",children:"Action Step"}),e.jsx("p",{className:"text-sm text-ink leading-relaxed",children:m.actionable})]})]})})]},p))})]})]}),e.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-warning-line bg-surface p-8",children:[e.jsx("div",{className:"absolute top-0 right-0 w-32 h-32 bg-warning-subtle rounded-full -mr-16 -mt-16"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx("div",{className:"w-14 h-14 roun
1ded-2xl bg-warning-subtle border border-warning-line flex items-center justify-center",children:e.jsx(yt,{className:"h-7 w-7 text-warning-text"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-bold text-warning-text",children:"Threats"}),e.jsx("p",{className:"text-ink-muted text-sm",children:"Risk Management"})]})]}),e.jsx("div",{className:"space-y-4",children:x.map((m,p)=>e.jsxs("div",{className:"rounded-xl border border-line bg-surface p-5 hover:border-warning-line transition-colors",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[e.jsx("h4",{className:"font-semibold text-ink",children:m.title}),e.jsxs(Te,{className:`${Tt(m.risk)} border whitespace-nowrap`,children:[e.jsx(yt,{className:"h-3 w-3 mr-1"}),m.risk," risk"]})]}),e.jsx("p",{className:"text-ink-muted text-sm leading-relaxed mb-4",children:m.description}),e.jsx("div",{className:"rounded-lg border border-primary-muted bg-primary-subtle p-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(yt,{className:"h-4 w-4 text-primary mt-0.5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-primary mb-1 uppercase tracking-wide",children:"Mitigation Strategy"}),e.jsx("p",{className:"text-sm text-ink leading-relaxed",children:m.mitigation})]})]})})]},p))})]})]})]})]})})}function hs(s){switch(s){case"high":return"bg-critical-subtle text-critical-text border-critical-line";case"medium":return"bg-warning-subtle text-warning-text border-warning-line";case"low":return"bg-good-subtle text-good-text border-good-line";default:return"bg-ink-faint text-ink-muted border-line"}}function au({impact:s}){switch(s){case"high":return e.jsx(Et,{className:"h-5 w-5 text-critical-text"});case"medium":return e.jsx(se,{className:"h-5 w-5 text-warning-text"});case"low":return e.jsx(Ct,{className:"h-5 w-5 text-good-text"});default:return e.jsx(et,{className:"h-5 w-5 text-ink-muted"})}}function lu({data:s}){const{toast:t}=Bt();if(!s)return e.jsx("div",{className:"flex items-center justify-center p-8 text-center",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(_t,{className:"h-8 w-8 text-warning-text mx-auto"}),e.jsx("p",{className:"text-ink-muted",children:"No copy analysis data available"}),e.jsx("p",{className:"text-sm text-ink-subtle",children:"Run an analysis first to see results"})]})});const{url:r,pageTitle:i,copyAnalysis:a,priorityFixes:c,overallRecommendations:x}=s,b={headline:(a==null?void 0:a.headline)||{current:"",issues:[],suggestions:[],rewriteExample:""},subheadlines:(a==null?void 0:a.subheadlines)||[],callToActions:(a==null?void 0:a.callToActions)||[],bodyContent:(a==null?void 0:a.bodyContent)||{strengths:[],weaknesses:[],improvements:[]}},h=c||[],j=x||[],d=async y=>{try{await navigator.clipboard.writeText(y),t({title:"Copied!",description:"Text copied to clipboard"})}catch{t({title:"Copy Failed",description:"Unable to copy to clipboard",variant:"destructive"})}};return e.jsx("div",{className:"min-h-screen bg-canvas",children:e.jsxs("div",{className:"space-y-8 p-6",children:[e.jsx("div",{className:"rounded-2xl border border-line bg-surface p-8",children:e.jsx("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-3xl font-bold text-ink",children:"AI Copy Intelligence Report"}),e.jsx("p",{className:"text-ink-muted",children:"Advanced copywriting optimization powered by conversion psychology"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[e.jsx("div",{className:"rounded-lg border border-line bg-surface px-3 py-1.5",children:e.jsx("span",{className:"text-ink text-sm font-medium",children:i})}),e.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-primary hover:text-primary transition-colors",children:[e.jsx(fa,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:"View Original"})]})]})]})})}),e.jsxs("div",{className:"rounded-2xl border border-line bg-surface p-8",children:[e.jsxs("h2",{className:"text-2xl font-bold text-ink mb-6 flex items-center gap-3",children:[e.jsx(Md,{className:"h-6 w-6 text-primary"}
1),"Priority Copy Optimisations"]}),e.jsx("div",{className:"grid gap-6",children:h.map((y,m)=>e.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-line bg-surface p-6 hover:border-primary-muted transition-colors",children:[e.jsx("div",{className:"absolute top-0 right-0 w-20 h-20 bg-primary-subtle rounded-full -mr-10 -mt-10"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(au,{impact:y.impact}),e.jsx("h3",{className:"text-xl font-bold text-ink",children:y.element})]}),e.jsxs(Te,{className:`${hs(y.impact)} border whitespace-nowrap`,children:[y.impact," impact"]})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4 mb-4",children:[e.jsxs("div",{className:"rounded-xl border border-critical-line bg-critical-subtle p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(et,{className:"h-4 w-4 text-critical-text"}),e.jsx("h4",{className:"text-xs font-semibold text-critical-text uppercase tracking-wide",children:"Current Copy"})]}),e.jsxs("p",{className:"text-ink leading-relaxed font-medium",children:['"',y.current,'"']})]}),e.jsxs("div",{className:"rounded-xl border border-good-line bg-good-subtle p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ct,{className:"h-4 w-4 text-good-text"}),e.jsx("h4",{className:"text-xs font-semibold text-good-text uppercase tracking-wide",children:"Optimised Copy"})]}),e.jsx(L,{size:"sm",variant:"outline",onClick:()=>d(y.suggested),className:"h-7 px-2 text-good-text border-good-line hover:bg-good-subtle hover:text-good-text",children:e.jsx(Nt,{className:"h-3.5 w-3.5"})})]}),e.jsxs("p",{className:"text-ink leading-relaxed font-medium",children:['"',y.suggested,'"']})]})]}),e.jsx("div",{className:"rounded-xl border border-primary-muted bg-primary-subtle p-5",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Me,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-primary mb-1 uppercase tracking-wide",children:"Conversion Psychology"}),e.jsx("p",{className:"text-ink leading-relaxed",children:y.reasoning})]})]})})]})]},m))})]}),e.jsxs("div",{className:"rounded-2xl border border-primary-muted bg-surface p-8",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary-subtle border border-primary-muted flex items-center justify-center",children:e.jsx(_t,{className:"h-7 w-7 text-primary"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-primary",children:"Headline Optimisation"}),e.jsx("p",{className:"text-ink-muted text-sm",children:"The most critical element for conversion impact"})]})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-ink-muted uppercase tracking-wide mb-2",children:"Current Headline"}),e.jsx("div",{className:"rounded-xl border border-line bg-surface p-4",children:e.jsxs("p",{className:"text-ink font-medium",children:['"',b.headline.current,'"']})})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-ink-muted uppercase tracking-wide mb-2",children:"Identified Issues"}),e.jsx("div",{className:"space-y-2",children:b.headline.issues.map((y,m)=>e.jsxs("div",{className:"flex items-start gap-2 text-critical-text",children:[e.jsx(et,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("span",{className:"text-sm",children:y})]},m))})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[e.jsx("h4",{className:"text-xs font-semibold text-ink-muted uppercase tracking-wide",children:"Optimised Version"}),e.jsx(L,{size:"sm",variant:"outline",onClick:()=>
1d(b.headline.rewriteExample),className:"h-7 px-2 text-primary border-primary-muted hover:bg-primary-subtle hover:text-primary",children:e.jsx(Nt,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"rounded-xl border border-primary-muted bg-primary-subtle p-4",children:e.jsxs("p",{className:"text-ink font-medium",children:['"',b.headline.rewriteExample,'"']})})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-ink-muted uppercase tracking-wide mb-2",children:"Improvement Strategies"}),e.jsx("div",{className:"space-y-2",children:b.headline.suggestions.map((y,m)=>e.jsxs("div",{className:"flex items-start gap-2 text-good-text",children:[e.jsx(Ct,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("span",{className:"text-sm",children:y})]},m))})]})]})]})]}),e.jsxs("div",{className:"rounded-2xl border border-primary-muted bg-surface p-8",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary-subtle border border-primary-muted flex items-center justify-center",children:e.jsx(se,{className:"h-7 w-7 text-primary"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-primary",children:"Call-to-Action Optimisation"}),e.jsx("p",{className:"text-ink-muted text-sm",children:"Drive action with persuasive CTA copy"})]})]}),e.jsx("div",{className:"grid gap-6",children:b.callToActions.map((y,m)=>e.jsxs("div",{className:"rounded-xl border border-line bg-surface p-5 hover:border-primary-muted transition-colors",children:[e.jsx("div",{className:"flex items-start justify-between gap-3 mb-4",children:e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-ink",children:y.location}),e.jsxs(Te,{className:`${hs(y.priority)} border mt-2`,children:[y.priority," priority"]})]})}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"rounded-lg border border-critical-line bg-critical-subtle p-4",children:[e.jsx("h5",{className:"text-xs font-semibold text-critical-text uppercase tracking-wide mb-2",children:"Current CTA"}),e.jsxs("p",{className:"text-ink font-medium",children:['"',y.current,'"']})]}),e.jsxs("div",{className:"rounded-lg border border-good-line bg-good-subtle p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-good-text uppercase tracking-wide",children:"Optimised CTA"}),e.jsx(L,{size:"sm",variant:"outline",onClick:()=>d(y.rewriteExample),className:"h-7 px-2 text-good-text border-good-line hover:bg-good-subtle hover:text-good-text",children:e.jsx(Nt,{className:"h-3.5 w-3.5"})})]}),e.jsxs("p",{className:"text-ink font-medium",children:['"',y.rewriteExample,'"']})]})]}),y.issues.length>0&&e.jsxs("div",{className:"mt-4",children:[e.jsx("h5",{className:"text-xs font-semibold text-ink-muted uppercase tracking-wide mb-2",children:"Issues Addressed"}),e.jsx("div",{className:"grid md:grid-cols-2 gap-2",children:y.issues.map((p,w)=>e.jsxs("div",{className:"flex items-start gap-2 text-ink-muted",children:[e.jsx(et,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("span",{className:"text-sm",children:p})]},w))})]})]},m))})]}),e.jsxs("div",{className:"rounded-2xl border border-line bg-surface p-8",children:[e.jsxs("h2",{className:"text-2xl font-bold text-ink mb-6 flex items-center gap-3",children:[e.jsx(Ed,{className:"h-6 w-6 text-primary"}),"Strategic Copy Recommendations"]}),e.jsx("div",{className:"grid gap-3",children:j.map((y,m)=>e.jsxs("div",{className:"rounded-xl border border-line bg-surface p-5 flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary-subtle border border-primary-muted flex items-center justify-center flex-shrink-0",children:e.jsx("span",{className:"text-primary font-bold text-sm",children:m+1})}),e.jsx("p",{className:"text-ink leading-relaxed",children:y})]},m))})]})]})})}const ou={swotAnalysis:!1,competitorAnalysis:!1,copyOptimizer:!1};function Qt(s){return ou[s]===!0}const It=Qt("competitorAnalysis"),Dt=Qt("swotAnalysis"),Ut=Qt("copyOptimizer"),Lt=(It?1:0)+(Dt?1:0)+(Ut?1:0),gs=1+Lt;function fs(){const[,s]=id(),t=nd(),{toast:r}=Bt(),[i,a]=T.useState("url"),[c,x]=T.useState(null),[b,h]=T.useState(null),[j,d]=T.useState(null),[y,m]=T.useState(!1),[p,w]=T.useState("free_limit"),[_,D]=T.useState(!1),[q,A]=T.useState("signup"),[le,z]=T.useState(!1),[W,B]=T.useState(!1),[xe,mt]=T.useState(),[Pe,xo]=T.useState(),[je,ut]=T.useState({open:!1,url:"",retryAfter:30,serverMessage:null}),{data:M}=ua({queryKey:["/api/auth/user"],retry:!1}),ho=(M==null?void 0:M.email)==="[email protected]"||(M==null?void 0:M.id)==="google_11607902
16198016871973",Wt=ad(M==null?void 0:M.subscriptionStatus),re=(M==null?void 0:M.stripeSubscriptionId)&&Wt||Wt||(M==null?void 0:M.id)==="44929866"||ho,U=Qe({resolver:We(eu),defaultValues:{url:""}});T.useEffect(()=>{const f=new URLSearchParams(window.location.search).get("url"),g=sessionStorage.getItem("pendingAnalysisUrl"),G=f||g;G&&(U.setValue("url",G),g&&sessionStorage.removeItem("pendingAnalysisUrl"))},[M,U]);const ve=Qe({resolver:We(tu),defaultValues:{primaryUrl:"",competitorUrls:[""]}}),pt=Qe({resolver:We(ae({url:$().url("Please enter a valid URL")})),defaultValues:{url:""}}),xt=Qe({resolver:We(ae({url:$().url("Please enter a valid URL")})),defaultValues:{url:""}}),[Ve,Ie]=T.useState(),te=T.useRef(!1),he=T.useRef(0),[oe,ge]=T.useState(null),[qe,we]=T.useState(null),De=T.useRef(!1),$e=async l=>{if(l){cd(l);try{const f=await dd(l);t.setQueryData(md(l),f),console.log("[report-nav] prefetched report",l.slice(0,8))}catch(f){console.warn("[report-nav] prefetch failed; report page will retry",f)}s(`/report/${l}`)}},fe=Ge({mutationFn:async l=>{sessionStorage.setItem("lastAnalysisUrl",l.url),De.current=!1;const f=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`cs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;return Ie(f),(await ze("POST","/api/analyze/url",{...l,clientToken:f},0,72e4)).json()},onSuccess:async l=>{var f;if((l==null?void 0:l.code)==="ANALYSIS_STILL_RUNNING"){const g=(typeof l.maxWaitSeconds=="number"?l.maxWaitSeconds:600)*1e3;we(Date.now()+g+6e4),r({title:"Still working on your audit",description:l.message??"This one is taking longer than usual, but it's still running. Keep this tab open and we'll load your report the moment it's ready."});return}te.current=!1,x(l),sessionStorage.removeItem("lastAnalysisUrl"),Ie(void 0),he.current=0,ge(null),we(null),(f=l.metadata)!=null&&f.warning&&r({title:"Limited Analysis",description:l.metadata.warning,variant:"destructive"}),l.reportId&&await $e(l.reportId)},onError:(l,f)=>{if(console.error("Analysis error:",l),console.log("Error message:",l.message),ud(l)){const K=pd(l);K&&Ie(K);return}if(te.current=!1,Ie(void 0),he.current=0,ge(null),we(null),De.current){console.log("ð¢ [v24.2.15] Suppressing onError toast - SSE already navigated to the completed report"),sessionStorage.removeItem("lastAnalysisUrl");return}const g=xd(l);if(g){const K=l,Le=K.body??void 0;ut({open:!0,url:f.url,retryAfter:K.retryAfterSeconds??30,serverMessage:(Le==null?void 0:Le.message)??null,reason:g});return}if(hd(l)){const K=l.body??void 0;r({title:"That page doesn't exist",description:(K==null?void 0:K.message)??'That URL returns a "not found" page. Check the address and try again.',variant:"destructive"});return}const G=gd(l);if(G){if(xo(f.url),G.body.gateType==="signup"){z(!0);return}if(G.body.gateType==="pro"){w("free_limit"),m(!0);return}}if(l.message.includes("Free plan limit reached")||l.message.includes("403")){w("free_limit"),m(!0);return}if(l.message.includes("401")){r({title:"Authentication Required",description:"Please sign up or sign in to continue your analysis.",variant:"destructive"}),A("signup"),D(!0);return}const E=l.message.toLowerCase().includes("timeout")||l.message.toLowerCase().includes("network")||l.message.toLowerCase().includes("failed to fetch")||l.message.toLowerCase().includes("aborted")||l.message.toLowerCase().includes("abort")||l.message.toLowerCase().includes("signal"),Ue=sessionStorage.getItem("lastAnalysisUrl");Ue&&U.setValue("url",Ue),r({title:E?"Connection Timed Out":"Analysis Failed",description:E?"Your phone may have gone to sleep. Your URL is saved - just tap the button again to retry.":l.message,variant:"destructive"})}}),Gt=Ge({mutationFn:async l=>(await ze("POST","/api/analyze/competitor",l,0,3e5)).json(),onSuccess:l=>{x(l)},onError:l=>{if(l.message.includes("401")){r({title:"ð Premium Feature",description:"Competitor Analysis requires Pro subscription. Sign up to unlock competitive intelligence.",variant:"destructive"}),A("signup"),D(!0);return}if(l.message.includes("403")){w("pro_feature"),m(!0);return}r({title:"Analysis Failed",description:l.message,variant:"destructive"})}}),Zt=Ge({mutationFn:async l=>(await ze("POST","/api/analyze/swot",l,0,48e4)).json(),onSuccess:l=>{h(l)},onError:l=>
1{if(l.message.includes("401")){r({title:"ð Premium Feature",description:"SWOT Analysis requires Pro subscription. Sign up to unlock advanced analytics.",variant:"destructive"}),setTimeout(()=>{window.location.href=bt("/api/login?returnTo=/analyze")},1500);return}if(l.message.includes("403")){w("pro_feature"),m(!0);return}r({title:"Analysis Failed",description:l.message,variant:"destructive"})}}),Kt=Ge({mutationFn:async l=>(await ze("POST","/api/analyze/copy-optimization",l)).json(),onSuccess:l=>{d(l)},onError:l=>{if(l.message.includes("401")){r({title:"ð Premium Feature",description:"Copy Optimisation requires Pro subscription. Sign up to unlock AI-powered copy improvements.",variant:"destructive"}),A("signup"),D(!0);return}if(l.message.includes("403")){w("pro_feature"),m(!0);return}r({title:"Analysis Failed",description:l.message,variant:"destructive"})}}),Xt=ld(),go=l=>{if(te.current||fe.isPending||oe!==null)return;te.current=!0;const f=Date.now();he.current=f,ge({url:l.url,startedAt:f}),fe.mutate(l)},Yt=l=>{te.current||fe.isPending||oe!==null||Xt.request(l.url,f=>go({...l,...f}))},ht="cs_pending_autostart_url";T.useLayoutEffect(()=>{const l=new URLSearchParams(window.location.search),f=l.get("autostart")==="1"||l.get("start")==="1",g=l.get("url");if(!f||!(g!=null&&g.trim()))return;const G=ts(g);if(!G)return;sessionStorage.setItem(ht,G),l.delete("autostart"),l.delete("start");const E=l.toString();window.history.replaceState(null,"",E?`/analyze?${E}`:"/analyze")},[]),T.useEffect(()=>{const l=sessionStorage.getItem(ht);if(!l)return;a("url"),U.setValue("url",l,{shouldValidate:!0});const f=window.setTimeout(()=>{sessionStorage.removeItem(ht),!(te.current||fe.isPending||oe!==null)&&(Yt({url:l}),r({title:"Starting your audit",description:"Hang tight, this usually takes a few minutes."}))},0);return()=>clearTimeout(f)},[U,fe,r]);const fo=l=>{Gt.mutate(l)},bo=l=>{Zt.mutate(l)},yo=l=>{Kt.mutate(l)},ie=oe!==null||Gt.isPending||Zt.isPending||Kt.isPending;if(T.useEffect(()=>{if(!oe)return;const l=ts(oe.url||U.watch("url")||sessionStorage.getItem("lastAnalysisUrl")||"");if(!l)return;let f=!1;const g=oe.startedAt,G=(()=>{try{return new URL(l).hostname.replace(/^www\./,"").toLowerCase()}catch{return""}})(),E=J=>{te.current=!1,he.current=0,ge(null),we(null),Ie(void 0);const X=sessionStorage.getItem("lastAnalysisUrl");X&&U.setValue("url",X),r({title:"Audit could not be completed",description:J,variant:"destructive"})};let Ue=!1;const K=async()=>{if(!f){if(qe&&Ve)try{const J=await fetch(bt(`/api/analyze/zombie-status?token=${encodeURIComponent(Ve)}`),{credentials:"include"});if(J.ok){const X=await J.json();if(!f&&X.status==="completed"&&X.reportSecureId){console.log("[audit-poll] zombie audit completed, navigating",{secureId:X.reportSecureId}),De.current=!0,te.current=!1,he.current=0,sessionStorage.removeItem("lastAnalysisUrl"),ge(null),we(null),$e(X.reportSecureId);return}if(!f&&X.status==="failed"){E(X.message??"Your audit could not be completed. Please try again, this is usually temporary.");return}}}catch{}if(!Ue)try{const J=await fetch(bt("/api/reports"),{credentials:"include"});if(J.status===401){Ue=!0;return}if(!J.ok)return;const X=await J.json();if(!Array.isArray(X))return;const gt=X.find(ne=>{if(!(ne!=null&&ne.secureId)||!(ne!=null&&ne.url))return!1;const Ht=ne.createdAt?new Date(ne.createdAt).getTime():0;if(Ht&&Ht<g-3e4)return!1;try{return new URL(ne.url).hostname.replace(/^www\./,"").toLowerCase()===G}catch{return!1}});gt&&!f&&(console.log("[audit-poll] match found, navigating",{secureId:gt.secureId,ageMs:Date.now()-g}),De.current=!0,te.current=!1,he.current=0,sessionStorage.removeItem("lastAnalysisUrl"),ge(null),$e(gt.secureId))}catch{}}},Le=window.setInterval(K,5e3);K();const No=qe?Math.max(6e4,qe-Date.now()):11*60*1e3,jo=window.setTimeout(()=>{if(f)return;console.warn("[audit-poll] safety timeout reached, releasing loading state"),te.current=!1,he.current=0,ge(null),we(null);const J=sessionStorage.getItem("lastAnalysisUrl");J&&U.setValue("url",J),r({title:"Audit taking longer than expected",description:"We couldnât confirm your report finished. Check your dashboard or try again.",variant:"destructive"})},No);return()=>{f=!0,window.clearInterval(Le),window.clearTimeout(jo)}},[oe,qe,Ve,s,r,U]),j)return e.jsxs("div",{className:"space-y-8",children:[e.jsx(lu,{data:j}),e.jsx("div",{className:"text-center",children:e.jsx(L,{onClick:()=>d(null),variant:"outline",className:"text-ink border-line-strong bg-surface hover:bg-subtle hover:text-ink font-medium",children:"Optimise Another Page"})})]});if(b)return e.jsxs("div",{className:"space-y-8",children:[e.jsx(nu,{data:b}),e.jsx("div",{className:"text-center",children:e.jsx(L,{onClick:()=>h(null),variant:"outline",className:"text-ink border-line-strong bg-surface hover:bg-subtle hover:text-ink font-medium",children:"Analyse Another Page"})})]});if(c){if(c.primary&&c.competitors)return e.jsxs("div",{className:"space-y-8",children:[e.jsx(ru,{data:c}),e.jsx("div",{className:"text-center",children:e.jsx(L,{onClick:()=>x(null),variant:"outline",className:"text-ink border-line-strong bg-surface hover:bg-subtle hover:text-ink font-medium",children:"Analyse Another Page"})})]});if(!c.reportId)return e.jsxs("div",{className:"space-y-8",children:[e.jsx(Cd,{report:c,embedded:!0}),e.jsx("div",{className:"text-center",children:e.jsx(L,{onClick:()=>x(null),variant:"outline",className:"text-ink border-line-strong bg-surface hover:bg-subtle hover:text-ink font-medium",children:"Analyse Another Page"})})]})}return e.jsxs(e.Fragment,{children:[e.jsx(Jd,{isLoading:ie,analysisType:i==="url"?"Conversion audit":i==="competitor"?"Competitor Analysis":i==="swot"?"SWOT Analysis":"Copy Optimisation",url:i==="url"?U.watch("url"):i==="competitor"?ve.watch("primaryUrl"):"",context:"analyze",clientToken:i==="url"?Ve:void 0,onAuditComplete:l=>{De.current=!0,U.reset(),sessionStorage.removeItem("lastAnalysisUrl"),$e(l)}}),e.jsx(em,{open:je.open,targetUrl:je.url,retryAfterSeconds:je.retryAfter,serverMessage:je.serverMessage,reason:je.reason,onCancel:()=>ut(l=>({...l,open:!1})),onRetry:()=>{const l=je.url;ut(f=>({...f,open:!1})),l&&fe.mutate({url:l})}}),e.jsxs("div",{className:"space-y-8",children:[e.jsx(Td,{children:e.jsx(_d,{className:"p-5 sm:p-6",children:e.jsxs(wd,{value:i,onValueChange:a,className:"w-full",children:[Lt>0&&e.jsxs(Sd,{className:gs===4?"grid w-full grid-cols-2 sm:grid-cols-4 gap-1 sm:gap-0":gs===3?"grid w-full grid-cols-2 sm:grid-cols-3 gap-1 sm:gap-0":"grid w-full grid-cols-2 sm:grid-cols-2 gap-1 sm:gap-0",children:[e.jsxs(Xe,{value:"url",className:"text-xs sm:text-sm px-2 sm:px-4",children:[e.jsx("span",{className:"hidden sm:inline",children:"Website URL"}),e.jsx("span",{className:"sm:hidden",children:"URL"})]}),It&&e.jsxs(Xe,{value:"competitor",className:`relative text-xs sm:text-sm px-2 sm:px-4 ${re?"cursor-pointer":"opacity-50 cursor-not-allowed"}`,disabled:!re,children:[e.jsx("span",{className:"hidden sm:inline",children:"VS Competitors"}),e.jsx("span",{className:"sm:hidden",children:"VS"}),e.jsx("span",{className:"absolute -top-1 -right-1 bg-primary text-white text-[10px] sm:text-xs px-1.5 py-0.5 rounded-full font-bold shadow-lg",children:"PRO"})]}),Dt&&e.jsxs(Xe,{value:"swot",className:`relative text-xs sm:text-sm px-2 sm:px-4 ${re?"cursor-pointer":"opacity-50 cursor-not-allowed"}`,disabled:!re,children:[e.jsx("span",{className:"hidden sm:inline",children:"SWOT Analysis"}),e.jsx("span",{className:"sm:hidden",children:"SWOT"}),e.jsx("span",{className:"absolute -top-1 -right-1 bg-primary text-white text-[10px] sm:text-xs px-1.5 py-0.5 rounded-full font-bold shadow-lg",children:"PRO"})]}),Ut&&e.jsxs(Xe,{value:"copywriter",className:"relative text-xs sm:text-sm px-2 sm:px-4 cursor-pointer",children:[e.jsx("span",{className:"hidden sm:inline",children:"Copy Optimiser"}),e.jsx("span",{className:"sm:hidden",children:"Copy"}),e.jsxs("div",{className:"absolute -top-1 -right-1 flex gap-1",children:[e.jsx("span",{className:"bg-good text-white text-[10px] sm:text-xs px-1.5 py-0.5 rounded-full font-bold shadow-lg",children:"BETA"}),e.jsx("span",{className:"bg-primary text-white text-[10px] sm:text-xs px-1.5 py-0.5 rounded-full font-bold shadow-lg",children:"PRO"})]})]})]}),e.jsx(Ye,{value:"url",className:Lt>0?"mt-6":"mt-0",children:e.jsx(Ke,{...U,children:e.jsxs("form",{onSubmit:U.handleSubmit(Yt),className:"space-y-3",children:[e.jsx(ce,{control:U.control,name:"url",render:({field:l})=>e.jsxs(de,{children:[e.jsx(me,{className:"text-heading text-ink",children:"Page URL"}),e.jsx("p",{className:"text-body-sm text-ink-subtle",children:"A product page, landing page or homepage. We capture it live and score it across six pillars."}),e.jsxs("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[e.jsx(ue,{children:e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Rd,{className:"pointer-events-none absolute left-3.5 to
1p-1/2 h-4 w-4 -translate-y-1/2 text-ink-faint","aria-hidden":!0}),e.jsx(be,{placeholder:"https://yourstore.com/products/best-seller",className:"h-12 pl-10 text-body",inputMode:"url",autoComplete:"url",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,...l,onChange:f=>{let g=f.target.value.trim();g&&!g.startsWith("http://")&&!g.startsWith("https://")&&(g="https://"+g),g=g.replace(/^https:\/\/https:\/\//,"https://"),l.onChange(g)}})]})}),e.jsxs(L,{type:"submit",size:"lg",variant:"brand",className:"h-12 shrink-0 px-6",disabled:ie,children:[ie?"Starting audit":re?"Run audit":"Run free audit",e.jsx(ba,{})]})]}),e.jsx(Oe,{})]})}),e.jsxs("details",{className:"group rounded-control border border-line bg-surface px-4 py-3","data-testid":"audit-context",children:[e.jsxs("summary",{className:"cursor-pointer list-none text-body-sm font-medium text-ink marker:hidden",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Vd,{className:"h-3.5 w-3.5 transition-transform duration-base group-open:rotate-45","aria-hidden":!0}),"Add context for sharper advice"]}),e.jsx("span",{className:"ml-1.5 font-normal text-ink-subtle",children:"(optional)"})]}),e.jsxs("div",{className:"mt-3 grid gap-3 sm:grid-cols-3",children:[e.jsx(ce,{control:U.control,name:"context.audience",render:({field:l})=>e.jsxs(de,{children:[e.jsx(me,{className:"text-body-sm text-ink",children:"Who it's for"}),e.jsx(ue,{children:e.jsx(be,{placeholder:"e.g. homeowners in Austin",maxLength:160,...l,value:l.value??"","data-testid":"input-context-audience"})})]})}),e.jsx(ce,{control:U.control,name:"context.trafficSource",render:({field:l})=>e.jsxs(de,{children:[e.jsx(me,{className:"text-body-sm text-ink",children:"Visitors come from"}),e.jsx(ue,{children:e.jsxs("select",{className:"h-9 w-full rounded-control border border-line-strong bg-surface px-3 text-body-sm text-ink",value:l.value??"",onChange:f=>l.onChange(f.target.value||void 0),"data-testid":"select-context-traffic",children:[e.jsx("option",{value:"",children:"Not sure"}),e.jsx("option",{value:"paid_ads",children:"Paid ads"}),e.jsx("option",{value:"search",children:"Google search"}),e.jsx("option",{value:"social",children:"Social media"}),e.jsx("option",{value:"email",children:"Email"}),e.jsx("option",{value:"referral",children:"Links from other sites"}),e.jsx("option",{value:"mixed",children:"A mix"})]})})]})}),e.jsx(ce,{control:U.control,name:"context.goal",render:({field:l})=>e.jsxs(de,{children:[e.jsx(me,{className:"text-body-sm text-ink",children:"Main goal"}),e.jsx(ue,{children:e.jsx(be,{placeholder:"e.g. book a service call",maxLength:160,...l,value:l.value??"","data-testid":"input-context-goal"})})]})})]})]}),e.jsxs("p",{className:"flex flex-wrap gap-x-4 gap-y-1 text-caption text-ink-subtle",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(qd,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Takes ",pa]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx($d,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Six pillars, ranked fixes"]}),!re&&e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Qd,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Free, no card needed"]})]})]})})}),It&&e.jsx(Ye,{value:"competitor",className:"mt-6",children:re?e.jsxs("div",{children:[e.jsxs("div",{className:"text-center space-y-2 mb-6",children:[e.jsx("h3",{className:"text-xl font-bold text-ink",children:"Competitive Intelligence"}),e.jsx("p",{className:"text-sm text-ink-muted",children:"AI-powered competitor analysis for strategic advantage"})]}),e.jsx(Ke,{...ve,children:e.jsxs("form",{onSubmit:ve.handleSubmit(fo),className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border border-primary-muted bg-primary-subtle p-4 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-primary font-medium mb-2",children:[e.jsx(Me,{className:"h-4 w-4"}),"Competitive Analysis"]}),e.jsx("p",{className:"text-sm text-ink-muted",children:"Compare your website against 1 competitor to discover what they're doing better and get specific recommendations to outperform them."})]}),e.jsx(ce,{control:ve.control,name:"primaryUrl",render:({field:l})=>e.jsxs(de,{children:[e.jsx(me,{className:"text-sm font-medium text-ink",children:"Your Website URL"}),e.jsx(ue,{children:e.jsxs("div",{className:"relative",children:[e.jsx(be,{placeholder:"https://yoursite.com",className:"text-lg py-3 pr-10 bg-surface border-line text-ink placeholder:text-ink-faint focus:border-primary transition-colors",...l,onChange:f=>{l.onChange(f);const g=f.target.value.trim();g&&!g.startsWith("http://")&&!g.startsWith("https://")&&l.onChange("https://"+g)}}),e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(Zd,{className:"h-4 w-4 text-primary"})})]})}),e.jsx(Oe,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(me,{className:"text-sm font-medium text-ink",children:"Competitor URL (1 website)"}),ve.watch("competitorUrls").map((l,f)=>e.jsx("div",{className:"flex gap-2",children:e.jsx(ce,{control:ve.control,name:`competitorUrls.${f}`,render:({field:g})=>e.jsxs(de,{className:"flex-1",children:[e.jsx(ue,{children:e.jsxs("div",{className:"relative",children:[e.jsx(be,{placeholder:`https://compet
1itor${f+1}.com`,className:"py-3 pr-10 bg-surface border-line text-ink placeholder:text-ink-faint focus:border-primary transition-colors",...g,onChange:G=>{let E=G.target.value.trim();E&&!E.startsWith("http://")&&!E.startsWith("https://")&&(E="https://"+E),E=E.replace(/^https:\/\/https:\/\//,"https://"),g.onChange(E)}}),e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(Kd,{className:"h-4 w-4 text-critical-text"})})]})}),e.jsx(Oe,{})]})})},f))]}),e.jsxs(L,{type:"submit",className:"w-full py-4 text-lg font-semibold rounded-xl bg-primary hover:bg-primary-hover text-white shadow-lg",disabled:ie,children:[e.jsx(Xd,{className:"mr-2 h-5 w-5"}),ie?"Analysing Competition...":"Analyse vs Competitors"]})]})})]}):e.jsxs("div",{className:"text-center space-y-6 py-12",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"mx-auto w-16 h-16 bg-primary rounded-full flex items-center justify-center shadow-lg",children:e.jsx(Wd,{className:"h-7 w-7 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-ink",children:"Competitor Analysis"}),e.jsx("p",{className:"text-ink-muted max-w-2xl mx-auto",children:"Compare your website against competitors to discover what they're doing better. Get side-by-side analysis, competitive insights, and specific recommendations to outperform them."})]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-4 max-w-4xl mx-auto text-left",children:[e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-4",children:[e.jsxs("h4",{className:"font-semibold text-primary mb-2 flex items-center gap-2",children:[e.jsx(se,{className:"h-4 w-4"}),"Head-to-Head Comparison"]}),e.jsx("p",{className:"text-sm text-ink-muted",children:"See exactly how your conversion elements stack up against competitors"})]}),e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-4",children:[e.jsxs("h4",{className:"font-semibold text-primary mb-2 flex items-center gap-2",children:[e.jsx(Gd,{className:"h-4 w-4"}),"Gap Analysis"]}),e.jsx("p",{className:"text-sm text-ink-muted",children:"Identify opportunities your competitors are missing"})]}),e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-4",children:[e.jsxs("h4",{className:"font-semibold text-primary mb-2 flex items-center gap-2",children:[e.jsx(Mt,{className:"h-4 w-4"}),"Action Plan"]}),e.jsx("p",{className:"text-sm text-ink-muted",children:"Get specific steps to outperform your competition"})]})]}),e.jsx(L,{onClick:()=>{w("pro_feature"),m(!0)},className:"bg-primary hover:bg-primary-hover text-white px-8 py-3 text-lg font-semibold rounded-xl shadow-lg",children:"Unlock Competitor Analysis"}),e.jsx("p",{className:"text-sm text-ink-muted",children:"Compare your page against the live patterns Pro audits identify."})]})}),Dt&&e.jsx(Ye,{value:"swot",className:"mt-6",children:re?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("h3",{className:"text-xl font-bold text-ink",children:"Strategic SWOT Analysis"}),e.jsx("p",{className:"text-sm text-ink-muted",children:"AI-powered strategic assessment for competitive positioning"})]}),e.jsx(Ke,{...pt,children:e.jsxs("form",{onSubmit:pt.handleSubmit(bo),className:"space-y-6",children:[e.jsx(ce,{control:pt.control,name:"url",render:({field:l})=>e.jsxs(de,{children:[e.jsx(me,{className:"text-sm font-medium text-ink",children:"Website URL"}),e.jsx(ue,{children:e.jsxs("div",{className:"relative",children:[e.jsx(be,{placeholder:"https://yourwebsite.com",className:"text-lg py-3 pr-10 bg-surface border-line text-ink placeholder:text-ink-faint focus:border-primary transition-colors",...l,onChange:f=>{let g=f.target.value.trim();g&&!g.startsWith("http://")&&!g.startsWith("https://")&&(g="https://"+g),g=g.replace(/^https:\/\/https:\/\//,"https://"),l.onChange(g)}}),e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(is,{className:"h-5 w-5 text-primary"})})]})}),e.jsx(Oe,{})]})}),e.jsxs(L,{type:"submit",className:"w-full py-4 text-lg font-semibold rounded-xl bg-primary hover:bg-primary-hover text-white transition-all duration-200 shadow-lg",disabled:ie,children:[e.jsx(is,{className:"h-5 w-5 mr-2"}),ie?"Generating SWOT Analysis...":"Generate SWOT Analysis"]})]})})]}):e.jsxs("div",{className:"text-center space-y-6 py-12",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"mx-auto w-16 h-16 bg-primary rounded-full flex items-center justify-center shadow-lg",children:e.jsx(xa,{
1className:"h-7 w-7 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-ink",children:"SWOT Analysis"}),e.jsx("p",{className:"text-ink-muted max-w-2xl mx-auto",children:"Get comprehensive Strengths, Weaknesses, Opportunities, and Threats analysis of your website. Perfect for strategic planning and competitive positioning."})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4 max-w-3xl mx-auto text-left",children:[e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-4",children:[e.jsxs("h4",{className:"font-semibold text-good-text mb-2 flex items-center gap-2",children:[e.jsx(ga,{className:"h-4 w-4"}),"Strengths & Opportunities"]}),e.jsx("p",{className:"text-sm text-ink-muted",children:"Identify what you're doing right and untapped opportunities"})]}),e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-4",children:[e.jsxs("h4",{className:"font-semibold text-warning-text mb-2 flex items-center gap-2",children:[e.jsx(se,{className:"h-4 w-4"}),"Weaknesses & Threats"]}),e.jsx("p",{className:"text-sm text-ink-muted",children:"Spot vulnerabilities and competitive threats to address"})]})]}),e.jsx(L,{onClick:()=>{w("pro_feature"),m(!0)},className:"bg-primary hover:bg-primary-hover text-white px-8 py-3 text-lg font-semibold rounded-xl shadow-lg",children:"Unlock SWOT Analysis"}),e.jsx("p",{className:"text-sm text-ink-muted",children:"Strategic insights used by top-performing websites"})]})}),Ut&&e.jsx(Ye,{value:"copywriter",className:"mt-6",children:re?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center space-y-2",children:[e.jsxs("h3",{className:"text-xl font-bold text-ink inline-flex items-center gap-2",children:["AI Copy Optimiser",e.jsx("span",{className:"bg-good text-white text-xs px-2 py-0.5 rounded-full font-bold",children:"BETA"})]}),e.jsx("p",{className:"text-sm text-ink-muted",children:"Advanced AI analysis for c
1onversion-focused copy improvements (in active development)"})]}),e.jsx(Ke,{...xt,children:e.jsxs("form",{onSubmit:xt.handleSubmit(yo),className:"space-y-6",children:[e.jsx(ce,{control:xt.control,name:"url",render:({field:l})=>e.jsxs(de,{children:[e.jsx(me,{className:"text-sm font-medium text-ink",children:"Website URL"}),e.jsx(ue,{children:e.jsxs("div",{className:"relative",children:[e.jsx(be,{placeholder:"https://yourwebsite.com",className:"text-lg py-3 pr-10 bg-surface border-line text-ink placeholder:text-ink-faint focus:border-primary transition-colors",...l,onChange:f=>{let g=f.target.value.trim();g&&!g.startsWith("http://")&&!g.startsWith("https://")&&(g="https://"+g),g=g.replace(/^https:\/\/https:\/\//,"https://"),l.onChange(g)}}),e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(ns,{className:"h-5 w-5 text-primary"})})]})}),e.jsx(Oe,{})]})}),e.jsxs(L,{type:"submit",className:"w-full py-4 text-lg font-semibold rounded-xl bg-primary hover:bg-primary-hover text-white transition-all duration-200 shadow-lg",disabled:ie,children:[e.jsx(ns,{className:"h-5 w-5 mr-2"}),ie?"Analysing Copy...":"Optimise Copy"]})]})})]}):e.jsxs("div",{className:"text-center space-y-6 py-12",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"mx-auto w-16 h-16 bg-primary rounded-full flex items-center justify-center shadow-lg",children:e.jsx(Yd,{className:"h-7 w-7 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-ink",children:"Copy Optimisation"}),e.jsx("p",{className:"text-ink-muted max-w-2xl mx-auto",children:"AI-powered copy optimisation with specific suggestions for headlines, CTAs, and persuasive content. Get exact text recommendations for better conversions."})]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-4 max-w-4xl mx-auto text-left",children:[e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-4",children:[e.jsxs("h4",{className:"font-semibold text-primary mb-2 flex items-center gap-2",children:[e.jsx(_t,{className:"h-4 w-4"}),"Headlines & Copy"]}),e.jsx("p",{className:"text-sm text-ink-muted",children:"Get AI-optimised headlines and persuasive copy suggestions"})]}),e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-4",children:[e.jsxs("h4",{className:"font-semibold text-primary mb-2 flex items-center gap-2",children:[e.jsx(se,{className:"h-4 w-4"}),"CTA Optimisation"]}),e.jsx("p",{className:"text-sm text-ink-muted",children:"Specific call-to-action improvements for higher conversions"})]}),e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-4",children:[e.jsxs("h4",{className:"font-semibold text-primary mb-2 flex items-center gap-2",children:[e.jsx(Me,{className:"h-4 w-4"}),"Psychology Insights"]}),e.jsx("p",{className:"text-sm text-ink-muted",children:"Behavioral triggers and persuasion techniques analysis"})]})]}),e.jsx(L,{onClick:()=>{w("pro_feature"),m(!0)},className:"bg-primary hover:bg-primary-hover text-white px-8 py-3 text-lg font-semibold rounded-xl shadow-lg",children:"Unlock Copy Optimiser"}),e.jsx("p",{className:"text-sm text-ink-muted",children:"Conversion-focused copy used by high-converting websites"})]})})]})})}),e.jsx(tm,{isOpen:y,onClose:()=>m(!1),trigger:p,featureName:p==="pro_feature"?"Competitor Analysis":void 0}),e.jsx(od,{isOpen:_,onClose:()=>D(!1),mode:q,onModeChange:A,onSuccess:()=>{D(!1)}}),Xt.modal,e.jsx(sm,{isOpen:le,onClose:()=>z(!1),onEmailCaptured:()=>{z(!1),Pe&&(U.setValue("url",Pe),fe.mutate({url:Pe}))},onSwitchToSignIn:()=>{z(!1),B(!0)}}),e.jsx(rm,{isOpen:W,onClose:()=>B(!1),prefillEmail:xe,returnTo:Pe?`/analyze?url=${encodeURIComponent(Pe)}&autostart=1`:"/analyze"})]})]})}const cu=["An overall conversion score and grade","Findings ranked by impact, each with the exact change to make","A breakdown of all six pillars, check by check","A redesign of the page with the fixes applied (Pro)"];function bs(){return e.jsx("ul",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:jd.map(s=>e.jsxs("li",{className:"rounded-panel border border-line bg-surface p-4 shadow-card",children:[e.jsxs("p",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("span",{className:"text-body-sm font-medium text-ink",children:s.name}),e.jsxs("span",{className:"num text-caption text-ink-subtle",children:[s.weight,"%"]})]}),e.jsx("p",{className:"mt-1 text-body-sm text-ink-muted",children:vd[s.key]})]},s.key))})}function Fu(){const{isAuthenticated:s,isLoading:t}=fd(),r=T.useRef(null);r.current===null&&!t&&(r.current=s?"app":"public"),T.useEffect(()=>{bd("page_view","analyze","analyze_page")},[]);const{data:i}=ua({queryKey:["/api/demo-report"],retry:!1}),a=i!=null&&i.secureId?`/report/${i.secureId}`:null,c=am["/analyze"];return r.current===null?e.jsx("div",{className:"min-h-screen bg-canvas","aria-busy":"true"}):r.current==="app"?e.jsx(im,{children:e.jsxs("main",{id:"main-content",className:"container-app space-y-10 px-4 py-6 sm:px-6 lg:px-8 lg:py-8",children:[e.jsx(nm,{title:"New audit",description:"Score any page across six pillars and get its f
1ixes ranked by impact."}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr),20rem]",children:[e.jsx(fs,{}),e.jsxs("aside",{className:"rounded-panel border border-line bg-surface p-5 shadow-card",children:[e.jsx("h2",{className:"text-heading text-ink",children:"What you get"}),e.jsx("ul",{className:"mt-3 space-y-2.5",children:cu.map(x=>e.jsxs("li",{className:"flex gap-2.5 text-body-sm text-ink-muted",children:[e.jsx(Hd,{className:"mt-0.5 h-4 w-4 shrink-0 text-brand","aria-hidden":!0}),x]},x))}),a&&e.jsxs(Ze,{href:a,className:"mt-4 inline-flex items-center gap-1.5 text-body-sm font-medium text-brand hover:underline",children:["See a sample report",e.jsx(ba,{className:"h-3.5 w-3.5","aria-hidden":!0})]})]})]}),e.jsxs("section",{"aria-labelledby":"pillars-heading",children:[e.jsx("h2",{id:"pillars-heading",className:"text-title text-ink",children:"The six pillars we score"}),e.jsx("p",{className:"mt-1 text-body-sm text-ink-subtle",children:"Each pillar is weighted into the overall score."}),e.jsx("div",{className:"mt-4",children:e.jsx(bs,{})})]})]})}):e.jsxs("div",{className:"min-h-screen bg-canvas",children:[e.jsx(yd,{}),e.jsxs("main",{id:"main-content",children:[e.jsx("section",{className:"border-b border-line bg-surface",children:e.jsxs("div",{className:"container-content px-4 py-12 sm:px-6 sm:py-16 lg:px-8",children:[e.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[e.jsx("h1",{className:"text-display text-ink sm:text-display-xl",children:"Free CRO audit tool"}),e.jsxs("p",{className:"mx-auto mt-4 max-w-2xl text-body-lg text-ink-muted",children:["Enter your URL and our AI audits your page across 6 conversion pillars, then hands you a scored report with the fixes ranked by impact. Built for founders, marketers, and agencies who want specialist-grade CRO findings in ",pa,", not a 3-week consulting engagement."]})]}),e.jsx("div",{className:"mx-auto mt-8 max-w-2xl",children:e.jsx(fs,{})})]})}),e.jsxs("div",{className:"container-content space-y-16 px-4 py-14 sm:px-6 lg:px-8",children:[e.jsxs("section",{"aria-labelledby":"pillars-heading",children:[e.jsx("h2",{id:"pillars-heading",className:"text-center text-title-lg text-ink",children:"The six pillars we score"}),e.jsx("div",{className:"mt-6",children:e.jsx(bs,{})}),a&&e.jsxs("p",{className:"mt-6 text-center text-body-sm text-ink-muted",children:["Want to see the output first?"," ",e.jsx(Ze,{href:a,className:"link",children:"Open a real sample report"}),"."]})]}),c&&e.jsxs("section",{"aria-labelledby":"faq-heading",className:"mx-auto max-w-3xl",children:[e.jsx("h2",{id:"faq-heading",className:"text-center text-title-lg text-ink",children:"Frequently asked questions"}),e.jsx("div",{className:"mt-6 divide-y divide-line rounded-panel border border-line bg-surface shadow-card",children:c.map(x=>e.jsxs("details",{className:"group px-5 py-4",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-4 text-body font-medium text-ink [&::-webkit-details-marker]:hidden",children:[x.question,e.jsx(ha,{className:"h-4 w-4 shrink-0 text-ink-subtle transition-transform duration-base group-open:rotate-180","aria-hidden":!0})]}),e.jsx("p",{className:"mt-2 text-body-sm text-ink-muted",children:x.answer})]},x.question))})]}),e.jsxs("p",{className:"text-center text-body-sm text-ink-muted",children:["While the audit runs, try our"," ",e.jsx(Ze,{href:"/tools",className:"link",children:"free CRO tools"})," ","or read the"," ",e.jsx(Ze,{href:"/blog",className:"link",children:"CRO blog"}),"."]})]})]}),e.jsx(Nd,{})]})}export{Fu as default};
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.