import{j as e}from"./jsx-runtime.D_zvdyIk.js";import{a as h}from"./friends-config.BSUHS37C.js";import{u as k}from"./useTranslation.Dg7DwAC5.js";import{r as t,R as y}from"./index.BIRwh3HZ.js";import"./site.Deo0TYgJ.js";import"./index.RTTH55m1.js";import"./utils.D6Ui05B2.js";import"./site-config.CgQ_bxrG.js";import"./index.3whys8t3.js";import"./_commonjsHelpers.CqkleIqs.js";const w=()=>{},v=typeof window>"u"?t.useEffect:y.useInsertionEffect||t.useLayoutEffect;function j(r){const a=t.useRef(N);return v(()=>{a.current=r},[r]),t.useCallback(function(){for(var l=arguments.length,c=Array(l),n=0;n<l;n++)c[n]=arguments[n];return(0,a.current)(...c)},[])}function N(){throw Error("foxact: the stablized handler cannot be invoked before the component has mounted.")}const C=t.useCallback,p=C;class F extends Error{constructor(a){super(a),this.name="UseClipboardError"}}function z(){let{timeout:r=1e3,usePromptAsFallback:a=!1,promptFallbackText:l="Failed to copy to clipboard automatically, please manually copy the text below.",onCopyError:c}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const[n,d]=t.useState(null),[x,s]=t.useState(!1),o=t.useRef(null),g=j(c||w),f=p(i=>{o.current&&clearTimeout(o.current),i&&(o.current=window.setTimeout(()=>s(!1),r)),s(i)},[r]),u=p(i=>{d(i),g(i)},[g]);return{copy:p(async i=>{try{if("clipboard"in navigator)await navigator.clipboard.writeText(i),f(!0);else throw new F("[foxact/use-clipboard] navigator.clipboard is not supported")}catch(b){if(a)try{window.prompt(l,i)}catch(m){u(m)}else u(b)}},[f,l,u,a]),reset:p(()=>{s(!1),d(null),o.current&&clearTimeout(o.current)},[]),error:n,copied:x}}function E({className:r}){return e.jsx("svg",{className:r,viewBox:"0 0 512 512",fill:"currentColor","aria-hidden":"true",children:e.jsxs("g",{children:[e.jsx("path",{fill:"currentColor",d:`M330.555,101.873c0-34.164-13.767-65.108-36.047-87.622c-2.432-2.465-9.63-4.349-14.212,3.466
		c-4.589,7.808-17.205,27.431-17.205,27.431c-1.534,2.438-4.219,3.918-7.089,3.918c-2.883,0-5.555-1.48-7.089-3.918
		c0,0-12.623-19.623-17.205-27.431c-4.582-7.815-11.781-5.931-14.219-3.466c-22.274,22.514-36.04,53.458-36.04,87.622
		c0,51.02,30.663,94.847,74.553,114.142C299.892,196.72,330.555,152.892,330.555,101.873z`}),e.jsx("path",{fill:"currentColor",d:`M204.51,253.425c-4.78-47.705-36.998-90.409-85.518-106.176c-32.492-10.554-66.177-7.027-94.47,7.205
		c-3.096,1.555-7.117,7.822-1.096,14.589c6.007,6.774,20.766,24.842,20.766,24.842c1.849,2.212,2.432,5.22,1.542,7.952
		c-0.891,2.74-3.13,4.829-5.918,5.528c0,0-22.562,5.945-31.404,7.89c-8.849,1.945-9.281,9.37-7.692,12.445
		c14.527,28.144,39.698,50.801,72.197,61.362C121.436,304.828,172.6,289.212,204.51,253.425z`}),e.jsx("path",{fill:"currentColor",d:`M96.772,362.484c-20.082,27.643-27.136,60.766-22.342,92.074c0.527,3.424,5.233,9.178,13.527,5.554
		c8.308-3.63,30.054-12.088,30.054-12.088c2.672-1.062,5.698-0.692,8.041,1c2.329,1.692,3.623,4.466,3.418,7.335
		c0,0-1.308,23.294-2.199,32.315c-0.883,9.006,6.048,11.712,9.466,11.15c31.252-5.116,60.581-22.054,80.662-49.704
		c29.993-41.266,30.944-94.758,6.781-136.155C177.332,303.773,126.758,321.204,96.772,362.484z`}),e.jsx("path",{fill:"currentColor",d:`M287.824,313.964c-24.165,41.397-23.212,94.888,6.78,136.155c20.082,27.65,49.41,44.588,80.663,49.704
		c3.418,0.562,10.349-2.144,9.466-11.15c-0.89-9.021-2.205-32.315-2.205-32.315c-0.198-2.869,1.102-5.643,3.431-7.335
		c2.322-1.692,5.363-2.062,8.034-1c0,0,21.746,8.458,30.047,12.088c8.294,3.623,13.007-2.13,13.534-5.554
		c4.787-31.308-2.254-64.43-22.342-92.074C385.246,321.204,334.672,303.766,287.824,313.964z`}),e.jsx("path",{fill:"currentColor",d:`M503.6,215.254c-8.849-1.945-31.41-7.89-31.41-7.89c-2.795-0.706-5.027-2.788-5.918-5.528
		c-0.89-2.732-0.308-5.74,1.534-7.952c0,0,14.76-18.068,20.78-24.842c6.014-6.766,1.993-13.034-1.096-14.589
		c-28.301-14.232-61.978-17.76-94.485-7.205c-48.519,15.767-80.731,58.472-85.512,106.176
		c31.91,35.787,83.067,51.403,131.593,35.636c32.492-10.561,57.67-33.218,72.191-61.362
		C512.867,224.624,512.449,217.199,503.6,215.254z`})]})})}function I(){const{t:r}=k(),[a,l]=t.useState({site:"",owner:"",url:"",desc:"",image:"",color:"#ffc0cb"}),{copied:c,copy:n}=z({timeout:2e3}),d=t.useCallback(()=>`site: ${a.site||r("friends.sitePlaceholder")}
url: ${a.url||"https://example.com"}
owner: ${a.owner||r("friends.ownerPlaceholder")}
desc: ${a.desc||r("friends.descPlaceholder")}
image: ${a.image||"https://example.com/avatar.jpg"}
color: "${a.color||"#ffc0cb"}"`,[a,r]),x=t.useCallback(()=>{const o=d();n(o)},[n,d]),s=t.useCallback(o=>{const{name:g,value:f}=o.target;l(u=>({...u,[g]:f}))},[]);return e.jsx("div",{className:"mb-4 w-full",children:e.jsxs("div",{className:"relative overflow-hidden rounded-3xl border-2 border-gray-100 bg-white p-6 shadow-sm md:p-3 dark:border-gray-800 dark:bg-gray-900",children:[e.jsx("div",{className:"absolute -top-6 -right-6 h-24 w-24 rounded-full bg-pink-100/50 dark:bg-pink-900/20"}),e.jsx("div",{className:"absolute -bottom-6 -left-6 h-24 w-24 rounded-full bg-blue-100/50 dark:bg-blue-900/20"}),e.jsxs("div",{className:"grid grid-cols-2 gap-12 md:grid-cols-1 md:gap-8",children:[e.jsxs("div",{className:"relative z-10",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("h2",{className:"mb-2 flex items-center gap-2 font-black text-2xl text-gray-800 dark:text-white",children:[e.jsx(E,{className:"size-6 animate-spin text-[#FFC0CB] duration-10000"}),r("friends.applyTitle")]}),e.jsx("p",{className:"font-medium text-gray-500 text-sm dark:text-gray-400",children:h.applyDesc})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"group relative",children:[e.jsx("label",{htmlFor:"friend-site",className:"mb-1.5 block font-bold text-gray-400 text-xs uppercase tracking-wide",children:r("friends.siteName")}),e.jsx("input",{id:"friend-site",type:"text",name:"site",value:a.site,onChange:s,className:"w-full rounded-xl border-2 border-gray-100 bg-gray-50/50 px-4 py-2.5 font-bold text-gray-700 text-sm transition-all focus:border-pink-300 focus:bg-white focus:outline-none focus:ring-4 focus:ring-pink-100 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-200 dark:focus:border-pink-700 dark:focus:bg-gray-800 dark:focus:ring-pink-900/30",placeholder:r("friends.sitePlaceholder")})]}),e.jsxs("div",{className:"group relative",children:[e.jsx("label",{htmlFor:"friend-owner",className:"mb-1.5 block font-bold text-gray-400 text-xs uppercase tracking-wide",children:r("friends.ownerName")}),e.jsx("input",{id:"friend-owner",type:"text",name:"owner",value:a.owner,onChange:s,className:"w-full rounded-xl border-2 border-gray-100 bg-gray-50/50 px-4 py-2.5 font-bold text-gray-700 text-sm transition-all focus:border-pink-300 focus:bg-white focus:outline-none focus:ring-4 focus:ring-pink-100 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-200 dark:focus:border-pink-700 dark:focus:bg-gray-800 dark:focus:ring-pink-900/30",placeholder:r("friends.ownerPlaceholder")})]})]}),e.jsxs("div",{className:"group relative",children:[e.jsx("label",{htmlFor:"friend-url",className:"mb-1.5 block font-bold text-gray-400 text-xs uppercase tracking-wide",children:r("friends.siteUrl")}),e.jsx("input",{id:"friend-url",type:"url",name:"url",value:a.url,onChange:s,className:"w-full rounded-xl border-2 border-gray-100 bg-gray-50/50 px-4 py-2.5 font-bold text-gray-700 text-sm transition-all focus:border-pink-300 focus:bg-white focus:outline-none focus:ring-4 focus:ring-pink-100 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-200 dark:focus:border-pink-700 dark:focus:bg-gray-800 dark:focus:ring-pink-900/30",placeholder:"https://your-site.com"})]}),e.jsxs("div",{className:"group relative",children:[e.jsx("label",{htmlFor:"friend-desc",className:"mb-1.5 block font-bold text-gray-400 text-xs uppercase tracking-wide",children:r("friends.siteDesc")}),e.jsx("textarea",{id:"friend-desc",name:"desc",value:a.desc,onChange:s,rows:2,className:"w-full resize-none rounded-xl border-2 border-gray-100 bg-gray-50/50 px-4 py-2.5 font-bold text-gray-700 text-sm transition-all focus:border-pink-300 focus:bg-white focus:outline-none focus:ring-4 focus:ring-pink-100 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-200 dark:focus:border-pink-700 dark:focus:bg-gray-800 dark:focus:ring-pink-900/30",placeholder:r("friends.descPlaceholder")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"group relative",children:[e.jsx("label",{htmlFor:"friend-image",className:"mb-1.5 block font-bold text-gray-400 text-xs uppercase tracking-wide",children:r("friends.avatarUrl")}),e.jsx("input",{id:"friend-image",type:"url",name:"image",value:a.image,onChange:s,className:"w-full rounded-xl border-2 border-gray-100 bg-gray-50/50 px-4 py-2.5 font-bold text-gray-700 text-sm transition-all focus:border-pink-300 focus:bg-white focus:outline-none focus:ring-4 focus:ring-pink-100 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-200 dark:focus:border-pink-700 dark:focus:bg-gray-800 dark:focus:ring-pink-900/30",placeholder:"https://..."})]}),e.jsxs("div",{className:"group relative",children:[e.jsx("label",{htmlFor:"friend-color",className:"mb-1.5 block font-bold text-gray-400 text-xs uppercase tracking-wide",children:r("friends.themeColor")}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"relative h-10 w-10 overflow-hidden rounded-xl border-2 border-gray-100 shadow-sm transition-transform hover:scale-105 dark:border-gray-700",children:e.jsx("input",{id:"friend-color",type:"color",name:"color",value:a.color,onChange:s,className:"absolute -top-1/2 -left-1/2 h-[200%] w-[200%] cursor-pointer p-0"})}),e.jsx("input",{type:"text",value:a.color,onChange:o=>l({...a,color:o.target.value}),className:"flex-1 rounded-xl border-2 border-gray-100 bg-gray-50/50 px-4 py-2.5 font-bold text-gray-700 text-sm transition-all focus:border-pink-300 focus:bg-white focus:outline-none focus:ring-4 focus:ring-pink-100 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-200 dark:focus:border-pink-700 dark:focus:bg-gray-800 dark:focus:ring-pink-900/30"})]})]})]})]})]}),e.jsxs("div",{className:"relative flex flex-col justify-center rounded-xl bg-gray-50 p-6 md:p-3 dark:bg-gray-800/50",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h3",{className:"font-bold text-xl uppercase tracking-wider",children:r("friends.previewTitle")}),e.jsxs("button",{type:"button",onClick:x,className:"group relative px-3 py-2 font-bold text-base transition-transform hover:-translate-y-1 dark:text-white",children:[e.jsx("div",{className:"absolute inset-0 rotate-[1deg] rounded-lg border-2 border-foreground border-dashed transition-all group-hover:rotate-0 dark:border-white"}),r(c?"friends.copiedConfig":"friends.copyConfig")]})]}),e.jsx("div",{className:"relative flex-1 overflow-hidden rounded-xl border-2 border-gray-100 bg-white p-4 dark:border-gray-700 dark:bg-gray-950/50",children:e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-gray-600 text-xs leading-relaxed dark:text-gray-300",children:d()})}),e.jsx("div",{className:"mt-6 flex items-center gap-3 rounded-xl bg-pink-50 p-4 font-medium text-pink-600 text-xs dark:bg-pink-900/20 dark:text-pink-300",children:r("friends.hint")})]})]})]})})}export{I as default};
