1import"../chunks/NZTpNUN0.js";import{p as xt,l as ve,v as Je,a as t,b as wt,k as Dt,f as n,n as te,$ as Rt,d as s,c as l,i as T,g as ne,r as a,t as c,j as e,o as y,m as Re,u as Ne}from"../chunks/CswluXHk.js";import{s as E}from"../chunks/D5MUd0dc.js";import{i as re}from"../chunks/Cvwav-Rz.js";import{e as h,i as b}from"../chunks/DLuIJL9M.js";import{c as ue}from"../chunks/DCqg9Lcd.js";import{h as kt}from"../chunks/D8BbSAiO.js";import{a as Qe,s as N,b as Xe,f as lt}from"../chunks/sqsHMH9B.js";import{d as Pt,a as Fe}from"../chunks/BnZqlU5Q.js";import{C as St}from"../chunks/BWr-x8mL.js";import{B as ye}from"../chunks/CGaxensS.js";import{C as rt}from"../chunks/BFGY4aR1.js";import{C as it}from"../chunks/C3F0Z4bJ.js";import{C as ot,a as dt,b as vt}from"../chunks/DQXZ4mXD.js";import"../chunks/aH0YTA77.js";import"../chunks/CFi-xeDB.js";import{I as ct}from"../chunks/DuX34-Zw.js";import{L as Ye}from"../chunks/CMmMJQVx.js";import{R as Ct,T as At,a as nt}from"../chunks/D2cVI5NL.js";import{S as jt}from"../chunks/BatQt1sd.js";import{s as qt}from"../chunks/BZCW45ZF.js";import{T as ut}from"../chunks/BzaZcO8G.js";import{D as Ze}from"../chunks/BUbkVUbI.js";import{P as Tt}from"../chunks/Cl6Mo6Sh.js";import{M as Et}from"../chunks/NKFprwG3.js";const Ht=!0,Lt=!0,Na=Object.freeze(Object.defineProperty({__proto__:null,prerender:Ht,ssr:Lt},Symbol.toStringTag,{value:"Module"}));var Mt=n('<meta name="description" content="Free online dice roller tool. Roll virtual dice for tabletop games, D&D, board games, or any game that requires dice. Supports d4, d6, d8, d10, d12, d20, d100, and custom dice." class="svelte-19a759z"/> <meta name="keywords" content="dice roller, virtual dice, online dice, d20, dungeons and dragons, tabletop games, random dice, d&d dice" class="svelte-19a759z"/> <meta property="og:title" content="Dice Roller - Roll virtual dice online for games, D&D, and more | Promo Amp" class="svelte-19a759z"/> <meta property="og:description" content="Roll virtual dice for tabletop games, D&D, board games, or any game that requires dice. Supports all standard dice types and custom dice." class="svelte-19a759z"/> <meta property="og:type" content="website" class="svelte-19a759z"/> <meta property="og:image" content="https://img.promoamp.com/og_image.png" class="svelte-19a759z"/> <meta name="twitter:card" content="summary_large_image" class="svelte-19a759z"/> <meta name="twitter:title" content="Dice Roller - Roll virtual dice online for games, D&D, and more | Promo Amp" class="svelte-19a759z"/> <meta name="twitter:description" content="Roll virtual dice for tabletop games, D&D, board games, or any game that requires dice. Supports all standard dice types and custom dice." class="svelte-19a759z"/> <meta name="robots" content="index, follow" class="svelte-19a759z"/> <link rel="canonical" href="https://www.promoamp.com/dice-roller" class="svelte-19a759z"/>',1),Nt=n('<h2 class="text-2xl font-bold svelte-19a759z">Add Dice to Roll</h2>'),Se=n("<!> <!>",1),Ft=n('<!> <span class="text-sm font-bold svelte-19a759z"> </span>',1),Ot=n('<div class="grid grid-cols-3 sm:grid-cols-4 gap-2 svelte-19a759z"></div>'),Ut=n('<div class="text-red-500 text-sm svelte-19a759z"> </div>'),Vt=n('<div class="space-y-4 svelte-19a759z"><div class="svelte-19a759z"><!> <div class="flex items-center gap-2 svelte-19a759z"><!></div></div> <!> <!></div>'),Bt=n("<!> <!> <!>",1),Gt=n('<div class="text-gray-500 text-center py-4 svelte-19a759z">No dice selected. Choose dice above to get started.</div>'),It=n('<div class="flex items-center justify-between bg-muted p-2 rounded-md svelte-19a759z"><div class="flex items-center gap-2 svelte-19a759z"><!> <span class="svelte-19a759z"> </span></div> <div class="flex items-center gap-1 svelte-19a759z"><!> <!></div></div>'),Kt=n('<div class="space-y-2 svelte-19a759z"><!> <div class="flex justify-between mt-4 svelte-19a759z"><!> <div class="text-sm font-medium svelte-19a759z"> </div></div></div>'),Wt=n('<!> <div class="mt-6 svelte-19a759z"><h3 class="text-lg font-semibold mb-2 svelte-19a759z">Selected Dice</h3> <!></div> <div class="mt-6 space-y-4 svelte-19a759z"><div class="flex items-center justify-between svelte-19a759z"><!> <!></div> <div class="svelte-19a759z"><!> <div class="flex items-center gap-2 svelte-19a759z"><span class="text-xs svelte-19a759z">Fast</span> <!> <span class="text-xs svelte-19a759z">Slow</span></div></div></div>',1),Jt=n('<h2 class="text-2xl font-bold svelte-19a759z">Roll Results</h2>'),F=n('<div class="dot svelte-19a759z"></div>'),Qt=n('<div class="dice-container svelte-19a759z"><div class="dice svelte-19a759z"><div class="dice-face front svelte-19a759z"></div> <div class="dice-face back svelte-19a759z"></div> <div class="dice-face right svelte-19a759z"></div> <div class="dice-face left svelte-19a759z"></div> <div class="dice-face top svelte-19a759z"></div> <div class="dice-face bottom svelte-19a759z"></div></div></div>'),Xt=n('<div class="dice-box svelte-19a759z"><span class="svelte-19a759z"> </span></div>'),ft=n('<div class="svelte-19a759z"><!></div>'),Yt=n('<div><div class="dice svelte-19a759z"><div class="dice-face front svelte-19a759z"></div> <div class="dice-face back svelte-19a759z"><div class="dot svelte-19a759z" style="top: 50%; left: 50%;"></div></div> <div class="dice-face right svelte-19a759z"></div> <div class="dice-face left svelte-19a759z"></div> <div class="dice-face top svelte-19a759z"></div> <div class="dice-face bottom svelte-19a759z"></div></div></div>'),Zt=n('<div><span class="svelte-19a759z"> </span></div>'),ea=n('<div class="text-gray-400 italic svelte-19a759z">Add dice to see them here</div>'),ta=n('<div class="text-2xl font-bold animate-pulse mb-2 svelte-19a759z">Dice are rolling...</div>'),aa=n('<div class="text-sm text-gray-500 svelte-19a759z"> </div>'),sa=n('<div class="text-xl text-gray-500 mb-2 svelte-19a759z">Results will appear here</div> <!>',1),la=n('<div class="text-4xl font-bold mb-2 svelte-19a759z"> </div> <div class="text-sm text-gray-500 svelte-19a759z"> </div>',1),ra=n('<div class="dice-container svelte-19a759z" role="button" tabindex="0" title="Click to re-roll this die"><div class="dice svelte-19a759z"><div class="dice-face front svelte-19a759z"></div> <div class="dice-face back svelte-19a759z"></div> <div class="dice-face right svelte-19a759z"></div> <div class="dice-face left svelte-19a759z"></div> <div class="dice-face top svelte-19a759z"></div> <div class="dice-face bottom svelte-19a759z"></div></div></div>'),ia=n('<div role="button" tabindex="0" title="Click to re-roll this die"> </div>'),oa=n('<div class="border rounded-md p-3 svelte-19a759z"><div class="flex justify-between items-center mb-2 svelte-19a759z"><span class="font-semibold svelte-19a759z"> </span> <span class="font-bold svelte-19a759z"> </span></div> <div class="flex flex-wrap gap-2 svelte-19a759z"></div></div>'),da=n('<div class="space-y-4 svelte-19a759z"><div class="text-sm text-gray-500 mb-2 italic text-center svelte-19a759z">Tip: Click on any individual die to re-roll just that one!</div> <!></div>'),va=n("<!> ",1),ca=n('<div class="flex justify-between items-center border-b pb-1 svelte-19a759z"><div class="svelte-19a759z"><span class="text-gray-500 svelte-19a759z"> </span> <span class="ml-2 svelte-19a759z"> </span></div> <span class="font-bold svelte-19a759z"> </span></div>'),na=n('<div class="w-full mt-4 border rounded-md p-3 max-h-60 overflow-y-auto svelte-19a759z"><h3 class="font-semibold mb-2 svelte-19a759z">Roll History</h3> <div class="space-y-2 text-sm svelte-19a759z"></div></div>'),ua=n('<!> <div class="w-full mb-6 svelte-19a759z"><div class="bg-muted rounded-lg p-6 text-center mb-4 svelte-19a759z"><div class="flex flex-wrap justify-center gap-3 mb-4 svelte-19a759z"><!></div> <!></div> <!></div> <!> <!> <!>',1),fa=n(`<div class="container mx-auto py-8 px-4 mt-20 svelte-19a759z"><h1 class="text-3xl font-bold mb-6 text-center svelte-19a759z">Online Dice Roller</h1> <div class="grid grid-cols-1 lg:grid-cols-2 gap-8 svelte-19a759z"><!> <!></div>
1 <div class="mt-12 prose max-w-5xl mx-auto svelte-19a759z"><section id="about" class="mb-8 svelte-19a759z"><h3 class="text-xl font-bold mb-2 svelte-19a759z">About the Online Dice Roller</h3> <p class="svelte-19a759z">Our free online dice roller lets you roll virtual dice for tabletop 2 games, board games, role-playing games like Dungeons & Dragons, or any 3 other game that requires dice. This tool supports all standard dice 4 types (d4, d6, d8, d10, d12, d20, d100) as well as custom dice with any 5 number of sides.</p></section> <section id="features" class="mb-8 svelte-19a759z"><h3 class="text-xl font-bold mb-2 svelte-19a759z">Features</h3> <ul class="list-disc list-inside svelte-19a759z"><li class="svelte-19a759z"><b class="svelte-19a759z">Multiple Dice Types:</b> Roll any combination of standard dice (d4, 6 d6, d8, d10, d12, d20, d100).</li> <li class="svelte-19a759z"><b class="svelte-19a759z">Custom Dice:</b> Create custom dice with any number of sides from 2 7 to 1000.</li> <li class="svelte-19a759z"><b class="svelte-19a759z">Multiple Dice:</b> Roll multiple dice at once and see individual results 8 and totals.</li> <li class="svelte-19a759z"><b class="svelte-19a759z">Secure Random Values:</b> Uses the browser's Web Crypto API and rejection 9 sampling to produce each die value.</li> <li class="svelte-19a759z"><b class="svelte-19a759z">Roll History:</b> Keep track of your previous rolls.</li> <li class="svelte-19a759z"><b class="svelte-19a759z">Customizable:</b> Adjust roll animation speed and toggle sound effects.</li> <li class="svelte-19a759z"><b class="svelte-19a759z">Visual Feedback:</b> Easily identify critical hits (maximum rolls) and 10 critical fails (rolls of 1).</li> <li class="svelte-19a759z"><b class="svelte-19a759z">Animated Dice:</b> Realistic 3D animated dice for standard six-sided 11 dice.</li> <li class="svelte-19a759z"><b class="svelte-19a759z">Individual Re-rolls:</b> Click on any die to re-roll just that one without 12 affecting other dice.</li></ul></section> <section id="how-to-use" class="mb-8 svelte-19a759z"><h3 class="text-xl font-bold mb-2 svelte-19a759z">How to Use the Dice Roller</h3> <ol class="list-decimal list-inside svelte-19a759z"><li class="svelte-19a759z">Select the type of dice you want to roll from the "Standard Dice" tab.</li> <li class="svelte-19a759z">For custom dice, switch to the "Custom Dice" tab, set the number of 13 sides, and click "Add".</li> <li class="svelte-19a759z">Adjust the quantity of each dice type using the + and - buttons.</li> <li class="svelte-19a759z">Click the "Roll Dice" button to roll all selected dice.</li> <li class="svelte-19a759z">View your results in the "Roll Results" section.</li> <li class="svelte-19a759z">Use the "Show History" button to see your previous rolls.</li></ol></section> <section id="applications" class="mb-8 svelte-19a759z"><h3 class="text-xl font-bold mb-2 svelte-19a759z">Applications of the Dice Roller</h3> <ul class="list-disc list-inside svelte-19a759z"><li class="svelte-19a759z"><b class="svelte-19a759z">Tabletop RPGs:</b> Perfect for Dungeons & Dragons, Pathfinder, and other 14 role-playing games.</li> <li class="svelte-19a759z"><b class="svelte-19a759z">Board Games:</b> Use for any board game that requires dice.</li> <li class="svelte-19a759z"><b class="svelte-19a759z">Game Development:</b> Test probability distributions for game mechanics.</li> <li class="svelte-19a759z"><b class="svelte-19a759z">Education:</b> Demonstrate probability concepts in mathematics.</li> <li class="svelte-19a759z"><b class="svelte-19a759z">Decision Making:</b> Let the dice decide when you can't make up your 15 mind!</li></ul></section></div></div>`);function Fa(mt,pt){xt(pt,!0);const _t=[{name:"4-sided",sides:4,icon:"4"},{name:"6-sided",sides:6,icon:"6"},{name:"8-sided",sides:8,icon:"8"},{name:"10-sided",sides:10,icon:"10"},{name:"12-sided",sides:12,icon:"12"},{name:"20-sided",sides:20,icon:"20"},{name:"100-sided",sides:100,icon:"100"}];let x=ve(Je([{type:"d6",sides:6,quantity:2}])),K=ve(Je([])),ae=ve(!1),Ce=ve(!1),xe=ve(30),et=ve("standard"),Oe=ve(!0),Ae=ve(1e3),we=ve(null),je=ve(Je([])),qe=ve(!1);function Ue(r,O){const B=e(x).findIndex(se=>se.type===r);B>=0?(e(x)[B].quantity+=1,y(x,[...e(x)],!0)):y(x,[...e(x),{type:r,sides:O,quantity:1}],!0),y(K,[],!0)}function gt(r){e(x)[r].quantity-=1,e(x)[r].quantity<=0&&e(x).splice(r,1),y(x,[...e(x)],!0),y(K,[],!0)}function ht(){y(x,[],!0),y(K,[],!0)}function bt(){if(e(xe)<2){y(we,"Custom dice must have at least 2 sides");return}Ue(`d${e(xe)}`,e(xe)),y(we,null)}function tt(r,O,B){return qt(r,O,B)}async function zt(){if(!(e(ae)||e(x).length===0)){y(ae,!0),y(Ce,!1),y(we,null),document.querySelectorAll(".dice-container").forEach(r=>{r.classList.add("rolling")});try{const r=[];for(const $ of e(x)){const I=tt(1,$.sides,$.quantity),he=I.reduce((fe,me)=>fe+me,0);r.push({type:$.type,sides:$.sides,results:I,total:he})}y(K,r,!0);const O=r.reduce(($,I)=>$+I.total,0),B=e(x).map($=>`${$.quantity}${$.type}`).join(" + ");y(je,[{timestamp:new Date().toLocaleTimeString(),dice:B,results:r.flatMap($=>$.results),total:O},...e(je).slice(0,9)],!0),e(Oe)&&new Audio("/dice-roll.mp3").play().catch(I=>console.error("Error playing sound:",I)),r.some($=>$.type==="d20"&&$.results.includes(20))&&y(Ce,!0)}catch(r){console.error("Error rolling dice:",r),y(we,r instanceof Error?r.message:"Failed to roll dice. Please try again.",!0)}finally{setTimeout(()=>{document.querySelectorAll(".dice-container").forEach(r=>{r.classList.remove("rolling")}),y(ae,!1)},e(Ae))}}}
15function Ve(){return e(x).length===0?"No dice selected":e(x).map(r=>`${r.quantity}${r.type}`).join(" + ")}function $t(){return e(K).reduce((r,O)=>r+O.total,0)}function H(r){switch(r){case 1:return[{top:"50%",left:"50%"}];case 2:return[{top:"25%",left:"25%"},{top:"75%",left:"75%"}];case 3:return[{top:"25%",left:"25%"},{top:"50%",left:"50%"},{top:"75%",left:"75%"}];case 4:return[{top:"25%",left:"25%"},{top:"25%",left:"75%"},{top:"75%",left:"25%"},{top:"75%",left:"75%"}];case 5:return[{top:"25%",left:"25%"},{top:"25%",left:"75%"},{top:"50%",left:"50%"},{top:"75%",left:"25%"},{top:"75%",left:"75%"}];case 6:return[{top:"25%",left:"25%"},{top:"25%",left:"50%"},{top:"25%",left:"75%"},{top:"75%",left:"25%"},{top:"75%",left:"50%"},{top:"75%",left:"75%"}];default:return[]}}function Be(r){return r===6}async function Te(r,O){if(e(ae))return;const B=document.querySelector(`.dice-container[data-result="${r}"][data-die="${O}"]`);B&&B.classList.add("rolling");try{const se=e(K)[r],$=tt(1,se.sides,1)[0];se.results[O]=$,se.total=se.results.reduce((I,he)=>I+he,0),y(K,[...e(K)],!0),se.type==="d20"&&$===20&&y(Ce,!0)}catch(se){console.error("Error re-rolling die:",se)}finally{setTimeout(()=>{B&&B.classList.remove("rolling")},e(Ae))}}var Ge=fa();kt("19a759z",r=>{var O=Mt();te(20),Dt(()=>{Rt.title="Dice Roller - Roll virtual dice online for games, D&D, and more | Promo Amp"}),t(r,O)});var at=s(l(Ge),2),st=l(at);ue(st,()=>rt,(r,O)=>{O(r,{class:"shadow-sm",children:(B,se)=>{var $=Se(),I=T($);ue(I,()=>ot,(fe,me)=>{me(fe,{children:(be,Ie)=>{var ie=Se(),oe=T(ie);ue(oe,()=>dt,(W,J)=>{J(W,{children:(Q,ge)=>{var X=Nt();t(Q,X)},$$slots:{default:!0}})});var pe=s(oe,2);ue(pe,()=>vt,(W,J)=>{J(W,{children:(Q,ge)=>{te();var X=ne("Choose the dice you want to roll");t(Q,X)},$$slots:{default:!0}})}),t(be,ie)},$$slots:{default:!0}})});var he=s(I,2);ue(he,()=>it,(fe,me)=>{me(fe,{children:(be,Ie)=>{var ie=Wt(),oe=T(ie);Ct(oe,{class:"w-full",get value(){return e(et)},set value(S){y(et,S,!0)},children:(S,de)=>{var le=Bt(),ze=T(le);At(ze,{class:"grid grid-cols-2 mb-4",children:(u,z)=>{var _=Se(),d=T(_);nt(d,{value:"standard",children:(m,w)=>{te();var P=ne("Standard Dice");t(m,P)},$$slots:{default:!0}});var o=s(d,2);nt(o,{value:"custom",children:(m,w)=>{te();var P=ne("Custom Dice");t(m,P)},$$slots:{default:!0}}),t(u,_)},$$slots:{default:!0}});var $e=s(ze,2);ut($e,{value:"standard",class:"space-y-4",children:(u,z)=>{var _=Ot();h(_,21,()=>_t,b,(d,o)=>{ye(d,{variant:"outline",class:"h-16 flex flex-col items-center justify-center gap-1",onclick:()=>Ue(e(o).name,e(o).sides),children:(m,w)=>{var P=Ft(),C=T(P);Ze(C,{class:"h-5 w-5"});var j=s(C,2),D=l(j,!0);a(j),c(()=>E(D,e(o).name)),t(m,P)},$$slots:{default:!0}})}),a(_),t(u,_)},$$slots:{default:!0}});var i=s($e,2);ut(i,{value:"custom",class:"space-y-4",children:(u,z)=>{var _=Vt(),d=l(_),o=l(d);Ye(o,{for:"custom-sides",children:(D,U)=>{te();var R=ne("Number of Sides");t(D,R)},$$slots:{default:!0}});var m=s(o,2),w=l(m);ct(w,{id:"custom-sides",type:"number",min:"2",max:"1000",class:"w-full",get value(){return e(xe)},set value(D){y(xe,D,!0)}}),a(m),a(d);var P=s(d,2);ye(P,{variant:"default",class:"w-full",onclick:bt,children:(D,U)=>{te();var R=ne();c(()=>E(R,`Add d${e(xe)??""}`)),t(D,R)},$$slots:{default:!0}});var C=s(P,2);{var j=D=>{var U=Ut(),R=l(U,!0);a(U),c(()=>E(R,e(we))),t(D,U)};re(C,D=>{e(we)&&D(j)})}a(_),t(u,_)},$$slots:{default:!0}}),t(S,le)},$$slots:{default:!0}});var pe=s(oe,2),W=s(l(pe),2);{var J=S=>{var de=Gt();t(S,de)},Q=S=>{var de=Kt(),le=l(de);h(le,17,()=>e(x),b,(z,_,d)=>{var o=It(),m=l(o),w=l(m);Ze(w,{class:"h-5 w-5"});var P=s(w,2),C=l(P);a(P),a(m);var j=s(m,2),D=l(j);ye(D,{variant:"ghost",size:"sm",class:"h-8 w-8 p-0",onclick:()=>Ue(e(_).type,e(_).sides),children:(R,k)=>{Tt(R,{class:"h-4 w-4"})},$$slots:{default:!0}});var U=s(D,2);ye(U,{variant:"ghost",size:"sm",class:"h-8 w-8 p-0",onclick:()=>gt(d),children:(R,k)=>{Et(R,{class:"h-4 w-4"})},$$slots:{default:!0}}),a(j),a(o),c(()=>E(C,`${e(_).quantity??""}Ã ${e(_).type??""}`)),t(z,o)});var ze=s(le,2),$e=l(ze);ye($e,{variant:"outline",size:"sm",onclick:ht,children:(z,_)=>{te();var d=ne("Clear All");t(z,d)},$$slots:{default:!0}});var i=s($e,2),u=l(i,!0);a(i),a(ze),a(de),c(z=>E(u,z),[()=>Ve()]),t(S,de)};re(W,S=>{e(x).length===0?S(J):S(Q,-1)})}a(pe);var ge=s(pe,2),X=l(ge),Ee=l(X);Ye(Ee,{for:"roll-sound",class:"cursor-pointer",children:(S,de)=>{te();var le=ne("Roll Sound");t(S,le)},$$slots:{default:!0}});var Ke=s(Ee,2);jt(Ke,{id:"roll-sound",get checked(){return e(Oe)},set checked(S){y(Oe,S,!0)}}),a(X);var He=s(X,2),Le=l(He);Ye(Le,{for:"roll-speed",children:(S,de)=>{te();var le=ne("Roll Animation Speed");t(S,le)},$$slots:{default:!0}});var Me=s(Le,2),We=s(l(Me),2);ct(We,{id:"roll-speed",type:"number",min:500,max:2e3,step:100,class:"w-full",get value(){return e(Ae)},set value(S){y(Ae,S,!0)}}),te(2),a(Me),a(He),a(ge),t(be,ie)},$$slots:{default:!0}})}),t(B,$)},$$slots:{default:!0}})});var yt=s(st,2);ue(yt,()=>rt,(r,O)=>{O(r,{class:"shadow-sm",children:(B,se)=>{var $=Se(),I=T($);ue(I,()=>ot,(fe,me)=>{me(fe,{children:(be,Ie)=>{var ie=Se(),oe=T(ie);ue(oe,()=>dt,(W,J)=>{J(W,{children:(Q,ge)=>{var X=Jt();t(Q,X)},$$slots:{default:!0}})});var pe=s(oe,2);ue(pe,()=>vt,(W,J)=>{J(W,{children:(Q,ge)=>{te();var X=ne("Click the button below to roll your selected dice");t(Q,X)},$$slots:{default:!0}})}),t(be,ie)},$$slots:{default:!0}})});var he=s(I,2);ue(he,()=>it,(fe,me)=>{me(fe,{class:"flex flex-col items-center justify-center",children:(be,Ie)=>{var ie=ua(),oe=T(ie);{var pe=i=>{St(i,{})};re(oe,i=>{e(Ce)&&i(pe)})}var W=s(oe,2),J=l(W),Q=l(J),ge=l(Q);{var X=i=>{var u=Re(),z=T(u);{var _=o=>{var m=Re(),w=T(m);h(w,17,()=>e(K),b,(P,C)=>{var j=Re(),D=T(j);h(D,17,()=>e(C).results,b,(U,R)=>{var k=ft(),_e=l(k);{var De=G=>{var A=Qt(),q=l(A),g=l(q);h(g,21,()=>H(e(R)),b,(p,v)=>{var f=F();c(()=>N(f,`top: ${e(v).top??""}; left: ${e(v).left??""};`)),t(p,f)}),a(g);var Y=s(g,2);h(Y,21,()=>H(7-e(R)),b,(p,v)=>{var f=F();c(()=>N(f,`top: ${e(v).top??""}; left: ${e(v).left??""};`)),t(p,f)}),a(Y);var Z=s(Y,2);h(Z,21,()=>H((e(R)+1)%6+1),b,(p,v)=>{var f=F();c(()=>N(f,`top: ${e(v).top??""}; left: ${e(v).left??""};`)),t(p,f)}),a(Z);var ee=s(Z,2);h(ee,21,()=>H((e(R)+2)%6+1),b,(p,v)=>{var f=F();c(()=>N(f,`top: ${e(v).top??""}; left: ${e(v).left??""};`)),t(p,f)}),a(ee);var ce=s(ee,2);h(ce,21,()=>H((e(R)+3)%6+1),b,(p,v)=>{var f=F();c(()=>N(f,`top: ${e(v).top??""}; left: ${e(v).left??""};`)),t(p,f)}),a(ce);var V=s(ce,2);h(V,21,()=>H((e(R)+4)%6+1),b,(p,v)=>{var f=F();c(()=>N(f,`top: ${e(v).top??""}; left: ${e(v).left??""};`)),t(p,f)}),a(V),a(q),a(A),t(G,A)},ke=Ne(()=>Be(e(C).sides)&&e(R)<=6),Pe=G=>{var A=Xt(),q=l(A),g=l(q,!0);a(q),a(A),c(()=>E(g,e(R))),t(G,A)};re(_e,G=>{e(ke)?G(De):G(Pe,-1)})}a(k),t(U,k)}),t(P,j)}),t(o,m)},d=o=>{var m=Re(),w=T(m);h(w,17,()=>e(x),b,(P,C)=>{var j=Re(),D=T(j);h(D,17,()=>[...Array(e(C).quantity).keys()],b,(U,R)=>{var k=ft(),_e=l(k);{var De=G=>{var A=Yt(),q=l(A),g=l(q);h(g,21,()=>H((e(ae),6)),b,(V,p)=>{var v=F();c(()=>N(v,`top: ${e(p).top??""}; left: ${e(p).left??""};`)),t(V,v)}),a(g);var Y=s(g,4);h(Y,21,()=>H(3),b,(V,p)=>{var v=F();c(()=>N(v,`top: ${e(p).top??""}; left: ${e(p).left??""};`)),t(V,v)}),a(Y);var Z=s(Y,2);h(Z,21,()=>H(4),b,(V,p)=>{var v=F();c(()=>N(v,`top: ${e(p).top??""}; left: ${e(p).left??""};`)),t(V,v)}),a(Z);var ee=s(Z,2);h(ee,21,()=>H(2),b,(V,p)=>{var v=F();c(()=>N(v,`top: ${e(p).top??""}; left: ${e(p).left??""};`)),t(V,v)}),a(ee);var ce=s(ee,2);h(ce,21,()=>H(5),b,(V,p)=>{var v=F();c(()=>N(v,`top: ${e(p).top??""}; left: ${e(p).left??""};`)),t(V,v)}),a(ce),a(q),a(A),c(()=>Xe(A,1,lt(e(ae)?"dice-container rolling":"dice-container"),"svelte-19a759z")),t(G,A)},ke=Ne(()=>Be(e(C).sides)),Pe=G=>
15{var A=Zt(),q=l(A),g=l(q,!0);a(q),a(A),c(()=>{Xe(A,1,lt(e(ae)?"dice-box rolling":"dice-box"),"svelte-19a759z"),E(g,e(C).type)}),t(G,A)};re(_e,G=>{e(ke)?G(De):G(Pe,-1)})}a(k),c(()=>Qe(k,"aria-label",`${e(C).type} ${e(R)+1}`)),t(U,k)}),t(P,j)}),t(o,m)};re(z,o=>{e(K).length>0&&!e(ae)?o(_):o(d,-1)})}t(i,u)},Ee=i=>{var u=ea();t(i,u)};re(ge,i=>{e(x).length>0?i(X):i(Ee,-1)})}a(Q);var Ke=s(Q,2);{var He=i=>{var u=ta();t(i,u)},Le=i=>{var u=sa(),z=s(T(u),2);{var _=d=>{var o=aa(),m=l(o);a(o),c(w=>E(m,`Click "Roll Dice" to roll ${w??""}`),[()=>Ve()]),t(d,o)};re(z,d=>{e(x).length>0&&d(_)})}t(i,u)},Me=i=>{var u=la(),z=T(u),_=l(z,!0);a(z);var d=s(z,2),o=l(d,!0);a(d),c((m,w)=>{E(_,m),E(o,w)},[()=>$t(),()=>Ve()]),t(i,u)};re(Ke,i=>{e(ae)?i(He):e(K).length===0?i(Le,1):i(Me,-1)})}a(J);var We=s(J,2);{var S=i=>{var u=da(),z=s(l(u),2);h(z,17,()=>e(K),b,(_,d,o)=>{var m=oa(),w=l(m),P=l(w),C=l(P);a(P);var j=s(P,2),D=l(j);a(j),a(w);var U=s(w,2);h(U,21,()=>e(d).results,b,(R,k,_e)=>{var De=Re(),ke=T(De);{var Pe=q=>{var g=ra();Qe(g,"data-result",o),Qe(g,"data-die",_e);var Y=l(g),Z=l(Y);h(Z,21,()=>H(e(k)),b,(f,L)=>{var M=F();c(()=>N(M,`top: ${e(L).top??""}; left: ${e(L).left??""};`)),t(f,M)}),a(Z);var ee=s(Z,2);h(ee,21,()=>H(7-e(k)),b,(f,L)=>{var M=F();c(()=>N(M,`top: ${e(L).top??""}; left: ${e(L).left??""};`)),t(f,M)}),a(ee);var ce=s(ee,2);h(ce,21,()=>H((e(k)+1)%6+1),b,(f,L)=>{var M=F();c(()=>N(M,`top: ${e(L).top??""}; left: ${e(L).left??""};`)),t(f,M)}),a(ce);var V=s(ce,2);h(V,21,()=>H((e(k)+2)%6+1),b,(f,L)=>{var M=F();c(()=>N(M,`top: ${e(L).top??""}; left: ${e(L).left??""};`)),t(f,M)}),a(V);var p=s(V,2);h(p,21,()=>H((e(k)+3)%6+1),b,(f,L)=>{var M=F();c(()=>N(M,`top: ${e(L).top??""}; left: ${e(L).left??""};`)),t(f,M)}),a(p);var v=s(p,2);h(v,21,()=>H((e(k)+4)%6+1),b,(f,L)=>{var M=F();c(()=>N(M,`top: ${e(L).top??""}; left: ${e(L).left??""};`)),t(f,M)}),a(v),a(Y),a(g),Fe("click",g,()=>Te(o,_e)),Fe("keydown",g,f=>f.key==="Enter"&&Te(o,_e)),t(q,g)},G=Ne(()=>Be(e(d).sides)&&e(k)<=6),A=q=>{var g=ia();let Y;var Z=l(g,!0);a(g),c(()=>{Y=Xe(g,1,"w-10 h-10 flex items-center justify-center rounded-md border-2 font-bold text-sm cursor-pointer svelte-19a759z",null,Y,{"bg-green-100":e(k)===e(d).sides,"border-green-500":e(k)===e(d).sides,"bg-red-100":e(k)===1,"border-red-500":e(k)===1}),E(Z,e(k))}),Fe("click",g,()=>Te(o,_e)),Fe("keydown",g,ee=>ee.key==="Enter"&&Te(o,_e)),t(q,g)};re(ke,q=>{e(G)?q(Pe):q(A,-1)})}t(R,De)}),a(U),a(m),c(()=>{E(C,`${e(d).results.length??""}Ã ${e(d).type??""}`),E(D,`Total: ${e(d).total??""}`)}),t(_,m)}),a(u),t(i,u)};re(We,i=>{!e(ae)&&e(K).length>0&&i(S)})}a(W);var de=s(W,2);{let i=Ne(()=>e(ae)||e(x).length===0);ye(de,{get disabled(){return e(i)},onclick:zt,class:"flex items-center gap-2 w-full sm:w-auto px-6 py-2",children:(u,z)=>{var _=va(),d=T(_);Ze(d,{class:"h-5 w-5"});var o=s(d);c(()=>E(o,` ${e(ae)?"Rolling the dice...":"Roll Dice"}`)),t(u,_)},$$slots:{default:!0}})}var le=s(de,2);ye(le,{variant:"ghost",size:"sm",class:"mt-4",onclick:()=>y(qe,!e(qe)),children:(i,u)=>{te();var z=ne();c(()=>E(z,e(qe)?"Hide History":"Show History")),t(i,z)},$$slots:{default:!0}});var ze=s(le,2);{var $e=i=>{var u=na(),z=s(l(u),2);h(z,21,()=>e(je),b,(_,d)=>{var o=ca(),m=l(o),w=l(m),P=l(w,!0);a(w);var C=s(w,2),j=l(C);a(C),a(m);var D=s(m,2),U=l(D,!0);a(D),a(o),c(()=>{E(P,e(d).timestamp),E(j,`${e(d).dice??""}-sided`),E(U,e(d).total)}),t(_,o)}),a(z),a(u),t(i,u)};re(ze,i=>{e(qe)&&e(je).length>0&&i($e)})}t(be,ie)},$$slots:{default:!0}})}),t(B,$)},$$slots:{default:!0}})}),a(at),te(2),a(Ge),t(mt,Ge),wt()}Pt(["click","keydown"]);export{Fa as component,Na as universal}; 16//# sourceMappingURL=78.DTHA85Ru.js.map
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.