1import{h as l,j as u,g as d,a as m,k as g,s as p,c as y}from"./resume-DQ2pc8eQ.js";import{D as f,c as h}from"./amplify_outputs-ByhBuvRU.js";import{g as _,f as S}from"./API-DAFHaofH.js";import{a as o}from"./index-DgoachrA.js";const $=` 2query GetUserDetailsById($id: String!) { 3 getUserDetailsById(id: $id) { 4 responseCode 5 responseMessage 6 } 7} 8`,w=` 9query getPaymentDetailsByIdGenieWebsite($id: String!) { 10 getPaymentDetailsByIdGenieWebsite(id: $id) { 11 responseCode 12 responseMessage 13 } 14} 15`,R=` 16query captureOrderGenie($id: String!,$product_type: String!,$paypalToken: String!) { 17 captureOrderGenie(id: $id,product_type: $product_type,paypalToken: $paypalToken) { 18 responseCode 19 responseMessage 20 } 21} 22`,M=` 23query getRazorpayDetailsHostingGenie($id: String!) { 24 getRazorpayDetailsHostingGenie(id: $id) { 25 responseCode 26 responseMessage 27 } 28} 29`,P=` 30query getGenieAIPayment($id: String!) { 31 getGenieAIPayment(id: $id) { 32 responseCode 33 responseMessage 34 } 35} 36`,v=` 37query getGenieAIPaypalPayments($id: String!,$product_type: String!,$paypalToken: String!) { 38 getGenieAIPaypalPayments(id: $id,product_type: $product_type,paypalToken: $paypalToken) { 39 responseCode 40 responseMessage 41 } 42} 43`,E=` 44query getRazorpayDetailsGenieAI($id: String!) { 45 getRazorpayDetailsGenieAI(id: $id) { 46 responseCode 47 responseMessage 48 } 49} 50`,F=` 51query getAllUserDetailsByDomain($domain_name: String!) { 52 getAllUserDetailsByDomain(domain_name: $domain_name) { 53 created_at 54 id 55 duration_in_month 56 domain_name 57 deployed_url 58 email 59 name 60 payment_status 61 product_name 62 product_type 63 repo_name 64 } 65} 66`,U=` 67query getDomainDetailsByEmail($email: String!) { 68 getDomainDetailsByEmail(email: $email) { 69 id 70 session_id 71 product_name 72 product_price 73 quantity_used 74 domain_name 75 created_at 76 duration_in_month 77 duration_in_year 78 total_amount_from_stripe 79 region 80 product_type 81 name 82 mode_used 83 email 84 payment_status 85 stripe_subscription_id 86 stripe_schedule_id 87 stripe_customer_id 88 forwarding 89 custom_domain 90 professional 91 } 92} 93`,z=` 94query getCloudflareAnalytics($domain: String!, $hours: String!) { 95 getCloudflareAnalytics(domain: $domain, hours: $hours) { 96 datetimeHour 97 edgeResponseBytes 98 visits 99 } 100 } 101`,H=` 102query getCloudflareZoneAnalytics($domain: String!, $hours: String!) { 103 getCloudflareZoneAnalytics(domain: $domain, hours: $hours) { 104 datetimeHour 105 visits 106 edgeResponseBytes 107 cachedRequests 108 encryptedRequests 109 threats 110 responseStatusMap { 111 status 112 requests 113 } 114 countryMap { 115 country 116 requests 117 bytes 118 threats 119 } 120 contentTypeMap { 121 type 122 bytes 123 requests 124 } 125 clientSSLMap { 126 protocol 127 requests 128 } 129 ipClassMap { 130 ipClass 131 requests 132 } 133 } 134} 135`,O=` 136 query GetCloudflareSecuritySampledLogs($domain: String!,$hours: String!) { 137 getCloudflareSecuritySampledLogs(domain: $domain,hours: $hours,) { 138 count 139 logs { 140 datetime 141 clientIP 142 country 143 asn 144 asnDescription 145 path 146 method 147 protocol 148 scheme 149 host 150 cacheStatus 151 userAgent 152 securityAction 153 securitySource 154 leakedCredentialCheckResult 155 } 156 } 157 } 158`,L=` 159 query getCloudflareTrafficAnalytics($domain: String!,$hours: String!) { 160 getCloudflareTrafficAnalytics(domain: $domain,hours: $hours) { 161 mitigatedByWAF { 162 count 163 sampleInterval 164 ts 165 } 166 servedByCloudflare { 167 count 168 sampleInterval 169 ts 170 } 171 servedByOrigin { 172 count 173 sampleInterval 174 ts 175 } 176 } 177 } 178`,j=` 179query getGoogleConsoleDetailsByID($ID: String!) { 180 getGoogleConsoleDetailsByID(ID: $ID) { 181 ID 182 gmailToAddForSearch 183 google_url 184 key 185 password 186 searchEnabled 187 username 188 zone_id 189 } 190} 191`,W=` 192query getFormDetails($user_id: String!) { 193 getFormDetails(user_id: $user_id) { 194 user_id 195 form_id 196 created_at 197 domain 198 endpoint 199 form_name 200 recipient_email 201 redirect_url 202 email_template 203 customTemplateHtml 204 turnstile_enabled 205 captchaMode 206 customCaptchaKey 207 fileUploadEnabled 208 allowedFileTypes 209 maxFileSize 210 googleSheetUrl 211 googleSheetEnabled 212 honeypotEnabled 213 } 214} 215`,x=` 216query getFormSubmissions($form_id: String!) { 217 getFormSubmissions(form_id: $form_id) { 218 form_id 219 timestamp 220 data 221 email 222 ip 223 user_agent 224 country 225 } 226} 227`;f.configure(h);const D=_();async function A(e){try{return(await D.graphql({query:$,variables:{id:e}})).data.getUserDetailsById.responseMessage}catch(t){throw console.error("Error in fetching user details in utils file:",t),t}}y();const r=o(null),n=o(!1),i=o(!1);async function I(){if(typeof window>"u")return;const e=await c({tokenType:"id"});e&&(await fetch("/api/runtime/entitlements?all=1",{headers:{Authorization:`Bearer ${e}`}}
227).catch(t=>{console.warn("[auth.runtime] Failed to sync D1 entitlements on auth bootstrap.",t)}),await fetch("/api/workspaces",{headers:{Authorization:`Bearer ${e}`}}).catch(t=>{console.warn("[auth.runtime] Failed to initialize AI workspace on auth bootstrap.",t)}))}const C=async e=>{try{const t=await A(e);if(t==="User not found")return console.log("No user found"),null;try{return JSON.parse(t)}catch(s){return console.error("Error parsing user details:",s),null}}catch(t){return console.error("Error fetching user details:",t),null}};async function k(){if(l()){u({includeAllReadableCookies:!0}),r.set(null),n.set(!1);return}try{const e=await d(),t=e.userId||e.username;r.set({username:e.username||t,email:e.signInDetails?.loginId,name:e.username||t}),i.set(!1),n.set(!0);const s=await C(t);if(s){const a={username:s.name||e.username||t,email:e.signInDetails?.loginId||s.email,name:s.name,contact:s.phone_number};r.set(a)}I()}catch{r.set(null),n.set(!1)}}async function c(e){if(l())return u({includeAllReadableCookies:!0}),null;try{const t=await S(e?.forceRefresh?{forceRefresh:!0}:void 0),s=t.tokens?.idToken?.toString(),a=t.tokens?.accessToken?.toString();if(e?.tokenType==="access"){if(a)return a;if(s)return s}else if(e?.tokenType==="id"){if(s)return s;if(a)return a}else if(s||a)return s||a;if(!s&&!a)return console.warn("[auth.sync] No Cognito token available for authenticated API call.",{forceRefresh:!!e?.forceRefresh,tokenType:e?.tokenType||"either"}),null}catch(t){return console.warn("[auth.sync] Failed to fetch Cognito token",{forceRefresh:!!e?.forceRefresh,tokenType:e?.tokenType||"either",error:t}),null}}async function q(){i.set(!0),m(),g();try{const e=await p({redirectPath:"/"});return r.set(null),n.set(!1),e}catch(e){return console.error("Error signing out:",e),r.set(null),n.set(!1),!1}}const N=Object.freeze(Object.defineProperty({__proto__:null,authUser:r,checkAuthStatus:k,fetchAuthToken:c,isAuthenticated:n,isLoggingOut:i,logout:q},Symbol.toStringTag,{value:"Module"}));export{r as a,E as b,k as c,A as d,i as e,c as f,M as g,P as h,n as i,v as j,F as k,q as l,H as m,L as n,O as o,z as p,j as q,W as r,x as s,w as t,R as u,U as v,N as w};
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.