import{v as h,n as g,j as u,r as m,A as x,a as v,b,R as w,c as y}from"./vendor.f00eef6e.js";const N=function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))s(e);new MutationObserver(e=>{for(const t of e)if(t.type==="childList")for(const n of t.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&s(n)}).observe(document,{childList:!0,subtree:!0});function o(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerpolicy&&(t.referrerPolicy=e.referrerpolicy),e.crossorigin==="use-credentials"?t.credentials="include":e.crossorigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function s(e){if(e.ep)return;e.ep=!0;const t=o(e);fetch(e.href,t)}};N();function k(d={}){const{immediate:a=!1,onNeedRefresh:o,onOfflineReady:s,onRegistered:e,onRegisterError:t}=d;let n,l;const f=async(i=!0)=>{i&&(n==null||n.addEventListener("controlling",p=>{p.isUpdate&&window.location.reload()})),l&&l.waiting&&await g(l.waiting,{type:"SKIP_WAITING"})};if("serviceWorker"in navigator){n=new h("/service-worker.js",{scope:"/",type:"classic"}),n.addEventListener("activated",i=>{i.isUpdate||s==null||s()});{const i=()=>{o==null||o()};n.addEventListener("waiting",i),n.addEventListener("externalwaiting",i)}n.register({immediate:a}).then(i=>{l=i,e==null||e(i)}).catch(i=>{t==null||t(i)})}return f}k();const r=u.exports.jsx,c=u.exports.jsxs,L=u.exports.Fragment;function j(){const[d,a]=m.exports.useState({id:0,quote:"Loading..."}),o=async()=>{b.get("https://muskapi.herokuapp.com/api/random").then(s=>{const t=s.data.message;a({id:t.id,quote:t.quote})}).catch(s=>{console.error(s)})};return m.exports.useEffect(()=>{o()},[]),r(L,{children:c("div",{className:" max-w-lg  mx-auto mt-3      h-auto",children:[c("div",{className:"  py-5",children:[r("div",{className:"text-center text-4xl",children:"MuskAPI \u{1F680}"}),r("div",{"data-prefix":"$",className:"text-lg text-center",children:"A hand curated quotes from Elon Musk."})]}),c("div",{className:"mb-2 max-w-lg mx-auto mt-3 flex  justify-between",children:[c("div",{className:"btn mr-2 ",children:[r(x,{size:24,className:" pr-2"}),r("a",{href:`http://twitter.com/home?status=${d.quote}`,target:"_blank",children:"Twitter"})]}),c("div",{className:"btn ",children:[r(v,{size:24,className:" pr-2"}),r("a",{href:`https://muskapi.herokuapp.com/api/quote/${d.id}`,target:"_blank",children:"Link"})]})]}),r("div",{className:"card max-w-lg mx-3 sm:mx-auto  rounded-none     lg:card-side bg-accent text-accent-content ",children:c("div",{className:"card-body p-3 md:p-8 bg-secondary",children:[c("div",{className:" relative  p-8 bg-secondary-focus   ",children:[r("p",{className:"   text-sm md:text-lg",children:d.quote}),r("span",{className:" text-lg absolute bottom-2 right-2",children:"- Elon Musk"})]}),r("div",{className:"justify-center card-actions",children:r("button",{className:"btn btn-primary",onClick:o,children:"Get a new quote"})})]})}),r("footer",{className:"p-4 max-w-lg    mx-3 md:mx-auto  bg-base-300 text-base-content footer-center",children:r("div",{children:r("p",{children:"Made with \u{1F497} by hinzwifi"})})})]})})}w.render(r(y.StrictMode,{children:r(j,{})}),document.getElementById("root"));
