import{c as Q,o as he,h as ge,g as S,t as C,a as X,s as n,i as $,b as re,S as ue,m as Z,e as H,k as ne,l as Be,d as je,u as He,r as Te,D as Ke}from"./web.gEHESIx2.js";var Ve=C('
— ");const Ue=new Map,De=new Map;function yt(e){const t="stoic-quote",i=De.get(t)||{text:"Loading wisdom...",author:""},[o,s]=Q(i),[a,c]=Q(""),[l,m]=Q(0),x=async(h=!1)=>{const p=Date.now(),L=Ue.get(t)||0;if(!h&&p-L<1e4){console.log("[StoicQuote] Cooldown active, skipping manual refresh");return}Ue.set(t,p),console.log("[StoicQuote] Fetching quote from API...");try{const z=await fetch("https://stoic-quotes.com/api/quote");if(!z.ok)throw new Error("Failed to fetch quote");const P=await z.json(),w={text:P.text,author:P.author};console.log("[StoicQuote] ✨ New quote received:",{author:w.author,preview:w.text.substring(0,50)+"...",timestamp:new Date().toLocaleTimeString()}),s(w),c(""),De.set(t,w),m(q=>q+1),console.log("[StoicQuote] ✅ Quote state updated, render key incremented, forcing re-render")}catch(z){console.error("[StoicQuote] Error:",z),c("Failed to load quote")}};he(()=>{De.has(t)||x(!0);const h=qe(e.settings,1,"hours");console.log(`[StoicQuote] Setting up interval: ${h}ms`);const p=setInterval(()=>{console.log("[StoicQuote] Interval tick - fetching new quote"),x(!0)},h);ge(()=>{console.log("[StoicQuote] Cleaning up interval"),clearInterval(p)})});const v=()=>e.settings.showAuthor!==!1,b=()=>e.settings.fontSize||"medium",g=()=>{const h={small:{quote:"clamp(0.7rem, 1.5vw, 1.2rem)",author:"clamp(0.6rem, 1.2vw, 0.9rem)"},medium:{quote:"clamp(0.9rem, 2vw, 1.5rem)",author:"clamp(0.7rem, 1.5vw, 1.1rem)"},large:{quote:"clamp(1.1rem, 2.5vw, 2rem)",author:"clamp(0.8rem, 1.8vw, 1.3rem)"}};return h[b()]||h.medium};return(()=>{var h=S(mt),p=h.firstChild,L=p.nextSibling,z=L.nextSibling;return n(h,"border","1px solid var(--border)"),n(h,"padding","1rem"),n(h,"width","100%"),n(h,"height","100%"),n(h,"display","flex"),n(h,"background","var(--bg, #fff)"),n(h,"position","relative"),n(p,"position","absolute"),n(p,"top","0.5rem"),n(p,"left","0.5rem"),n(p,"color","var(--border, #ccc)"),n(p,"opacity","0.3"),$(L,(()=>{var P=Z(()=>!!a());return()=>P()?(()=>{var w=S(ft);return n(w,"color","var(--gray, #999)"),$(w,a),w})():[(()=>{var w=S(vt),q=w.firstChild,B=q.nextSibling,[f,d]=X(B.nextSibling);return f.nextSibling,$(w,()=>o().text,f,d),H(k=>n(w,"font-size",g().quote)),w})(),Z(()=>Z(()=>!!(v()&&o().author))()&&(()=>{var w=S(bt),q=w.firstChild,B=q.nextSibling,[f,d]=X(B.nextSibling);return n(w,"color","var(--gray, #666)"),$(w,()=>o().author,f,d),H(k=>n(w,"font-size",g().author)),w})())]})()),n(z,"position","absolute"),n(z,"bottom","8px"),n(z,"left","8px"),n(z,"color","var(--gray, #999)"),n(z,"opacity","0.5"),H(()=>ne(h,"data-render-key",l())),h})()}const xt={name:"Stoic Quote",description:"Display stoic wisdom from Marcus Aurelius, Seneca, and Epictetus",settingsSchema:{fontSize:{type:"select",label:"Font Size",options:["small","medium","large"],default:"medium"},showAuthor:{type:"boolean",label:"Show Author",default:!0},refreshIntervalValue:{type:"number",label:"Refresh Interval",default:1,required:!0},refreshIntervalUnit:{type:"select",label:"Unit",options:["seconds","minutes","hours","days"],default:"hours",required:!0}}},pt={"crypto-price":{schema:ot,Component:rt},clock:{schema:et,Component:Ze},weather:{schema:gt,Component:ht},"stoic-quote":{schema:xt,Component:yt}};function wt(e){return pt[e]}var Me={dragStart:!0},ze={delay:0,distance:3};function $t(e,t={}){let r,i,{bounds:o,axis:s="both",gpuAcceleration:a=!0,legacyTranslate:c=!1,transform:l,applyUserSelectHack:m=!0,disabled:x=!1,ignoreMultitouch:v=!1,recomputeBounds:b=Me,grid:g,threshold:h=ze,position:p,cancel:L,handle:z,defaultClass:P="neodrag",defaultClassDragging:w="neodrag-dragging",defaultClassDragged:q="neodrag-dragged",defaultPosition:B={x:0,y:0},onDragStart:f,onDrag:d,onDragEnd:k}=t,M=!1,I=!1,U=0,A=!1,E=!1,N=0,Y=0,_=0,y=0,K=0,ie=0,{x:ee,y:te}=p?{x:p?.x??0,y:p?.y??0}:B;$e(ee,te);let W,G,oe,xe,pe,Pe="",Qe=!!p;b={...Me,...b},h={...ze,...h??{}};let me=new Set;function Ae(u){M&&!I&&E&&A&&pe&&(I=!0,(function(R){Se("neodrag:start",f,R)})(u),V.add(w),m&&(Pe=we.userSelect,we.userSelect="none"))}const we=document.body.style,V=e.classList;function $e(u=N,R=Y){if(!l){if(c){let O=`${+u}px, ${+R}px`;return be(e,"transform",a?`translate3d(${O}, 0)`:`translate(${O})`)}return be(e,"translate",`${+u}px ${+R}px`)}const T=l({offsetX:u,offsetY:R,rootNode:e});Ie(T)&&be(e,"transform",T)}function Se(u,R,T){const O=(function(F){return{offsetX:N,offsetY:Y,rootNode:e,currentNode:pe,event:F}})(T);e.dispatchEvent(new CustomEvent(u,{detail:O})),R?.(O)}const fe=addEventListener,Ce=new AbortController,_e={signal:Ce.signal,capture:!1};function Fe(){let u=e.offsetWidth/G.width;return isNaN(u)&&(u=1),u}return be(e,"touch-action","none"),fe("pointerdown",(u=>{if(x||u.button===2)return;if(me.add(u.pointerId),v&&me.size>1)return u.preventDefault();if(b.dragStart&&(W=Re(o,e)),Ie(z)&&Ie(L)&&z===L)throw new Error("`handle` selector can't be same as `cancel` selector");if(V.add(P),oe=(function(D,J){if(!D)return[J];if(Le(D))return[D];if(Array.isArray(D))return D;const j=J.querySelectorAll(D);if(j===null)throw new Error("Selector passed for `handle` option should be child of the element on which the action is applied");return Array.from(j.values())})(z,e),xe=(function(D,J){if(!D)return[];if(Le(D))return[D];if(Array.isArray(D))return D;const j=J.querySelectorAll(D);if(j===null)throw new Error("Selector passed for `cancel` option should be child of the element on which the action is applied");return Array.from(j.values())})(L,e),r=/(both|x)/.test(s),i=/(both|y)/.test(s),We(xe,oe))throw new Error("Element being dragged can't be a child of the element on which `cancel` is applied");const R=u.composedPath()[0];if(!oe.some((D=>D.contains(R)||D.shadowRoot?.contains(R)))||We(xe,[R]))return;pe=oe.length===1?e:oe.find((D=>D.contains(R))),M=!0,U=Date.now(),h.delay||(A=!0),G=e.getBoundingClientRect();const{clientX:T,clientY:O}=u,F=Fe();r&&(_=T-ee/F),i&&(y=O-te/F),W&&(K=T-G.left,ie=O-G.top)}),_e),fe("pointermove",(u=>{if(!M||v&&me.size>1)return;if(!I){if(A||Date.now()-U>=h.delay&&(A=!0,Ae(u)),!E){const F=u.clientX-_,D=u.clientY-y;Math.sqrt(F**2+D**2)>=h.distance&&(E=!0,Ae(u))}if(!I)return}b.drag&&(W=Re(o,e)),u.preventDefault(),G=e.getBoundingClientRect();let R=u.clientX,T=u.clientY;const O=Fe();if(W){const F={left:W.left+K,top:W.top+ie,right:W.right+K-G.width,bottom:W.bottom+ie-G.height};R=Ne(R,F.left,F.right),T=Ne(T,F.top,F.bottom)}if(Array.isArray(g)){let[F,D]=g;if(isNaN(+F)||F<0)throw new Error("1st argument of `grid` must be a valid positive number");if(isNaN(+D)||D<0)throw new Error("2nd argument of `grid` must be a valid positive number");let J=R-_,j=T-y;[J,j]=St([F/O,D/O],J,j),R=_+J,T=y+j}r&&(N=Math.round((R-_)*O)),i&&(Y=Math.round((T-y)*O)),ee=N,te=Y,Se("neodrag",d,u),$e()}),_e),fe("pointerup",(u=>{me.delete(u.pointerId),M&&(I&&(fe("click",(R=>R.stopPropagation()),{once:!0,signal:Ce.signal,capture:!0}),b.dragEnd&&(W=Re(o,e)),V.remove(w),V.add(q),m&&(we.userSelect=Pe),Se("neodrag:end",k,u),r&&(_=N),i&&(y=Y)),M=!1,I=!1,A=!1,E=!1)}),_e),{destroy:()=>Ce.abort(),update:u=>{s=u.axis||"both",x=u.disabled??!1,v=u.ignoreMultitouch??!1,z=u.handle,o=u.bounds,b=u.recomputeBounds??Me,L=u.cancel,m=u.applyUserSelectHack??!0,g=u.grid,a=u.gpuAcceleration??!0,c=u.legacyTranslate??!1,l=u.transform,h={...ze,...u.threshold??{}};const R=V.contains(q);V.remove(P,q),P=u.defaultClass??"neodrag",w=u.defaultClassDragging??"neodrag-dragging",q=u.defaultClassDragged??"neodrag-dragged",V.add(P),R&&V.add(q),Qe&&(ee=N=u.position?.x??N,te=Y=u.position?.y??Y,$e())}}}var Ne=(e,t,r)=>Math.min(Math.max(e,t),r),Ie=e=>typeof e=="string",St=([e,t],r,i)=>{const o=(s,a)=>a===0?0:Math.ceil(s/a)*a;return[o(r,e),o(i,t)]},We=(e,t)=>e.some((r=>t.some((i=>r.contains(i)))));function Re(e,t){if(e===void 0)return;if(Le(e))return e.getBoundingClientRect();if(typeof e=="object"){const{top:i=0,left:o=0,right:s=0,bottom:a=0}=e;return{top:i,right:window.innerWidth-s,bottom:window.innerHeight-a,left:o}}if(e==="parent")return t.parentNode.getBoundingClientRect();const r=document.querySelector(e);if(r===null)throw new Error("The selector provided for bound doesn't exists in the document.");return r.getBoundingClientRect()}var be=(e,t,r)=>e.style.setProperty(t,r),Le=e=>e instanceof HTMLElement,Ct=()=>({draggable:(e,t)=>{const{update:r,destroy:i}=$t(e,t());ge(i),Be((()=>r(t())))}}),_t=C("