import{r as e,t}from"./jsx-runtime-BbTa8W_M-1776590214964.js";import{a as n,n as r,t as i}from"./app-CXDQ5oEH-1776590214964.js";import{t as a}from"./AdminLayout-gmPnZHB9-1776590214964.js";import{n as o}from"./image-BMWfnpwa-1776590214964.js";import{t as s}from"./loader-circle-BF-wgoyu-1776590214964.js";import{t as c}from"./save-DLvESXbJ-1776590214964.js";import{t as l}from"./triangle-alert-DCmuaATN-1776590214964.js";import{t as u}from"./button-WiAFyHfP-1776590214964.js";import{t as d}from"./label-DwYxovYB-1776590214964.js";import{a as f,n as p,o as m,r as h,t as g}from"./card-Cby8flFO-1776590214964.js";e();var _=t();function v({settings:e}){let{data:t,setData:v,post:y,processing:b}=n({custom_header_script:e?.custom_header_script||``,custom_footer_script:e?.custom_footer_script||``});return(0,_.jsxs)(a,{children:[(0,_.jsx)(r,{title:`Custom Scripts & Analytics`}),(0,_.jsxs)(`div`,{className:`max-w-5xl mx-auto pb-12`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-3 mb-6`,children:[(0,_.jsx)(o,{className:`w-8 h-8 text-primary`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:`Custom Scripts (Injectors)`}),(0,_.jsx)(`p`,{className:`text-muted-foreground`,children:`Add third-party tracking codes, CSS, or JavaScript globally.`})]})]}),(0,_.jsxs)(`div`,{className:`bg-amber-500/10 border border-amber-500/30 text-amber-700 dark:text-amber-500 p-4 rounded-xl flex gap-3 items-start mb-6`,children:[(0,_.jsx)(l,{className:`w-5 h-5 shrink-0 mt-0.5`}),(0,_.jsxs)(`div`,{className:`text-sm leading-relaxed`,children:[(0,_.jsx)(`strong`,{children:`Warning:`}),` The code pasted here is injected directly into the HTML without filtering. Malformed tags or syntax errors in JavaScript could break the visual layout or functionality of the frontend. Only paste scripts from trusted sources (Google Analytics, Meta Pixel, Tawk.to, etc.).`]})]}),(0,_.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),y(route(`cp.settings.scripts.update`),{preserveScroll:!0,onSuccess:()=>i.success(`Custom scripts updated successfully!`),onError:()=>i.error(`Failed to save scripts.`)})},className:`space-y-6`,children:[(0,_.jsxs)(g,{className:`shadow-sm border-border/50`,children:[(0,_.jsxs)(f,{className:`bg-muted/10 border-b pb-4`,children:[(0,_.jsx)(m,{children:`Header Scripts (<head>)`}),(0,_.jsxs)(h,{children:[`Scripts added here will be rendered just before the closing `,(0,_.jsx)(`code`,{children:`</head>`}),` tag. Best for Google Analytics (GA4), Meta Pixel, custom CSS, or verification meta tags.`]})]}),(0,_.jsx)(p,{className:`pt-6`,children:(0,_.jsxs)(`div`,{className:`space-y-2`,children:[(0,_.jsx)(d,{className:`sr-only`,children:`Header Code`}),(0,_.jsx)(`textarea`,{value:t.custom_header_script,onChange:e=>v(`custom_header_script`,e.target.value),placeholder:`<!-- Paste your Header HTML/JS here -->
<script>
  // Google Analytics code...
<\/script>`,className:`w-full min-h-[250px] p-4 font-mono text-sm leading-relaxed bg-zinc-950 text-zinc-100 border border-border/50 rounded-xl focus:ring-primary focus:border-primary resize-y`,spellCheck:`false`})]})})]}),(0,_.jsxs)(g,{className:`shadow-sm border-border/50`,children:[(0,_.jsxs)(f,{className:`bg-muted/10 border-b pb-4`,children:[(0,_.jsx)(m,{children:`Footer Scripts (<body>)`}),(0,_.jsxs)(h,{children:[`Scripts added here will be rendered just before the closing `,(0,_.jsx)(`code`,{children:`</body>`}),` tag. Best for Live Chat widgets (Tawk.to, Crisp), deferred JavaScript, or heavy tracking codes to avoid slowing down page load.`]})]}),(0,_.jsx)(p,{className:`pt-6`,children:(0,_.jsxs)(`div`,{className:`space-y-2`,children:[(0,_.jsx)(d,{className:`sr-only`,children:`Footer Code`}),(0,_.jsx)(`textarea`,{value:t.custom_footer_script,onChange:e=>v(`custom_footer_script`,e.target.value),placeholder:`<!-- Paste your Footer HTML/JS here -->
<script>
  // Tawk.to Live Chat code...
<\/script>`,className:`w-full min-h-[250px] p-4 font-mono text-sm leading-relaxed bg-zinc-950 text-zinc-100 border border-border/50 rounded-xl focus:ring-primary focus:border-primary resize-y`,spellCheck:`false`})]})})]}),(0,_.jsx)(`div`,{className:`flex justify-end pt-4`,children:(0,_.jsxs)(u,{type:`submit`,disabled:b,className:`gap-2 min-w-[160px] shadow-sm`,size:`lg`,children:[b?(0,_.jsx)(s,{className:`w-5 h-5 animate-spin`}):(0,_.jsx)(c,{className:`w-5 h-5`}),b?`Saving...`:`Save Scripts`]})})]})]})]})}export{v as default};