tweakit 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/tweaks/{bezier-KSA2VTVT.js → bezier-W6K7LDKM.js} +1 -1
  2. package/dist/tweaks/{chunk-HWQKSB7T.js → chunk-36FYZSWP.js} +1 -1
  3. package/dist/tweaks/chunk-R7BLRFON.js +1 -0
  4. package/dist/tweaks/{chunk-SIIHIBXV.js → chunk-X5DD246E.js} +1 -1
  5. package/dist/tweaks/clip-7ZYA76G4.js +1 -0
  6. package/dist/tweaks/colour-5W24RKYH.js +1 -0
  7. package/dist/tweaks/core.js +1 -1
  8. package/dist/tweaks/fold-EIXF4KHZ.js +1 -0
  9. package/dist/tweaks/{gradient-AHHDJIIU.js → gradient-7UHCGHF2.js} +1 -1
  10. package/dist/tweaks/{heavy-ZZA3NS5O.js → heavy-O4TB6NMH.js} +1 -1
  11. package/dist/tweaks/{image-ZSAP6BIK.js → image-XHCPC5OK.js} +1 -1
  12. package/dist/tweaks/interval-D6SSAQB4.js +1 -0
  13. package/dist/tweaks/{monitor-5CFBIGGT.js → monitor-ZDLYLKC4.js} +1 -1
  14. package/dist/tweaks/motion-AAMZUKLO.js +1 -0
  15. package/dist/tweaks/{plot-KQGIWQHO.js → plot-Z2PJJQOR.js} +2 -2
  16. package/dist/tweaks/{point-4J4HHM2Z.js → point-44JV524M.js} +1 -1
  17. package/dist/tweaks/shadow-PMJG5SZY.js +1 -0
  18. package/dist/tweaks/{sides-EI7BN5Q6.js → sides-JITGW2AD.js} +1 -1
  19. package/dist/tweaks/{spring-JGHWZBNF.js → spring-CGJCZJ6Q.js} +1 -1
  20. package/dist/tweaks/tabs-U5XC6JHJ.js +1 -0
  21. package/dist/tweaks.css +1 -1
  22. package/dist/tweaks.js +3 -3
  23. package/dist/types/tweaks/easing.d.ts +8 -19
  24. package/dist/types/tweaks/enhance.d.ts +1 -0
  25. package/dist/types/tweaks/panel.d.ts +21 -1
  26. package/dist/types/tweaks/schema.d.ts +78 -0
  27. package/dist/types/tweaks/standalone.d.ts +2 -0
  28. package/dist/types/tweaks/types.d.ts +1 -1
  29. package/package.json +1 -1
  30. package/dist/tweaks/chunk-WWCMYF2Q.js +0 -1
  31. package/dist/tweaks/colour-L2QYS74L.js +0 -1
  32. package/dist/tweaks/interval-4KQVZGAX.js +0 -1
  33. package/dist/tweaks/motion-5UMJIBOJ.js +0 -1
  34. package/dist/tweaks/shadow-RAXIV6FG.js +0 -1
  35. package/dist/tweaks/tabs-RM7NR6CO.js +0 -1
package/dist/tweaks.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /* tweakit — MIT © Ryan Kiley. Toolbar and control icons from Hugeicons (MIT); see THIRD-PARTY-NOTICES.md in the tweakit package. */
2
- var Vo=Object.assign(Object.create(null),{ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]}),rn=t=>Math.min(1,Math.max(0,t)),Xn=15;function sn(t){if(typeof t!="string")return null;let e=t.trim().toLowerCase();if(Vo[e])return Vo[e];let n=/^cubic-bezier\(([^()]*)\)$/.exec(e);if(!n)return null;let o=n[1].split(",").map(r=>r.trim()?Number(r):NaN);return o.length!==4||!o.every(Number.isFinite)?null:[rn(o[0]),o[1],rn(o[2]),o[3]]}var zn=t=>sn(t)?t.trim().toLowerCase():"linear";function Go(t){let e=[];for(let n=0;n<=Xn;n++){let o=n/Xn,r=1-o,s=3*r*r*o,i=3*r*o*o,a=o*o*o;e.push([s*t[0]+i*t[2]+a,rn(s*t[1]+i*t[3]+a)])}return e}function Xo(t,e){if(e=rn(e),!t)return e;let n=Go(t);for(let o=1;o<n.length;o++)if(e<=n[o][0]){let[r,s]=n[o-1],[i,a]=n[o];return i>r?s+(a-s)*(e-r)/(i-r):a}return 1}var Gn=t=>+(t*100).toFixed(2);function Kn(t){let e=[...t.stops].sort((a,l)=>a.pos-l.pos),n=a=>`${a.color} ${Gn(a.pos)}%`,o=sn(t.easing);if(!o||e.length<2)return e.map(n).join(", ");let r=Go(o),s=t.interpolation||"oklch",i=[n(e[0])];for(let a=1;a<e.length;a++){let l=e[a-1],h=e[a],c=h.pos-l.pos;if(c>1e-6)for(let u=1;u<Xn;u++){let[d,O]=r[u];i.push(`color-mix(in ${s}, ${l.color}, ${h.color} ${Gn(O)}%) ${Gn(l.pos+c*d)}%`)}i.push(n(h))}return i.join(", ")}function an(t,e="to right"){return`linear-gradient(in ${t.interpolation||"oklch"} ${typeof e=="number"?`${e}deg`:e}, ${Kn(t)})`}var ln=t=>t.replace(/([a-z])(?=[A-Z])|([A-Z\d])(?=[A-Z][a-z])/g,"$1$2 ").replace(/^./,e=>e.toUpperCase()).trim(),R=(t,e,n)=>Math.min(n,Math.max(e,t)),Ko=t=>typeof t=="string"&&(/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t.trim())||/^(oklch|oklab|rgba?|hsla?|hwb|lab|lch|color)\(/i.test(t.trim())),zo=20,ne=t=>{let e=String(t),n=/e-(\d+)$/i.exec(e);if(n)return Math.min(zo,Number(n[1])+(e.split("e")[0].split(".")[1]||"").length);let o=e.indexOf(".");return o===-1?0:Math.min(zo,e.length-o-1)},ve=(t,e,n)=>{if(!(n>0))return t;let o=ne(n),r=Number((+e).toFixed(o)),s=Math.round((t-r)/n);return Number.isFinite(s)?Number((r+s*n).toFixed(o)):t},Se=(t,e,n,o=t)=>{let r=a=>ve(a,o,n),s=Number.isFinite(t)?r(t):-1/0,i=Number.isFinite(e)?r(e):1/0;return s<t&&(s=r(s+n)),i>e&&(i=r(i-n)),s>i?[t,t]:[s,i]},Ae=(t,e)=>{let n=e-t;return n<=1?.01:n<=10?.1:n<=100?1:10},cn=(t,e,n,o=0,r=null)=>{let s=+t,i=+e,a=+n;if(Number.isFinite(s)||(s=o),Number.isFinite(i)||(i=r??s+100),i<s){let l=s;s=i,i=l}return(!(a>0)||a>i-s)&&(a=Ae(s,i)),{min:s,max:i,step:a}},pe=(t,e,n,o,r,s=null)=>{let i=t.shiftKey?10:1;switch(t.key){case"ArrowRight":case"ArrowUp":return e+n*i;case"ArrowLeft":case"ArrowDown":return e-n*i;case"PageUp":return s!=null?e+s:null;case"PageDown":return s!=null?e-s:null;case"Home":return o;case"End":return r}return null},un=(t,e,n,o,r=0)=>{let s=t.offsetLeft,i=s+t.offsetWidth,a=e.offsetLeft,l=a+e.offsetWidth;return n<i&&n+o>s||n<l+r&&n+o>a-r},oe=t=>t>=0?[0,t<=1?1:t*3||100]:[t>=-1?-1:t*3,0],re=t=>t==null?void 0:typeof t=="object"?t.value:t,ze=t=>{try{return JSON.stringify(t)}catch{return String(t)}},Wn=t=>t==null?"":typeof t=="string"?ln(t):typeof t=="object"?t.label??(t.value!==void 0?String(t.value):ze(t)):String(t),w=(t,e,n)=>{let o=document.createElement(t);return e&&(o.className=e),n!=null&&(o.innerHTML=n),o},yt=(t,e)=>{let n=w("button",t,e);return n.type="button",n},tt=(t,e,n)=>{let o=w(t,e);return o.textContent=n,t==="button"&&(o.type="button"),o},Un=t=>["pointerdown","pointermove","pointerup"].forEach(e=>t.addEventListener(e,n=>n.stopPropagation())),Ht=t=>{requestAnimationFrame(t),document.fonts&&document.fonts.ready&&document.fonts.ready.then(t)},jt=(t,e,n)=>{let o=t.isConnected;o||requestAnimationFrame(()=>{t.isConnected&&(o=!0)});let r=i=>{if(!t.isConnected){(o||t.closest("[data-tw-destroyed]"))&&s();return}o=!0,n(i)},s=()=>e.forEach(([i,a])=>i.removeEventListener(a,r));return e.forEach(([i,a])=>i.addEventListener(a,r)),s},Jn=()=>requestAnimationFrame(()=>window.dispatchEvent(new Event("tw-reflow"))),dn=(t,e)=>{t.addEventListener("pointerenter",()=>{t.classList.add("is-hover"),e&&e()}),t.addEventListener("pointerleave",()=>t.classList.remove("is-hover"))},Xe=!1;typeof document<"u"&&(document.addEventListener("pointerdown",()=>{Xe=!0},!0),document.addEventListener("keydown",()=>{Xe=!1},!0));var Xt=t=>{t.addEventListener("focus",()=>t.classList.toggle("tw-focus-quiet",Xe)),t.addEventListener("blur",()=>t.classList.remove("tw-focus-quiet"))},Zn=(t,e,{width:n,fallbackH:o=300,gap:r=6,align:s="start",prefer:i="below"}={})=>{let a=t.getBoundingClientRect();n==="match"&&(e.style.width=a.width+"px");let l=n==="match"?a.width:e.offsetWidth||n||0,h=s==="end"?a.right-l:s==="center"?a.left+a.width/2-l/2:a.left;e.style.left=Math.max(8,Math.min(h,window.innerWidth-l-8))+"px";let c=e.offsetHeight||o,u=window.innerHeight-a.bottom,d=a.top,O=c+12,L=u>=O,b=d>=O,f=(i==="above"?b||!L&&d>=u:!L&&(b||d>u))?a.top-c-r:a.bottom+r;e.style.top=R(f,r,window.innerHeight-c-r)+"px"},ks=Object.assign(Object.create(null),{accent:"--tw-accent",onAccent:"--tw-on-accent",base:"--tw-base",dropdownBg:"--tw-dropdown-bg",surface:"--tw-surface",surfaceHover:"--tw-surface-hover",surfaceActive:"--tw-surface-active",border:"--tw-border",borderHover:"--tw-border-hover",selection:"--tw-selection",title:"--tw-text-root",section:"--tw-text-section",text:"--tw-text-primary",label:"--tw-text-label",textMuted:"--tw-text-secondary",textFaint:"--tw-text-tertiary",focus:"--tw-text-focus",success:"--tw-success",danger:"--tw-danger",shadow:"--tw-shadow-dropdown",shadowPanel:"--tw-shadow-panel",shadowPanelLifted:"--tw-shadow-panel-lifted",font:"--tw-font-sans",fontMono:"--tw-font-mono",radius:"--tw-radius",density:"--tw-row-height",width:"--tw-width"}),Cs=new Set(["radius","density","width"]),qn=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),Ls=t=>{t=String(t).trim();let e=/^#([0-9a-f]{3})$/i.exec(t);if(e)return e[1].split("").map(n=>parseInt(n+n,16));if(e=/^#([0-9a-f]{6})$/i.exec(t),e)return[0,2,4].map(n=>parseInt(e[1].slice(n,n+2),16));if(e=/^rgba?\(([^)]+)\)/i.exec(t),e){let n=e[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);return[n[0],n[1],n[2]]}return null},Ss=t=>{let e=Ls(t);if(!e||e.some(o=>!Number.isFinite(o)))return"#ffffff";let n=.2126*qn(e[0])+.7152*qn(e[1])+.0722*qn(e[2]);return 1.05/(n+.05)>=(n+.05)/.0571?"#ffffff":"#161616"},Qn=t=>{if(!t||typeof t!="object")return null;let e={};for(let[n,o]of Object.entries(t)){if(n.startsWith("--")){e[n]=String(o);continue}let r=ks[n];r&&(e[r]=Cs.has(n)&&typeof o=="number"?`${o}px`:String(o))}return e["--tw-accent"]&&!e["--tw-on-accent"]&&(e["--tw-on-accent"]=Ss(e["--tw-accent"])),Object.keys(e).length?e:null},pn=(t,e)=>{if(t){if(t._twAppliedVars)for(let n of t._twAppliedVars)t.style.removeProperty(n);if(t._twAppliedVars=e?Object.keys(e):null,e)for(let n in e)t.style.setProperty(n,e[n])}},to=(t,e)=>{let n=e?.closest('[data-tw-scheme="light"]')?"light":e?.closest('[data-tw-scheme="dark"]')?"dark":null;n?t.setAttribute("data-tw-scheme",n):t.removeAttribute("data-tw-scheme")},ye=(t,e)=>{pn(t,e?.closest(".tw-panel")?._twTheme),to(t,e)},de=null,Yn=null,qo=t=>{de&&(!t||t.contains(Yn))&&de()};function Bt(t,e,n,o={}){let r=!1,s=null;n.classList.add("tw-portal"),n.inert=!0,n.addEventListener("pointerdown",C=>e.closest(".tw-panel")?._twEditPointer?.(C),!0),Un(n);let i=0,a=0,l=()=>{Zn(e,n,{width:o.width,fallbackH:o.fallbackH,gap:o.gap,align:o.align});let C=e.getBoundingClientRect();i=parseFloat(n.style.left)-C.left,a=parseFloat(n.style.top)-C.top},h=()=>{if(r){if(!t.isConnected)return E();l(),o.onReflow&&o.onReflow()}},c=()=>{if(!r)return;if(!t.isConnected)return E();let C=e.getBoundingClientRect();if(!(C.width||C.height)||C.bottom<0||C.top>window.innerHeight||C.right<0||C.left>window.innerWidth)return E();n.style.left=C.left+i+"px",n.style.top=C.top+a+"px"},u=C=>{!t.contains(C.target)&&!n.contains(C.target)&&E()},d=C=>{C.key==="Escape"&&r&&(E(),e.focus())},O=C=>{if(!r)return;let B=C.relatedTarget;(B?t.contains(B)||n.contains(B):Xe)||(E(),B&&!e.closest(".tw-panel")?.contains(B)&&setTimeout(()=>{!r&&document.activeElement===B&&e.focus()},0))};t.addEventListener("focusout",O),n.addEventListener("focusout",O);let L=()=>n.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'),b=()=>ye(n,t),m=C=>{C.every(B=>B.target===n)||b()},f=()=>{de&&de!==E&&de(),de=E,Yn=e,r=!0,t.classList.add("is-open"),e.setAttribute("aria-expanded","true"),n.inert=!1,document.body.appendChild(n),ye(n,t),window.addEventListener("tw-retheme",b),typeof MutationObserver=="function"&&(s=new MutationObserver(m),s.observe(document.documentElement,{subtree:!0,attributes:!0,attributeFilter:["data-tw-scheme"]})),l(),requestAnimationFrame(()=>{if(r&&(n.classList.add("is-open"),o.onOpen&&o.onOpen(),l(),!n.contains(document.activeElement))){let C=o.initialFocus&&o.initialFocus()||L();C&&C.focus({focusVisible:!Xe})}}),requestAnimationFrame(function C(){if(r){if(!t.isConnected)return E();requestAnimationFrame(C)}}),setTimeout(()=>{r&&document.addEventListener("pointerdown",u,!0)},0),document.addEventListener("keydown",d),window.addEventListener("scroll",c,!0),window.addEventListener("resize",h)},E=()=>{de===E&&(de=null,Yn=null),n.contains(document.activeElement)&&e.focus(),r=!1,t.classList.remove("is-open"),n.classList.remove("is-open"),n.inert=!0,e.setAttribute("aria-expanded","false"),document.removeEventListener("pointerdown",u,!0),document.removeEventListener("keydown",d),window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",h),window.removeEventListener("tw-retheme",b),s&&(s.disconnect(),s=null),setTimeout(()=>{r||n.remove()},200)};return e.addEventListener("click",()=>{e.disabled||(r?E():f())}),{open:f,close:E,isOpen:()=>r,reflow:h}}var fn=(t,e)=>{if(t=t.toLowerCase(),t.includes(e))return!0;if(e.length<3)return!1;let n=e.length,o=t.length,r=new Array(o+1).fill(0);for(let s=1;s<=n;s++){let i=[s];for(let a=1;a<=o;a++)i[a]=Math.min(r[a]+1,i[a-1]+1,r[a-1]+(e[s-1]===t[a-1]?0:1));r=i}return Math.min(...r)<=(e.length<6?1:2)},fe=typeof matchMedia=="function"?matchMedia("(prefers-reduced-motion: reduce)"):{matches:!1},Ke="cubic-bezier(0.22, 1, 0.36, 1)",eo="cubic-bezier(0.34, 1.2, 0.64, 1)",As=(t,e)=>{fe.matches||typeof t.animate!="function"||(t.style.transformOrigin=e>0?"left center":"right center",t.animate([{transform:"scaleX(1)"},{transform:"scaleX(1.18)"},{transform:"scaleX(1)"}],{duration:300,easing:Ke}))},no=(t,e,n)=>{let o=t.querySelector('[data-active="true"]');if(!o)return;let r=o.offsetLeft,s=o.offsetWidth,i=parseFloat(e.style.left);e.style.left=r+"px",e.style.width=s+"px",n&&Number.isFinite(i)&&i!==r&&As(e,r>i?1:-1)},mn=(t,e)=>{t.classList.toggle("is-disabled",e);for(let n of t.children)n.classList.contains("tw-portal")||(n.inert=e)},Te=(t,e,n,o)=>{t.classList.toggle("is-collapsed",o),e.setAttribute("aria-expanded",String(!o)),n.inert=o},gn=(t,e)=>{let n=t.findIndex(o=>o.dataset.value===String(e));return n<0&&t.length?0:n},oo=(t,e)=>{let n=gn(t,e);t.forEach((o,r)=>{let s=o.dataset.value===String(e);o.dataset.active=String(s),o.setAttribute("aria-checked",String(s)),o.tabIndex=r===n?0:-1})},ro=(t,e,n)=>{let o=tt("button",t,Wn(e));return o.setAttribute("role","radio"),o._twVal=re(e),o.dataset.value=o._twVal,o.addEventListener("click",()=>n(o._twVal)),o},qe=(t,e,n,o=0)=>{switch(t){case"ArrowRight":return(e+1)%n;case"ArrowLeft":return(e-1+n)%n;case"ArrowDown":return o<0?-1:o?e+o<n?e+o:e:(e+1)%n;case"ArrowUp":return o<0?-1:o?e-o>=0?e-o:e:(e-1+n)%n;case"Home":return 0;case"End":return n-1}return-1};function me(t,e,n,o){let r=w("div","tw-seg");r.setAttribute("role","radiogroup"),o&&r.setAttribute("aria-label",o);let s=w("div","tw-seg-pill");r.append(s);let i=t.map(c=>{let u=ro("tw-seg-btn",c,d=>h(d));return r.append(u),u}),a=c=>no(r,s,c),l=()=>{oo(i,e),a(!0)},h=(c,u=!0)=>{c!=null&&!i.some(d=>d._twVal===c)||(e=c,l(),u&&n(c))};return r.addEventListener("keydown",c=>{let u=gn(i,e);if(u<0)return;let d=qe(c.key,u,i.length);d<0||(c.preventDefault(),h(i[d]._twVal),i[d].focus())}),l(),Ht(()=>{a(),r.classList.add("is-ready")}),jt(r,[[window,"tw-reflow"]],()=>a()),{el:r,set:c=>h(c,!1),get:()=>e}}var Pt=(t,e="",n=2,o=24)=>`<svg${e?` class="${e}"`:""} viewBox="0 0 ${o} ${o}" fill="none" stroke="currentColor" stroke-width="${n}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`,se=(t,e)=>({el:t,set:()=>{},get:()=>{},destroy:e}),Yo={},at=(t,e)=>{Yo[t]=e},Vt=t=>Yo[t];var Ts="http://www.w3.org/2000/svg",Lt=(t,e)=>{let n=document.createElementNS(Ts,t);return e&&n.setAttribute("class",e),n},Wo=(t,e)=>getComputedStyle(t).getPropertyValue(e).trim(),bn=t=>{let e=getComputedStyle(t),n=o=>e.getPropertyValue(o).trim();return n("--tw-accent")||n("--tw-text-primary")||"#fff"},Uo=t=>{let e=!1;t.addEventListener("pointerdown",n=>{e=n.button===0&&document.activeElement!==t}),t.addEventListener("focus",()=>t.select()),t.addEventListener("mouseup",n=>{e&&(e=!1,n.button===0&&document.activeElement===t&&t.selectionStart===0&&t.selectionEnd===t.value.length&&n.preventDefault())})};function Qt(t,{onDown:e,onMove:n,onEnd:o}={}){let r=null,s=i=>{r===null||i.pointerId!==r||(r=null,o&&o(i))};t.addEventListener("pointerdown",i=>{if(!(i.button!==0||r!==null)){r=i.pointerId;try{t.setPointerCapture(i.pointerId)}catch{}e&&e(i)}}),t.addEventListener("pointermove",i=>{if(i.pointerId===r){if(i.buttons===0)return s(i);n&&n(i)}}),t.addEventListener("pointerup",s),t.addEventListener("pointercancel",s),t.addEventListener("lostpointercapture",s)}var Oe=(t,e)=>Qt(t,{onDown:n=>{t.classList.add("is-grabbing"),e(n)},onMove:e,onEnd:()=>t.classList.remove("is-grabbing")}),Ne=(t,e)=>{let n=e.getBoundingClientRect();return[R((t.clientX-n.left)/n.width,0,1),R((t.clientY-n.top)/n.height,0,1)]},Jo=(t,e,n=1/0)=>{let o=t.getBoundingClientRect(),r=Math.min(window.devicePixelRatio||1,n);return t.width=o.width*r,t.height=o.height*r,e.setTransform(r,0,0,r,0,0),[o.width,o.height]},zt=(t,e)=>{let n=w("div",t),o=yt("tw-trigger");o.setAttribute("aria-expanded","false");let r=w("span","tw-trigger-right");return o.append(tt("span","tw-trigger-label",e),r),n.append(o),{root:n,trigger:o,right:r}},Os=Pt('<path d="M6 4v8M10 4v8"/>',"",1.5,16);function Ns(){let t=null,e=0,n=0,o=0;return{show(r,s,i,a){t=w("div","tw-grab-guide tw-portal"),t.innerHTML='<span class="tw-grab-line"></span><span class="tw-grab-dot"></span><span class="tw-grab-arrow"></span><span class="tw-grab-bubble"></span>',e=s,n=r,o=i??r,t.children[1].style.cssText=`left:${r}px;top:${e}px`,ye(t,a),document.body.appendChild(t)},move(r,s){t&&(t.children[0].style.cssText=`left:${Math.min(n,r)}px;top:${e}px;width:${Math.abs(r-n)}px`,t.children[2].style.cssText=`left:${r}px;top:${e}px;transform:translate(-50%,-50%) scaleX(${r>=n?1:-1})`,t.children[3].style.cssText=`left:${o}px;top:${e-16}px`,t.children[3].textContent=s)},hide(){t&&(t.remove(),t=null)}}}function Ps(t,e,n,o,r,s){let i=0,a=0,l=1,h=Ns();Qt(t,{onDown:c=>{c.preventDefault(),i=c.clientX,a=o(),l=1,t.classList.add("is-dragging");let u=e.getBoundingClientRect();h.show(c.clientX,u.top+u.height/2,u.left+u.width/2,e),h.move(c.clientX,s())},onMove:c=>{let u=c.shiftKey?10:c.altKey?.1:1;u!==l&&(l=u,i=c.clientX,a=o()),r(a+(c.clientX-i)*n*u),h.move(c.clientX,s())},onEnd:()=>{t.classList.remove("is-dragging"),h.hide()}})}function Ot(t,e){let n=Number.isFinite(+t.step)&&+t.step>0?+t.step:1,o=f=>f==null?NaN:+f,r=o(t.min),s=o(t.max);if(Number.isFinite(r)&&Number.isFinite(s)&&s<r){let f=r;r=s,s=f}let i=Number.isFinite(r)?r:0,a=ne(n),[l,h]=Se(Number.isFinite(r)?r:-1/0,Number.isFinite(s)?s:1/0,n,i),c=f=>{let E=ve(f,i,n);return t.soft?E:R(E,l,h)},u=c(Number.isFinite(+t.value)?+t.value:0),d=w("div",t.row?"tw-row":"tw-field"),O=w("div","tw-num-wrap"),L=w("span","tw-num-grab",Os);L.setAttribute("aria-hidden","true"),L.title="Drag to adjust";let b=w("input","tw-num");b.type="text",b.inputMode="decimal",b.setAttribute("aria-label",t.unit?`${t.label} (${t.unit})`:t.label),b.value=u.toFixed(a),Xt(b),O.append(L,b),t.unit&&O.append(tt("span","tw-num-unit",t.unit)),d.append(tt("span",t.row?"tw-row-label":"tw-field-label",t.label),O);let m=(f,E=!0)=>{f=+f,Number.isFinite(f)&&(u=c(f),b.value=u.toFixed(a),E&&e&&e(u))};return b.addEventListener("change",()=>{let f=parseFloat(b.value);m(isNaN(f)?u:f)}),b.addEventListener("keydown",f=>{if(f.key==="Enter")return b.blur();let E=f.key==="ArrowUp"?1:f.key==="ArrowDown"?-1:0;if(!E)return;f.preventDefault();let C=parseFloat(b.value);m((isNaN(C)?u:C)+E*n*(f.shiftKey?10:1))}),Ps(L,O,n,()=>u,m,()=>b.value),{el:d,set:f=>m(f,!1),get:()=>u}}at("number",(t,e)=>Ot({...t,row:!0},e));var $s=(t,e,n)=>{let o=Math.sqrt(t/n),r=e/(2*Math.sqrt(t*n));return Math.min(2.2,9/Math.max(r*o,.5))};function Ye(t,e,n,o=64,r=$s(t,e,n)){let s=Math.sqrt(t/n),i=e/(2*Math.sqrt(t*n)),a=[];for(let l=0;l<o;l++){let h=l/(o-1)*r,c;if(i<1-1e-4){let u=s*Math.sqrt(1-i*i);c=1-Math.exp(-i*s*h)*(Math.cos(u*h)+i*s/u*Math.sin(u*h))}else if(i<=1+1e-4)c=1-Math.exp(-s*h)*(1+s*h);else{let u=Math.sqrt(i*i-1),d=s*(i+u),O=s*(i-u);c=1-(d*Math.exp(-O*h)-O*Math.exp(-d*h))/(d-O)}a.push(c)}return a}var Rs=180/Math.PI,ao=Math.PI/180,te=(t,e)=>[t[0][0]*e[0]+t[0][1]*e[1]+t[0][2]*e[2],t[1][0]*e[0]+t[1][1]*e[1]+t[1][2]*e[2],t[2][0]*e[0]+t[2][1]*e[1]+t[2][2]*e[2]],Fs=(t,e)=>{let n=[[0,0,0],[0,0,0],[0,0,0]];for(let o=0;o<3;o++)for(let r=0;r<3;r++)n[o][r]=t[o][0]*e[0][r]+t[o][1]*e[1][r]+t[o][2]*e[2][r];return n},Mt=t=>Number.isFinite(t)?t:0,_s=(t,e,n)=>Math.min(n,Math.max(e,t)),hn=t=>{let e=Math.abs(t);return e<=.04045?t/12.92:Math.sign(t)*((e+.055)/1.055)**2.4},We=t=>{let e=Math.abs(t);return e<=.0031308?t*12.92:Math.sign(t)*(1.055*e**(1/2.4)-.055)},vn=1.09929682680944,ar=.018053968510807,Hs=t=>{let e=Math.abs(t);return e<ar*4.5?t/4.5:Math.sign(t)*((e+vn-1)/vn)**(1/.45)},lr=t=>{let e=Math.abs(t);return e<ar?t*4.5:Math.sign(t)*(vn*e**.45-(vn-1))},cr=1/512,Ds=t=>{let e=Math.abs(t);return e<=cr*16?t/16:Math.sign(t)*e**1.8},Is=t=>{let e=Math.abs(t);return e>=cr?Math.sign(t)*e**(1/1.8):16*t},so=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],wn=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],js=[[.4865709486482162,.26566769316909306,.19821728523436247],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],ur=[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]],Bs=[[.6369580483012914,.14461690358620832,.16888097516417205],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],dr=[[1.7166511879712674,-.35567078377639233,-.25336628137365974],[-.6666843518324892,1.6164812366349395,.01576854581391113],[.017639857445310783,-.042770613257808524,.9421031212354738]],Vs=[[.7977604896723027,.13518583717574031,.0313493495815248],[.2880711282292934,.7118432178101014,8565396060525902e-20],[0,0,.8251046025104601]],Gs=[[1.3457989731028281,-.25558010007997534,-.05110628506753401],[-.5446224939028347,1.5082327413132781,.02053603239147973],[0,0,1.2119675456389454]],pr=[[1.0479298208405488,.022946793341019088,-.05019222954313557],[.029627815688159344,.990434484573249,-.01707382502938514],[-.009243058152591178,.015055144896577895,.7518742899580008]],fr=[[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]],Xs=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],mr=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],zs=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],gr=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],yn=216/24389,Ue=24389/27,Re=[.3457/.3585,1,(1-.3457-.3585)/.3585],Pe=(t,e,n)=>te(n,[e(t[0]),e(t[1]),e(t[2])]),$e=(t,e,n)=>{let o=te(n,t);return[e(o[0]),e(o[1]),e(o[2])]},Zo=t=>{let e=te(gr,t);return te(mr,[e[0]**3,e[1]**3,e[2]**3])},Qo=t=>{let e=te(Xs,t);return te(zs,[Math.cbrt(e[0]),Math.cbrt(e[1]),Math.cbrt(e[2])])};function tr(t){let[e,n,o]=t,r=(e+16)/116,s=n/500+r,i=r-o/200,a=s**3>yn?s**3:(116*s-16)/Ue,l=e>Ue*yn?r**3:e/Ue,h=i**3>yn?i**3:(116*i-16)/Ue;return te(fr,[a*Re[0],l*Re[1],h*Re[2]])}function er(t){let e=te(pr,t),n=i=>i>yn?Math.cbrt(i):(Ue*i+16)/116,o=n(e[0]/Re[0]),r=n(e[1]/Re[1]),s=n(e[2]/Re[2]);return[116*r-16,500*(o-r),200*(r-s)]}var xn=t=>{let e=Math.hypot(t[1],t[2]),n=Math.atan2(t[2],t[1])*Rs;return n<0&&(n+=360),[t[0],e,n]},Mn=t=>[t[0],t[1]*Math.cos(t[2]*ao),t[1]*Math.sin(t[2]*ao)];function br(t){let e=((Number.isNaN(t[0])?0:t[0])%360+360)%360,n=t[1]/100,o=t[2]/100,r=s=>{let i=(s+e/30)%12,a=n*Math.min(o,1-o);return o-a*Math.max(-1,Math.min(i-3,9-i,1))};return[r(0),r(8),r(4)]}function hr(t){let e=Math.max(...t),n=Math.min(...t),o=e-n;if(o<1e-9)return NaN;let r;return e===t[0]?r=(t[1]-t[2])/o+(t[1]<t[2]?6:0):e===t[1]?r=(t[2]-t[0])/o+2:r=(t[0]-t[1])/o+4,r*60}function Ks(t){let e=Math.max(...t),n=Math.min(...t),o=(n+e)/2,r=hr(t),s=e===n||o===0||o===1?0:(e-o)/Math.min(o,1-o);return s<0&&(r+=180,s=-s),r>=360&&(r-=360),[r,s*100,o*100]}function qs(t){let e=t[1]/100,n=t[2]/100;if(e+n>=1){let s=e/(e+n);return[s,s,s]}let o=br([t[0],100,50]),r=1-e-n;return[o[0]*r+e,o[1]*r+e,o[2]*r+e]}var Ys=t=>[hr(t),Math.min(...t)*100,(1-Math.max(...t))*100];function Ws(t,e){switch(e){case"srgb":return Pe(t,hn,so);case"p3":return Pe(t,hn,js);case"rec2020":return Pe(t,Hs,Bs);case"prophoto-rgb":return te(fr,Pe(t,Ds,Vs));case"oklab":return Zo(t);case"oklch":return Zo(Mn(t));case"lab":return tr(t);case"lch":return tr(Mn(t));case"hsl":return Pe(br(t),hn,so);case"hwb":return Pe(qs(t),hn,so)}}function Us(t,e){switch(e){case"srgb":return $e(t,We,wn);case"p3":return $e(t,We,ur);case"rec2020":return $e(t,lr,dr);case"prophoto-rgb":return $e(te(pr,t),Is,Gs);case"oklab":return Qo(t);case"oklch":return xn(Qo(t));case"lab":return er(t);case"lch":return xn(er(t));case"hsl":return Ks($e(t,We,wn));case"hwb":return Ys($e(t,We,wn))}}function St(t,e,n){return e===n?[t[0],t[1],t[2]]:e==="oklch"&&n==="oklab"?Mn(t):e==="oklab"&&n==="oklch"?xn(t):e==="lch"&&n==="lab"?Mn(t):e==="lab"&&n==="lch"?xn(t):Us(Ws(t,e),n)}var En=75e-6,wr=t=>t.every(e=>e>=-En&&e<=1+En),lo=(t,e)=>wr(St(t,"oklch",e)),io=t=>t.map(e=>Math.min(1,Math.max(0,e))),nr=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]);function kn(t,e){if(lo(t,e))return St(t,"oklch",e);let n=t[0];if(n>=1)return[1,1,1];if(n<=0)return[0,0,0];if(!Number.isFinite(t[1]))return io(St([n,0,Mt(t[2])],"oklch",e));let o=.02,r=1e-4,s=[t[0],t[1],t[2]],i=0,a=t[1],l=!0,h=io(St(s,"oklch",e));if(nr(St(h,e,"oklab"),St(t,"oklch","oklab"))<o)return h;for(;a-i>r;){let c=(i+a)/2;s[1]=c;let u=St(s,"oklch",e);if(l&&wr(u)){i=c;continue}h=io(u);let d=nr(St(h,e,"oklab"),St(s,"oklch","oklab"));if(d<o){if(o-d<r)return h;l=!1,i=c}else a=c}return h}var yr=(t,e)=>{let n=t*ao,o=Math.cos(n),r=Math.sin(n),s=gr.map(a=>o*a[1]+r*a[2]),i=Fs(e==="p3"?ur:e==="rec2020"?dr:wn,mr);return{d:s,F:i,gam:e==="rec2020"?lr:We}};function Cn(t,e){let{d:[n,o,r],F:s,gam:i}=yr(t,e),a=-En,l=1+En;return(h,c)=>{let u=h+c*n,d=h+c*o,O=h+c*r,L=u**3,b=d**3,m=O**3,f=i(s[0][0]*L+s[0][1]*b+s[0][2]*m);if(f<a||f>l)return!1;let E=i(s[1][0]*L+s[1][1]*b+s[1][2]*m);if(E<a||E>l)return!1;let C=i(s[2][0]*L+s[2][1]*b+s[2][2]*m);return C>=a&&C<=l}}function vr(t,e){let{d:[n,o,r],F:s,gam:i}=yr(t,e);return(a,l,h)=>{let c=a+l*n,u=a+l*o,d=a+l*r,O=c**3,L=u**3,b=d**3;h[0]=i(s[0][0]*O+s[0][1]*L+s[0][2]*b),h[1]=i(s[1][0]*O+s[1][1]*L+s[1][2]*b),h[2]=i(s[2][0]*O+s[2][1]*L+s[2][2]*b)}}function Ln(t,e,n=.5){if(!t(e,0))return 0;let o=0;for(let r=0;r<16;r++){let s=(o+n)/2;t(e,s)?o=s:n=s}return o}var xe=t=>Math.round(Math.min(1,Math.max(0,t))*255).toString(16).padStart(2,"0"),Js=t=>`#${xe(t[0])}${xe(t[1])}${xe(t[2])}`,Sn=(t,e,n)=>Js(kn([t,e,n],"srgb"));function xr(t){let e=String(t).replace("#","").trim();if(e.length===3&&(e=e.split("").map(o=>o+o).join("")),e.length<6)return[.7,.1,280];let n=[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255];return St(n,"srgb","oklch").map(Mt)}var An=["hex","srgb","css","hsl","hwb","oklch","oklab","lch","lab","p3","rec2020"],Mr={hex:"HEX",srgb:"RGB",css:"CSS",hsl:"HSL",hwb:"HWB",oklch:"OKLCH",oklab:"OKLab",lch:"LCH",lab:"Lab",p3:"P3",rec2020:"Rec2020"},Er=["srgb","css","hsl","hwb","hex"],co=t=>!Er.includes(t),kr=t=>t==="hex"||t==="css"?"srgb":t,Zs=Object.assign(Object.create(null),{hex:"srgb",srgb:"srgb",css:"srgb",hsl:"hsl",hwb:"hwb",oklch:"oklch",oklab:"oklab",lch:"lch",lab:"lab",p3:"display-p3",rec2020:"rec2020"}),Cr=t=>Zs[t]||"oklch",Qs=Object.assign(Object.create(null),{srgb:"srgb",hsl:"hsl",hwb:"hwb",oklch:"oklch",oklab:"oklab",lch:"lch",lab:"lab","display-p3":"p3",rec2020:"rec2020"}),uo=t=>Qs[t]||"oklch",Tn=.5,Lr=(t,e,n)=>Object.freeze(["R","G","B"].map(o=>Object.freeze({k:o,min:0,max:t,step:e,scale:n}))),or=Lr(255,1,255),rr=Lr(1,.01,1),Je={oklch:[{k:"L",min:0,max:100,step:1,scale:100},{k:"C",min:0,max:Tn,step:.01,scale:1},{k:"H",min:0,max:360,step:1,scale:1}],oklab:[{k:"L",min:0,max:100,step:1,scale:100},{k:"a",min:-.4,max:.4,step:.01,scale:1},{k:"b",min:-.4,max:.4,step:.01,scale:1}],lch:[{k:"L",min:0,max:100,step:1,scale:1},{k:"C",min:0,max:150,step:1,scale:1},{k:"H",min:0,max:360,step:1,scale:1}],lab:[{k:"L",min:0,max:100,step:1,scale:1},{k:"a",min:-125,max:125,step:1,scale:1},{k:"b",min:-125,max:125,step:1,scale:1}],srgb:or,css:or,hsl:[{k:"H",min:0,max:360,step:1,scale:1},{k:"S",min:0,max:100,step:1,scale:1},{k:"L",min:0,max:100,step:1,scale:1}],hwb:[{k:"H",min:0,max:360,step:1,scale:1},{k:"W",min:0,max:100,step:1,scale:1},{k:"B",min:0,max:100,step:1,scale:1}],p3:rr,rec2020:rr},sr=t=>t>=1?0:t>=.1?1:t>=.01?2:3,Sr=(t,e,n)=>e==="oklch"?[t[0],t[1],t[2]]:Er.includes(n)?e==="srgb"?kn(t,"srgb"):St(kn(t,"srgb"),"srgb",e):St(t,"oklch",e);function On(t,e){let n=Sr(t,kr(e),e);return Je[e].map((o,r)=>{let s=Mt(n[r])*o.scale;return _s(Math.abs(s)<.5*o.step?0:s,o.min,o.max)})}function Ar(t,e,n,o){let r=kr(e),s=Sr(t,r,e).map(Mt);s[n]=o/Je[e][n].scale;let i=St(s,r,"oklch");return[Mt(i[0]),Mt(i[1]),Mt(i[2])]}function Tr(t,e){if(!co(e))return"sRGB";let n=kn(t,"srgb");return Math.max(...n)<.03||Math.min(...n)>.97||lo(t,"srgb")?"sRGB":lo(t,"p3")?"P3":"wide"}function po(t,e){if(e==="hex")return Sn(t[0],t[1],t[2]);let n=Je[e],o=On(t,e),r=s=>{let i=o[s].toFixed(sr(n[s].step));return n[s].k==="H"&&+i==360?0 .toFixed(sr(n[s].step)):i};return e==="css"?`${r(0)}, ${r(1)}, ${r(2)}`:e==="oklch"||e==="oklab"||e==="lch"||e==="lab"?`${r(0)}% ${r(1)} ${r(2)}`:e==="hsl"||e==="hwb"?`${r(0)} ${r(1)}% ${r(2)}%`:`${r(0)} ${r(1)} ${r(2)}`}var ir=(t,e)=>e==="hex"?t:e==="srgb"?`rgb(${t})`:e==="css"?`rgba(${t}, 1)`:e==="hsl"?`hsl(${t})`:e==="hwb"?`hwb(${t})`:e==="p3"?`color(display-p3 ${t})`:e==="rec2020"?`color(rec2020 ${t})`:`${e}(${t})`;function Or(t,e,n){let o=Mt(n);if(e==="hex")return Sn(t[0],t[1],t[2])+(o<.999?xe(o):"");let r=po(t,e);if(o>=.999)return ir(r,e);let s=+o.toFixed(3);return e==="css"?`rgba(${r}, ${s})`:ir(`${r} / ${s}`,e)}var Nr=(()=>{try{return document.createElement("canvas").getContext("2d",{colorSpace:"display-p3"})?.getContextAttributes?.().colorSpace==="display-p3"}catch{return!1}})(),fo=Nr?{colorSpace:"display-p3"}:{},ti=Nr?"p3":"srgb",Nn=(t,e)=>{let n=t.length-1,o=Math.max(0,Math.min(n,e*n)),r=Math.floor(o),s=o-r;return t[r]*(1-s)+t[Math.min(r+1,n)]*s},ei=(t,e)=>{let n=Cn(t,e),o=new Float64Array(128);for(let r=0;r<128;r++)o[r]=Ln(n,r/127);return o},wo="var(--tw-checker)",ni=Object.assign(Object.create(null),{srgb:"srgb","display-p3":"p3",rec2020:"rec2020","prophoto-rgb":"prophoto-rgb"}),yo=/^(rgba?|hsla?|hwb)\([ \t\n\r\f]*([^)]*?)[ \t\n\r\f]*\)$/i,vo=/^(oklch|oklab|lch|lab|color)\([ \t\n\r\f]*([^)]*?)[ \t\n\r\f]*\)$/i,oi=/^(srgb|srgb-linear|display-p3|a98-rgb|prophoto-rgb|rec2020|xyz|xyz-d50|xyz-d65)$/i,Pn=/^#?([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,mo,Pr=()=>mo===void 0?mo=document.createElement("canvas").getContext("2d"):mo,ri=/^(#[0-9a-f]{3,8}|[a-z][a-z-]*(?:\([\w\s.,%+\-\/]*\))?)$/i;function Fe(t){if(t=String(t??"").trim(),!ri.test(t))return!1;if(Pn.test(t))return!0;if(vo.test(t))return ai(t);if(yo.test(t))return Rr(t)!==null;let e=Pr();return e?["#000","#fff"].some(n=>{e.fillStyle=n;let o=e.fillStyle;return e.fillStyle=t,e.fillStyle!==o}):!0}var xo="[+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:e[+-]?\\d+)?",si=new RegExp("^"+xo+"$","i"),ii=new RegExp("^"+xo+"%$","i"),$r=new RegExp("^("+xo+")(deg|grad|rad|turn)$","i"),Mo=/[ \t\n\r\f]+/,Eo=/^none$/i,go=t=>t.replace(/^[ \t\n\r\f]+|[ \t\n\r\f]+$/g,""),bo=t=>!!t&&!Mo.test(t),Me=t=>Eo.test(t)?"none":si.test(t)?"num":ii.test(t)?"pct":$r.test(t)?"angle":null,ho=t=>{let e=$r.exec(t);if(!e)return Mt(parseFloat(t));let n=parseFloat(e[1]),o=e[2].toLowerCase();return Mt(o==="turn"?n*360:o==="grad"?n*.9:o==="rad"?n*180/Math.PI:n)};function Rr(t){let e=yo.exec(t);if(!e)return null;let n=e[1].toLowerCase().replace(/a$/,""),o=e[2],r,s,i;if(o.includes(",")){if(n==="hwb")return null;let c=o.split(",").map(go);if(c.length<3||c.length>4||!c.every(bo)||(r=c.slice(0,3),s=c[3],i=r.map(Me),n==="rgb"?!(i.every(u=>u==="num")||i.every(u=>u==="pct")):!((i[0]==="num"||i[0]==="angle")&&i[1]==="pct"&&i[2]==="pct"))||s!==void 0&&Me(s)!=="num"&&Me(s)!=="pct")return null}else{let c=o.split("/");if(c.length>2||(r=c[0].split(Mo).filter(Boolean),r.length!==3))return null;if(c.length===2){s=go(c[1]);let u=bo(s)?Me(s):null;if(!u||u==="angle")return null}if(i=r.map(Me),n==="rgb"?!i.every(u=>u&&u!=="angle"):!(i[0]&&i[0]!=="pct"&&i[1]&&i[1]!=="angle"&&i[2]&&i[2]!=="angle"))return null}let a=(c,u)=>Eo.test(c)?0:/%$/.test(c)?parseFloat(c)/100*u:parseFloat(c),l=s===void 0?1:R(a(s,1),0,1);return[n==="rgb"?St([R(a(r[0],255)/255,0,1),R(a(r[1],255)/255,0,1),R(a(r[2],255)/255,0,1)],"srgb","oklch"):St([i[0]==="none"?0:ho(r[0]),R(a(r[1],100),0,100),R(a(r[2],100),0,100)],n,"oklch"),l]}var ai=t=>{let e=vo.exec(t);if(!e)return!1;let n=e[1].toLowerCase(),o=e[2].split("/");if(o.length>2)return!1;let r=o[0].split(Mo).filter(Boolean);if(n==="color"&&!oi.test(r.shift()||"")||r.length!==3)return!1;let s=n==="lch"||n==="oklch";if(!r.every((i,a)=>{let l=Me(i);return l&&(s&&a===2?l!=="pct":l!=="angle")}))return!1;if(o.length===2){let i=go(o[1]),a=bo(i)?Me(i):null;if(!a||a==="angle")return!1}return!0};function Ee(t){if(t=String(t??"").trim(),Pn.test(t)){let a=t.replace("#",""),l=1;a.length===4?(l=parseInt(a[3]+a[3],16)/255,a=a.slice(0,3)):a.length===8&&(l=parseInt(a.slice(6,8),16)/255,a=a.slice(0,6));let[h,c,u]=xr("#"+a);return[h,c,u,l]}let e=vo.exec(t);if(e){let a=e[1].toLowerCase(),[l,h]=e[2].split("/").map(m=>m.trim()),c=l.split(/\s+/).filter(Boolean),u=a;if(a==="color"&&(u=ni[(c[0]||"").toLowerCase()],c=c.slice(1),!u))return[.7,.1,280,1];let d=(m,f=1)=>!m||Eo.test(m)?0:Mt(parseFloat(m))*(/%$/.test(m)?f:1),O=h?R(d(h,.01),0,1):1,L=a==="lab"?[R(d(c[0]),0,100),d(c[1],1.25),d(c[2],1.25)]:a==="lch"?[R(d(c[0]),0,100),Math.max(0,d(c[1],1.5)),ho(c[2]||"0")]:a==="color"?[d(c[0],.01),d(c[1],.01),d(c[2],.01)]:a==="oklab"?[R(d(c[0],.01),0,1),d(c[1],.004),d(c[2],.004)]:[R(d(c[0],.01),0,1),Math.max(0,d(c[1],.004)),ho(c[2]||"0")],b=u==="oklch"?L:St(L,u,"oklch");return[Mt(b[0]),R(Mt(b[1]),0,Tn),(Mt(b[2])%360+360)%360,O]}if(yo.test(t)){let a=Rr(t);if(!a)return[0,0,0,1];let[l,h]=a;return[Mt(l[0]),R(Mt(l[1]),0,Tn),(Mt(l[2])%360+360)%360,h]}let n=Pr();if(!n)return[0,0,0,1];n.fillStyle="#000",n.fillStyle=t;let o=n.fillStyle;if(Pn.test(o))return Ee(o);let r=o.match(/^rgba?\(([^)]*)\)/i),s=((r?r[1]:"").match(/-?[\d.]+(?:e[+-]?\d+)?/gi)||[0,0,0]).map(Number),i=St([s[0]/255,s[1]/255,s[2]/255],"srgb","oklch");return[Mt(i[0]),Mt(i[1]),Mt(i[2]),s[3]!=null?R(Mt(s[3]),0,1):1]}function _e(t,e){let[n,o,r,s]=Ee(t.value||"#7c5cff"),i=An.includes(t.mode)?t.mode:"oklch",a=NaN,l=null,h=[],c=NaN,u="",d=()=>Or([n,o,r],i,s),O=w("div","tw-color-body"),L=w("div","tw-wg-area"),b=document.createElement("canvas");b.className="tw-wg-canvas";let m=w("div","tw-wg-thumb");L.append(b,m);let f=w("div","tw-wg-hue"),E=document.createElement("canvas");E.className="tw-wg-hue-canvas";let C=w("div","tw-wg-hue-thumb");f.append(E,C);let B=w("div","tw-wg-alpha"),j=w("div","tw-wg-alpha-grad"),_=w("div","tw-wg-hue-thumb");B.append(j,_),b.setAttribute("aria-hidden","true"),E.setAttribute("aria-hidden","true"),L.tabIndex=0,L.setAttribute("role","group"),L.setAttribute("aria-label","Colour plane: chroma across, lightness up"),f.tabIndex=0,f.setAttribute("role","slider"),f.setAttribute("aria-label","Hue"),f.setAttribute("aria-valuemin","0"),f.setAttribute("aria-valuemax","360"),B.tabIndex=0,B.setAttribute("role","slider"),B.setAttribute("aria-label","Alpha"),B.setAttribute("aria-valuemin","0"),B.setAttribute("aria-valuemax","1");let D=w("div","tw-color-mode-row"),V=w("select","tw-color-mode");V.setAttribute("aria-label","Color mode"),An.forEach(H=>{let G=document.createElement("option");G.value=H,G.textContent=Mr[H],V.append(G)}),V.value=i;let W=w("span","tw-color-gamut");D.append(V,W);let P=w("div","tw-color-channels");O.append(L,f,B,D,P);let $=b.getContext("2d",fo),Q=E.getContext("2d"),K=document.createElement("canvas"),U=K.getContext("2d",fo),it=null,A=()=>{let H=L.getBoundingClientRect(),G=Math.round(H.width),dt=Math.round(H.height);if(G<2)return;let ct=window.devicePixelRatio||1,kt=co(i)?"p3":"srgb",Dt=ei(r,kt);l=Dt;let $t=Math.round(G*ct),N=Math.round(dt*ct),et=Math.max(1,Math.round($t/4)),pt=Math.max(1,Math.round(N/4));(K.width!==et||K.height!==pt)&&(K.width=et,K.height=pt,it=new ImageData(et,pt,fo));let bt=it.data,ut=pt>1?1/(pt-1):0,Ct=et>1?1/(et-1):0,Gt=vr(r,ti),Jt=[0,0,0];for(let Ft=0;Ft<pt;Ft++){let Zt=1-Ft*ut,he=Nn(Dt,Zt);for(let Yt=0;Yt<et;Yt++){Gt(Zt,Yt*Ct*he,Jt);let Wt=(Ft*et+Yt)*4;bt[Wt]=Math.round(R(Jt[0],0,1)*255),bt[Wt+1]=Math.round(R(Jt[1],0,1)*255),bt[Wt+2]=Math.round(R(Jt[2],0,1)*255),bt[Wt+3]=255}}if(U.putImageData(it,0,0),b.width=$t,b.height=N,$.imageSmoothingEnabled=!0,$.drawImage(K,0,0,$t,N),kt!=="srgb"){let Ft=(Zt,he,Yt,Wt)=>{let Ce=Cn(r,Zt),Ve=[];for(let It=0;It<=100;It++){let we=It/100,ue=Nn(Dt,we);if(ue<=0)continue;let ee=Ln(Ce,we,ue);ee<=0||Ve.push([Math.min(ee/ue*$t,$t-Yt*ct/2),(1-we)*N])}Ve.length<2||($.save(),$.strokeStyle=he,$.lineWidth=Yt*ct,$.lineJoin=$.lineCap="round",$.setLineDash(Wt.map(It=>It*ct)),$.beginPath(),Ve.forEach((It,we)=>we?$.lineTo(It[0],It[1]):$.moveTo(It[0],It[1])),$.stroke(),$.restore())};Ft("srgb","rgba(255,255,255,0.7)",1.5,[]),Ft("p3","rgba(255,255,255,0.4)",1,[3,3])}a=r},F=.7,y=H=>{let G=St([F,Ln(Cn(H,"srgb"),F),H],"oklch","srgb");return`rgb(${R(G[0]*255,0,255)|0},${R(G[1]*255,0,255)|0},${R(G[2]*255,0,255)|0})`},g=0,S=()=>{let H=f.getBoundingClientRect(),G=Math.max(1,Math.round(H.width)),dt=Math.max(1,Math.round(H.height));if(!(G<2)&&!(G===g&&E.width===G)){g=G,E.width=G,E.height=dt;for(let ct=0;ct<G;ct++)Q.fillStyle=y(ct/(G-1)*360),Q.fillRect(ct,0,1,dt)}},k=()=>{let H=l?Nn(l,n):.4,G=kt=>`${R(kt,0,1)*100}%`,dt=(kt,Dt)=>{let $t=R(kt,0,1);return`calc(${$t*100}% + ${(.5-$t)*Dt}px)`};m.style.left=G(H>0?o/H:0),m.style.top=G(1-n),C.style.left=dt(r/360,16),_.style.left=dt(s,16),B.setAttribute("aria-valuenow",String(+s.toFixed(2)));let ct=Math.round(r);f.setAttribute("aria-valuenow",String(ct)),f.setAttribute("aria-valuetext",`${ct}\xB0`),L.setAttribute("aria-description",`lightness ${Math.round(n*100)}%, chroma ${+o.toFixed(3)}`),j.style.background=`linear-gradient(to right, oklch(${n} ${o} ${r} / 0), oklch(${n} ${o} ${r}))`,m.style.background=`oklch(${n} ${o} ${r})`,_.style.background=`linear-gradient(oklch(${n} ${o} ${r} / ${s}), oklch(${n} ${o} ${r} / ${s})), var(--tw-dropdown-bg)`,r!==c&&(u=y(r),c=r),C.style.background=u},v=()=>{if(W.textContent=Tr([n,o,r],i),i==="hex"){let H=P.querySelector(".tw-color-chan-input");H&&document.activeElement!==H&&(H.value=Sn(n,o,r)+(s<.999?xe(s):""))}else{let H=On([n,o,r],i);h.forEach((G,dt)=>{G.el.contains(document.activeElement)||G.set(H[dt])})}},I=()=>{S(),A(),k()},J=()=>e(d()),T=H=>{H&&r!==a&&A(),k(),v()},Y=H=>{T(H),J()},rt=()=>{if(P.replaceChildren(),h=[],i==="hex"){P.classList.add("tw-color-channels--hex");let H=w("div","tw-color-chan"),G=w("input","tw-color-chan-input");G.type="text",G.spellcheck=!1,G.setAttribute("aria-label","Hex color"),Xt(G),Uo(G),G.addEventListener("change",()=>{let dt=G.value.trim();Pn.test(dt)&&([n,o,r,s]=Ee(dt),Y(!0))}),G.addEventListener("blur",v),G.addEventListener("keydown",dt=>{dt.key==="Enter"&&G.blur()}),H.append(tt("span","tw-color-chan-label","HEX"),G),P.append(H)}else{P.classList.remove("tw-color-channels--hex");let H=On([n,o,r],i);Je[i].forEach((G,dt)=>{let ct=Ot({label:G.k,value:H[dt],min:G.min,max:G.max,step:G.step},kt=>{[n,o,r]=Ar([n,o,r],i,dt,R(kt,G.min,G.max)),Y(!0)});ct.el.addEventListener("focusout",v),h.push(ct),P.append(ct.el)})}v()},lt=H=>l?Nn(l,H):.4,Et=H=>Ne(H,L);Oe(L,H=>{let[G,dt]=Et(H);n=1-dt,o=G*lt(n),Y(!1)}),L.addEventListener("keydown",H=>{if(H.key==="Home"||H.key==="End"){H.preventDefault();return}let G=H.shiftKey?10:1,dt=H.key==="ArrowRight"?G:H.key==="ArrowLeft"?-G:0,ct=H.key==="ArrowUp"?G:H.key==="ArrowDown"?-G:H.key==="PageUp"?10:H.key==="PageDown"?-10:0;if(!dt&&!ct)return;H.preventDefault();let kt=lt(n),Dt=R((kt>0?o/kt:0)+dt*.01,0,1);n=R(n+ct*.01,0,1),o=Dt*lt(n),Y(!1)});let gt=H=>Ne(H,f)[0]*360;Oe(f,H=>{r=gt(H),Y(!0)}),f.addEventListener("keydown",H=>{let G=pe(H,r,1,0,360);G!=null&&(H.preventDefault(),r=R(G,0,360),Y(!0))});let At=H=>Ne(H,B)[0];Oe(B,H=>{s=At(H),Y(!1)}),B.addEventListener("keydown",H=>{let G=pe(H,s,.01,0,1);G!=null&&(H.preventDefault(),s=R(G,0,1),Y(!1))});let Nt=H=>{i=H,V.value=H,rt(),A(),k()};return V.addEventListener("change",()=>{Nt(V.value),t.onMode&&t.onMode()}),rt(),{el:O,set:H=>{let G=document.activeElement;G&&O.contains(G)&&G.matches("input")&&G.blur(),[n,o,r,s]=Ee(H),T(!0)},get:()=>d(),mode:()=>i,setMode:H=>{H!==i&&An.includes(H)&&Nt(H)},reflow:I,swatchCss:()=>`linear-gradient(oklch(${n} ${o} ${r} / ${s}), oklch(${n} ${o} ${r} / ${s})), ${wo}`,valueText:()=>po([n,o,r],i)+(s<.999?i==="hex"?xe(s):` / ${+s.toFixed(2)}`:"")}}function li(t,e){let{root:n,trigger:o,right:r}=zt("tw-color",t.label??"Colour"),s=w("span","tw-trigger-chip tw-color-swatch"),i=w("span","tw-trigger-value");r.append(s,i);let a=w("div","tw-color-pop"),l=()=>{s.style.background=h.swatchCss(),i.textContent=h.valueText()},h=_e({value:t.value,onMode:()=>l()},c=>{l(),e(c)});return a.append(h.el),n.append(a),Bt(n,o,a,{width:240,fallbackH:340,gap:6,onOpen:h.reflow,onReflow:h.reflow}),l(),{el:n,set:c=>{c!=null&&(h.set(c),l())},get:()=>h.get()}}var Fr=(t,e,n,o)=>o<.999?`oklch(${+t.toFixed(4)} ${+e.toFixed(4)} ${+n.toFixed(2)} / ${+o.toFixed(3)})`:`oklch(${+t.toFixed(4)} ${+e.toFixed(4)} ${+n.toFixed(2)})`;at("color",li);at("colorpicker",_e);var ci=Pt('<path d="M12 5v14m7-7H5"/>',"",2.5),jr=(t,e)=>t&&!Array.isArray(t)&&typeof t[e]=="string"?t[e]:null,_r=t=>jr(t,"interpolation"),Hr=t=>jr(t,"easing"),Dr=[["linear","Linear"],["ease","Ease"],["ease-in","Ease in"],["ease-out","Ease out"],["ease-in-out","Ease in-out"]];function Ir(t){let e=[{color:"oklch(0.72 0.19 25)",pos:0},{color:"oklch(0.72 0.16 280)",pos:1}],n=Array.isArray(t)?t:t&&Array.isArray(t.stops)?t.stops:null,o=(s,i)=>Fe(s)?{color:String(s).trim(),pos:R(+i||0,0,1)}:null,r=(n||[]).map(s=>Array.isArray(s)?o(s[0],s[1]):s&&typeof s=="object"?o(s.color,s.pos):null).filter(Boolean);return r.length>=2?r:e}function ui(t,e){t.value??(t.value=t.stops);let n=Ir(t.value),o=n[0],r=zn(Hr(t.value)),{root:s,trigger:i,right:a}=zt("tw-gradient",t.label??"Gradient"),l=w("span","tw-trigger-chip tw-gradient-preview");l.setAttribute("role","img"),a.append(l);let h=w("div","tw-color-pop tw-gradient-pop"),c=w("div","tw-gradient-bar-row"),u=w("div","tw-gradient-bar"),d=w("div","tw-gradient-grad"),O=w("div","tw-gradient-rail");u.append(d,O);let L=yt("tw-gradient-add",ci);L.title="Add a stop after the selected one",L.setAttribute("aria-label","Add a colour stop after the selected one"),c.append(u,L);let b=()=>[...n].sort((y,g)=>y.pos-g.pos),m=()=>Cr(_.mode()),f=()=>({stops:b().map(y=>({color:y.color,pos:+y.pos.toFixed(4)})),interpolation:m(),easing:r}),E=()=>{let y=an(f());d.style.background=y,l.style.background=`${y}, ${wo}`},C=()=>{l.setAttribute("aria-label",`${n.length} stop${n.length===1?"":"s"}`)},B=()=>e(f()),j=y=>[...O.children].find(g=>g._stop===y),_=_e({value:o.color,mode:uo(_r(t.value)||"oklch"),onMode:()=>{E(),B()}},y=>{o.color=y,j(o)?.style.setProperty("--stop",y),E(),B()}),D=w("select","tw-color-mode tw-gradient-ease");D.setAttribute("aria-label","Easing between stops"),D.title="How the ramp blends between stops";for(let[y,g]of Dr){let S=document.createElement("option");S.value=y,S.textContent=g,D.append(S)}let V=()=>{let y=D.querySelector("option[data-custom]");Dr.some(([g])=>g===r)?y?.remove():(y||(y=document.createElement("option"),y.dataset.custom="",y.textContent="Custom",D.append(y)),y.value=r),D.value=r};D.addEventListener("change",()=>{r=D.value,V(),E(),B()}),_.el.querySelector(".tw-color-mode").after(D),V(),h.append(c,_.el),s.append(h);let W=y=>y.setAttribute("aria-label",`Colour stop at ${Math.round(y._stop.pos*100)}%${y._stop===o?", selected":""}`),P=()=>{for(let y of O.children)y.dataset.sel=String(y._stop===o),W(y)},$=()=>{O.replaceChildren();for(let y of n){let g=yt("tw-gradient-stop");g._stop=y,g.style.left=y.pos*100+"%",g.style.setProperty("--stop",y.color),g.dataset.sel=String(y===o),W(g),g.addEventListener("focus",()=>Q(y,!1));let S=!1;Qt(g,{onDown:k=>{k.preventDefault(),k.stopPropagation(),g.focus({focusVisible:!1}),Q(y,!1),S=!1},onMove:k=>{let v=O.getBoundingClientRect();y.pos=R((k.clientX-v.left)/(v.width||1),0,1),g.style.left=y.pos*100+"%",W(g),E(),B(),S=n.length>2&&(k.clientY<v.top-24||k.clientY>v.bottom+24),g.dataset.removing=String(S)},onEnd:()=>{S?it(y):g.dataset.removing="false"}}),g.addEventListener("dblclick",k=>{k.preventDefault(),it(y)}),g.addEventListener("keydown",k=>{let v=k.key==="ArrowLeft"?-1:k.key==="ArrowRight"?1:0;v&&(k.preventDefault(),y.pos=R(y.pos+v*(k.shiftKey?.1:.01),0,1),g.style.left=y.pos*100+"%",W(g),E(),B())}),O.append(g)}},Q=(y,g)=>{y!==o&&(_.set(y.color),o=y),g?$():P()},K=y=>{let g=O.getBoundingClientRect();return R((y-g.left)/(g.width||1),0,1)},U=y=>{let g=b(),S=g[0],k=g[g.length-1];for(let lt=0;lt<g.length-1;lt++)if(y>=g[lt].pos&&y<=g[lt+1].pos){S=g[lt],k=g[lt+1];break}let v=Xo(sn(r),k.pos>S.pos?R((y-S.pos)/(k.pos-S.pos),0,1):0),I=Ee(S.color),J=Ee(k.color),T=lt=>lt[1]<1e-4,Y=J[2]-I[2];Y>180?Y-=360:Y<-180&&(Y+=360),(T(I)||T(J))&&(Y=0);let rt=(((T(I)&&!T(J)?J[2]:I[2])+Y*v)%360+360)%360;return Fr(I[0]+(J[0]-I[0])*v,I[1]+(J[1]-I[1])*v,rt,I[3]+(J[3]-I[3])*v)},it=y=>{if(n.length<=2)return;let g=n.indexOf(y);if(g<0)return;n.splice(g,1);let S=o===y?n[Math.max(0,g-1)]:o;E(),Q(S,!0),C(),B(),j(o)?.focus()},A=y=>{let g={color:U(y),pos:R(y,0,1)};return n.push(g),E(),Q(g,!0),C(),B(),g},F=()=>{let y=b(),g=y.indexOf(o);g<0&&(g=0);let S=g<y.length-1?(y[g].pos+y[g+1].pos)/2:g>0?(y[g-1].pos+y[g].pos)/2:R(y[g].pos+.1,0,1);A(S)};return L.addEventListener("click",y=>{y.stopPropagation(),F()}),u.addEventListener("dblclick",y=>{y.target.closest(".tw-gradient-stop")||(y.preventDefault(),A(K(y.clientX)))}),h.tabIndex=-1,h.addEventListener("keydown",y=>{(y.key==="Delete"||y.key==="Backspace")&&!y.altKey&&!/^(input|textarea|select)$/i.test(y.target.tagName)&&n.length>2&&(y.preventDefault(),it(o))}),Bt(s,i,h,{width:260,fallbackH:392,gap:6,onOpen:_.reflow,onReflow:_.reflow,initialFocus:()=>j(o)}),$(),E(),C(),{el:s,set:y=>{let g=_r(y);g&&_.setMode(uo(g));let S=Hr(y);S!==null&&(r=zn(S),V());let k=Ir(y).sort((v,I)=>v.pos-I.pos);if(k.length===n.length)b().forEach((v,I)=>{v.color=k[I].color,v.pos=k[I].pos;let J=j(v);J&&(J.style.left=v.pos*100+"%",J.style.setProperty("--stop",v.color))});else{let v=o.pos;n=k,o=n.reduce((I,J)=>Math.abs(J.pos-v)<Math.abs(I.pos-v)?J:I,n[0]),$()}E(),C(),_.set(o.color)},get:()=>f()}}at("gradient",ui);var Ze={x:0,y:8,blur:24,spread:0,color:"rgb(0 0 0 / 0.18)"},di=t=>!!t&&typeof t=="object",ge=(t,e)=>t!=null&&t!==""&&Number.isFinite(+t)?+t:e,Kt=t=>String(+t.toFixed(1)),pi=/#[0-9a-f]{3,8}\b|(?:oklch|oklab|rgba?|hsla?|hwb|lab|lch|color)\([^()]*\)/i,fi=/^(-?\d*\.?\d+)(px)?$/,mi=t=>{let e=pi.exec(t);if(!e||!Fe(e[0]))return null;let n=(t.slice(0,e.index)+" "+t.slice(e.index+e[0].length)).trim().split(/\s+/).filter(Boolean),o=n.includes("inset"),r=n.filter(i=>i!=="inset");if(r.length<2||r.length>4||!r.every(i=>fi.test(i)))return null;let s=r.map(i=>+i.replace(/px$/,""));return{inset:o,x:s[0],y:s[1],blur:s[2]??0,spread:s[3]??0,color:e[0]}},gi=Pt('<path d="M18 9s-4.4 6-6 6-6-6-6-6"/>',"tw-shadow-chevron",2.5);function bi(t,e){let n=k=>typeof k=="string"?mi(k):di(k)?k:null,o=n(t.value??t)||{},r=!!o.inset,s=ge(o.x,Ze.x),i=ge(o.y,Ze.y),a=Math.max(0,ge(o.blur,Ze.blur)),l=ge(o.spread,Ze.spread),{root:h,trigger:c,right:u}=zt("tw-shadow",t.label??"Shadow"),d=w("span","tw-trigger-chip tw-shadow-chip"),O=w("span","tw-shadow-chip-tile");d.append(O);let L=w("span","tw-trigger-value");u.append(d,L);let b=w("div","tw-color-pop tw-shadow-pop"),m=w("div","tw-shadow-stage"),f=w("div","tw-shadow-card");m.append(f);let E=me([{value:"outer",label:"Outer"},{value:"inner",label:"Inner"}],r?"inner":"outer",k=>{k==="inner"!==r&&(r=k==="inner",y(),F())},"Shadow position"),C=w("div","tw-row");C.append(tt("span","tw-row-label","Position"),E.el);let B=w("div","tw-fields tw-shadow-fields"),j=(k,v,I,J)=>{let T=Ot({label:k,value:v(),step:1,min:J,unit:"px"},Y=>{I(Y),y(),F()});return B.append(T.el),T},_=j("X",()=>s,k=>{s=k}),D=j("Y",()=>i,k=>{i=k}),V=j("Blur",()=>a,k=>{a=Math.max(0,k)},0),W=j("Spread",()=>l,k=>{l=k});s=_.get(),i=D.get(),a=V.get(),l=W.get();let P=yt("tw-trigger tw-shadow-color");P.setAttribute("aria-expanded","false");let $=w("span","tw-trigger-chip tw-color-swatch"),Q=w("span","tw-trigger-value"),K=w("span","tw-trigger-right");K.append($,Q),K.insertAdjacentHTML("beforeend",gi),P.append(tt("span","tw-trigger-label","Colour"),K);let U=_e({value:typeof o.color=="string"&&Fe(o.color)?o.color:Ze.color,onMode:()=>y()},()=>{y(),F()});U.el.hidden=!0,P.addEventListener("click",()=>{let k=U.el.hidden;U.el.hidden=!k,P.setAttribute("aria-expanded",String(k)),g.reflow()}),b.append(m,C,B,P,U.el),h.append(b);let it=k=>`${r?"inset ":""}${Kt(s*k)}px ${Kt(i*k)}px ${Kt(a*k)}px ${Kt(l*k)}px ${U.get()}`,A=()=>({inset:r,x:+Kt(s),y:+Kt(i),blur:+Kt(a),spread:+Kt(l),color:U.get(),css:it(1)}),F=()=>e(A()),y=()=>{f.style.boxShadow=it(1),O.style.boxShadow=it(.3),L.textContent=`${r?"in ":""}${Kt(s)} ${Kt(i)} ${Kt(a)}${l?" "+Kt(l):""}`,$.style.background=U.swatchCss(),Q.textContent=U.valueText()},g=Bt(h,c,b,{width:260,fallbackH:300,gap:6,onOpen:U.reflow,onReflow:U.reflow});return y(),{el:h,set:k=>{let v=n(k);v&&(v.inset!=null&&(r=!!v.inset,E.set(r?"inner":"outer")),v.x!=null&&(_.set(ge(v.x,s)),s=_.get()),v.y!=null&&(D.set(ge(v.y,i)),i=D.get()),v.blur!=null&&(V.set(ge(v.blur,a)),a=V.get()),v.spread!=null&&(W.set(ge(v.spread,l)),l=W.get()),typeof v.color=="string"&&Fe(v.color)&&U.set(v.color),y())},get:A}}at("shadow",bi);var hi=Pt('<path d="M10.5 13.5a4 4 0 0 0 5.6 0l3-3a4 4 0 0 0-5.6-5.6l-1.5 1.5M13.5 10.5a4 4 0 0 0-5.6 0l-3 3a4 4 0 0 0 5.6 5.6l1.5-1.5"/>'),wi=/^(-?\d*\.?\d+)([a-z%]*)$/i,Br=t=>t!=null&&t!==""&&Number.isFinite(+t)?+t:null,Vr=t=>String(+t.toFixed(2)),Gr=t=>t.length===1?[t[0],t[0],t[0],t[0]]:t.length===2?[t[0],t[1],t[0],t[1]]:t.length===3?[t[0],t[1],t[2],t[1]]:t.slice(0,4),Xr=(t,e)=>{if(typeof t=="number")return Number.isFinite(t)?[t,t,t,t]:null;if(typeof t=="string"){let n=t.trim().split(/\s+/).map(o=>{let r=wi.exec(o);return r?+r[1]:NaN});return n.length>=1&&n.length<=4&&n.every(Number.isFinite)?Gr(n):null}if(Array.isArray(t)){let n=t.map(Br);return n.length>=1&&n.length<=4&&n.every(o=>o!==null)?Gr(n):null}if(t&&typeof t=="object"){let n=t,o=e.slice(),r=!1;return["top","right","bottom","left"].forEach((s,i)=>{let a=Br(n[s]);a!==null&&(o[i]=a,r=!0)}),r?o:null}return null};function yi(t,e){let n=typeof t.unit=="string"&&t.unit.trim()?t.unit.trim():"px",o=!!t.corners,r={step:t.step??1,min:t.min,max:t.max,unit:n},s=Xr(t.value??t,[0,0,0,0])||[0,0,0,0],i=s.every(_=>_===s[0]),a=w("div","tw-sides"),l=Ot({label:t.label,value:s[0],row:!0,...r},_=>{s=[_,_,_,_],C(),E()}),h=yt("tw-sides-link",hi);h.setAttribute("aria-label","Link all sides"),h.title="Same on all sides",h.addEventListener("click",()=>B());let c=w("div","tw-sides-multi"),u=w("div","tw-sides-head"),d=w("span","tw-sides-sum");u.append(tt("span","tw-row-label",t.label),d);let O=w("div","tw-fields"),b=(o?["TL","TR","BR","BL"]:["T","R","B","L"]).map((_,D)=>{let V=Ot({label:_,value:s[D],...r},W=>{s[D]=W,C(),E()});return O.append(V.el),V});c.append(u,O),a.append(l.el,c),s=b.map(_=>_.get());let m=()=>{let[_,D,V,W]=s.map(Vr),P=$=>$==="0"?"0":$+n;return(_===V&&D===W?_===D?[_]:[_,D]:D===W?[_,D,V]:[_,D,V,W]).map(P).join(" ")},f=()=>({top:s[0],right:s[1],bottom:s[2],left:s[3],css:m()}),E=()=>e(f()),C=()=>{a.classList.toggle("is-linked",i),h.setAttribute("aria-pressed",String(i)),i?l.el.insertBefore(h,l.el.lastChild):u.append(h),l.set(s[0]),b.forEach((_,D)=>_.set(s[D])),d.textContent=s.map(Vr).join(" ")},B=()=>{i=!i,i&&(s=[s[0],s[0],s[0],s[0]]),C(),E(),h.focus()};return C(),{el:a,set:_=>{let D=Xr(_,s);D&&(b.forEach((V,W)=>V.set(D[W])),s=b.map(V=>V.get()),i=s.every(V=>V===s[0]),C())},get:f}}at("sides",yi);function vi(t,e){let n=t.label,o=+(t.value&&t.value[0]),r=+(t.value&&t.value[1]),s=Number.isFinite(o)?o:0,i=Number.isFinite(r)?r:1,[a,l]=[oe(s),oe(i)],h=S=>S!=null&&S!==""&&Number.isFinite(+S),{min:c,max:u,step:d}=cn(h(t.min)?t.min:Math.min(a[0],l[0]),h(t.max)?t.max:Math.max(a[1],l[1]),t.step,s,i);[c,u]=Se(c,u,d);let O=ne(d),L=S=>ve(S,c,d),b=R(L(Number.isFinite(o)?o:c),c,u),m=R(L(Number.isFinite(r)?r:u),c,u);if(b>m){let S=b;b=m,m=S}let f=w("div","tw-slider-wrap"),E=w("div","tw-slider tw-interval"),C=w("div","tw-slider-fill"),B=w("div","tw-slider-handle"),j=w("div","tw-slider-handle"),_=tt("span","tw-slider-label",n),D=w("span","tw-slider-value");E.append(C,B,j,_,D),f.append(E),[["minimum",B],["maximum",j]].forEach(([S,k])=>{k.tabIndex=0,k.setAttribute("role","slider"),k.setAttribute("aria-label",`${n} ${S}`),k.setAttribute("aria-valuemin",String(c)),k.setAttribute("aria-valuemax",String(u))});let V=S=>(S-c)/(u-c||1)*100,W=S=>`clamp(5px, calc(${S}% - 1.5px), calc(100% - 9px))`,P=()=>{let S=V(b),k=V(m);C.style.left=S+"%",C.style.width=Math.max(0,k-S)+"%",B.style.left=W(S),j.style.left=W(k),D.textContent=`${b.toFixed(O)} \u2013 ${m.toFixed(O)}`,B.setAttribute("aria-valuenow",String(b)),j.setAttribute("aria-valuenow",String(m));let v=f.offsetWidth;if(v){_.style.maxWidth=Math.max(0,v-D.offsetWidth-12-8-10)+"px";let I=J=>un(_,D,J/100*v-1.5,3);B.classList.toggle("is-dodge",I(V(b))),j.classList.toggle("is-dodge",I(V(m)))}};P();let $=()=>e([b,m]),Q=S=>{b=R(Math.min(L(S),m),c,u),P()},K=S=>{m=R(Math.max(L(S),b),c,u),P()},U=null,it=1,A=null,F=S=>{let k=f.offsetWidth||U.width,v=R((S-U.left)/it/k,0,1);return R(c+v*(u-c),c,u)},y=S=>{let k=F(S);A||(A=k<b?"lo":k>m?"hi":Math.abs(k-b)<=Math.abs(k-m)?"lo":"hi"),A==="lo"?Q(k):K(k),$()};Qt(E,{onDown:S=>{S.preventDefault(),U=f.getBoundingClientRect(),it=U.width/(f.offsetWidth||U.width),E.classList.add("is-active","is-dragging"),A=null,y(S.clientX),(A==="lo"?B:j).focus({focusVisible:!1})},onMove:S=>y(S.clientX),onEnd:()=>{U=null,A=null,E.classList.remove("is-active","is-dragging")}}),dn(E,P),Ht(P),jt(E,[[window,"resize"],[window,"tw-reflow"]],P);let g=S=>k=>{let v=S==="lo"?pe(k,b,d,c,m):pe(k,m,d,b,u);v!=null&&(k.preventDefault(),S==="lo"?Q(v):K(v),$())};return B.addEventListener("keydown",g("lo")),j.addEventListener("keydown",g("hi")),{el:f,set:S=>{if(Array.isArray(S)){let k=+S[0],v=+S[1];if(!Number.isFinite(k)||!Number.isFinite(v))return;b=R(L(Math.min(k,v)),c,u),m=R(L(Math.max(k,v)),c,u),P()}},get:()=>[b,m]}}at("interval",vi);var xi=0;function Mi(t){let e=`tw-tabs-${++xi}`,n=w("div","tw-tabs"),o=w("div","tw-tabs-bar");o.setAttribute("role","tablist");let r=w("div","tw-tabs-pill");o.append(r);let s=w("div","tw-tabs-pages"),i=[],a=t.pages.map((c,u)=>{let d=tt("button","tw-tabs-tab",c.title);d.setAttribute("role","tab"),d.dataset.active=String(u===0),d.setAttribute("aria-selected",String(u===0)),d.tabIndex=u===0?0:-1,d.id=`${e}-tab-${u}`,d.setAttribute("aria-controls",`${e}-page-${u}`);let O=w("div","tw-tabs-page tw-controls");return O.dataset.active=String(u===0),O.setAttribute("role","tabpanel"),O.id=`${e}-page-${u}`,O.setAttribute("aria-labelledby",d.id),i.push(O),s.append(O),d.addEventListener("click",()=>h(u)),o.append(d),d});n.append(o,s);let l=c=>no(o,r,c);function h(c){a.forEach((u,d)=>{u.dataset.active=String(d===c),u.setAttribute("aria-selected",String(d===c)),u.tabIndex=d===c?0:-1}),i.forEach((u,d)=>u.dataset.active=String(d===c)),l(!0),requestAnimationFrame(()=>window.dispatchEvent(new Event("tw-reflow")))}return o.addEventListener("keydown",c=>{let u=a.findIndex(O=>O.dataset.active==="true");if(u<0)return;let d=qe(c.key,u,a.length,-1);d<0||(c.preventDefault(),h(d),a[d].focus())}),Ht(l),{el:n,bodies:i,activate:h,active:()=>a.findIndex(c=>c.dataset.active==="true")}}at("tabs",Mi);var Ei=t=>String(t).replace(/[\\"]/g,"\\$&").replace(/[\x00-\x1f\x7f]/g,e=>"\\"+e.charCodeAt(0).toString(16)+" ");function ki(t,e){let n=t.value||"",{root:o,trigger:r,right:s}=zt("tw-image",t.label);r.removeAttribute("aria-expanded"),r.setAttribute("aria-label",`${t.label}: choose an image`);let i=w("span","tw-image-text"),a=w("span","tw-trigger-chip tw-image-thumb");s.append(a,i);let l=w("input","tw-image-input");l.type="file",l.accept="image/*",o.append(l);let h=()=>{a.dataset.set=n?"true":"false",a.style.backgroundImage=n?`url("${Ei(n)}")`:"",i.textContent=n?"Replace":"Drop or choose"},c=u=>{if(!u||!u.type.startsWith("image/"))return;let d=new FileReader;d.onload=()=>{n=String(d.result),h(),e(n)},d.readAsDataURL(u)};return r.addEventListener("click",()=>l.click()),l.addEventListener("change",()=>{l.files[0]&&c(l.files[0])}),r.addEventListener("dragover",u=>{u.preventDefault(),r.dataset.over="true"}),r.addEventListener("dragleave",()=>{r.dataset.over="false"}),r.addEventListener("drop",u=>{u.preventDefault(),r.dataset.over="false",u.dataTransfer.files[0]&&c(u.dataTransfer.files[0])}),h(),{el:o,set:u=>{u!=null&&typeof u!="string"||(n=u||"",h())},get:()=>n}}at("image",ki);var Ci=(t,e,n,o,r,s,i)=>{let a=r.length;t.clearRect(0,0,n,o),t.strokeStyle=bn(e),t.lineWidth=1.5,t.lineJoin="round",t.beginPath();let l=!1;for(let h=0;h<a;h++){let c=r[(s+h)%a];if(Number.isNaN(c))continue;let u=h/(a-1)*n,d=o-R(i(c),0,1)*o;l?t.lineTo(u,d):(t.moveTo(u,d),l=!0)}t.stroke()},Li=t=>{for(let e of["resize","tw-reflow"])window.addEventListener(e,t);return()=>{for(let e of["resize","tw-reflow"])window.removeEventListener(e,t)}};function zr(t,e=!1){let n=typeof t.get=="function"?t.get:()=>t.value,o=Math.max(30,Number.isFinite(+t.interval)?+t.interval:200),r;try{r=n()}catch{}let s=typeof r=="number",i=t.view==="graph"||s&&t.graph!==!1&&t.view!=="text"&&t.rows==null,a=w("div","tw-fps tw-monitor"),l=tt("span","tw-fps-val","\u2014");a.append(tt("span","tw-fps-label",t.label??"Monitor"),l);let h=0,c=0,u=()=>{},d=!1,O=Number.isFinite(+t.decimals)?Math.min(20,Math.max(0,Math.floor(+t.decimals))):2,L=P=>P==null?"\u2014":typeof P=="number"?Number.isInteger(P)||!Number.isFinite(P)?String(P):P.toFixed(O):typeof P=="object"?ze(P):String(P),b=()=>{h&&clearInterval(h),h=0,c&&cancelAnimationFrame(c),c=0,u()},m=P=>{let $=Q=>{if(e&&(c=requestAnimationFrame($)),!a.isConnected){d&&b();return}d=!0;let K;try{K=n(Q)}catch{return}P(K)};e?c=requestAnimationFrame($):h=setInterval($,o)};if(!i&&t.rows){l.remove();let P=Math.max(1,Math.floor(+t.rows)||1),$=w("pre","tw-monitor-buffer");$.style.setProperty("--tw-monitor-rows",P),a.append($);let Q=[];return m(K=>{for(Q.push(L(K));Q.length>P;)Q.shift();$.textContent=Q.join(`
3
- `)}),se(a,b)}if(!i)return m(P=>{l.textContent=L(P)}),se(a,b);let f=document.createElement("canvas");f.className="tw-fps-canvas",a.append(f);let E=f.getContext("2d");if(!E)return m(P=>{l.textContent=L(P)}),se(a,b);let C=80,B=new Array(C).fill(NaN),j=0,_=0,D=0,V=()=>{[_,D]=Jo(f,E,2)};u=Li(V);let W=()=>{if(_||V(),!_)return;let P=t.min,$=t.max;if(P==null||$==null){let K=1/0,U=-1/0;for(let A of B)Number.isFinite(A)&&(A<K&&(K=A),A>U&&(U=A));K===1/0?(K=0,U=1):K===U&&(K-=.5,U+=.5);let it=(U-K)*.1;P==null&&(P=K-it),$==null&&($=U+it)}let Q=$-P||1;Ci(E,a,_,D,B,j,K=>(K-P)/Q)};return m(P=>{if(typeof P!="number"||!Number.isFinite(P)){l.textContent=L(P);return}B[j]=P,j=(j+1)%C,l.textContent=L(P),W()}),se(a,b)}var Si=()=>{let t=0;return e=>{if(!(e>0))return;let n=t?1e3/(e-t):void 0;return t=e,n}},Ai=t=>zr({...t,label:t.label??"FPS",get:Si(),view:"graph",min:0,max:120,decimals:0},!0);at("fpsgraph",Ai);at("monitor",t=>zr(t));function Ti(t,e){let n=(T,Y,rt)=>Number.isFinite(+T)?Math.max(Y,+T):rt,o=T=>({stiffness:n(T.stiffness,1,300),damping:n(T.damping,.5,26),mass:n(T.mass,.1,1)}),r=T=>Number.isFinite(+T),a=T=>R(r(T)?+T:.5,.1,1),l=T=>R(r(T)?+T:.2,0,1),h=T=>+T.toPrecision(10),c=T=>{let Y=(2*Math.PI/T.visualDuration)**2,rt=1-T.bounce,lt=1;return{stiffness:h(Y),damping:h(2*rt*Math.sqrt(Y*lt)),mass:lt}},u=T=>T==="time"||T==="physics"?T:null,d={stiffness:t.stiffness,damping:t.damping,mass:t.mass,visualDuration:t.visualDuration,bounce:t.bounce,...t.value||{}},O=u(d.mode)??u(t.mode)??(r(d.visualDuration)||r(d.bounce)?"time":"physics"),L={visualDuration:a(d.visualDuration),bounce:l(d.bounce)},b=o({stiffness:d.stiffness,damping:d.damping,mass:d.mass}),m=w("div","tw-spring"),f=w("div","tw-spring-viz"),E=document.createElement("canvas");E.className="tw-spring-canvas",f.append(E);let C=w("div","tw-fields"),B=w("div","tw-fields"),j=E.getContext("2d"),_=()=>o(O==="time"?c(L):b),D=()=>{let T=f.getBoundingClientRect(),Y=Math.max(1,Math.round(T.width)),rt=Math.max(1,Math.round(T.height));if(Y<2)return;let lt=window.devicePixelRatio||1;E.width=Y*lt,E.height=rt*lt,j.setTransform(lt,0,0,lt,0,0),j.clearRect(0,0,Y,rt);let Et=_(),mt=Ye(Et.stiffness,Et.damping,Et.mass,Math.max(160,Math.round(Y*lt))),gt=Math.max(1.05,...mt),vt=8,At=Nt=>vt+Nt/(mt.length-1)*(Y-2*vt),Tt=Nt=>rt-vt-Nt/gt*(rt-2*vt);j.strokeStyle=Wo(m,"--tw-surface-active")||"rgba(255,255,255,0.1)",j.lineWidth=1,j.beginPath(),j.moveTo(vt,Tt(1)),j.lineTo(Y-vt,Tt(1)),j.stroke(),j.strokeStyle=bn(m),j.lineWidth=1.5,j.lineJoin=j.lineCap="round",j.beginPath(),mt.forEach((Nt,H)=>H?j.lineTo(At(H),Tt(Nt)):j.moveTo(At(H),Tt(Nt))),j.stroke()},V=()=>O==="time"?{..._(),visualDuration:L.visualDuration,bounce:L.bounce}:_(),W=()=>e(V()),P={};[["stiffness","Stiffness",1],["damping","Damping",.5],["mass","Mass",.1]].forEach(([T,Y,rt])=>{P[T]=Ot({label:Y,value:b[T],step:rt,min:rt},lt=>{b[T]=lt,D(),W()}),C.append(P[T].el)});let $=Ot({label:"Duration",value:L.visualDuration*1e3,step:50,min:.1*1e3,max:1*1e3,unit:"ms"},T=>{L.visualDuration=a(T/1e3),D(),W()}),Q=Ot({label:"Bounce",value:L.bounce*100,step:5,min:0,max:100,unit:"%"},T=>{L.bounce=l(T/100),D(),W()});B.append($.el,Q.el);let K=()=>{B.style.display=O==="time"?"":"none",C.style.display=O==="physics"?"":"none"},it=me([{value:"time",label:"Time"},{value:"physics",label:"Physics"}],O,T=>{T!=="time"&&T!=="physics"||T===O||(O=T,K(),D(),W())},"Spring mode"),A=w("div","tw-row");A.append(tt("span","tw-row-label","Mode"),it.el),t.label&&m.append(tt("div","tw-spring-label",t.label)),m.append(f,A,C,B);let F=1,y=500,g=1,S=40,k=null,v=T=>{if(!k)return;let Y=R((T.clientX-k.left)/k.width,0,1),rt=R((T.clientY-k.top)/k.height,0,1);O==="time"?($.set((.1+Y*(1-.1))*1e3),L.visualDuration=$.get()/1e3,Q.set((1-rt)*100),L.bounce=Q.get()/100):(P.stiffness.set(F+Y*(y-F)),b.stiffness=P.stiffness.get(),P.damping.set(g+rt*(S-g)),b.damping=P.damping.get()),D(),W()};Qt(f,{onDown:T=>{T.preventDefault(),k=f.getBoundingClientRect(),f.classList.add("is-dragging"),v(T)},onMove:v,onEnd:()=>{k=null,f.classList.remove("is-dragging")}}),K(),Ht(D),jt(E,[[window,"resize"],[window,"tw-reflow"],[matchMedia("(prefers-color-scheme: dark)"),"change"],[window,"tw-retheme"]],D);let I=null,J=!1;return typeof MutationObserver=="function"&&(I=new MutationObserver(()=>{E.isConnected?(J=!0,D()):J&&(I.disconnect(),I=null)}),I.observe(document.documentElement,{subtree:!0,attributes:!0,attributeFilter:["data-tw-scheme"]})),{el:m,destroy:()=>{I&&(I.disconnect(),I=null)},set:T=>{if(!T||typeof T!="object")return;let Y=u(T.mode),rt=r(T.visualDuration)||r(T.bounce),lt=r(T.stiffness)||r(T.damping)||r(T.mass);!rt&&!lt&&!Y||(O=Y??(rt?"time":"physics"),rt&&(r(T.visualDuration)&&(L.visualDuration=a(T.visualDuration)),r(T.bounce)&&(L.bounce=l(T.bounce))),lt&&(b=o({...b,...T})),it.set(O),$.set(L.visualDuration*1e3),Q.set(L.bounce*100),P.stiffness.set(b.stiffness),P.damping.set(b.damping),P.mass.set(b.mass),K(),D())},get:()=>V()}}at("spring",Ti);function Oi(t,e){let n=[.25,.1,.25,1],o=-.25,r=1.25,s=r-o,i=8,a=A=>A.map((F,y)=>R(F,y%2?o:0,y%2?r:1)),l=Array.isArray(t.value)&&t.value.length===4?t.value.map(Number):n.slice();l.some(A=>!Number.isFinite(A))&&(l=n.slice()),l=a(l);let h=l.slice(),c=w("div","tw-bezier");t.label&&c.append(tt("div","tw-bezier-label",t.label));let u=w("div","tw-bezier-graph"),d=Lt("svg","tw-bezier-svg");d.setAttribute("preserveAspectRatio","none");let O=Lt("line","tw-bezier-guide"),L=Lt("line","tw-bezier-guide"),b=Lt("line","tw-bezier-diag"),m=Lt("line","tw-bezier-ctl"),f=Lt("line","tw-bezier-ctl"),E=Lt("path","tw-bezier-curve");d.append(O,L,b,m,f,E);let C=yt("tw-bezier-handle");C.setAttribute("aria-label","Control point 1");let B=yt("tw-bezier-handle");B.setAttribute("aria-label","Control point 2"),u.append(d,C,B);let j=w("div","tw-fields tw-bezier-fields");c.append(u,j);let _=0,D=0,V=A=>i+A*(_-2*i),W=A=>D-i-(A-o)/s*(D-2*i),P=(A,F,y,g,S)=>{A.setAttribute("x1",F),A.setAttribute("y1",y),A.setAttribute("x2",g),A.setAttribute("y2",S)},$=()=>{if(C.setAttribute("aria-label",`Control point 1, x ${l[0]}, y ${l[1]}`),B.setAttribute("aria-label",`Control point 2, x ${l[2]}, y ${l[3]}`),_=u.offsetWidth,D=u.offsetHeight,_<2)return;d.setAttribute("viewBox",`0 0 ${_} ${D}`);let[A,F,y,g]=l,S=V(0),k=W(0),v=V(1),I=W(1),J=V(A),T=W(F),Y=V(y),rt=W(g);P(O,i,k,_-i,k),P(L,i,I,_-i,I),P(b,S,k,v,I),P(m,S,k,J,T),P(f,v,I,Y,rt),E.setAttribute("d",`M${S},${k} C${J},${T} ${Y},${rt} ${v},${I}`),C.style.left=J+"px",C.style.top=T+"px",B.style.left=Y+"px",B.style.top=rt+"px"},Q=[{label:"X1",i:0,lo:0,hi:1},{label:"Y1",i:1,lo:o,hi:r},{label:"X2",i:2,lo:0,hi:1},{label:"Y2",i:3,lo:o,hi:r}],K=Q.map(A=>{let F=Ot({label:A.label,value:l[A.i],step:.01,min:A.lo,max:A.hi},y=>{l[A.i]=y,$(),e(l.slice())});return j.append(F.el),F}),U=()=>K.forEach((A,F)=>A.set(l[Q[F].i])),it=(A,F)=>{let y=null,g=0,S=0,k=1;Qt(A,{onDown:v=>{v.preventDefault(),y=u.getBoundingClientRect(),g=u.offsetWidth||y.width,S=u.offsetHeight||y.height,k=y.width/g,A.classList.add("is-dragging"),A.focus({focusVisible:!1})},onMove:v=>{let I=(v.clientX-y.left)/k,J=(v.clientY-y.top)/k,T=R((I-i)/(g-2*i),0,1),Y=R(o+(S-i-J)/(S-2*i)*s,o,r);l[F*2]=+T.toFixed(2),l[F*2+1]=+Y.toFixed(2),$(),U(),e(l.slice())},onEnd:()=>{y=null,A.classList.remove("is-dragging")}}),A.addEventListener("keydown",v=>{if(v.key==="Escape")return A.blur();if(v.key==="Home"){v.preventDefault(),l=h.slice(),$(),U(),e(l.slice());return}let I=v.key==="ArrowRight"?1:v.key==="ArrowLeft"?-1:0,J=v.key==="ArrowUp"?1:v.key==="ArrowDown"?-1:0;if(!I&&!J)return;v.preventDefault();let T=v.shiftKey?.1:.01,Y=F*2;I&&(l[Y]=+R(l[Y]+I*T,0,1).toFixed(2)),J&&(l[Y+1]=+R(l[Y+1]+J*T,o,r).toFixed(2)),$(),U(),e(l.slice())})};return it(C,0),it(B,1),Ht($),jt(c,[[window,"resize"],[window,"tw-reflow"]],$),{el:c,set:A=>{if(Array.isArray(A)&&A.length===4){let F=A.map(Number);if(F.some(y=>!Number.isFinite(y)))return;l=a(F),$(),U()}},get:()=>l.slice()}}at("cubicbezier",Oi);var ko={ease:[.25,.1,.25,1],linear:[0,0,1,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]},Ni=300,$n=1e4,Pi=16,Kr=.9,qr=t=>!!t&&typeof t=="object",qt=t=>typeof t=="number"?Number.isFinite(t):typeof t=="string"&&t.trim()!==""&&Number.isFinite(+t),Co=t=>{if(typeof t=="string")return Object.prototype.hasOwnProperty.call(ko,t)?ko[t].slice():null;if(Array.isArray(t)&&t.length===4){let e=t.map(Number);return e.every(Number.isFinite)?e:null}return null},Ur=t=>qt(t.stiffness)||qt(t.damping)||qt(t.mass)||qt(t.visualDuration)||qt(t.bounce),Yr=t=>{let e={mode:"time"};if(qt(t.stiffness)){let n=+t.stiffness,o=qt(t.mass)?+t.mass:1,r=Math.sqrt(n/o);e.visualDuration=2*Math.PI/r,qt(t.damping)&&(e.bounce=R(1-+t.damping/(2*Math.sqrt(n*o)),0,Kr))}return qt(t.visualDuration)&&(e.visualDuration=+t.visualDuration),qt(t.bounce)&&(e.bounce=R(+t.bounce,0,Kr)),e},Wr=(t,e)=>t.mode==="spring"||t.mode==="easing"?t.mode:Ur(t)?"spring":Co(t.curve)?"easing":e;function $i(t,e){let n=Vt("cubicbezier"),o=Vt("spring");if(!n||!o)throw new Error("[tweaks] motion: the bezier and spring controls are not loaded");let r=qr(t.value)?t.value:{},s=Wr(r,"easing"),i=Co(r.curve)??ko.ease.slice(),a=qt(r.duration)?R(+r.duration,0,$n):Ni,{root:l,trigger:h,right:c}=zt("tw-motion",t.label??"Motion"),u=w("span","tw-trigger-chip tw-motion-chip"),d=Lt("svg");d.setAttribute("viewBox","0 0 100 100"),d.setAttribute("preserveAspectRatio","none");let O=Lt("path");d.append(O),u.append(d);let L=w("span","tw-trigger-value");c.append(u,L);let b=w("div","tw-color-pop tw-motion-pop"),m=w("div","tw-motion-body");b.append(m);let f=n({...t,type:"cubicbezier",label:"",value:i.slice()},v=>{i=v,S(),Q()});i=f.get();let E=o({...t,type:"spring",label:"",value:Yr(r)},()=>{S(),Q()}),C=Ot({label:"Duration",value:a,step:10,min:0,max:$n,unit:"ms"},v=>{a=R(v,0,$n),S(),Q()});a=C.get();let B=w("div","tw-motion-pane"),j=w("div","tw-motion-pane"),_=w("div","tw-fields");_.append(C.el),B.append(f.el,_),j.append(E.el);let D=w("div","tw-motion-stage"),V=w("div","tw-motion-box");D.append(V);let W=me([{value:"easing",label:"Easing"},{value:"spring",label:"Spring"}],s,v=>{(v==="easing"||v==="spring")&&v!==s&&(s=v,y(),S(),Q())},"Motion type"),P=w("div","tw-row");P.append(tt("span","tw-row-label","Type"),W.el),m.append(P,B,j,D),l.append(b);let $=()=>{if(s==="easing")return{mode:s,curve:i.slice(),duration:a,easing:`cubic-bezier(${i.join(", ")})`};let v=E.get(),I=7/Math.max(v.damping/(2*v.mass),.5),J=R(Math.round(I*40),48,240);return{mode:s,...v,duration:Math.round(I*1e3),easing:`linear(${Ye(v.stiffness,v.damping,v.mass,J,I).map(T=>+T.toFixed(3)).join(", ")})`}},Q=()=>e($()),K=!1,U=null,it=v=>{if(v)K=!K;else if(U&&U.playState==="running")return;let I=$(),J=Math.max(0,D.clientWidth-V.offsetWidth-2*Pi),T=`translateX(${K?0:J}px)`,Y=`translateX(${K?J:0}px)`;if(fe.matches||typeof V.animate!="function"){V.style.transform=Y;return}U?.cancel();let rt=[{transform:T},{transform:Y}];try{U=V.animate(rt,{duration:I.duration,easing:I.easing,fill:"forwards"})}catch{U=V.animate(rt,{duration:I.duration,fill:"forwards"})}};D.addEventListener("click",()=>it(!0)),D.tabIndex=0,D.setAttribute("role","button"),D.setAttribute("aria-label","Replay the motion"),D.addEventListener("keydown",v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),it(!0))});let A=()=>{let v;if(s==="easing"){let[T,Y,rt,lt]=i;v=[];for(let Et=0;Et<=24;Et++){let mt=Et/24,gt=1-mt,vt=3*gt*gt*mt,At=3*gt*mt*mt,Tt=mt*mt*mt;v.push([vt*T+At*rt+Tt,vt*Y+At*lt+Tt])}}else{let T=E.get();v=Ye(T.stiffness,T.damping,T.mass,32).map((Y,rt)=>[rt/31,Y])}let I=Math.max(1,...v.map(T=>T[1])),J=Math.min(0,...v.map(T=>T[1]));return v.map(([T,Y],rt)=>`${rt?"L":"M"}${(10+T*80).toFixed(1)},${(90-(Y-J)/(I-J)*80).toFixed(1)}`).join(" ")},F=()=>{s==="easing"?f.set(i.slice()):E.set(E.get())},y=()=>{B.style.display=s==="easing"?"":"none",j.style.display=s==="spring"?"":"none",F()},g=()=>s==="easing"?`Easing \xB7 ${a} ms`:`Spring \xB7 ${Math.round((E.get().visualDuration??0)*1e3)} ms`,S=()=>{O.setAttribute("d",A()),L.textContent=g(),it(!1)};return Bt(l,h,b,{width:240,fallbackH:380,gap:6,onOpen:()=>{W.set(s),F(),it(!0)},initialFocus:()=>W.el.querySelector('[tabindex="0"]')}),y(),S(),{el:l,set:v=>{let I=typeof v=="string"?{curve:v}:Array.isArray(v)&&v.length===4?{curve:v}:qr(v)?v:null;if(!I)return;s=Wr(I,s);let J=Co(I.curve);J&&(f.set(J.slice()),i=f.get()),s==="easing"&&qt(I.duration)&&(C.set(R(+I.duration,0,$n)),a=C.get()),Ur(I)&&E.set(Yr(I)),W.set(s),y(),S()},get:$,destroy:()=>E.destroy&&E.destroy()}}at("motion",$i);function Ri(t,e){let n=t.components,{root:o,trigger:r,right:s}=zt("tw-point",t.label??"Point"),i=w("span","tw-trigger-value"),a=w("div","tw-trigger-chip tw-point-preview"),l=w("div","tw-point-preview-dot");a.append(l),s.append(a,i);let h=w("div","tw-color-pop tw-point-pop"),c=w("div","tw-point-body");h.append(c);let u=t.pad!==!1&&n.length>=2,d=A=>{let F=oe(Math.abs(Number.isFinite(+A.value)?+A.value:0))[1],y=A.min??-F,g=A.max??F,S=10**Math.floor(Math.log10((g-y)/200));return{lo:y,hi:g,step:A.step??(S>0&&Number.isFinite(S)?S:1)}},O=n.map(d),L=O[0],b=O[1],m=L?.lo??-1,f=L?.hi??1,E=b?.lo??-1,C=b?.hi??1,B=(A,F,y)=>y>F?R((A-F)/(y-F),0,1):.5,j=null,_=null,D=null;if(u){j=w("div","tw-pad"),_=w("div","tw-pad-thumb");let A=Lt("svg","tw-pad-line");A.setAttribute("viewBox","0 0 100 100"),A.setAttribute("preserveAspectRatio","none"),D=Lt("line"),A.append(D);let F=B(0,E,C);D.setAttribute("x1",B(0,m,f)*100),D.setAttribute("y1",(t.invertY?F:1-F)*100),j.append(w("div","tw-pad-axis tw-pad-axis-x"),w("div","tw-pad-axis tw-pad-axis-y"),A,_),c.append(j)}let V=w("div","tw-fields");c.append(V);let W=()=>{it(),U()},P=()=>e(Q()),$=n.map((A,F)=>{let y=Ot({label:A.label,value:A.value??0,step:O[F].step,min:A.min,max:A.max},()=>{W(),P()});return V.append(y.el),y}),Q=()=>Object.fromEntries(n.map((A,F)=>[A.key,$[F].get()])),K=(A,F)=>(+A).toFixed(ne(F)),U=()=>{i.textContent=n.map((A,F)=>K($[F].get(),O[F].step)).join(", ")},it=()=>{l.style.left="50%",l.style.top="50%"};if(u){let F=g=>`calc(${(g*100).toFixed(2)}% + ${((.5-g)*5).toFixed(2)}px)`;it=()=>{let g=B($[0].get(),m,f),S=B($[1].get(),E,C),k=t.invertY?S:1-S,v=g*100,I=k*100;_.style.left=v+"%",_.style.top=I+"%",l.style.left=F(g),l.style.top=F(k),D.setAttribute("x2",v),D.setAttribute("y2",I),j.setAttribute("aria-description",`${n[0].label??n[0].key} ${K($[0].get(),L.step)}, ${n[1].label??n[1].key} ${K($[1].get(),b.step)}`)},Oe(j,g=>{let[S,k]=Ne(g,j),v=t.invertY?k:1-k;$[0].set(m+S*(f-m)),$[1].set(E+v*(C-E)),W(),P()}),j.tabIndex=0,j.setAttribute("role","group"),j.setAttribute("aria-label",`${t.label??"Point"} pad: ${n[0].label??n[0].key} and ${n[1].label??n[1].key}`),j.addEventListener("keydown",g=>{if(g.key==="Home"){g.preventDefault(),n.forEach((I,J)=>$[J].set(I.value??0)),W(),P();return}let S=g.key==="ArrowRight"?1:g.key==="ArrowLeft"?-1:0,k=g.key==="ArrowUp"?1:g.key==="ArrowDown"?-1:0;if(!S&&!k)return;g.preventDefault();let v=g.shiftKey?10:1;S&&$[0].set(R($[0].get()+S*L.step*v,m,f)),k&&$[1].set(R($[1].get()+(t.invertY?-k:k)*b.step*v,E,C)),W(),P()})}return o.append(h),Bt(o,r,h,{width:216,fallbackH:240,gap:6,onOpen:W}),W(),{el:o,set:A=>{A&&n.forEach((F,y)=>{A[F.key]!=null&&$[y].set(A[F.key])}),W()},get:Q}}at("point",Ri);var Fi=Object.assign(Object.create(null),{sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,atan2:Math.atan2,sinh:Math.sinh,cosh:Math.cosh,tanh:Math.tanh,sqrt:Math.sqrt,cbrt:Math.cbrt,abs:Math.abs,exp:Math.exp,log:Math.log,ln:Math.log,log10:Math.log10,log2:Math.log2,floor:Math.floor,ceil:Math.ceil,round:Math.round,sign:Math.sign,trunc:Math.trunc,min:Math.min,max:Math.max,pow:Math.pow,hypot:Math.hypot,mod:(t,e)=>t%e,clamp:(t,e,n)=>Math.min(Math.max(t,e),n)}),Jr=Object.assign(Object.create(null),{pi:Math.PI,e:Math.E,tau:Math.PI*2,phi:(1+Math.sqrt(5))/2});function Lo(t){if(typeof t!="string"||!t.trim()||t.length>512)return null;let e=t,n=[],o=/\d*\.?\d+(?:[eE][+-]?\d+)?/y,r=/[A-Za-z_]\w*/y,s=0;for(;s<e.length;){let b=e[s];if(b===" "||b===" "||b===`
4
- `){s++;continue}if(b>="0"&&b<="9"||b==="."&&e[s+1]>="0"&&e[s+1]<="9"){o.lastIndex=s;let m=o.exec(e);if(!m||m.index!==s)return null;n.push({t:"num",v:parseFloat(m[0])}),s=o.lastIndex;continue}if(b>="A"&&b<="Z"||b>="a"&&b<="z"||b==="_"){r.lastIndex=s;let m=r.exec(e);n.push({t:"id",v:m[0]}),s=r.lastIndex;continue}if(b==="*"&&e[s+1]==="*"){n.push({t:"op",v:"^"}),s+=2;continue}if("+-*/%^".includes(b)){n.push({t:"op",v:b}),s++;continue}if(b==="("){n.push({t:"lp"}),s++;continue}if(b===")"){n.push({t:"rp"}),s++;continue}if(b===","){n.push({t:"comma"}),s++;continue}return null}if(!n.length)return null;let i=0,a=()=>n[i],l=b=>{let m=n[i];return!m||b&&m.t!==b?null:(i++,m)},h=()=>{let b=c();if(!b)return null;for(;a()&&a().t==="op"&&(a().v==="+"||a().v==="-");){let m=l("op").v,f=c();if(!f)return null;let E=b;b=m==="+"?C=>E(C)+f(C):C=>E(C)-f(C)}return b},c=()=>{let b=u();if(!b)return null;for(;a()&&a().t==="op"&&(a().v==="*"||a().v==="/"||a().v==="%");){let m=l("op").v,f=u();if(!f)return null;let E=b;b=m==="*"?C=>E(C)*f(C):m==="/"?C=>E(C)/f(C):C=>E(C)%f(C)}return b},u=()=>{if(a()&&a().t==="op"&&(a().v==="-"||a().v==="+")){let b=l("op").v,m=u();return m?b==="-"?f=>-m(f):m:null}return d()},d=()=>{let b=O();if(!b)return null;if(a()&&a().t==="op"&&a().v==="^"){l("op");let m=u();return m?f=>Math.pow(b(f),m(f)):null}return b},O=()=>{let b=a();if(!b)return null;if(b.t==="num")return l("num"),()=>b.v;if(b.t==="lp"){l("lp");let m=h();return!m||!l("rp")?null:m}if(b.t==="id"){l("id");let m=b.v.toLowerCase();if(a()&&a().t==="lp"){let f=Fi[m];if(!f)return null;l("lp");let E=[];if(a()&&a().t!=="rp")do{let C=h();if(!C)return null;E.push(C)}while(l("comma"));return l("rp")?C=>f(...E.map(B=>B(C))):null}if(m==="x")return f=>f;if(m in Jr){let f=Jr[m];return()=>f}return null}return null},L=h();return L&&i===n.length?L:null}function _i(t,e){let n=Number(t.xMin??t.min),o=Number(t.xMax??t.max);if(Number.isFinite(n)||(n=-10),Number.isFinite(o)||(o=10),o<n){let C=n;n=o,o=C}o===n&&(n-=1,o+=1);let r=Math.max(2,Math.min(4096,t.samples|0||256)),s=Number.isFinite(t.yMin)&&Number.isFinite(t.yMax)&&+t.yMax>+t.yMin,i=typeof t.fn=="function"?t.fn:null,a=t.editable!==!1&&!i,l=t.expr!=null?String(t.expr):i?"":"sin(x)",h=i||Lo(l),c=w("div","tw-plot");t.label&&c.append(tt("div","tw-plot-label",t.label));let u=w("div","tw-plot-graph"),d=Lt("svg","tw-plot-svg");d.setAttribute("preserveAspectRatio","none");let O=Lt("line","tw-plot-axis"),L=Lt("line","tw-plot-axis"),b=Lt("path","tw-plot-curve");d.append(O,L,b),u.append(d),c.append(u);let m=null;if(a){let C=w("div","tw-plot-field");m=w("input","tw-plot-input"),m.type="text",m.value=l,m.spellcheck=!1,m.autocapitalize="off",m.autocomplete="off",Xt(m),m.setAttribute("aria-label",`${t.label||"Plot"} \u2014 expression in x`),m.setAttribute("aria-invalid","false"),C.append(tt("span","tw-plot-fx","y ="),m),c.append(C)}let f=6,E=()=>{let C=typeof h=="function";c.classList.toggle("is-invalid",a&&!C),m&&m.setAttribute("aria-invalid",a&&!C?"true":"false");let B=u.getBoundingClientRect(),j=B.width,_=B.height;if(j<2)return;d.setAttribute("viewBox",`0 0 ${j} ${_}`);let D=[],V=1/0,W=-1/0;if(C)for(let F=0;F<r;F++){let y=n+(o-n)*(F/(r-1)),g;try{g=h(y)}catch{g=NaN}D.push(g),Number.isFinite(g)&&(g<V&&(V=g),g>W&&(W=g))}let P=t.yMin,$=t.yMax;if(!s)if(!Number.isFinite(V)||V===W){let F=Number.isFinite(V)?V:0;P=F-1,$=F+1}else{let F=(W-V)*.12;P=V-F,$=W+F}let Q=F=>f+(F-n)/(o-n)*(j-2*f),K=F=>_-f-(F-P)/($-P)*(_-2*f),U=(F,y,g,S,k,v)=>{F.style.display=v?"":"none",v&&(F.setAttribute("x1",y),F.setAttribute("y1",g),F.setAttribute("x2",S),F.setAttribute("y2",k))};U(O,f,K(0),j-f,K(0),P<=0&&$>=0),U(L,Q(0),f,Q(0),_-f,n<=0&&o>=0);let it="",A=!1;if(C)for(let F=0;F<r;F++){let y=D[F];if(!Number.isFinite(y)){A=!1;continue}let g=Q(n+(o-n)*(F/(r-1))),S=R(K(y),-1e4,1e4);it+=(A?"L":"M")+g.toFixed(1)+","+S.toFixed(1)+" ",A=!0}b.setAttribute("d",it)};return a&&m.addEventListener("input",()=>{l=m.value,h=Lo(l),E(),e(l)}),Ht(E),jt(c,[[window,"resize"],[window,"tw-reflow"]],E),{el:c,get:()=>l,set:C=>{C!=null&&(l=String(C),m&&(m.value=l),i||(h=Lo(l)),E())}}}at("plot",_i);var He={},Rn={},Hi=t=>Vt(t)||!He[t]?null:Rn[t]||(Rn[t]=He[t]().catch(e=>{throw delete Rn[t],console.error(`[tweaks] control chunk "${t}" failed to load:`,e),e})),So=(t,e=new Set)=>{for(let n of t)if(n&&(He[n.type]&&e.add(n.type),n.children&&So(n.children,e),n.pages))for(let o of n.pages)So(o.children,e);return e},De=t=>{let e=[...So(t)].map(Hi).filter(Boolean);return e.length?Promise.all(e):null};var Zr=Pt('<path class="tw-copy-back" d="m5.5 16.5-.7-.2q-1.5-.6-2.1-2.1-.2-.7-.2-2.7v-2c0-3.3 0-5 1-6s2.7-1 6-1h2c1.4 0 2 0 2.7.2q1.6.5 2.1 2.1l.2.7"/><path class="tw-copy-front" d="M7.5 14.5c0-3.3 0-5 1-6s2.7-1 6-1 5 0 6 1 1 2.7 1 6 0 5-1 6-2.7 1-6 1-5 0-6-1-1-2.7-1-6"/>',"tw-toolbar-btn__copy"),Qr=Pt('<path d="m5 14 3.5 3.5L19 6.5"/>',"tw-toolbar-btn__check",2.4),ts=Pt('<path d="M3 12a9 9 0 1 0 9-9 9 9 0 0 0-7.6 4.2M3.3 3l.2 2q0 2.2.6 2.7t2.7.2l2-.2"/>'),es=Pt('<path d="m17 17 4 4m-2-10a8 8 0 0 0-16 0 8 8 0 0 0 16 0"/>'),Ao=t=>Pt('<path d="M18 9s-4.4 6-6 6-6-6-6-6"/>',t,2.5),ns=Ao("tw-chevron"),os=Pt('<path d="M20.2 13.5q1.8.8 1.8 1.5 0 .8-2.7 2l-5 2.2Q13 20 12 20q-.7 0-2.4-.8l-4.9-2.3Q2 16 2 15t1.8-1.5"/><path class="tw-layer-top" d="M9.6 4.8Q11.3 4 12 4t2.4.8l4.9 2.3Q22 8 22 9c0 .7-.9 1.1-2.7 2l-5 2.2Q13 14 12 14q-.7 0-2.4-.8l-4.9-2.3Q2 10 2 9c0-.7.9-1.1 2.7-2z"/>'),rs=Pt('<path d="M18 6 6 18m12 0L6 6"/>',"",2.2),To=Pt('<circle cx="12" cy="12" r="10"/><path d="M12 16v-4m-.25-3.75a.25.25 0 0 0 .5 0 .25.25 0 0 0-.5 0"/>');var Qe=(t,e,n)=>{let o=yt("tw-toolbar-btn"+(t?" "+t:""),e);return o.title=n,o.setAttribute("aria-label",n),o},Hn=(t,e,n)=>{let o=Qe("tw-toolbar-btn--swap",`<span class="tw-toolbar-btn__icons">${Zr}${Qr}</span>`,"Copy values (\u21E7: changed only)");return o.addEventListener("click",async r=>{if(o.disabled)return;let[s,i]=n(r.shiftKey);if(!i){ae("Nothing has changed",t);return}await ji(s)?(Di(o),ae(i>0?`${i} changed value${i===1?"":"s"} copied`:`${e()} values copied`,t)):ae("Copy failed",t)}),o},Dn=t=>{let e=Qe("tw-toolbar-btn--reset",ts,"Reset");return e.addEventListener("click",()=>{e.disabled||(Oo(e),t())}),e},Di=t=>{t.classList.add("is-copied"),clearTimeout(t._t),t._t=setTimeout(()=>t.classList.remove("is-copied"),1400)},Oo=t=>{let e=t.querySelector("svg");t._spinSettle||(t._spinSettle=()=>{clearTimeout(t._t),t.classList.remove("is-spinning"),e.style.transition="none",e.style.setProperty("--tw-spin","0deg"),e.getBoundingClientRect(),e.style.transition=""},e.addEventListener("transitionend",o=>{o.propertyName==="transform"&&t.classList.contains("is-spinning")&&performance.now()-t._spinT>250&&t._spinSettle()})),t._spinT=performance.now(),e.style.setProperty("--tw-spin",`${(parseFloat(e.style.getPropertyValue("--tw-spin"))||0)-360}deg`),t.classList.add("is-spinning"),clearTimeout(t._t);let n=()=>{e.getAnimations&&e.getAnimations().length?t._t=setTimeout(n,250):t._spinSettle()};t._t=setTimeout(n,600)},ie=null,ss=0;function ae(t,e){ie||(ie=w("div","tw-toast tw-portal"),ie.setAttribute("role","status")),ie.isConnected||document.body.appendChild(ie),ie.textContent=t,ye(ie,e),ie.classList.add("is-open"),clearTimeout(ss),ss=setTimeout(()=>ie.classList.remove("is-open"),1600)}var Rt=null,Fn=0,_n=null,as=t=>{t.key==="Escape"&&tn()},tn=t=>{t&&_n&&!t.contains(_n)||(clearTimeout(Fn),document.removeEventListener("keydown",as),Rt&&Rt.classList.remove("is-open"))};function Ii(t,e){Rt||(Rt=w("div","tw-tip tw-portal"),Rt.setAttribute("role","tooltip")),Rt.isConnected||document.body.appendChild(Rt),clearTimeout(Fn),Rt.textContent=e,ye(Rt,t);let n=Rt.classList.contains("is-open");Rt.style.visibility="hidden",Rt.classList.add("is-open"),Zn(t,Rt,{align:"center",prefer:"above",gap:8}),Rt.style.visibility="",document.addEventListener("keydown",as),_n=t,n||requestAnimationFrame(function o(){if(Rt.classList.contains("is-open")){if(!_n.isConnected)return tn();requestAnimationFrame(o)}})}function is(){Rt&&(clearTimeout(Fn),Fn=setTimeout(tn,80))}var No=".tw-slider-label, .tw-row-label, .tw-select-label, .tw-trigger-label, .tw-radiogrid-label, .tw-field-label, .tw-folder-title, .tw-fps-label, .tw-plot-label";function Ie(t,e){let n=t.querySelector(No)||t;if(n===t&&t.classList.contains("tw-separator"))return;let o=n.closest("button"),r=o?w("span","tw-hint",To):yt("tw-hint",To),s=()=>Ii(r,e);if(o){r.setAttribute("aria-hidden","true");let i=o.getAttribute("aria-description");o.setAttribute("aria-description",i?`${i}. ${e}`:e)}else r.setAttribute("aria-label",e),r.addEventListener("focus",s),r.addEventListener("blur",is),r.addEventListener("keydown",i=>{(i.key==="Enter"||i.key===" ")&&i.stopPropagation()});r.addEventListener("pointerenter",s),r.addEventListener("pointerleave",is),r.addEventListener("pointerdown",i=>i.stopPropagation()),r.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation()}),n.appendChild(r)}async function ji(t){try{return await navigator.clipboard.writeText(t),!0}catch{}let e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.top="-9999px",document.body.appendChild(e),e.focus(),e.select();let n=!1;try{n=document.execCommand("copy")}catch{}return document.body.removeChild(e),n}function ke(t,e,n=0){if(jn(t))return null;let o=Gi(t,e,n);return o&&e&&typeof e=="object"&&(typeof e.render=="function"&&(o.render=e.render),e.disabled!=null&&(o.disabled=e.disabled),e.hint!=null&&(o.hint=String(e.hint)),e.persist===!1&&(o.persist=!1)),o}var le=t=>t&&typeof t=="object",be=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),jn=t=>t==="__proto__"||t==="constructor"||t==="prototype",ce=(t,e)=>t!==e&&!(le(t)&&le(e)&&JSON.stringify(t)===JSON.stringify(e)),Bn=(t,e,n)=>{t.set(n),t.set(e)},ls=t=>Array.isArray(t.options)&&{type:"radiogrid",options:t.options,value:t.value??re(t.options[0]),cols:t.cols},Bi=(t,...e)=>{let n=(e.length?e:[0]).map(s=>oe(Number.isFinite(+s)?+s:0)),o=t.min??Math.min(...n.map(s=>s[0])),r=t.max??Math.max(...n.map(s=>s[1]));return{min:o,max:r,step:t.step??Ae(o,r)}},Po=(t,e)=>t.label==null?e:String(t.label),cs=t=>typeof t=="function"?t:void 0,us=t=>typeof t=="string"&&t.trim()?t.trim().slice(0,12):void 0,$o=["stiffness","damping","mass","visualDuration","bounce"],ds={slider:t=>{let e=Bi(t,t.value??t.min??0);return{value:t.value??e.min,...e,soft:t.soft,unit:us(t.unit),format:cs(t.format),parse:cs(t.parse)}},number:t=>({value:t.value??0,min:t.min,max:t.max,step:t.step??1,soft:t.soft,unit:us(t.unit)}),checkbox:t=>({value:!!t.value}),radiogrid:ls,segmented:ls,list:t=>Array.isArray(t.options)&&{options:t.options,value:t.value??re(t.options[0])},text:t=>({value:t.value??"",rows:t.rows,placeholder:t.placeholder}),spring:t=>{let e=le(t.value)?t.value:t,n={stiffness:e.stiffness??300,damping:e.damping??26,mass:e.mass??1};Number.isFinite(+e.visualDuration)&&(n.visualDuration=+e.visualDuration),Number.isFinite(+e.bounce)&&(n.bounce=+e.bounce);let o=t.mode??e.mode;return(o==="time"||o==="physics")&&(n.mode=o),{value:n}},motion:t=>{let e=typeof t.value=="string"||Array.isArray(t.value)?{...t,curve:t.value}:le(t.value)?t.value:t,n=$o.some(r=>e[r]!=null),o={curve:"ease",duration:300,...n?{}:{visualDuration:.5,bounce:.2}};for(let r of["mode","curve","duration",...$o])e[r]!=null&&(o[r]=e[r]);return o.mode!=="easing"&&o.mode!=="spring"&&(o.mode=n?"spring":"easing"),{value:o}},point:t=>{if(!Array.isArray(t.components)||!t.components.length)return!1;let e=new Set,n=t.components.map((o,r)=>{let s=String(o.key??((o.label?String(o.label).toLowerCase():"")||`c${r}`)),i=s,a=2;for(;e.has(i);)i=`${s}-${a++}`;return e.add(i),{...o,key:i}});return{components:n,pad:t.pad,invertY:t.invertY,value:Object.fromEntries(n.map(o=>[o.key,o.value??0]))}},buttongroup:t=>({buttons:t.buttons}),separator:()=>({}),tabs:(t,e)=>{if(!t.pages||typeof t.pages!="object"||!Object.keys(t.pages).length)return!1;let n=new Set;return{pages:Object.entries(t.pages).map(([o,r])=>{let s=o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"tab",i=s,a=2;for(;n.has(i);)i=`${s}-${a++}`;return n.add(i),{key:i,title:o.trim()?o:"Tab",children:Object.entries(r).map(([l,h])=>ke(l,h,e+1)).filter(Boolean)}})}}},Vi=Object.assign(Object.create(null),{list:"options",radiogrid:"options",segmented:"options",point:"components",tabs:"pages"});function Gi(t,e,n=0){if(n>64)return null;let o=ln(t),r=(s,i,a=o)=>({type:s,key:t,label:a,...i});if(le(e)&&!Array.isArray(e)&&be(ds,e.type)){let s;try{s=ds[e.type](e,n)}catch(i){return console.error(`[tweaks] malformed "${e.type}" schema value for "${t}" \u2014 control skipped:`,i),null}if(s)return r(String(e.type),s,Po(e,o));if(be(e,Vi[e.type]))return console.error(`[tweaks] malformed "${e.type}" schema value for "${t}" \u2014 control skipped`),null}else if(le(e)&&!Array.isArray(e)&&typeof e.type=="string"&&(He[e.type]||Vt(e.type))){let{type:s,label:i,...a}=e;return r(s,a,Po(e,o))}if(Array.isArray(e)&&Array.isArray(e[0])&&e[0].length===2&&typeof e[0][0]=="number"){let s=Number.isFinite(+e[1])?+e[1]:+e[0][0],i=Number.isFinite(+e[2])?+e[2]:+e[0][1];return r("interval",{value:e[0].map(Number),min:s,max:i,step:e[3]??Ae(s,i)})}if(Array.isArray(e)&&e.length<=4&&typeof e[0]=="number"){let s=e[0],[i,a]=oe(s),l=e.length>1?e[1]:i,h=e.length>2?e[2]:a;return r("slider",{value:s,min:l,max:h,step:e[3]??Ae(l,h)})}if(typeof e=="number"){let[s,i]=oe(e);return r("slider",{value:e,min:s,max:i,step:Ae(s,i)})}return typeof e=="boolean"?r("checkbox",{value:e}):Array.isArray(e)?r("list",{options:e,value:re(e[0])}):le(e)&&typeof e.action=="function"?r("button",{action:e.action},Po(e,o)):le(e)&&Array.isArray(e.options)?r("list",{options:e.options,value:e.value??re(e.options[0])}):Ko(e)?r("color",{value:e}):typeof e=="string"?r("text",{value:e}):le(e)?r("folder",{children:Object.entries(e).filter(([s,i])=>!(s==="render"&&typeof i=="function")&&!((s==="disabled"||s==="hint")&&i!=null)).map(([s,i])=>ke(s,i,n+1)).filter(Boolean)}):null}var Vn=new Set(["button","fpsgraph","monitor","buttongroup","separator"]),ps=t=>({...Object.fromEntries($o.map(e=>[e,ht(t[e])])),mode:t.mode}),fs={slider:t=>({value:ht(t.value),min:ht(t.min),max:ht(t.max),step:ht(t.step),soft:In(t.soft),unit:t.unit}),checkbox:t=>t.options?{type:"radiogrid",options:en(t.options),value:t.value,cols:ht(t.cols)}:{value:t.checked==="true"},radiogrid:t=>({options:en(t.options),value:t.value,cols:ht(t.cols)}),list:t=>({options:en(t.options),value:t.value}),button:(t,e,n)=>({action:()=>ae(`${n} pressed`,e)}),buttongroup:(t,e)=>({buttons:en(t.buttons).map(n=>({label:n,action:()=>ae(`${n} pressed`,e)}))}),separator:()=>({}),number:t=>({value:ht(t.value),min:ht(t.min),max:ht(t.max),step:ht(t.step),unit:t.unit}),text:t=>({value:t.value??"",placeholder:t.placeholder,rows:ht(t.rows)}),fpsgraph:t=>({label:t.label??"FPS"}),interval:t=>({value:t.value?t.value.split(",").map(Number):void 0,min:ht(t.min),max:ht(t.max),step:ht(t.step)}),sides:t=>({value:t.value??t,corners:In(t.corners),unit:t.unit,step:ht(t.step),min:ht(t.min),max:ht(t.max)}),shadow:t=>({value:t.value??{...t,inset:In(t.inset)}}),spring:ps,motion:t=>({...ps(t),curve:t.curve&&t.curve.includes(",")?t.curve.split(",").map(Number):t.curve,duration:ht(t.duration)}),cubicbezier:t=>({value:t.value?t.value.split(",").map(Number):void 0}),point:t=>{let e=(t.value||"").split(",").map(n=>parseFloat(n));return{components:en(t.components||"X,Y").map((n,o)=>({key:n.toLowerCase(),label:n,value:isNaN(e[o])?0:e[o],step:ht(t.step),min:ht(t.min),max:ht(t.max)})),pad:In(t.pad),invertY:t.invertY==="true"}},plot:t=>({expr:t.expr,xMin:ht(t.xmin),xMax:ht(t.xmax),yMin:ht(t.ymin),yMax:ht(t.ymax),samples:ht(t.samples),editable:t.editable!=="false"})},ht=t=>{if(t==null||t==="")return;let e=+t;return Number.isFinite(e)?e:void 0},In=t=>t==="true"||t==="",en=t=>(t||"").split(",").map(e=>e.trim()).filter(Boolean),ms=t=>{let e=t.dataset,n=e.tw,o=e.label??ln(e.key||n),r=be(fs,n)?fs[n](e,t,o):He[n]||Vt(n)?{...e}:null;return r?ke("v",{type:n,label:o,...r}):null};var Xi=3,gs=32,bs=200,hs=8;function zi(t,e){let n=t.label,{min:o,max:r,step:s}=cn(t.min,t.max,t.step);t.soft||([o,r]=Se(o,r,s));let i=(r-o)/s<=6,a=Number.isFinite(+t.value)?+t.value:o,l=t.soft&&!i?a:R(a,o,r),h=0,c=ne(s),u=w("div","tw-slider-wrap"),d=w("div","tw-slider"),O=w("div","tw-slider-hashmarks"),L=w("div","tw-slider-fill"),b=w("div","tw-slider-handle"),m=tt("span","tw-slider-label",n),f=w("span","tw-slider-value"),E=typeof t.unit=="string"?t.unit.trim():"",C=document.createTextNode(""),B=E?/^[%°]$/.test(E)?E:" "+E:"";f.append(C),E&&f.append(tt("span","tw-slider-unit",B));let j=t.format,_=t.parse,D=N=>{if(j)try{let et=j(N);if(typeof et=="string"&&et)return et}catch{}return N.toFixed(c)};d.append(O,L,b,m,f),u.append(d),d.tabIndex=0,d.setAttribute("role","slider"),d.setAttribute("aria-label",n),d.setAttribute("aria-valuemin",String(o)),d.setAttribute("aria-valuemax",String(r));let V=N=>ve(N,o,s),W=i?Array.from({length:Math.max(0,Math.round((r-o)/s)-1)},(N,et)=>(et+1)*s/(r-o)*100):[];for(let N of W){let et=w("div","tw-slider-hashmark");et.style.left=N+"%",O.append(et)}let P=()=>{let N=R((l-o)/(r-o||1)*100,0,100),et=h?` + ${h.toFixed(1)}px`:"",pt=`${N}%${et}`;L.style.width=h?`calc(${pt})`:N+"%",b.style.left=`max(5px, calc(${pt} - 9px))`;let bt=V(l),ut=D(bt);C.data=ut,d.setAttribute("aria-valuenow",String(bt)),d.setAttribute("aria-valuetext",ut+B);let Ct=u.offsetWidth,Gt=f.offsetWidth;if(Ct){Gt&&(m.style.maxWidth=Math.max(0,Ct-Gt-30)+"px");let Jt=Math.max(5,N/100*Ct+h-9);d.classList.toggle("is-dodge",un(m,f,Jt,3))}};P();let $=null,Q=1,K=null,U=!0,it,A=null,F=null,y=`width 0.34s ${eo}`,g=`left 0.34s ${eo}, opacity 0.15s, transform 0.2s ${Ke}`,S=.2,k=N=>{if(!$)return l;let et=u.offsetWidth||$.width,pt=R((N-$.left)/Q/et,0,1);return R(o+pt*(r-o),o,r)},v=N=>{let et=0;N<$.left?et=-hs*Math.sqrt(Math.min(Math.max(0,$.left-N-gs)/bs,1)):N>$.right&&(et=hs*Math.sqrt(Math.min(Math.max(0,N-$.right-gs)/bs,1))),d.style.width=`calc(100% + ${Math.abs(et)}px)`,d.style.transform=et<0?`translateX(${et}px)`:""},I=(N,et=!0)=>{N=+N,Number.isFinite(N)&&(l=i?R(V(N),o,r):t.soft?N:R(N,o,r),P(),et&&e(V(l)))},J=Math.max(1,Math.round((r-o)/s)),T=.2,Y=.3,rt=520,lt=27,Et=N=>(N-o)/s,mt=0,gt=0,vt=0,At=!1,Tt=null,Nt=l,H=0,G=()=>{vt&&cancelAnimationFrame(vt),vt=0,H=0},dt=N=>{if(!d.isConnected){G();return}let et=H?Math.min((N-H)/1e3,.05):1/60;H=N;let pt=u.offsetWidth||$&&$.width||1,bt=Et(R(Nt,o,r)),ut=R(Math.round(bt+T),0,J),Ct=At?ut+Y*R(bt-ut,-.5,.5):ut;if(fe&&fe.matches)mt=Ct,gt=0;else{let Gt=et,Jt=1/240;for(;Gt>1e-4;){let Ft=Math.min(Jt,Gt);Gt-=Ft;let Zt=rt*(Ct-mt)-lt*gt;gt+=Zt*Ft,mt+=gt*Ft,mt<0&&(mt=0,gt=0),mt>J&&(mt=J,gt=0)}}h=(mt-ut)*s/(r-o||1)*pt,l=R(o+ut*s,o,r),P(),ut!==Tt&&(Tt=ut,e(V(l))),!At&&Math.abs(gt)<.004&&Math.abs(mt-ut)<.004?(mt=ut,gt=0,h=0,P(),G(),d.classList.remove("is-active")):vt=requestAnimationFrame(dt)},ct=N=>{mt=Et(l),gt=0,At=!0,Tt=Math.round(Et(l)),Nt=k(N),vt||(vt=requestAnimationFrame(dt))};d.addEventListener("pointerdown",N=>{if(!f.classList.contains("is-editing")&&!(N.button!==0||K)){N.preventDefault(),d.focus({focusVisible:!1}),F=N.pointerId;try{N.target.setPointerCapture(N.pointerId)}catch{}clearTimeout(it),d.style.transition="",K={x:N.clientX,y:N.clientY},U=!0,d.classList.add("is-active"),$=u.getBoundingClientRect(),Q=$.width/(u.offsetWidth||$.width),i?(L.style.transition="",b.style.transition="",ct(N.clientX)):(L.style.transition=y,b.style.transition=g,I(k(N.clientX)))}}),d.addEventListener("pointermove",N=>{if(!(!K||N.pointerId!==F)){if(N.buttons===0){kt();return}if(U&&Math.hypot(N.clientX-K.x,N.clientY-K.y)>Xi&&(U=!1,d.classList.add("is-dragging"),i||(L.style.transition="",b.style.transition="")),!U)if(v(N.clientX),i)Nt=k(N.clientX);else{let et;if(N.altKey){A||(A={x:N.clientX,v:l});let pt=u.offsetWidth||$.width;et=R(A.v+(N.clientX-A.x)/pt*(r-o)*S,o,r)}else A=null,et=k(N.clientX);I(et)}N.clientX>=$.left&&N.clientX<=$.right&&(d.style.width="",d.style.transform="")}});let kt=N=>{!K||N&&N.pointerId!==F||(i?(At=!1,d.classList.remove("is-dragging"),vt||(vt=requestAnimationFrame(dt))):(it=setTimeout(()=>{L.style.transition="",b.style.transition=""},360),d.classList.remove("is-active","is-dragging")),d.style.transition=`width 0.35s ${Ke}, transform 0.35s ${Ke}`,d.style.width="",d.style.transform="",setTimeout(()=>{d.style.transition=""},360),K=null,A=null,F=null)};d.addEventListener("pointerup",kt),d.addEventListener("pointercancel",kt),d.addEventListener("lostpointercapture",kt),dn(d,P),Ht(P),jt(d,[[window,"resize"]],P),d.addEventListener("keydown",N=>{if(N.target!==d||K)return;let et=pe(N,l,s,o,r,(r-o)/10||s*10);et!=null&&(N.preventDefault(),i&&(G(),h=0,d.classList.remove("is-active")),I(R(et,o,r)))});let Dt;f.addEventListener("mouseenter",()=>{Dt=setTimeout(()=>f.classList.add("is-editable"),800)}),f.addEventListener("mouseleave",()=>{clearTimeout(Dt),f.classList.contains("is-editing")||f.classList.remove("is-editable")}),f.addEventListener("pointerdown",N=>{N.pointerType&&N.pointerType!=="mouse"?(f.classList.add("is-editable"),N.stopPropagation()):f.classList.contains("is-editable")&&N.stopPropagation()});let $t=()=>{if(f.classList.contains("is-editing"))return;let N=w("input","tw-slider-input");N.type="text",N.inputMode=_?"text":"decimal",Xt(N),N.value=_?D(V(l)):V(l).toFixed(c);let et=N.value;N.style.width=et.length+1+"ch",f.classList.add("is-editing"),f.replaceWith(N),N.focus(),N.select();let pt=()=>{N.replaceWith(f),f.classList.remove("is-editing","is-editable")},bt=()=>{let ut=N.value,Ct=NaN;if(ut!==et)try{Ct=_?_(ut):Number(ut.replace(E,"").trim()||NaN)}catch{}Number.isFinite(Ct)&&I(t.soft?Ct:R(Ct,o,r)),pt()};N.addEventListener("pointerdown",ut=>ut.stopPropagation()),N.addEventListener("blur",bt),N.addEventListener("keydown",ut=>{ut.key==="Enter"?(N.removeEventListener("blur",bt),d.focus(),bt()):ut.key==="Escape"&&(ut.stopPropagation(),N.removeEventListener("blur",bt),d.focus(),pt())})};return f.addEventListener("click",()=>{f.classList.contains("is-editable")&&$t()}),d.addEventListener("keydown",N=>{N.key==="Enter"&&N.target===d&&!K&&(N.preventDefault(),$t())}),{el:u,set:N=>I(N,!1),get:()=>V(l)}}function Ki(t,e){let n=w("div","tw-row"),o=me([{value:"off",label:"Off"},{value:"on",label:"On"}],t.value?"on":"off",r=>e(r==="on"),t.label);return n.append(tt("span","tw-row-label",t.label),o.el),{el:n,set:r=>o.set(r?"on":"off"),get:()=>o.get()==="on"}}function qi(t,e){let n=t.options||[],o=Math.min(3,Math.max(2,t.cols||(n.length<=3?n.length:n.length===4?2:3))),r=w("div","tw-radiogrid"),s=w("div","tw-radiogrid-grid");s.style.setProperty("--tw-rg-cols",o),s.setAttribute("role","radiogroup"),s.setAttribute("aria-label",t.label);let i=t.value??re(n[0]),a=n.map(c=>{let u=ro("tw-radiogrid-btn",c,d=>h(d));return s.append(u),u}),l=()=>oo(a,i),h=(c,u=!0)=>{c!=null&&!a.some(d=>d._twVal===c)||(i=c,l(),u&&e(c))};return s.addEventListener("keydown",c=>{let u=gn(a,i);if(u<0)return;let d=qe(c.key,u,a.length,o);d<0||(c.preventDefault(),d!==u&&(h(a[d]._twVal),a[d].focus()))}),l(),r.append(tt("span","tw-radiogrid-label",t.label),s),{el:r,set:c=>h(c,!1),get:()=>i}}var Yi=/^(?:#[0-9a-f]{3,8}|[a-z]+|(?:oklch|oklab|rgba?|hsla?|hwb|lab|lch|color|var)\([^()]*\))$/i,Wi=Ao("tw-select-chevron");function Ui(t,e){let n=t.value,o=t.options.map(m=>({value:re(m),label:Wn(m),color:m&&typeof m=="object"&&typeof m.color=="string"&&Yi.test(m.color.trim())?m.color.trim():""})),r=w("div","tw-select"),s=yt("tw-select-trigger");s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-expanded","false");let i=w("span","tw-select-right"),a=m=>`linear-gradient(${m}, ${m}), var(--tw-checker)`,l=m=>{let f=w("span","tw-option-swatch");return f.style.background=a(m),f},h=w("span","tw-option-swatch"),c=w("span","tw-select-value");i.append(h,c),i.insertAdjacentHTML("beforeend",Wi),s.append(tt("span","tw-select-label",t.label),i);let u=w("div","tw-select-dropdown");u.setAttribute("role","listbox");let d=o.map(m=>{let f=yt("tw-select-option");return f.setAttribute("role","option"),m.color&&f.append(l(m.color)),f.append(tt("span","tw-option-label",m.label)),f.dataset.value=m.value,f.addEventListener("click",()=>{L(m.value),b.close()}),u.append(f),f});r.append(s,u);let O=()=>{let m=o.find(f=>f.value===n);c.textContent=m?.label??n,h.style.display=m?.color?"":"none",m?.color&&(h.style.background=a(m.color)),d.forEach(f=>{let E=f.dataset.value===String(n);f.dataset.selected=String(E),f.setAttribute("aria-selected",String(E))})},L=(m,f=!0)=>{m!=null&&!o.some(E=>E.value===m)||(n=m,O(),f&&e(m))},b=Bt(r,s,u,{width:"match",fallbackH:200,gap:4,onOpen:()=>(d.find(m=>m.dataset.value===String(n))||d[0])?.focus()});return s.addEventListener("keydown",m=>{!b.isOpen()&&(m.key==="ArrowDown"||m.key==="ArrowUp")&&(m.preventDefault(),b.open())}),u.addEventListener("keydown",m=>{let f=d.indexOf(document.activeElement),E=f;if(m.key==="ArrowDown")E=f<0?0:Math.min(d.length-1,f+1);else if(m.key==="ArrowUp")E=f<0?d.length-1:Math.max(0,f-1);else if(m.key==="Home")E=0;else if(m.key==="End")E=d.length-1;else return;m.preventDefault(),d[E]?.focus()}),O(),{el:r,set:m=>L(m,!1),get:()=>n}}function Ji(t){let e=tt("button","tw-button",t.label);return e.addEventListener("click",()=>t.action&&t.action()),se(e)}function Zi(t){let e=w("div","tw-row tw-buttongroup");t.label&&e.append(tt("span","tw-row-label",t.label));let n=w("div","tw-buttongroup-btns"),o=Array.isArray(t.buttons)?t.buttons.map(r=>[r.label??"Button",r.action]):Object.entries(t.buttons||{});for(let[r,s]of o){let i=tt("button","tw-buttongroup-btn",r);i.addEventListener("click",()=>typeof s=="function"&&s()),n.append(i)}return e.append(n),se(e)}var Qi=()=>se(w("div","tw-separator"));function ta(t,e){let n=l=>l==null?"":typeof l=="object"?ze(l):String(l),o=n(t.value),r=t.rows>0,s=w("div",r?"tw-row tw-row-multiline":"tw-row"),i=w(r?"textarea":"input",r?"tw-text tw-textarea":"tw-text");r?i.rows=t.rows:i.type="text",i.value=o,Xt(i),t.placeholder&&(i.placeholder=t.placeholder),i.addEventListener("input",()=>{o=i.value,e(o)});let a=()=>{let l=i.scrollHeight-i.clientHeight>1;i.classList.toggle("is-clip-top",l&&i.scrollTop>1),i.classList.toggle("is-clip-bottom",l&&i.scrollTop+i.clientHeight<i.scrollHeight-1)};return r&&(i.addEventListener("scroll",a),i.addEventListener("input",a),typeof ResizeObserver=="function"&&new ResizeObserver(a).observe(i)),s.append(tt("span","tw-row-label",t.label),i),{el:s,set:l=>{o=n(l),i.value=o,r&&a()},get:()=>o}}function nn(t){let e=w("div","tw-folder"),n=yt("tw-folder-header");n.setAttribute("aria-expanded","true"),n.append(tt("span","tw-folder-title",t.label)),n.insertAdjacentHTML("beforeend",ns);let o=w("div","tw-folder-body"),r=w("div","tw-controls");o.append(r),e.append(n,o);let s=i=>Te(e,n,o,i);return n.addEventListener("click",()=>s(!e.classList.contains("is-collapsed"))),{el:e,body:r,setCollapsed:s}}function je(t,e){let n=Vt(t.type);if(!n)return null;try{return n(t,e)}catch(o){return console.error("[tweaks] control failed to build:",t&&t.type,o),null}}at("slider",zi);at("checkbox",Ki);at("radiogrid",qi);at("list",Ui);at("button",Ji);at("buttongroup",Zi);at("separator",Qi);at("text",ta);at("folder",nn);var Be=null;function ea(t,e,n={}){let o=Object.entries(e).filter(([p])=>p!=="_last"||(console.warn('[tweaks] "_last" is reserved (the changed-key channel) \u2014 schema entry skipped'),!1)).map(([p,x])=>ke(p,x)).filter(Boolean),r={},s=[],i=new Set,a=new Set,l=new Set,h=[],c=!1,u=!1,d=[],O=new Map,L=!1,b=-1,m=p=>{if(!c){if(L){console.warn("[tweaks] call ignored \u2014 the panel could not be built");return}u?p():d.push(p)}},f=null,E=function(p,x){return p==="_last"&&this===r?void 0:x===void 0?null:typeof x=="bigint"?String(x):x},C=!1,B=()=>{let p={};for(let x of s){let M=p;for(let X of x.path.slice(0,-1))M=M[X]||(M[X]={});M[x.key]=x.get()}return JSON.parse(JSON.stringify(p,E))},j=()=>{try{return JSON.parse(JSON.stringify(r,E))}catch(p){return C||(C=!0,console.warn("[tweaks] a value parked on params can't be serialised \u2014 snapshots carry the controls' values only:",p)),B()}},_=n.persist?`tw:${n.persist===!0?t:n.persist}`:null,D=_?`${_}:presets`:null,V=p=>{try{return JSON.parse(localStorage.getItem(p)||"null")}catch{return null}},W=(p,x)=>{try{localStorage.setItem(p,JSON.stringify(x))}catch{}},P=(p,x)=>x.reduce((M,X)=>M?.[X],p),$=p=>{for(let x of s)if(!x.persist){let M=P(p,x.path.slice(0,-1));M&&typeof M=="object"&&Reflect.deleteProperty(M,x.key)}return p},Q=_?(()=>{let p=0,x=()=>{p=0,W(_,$(j()))};return h.push(()=>{p&&(clearTimeout(p),x())}),()=>{clearTimeout(p),p=setTimeout(x,150)}})():()=>{},K=(p,x=r._last)=>{(p?l:a).forEach(M=>{try{M(r,x)}catch(X){console.error("[tweaks] listener threw:",X)}}),c||Q()},U=p=>typeof p=="function"||typeof p=="symbol"||typeof p=="bigint",it=(p,x)=>{if(U(x))throw new TypeError(`a ${typeof x} is not a control value`);p.set(x),p.target[p.key]=p.get()},A=p=>{Bn(p,p.raw,p.def),p.target[p.key]=p.get()},F=!1,y=()=>{if(typeof n.onReset=="function"&&!F){F=!0;try{return n.onReset()}finally{F=!1}}for(let p of s)try{A(p)}catch(x){console.error(`[tweaks] resetting "${p.path.join(".")}" failed \u2014 control skipped:`,x)}r._last=void 0,K()},g=w("div","tw-panel");g.dataset.mode="inline",Un(g);let S=w("div","tw-header"),k=yt("tw-header-toggle");k.setAttribute("aria-expanded","true");let v=t,I=tt("span","tw-title",v);k.append(I);let J=w("div","tw-toolbar"),T=()=>{let p={};for(let x of s)ce(x.get(),x.def)&&(p[x.path.join(".")]=x.get());return JSON.parse(JSON.stringify(p,E))},Y=Hn(g,()=>v,p=>{if(!p)return[JSON.stringify(j(),null,2),-1];let x=T();return[JSON.stringify(x,null,2),Object.keys(x).length]}),rt=Dn(y),lt=null;_&&n.presets!==!1&&(lt=Qe("",os,"Presets"),lt.setAttribute("aria-haspopup","menu"),lt.setAttribute("aria-expanded","false"),J.append(lt));let Et=!!n.filter&&(n.toolbar!==!1||(console.warn("[tweaks] opts.filter needs the toolbar (its search button lives there) \u2014 ignored alongside toolbar:false"),!1)),mt=Et?Qe("",es,"Filter controls"):null,gt=Et?w("input","tw-search"):null;Et&&(gt.type="text",gt.placeholder="Filter\u2026",gt.spellcheck=!1,gt.setAttribute("aria-label","Filter controls"),Xt(gt),J.append(mt)),J.append(Y,rt),S.append(k),Et&&S.append(gt),n.toolbar!==!1&&S.append(J);let vt=[Y,rt,lt,mt].filter(Boolean);for(let p of vt)p.disabled=!0;let At=!1,Tt=!1;S.addEventListener("click",p=>{Tt&&(Tt=!1,p.preventDefault(),p.stopPropagation())},!0),k.addEventListener("click",()=>{Te(g,k,Nt,!g.classList.contains("is-collapsed")),g.dataset.mode==="floating"&&setTimeout(()=>{g.dataset.mode==="floating"&&g.isConnected&&(Ct(),ut())},270)});let Nt=w("div","tw-body"),H=w("div","tw-controls");Nt.append(H),g.append(S,Nt);let G=Qn(n.theme);pn(g,G),g._twTheme=G;let dt=n.draggable!==!1,ct=8,kt=28,Dt=()=>({maxX:Math.max(ct,window.innerWidth-g.offsetWidth-ct),maxY:Math.max(ct,window.innerHeight-g.offsetHeight-ct)}),$t=_?`${_}:pos`:null,N=(dt||n.floating)&&$t?V($t):null,et=N||(typeof n.floating=="object"?n.floating:null)||{x:16,y:16},pt=+et.x||16,bt=+et.y||16,ut=()=>{g.style.left=pt+"px",g.style.top=bt+"px"},Ct=()=>{let{maxX:p,maxY:x}=Dt();pt=R(pt,ct,p),bt=R(bt,ct,x)};(dt||n.floating)&&(n.floating||N)&&(g.dataset.mode="floating",Ct(),ut(),requestAnimationFrame(()=>{!c&&g.dataset.mode==="floating"&&g.isConnected&&(Ct(),ut())}));let Gt=p=>{A(p),r._last=p.key,K()},Jt=(p,x)=>{let M=p.querySelector(".tw-slider-value")||p.querySelector(No)||p;M.classList.add("tw-resettable"),M.title="Double-click or hold to reset";let X=0,nt=0,q=0,st=!1,Z=()=>{X&&(clearTimeout(X),X=0,M.classList.remove("tw-reset-holding"))};M.addEventListener("pointerdown",z=>{z.stopPropagation(),st=!1,!(z.pointerType!=="touch"&&z.pointerType!=="pen")&&(nt=z.clientX,q=z.clientY,M.classList.add("tw-reset-holding"),X=setTimeout(()=>{X=0,M.classList.remove("tw-reset-holding","is-editable"),st=!0,Gt(x)},500))}),M.addEventListener("pointermove",z=>{X&&Math.abs(z.clientX-nt)+Math.abs(z.clientY-q)>8&&Z()}),M.addEventListener("pointerup",Z),M.addEventListener("pointercancel",Z),M.addEventListener("pointerleave",Z),M.addEventListener("contextmenu",z=>{st&&z.preventDefault()}),M.addEventListener("click",z=>{st&&(z.preventDefault(),z.stopImmediatePropagation(),st=!1)},!0),M.addEventListener("dblclick",z=>{M===p&&z.target.closest&&z.target.closest("input, textarea")||(z.preventDefault(),z.stopPropagation(),Gt(x))}),M.classList.contains("tw-slider-value")&&p.addEventListener("dblclick",z=>{let ft=z.target;!ft.classList||!ft.classList.contains("tw-slider-input")||(z.preventDefault(),z.stopPropagation(),ft.blur(),Gt(x))}),p.addEventListener("keydown",z=>{!z.altKey||z.metaKey||z.ctrlKey||z.key!=="Backspace"&&z.key!=="Delete"||(z.preventDefault(),z.stopPropagation(),z.target.classList&&z.target.classList.contains("tw-slider-input")&&z.target.blur(),Gt(x))})},Ft=[],Zt=(p,x)=>{x.hint&&Ie(p,x.hint),(x.render||x.disabled!=null)&&Ft.push({node:p,m:x})},he=[],Yt=[],Wt=[],Ce=[],Ve=p=>{typeof p.destroy=="function"&&h.push(p.destroy)},It=(p,x,M,X=[],nt=null)=>{for(let q of x){if(q.type==="tabs"){let z={};i.add(z),M[q.key]=z;let ft=Vt("tabs"),ot=ft&&ft(q);if(!ot)continue;Ce.push({path:[...X,q.key],ctrl:ot,pageKeys:q.pages.map(wt=>wt.key)}),q.pages.forEach((wt,_t)=>{let Ut={};i.add(Ut),z[wt.key]=Ut,It(ot.bodies[_t],wt.children,Ut,[...X,q.key,wt.key])}),Zt(ot.el,q),p.append(ot.el);continue}if(q.type==="folder"){let z={};i.add(z),M[q.key]=z;let ft=nn(q);Wt.push({path:[...X,q.key],el:ft.el,setCollapsed:ft.setCollapsed});let ot=Et?{el:ft.el,label:q.label,body:ft.body}:null;ot&&Yt.push(ot),It(ft.body,q.children,z,[...X,q.key],ot),Zt(ft.el,q),p.append(ft.el);continue}let st=!Vn.has(q.type),Z=je(q,st?z=>{ce(M[q.key],z)&&(M[q.key]=z,r._last=q.key,K())}:()=>{});if(Z){if(Ve(Z),st){let z=Z.get();be(M,q.key)&&Z.set(M[q.key]),M[q.key]=Z.get();let ft={target:M,key:q.key,set:Z.set,get:Z.get,raw:q.value,def:z,path:[...X,q.key],persist:q.persist!==!1};s.push(ft),Jt(Z.el,ft)}Zt(Z.el,q),Et&&q.type!=="separator"&&he.push({el:Z.el,label:q.label,folder:nt}),p.append(Z.el)}}};if(Et){let p=M=>{let X=M.trim().toLowerCase(),nt=!1,q=(st,Z)=>{!Z&&st.classList.contains("tw-filter-hidden")&&(nt=!0),st.classList.toggle("tw-filter-hidden",Z)};if(!X)he.forEach(st=>q(st.el,!1)),Yt.forEach(st=>q(st.el,!1));else{for(let st of he){let Z=st.folder&&fn(st.folder.label,X);q(st.el,!(fn(st.label,X)||Z))}for(let st of Yt.slice().reverse()){let Z=[...st.body.children].some(z=>!z.classList.contains("tw-filter-hidden"));q(st.el,!(fn(st.label,X)||Z))}}nt&&Jn()},x=()=>{g.classList.remove("is-searching"),gt.value="",p("")};mt.addEventListener("click",()=>{mt.disabled||(g.classList.toggle("is-searching")?(gt.focus(),gt.select()):x())}),gt.addEventListener("input",()=>p(gt.value)),gt.addEventListener("keydown",M=>{M.key==="Escape"&&(x(),mt.focus())})}let we=new Set(o.map(p=>p.key)),ue=(p,x)=>{if(!(!p||typeof p!="object")){for(let M of s){let X=P(p,M.path);if(X!==void 0)try{it(M,X)}catch(nt){console.error(`[tweaks] restoring "${M.path.join(".")}" failed \u2014 value skipped:`,nt)}}for(let M of Object.keys(p))if(!we.has(M)&&M!=="_last"&&be(r,M)&&!jn(M)&&!U(p[M]))try{r[M]=p[M]}catch(X){console.error(`[tweaks] restoring "${M}" failed \u2014 value skipped:`,X)}r._last=void 0,K(x)}},ee=()=>{let p=D?V(D):null;return Object.assign(Object.create(null),p&&typeof p=="object"?p:{})},Fo=p=>{let x=ee();x[p]=j(),W(D,x)},_o=p=>{let x=ee();x[p]&&ue(x[p])},Ho=p=>{let x=ee();delete x[p],W(D,x)},on=p=>p.map(x=>String(x).replace(/~/g,"~1").replace(/\./g,"~0")).join("."),xs=()=>{let p={};if(Wt.length){let x={};for(let M of Wt)x[on(M.path)]=M.el.classList.contains("is-collapsed");p.folders=x}if(Ce.length){let x={};for(let M of Ce)x[on(M.path)]=M.pageKeys[M.ctrl.active()]??null;p.tabs=x}return p},Ms=p=>{if(!(!p||typeof p!="object")){if(p.folders)for(let x of Wt){let M=p.folders[on(x.path)];typeof M=="boolean"&&x.setCollapsed(M)}if(p.tabs)for(let x of Ce){let M=x.pageKeys.indexOf(p.tabs[on(x.path)]);M>=0&&M!==x.ctrl.active()&&x.ctrl.activate(M)}}};if(dt||n.floating){if(dt){g.dataset.draggable="true";let ot=w("span","tw-grabber");ot.setAttribute("aria-hidden","true"),S.prepend(ot)}let p=()=>{if(g.dataset.mode==="floating")return;let ot=g.getBoundingClientRect();if(pt=ot.left,bt=ot.top,g.parentNode&&(f=w("span","tw-lift-slot"),f.style.width=ot.width+"px",f.style.height=ot.height+"px",f.setAttribute("aria-hidden","true"),g.before(f)),to(g,g),document.body.appendChild(g),g.dataset.mode="floating",ut(),f&&typeof MutationObserver=="function"){let wt=new MutationObserver(()=>{f&&!f.isConnected&&(wt.disconnect(),f=null,g.remove())});wt.observe(document.documentElement,{childList:!0,subtree:!0}),h.push(()=>wt.disconnect())}},x=()=>{Be&&Be!==g&&(Be.style.zIndex=""),g.style.zIndex="99991",Be=g},M=null,X=0,nt=0,q=0,st=0,Z=ot=>{for(let[wt,_t]of[["pointermove",z],["pointerup",ft],["pointercancel",ft]])ot?document.addEventListener(wt,_t,!0):document.removeEventListener(wt,_t,!0)};dt&&S.addEventListener("pointerdown",ot=>{if(!(ot.button!==0||M!==null||ot.target.closest(".tw-toolbar, input, textarea, select"))&&(M=ot.pointerId,X=ot.clientX,nt=ot.clientY,At=!1,Z(!0),g.classList.add("is-grabbing"),g.style.transition)){let wt=getComputedStyle(g);pt=parseFloat(wt.left)||pt,bt=parseFloat(wt.top)||bt,g.style.transition="",ut()}});let z=ot=>{if(ot.pointerId!==M)return;if(ot.buttons===0){ft(ot);return}let wt=ot.clientX-X,_t=ot.clientY-nt;if(!At){if(Math.abs(wt)+Math.abs(_t)<4)return;At=!0,p(),x(),q=pt,st=bt;try{S.setPointerCapture(M)}catch{}g.classList.add("is-dragging")}let{maxX:Ut,maxY:xt}=Dt();pt=R(q+wt,ct,Ut),bt=R(st+_t,ct,xt),ut()},ft=ot=>{if(ot.pointerId===M){try{S.releasePointerCapture(M)}catch{}if(M=null,Z(!1),Tt=At,Tt&&setTimeout(()=>{Tt=!1},0),At){let{maxX:wt,maxY:_t}=Dt();pt<=ct+kt?pt=ct:pt>=wt-kt&&(pt=wt),bt<=ct+kt?bt=ct:bt>=_t-kt&&(bt=_t),fe.matches||(g.style.transition="left 0.32s var(--tw-ease-spring), top 0.32s var(--tw-ease-spring)",setTimeout(()=>{g.style.transition=""},340)),ut(),$t&&W($t,{x:pt,y:bt})}g.classList.remove("is-dragging","is-grabbing")}};S.addEventListener("lostpointercapture",ft),h.push(()=>Z(!1))}let Es=()=>{(dt||n.floating)&&(g.dataset.mode==="floating"&&(Ct(),ut()),h.push(jt(g,[[window,"resize"]],()=>{g.dataset.mode==="floating"&&(Ct(),ut())})))};if(lt){let p=w("div","tw-presets-menu"),x=w("div","tw-presets-save"),M=w("input","tw-presets-input");M.type="text",M.placeholder="Preset name\u2026",M.spellcheck=!1,M.setAttribute("aria-label","New preset name"),Xt(M);let X=tt("button","tw-presets-savebtn","Save");x.append(M,X);let nt=w("div","tw-presets-list");p.append(x,nt);let q=()=>{let z=ee(),ft=Object.keys(z);if(nt.replaceChildren(),!ft.length)return nt.append(tt("div","tw-presets-empty","No presets yet"));for(let ot of ft){let wt=w("div","tw-presets-row"),_t=tt("button","tw-presets-load",ot);_t.addEventListener("click",()=>{_o(ot),Z.close(),ae(`Loaded \u201C${ot}\u201D`,g)});let Ut=yt("tw-presets-del",rs);Ut.setAttribute("aria-label",`Delete preset ${ot}`),Ut.addEventListener("click",xt=>{xt.stopPropagation(),Ho(ot),q()}),wt.append(_t,Ut),nt.append(wt)}},st=()=>{let z=M.value.trim();if(!z){M.focus();return}Fo(z),M.value="",q(),ae(`Saved \u201C${z}\u201D`,g)},Z=Bt(lt,lt,p,{width:208,fallbackH:160,gap:6,align:"end",onOpen:()=>{q(),M.focus()}});X.addEventListener("click",st),M.addEventListener("keydown",z=>{z.key==="Enter"&&st()})}if(n.onEditStart||n.onEditEnd){let p=".tw-slider, .tw-num-grab, .tw-pad, .tw-wg-area, .tw-wg-hue, .tw-wg-alpha, .tw-bezier-handle, .tw-gradient-bar, .tw-gradient-stop",x=!1,M=()=>{document.removeEventListener("pointerup",M,!0),document.removeEventListener("pointercancel",M,!0),x&&(x=!1,n.onEditEnd&&n.onEditEnd())},X=nt=>{x||!nt.target.closest(p)||(x=!0,n.onEditStart&&n.onEditStart(),document.addEventListener("pointerup",M,!0),document.addEventListener("pointercancel",M,!0))};g.addEventListener("pointerdown",X),g._twEditPointer=X,h.push(M)}let Ge=n.undo?(()=>{let x=[],M=0,X=!1,nt=0,q=()=>{nt=0;let xt=j();JSON.stringify(xt)!==JSON.stringify(x[M])&&(x=x.slice(0,M+1),x.push(xt),x.length>200&&(x=x.slice(x.length-200)),M=x.length-1)},st=()=>{X||(clearTimeout(nt),nt=setTimeout(q,350))},Z=()=>{nt&&(clearTimeout(nt),q())};a.add(st),l.add(st);let z=xt=>{X=!0,ue(x[xt]),X=!1,M=xt},ft=()=>{Z(),M>0&&z(M-1)},ot=()=>{Z(),M<x.length-1&&z(M+1)},wt=()=>g.matches(":hover")||g.contains(document.activeElement),_t=xt=>!!(xt&&xt.matches&&(xt.matches("input, textarea")||xt.isContentEditable)),Ut=xt=>{if(!wt()||!(xt.metaKey||xt.ctrlKey)||_t(xt.target))return;let Bo=xt.key.toLowerCase();Bo==="z"?(xt.preventDefault(),xt.shiftKey?ot():ft()):Bo==="y"&&(xt.preventDefault(),ot())};return{undo:ft,redo:ot,arm:()=>{x=[j()],M=0,h.push(jt(g,[[document,"keydown"]],Ut))}}})():null,Do=()=>{if(!c){if(b=h.length,It(H,o,r),Ft.length){let p=new Map;for(let X of s)p.has(X.key)||p.set(X.key,X);let x=X=>{let nt=p.get(X);return nt?nt.target[nt.key]:r[X]},M=()=>{let X=!1;for(let{node:nt,m:q}of Ft)try{if(q.render){let st=!q.render(x);!st&&nt.classList.contains("tw-cond-hidden")&&(X=!0),nt.classList.toggle("tw-cond-hidden",st)}if(q.disabled!=null){let st=typeof q.disabled=="function"?q.disabled(x):q.disabled;mn(nt,!!st)}}catch{}X&&Jn()};a.add(M),l.add(M),M()}if(_&&ue($(V(_))),!c){Ge?.arm(),Es(),u=!0;for(let p of d.splice(0)){if(c)break;try{p()}catch(x){console.error("[tweaks] a call queued before ready failed:",x)}}O.clear();for(let p of vt)p.disabled=!1}}},Io=(p,x)=>{if(String(p).split(".").some(jn))return console.warn(`[tweaks] set("${p}") ignored \u2014 reserved key`),!1;let M=String(p).split("."),X;if(M.length>1){let Z=r;for(let z=0;z<M.length-1&&Z;z++)Z=Z[M[z]],i.has(Z)||(Z=null);if(X=Z&&s.find(z=>z.target===Z&&z.key===M[M.length-1]),!X)return console.warn(`[tweaks] set("${p}") \u2014 no control at that path`),!1}else{let Z=s.filter(ft=>ft.key===p),z=Z.find(ft=>ft.target===r);if(!z&&Z.length>1)return console.warn(`[tweaks] set("${p}") is ambiguous \u2014 ${Z.length} controls share that key; use a dotted path (e.g. "${Z[0].path.join(".")}")`),!1;X=z||Z[0]}let nt=X?X.target:r,q=X?X.key:p,st=nt[q];if(X&&U(x))return console.warn(`[tweaks] set("${p}") ignored \u2014 a ${typeof x} is not a control value`),!1;if(X)try{it(X,x)}catch(Z){return console.error(`[tweaks] set("${p}") failed \u2014 value skipped:`,Z),!1}else{if(i.has(r[p]))return console.warn(`[tweaks] set("${p}") ignored \u2014 it's a folder/tabs group; set its children instead`),!1;r[p]=x}return ce(st,nt[q])?(r._last=q,!0):!1},Le={el:g,params:r,on(p){return c?()=>{}:(a.add(p),()=>a.delete(p))},set(p,x,M){let X=String(p),nt=M?.silent;m(()=>{Io(X,x)&&K(nt)})},setMany(p,x){if(p==null||typeof p!="object")return;let M=Object.entries(p),X=x?.silent;m(()=>{let nt=!1;for(let[q,st]of M)try{Io(q,st)&&(nt=!0)}catch(Z){console.error(`[tweaks] setMany("${q}") failed \u2014 key skipped:`,Z)}nt&&K(X)})},reset(){u&&!c&&Oo(rt),m(y)},toJSON(){return c?{values:{},ui:{}}:{values:j(),ui:xs()}},changes(){return c?{}:T()},fromJSON(p,x){if(!p||typeof p!="object")return;let M=x?.silent,X=p.values&&typeof p.values=="object"?{...p.values}:p.values,nt=p.ui&&typeof p.ui=="object"?{...p.ui}:p.ui;m(()=>{X&&ue(X,M),Ms(nt)})},setName(p){c||(v=String(p),I.textContent=v)},setTheme(p){if(!c){if(G)for(let x in G)g.style.removeProperty(x);G=Qn(p),g._twTheme=G,pn(g,G),window.dispatchEvent(new Event("tw-retheme"))}},savePreset:p=>c||L||!D||!p?!1:(u||O.set(String(p),"save"),m(()=>Fo(p)),!0),loadPreset:p=>{let x=O.get(String(p));return c||L||x==="delete"||!(x==="save"||ee()[p])?!1:(m(()=>_o(p)),!0)},deletePreset:p=>{D&&(u||O.set(String(p),"delete"),m(()=>Ho(p)))},presets:()=>c?[]:Object.keys(ee()),undo:()=>{Ge&&m(Ge.undo)},redo:()=>{Ge&&m(Ge.redo)},destroy(){if(!c){c=!0,qo(g),tn(g);for(let p of h.splice(0))try{p()}catch{}a.clear(),f&&(f.remove(),f=null),Be===g&&(Be=null),g.dataset.twDestroyed="",g.remove()}}},jo=De(o);if(jo){let p=x=>{if(L=!0,d.length=0,b>=0)for(let M of h.splice(b))try{M()}catch{}for(let M of H.children)M.dataset.twDestroyed="";throw a.clear(),s.length=0,H.replaceChildren(),c||console.warn(`[tweaks] "${t}": the panel could not be built \u2014 ${b>=0?"the build threw":"its lazy controls failed to load"}; the API is inert`),x};Le.ready=g.ready=jo.then(Do).then(()=>Le,p),Le.ready.catch(()=>{})}else Do(),Le.ready=g.ready=Promise.resolve(Le);return Le}var na=(t,e)=>{t.dataset.value=e==null?"":Array.isArray(e)?e.join(","):typeof e=="object"?Object.values(e).join(","):String(e)},oa=(t,e,n)=>{na(t,n),t.dispatchEvent(new CustomEvent("tw:change",{bubbles:!0,detail:{key:e,value:n}}))},Ro=(t,e)=>[...typeof t.matches=="function"&&t.matches(e)?[t]:[],...t.querySelectorAll(e)];async function ws(t=document){Ro(t,'.tw-panel[data-mode="inline"]:not([data-tw-panel-bound])').forEach(o=>{let r=o.querySelector(":scope > .tw-header"),s=o.querySelector(":scope > .tw-controls");if(!r||!s)return;o.setAttribute("data-tw-panel-bound","");let i=w("div","tw-body");o.insertBefore(i,s),i.append(s);let a=r.querySelector(".tw-header-toggle"),l=r.querySelector(".tw-title");if(!a&&l&&(a=yt("tw-header-toggle"),l.replaceWith(a),a.append(l)),!!a&&(a.setAttribute("aria-expanded","true"),a.addEventListener("click",()=>Te(o,a,i,!o.classList.contains("is-collapsed"))),!r.querySelector(".tw-toolbar"))){let h=l&&l.textContent||"Panel",c=()=>[...o.querySelectorAll("[data-tw]")].map(L=>L._tw).filter(L=>L&&L.ctrl.get()!==void 0),u=()=>{let L=Object.create(null);for(let b of c()){let m=b.key,f=2;for(;be(L,m);)m=`${b.key}-${f++}`;L[m]=b.ctrl.get()}return JSON.stringify(L,null,2)},d=()=>{for(let L of c())L.reset()},O=w("div","tw-toolbar");O.append(Hn(o,()=>h,()=>[u(),-1]),Dn(d)),r.append(O)}}),Ro(t,'[data-tw="folder"]:not([data-tw-bound])').forEach(o=>{o.setAttribute("data-tw-bound","");let r=nn({label:o.dataset.label||"Folder"});[...o.children].forEach(s=>r.body.append(s)),o.append(r.el)});let e=Ro(t,"[data-tw]:not([data-tw-bound])").map(o=>({host:o,meta:ms(o)})).filter(o=>o.meta);e.forEach(({host:o})=>o.setAttribute("data-tw-bound",""));let n=De(e.map(o=>o.meta));n&&await n.catch(()=>{});for(let{host:o,meta:r}of e){let s=o.dataset.key||r.label,i,a=u=>{ce(i,u)&&(i=u,oa(o,s,u))},l=je(r,a);if(!l)continue;o.closest(".tw-panel, .tw-portal")||o.classList.add("tw-portal"),o.append(l.el),o.dataset.hint&&Ie(l.el,o.dataset.hint);let h=l.get();i=h;let c={...l,set:u=>{l.set(u),a(l.get())}};o._tw={ctrl:c,raw:r.value,def:h,key:s,host:o,reset:()=>{Bn(l,r.value,h),a(l.get())}}}}if(typeof document<"u"){let t=()=>ws(document);document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()}var ys=t=>w("div",`${t} tw-standalone tw-portal`),vs=(t,e,n)=>{let o=De(t);if(!o)return e(),Promise.resolve(n);let r=o.then(e).then(()=>n);return r.catch(()=>{}),r};function ra(t,e,n={}){let o=n.key??"value",r=ke(o,e);if(!r||r.type==="folder"||r.type==="tabs")throw new TypeError(`[tweaks] mountControl: "${o}" is not a single-control schema value`);n.label!=null&&(r.label=String(n.label));let s=!Vn.has(r.type),i=ys("tw-control");t.append(i);let a=null,l=!1,h=r.value,c,u=!1,d=b=>{ce(h,b)&&(h=b,n.onChange&&n.onChange(b,o))},O=()=>{if(l||(a=je(r,s?d:()=>{}),!a))return;r.hint&&Ie(a.el,r.hint);let b=()=>{};try{r.render&&!r.render(b)&&a.el.classList.add("tw-cond-hidden")}catch{}try{(typeof r.disabled=="function"?r.disabled(b):r.disabled)&&mn(a.el,!0)}catch{}i.append(a.el),s&&(h=a.get(),u&&(a.set(c),d(a.get())))},L={el:i,set:b=>{l||!s||(a?(a.set(b),d(a.get())):(c=b,u=!0))},get:()=>s?a?a.get():u?c:r.value:void 0,destroy:()=>{l=!0,a&&typeof a.destroy=="function"&&a.destroy(),i.dataset.twDestroyed="",i.remove()},ready:null};return L.ready=vs([r],O,L),L}function sa(t={}){let e=ys("tw-color-picker"),n=null,o=!1,r=t.value,s,i=!1,a=null,l=u=>{ce(r,u)&&(r=u,t.onChange&&t.onChange(u))},h=()=>{if(o)return;let u=Vt("colorpicker");u&&(n=u({value:t.value,mode:t.mode},l),r=n.get(),e.append(n.el),a&&n.setMode(a),i&&(n.set(s),l(n.get())),Ht(n.reflow))},c={el:e,set:u=>{o||(n?(n.set(u),l(n.get())):(s=u,i=!0))},get:()=>n?n.get():i?s:t.value,mode:()=>n?n.mode():a||t.mode||"oklch",setMode:u=>{n?n.setMode(u):a=u},reflow:()=>{n&&n.reflow()},destroy:()=>{o=!0,e.remove()},ready:null};return c.ready=vs([{type:"color"}],h,c),c}export{sa as createColorPicker,ws as enhance,an as gradientCss,Kn as gradientStops,ra as mountControl,ea as tweaks};
2
+ var Qs=Object.defineProperty;var gn=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(o){throw n=[o],o}};var sr=(t,e)=>{for(var n in e)Qs(t,n,{get:e[n],enumerable:!0})};function hn(t){if(typeof t!="string")return null;let e=t.trim().toLowerCase();if(ir[e])return ir[e];let n=/^cubic-bezier\(([^()]*)\)$/.exec(e);if(!n)return null;let o=n[1].split(",").map(r=>r.trim()?Number(r):NaN);return o.length!==4||!o.every(Number.isFinite)?null:[bn(o[0]),o[1],bn(o[2]),o[3]]}function ar(t){let e=[];for(let n=0;n<=so;n++){let o=n/so,r=1-o,s=3*r*r*o,i=3*r*o*o,a=o*o*o;e.push([s*t[0]+i*t[2]+a,bn(s*t[1]+i*t[3]+a)])}return e}function lr(t,e){if(e=bn(e),!t)return e;let n=ar(t);for(let o=1;o<n.length;o++)if(e<=n[o][0]){let[r,s]=n[o-1],[i,a]=n[o];return i>r?s+(a-s)*(e-r)/(i-r):a}return 1}function ao(t){let e=[...t.stops].sort((a,l)=>a.pos-l.pos),n=a=>`${a.color} ${ro(a.pos)}%`,o=hn(t.easing);if(!o||e.length<2)return e.map(n).join(", ");let r=ar(o),s=t.interpolation||"oklch",i=[n(e[0])];for(let a=1;a<e.length;a++){let l=e[a-1],h=e[a],u=h.pos-l.pos;if(u>1e-6)for(let d=1;d<so;d++){let[p,N]=r[d];i.push(`color-mix(in ${s}, ${l.color}, ${h.color} ${ro(N)}%) ${ro(l.pos+u*p)}%`)}i.push(n(h))}return i.join(", ")}function wn(t,e="to right"){return`linear-gradient(in ${t.interpolation||"oklch"} ${typeof e=="number"?`${e}deg`:e}, ${ao(t)})`}var ir,bn,so,io,ro,yn=gn(()=>{ir=Object.assign(Object.create(null),{ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]}),bn=t=>Math.min(1,Math.max(0,t)),so=15;io=t=>hn(t)?t.trim().toLowerCase():"linear";ro=t=>+(t*100).toFixed(2)});function Xt(t,e,n,o={}){let r=!1,s=null;n.classList.add("tw-portal"),n.inert=!0,n.addEventListener("pointerdown",C=>e.closest(".tw-panel")?._twEditPointer?.(C),!0),po(n);let i=0,a=0,l=()=>{mo(e,n,{width:o.width,fallbackH:o.fallbackH,gap:o.gap,align:o.align});let C=e.getBoundingClientRect();i=parseFloat(n.style.left)-C.left,a=parseFloat(n.style.top)-C.top},h=()=>{if(r){if(!t.isConnected)return M();l(),o.onReflow&&o.onReflow()}},u=()=>{if(!r)return;if(!t.isConnected)return M();let C=e.getBoundingClientRect(),j=e.closest(".tw-panel")?.getBoundingClientRect();if(!(C.width||C.height)||C.bottom<0||C.top>window.innerHeight||C.right<0||C.left>window.innerWidth||j?.height&&(C.bottom<j.top||C.top>j.bottom))return M();n.style.left=C.left+i+"px",n.style.top=C.top+a+"px"},d=C=>{!t.contains(C.target)&&!n.contains(C.target)&&M()},p=C=>{C.key==="Escape"&&r&&(M(),e.focus())},N=C=>{if(!r)return;let j=C.relatedTarget;(j?t.contains(j)||n.contains(j):Ue)||(M(),j&&!e.closest(".tw-panel")?.contains(j)&&setTimeout(()=>{!r&&document.activeElement===j&&e.focus()},0))};t.addEventListener("focusout",N),n.addEventListener("focusout",N);let L=()=>n.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'),b=()=>Ne(n,t),g=C=>{C.every(j=>j.target===n)||b()},m=()=>{me&&me!==M&&me(),me=M,co=e,r=!0,t.classList.add("is-open"),e.setAttribute("aria-expanded","true"),n.inert=!1,document.body.appendChild(n),Ne(n,t),window.addEventListener("tw-retheme",b),typeof MutationObserver=="function"&&(s=new MutationObserver(g),s.observe(document.documentElement,{subtree:!0,attributes:!0,attributeFilter:["data-tw-scheme"]})),l(),requestAnimationFrame(()=>{if(r&&(n.classList.add("is-open"),o.onOpen&&o.onOpen(),l(),!n.contains(document.activeElement))){let C=o.initialFocus&&o.initialFocus()||L();C&&C.focus({focusVisible:!Ue})}}),requestAnimationFrame(function C(){if(r){if(!t.isConnected)return M();requestAnimationFrame(C)}}),setTimeout(()=>{r&&document.addEventListener("pointerdown",d,!0)},0),document.addEventListener("keydown",p),window.addEventListener("scroll",u,!0),window.addEventListener("resize",h)},M=()=>{me===M&&(me=null,co=null),n.contains(document.activeElement)&&e.focus(),r=!1,t.classList.remove("is-open"),n.classList.remove("is-open"),n.inert=!0,e.setAttribute("aria-expanded","false"),document.removeEventListener("pointerdown",d,!0),document.removeEventListener("keydown",p),window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",h),window.removeEventListener("tw-retheme",b),s&&(s.disconnect(),s=null),setTimeout(()=>{r||n.remove()},200)};return e.addEventListener("click",()=>{e.disabled||(r?M():m())}),{open:m,close:M,isOpen:()=>r,reflow:h}}function be(t,e,n,o){let r=w("div","tw-seg");r.setAttribute("role","radiogroup"),o&&r.setAttribute("aria-label",o);let s=w("div","tw-seg-pill");r.append(s);let i=t.map(u=>{let d=vo("tw-seg-btn",u,p=>h(p));return r.append(d),d}),a=u=>wo(r,s,u),l=()=>{yo(i,e),a(!0)},h=(u,d=!0)=>{u!=null&&!i.some(p=>p._twVal===u)||(e=u,l(),d&&n(u))};return r.addEventListener("keydown",u=>{let d=Sn(i,e);if(d<0)return;let p=tn(u.key,d,i.length);p<0||(u.preventDefault(),h(i[p]._twVal),i[p].focus())}),l(),jt(()=>{a(),r.classList.add("is-ready")}),Gt(r,[[window,"tw-reflow"]],()=>a()),{el:r,set:u=>h(u,!1),get:()=>e}}var vn,$,xt,Je,cr,ce,Me,Pe,Re,En,ge,xn,ue,Zt,Ze,uo,w,Mt,nt,po,jt,Gt,fo,Mn,Ue,Yt,mo,ti,ei,lo,ni,oi,go,kn,bo,Ne,me,co,ur,Cn,oe,Qe,ho,ri,wo,Ln,$e,Sn,yo,vo,tn,$t,de,dr,lt,zt,Et=gn(()=>{yn();vn=t=>t.replace(/([a-z])(?=[A-Z])|([A-Z\d])(?=[A-Z][a-z])/g,"$1$2 ").replace(/^./,e=>e.toUpperCase()).trim(),$=(t,e,n)=>Math.min(n,Math.max(e,t)),xt=t=>!!t&&typeof t=="object",Je=t=>typeof t=="string"&&(/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t.trim())||/^(oklch|oklab|rgba?|hsla?|hwb|lab|lch|color)\(/i.test(t.trim())),cr=20,ce=t=>{let e=String(t),n=/e-(\d+)$/i.exec(e);if(n)return Math.min(cr,Number(n[1])+(e.split("e")[0].split(".")[1]||"").length);let o=e.indexOf(".");return o===-1?0:Math.min(cr,e.length-o-1)},Me=(t,e,n)=>{if(!(n>0))return t;let o=ce(n),r=Number((+e).toFixed(o)),s=Math.round((t-r)/n);return Number.isFinite(s)?Number((r+s*n).toFixed(o)):t},Pe=(t,e,n,o=t)=>{let r=a=>Me(a,o,n),s=Number.isFinite(t)?r(t):-1/0,i=Number.isFinite(e)?r(e):1/0;return s<t&&(s=r(s+n)),i>e&&(i=r(i-n)),s>i?[t,t]:[s,i]},Re=(t,e)=>{let n=e-t;return n<=1?.01:n<=10?.1:n<=100?1:10},En=(t,e,n,o=0,r=null)=>{let s=+t,i=+e,a=+n;if(Number.isFinite(s)||(s=o),Number.isFinite(i)||(i=r??s+100),i<s){let l=s;s=i,i=l}return(!(a>0)||a>i-s)&&(a=Re(s,i)),{min:s,max:i,step:a}},ge=(t,e,n,o,r,s=null)=>{let i=t.shiftKey?10:1;switch(t.key){case"ArrowRight":case"ArrowUp":return e+n*i;case"ArrowLeft":case"ArrowDown":return e-n*i;case"PageUp":return s!=null?e+s:null;case"PageDown":return s!=null?e-s:null;case"Home":return o;case"End":return r}return null},xn=(t,e,n,o,r=0)=>{let s=t.offsetLeft,i=s+t.offsetWidth,a=e.offsetLeft,l=a+e.offsetWidth;return n<i&&n+o>s||n<l+r&&n+o>a-r},ue=t=>t>=0?[0,t<=1?1:t*3||100]:[t>=-1?-1:t*3,0],Zt=t=>t==null?void 0:typeof t=="object"?t.value:t,Ze=t=>{try{return JSON.stringify(t)}catch{return String(t)}},uo=t=>t==null?"":typeof t=="string"?vn(t):typeof t=="object"?t.label??(t.value!==void 0?String(t.value):Ze(t)):String(t),w=(t,e,n)=>{let o=document.createElement(t);return e&&(o.className=e),n!=null&&(o.innerHTML=n),(t=="input"||t=="textarea")&&(o.setAttribute("autocomplete","off"),o.setAttribute("data-1p-ignore",""),o.setAttribute("data-lpignore","true")),o},Mt=(t,e)=>{let n=w("button",t,e);return n.type="button",n},nt=(t,e,n)=>{let o=w(t,e);return o.textContent=n,t==="button"&&(o.type="button"),o},po=t=>["pointerdown","pointermove","pointerup","click"].forEach(e=>t.addEventListener(e,n=>n.stopPropagation())),jt=t=>{requestAnimationFrame(t),document.fonts&&document.fonts.ready&&document.fonts.ready.then(t)},Gt=(t,e,n)=>{let o=t.isConnected;o||requestAnimationFrame(()=>{t.isConnected&&(o=!0)});let r=i=>{if(!t.isConnected){(o||t.closest("[data-tw-destroyed]"))&&s();return}o=!0,n(i)},s=()=>e.forEach(([i,a])=>i.removeEventListener(a,r));return e.forEach(([i,a])=>i.addEventListener(a,r)),s},fo=()=>requestAnimationFrame(()=>window.dispatchEvent(new Event("tw-reflow"))),Mn=(t,e)=>{t.addEventListener("pointerenter",()=>{t.classList.add("is-hover"),e&&e()}),t.addEventListener("pointerleave",()=>t.classList.remove("is-hover"))},Ue=!1;typeof document<"u"&&(document.addEventListener("pointerdown",()=>{Ue=!0},!0),document.addEventListener("keydown",()=>{Ue=!1},!0));Yt=t=>{t.addEventListener("focus",()=>t.classList.toggle("tw-focus-quiet",Ue)),t.addEventListener("blur",()=>t.classList.remove("tw-focus-quiet"))},mo=(t,e,{width:n,fallbackH:o=300,gap:r=6,align:s="start",prefer:i="below"}={})=>{let a=t.getBoundingClientRect();n==="match"&&(e.style.width=a.width+"px");let l=n==="match"?a.width:e.offsetWidth||n||0,h=s==="end"?a.right-l:s==="center"?a.left+a.width/2-l/2:a.left;e.style.left=Math.max(8,Math.min(h,window.innerWidth-l-8))+"px";let u=e.offsetHeight||o,d=window.innerHeight-a.bottom,p=a.top,N=u+12,L=d>=N,b=p>=N,m=(i==="above"?b||!L&&p>=d:!L&&(b||p>d))?a.top-u-r:a.bottom+r;e.style.top=$(m,r,window.innerHeight-u-r)+"px"},ti=Object.assign(Object.create(null),{accent:"--tw-accent",onAccent:"--tw-on-accent",base:"--tw-base",dropdownBg:"--tw-dropdown-bg",surface:"--tw-surface",surfaceHover:"--tw-surface-hover",surfaceActive:"--tw-surface-active",border:"--tw-border",borderHover:"--tw-border-hover",selection:"--tw-selection",title:"--tw-text-root",section:"--tw-text-section",text:"--tw-text-primary",label:"--tw-text-label",textMuted:"--tw-text-secondary",textFaint:"--tw-text-tertiary",focus:"--tw-text-focus",success:"--tw-success",danger:"--tw-danger",shadow:"--tw-shadow-dropdown",shadowPanel:"--tw-shadow-panel",shadowPanelLifted:"--tw-shadow-panel-lifted",font:"--tw-font-sans",fontMono:"--tw-font-mono",radius:"--tw-radius",density:"--tw-row-height",width:"--tw-width"}),ei=new Set(["radius","density","width"]),lo=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),ni=t=>{t=String(t).trim();let e=/^#([0-9a-f]{3})$/i.exec(t);if(e)return e[1].split("").map(n=>parseInt(n+n,16));if(e=/^#([0-9a-f]{6})$/i.exec(t),e)return[0,2,4].map(n=>parseInt(e[1].slice(n,n+2),16));if(e=/^rgba?\(([^)]+)\)/i.exec(t),e){let n=e[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);return[n[0],n[1],n[2]]}return null},oi=t=>{let e=ni(t);if(!e||e.some(o=>!Number.isFinite(o)))return"#ffffff";let n=.2126*lo(e[0])+.7152*lo(e[1])+.0722*lo(e[2]);return 1.05/(n+.05)>=(n+.05)/.0571?"#ffffff":"#161616"},go=t=>{if(!t||typeof t!="object")return null;let e={};for(let[n,o]of Object.entries(t)){if(n.startsWith("--")){e[n]=String(o);continue}let r=ti[n];r&&(e[r]=ei.has(n)&&typeof o=="number"?`${o}px`:String(o))}return e["--tw-accent"]&&!e["--tw-on-accent"]&&(e["--tw-on-accent"]=oi(e["--tw-accent"])),Object.keys(e).length?e:null},kn=(t,e)=>{if(t){if(t._twAppliedVars)for(let n of t._twAppliedVars)t.style.removeProperty(n);if(t._twAppliedVars=e?Object.keys(e):null,e)for(let n in e)t.style.setProperty(n,e[n])}},bo=(t,e)=>{let n=e?.closest('[data-tw-scheme="light"]')?"light":e?.closest('[data-tw-scheme="dark"]')?"dark":null;n?t.setAttribute("data-tw-scheme",n):t.removeAttribute("data-tw-scheme")},Ne=(t,e)=>{kn(t,e?.closest(".tw-panel")?._twTheme),bo(t,e)},me=null,co=null,ur=t=>{me&&(!t||t.contains(co))&&me()};Cn=(t,e)=>{if(t=t.toLowerCase(),t.includes(e))return!0;if(e.length<3)return!1;let n=e.length,o=t.length,r=new Array(o+1).fill(0);for(let s=1;s<=n;s++){let i=[s];for(let a=1;a<=o;a++)i[a]=Math.min(r[a]+1,i[a-1]+1,r[a-1]+(e[s-1]===t[a-1]?0:1));r=i}return Math.min(...r)<=(e.length<6?1:2)},oe=typeof matchMedia=="function"?matchMedia("(prefers-reduced-motion: reduce)"):{matches:!1},Qe="cubic-bezier(0.22, 1, 0.36, 1)",ho="cubic-bezier(0.34, 1.2, 0.64, 1)",ri=(t,e)=>{oe.matches||typeof t.animate!="function"||(t.style.transformOrigin=e>0?"left center":"right center",t.animate([{transform:"scaleX(1)"},{transform:"scaleX(1.18)"},{transform:"scaleX(1)"}],{duration:300,easing:Qe}))},wo=(t,e,n)=>{let o=t.querySelector('[data-active="true"]');if(!o)return;let r=o.offsetLeft,s=o.offsetWidth,i=parseFloat(e.style.left);e.style.left=r+"px",e.style.width=s+"px",n&&Number.isFinite(i)&&i!==r&&ri(e,r>i?1:-1)},Ln=(t,e)=>{t.classList.toggle("is-disabled",e);for(let n of t.children)n.classList.contains("tw-portal")||(n.inert=e)},$e=(t,e,n,o)=>{t.classList.toggle("is-collapsed",o),e.setAttribute("aria-expanded",String(!o)),n.inert=o},Sn=(t,e)=>{let n=t.findIndex(o=>o.dataset.value===String(e));return n<0&&t.length?0:n},yo=(t,e)=>{let n=Sn(t,e);t.forEach((o,r)=>{let s=o.dataset.value===String(e);o.dataset.active=String(s),o.setAttribute("aria-checked",String(s)),o.tabIndex=r===n?0:-1})},vo=(t,e,n)=>{let o=nt("button",t,uo(e));return o.setAttribute("role","radio"),o._twVal=Zt(e),o.dataset.value=o._twVal,o.addEventListener("click",()=>n(o._twVal)),o},tn=(t,e,n,o=0)=>{switch(t){case"ArrowRight":return(e+1)%n;case"ArrowLeft":return(e-1+n)%n;case"ArrowDown":return o<0?-1:o?e+o<n?e+o:e:(e+1)%n;case"ArrowUp":return o<0?-1:o?e-o>=0?e-o:e:(e-1+n)%n;case"Home":return 0;case"End":return n-1}return-1};$t=(t,e="",n=2,o=24)=>`<svg${e?` class="${e}"`:""} viewBox="0 0 ${o} ${o}" fill="none" stroke="currentColor" stroke-width="${n}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`,de=(t,e)=>({el:t,set:()=>{},get:()=>{},destroy:e}),dr={},lt=(t,e)=>{dr[t]=e},zt=t=>dr[t]});var Ds={};sr(Ds,{pasteInto:()=>$a,pasteScope:()=>Ra,pick:()=>Hs});function Ra(t,e,n){let o=JSON.parse(n),r;if(e.kind==="row"){let s=e.entry,i=xt(o)&&!Array.isArray(o)&&Object.keys(o).length===1&&Object.prototype.hasOwnProperty.call(o,s.key)?o[s.key]:o;r=_s(s,i)?[[s,i]]:[]}else{if(!xt(o)||Array.isArray(o))return!1;let s=t.entries.filter(i=>i.path.length>e.path.length&&e.path.every((a,l)=>i.path[l]===a));r=[];for(let i of[o,Oa(o)])for(let a of[Fs(i,e.path),i]){let l=xt(a)?Hs(s,a,e.path):[];l.length>r.length&&(r=l)}}return r.length?(Pa(t,r),r.length):!1}function $a(t,e,n,o){if(!n.alive())return;let r=!1;if(t!==null)try{r=e(t)}catch{}if(n.announce(r?`${r} value${r===1?"":"s"} pasted`:t===null?"Couldn't read the clipboard":"Nothing to paste"),o){let s=r?"is-pasted":"is-refused";o.classList.remove("is-pasted","is-refused"),o.classList.add(s),clearTimeout($s.get(o)),$s.set(o,setTimeout(()=>o.classList.remove(s),450))}return!!r}var Ta,Fs,Oa,Na,eo,_s,Hs,Pa,$s,Is=gn(()=>{Et();Ta=new Set(["__proto__","constructor","prototype"]),Fs=(t,e)=>e.reduce((n,o)=>xt(n)&&Object.prototype.hasOwnProperty.call(n,o)?n[o]:void 0,t),Oa=t=>{let e={};for(let n of Object.keys(t)){let o=n.split(".");if(o.some(s=>Ta.has(s)))continue;let r=e;for(let s of o.slice(0,-1))r=xt(r[s])?r[s]:r[s]={};r[o[o.length-1]]=t[n]}return e},Na=t=>Je(t)&&(typeof CSS>"u"||!CSS.supports||CSS.supports("color",t)),eo=(t,e,n)=>Array.isArray(t)?Array.isArray(e)&&(t.every(o=>!xt(o))?e.length===t.length&&e.every((o,r)=>eo(t[r],o,n)):e.length>=2&&e.length<=64&&e.every(o=>eo(t[0],o,n))):xt(t)?xt(e)&&!Array.isArray(e)&&Object.keys(t).every(o=>eo(t[o],e[o],n)):typeof e==typeof t&&(typeof e!="number"||Number.isFinite(e))&&(!n||!Je(t)||Na(e)),_s=(t,e)=>e!=null&&!t.el?.closest(".is-disabled")&&eo(t.get(),e,t.m.type==="color"||t.m.type==="gradient")&&(!t.m.options||t.m.options.some(n=>JSON.stringify(Zt(n))===JSON.stringify(e))),Hs=(t,e,n=[])=>t.map(o=>[o,Fs(e,o.path.slice(n.length))]).filter(([o,r])=>_s(o,r)),Pa=(t,e)=>{let n={};for(let[o,r]of e){let s=n;for(let i of o.path.slice(0,-1))s=s[i]||(s[i]={});s[o.path[o.path.length-1]]=r}t.fromJSON({values:n})};$s=new WeakMap});var js={};sr(js,{fold:()=>Fa});var Fa,Bs=gn(()=>{Et();Fa=(t,e)=>{let n=getComputedStyle(t),o=t._fold?.playState=="running"&&{marginBottom:n.marginBottom,clipPath:n.clipPath,opacity:n.opacity};t._fold?.cancel(),t.classList.remove("tw-cond-hidden");let r=!oe.matches&&t.animate&&t.offsetHeight;if(t.classList.toggle("tw-cond-hidden",e),r)try{let s=r+6+parseFloat(n.marginTop),i=r+"px",a={height:i,marginBottom:-s+"px",clipPath:`inset(0 0 ${s}px)`,opacity:0},l={height:i,clipPath:"inset(0)"};(t._fold=t.animate([o||(e?l:a),e?a:l],{duration:350,easing:n.getPropertyValue("--tw-ease-fold").trim()})).onfinish=()=>t.classList.toggle("tw-cond-hidden",e),t.classList.remove("tw-cond-hidden")}catch{}}});Et();var si="http://www.w3.org/2000/svg",Ot=(t,e)=>{let n=document.createElementNS(si,t);return e&&n.setAttribute("class",e),n},pr=(t,e)=>getComputedStyle(t).getPropertyValue(e).trim(),An=t=>{let e=getComputedStyle(t),n=o=>e.getPropertyValue(o).trim();return n("--tw-accent")||n("--tw-text-primary")||"#fff"},fr=t=>{let e=!1;t.addEventListener("pointerdown",n=>{e=n.button===0&&document.activeElement!==t}),t.addEventListener("focus",()=>t.select()),t.addEventListener("mouseup",n=>{e&&(e=!1,n.button===0&&document.activeElement===t&&t.selectionStart===0&&t.selectionEnd===t.value.length&&n.preventDefault())})};function re(t,{onDown:e,onMove:n,onEnd:o}={}){let r=null,s=i=>{r===null||i.pointerId!==r||(r=null,o&&o(i))};t.addEventListener("pointerdown",i=>{if(!(i.button!==0||r!==null)){r=i.pointerId;try{t.setPointerCapture(i.pointerId)}catch{}e&&e(i)}}),t.addEventListener("pointermove",i=>{if(i.pointerId===r){if(i.buttons===0)return s(i);n&&n(i)}}),t.addEventListener("pointerup",s),t.addEventListener("pointercancel",s),t.addEventListener("lostpointercapture",s)}var Fe=(t,e)=>re(t,{onDown:n=>{t.classList.add("is-grabbing"),e(n)},onMove:e,onEnd:()=>t.classList.remove("is-grabbing")}),_e=(t,e)=>{let n=e.getBoundingClientRect();return[$((t.clientX-n.left)/n.width,0,1),$((t.clientY-n.top)/n.height,0,1)]},mr=(t,e,n=1/0)=>{let o=t.getBoundingClientRect(),r=Math.min(window.devicePixelRatio||1,n);return t.width=o.width*r,t.height=o.height*r,e.setTransform(r,0,0,r,0,0),[o.width,o.height]},Wt=(t,e)=>{let n=w("div",t),o=Mt("tw-trigger");o.setAttribute("aria-expanded","false");let r=w("span","tw-trigger-right");return o.append(nt("span","tw-trigger-label",e),r),n.append(o),{root:n,trigger:o,right:r}},ii=$t('<path d="M6 4v8M10 4v8"/>',"",1.5,16);function ai(){let t=null,e=0,n=0,o=0;return{show(r,s,i,a){t=w("div","tw-grab-guide tw-portal"),t.innerHTML='<span class="tw-grab-line"></span><span class="tw-grab-dot"></span><span class="tw-grab-arrow"></span><span class="tw-grab-bubble"></span>',e=s,n=r,o=i??r,t.children[1].style.cssText=`left:${r}px;top:${e}px`,Ne(t,a),document.body.appendChild(t)},move(r,s){t&&(t.children[0].style.cssText=`left:${Math.min(n,r)}px;top:${e}px;width:${Math.abs(r-n)}px`,t.children[2].style.cssText=`left:${r}px;top:${e}px;transform:translate(-50%,-50%) scaleX(${r>=n?1:-1})`,t.children[3].style.cssText=`left:${o}px;top:${e-16}px`,t.children[3].textContent=s)},hide(){t&&(t.remove(),t=null)}}}function li(t,e,n,o,r,s){let i=0,a=0,l=1,h=ai();re(t,{onDown:u=>{u.preventDefault(),i=u.clientX,a=o(),l=1,t.classList.add("is-dragging");let d=e.getBoundingClientRect();h.show(u.clientX,d.top+d.height/2,d.left+d.width/2,e),h.move(u.clientX,s())},onMove:u=>{let d=u.shiftKey?10:u.altKey?.1:1;d!==l&&(l=d,i=u.clientX,a=o()),r(a+(u.clientX-i)*n*d),h.move(u.clientX,s())},onEnd:()=>{t.classList.remove("is-dragging"),h.hide()}})}function Rt(t,e){let n=Number.isFinite(+t.step)&&+t.step>0?+t.step:1,o=m=>m==null?NaN:+m,r=o(t.min),s=o(t.max);if(Number.isFinite(r)&&Number.isFinite(s)&&s<r){let m=r;r=s,s=m}let i=Number.isFinite(r)?r:0,a=ce(n),[l,h]=Pe(Number.isFinite(r)?r:-1/0,Number.isFinite(s)?s:1/0,n,i),u=m=>{let M=Me(m,i,n);return t.soft?M:$(M,l,h)},d=u(Number.isFinite(+t.value)?+t.value:0),p=w("div",t.row?"tw-row":"tw-field"),N=w("div","tw-num-wrap"),L=w("span","tw-num-grab",ii);L.setAttribute("aria-hidden","true"),L.title="Drag to adjust";let b=w("input","tw-num");b.type="text",b.inputMode="decimal",b.setAttribute("aria-label",t.unit?`${t.label} (${t.unit})`:t.label),b.value=d.toFixed(a),Yt(b),N.append(L,b),t.unit&&N.append(nt("span","tw-num-unit",t.unit)),p.append(nt("span",t.row?"tw-row-label":"tw-field-label",t.label),N);let g=(m,M=!0)=>{m=+m,Number.isFinite(m)&&(d=u(m),b.value=d.toFixed(a),M&&e&&e(d))};return b.addEventListener("change",()=>{let m=parseFloat(b.value);g(isNaN(m)?d:m)}),b.addEventListener("keydown",m=>{if(m.key==="Enter")return b.blur();let M=m.key==="ArrowUp"?1:m.key==="ArrowDown"?-1:0;if(!M)return;m.preventDefault();let C=parseFloat(b.value);g((isNaN(C)?d:C)+M*n*(m.shiftKey?10:1))}),li(L,N,n,()=>d,g,()=>b.value),{el:p,set:m=>g(m,!1),get:()=>d}}lt("number",(t,e)=>Rt({...t,row:!0},e));var ci=(t,e,n)=>{let o=Math.sqrt(t/n),r=e/(2*Math.sqrt(t*n));return Math.min(2.2,9/Math.max(r*o,.5))};function en(t,e,n,o=64,r=ci(t,e,n)){let s=Math.sqrt(t/n),i=e/(2*Math.sqrt(t*n)),a=[];for(let l=0;l<o;l++){let h=l/(o-1)*r,u;if(i<1-1e-4){let d=s*Math.sqrt(1-i*i);u=1-Math.exp(-i*s*h)*(Math.cos(d*h)+i*s/d*Math.sin(d*h))}else if(i<=1+1e-4)u=1-Math.exp(-s*h)*(1+s*h);else{let d=Math.sqrt(i*i-1),p=s*(i+d),N=s*(i-d);u=1-(p*Math.exp(-N*h)-N*Math.exp(-p*h))/(p-N)}a.push(u)}return a}Et();var ui=180/Math.PI,Mo=Math.PI/180,se=(t,e)=>[t[0][0]*e[0]+t[0][1]*e[1]+t[0][2]*e[2],t[1][0]*e[0]+t[1][1]*e[1]+t[1][2]*e[2],t[2][0]*e[0]+t[2][1]*e[1]+t[2][2]*e[2]],di=(t,e)=>{let n=[[0,0,0],[0,0,0],[0,0,0]];for(let o=0;o<3;o++)for(let r=0;r<3;r++)n[o][r]=t[o][0]*e[0][r]+t[o][1]*e[1][r]+t[o][2]*e[2][r];return n},St=t=>Number.isFinite(t)?t:0,pi=(t,e,n)=>Math.min(n,Math.max(e,t)),Tn=t=>{let e=Math.abs(t);return e<=.04045?t/12.92:Math.sign(t)*((e+.055)/1.055)**2.4},nn=t=>{let e=Math.abs(t);return e<=.0031308?t*12.92:Math.sign(t)*(1.055*e**(1/2.4)-.055)},Pn=1.09929682680944,kr=.018053968510807,fi=t=>{let e=Math.abs(t);return e<kr*4.5?t/4.5:Math.sign(t)*((e+Pn-1)/Pn)**(1/.45)},Cr=t=>{let e=Math.abs(t);return e<kr?t*4.5:Math.sign(t)*(Pn*e**.45-(Pn-1))},Lr=1/512,mi=t=>{let e=Math.abs(t);return e<=Lr*16?t/16:Math.sign(t)*e**1.8},gi=t=>{let e=Math.abs(t);return e>=Lr?Math.sign(t)*e**(1/1.8):16*t},Eo=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],On=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],bi=[[.4865709486482162,.26566769316909306,.19821728523436247],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],Sr=[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]],hi=[[.6369580483012914,.14461690358620832,.16888097516417205],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],Ar=[[1.7166511879712674,-.35567078377639233,-.25336628137365974],[-.6666843518324892,1.6164812366349395,.01576854581391113],[.017639857445310783,-.042770613257808524,.9421031212354738]],wi=[[.7977604896723027,.13518583717574031,.0313493495815248],[.2880711282292934,.7118432178101014,8565396060525902e-20],[0,0,.8251046025104601]],yi=[[1.3457989731028281,-.25558010007997534,-.05110628506753401],[-.5446224939028347,1.5082327413132781,.02053603239147973],[0,0,1.2119675456389454]],Tr=[[1.0479298208405488,.022946793341019088,-.05019222954313557],[.029627815688159344,.990434484573249,-.01707382502938514],[-.009243058152591178,.015055144896577895,.7518742899580008]],Or=[[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]],vi=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],Nr=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],Ei=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],Pr=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],Nn=216/24389,on=24389/27,Ie=[.3457/.3585,1,(1-.3457-.3585)/.3585],He=(t,e,n)=>se(n,[e(t[0]),e(t[1]),e(t[2])]),De=(t,e,n)=>{let o=se(n,t);return[e(o[0]),e(o[1]),e(o[2])]},gr=t=>{let e=se(Pr,t);return se(Nr,[e[0]**3,e[1]**3,e[2]**3])},br=t=>{let e=se(vi,t);return se(Ei,[Math.cbrt(e[0]),Math.cbrt(e[1]),Math.cbrt(e[2])])};function hr(t){let[e,n,o]=t,r=(e+16)/116,s=n/500+r,i=r-o/200,a=s**3>Nn?s**3:(116*s-16)/on,l=e>on*Nn?r**3:e/on,h=i**3>Nn?i**3:(116*i-16)/on;return se(Or,[a*Ie[0],l*Ie[1],h*Ie[2]])}function wr(t){let e=se(Tr,t),n=i=>i>Nn?Math.cbrt(i):(on*i+16)/116,o=n(e[0]/Ie[0]),r=n(e[1]/Ie[1]),s=n(e[2]/Ie[2]);return[116*r-16,500*(o-r),200*(r-s)]}var Rn=t=>{let e=Math.hypot(t[1],t[2]),n=Math.atan2(t[2],t[1])*ui;return n<0&&(n+=360),[t[0],e,n]},$n=t=>[t[0],t[1]*Math.cos(t[2]*Mo),t[1]*Math.sin(t[2]*Mo)];function Rr(t){let e=((Number.isNaN(t[0])?0:t[0])%360+360)%360,n=t[1]/100,o=t[2]/100,r=s=>{let i=(s+e/30)%12,a=n*Math.min(o,1-o);return o-a*Math.max(-1,Math.min(i-3,9-i,1))};return[r(0),r(8),r(4)]}function $r(t){let e=Math.max(...t),n=Math.min(...t),o=e-n;if(o<1e-9)return NaN;let r;return e===t[0]?r=(t[1]-t[2])/o+(t[1]<t[2]?6:0):e===t[1]?r=(t[2]-t[0])/o+2:r=(t[0]-t[1])/o+4,r*60}function xi(t){let e=Math.max(...t),n=Math.min(...t),o=(n+e)/2,r=$r(t),s=e===n||o===0||o===1?0:(e-o)/Math.min(o,1-o);return s<0&&(r+=180,s=-s),r>=360&&(r-=360),[r,s*100,o*100]}function Mi(t){let e=t[1]/100,n=t[2]/100;if(e+n>=1){let s=e/(e+n);return[s,s,s]}let o=Rr([t[0],100,50]),r=1-e-n;return[o[0]*r+e,o[1]*r+e,o[2]*r+e]}var ki=t=>[$r(t),Math.min(...t)*100,(1-Math.max(...t))*100];function Ci(t,e){switch(e){case"srgb":return He(t,Tn,Eo);case"p3":return He(t,Tn,bi);case"rec2020":return He(t,fi,hi);case"prophoto-rgb":return se(Or,He(t,mi,wi));case"oklab":return gr(t);case"oklch":return gr($n(t));case"lab":return hr(t);case"lch":return hr($n(t));case"hsl":return He(Rr(t),Tn,Eo);case"hwb":return He(Mi(t),Tn,Eo)}}function Li(t,e){switch(e){case"srgb":return De(t,nn,On);case"p3":return De(t,nn,Sr);case"rec2020":return De(t,Cr,Ar);case"prophoto-rgb":return De(se(Tr,t),gi,yi);case"oklab":return br(t);case"oklch":return Rn(br(t));case"lab":return wr(t);case"lch":return Rn(wr(t));case"hsl":return xi(De(t,nn,On));case"hwb":return ki(De(t,nn,On))}}function Nt(t,e,n){return e===n?[t[0],t[1],t[2]]:e==="oklch"&&n==="oklab"?$n(t):e==="oklab"&&n==="oklch"?Rn(t):e==="lch"&&n==="lab"?$n(t):e==="lab"&&n==="lch"?Rn(t):Li(Ci(t,e),n)}var Fn=75e-6,Fr=t=>t.every(e=>e>=-Fn&&e<=1+Fn),ko=(t,e)=>Fr(Nt(t,"oklch",e)),xo=t=>t.map(e=>Math.min(1,Math.max(0,e))),yr=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]);function _n(t,e){if(ko(t,e))return Nt(t,"oklch",e);let n=t[0];if(n>=1)return[1,1,1];if(n<=0)return[0,0,0];if(!Number.isFinite(t[1]))return xo(Nt([n,0,St(t[2])],"oklch",e));let o=.02,r=1e-4,s=[t[0],t[1],t[2]],i=0,a=t[1],l=!0,h=xo(Nt(s,"oklch",e));if(yr(Nt(h,e,"oklab"),Nt(t,"oklch","oklab"))<o)return h;for(;a-i>r;){let u=(i+a)/2;s[1]=u;let d=Nt(s,"oklch",e);if(l&&Fr(d)){i=u;continue}h=xo(d);let p=yr(Nt(h,e,"oklab"),Nt(s,"oklch","oklab"));if(p<o){if(o-p<r)return h;l=!1,i=u}else a=u}return h}var _r=(t,e)=>{let n=t*Mo,o=Math.cos(n),r=Math.sin(n),s=Pr.map(a=>o*a[1]+r*a[2]),i=di(e==="p3"?Sr:e==="rec2020"?Ar:On,Nr);return{d:s,F:i,gam:e==="rec2020"?Cr:nn}};function Hn(t,e){let{d:[n,o,r],F:s,gam:i}=_r(t,e),a=-Fn,l=1+Fn;return(h,u)=>{let d=h+u*n,p=h+u*o,N=h+u*r,L=d**3,b=p**3,g=N**3,m=i(s[0][0]*L+s[0][1]*b+s[0][2]*g);if(m<a||m>l)return!1;let M=i(s[1][0]*L+s[1][1]*b+s[1][2]*g);if(M<a||M>l)return!1;let C=i(s[2][0]*L+s[2][1]*b+s[2][2]*g);return C>=a&&C<=l}}function Hr(t,e){let{d:[n,o,r],F:s,gam:i}=_r(t,e);return(a,l,h)=>{let u=a+l*n,d=a+l*o,p=a+l*r,N=u**3,L=d**3,b=p**3;h[0]=i(s[0][0]*N+s[0][1]*L+s[0][2]*b),h[1]=i(s[1][0]*N+s[1][1]*L+s[1][2]*b),h[2]=i(s[2][0]*N+s[2][1]*L+s[2][2]*b)}}function Dn(t,e,n=.5){if(!t(e,0))return 0;let o=0;for(let r=0;r<16;r++){let s=(o+n)/2;t(e,s)?o=s:n=s}return o}var ke=t=>Math.round(Math.min(1,Math.max(0,t))*255).toString(16).padStart(2,"0"),Si=t=>`#${ke(t[0])}${ke(t[1])}${ke(t[2])}`,In=(t,e,n)=>Si(_n([t,e,n],"srgb"));function Dr(t){let e=String(t).replace("#","").trim();if(e.length===3&&(e=e.split("").map(o=>o+o).join("")),e.length<6)return[.7,.1,280];let n=[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255];return Nt(n,"srgb","oklch").map(St)}var jn=["hex","srgb","css","hsl","hwb","oklch","oklab","lch","lab","p3","rec2020"],Ir={hex:"HEX",srgb:"RGB",css:"CSS",hsl:"HSL",hwb:"HWB",oklch:"OKLCH",oklab:"OKLab",lch:"LCH",lab:"Lab",p3:"P3",rec2020:"Rec2020"},jr=["srgb","css","hsl","hwb","hex"],Co=t=>!jr.includes(t),Br=t=>t==="hex"||t==="css"?"srgb":t,Ai=Object.assign(Object.create(null),{hex:"srgb",srgb:"srgb",css:"srgb",hsl:"hsl",hwb:"hwb",oklch:"oklch",oklab:"oklab",lch:"lch",lab:"lab",p3:"display-p3",rec2020:"rec2020"}),Vr=t=>Ai[t]||"oklch",Ti=Object.assign(Object.create(null),{srgb:"srgb",hsl:"hsl",hwb:"hwb",oklch:"oklch",oklab:"oklab",lch:"lch",lab:"lab","display-p3":"p3",rec2020:"rec2020"}),Lo=t=>Ti[t]||"oklch",Bn=.5,Gr=(t,e,n)=>Object.freeze(["R","G","B"].map(o=>Object.freeze({k:o,min:0,max:t,step:e,scale:n}))),vr=Gr(255,1,255),Er=Gr(1,.01,1),rn={oklch:[{k:"L",min:0,max:100,step:1,scale:100},{k:"C",min:0,max:Bn,step:.01,scale:1},{k:"H",min:0,max:360,step:1,scale:1}],oklab:[{k:"L",min:0,max:100,step:1,scale:100},{k:"a",min:-.4,max:.4,step:.01,scale:1},{k:"b",min:-.4,max:.4,step:.01,scale:1}],lch:[{k:"L",min:0,max:100,step:1,scale:1},{k:"C",min:0,max:150,step:1,scale:1},{k:"H",min:0,max:360,step:1,scale:1}],lab:[{k:"L",min:0,max:100,step:1,scale:1},{k:"a",min:-125,max:125,step:1,scale:1},{k:"b",min:-125,max:125,step:1,scale:1}],srgb:vr,css:vr,hsl:[{k:"H",min:0,max:360,step:1,scale:1},{k:"S",min:0,max:100,step:1,scale:1},{k:"L",min:0,max:100,step:1,scale:1}],hwb:[{k:"H",min:0,max:360,step:1,scale:1},{k:"W",min:0,max:100,step:1,scale:1},{k:"B",min:0,max:100,step:1,scale:1}],p3:Er,rec2020:Er},xr=t=>t>=1?0:t>=.1?1:t>=.01?2:3,Xr=(t,e,n)=>e==="oklch"?[t[0],t[1],t[2]]:jr.includes(n)?e==="srgb"?_n(t,"srgb"):Nt(_n(t,"srgb"),"srgb",e):Nt(t,"oklch",e);function Vn(t,e){let n=Xr(t,Br(e),e);return rn[e].map((o,r)=>{let s=St(n[r])*o.scale;return pi(Math.abs(s)<.5*o.step?0:s,o.min,o.max)})}function zr(t,e,n,o){let r=Br(e),s=Xr(t,r,e).map(St);s[n]=o/rn[e][n].scale;let i=Nt(s,r,"oklch");return[St(i[0]),St(i[1]),St(i[2])]}function Kr(t,e){if(!Co(e))return"sRGB";let n=_n(t,"srgb");return Math.max(...n)<.03||Math.min(...n)>.97||ko(t,"srgb")?"sRGB":ko(t,"p3")?"P3":"wide"}function So(t,e){if(e==="hex")return In(t[0],t[1],t[2]);let n=rn[e],o=Vn(t,e),r=s=>{let i=o[s].toFixed(xr(n[s].step));return n[s].k==="H"&&+i==360?0 .toFixed(xr(n[s].step)):i};return e==="css"?`${r(0)}, ${r(1)}, ${r(2)}`:e==="oklch"||e==="oklab"||e==="lch"||e==="lab"?`${r(0)}% ${r(1)} ${r(2)}`:e==="hsl"||e==="hwb"?`${r(0)} ${r(1)}% ${r(2)}%`:`${r(0)} ${r(1)} ${r(2)}`}var Mr=(t,e)=>e==="hex"?t:e==="srgb"?`rgb(${t})`:e==="css"?`rgba(${t}, 1)`:e==="hsl"?`hsl(${t})`:e==="hwb"?`hwb(${t})`:e==="p3"?`color(display-p3 ${t})`:e==="rec2020"?`color(rec2020 ${t})`:`${e}(${t})`;function qr(t,e,n){let o=St(n);if(e==="hex")return In(t[0],t[1],t[2])+(o<.999?ke(o):"");let r=So(t,e);if(o>=.999)return Mr(r,e);let s=+o.toFixed(3);return e==="css"?`rgba(${r}, ${s})`:Mr(`${r} / ${s}`,e)}var Yr=(()=>{try{return document.createElement("canvas").getContext("2d",{colorSpace:"display-p3"})?.getContextAttributes?.().colorSpace==="display-p3"}catch{return!1}})(),Ao=Yr?{colorSpace:"display-p3"}:{},Oi=Yr?"p3":"srgb",Gn=(t,e)=>{let n=t.length-1,o=Math.max(0,Math.min(n,e*n)),r=Math.floor(o),s=o-r;return t[r]*(1-s)+t[Math.min(r+1,n)]*s},Ni=(t,e)=>{let n=Hn(t,e),o=new Float64Array(128);for(let r=0;r<128;r++)o[r]=Dn(n,r/127);return o},Ro="var(--tw-checker)",Pi=Object.assign(Object.create(null),{srgb:"srgb","display-p3":"p3",rec2020:"rec2020","prophoto-rgb":"prophoto-rgb"}),$o=/^(rgba?|hsla?|hwb)\([ \t\n\r\f]*([^)]*?)[ \t\n\r\f]*\)$/i,Fo=/^(oklch|oklab|lch|lab|color)\([ \t\n\r\f]*([^)]*?)[ \t\n\r\f]*\)$/i,Ri=/^(srgb|srgb-linear|display-p3|a98-rgb|prophoto-rgb|rec2020|xyz|xyz-d50|xyz-d65)$/i,Xn=/^#?([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,To,Wr=()=>To===void 0?To=document.createElement("canvas").getContext("2d"):To,$i=/^(#[0-9a-f]{3,8}|[a-z][a-z-]*(?:\([\w\s.,%+\-\/]*\))?)$/i;function je(t){if(t=String(t??"").trim(),!$i.test(t))return!1;if(Xn.test(t))return!0;if(Fo.test(t))return Hi(t);if($o.test(t))return Jr(t)!==null;let e=Wr();return e?["#000","#fff"].some(n=>{e.fillStyle=n;let o=e.fillStyle;return e.fillStyle=t,e.fillStyle!==o}):!0}var _o="[+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:e[+-]?\\d+)?",Fi=new RegExp("^"+_o+"$","i"),_i=new RegExp("^"+_o+"%$","i"),Ur=new RegExp("^("+_o+")(deg|grad|rad|turn)$","i"),Ho=/[ \t\n\r\f]+/,Do=/^none$/i,Oo=t=>t.replace(/^[ \t\n\r\f]+|[ \t\n\r\f]+$/g,""),No=t=>!!t&&!Ho.test(t),Ce=t=>Do.test(t)?"none":Fi.test(t)?"num":_i.test(t)?"pct":Ur.test(t)?"angle":null,Po=t=>{let e=Ur.exec(t);if(!e)return St(parseFloat(t));let n=parseFloat(e[1]),o=e[2].toLowerCase();return St(o==="turn"?n*360:o==="grad"?n*.9:o==="rad"?n*180/Math.PI:n)};function Jr(t){let e=$o.exec(t);if(!e)return null;let n=e[1].toLowerCase().replace(/a$/,""),o=e[2],r,s,i;if(o.includes(",")){if(n==="hwb")return null;let u=o.split(",").map(Oo);if(u.length<3||u.length>4||!u.every(No)||(r=u.slice(0,3),s=u[3],i=r.map(Ce),n==="rgb"?!(i.every(d=>d==="num")||i.every(d=>d==="pct")):!((i[0]==="num"||i[0]==="angle")&&i[1]==="pct"&&i[2]==="pct"))||s!==void 0&&Ce(s)!=="num"&&Ce(s)!=="pct")return null}else{let u=o.split("/");if(u.length>2||(r=u[0].split(Ho).filter(Boolean),r.length!==3))return null;if(u.length===2){s=Oo(u[1]);let d=No(s)?Ce(s):null;if(!d||d==="angle")return null}if(i=r.map(Ce),n==="rgb"?!i.every(d=>d&&d!=="angle"):!(i[0]&&i[0]!=="pct"&&i[1]&&i[1]!=="angle"&&i[2]&&i[2]!=="angle"))return null}let a=(u,d)=>Do.test(u)?0:/%$/.test(u)?parseFloat(u)/100*d:parseFloat(u),l=s===void 0?1:$(a(s,1),0,1);return[n==="rgb"?Nt([$(a(r[0],255)/255,0,1),$(a(r[1],255)/255,0,1),$(a(r[2],255)/255,0,1)],"srgb","oklch"):Nt([i[0]==="none"?0:Po(r[0]),$(a(r[1],100),0,100),$(a(r[2],100),0,100)],n,"oklch"),l]}var Hi=t=>{let e=Fo.exec(t);if(!e)return!1;let n=e[1].toLowerCase(),o=e[2].split("/");if(o.length>2)return!1;let r=o[0].split(Ho).filter(Boolean);if(n==="color"&&!Ri.test(r.shift()||"")||r.length!==3)return!1;let s=n==="lch"||n==="oklch";if(!r.every((i,a)=>{let l=Ce(i);return l&&(s&&a===2?l!=="pct":l!=="angle")}))return!1;if(o.length===2){let i=Oo(o[1]),a=No(i)?Ce(i):null;if(!a||a==="angle")return!1}return!0};function Le(t){if(t=String(t??"").trim(),Xn.test(t)){let a=t.replace("#",""),l=1;a.length===4?(l=parseInt(a[3]+a[3],16)/255,a=a.slice(0,3)):a.length===8&&(l=parseInt(a.slice(6,8),16)/255,a=a.slice(0,6));let[h,u,d]=Dr("#"+a);return[h,u,d,l]}let e=Fo.exec(t);if(e){let a=e[1].toLowerCase(),[l,h]=e[2].split("/").map(g=>g.trim()),u=l.split(/\s+/).filter(Boolean),d=a;if(a==="color"&&(d=Pi[(u[0]||"").toLowerCase()],u=u.slice(1),!d))return[.7,.1,280,1];let p=(g,m=1)=>!g||Do.test(g)?0:St(parseFloat(g))*(/%$/.test(g)?m:1),N=h?$(p(h,.01),0,1):1,L=a==="lab"?[$(p(u[0]),0,100),p(u[1],1.25),p(u[2],1.25)]:a==="lch"?[$(p(u[0]),0,100),Math.max(0,p(u[1],1.5)),Po(u[2]||"0")]:a==="color"?[p(u[0],.01),p(u[1],.01),p(u[2],.01)]:a==="oklab"?[$(p(u[0],.01),0,1),p(u[1],.004),p(u[2],.004)]:[$(p(u[0],.01),0,1),Math.max(0,p(u[1],.004)),Po(u[2]||"0")],b=d==="oklch"?L:Nt(L,d,"oklch");return[St(b[0]),$(St(b[1]),0,Bn),(St(b[2])%360+360)%360,N]}if($o.test(t)){let a=Jr(t);if(!a)return[0,0,0,1];let[l,h]=a;return[St(l[0]),$(St(l[1]),0,Bn),(St(l[2])%360+360)%360,h]}let n=Wr();if(!n)return[0,0,0,1];n.fillStyle="#000",n.fillStyle=t;let o=n.fillStyle;if(Xn.test(o))return Le(o);let r=o.match(/^rgba?\(([^)]*)\)/i),s=((r?r[1]:"").match(/-?[\d.]+(?:e[+-]?\d+)?/gi)||[0,0,0]).map(Number),i=Nt([s[0]/255,s[1]/255,s[2]/255],"srgb","oklch");return[St(i[0]),St(i[1]),St(i[2]),s[3]!=null?$(St(s[3]),0,1):1]}function Be(t,e){let[n,o,r,s]=Le(t.value||"#7c5cff"),i=jn.includes(t.mode)?t.mode:"oklch",a=NaN,l=null,h=[],u=NaN,d="",p=()=>qr([n,o,r],i,s),N=w("div","tw-color-body"),L=w("div","tw-wg-area"),b=document.createElement("canvas");b.className="tw-wg-canvas";let g=w("div","tw-wg-thumb");L.append(b,g);let m=w("div","tw-wg-hue"),M=document.createElement("canvas");M.className="tw-wg-hue-canvas";let C=w("div","tw-wg-hue-thumb");m.append(M,C);let j=w("div","tw-wg-alpha"),B=w("div","tw-wg-alpha-grad"),H=w("div","tw-wg-hue-thumb");j.append(B,H),b.setAttribute("aria-hidden","true"),M.setAttribute("aria-hidden","true"),L.tabIndex=0,L.setAttribute("role","group"),L.setAttribute("aria-label","Colour plane: chroma across, lightness up"),m.tabIndex=0,m.setAttribute("role","slider"),m.setAttribute("aria-label","Hue"),m.setAttribute("aria-valuemin","0"),m.setAttribute("aria-valuemax","360"),j.tabIndex=0,j.setAttribute("role","slider"),j.setAttribute("aria-label","Alpha"),j.setAttribute("aria-valuemin","0"),j.setAttribute("aria-valuemax","1");let D=w("div","tw-color-mode-row"),G=w("select","tw-color-mode");G.setAttribute("aria-label","Color mode"),jn.forEach(I=>{let K=document.createElement("option");K.value=I,K.textContent=Ir[I],G.append(K)}),G.value=i;let W=w("span","tw-color-gamut");D.append(G,W);let P=w("div","tw-color-channels");N.append(L,m,j,D,P);let R=b.getContext("2d",Ao),tt=M.getContext("2d"),q=document.createElement("canvas"),U=q.getContext("2d",Ao),at=null,A=()=>{let I=L.getBoundingClientRect(),K=Math.round(I.width),dt=Math.round(I.height);if(K<2)return;let gt=window.devicePixelRatio||1,mt=Co(i)?"p3":"srgb",Ht=Ni(r,mt);l=Ht;let Dt=Math.round(K*gt),O=Math.round(dt*gt),ot=Math.max(1,Math.round(Dt/4)),At=Math.max(1,Math.round(O/4));(q.width!==ot||q.height!==At)&&(q.width=ot,q.height=At,at=new ImageData(ot,At,Ao));let bt=at.data,ct=At>1?1/(At-1):0,Ct=ot>1?1/(ot-1):0,Bt=Hr(r,Oi),Kt=[0,0,0];for(let qt=0;qt<At;qt++){let Qt=1-qt*ct,ve=Gn(Ht,Qt);for(let ae=0;ae<ot;ae++){Bt(Qt,ae*Ct*ve,Kt);let te=(qt*ot+ae)*4;bt[te]=Math.round($(Kt[0],0,1)*255),bt[te+1]=Math.round($(Kt[1],0,1)*255),bt[te+2]=Math.round($(Kt[2],0,1)*255),bt[te+3]=255}}if(U.putImageData(at,0,0),b.width=Dt,b.height=O,R.imageSmoothingEnabled=!0,R.drawImage(q,0,0,Dt,O),mt!=="srgb"){let qt=(Qt,ve,ae,te)=>{let qe=Hn(r,Qt),Ee=[];for(let It=0;It<=100;It++){let ee=It/100,Ye=Gn(Ht,ee);if(Ye<=0)continue;let Te=Dn(qe,ee,Ye);Te<=0||Ee.push([Math.min(Te/Ye*Dt,Dt-ae*gt/2),(1-ee)*O])}Ee.length<2||(R.save(),R.strokeStyle=ve,R.lineWidth=ae*gt,R.lineJoin=R.lineCap="round",R.setLineDash(te.map(It=>It*gt)),R.beginPath(),Ee.forEach((It,ee)=>ee?R.lineTo(It[0],It[1]):R.moveTo(It[0],It[1])),R.stroke(),R.restore())};qt("srgb","rgba(255,255,255,0.7)",1.5,[]),qt("p3","rgba(255,255,255,0.4)",1,[3,3])}a=r},F=.7,v=I=>{let K=Nt([F,Dn(Hn(I,"srgb"),F),I],"oklch","srgb");return`rgb(${$(K[0]*255,0,255)|0},${$(K[1]*255,0,255)|0},${$(K[2]*255,0,255)|0})`},f=0,S=()=>{let I=m.getBoundingClientRect(),K=Math.max(1,Math.round(I.width)),dt=Math.max(1,Math.round(I.height));if(!(K<2)&&!(K===f&&M.width===K)){f=K,M.width=K,M.height=dt;for(let gt=0;gt<K;gt++)tt.fillStyle=v(gt/(K-1)*360),tt.fillRect(gt,0,1,dt)}},k=()=>{let I=l?Gn(l,n):.4,K=mt=>`${$(mt,0,1)*100}%`,dt=(mt,Ht)=>{let Dt=$(mt,0,1);return`calc(${Dt*100}% + ${(.5-Dt)*Ht}px)`};g.style.left=K(I>0?o/I:0),g.style.top=K(1-n),C.style.left=dt(r/360,16),H.style.left=dt(s,16),j.setAttribute("aria-valuenow",String(+s.toFixed(2)));let gt=Math.round(r);m.setAttribute("aria-valuenow",String(gt)),m.setAttribute("aria-valuetext",`${gt}\xB0`),L.setAttribute("aria-description",`lightness ${Math.round(n*100)}%, chroma ${+o.toFixed(3)}`),B.style.background=`linear-gradient(to right, oklch(${n} ${o} ${r} / 0), oklch(${n} ${o} ${r}))`,g.style.background=`oklch(${n} ${o} ${r})`,H.style.background=`linear-gradient(oklch(${n} ${o} ${r} / ${s}), oklch(${n} ${o} ${r} / ${s})), var(--tw-dropdown-bg)`,r!==u&&(d=v(r),u=r),C.style.background=d},x=()=>{if(W.textContent=Kr([n,o,r],i),i==="hex"){let I=P.querySelector(".tw-color-chan-input");I&&document.activeElement!==I&&(I.value=In(n,o,r)+(s<.999?ke(s):""))}else{let I=Vn([n,o,r],i);h.forEach((K,dt)=>{K.el.contains(document.activeElement)||K.set(I[dt])})}},V=()=>{S(),A(),k()},Z=()=>e(p()),T=I=>{I&&r!==a&&A(),k(),x()},Y=I=>{T(I),Z()},st=()=>{if(P.replaceChildren(),h=[],i==="hex"){P.classList.add("tw-color-channels--hex");let I=w("div","tw-color-chan"),K=w("input","tw-color-chan-input");K.type="text",K.spellcheck=!1,K.setAttribute("aria-label","Hex color"),Yt(K),fr(K),K.addEventListener("change",()=>{let dt=K.value.trim();Xn.test(dt)&&([n,o,r,s]=Le(dt),Y(!0))}),K.addEventListener("blur",x),K.addEventListener("keydown",dt=>{dt.key==="Enter"&&K.blur()}),I.append(nt("span","tw-color-chan-label","HEX"),K),P.append(I)}else{P.classList.remove("tw-color-channels--hex");let I=Vn([n,o,r],i);rn[i].forEach((K,dt)=>{let gt=Rt({label:K.k,value:I[dt],min:K.min,max:K.max,step:K.step},mt=>{[n,o,r]=zr([n,o,r],i,dt,$(mt,K.min,K.max)),Y(!0)});gt.el.addEventListener("focusout",x),h.push(gt),P.append(gt.el)})}x()},ut=I=>l?Gn(l,I):.4,Lt=I=>_e(I,L);Fe(L,I=>{let[K,dt]=Lt(I);n=1-dt,o=K*ut(n),Y(!1)}),L.addEventListener("keydown",I=>{if(I.key==="Home"||I.key==="End"){I.preventDefault();return}let K=I.shiftKey?10:1,dt=I.key==="ArrowRight"?K:I.key==="ArrowLeft"?-K:0,gt=I.key==="ArrowUp"?K:I.key==="ArrowDown"?-K:I.key==="PageUp"?10:I.key==="PageDown"?-10:0;if(!dt&&!gt)return;I.preventDefault();let mt=ut(n),Ht=$((mt>0?o/mt:0)+dt*.01,0,1);n=$(n+gt*.01,0,1),o=Ht*ut(n),Y(!1)});let kt=I=>_e(I,m)[0]*360;Fe(m,I=>{r=kt(I),Y(!0)}),m.addEventListener("keydown",I=>{let K=ge(I,r,1,0,360);K!=null&&(I.preventDefault(),r=$(K,0,360),Y(!0))});let _t=I=>_e(I,j)[0];Fe(j,I=>{s=_t(I),Y(!1)}),j.addEventListener("keydown",I=>{let K=ge(I,s,.01,0,1);K!=null&&(I.preventDefault(),s=$(K,0,1),Y(!1))});let Tt=I=>{i=I,G.value=I,st(),A(),k()};return G.addEventListener("change",()=>{Tt(G.value),t.onMode&&t.onMode()}),st(),{el:N,set:I=>{let K=document.activeElement;K&&N.contains(K)&&K.matches("input")&&K.blur(),[n,o,r,s]=Le(I),T(!0)},get:()=>p(),mode:()=>i,setMode:I=>{I!==i&&jn.includes(I)&&Tt(I)},reflow:V,swatchCss:()=>`linear-gradient(oklch(${n} ${o} ${r} / ${s}), oklch(${n} ${o} ${r} / ${s})), ${Ro}`,valueText:()=>So([n,o,r],i)+(s<.999?i==="hex"?ke(s):` / ${+s.toFixed(2)}`:"")}}function Di(t,e){let{root:n,trigger:o,right:r}=Wt("tw-color",t.label??"Colour"),s=w("span","tw-trigger-chip tw-color-swatch"),i=w("span","tw-trigger-value");r.append(s,i);let a=w("div","tw-color-pop"),l=()=>{s.style.background=h.swatchCss(),i.textContent=h.valueText()},h=Be({value:t.value,onMode:()=>l()},u=>{l(),e(u)});return a.append(h.el),n.append(a),Xt(n,o,a,{width:240,fallbackH:340,gap:6,onOpen:h.reflow,onReflow:h.reflow}),l(),{el:n,set:u=>{u!=null&&(h.set(u),l())},get:()=>h.get()}}var Zr=(t,e,n,o)=>o<.999?`oklch(${+t.toFixed(4)} ${+e.toFixed(4)} ${+n.toFixed(2)} / ${+o.toFixed(3)})`:`oklch(${+t.toFixed(4)} ${+e.toFixed(4)} ${+n.toFixed(2)})`;lt("color",Di);lt("colorpicker",Be);Et();yn();var Ii=$t('<path d="M12 5v14m7-7H5"/>',"",2.5),os=(t,e)=>t&&!Array.isArray(t)&&typeof t[e]=="string"?t[e]:null,Qr=t=>os(t,"interpolation"),ts=t=>os(t,"easing"),es=[["linear","Linear"],["ease","Ease"],["ease-in","Ease in"],["ease-out","Ease out"],["ease-in-out","Ease in-out"]];function ns(t){let e=[{color:"oklch(0.72 0.19 25)",pos:0},{color:"oklch(0.72 0.16 280)",pos:1}],n=Array.isArray(t)?t:t&&Array.isArray(t.stops)?t.stops:null,o=(s,i)=>je(s)?{color:String(s).trim(),pos:$(+i||0,0,1)}:null,r=(n||[]).map(s=>Array.isArray(s)?o(s[0],s[1]):s&&typeof s=="object"?o(s.color,s.pos):null).filter(Boolean);return r.length>=2?r:e}function ji(t,e){t.value??(t.value=t.stops);let n=ns(t.value),o=n[0],r=io(ts(t.value)),{root:s,trigger:i,right:a}=Wt("tw-gradient",t.label??"Gradient"),l=w("span","tw-trigger-chip tw-gradient-preview");l.setAttribute("role","img"),a.append(l);let h=w("div","tw-color-pop tw-gradient-pop"),u=w("div","tw-gradient-bar-row"),d=w("div","tw-gradient-bar"),p=w("div","tw-gradient-grad"),N=w("div","tw-gradient-rail");d.append(p,N);let L=Mt("tw-gradient-add",Ii);L.title="Add a stop after the selected one",L.setAttribute("aria-label","Add a colour stop after the selected one"),u.append(d,L);let b=()=>[...n].sort((v,f)=>v.pos-f.pos),g=()=>Vr(H.mode()),m=()=>({stops:b().map(v=>({color:v.color,pos:+v.pos.toFixed(4)})),interpolation:g(),easing:r}),M=()=>{let v=wn(m());p.style.background=v,l.style.background=`${v}, ${Ro}`},C=()=>{l.setAttribute("aria-label",`${n.length} stop${n.length===1?"":"s"}`)},j=()=>e(m()),B=v=>[...N.children].find(f=>f._stop===v),H=Be({value:o.color,mode:Lo(Qr(t.value)||"oklch"),onMode:()=>{M(),j()}},v=>{o.color=v,B(o)?.style.setProperty("--stop",v),M(),j()}),D=w("select","tw-color-mode tw-gradient-ease");D.setAttribute("aria-label","Easing between stops"),D.title="How the ramp blends between stops";for(let[v,f]of es){let S=document.createElement("option");S.value=v,S.textContent=f,D.append(S)}let G=()=>{let v=D.querySelector("option[data-custom]");es.some(([f])=>f===r)?v?.remove():(v||(v=document.createElement("option"),v.dataset.custom="",v.textContent="Custom",D.append(v)),v.value=r),D.value=r};D.addEventListener("change",()=>{r=D.value,G(),M(),j()}),H.el.querySelector(".tw-color-mode").after(D),G(),h.append(u,H.el),s.append(h);let W=v=>v.setAttribute("aria-label",`Colour stop at ${Math.round(v._stop.pos*100)}%${v._stop===o?", selected":""}`),P=()=>{for(let v of N.children)v.dataset.sel=String(v._stop===o),W(v)},R=()=>{N.replaceChildren();for(let v of n){let f=Mt("tw-gradient-stop");f._stop=v,f.style.left=v.pos*100+"%",f.style.setProperty("--stop",v.color),f.dataset.sel=String(v===o),W(f),f.addEventListener("focus",()=>tt(v,!1));let S=!1;re(f,{onDown:k=>{k.preventDefault(),k.stopPropagation(),f.focus({focusVisible:!1}),tt(v,!1),S=!1},onMove:k=>{let x=N.getBoundingClientRect();v.pos=$((k.clientX-x.left)/(x.width||1),0,1),f.style.left=v.pos*100+"%",W(f),M(),j(),S=n.length>2&&(k.clientY<x.top-24||k.clientY>x.bottom+24),f.dataset.removing=String(S)},onEnd:()=>{S?at(v):f.dataset.removing="false"}}),f.addEventListener("dblclick",k=>{k.preventDefault(),at(v)}),f.addEventListener("keydown",k=>{let x=k.key==="ArrowLeft"?-1:k.key==="ArrowRight"?1:0;x&&(k.preventDefault(),v.pos=$(v.pos+x*(k.shiftKey?.1:.01),0,1),f.style.left=v.pos*100+"%",W(f),M(),j())}),N.append(f)}},tt=(v,f)=>{v!==o&&(H.set(v.color),o=v),f?R():P()},q=v=>{let f=N.getBoundingClientRect();return $((v-f.left)/(f.width||1),0,1)},U=v=>{let f=b(),S=f[0],k=f[f.length-1];for(let ut=0;ut<f.length-1;ut++)if(v>=f[ut].pos&&v<=f[ut+1].pos){S=f[ut],k=f[ut+1];break}let x=lr(hn(r),k.pos>S.pos?$((v-S.pos)/(k.pos-S.pos),0,1):0),V=Le(S.color),Z=Le(k.color),T=ut=>ut[1]<1e-4,Y=Z[2]-V[2];Y>180?Y-=360:Y<-180&&(Y+=360),(T(V)||T(Z))&&(Y=0);let st=(((T(V)&&!T(Z)?Z[2]:V[2])+Y*x)%360+360)%360;return Zr(V[0]+(Z[0]-V[0])*x,V[1]+(Z[1]-V[1])*x,st,V[3]+(Z[3]-V[3])*x)},at=v=>{if(n.length<=2)return;let f=n.indexOf(v);if(f<0)return;n.splice(f,1);let S=o===v?n[Math.max(0,f-1)]:o;M(),tt(S,!0),C(),j(),B(o)?.focus()},A=v=>{let f={color:U(v),pos:$(v,0,1)};return n.push(f),M(),tt(f,!0),C(),j(),f},F=()=>{let v=b(),f=v.indexOf(o);f<0&&(f=0);let S=f<v.length-1?(v[f].pos+v[f+1].pos)/2:f>0?(v[f-1].pos+v[f].pos)/2:$(v[f].pos+.1,0,1);A(S)};return L.addEventListener("click",v=>{v.stopPropagation(),F()}),d.addEventListener("dblclick",v=>{v.target.closest(".tw-gradient-stop")||(v.preventDefault(),A(q(v.clientX)))}),h.tabIndex=-1,h.addEventListener("keydown",v=>{(v.key==="Delete"||v.key==="Backspace")&&!v.altKey&&!/^(input|textarea|select)$/i.test(v.target.tagName)&&n.length>2&&(v.preventDefault(),at(o))}),Xt(s,i,h,{width:260,fallbackH:392,gap:6,onOpen:H.reflow,onReflow:H.reflow,initialFocus:()=>B(o)}),R(),M(),C(),{el:s,set:v=>{let f=Qr(v);f&&H.setMode(Lo(f));let S=ts(v);S!==null&&(r=io(S),G());let k=ns(v).sort((x,V)=>x.pos-V.pos);if(k.length===n.length)b().forEach((x,V)=>{x.color=k[V].color,x.pos=k[V].pos;let Z=B(x);Z&&(Z.style.left=x.pos*100+"%",Z.style.setProperty("--stop",x.color))});else{let x=o.pos;n=k,o=n.reduce((V,Z)=>Math.abs(Z.pos-x)<Math.abs(V.pos-x)?Z:V,n[0]),R()}M(),C(),H.set(o.color)},get:()=>m()}}lt("gradient",ji);Et();var sn={x:0,y:8,blur:24,spread:0,color:"rgb(0 0 0 / 0.18)"},he=(t,e)=>t!=null&&t!==""&&Number.isFinite(+t)?+t:e,Ut=t=>String(+t.toFixed(1)),Bi=/#[0-9a-f]{3,8}\b|(?:oklch|oklab|rgba?|hsla?|hwb|lab|lch|color)\([^()]*\)/i,Vi=/^(-?\d*\.?\d+)(px)?$/,Gi=t=>{let e=Bi.exec(t);if(!e||!je(e[0]))return null;let n=(t.slice(0,e.index)+" "+t.slice(e.index+e[0].length)).trim().split(/\s+/).filter(Boolean),o=n.includes("inset"),r=n.filter(i=>i!=="inset");if(r.length<2||r.length>4||!r.every(i=>Vi.test(i)))return null;let s=r.map(i=>+i.replace(/px$/,""));return{inset:o,x:s[0],y:s[1],blur:s[2]??0,spread:s[3]??0,color:e[0]}},Xi=$t('<path d="M18 9s-4.4 6-6 6-6-6-6-6"/>',"tw-shadow-chevron",2.5);function zi(t,e){let n=k=>typeof k=="string"?Gi(k):xt(k)?k:null,o=n(t.value??t)||{},r=!!o.inset,s=he(o.x,sn.x),i=he(o.y,sn.y),a=Math.max(0,he(o.blur,sn.blur)),l=he(o.spread,sn.spread),{root:h,trigger:u,right:d}=Wt("tw-shadow",t.label??"Shadow"),p=w("span","tw-trigger-chip tw-shadow-chip"),N=w("span","tw-shadow-chip-tile");p.append(N);let L=w("span","tw-trigger-value");d.append(p,L);let b=w("div","tw-color-pop tw-shadow-pop"),g=w("div","tw-shadow-stage"),m=w("div","tw-shadow-card");g.append(m);let M=be([{value:"outer",label:"Outer"},{value:"inner",label:"Inner"}],r?"inner":"outer",k=>{k==="inner"!==r&&(r=k==="inner",v(),F())},"Shadow position"),C=w("div","tw-row");C.append(nt("span","tw-row-label","Position"),M.el);let j=w("div","tw-fields tw-shadow-fields"),B=(k,x,V,Z)=>{let T=Rt({label:k,value:x(),step:1,min:Z,unit:"px"},Y=>{V(Y),v(),F()});return j.append(T.el),T},H=B("X",()=>s,k=>{s=k}),D=B("Y",()=>i,k=>{i=k}),G=B("Blur",()=>a,k=>{a=Math.max(0,k)},0),W=B("Spread",()=>l,k=>{l=k});s=H.get(),i=D.get(),a=G.get(),l=W.get();let P=Mt("tw-trigger tw-shadow-color");P.setAttribute("aria-expanded","false");let R=w("span","tw-trigger-chip tw-color-swatch"),tt=w("span","tw-trigger-value"),q=w("span","tw-trigger-right");q.append(R,tt),q.insertAdjacentHTML("beforeend",Xi),P.append(nt("span","tw-trigger-label","Colour"),q);let U=Be({value:typeof o.color=="string"&&je(o.color)?o.color:sn.color,onMode:()=>v()},()=>{v(),F()});U.el.hidden=!0,P.addEventListener("click",()=>{let k=U.el.hidden;U.el.hidden=!k,P.setAttribute("aria-expanded",String(k)),f.reflow()}),b.append(g,C,j,P,U.el),h.append(b);let at=k=>`${r?"inset ":""}${Ut(s*k)}px ${Ut(i*k)}px ${Ut(a*k)}px ${Ut(l*k)}px ${U.get()}`,A=()=>({inset:r,x:+Ut(s),y:+Ut(i),blur:+Ut(a),spread:+Ut(l),color:U.get(),css:at(1)}),F=()=>e(A()),v=()=>{m.style.boxShadow=at(1),N.style.boxShadow=at(.3),L.textContent=`${r?"in ":""}${Ut(s)} ${Ut(i)} ${Ut(a)}${l?" "+Ut(l):""}`,R.style.background=U.swatchCss(),tt.textContent=U.valueText()},f=Xt(h,u,b,{width:260,fallbackH:300,gap:6,onOpen:U.reflow,onReflow:U.reflow});return v(),{el:h,set:k=>{let x=n(k);x&&(x.inset!=null&&(r=!!x.inset,M.set(r?"inner":"outer")),x.x!=null&&(H.set(he(x.x,s)),s=H.get()),x.y!=null&&(D.set(he(x.y,i)),i=D.get()),x.blur!=null&&(G.set(he(x.blur,a)),a=G.get()),x.spread!=null&&(W.set(he(x.spread,l)),l=W.get()),typeof x.color=="string"&&je(x.color)&&U.set(x.color),v())},get:A}}lt("shadow",zi);Et();var Ki=$t('<path d="M10.5 13.5a4 4 0 0 0 5.6 0l3-3a4 4 0 0 0-5.6-5.6l-1.5 1.5M13.5 10.5a4 4 0 0 0-5.6 0l-3 3a4 4 0 0 0 5.6 5.6l1.5-1.5"/>'),qi=/^(-?\d*\.?\d+)([a-z%]*)$/i,rs=t=>t!=null&&t!==""&&Number.isFinite(+t)?+t:null,ss=t=>String(+t.toFixed(2)),is=t=>t.length===1?[t[0],t[0],t[0],t[0]]:t.length===2?[t[0],t[1],t[0],t[1]]:t.length===3?[t[0],t[1],t[2],t[1]]:t.slice(0,4),as=(t,e)=>{if(typeof t=="number")return Number.isFinite(t)?[t,t,t,t]:null;if(typeof t=="string"){let n=t.trim().split(/\s+/).map(o=>{let r=qi.exec(o);return r?+r[1]:NaN});return n.length>=1&&n.length<=4&&n.every(Number.isFinite)?is(n):null}if(Array.isArray(t)){let n=t.map(rs);return n.length>=1&&n.length<=4&&n.every(o=>o!==null)?is(n):null}if(t&&typeof t=="object"){let n=t,o=e.slice(),r=!1;return["top","right","bottom","left"].forEach((s,i)=>{let a=rs(n[s]);a!==null&&(o[i]=a,r=!0)}),r?o:null}return null};function Yi(t,e){let n=typeof t.unit=="string"&&t.unit.trim()?t.unit.trim():"px",o=!!t.corners,r={step:t.step??1,min:t.min,max:t.max,unit:n},s=as(t.value??t,[0,0,0,0])||[0,0,0,0],i=s.every(H=>H===s[0]),a=w("div","tw-sides"),l=Rt({label:t.label,value:s[0],row:!0,...r},H=>{s=[H,H,H,H],C(),M()}),h=Mt("tw-sides-link",Ki);h.setAttribute("aria-label","Link all sides"),h.title="Same on all sides",h.addEventListener("click",()=>j());let u=w("div","tw-sides-multi"),d=w("div","tw-sides-head"),p=w("span","tw-sides-sum");d.append(nt("span","tw-row-label",t.label),p);let N=w("div","tw-fields"),b=(o?["TL","TR","BR","BL"]:["T","R","B","L"]).map((H,D)=>{let G=Rt({label:H,value:s[D],...r},W=>{s[D]=W,C(),M()});return N.append(G.el),G});u.append(d,N),a.append(l.el,u),s=b.map(H=>H.get());let g=()=>{let[H,D,G,W]=s.map(ss),P=R=>R==="0"?"0":R+n;return(H===G&&D===W?H===D?[H]:[H,D]:D===W?[H,D,G]:[H,D,G,W]).map(P).join(" ")},m=()=>({top:s[0],right:s[1],bottom:s[2],left:s[3],css:g()}),M=()=>e(m()),C=()=>{a.classList.toggle("is-linked",i),h.setAttribute("aria-pressed",String(i)),i?l.el.insertBefore(h,l.el.lastChild):d.append(h),l.set(s[0]),b.forEach((H,D)=>H.set(s[D])),p.textContent=s.map(ss).join(" ")},j=()=>{i=!i,i&&(s=[s[0],s[0],s[0],s[0]]),C(),M(),h.focus()};return C(),{el:a,set:H=>{let D=as(H,s);D&&(b.forEach((G,W)=>G.set(D[W])),s=b.map(G=>G.get()),i=s.every(G=>G===s[0]),C())},get:m}}lt("sides",Yi);Et();function Wi(t,e){let n=t.label,o=+(t.value&&t.value[0]),r=+(t.value&&t.value[1]),s=Number.isFinite(o)?o:0,i=Number.isFinite(r)?r:1,[a,l]=[ue(s),ue(i)],h=S=>S!=null&&S!==""&&Number.isFinite(+S),{min:u,max:d,step:p}=En(h(t.min)?t.min:Math.min(a[0],l[0]),h(t.max)?t.max:Math.max(a[1],l[1]),t.step,s,i);[u,d]=Pe(u,d,p);let N=ce(p),L=S=>Me(S,u,p),b=$(L(Number.isFinite(o)?o:u),u,d),g=$(L(Number.isFinite(r)?r:d),u,d);if(b>g){let S=b;b=g,g=S}let m=w("div","tw-slider-wrap"),M=w("div","tw-slider tw-interval"),C=w("div","tw-slider-fill"),j=w("div","tw-slider-handle"),B=w("div","tw-slider-handle"),H=nt("span","tw-slider-label",n),D=w("span","tw-slider-value");M.append(C,j,B,H,D),m.append(M),[["minimum",j],["maximum",B]].forEach(([S,k])=>{k.tabIndex=0,k.setAttribute("role","slider"),k.setAttribute("aria-label",`${n} ${S}`),k.setAttribute("aria-valuemin",String(u)),k.setAttribute("aria-valuemax",String(d))});let G=S=>(S-u)/(d-u||1)*100,W=S=>`clamp(5px, calc(${S}% - 1.5px), calc(100% - 9px))`,P=()=>{let S=G(b),k=G(g);C.style.left=S+"%",C.style.width=Math.max(0,k-S)+"%",j.style.left=W(S),B.style.left=W(k),D.textContent=`${b.toFixed(N)} \u2013 ${g.toFixed(N)}`,j.setAttribute("aria-valuenow",String(b)),B.setAttribute("aria-valuenow",String(g));let x=m.offsetWidth;if(x){H.style.maxWidth=Math.max(0,x-D.offsetWidth-12-8-10)+"px";let V=Z=>xn(H,D,Z/100*x-1.5,3);j.classList.toggle("is-dodge",V(G(b))),B.classList.toggle("is-dodge",V(G(g)))}};P();let R=()=>e([b,g]),tt=S=>{b=$(Math.min(L(S),g),u,d),P()},q=S=>{g=$(Math.max(L(S),b),u,d),P()},U=null,at=1,A=null,F=S=>{let k=m.offsetWidth||U.width,x=$((S-U.left)/at/k,0,1);return $(u+x*(d-u),u,d)},v=S=>{let k=F(S);A||(A=k<b?"lo":k>g?"hi":Math.abs(k-b)<=Math.abs(k-g)?"lo":"hi"),A==="lo"?tt(k):q(k),R()};re(M,{onDown:S=>{S.preventDefault(),U=m.getBoundingClientRect(),at=U.width/(m.offsetWidth||U.width),M.classList.add("is-active","is-dragging"),A=null,v(S.clientX),(A==="lo"?j:B).focus({focusVisible:!1})},onMove:S=>v(S.clientX),onEnd:()=>{U=null,A=null,M.classList.remove("is-active","is-dragging")}}),Mn(M,P),jt(P),Gt(M,[[window,"resize"],[window,"tw-reflow"]],P);let f=S=>k=>{let x=S==="lo"?ge(k,b,p,u,g):ge(k,g,p,b,d);x!=null&&(k.preventDefault(),S==="lo"?tt(x):q(x),R())};return j.addEventListener("keydown",f("lo")),B.addEventListener("keydown",f("hi")),{el:m,set:S=>{if(Array.isArray(S)){let k=+S[0],x=+S[1];if(!Number.isFinite(k)||!Number.isFinite(x))return;b=$(L(Math.min(k,x)),u,d),g=$(L(Math.max(k,x)),u,d),P()}},get:()=>[b,g]}}lt("interval",Wi);Et();var Ui=0;function Ji(t){let e=`tw-tabs-${++Ui}`,n=w("div","tw-tabs"),o=w("div","tw-tabs-bar");o.setAttribute("role","tablist");let r=w("div","tw-tabs-pill");o.append(r);let s=w("div","tw-tabs-pages"),i=[],a=t.pages.map((u,d)=>{let p=nt("button","tw-tabs-tab",u.title);p.setAttribute("role","tab"),p.dataset.active=String(d===0),p.setAttribute("aria-selected",String(d===0)),p.tabIndex=d===0?0:-1,p.id=`${e}-tab-${d}`,p.setAttribute("aria-controls",`${e}-page-${d}`);let N=w("div","tw-tabs-page tw-controls");return N.dataset.active=String(d===0),N.setAttribute("role","tabpanel"),N.id=`${e}-page-${d}`,N.setAttribute("aria-labelledby",p.id),i.push(N),s.append(N),p.addEventListener("click",()=>h(d)),o.append(p),p});n.append(o,s);let l=u=>wo(o,r,u);function h(u){a.forEach((d,p)=>{d.dataset.active=String(p===u),d.setAttribute("aria-selected",String(p===u)),d.tabIndex=p===u?0:-1}),i.forEach((d,p)=>d.dataset.active=String(p===u)),l(!0),requestAnimationFrame(()=>window.dispatchEvent(new Event("tw-reflow")))}return o.addEventListener("keydown",u=>{let d=a.findIndex(N=>N.dataset.active==="true");if(d<0)return;let p=tn(u.key,d,a.length,-1);p<0||(u.preventDefault(),h(p),a[p].focus())}),jt(l),{el:n,bodies:i,activate:h,active:()=>a.findIndex(u=>u.dataset.active==="true")}}lt("tabs",Ji);Et();var Zi=t=>String(t).replace(/[\\"]/g,"\\$&").replace(/[\x00-\x1f\x7f]/g,e=>"\\"+e.charCodeAt(0).toString(16)+" ");function Qi(t,e){let n=t.value||"",{root:o,trigger:r,right:s}=Wt("tw-image",t.label);r.removeAttribute("aria-expanded"),r.setAttribute("aria-label",`${t.label}: choose an image`);let i=w("span","tw-image-text"),a=w("span","tw-trigger-chip tw-image-thumb");s.append(a,i);let l=w("input","tw-image-input");l.type="file",l.accept="image/*",o.append(l);let h=()=>{a.dataset.set=n?"true":"false",a.style.backgroundImage=n?`url("${Zi(n)}")`:"",i.textContent=n?"Replace":"Drop or choose"},u=d=>{if(!d||!d.type.startsWith("image/"))return;let p=new FileReader;p.onload=()=>{n=String(p.result),h(),e(n)},p.readAsDataURL(d)};return r.addEventListener("click",()=>l.click()),l.addEventListener("change",()=>{l.files[0]&&u(l.files[0])}),r.addEventListener("dragover",d=>{d.preventDefault(),r.dataset.over="true"}),r.addEventListener("dragleave",()=>{r.dataset.over="false"}),r.addEventListener("drop",d=>{d.preventDefault(),r.dataset.over="false",d.dataTransfer.files[0]&&u(d.dataTransfer.files[0])}),h(),{el:o,set:d=>{d!=null&&typeof d!="string"||(n=d||"",h())},get:()=>n}}lt("image",Qi);Et();var ta=(t,e,n,o,r,s,i)=>{let a=r.length;t.clearRect(0,0,n,o),t.strokeStyle=An(e),t.lineWidth=1.5,t.lineJoin="round",t.beginPath();let l=!1;for(let h=0;h<a;h++){let u=r[(s+h)%a];if(Number.isNaN(u))continue;let d=h/(a-1)*n,p=o-$(i(u),0,1)*o;l?t.lineTo(d,p):(t.moveTo(d,p),l=!0)}t.stroke()},ea=t=>{for(let e of["resize","tw-reflow"])window.addEventListener(e,t);return()=>{for(let e of["resize","tw-reflow"])window.removeEventListener(e,t)}};function ls(t,e=!1){let n=typeof t.get=="function"?t.get:()=>t.value,o=Math.max(30,Number.isFinite(+t.interval)?+t.interval:200),r;try{r=n()}catch{}let s=typeof r=="number",i=t.view==="graph"||s&&t.graph!==!1&&t.view!=="text"&&t.rows==null,a=w("div","tw-fps tw-monitor"),l=nt("span","tw-fps-val","\u2014");a.append(nt("span","tw-fps-label",t.label??"Monitor"),l);let h=0,u=0,d=()=>{},p=!1,N=Number.isFinite(+t.decimals)?Math.min(20,Math.max(0,Math.floor(+t.decimals))):2,L=P=>P==null?"\u2014":typeof P=="number"?Number.isInteger(P)||!Number.isFinite(P)?String(P):P.toFixed(N):typeof P=="object"?Ze(P):String(P),b=()=>{h&&clearInterval(h),h=0,u&&cancelAnimationFrame(u),u=0,d()},g=P=>{let R=tt=>{if(e&&(u=requestAnimationFrame(R)),!a.isConnected){p&&b();return}p=!0;let q;try{q=n(tt)}catch{return}P(q)};e?u=requestAnimationFrame(R):h=setInterval(R,o)};if(!i&&t.rows){l.remove();let P=Math.max(1,Math.floor(+t.rows)||1),R=w("pre","tw-monitor-buffer");R.style.setProperty("--tw-monitor-rows",P),a.append(R);let tt=[];return g(q=>{for(tt.push(L(q));tt.length>P;)tt.shift();R.textContent=tt.join(`
3
+ `)}),de(a,b)}if(!i)return g(P=>{l.textContent=L(P)}),de(a,b);let m=document.createElement("canvas");m.className="tw-fps-canvas",a.append(m);let M=m.getContext("2d");if(!M)return g(P=>{l.textContent=L(P)}),de(a,b);let C=80,j=new Array(C).fill(NaN),B=0,H=0,D=0,G=()=>{[H,D]=mr(m,M,2)};d=ea(G);let W=()=>{if(H||G(),!H)return;let P=t.min,R=t.max;if(P==null||R==null){let q=1/0,U=-1/0;for(let A of j)Number.isFinite(A)&&(A<q&&(q=A),A>U&&(U=A));q===1/0?(q=0,U=1):q===U&&(q-=.5,U+=.5);let at=(U-q)*.1;P==null&&(P=q-at),R==null&&(R=U+at)}let tt=R-P||1;ta(M,a,H,D,j,B,q=>(q-P)/tt)};return g(P=>{if(typeof P!="number"||!Number.isFinite(P)){l.textContent=L(P);return}j[B]=P,B=(B+1)%C,l.textContent=L(P),W()}),de(a,b)}var na=()=>{let t=0;return e=>{if(!(e>0))return;let n=t?1e3/(e-t):void 0;return t=e,n}},oa=t=>ls({...t,label:t.label??"FPS",get:na(),view:"graph",min:0,max:120,decimals:0},!0);lt("fpsgraph",oa);lt("monitor",t=>ls(t));Et();function ra(t,e){let n=(T,Y,st)=>Number.isFinite(+T)?Math.max(Y,+T):st,o=T=>({stiffness:n(T.stiffness,1,300),damping:n(T.damping,.5,26),mass:n(T.mass,.1,1)}),r=T=>Number.isFinite(+T),a=T=>$(r(T)?+T:.5,.1,1),l=T=>$(r(T)?+T:.2,0,1),h=T=>+T.toPrecision(10),u=T=>{let Y=(2*Math.PI/T.visualDuration)**2,st=1-T.bounce,ut=1;return{stiffness:h(Y),damping:h(2*st*Math.sqrt(Y*ut)),mass:ut}},d=T=>T==="time"||T==="physics"?T:null,p={stiffness:t.stiffness,damping:t.damping,mass:t.mass,visualDuration:t.visualDuration,bounce:t.bounce,...t.value||{}},N=d(p.mode)??d(t.mode)??(r(p.visualDuration)||r(p.bounce)?"time":"physics"),L={visualDuration:a(p.visualDuration),bounce:l(p.bounce)},b=o({stiffness:p.stiffness,damping:p.damping,mass:p.mass}),g=w("div","tw-spring"),m=w("div","tw-spring-viz"),M=document.createElement("canvas");M.className="tw-spring-canvas",m.append(M);let C=w("div","tw-fields"),j=w("div","tw-fields"),B=M.getContext("2d"),H=()=>o(N==="time"?u(L):b),D=()=>{let T=m.getBoundingClientRect(),Y=Math.max(1,Math.round(T.width)),st=Math.max(1,Math.round(T.height));if(Y<2)return;let ut=window.devicePixelRatio||1;M.width=Y*ut,M.height=st*ut,B.setTransform(ut,0,0,ut,0,0),B.clearRect(0,0,Y,st);let Lt=H(),pt=en(Lt.stiffness,Lt.damping,Lt.mass,Math.max(160,Math.round(Y*ut))),kt=Math.max(1.05,...pt),ft=8,_t=Tt=>ft+Tt/(pt.length-1)*(Y-2*ft),Pt=Tt=>st-ft-Tt/kt*(st-2*ft);B.strokeStyle=pr(g,"--tw-surface-active")||"rgba(255,255,255,0.1)",B.lineWidth=1,B.beginPath(),B.moveTo(ft,Pt(1)),B.lineTo(Y-ft,Pt(1)),B.stroke(),B.strokeStyle=An(g),B.lineWidth=1.5,B.lineJoin=B.lineCap="round",B.beginPath(),pt.forEach((Tt,I)=>I?B.lineTo(_t(I),Pt(Tt)):B.moveTo(_t(I),Pt(Tt))),B.stroke()},G=()=>N==="time"?{...H(),visualDuration:L.visualDuration,bounce:L.bounce}:H(),W=()=>e(G()),P={};[["stiffness","Stiffness",1],["damping","Damping",.5],["mass","Mass",.1]].forEach(([T,Y,st])=>{P[T]=Rt({label:Y,value:b[T],step:st,min:st},ut=>{b[T]=ut,D(),W()}),C.append(P[T].el)});let R=Rt({label:"Duration",value:L.visualDuration*1e3,step:50,min:.1*1e3,max:1*1e3,unit:"ms"},T=>{L.visualDuration=a(T/1e3),D(),W()}),tt=Rt({label:"Bounce",value:L.bounce*100,step:5,min:0,max:100,unit:"%"},T=>{L.bounce=l(T/100),D(),W()});j.append(R.el,tt.el);let q=()=>{j.style.display=N==="time"?"":"none",C.style.display=N==="physics"?"":"none"},at=be([{value:"time",label:"Time"},{value:"physics",label:"Physics"}],N,T=>{T!=="time"&&T!=="physics"||T===N||(N=T,q(),D(),W())},"Spring mode"),A=w("div","tw-row");A.append(nt("span","tw-row-label","Mode"),at.el),t.label&&g.append(nt("div","tw-spring-label",t.label)),g.append(m,A,C,j);let F=1,v=500,f=1,S=40,k=null,x=T=>{if(!k)return;let Y=$((T.clientX-k.left)/k.width,0,1),st=$((T.clientY-k.top)/k.height,0,1);N==="time"?(R.set((.1+Y*(1-.1))*1e3),L.visualDuration=R.get()/1e3,tt.set((1-st)*100),L.bounce=tt.get()/100):(P.stiffness.set(F+Y*(v-F)),b.stiffness=P.stiffness.get(),P.damping.set(f+st*(S-f)),b.damping=P.damping.get()),D(),W()};re(m,{onDown:T=>{T.preventDefault(),k=m.getBoundingClientRect(),m.classList.add("is-dragging"),x(T)},onMove:x,onEnd:()=>{k=null,m.classList.remove("is-dragging")}}),q(),jt(D),Gt(M,[[window,"resize"],[window,"tw-reflow"],[matchMedia("(prefers-color-scheme: dark)"),"change"],[window,"tw-retheme"]],D);let V=null,Z=!1;return typeof MutationObserver=="function"&&(V=new MutationObserver(()=>{M.isConnected?(Z=!0,D()):Z&&(V.disconnect(),V=null)}),V.observe(document.documentElement,{subtree:!0,attributes:!0,attributeFilter:["data-tw-scheme"]})),{el:g,destroy:()=>{V&&(V.disconnect(),V=null)},set:T=>{if(!T||typeof T!="object")return;let Y=d(T.mode),st=r(T.visualDuration)||r(T.bounce),ut=r(T.stiffness)||r(T.damping)||r(T.mass);!st&&!ut&&!Y||(N=Y??(st?"time":"physics"),st&&(r(T.visualDuration)&&(L.visualDuration=a(T.visualDuration)),r(T.bounce)&&(L.bounce=l(T.bounce))),ut&&(b=o({...b,...T})),at.set(N),R.set(L.visualDuration*1e3),tt.set(L.bounce*100),P.stiffness.set(b.stiffness),P.damping.set(b.damping),P.mass.set(b.mass),q(),D())},get:()=>G()}}lt("spring",ra);Et();function sa(t,e){let n=[.25,.1,.25,1],o=-.25,r=1.25,s=r-o,i=8,a=A=>A.map((F,v)=>$(F,v%2?o:0,v%2?r:1)),l=Array.isArray(t.value)&&t.value.length===4?t.value.map(Number):n.slice();l.some(A=>!Number.isFinite(A))&&(l=n.slice()),l=a(l);let h=l.slice(),u=w("div","tw-bezier");t.label&&u.append(nt("div","tw-bezier-label",t.label));let d=w("div","tw-bezier-graph"),p=Ot("svg","tw-bezier-svg");p.setAttribute("preserveAspectRatio","none");let N=Ot("line","tw-bezier-guide"),L=Ot("line","tw-bezier-guide"),b=Ot("line","tw-bezier-diag"),g=Ot("line","tw-bezier-ctl"),m=Ot("line","tw-bezier-ctl"),M=Ot("path","tw-bezier-curve");p.append(N,L,b,g,m,M);let C=Mt("tw-bezier-handle");C.setAttribute("aria-label","Control point 1");let j=Mt("tw-bezier-handle");j.setAttribute("aria-label","Control point 2"),d.append(p,C,j);let B=w("div","tw-fields tw-bezier-fields");u.append(d,B);let H=0,D=0,G=A=>i+A*(H-2*i),W=A=>D-i-(A-o)/s*(D-2*i),P=(A,F,v,f,S)=>{A.setAttribute("x1",F),A.setAttribute("y1",v),A.setAttribute("x2",f),A.setAttribute("y2",S)},R=()=>{if(C.setAttribute("aria-label",`Control point 1, x ${l[0]}, y ${l[1]}`),j.setAttribute("aria-label",`Control point 2, x ${l[2]}, y ${l[3]}`),H=d.offsetWidth,D=d.offsetHeight,H<2)return;p.setAttribute("viewBox",`0 0 ${H} ${D}`);let[A,F,v,f]=l,S=G(0),k=W(0),x=G(1),V=W(1),Z=G(A),T=W(F),Y=G(v),st=W(f);P(N,i,k,H-i,k),P(L,i,V,H-i,V),P(b,S,k,x,V),P(g,S,k,Z,T),P(m,x,V,Y,st),M.setAttribute("d",`M${S},${k} C${Z},${T} ${Y},${st} ${x},${V}`),C.style.left=Z+"px",C.style.top=T+"px",j.style.left=Y+"px",j.style.top=st+"px"},tt=[{label:"X1",i:0,lo:0,hi:1},{label:"Y1",i:1,lo:o,hi:r},{label:"X2",i:2,lo:0,hi:1},{label:"Y2",i:3,lo:o,hi:r}],q=tt.map(A=>{let F=Rt({label:A.label,value:l[A.i],step:.01,min:A.lo,max:A.hi},v=>{l[A.i]=v,R(),e(l.slice())});return B.append(F.el),F}),U=()=>q.forEach((A,F)=>A.set(l[tt[F].i])),at=(A,F)=>{let v=null,f=0,S=0,k=1;re(A,{onDown:x=>{x.preventDefault(),v=d.getBoundingClientRect(),f=d.offsetWidth||v.width,S=d.offsetHeight||v.height,k=v.width/f,A.classList.add("is-dragging"),A.focus({focusVisible:!1})},onMove:x=>{let V=(x.clientX-v.left)/k,Z=(x.clientY-v.top)/k,T=$((V-i)/(f-2*i),0,1),Y=$(o+(S-i-Z)/(S-2*i)*s,o,r);l[F*2]=+T.toFixed(2),l[F*2+1]=+Y.toFixed(2),R(),U(),e(l.slice())},onEnd:()=>{v=null,A.classList.remove("is-dragging")}}),A.addEventListener("keydown",x=>{if(x.key==="Escape")return A.blur();if(x.key==="Home"){x.preventDefault(),l=h.slice(),R(),U(),e(l.slice());return}let V=x.key==="ArrowRight"?1:x.key==="ArrowLeft"?-1:0,Z=x.key==="ArrowUp"?1:x.key==="ArrowDown"?-1:0;if(!V&&!Z)return;x.preventDefault();let T=x.shiftKey?.1:.01,Y=F*2;V&&(l[Y]=+$(l[Y]+V*T,0,1).toFixed(2)),Z&&(l[Y+1]=+$(l[Y+1]+Z*T,o,r).toFixed(2)),R(),U(),e(l.slice())})};return at(C,0),at(j,1),jt(R),Gt(u,[[window,"resize"],[window,"tw-reflow"]],R),{el:u,set:A=>{if(Array.isArray(A)&&A.length===4){let F=A.map(Number);if(F.some(v=>!Number.isFinite(v)))return;l=a(F),R(),U()}},get:()=>l.slice()}}lt("cubicbezier",sa);Et();var Io={ease:[.25,.1,.25,1],linear:[0,0,1,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]},ia=300,zn=1e4,aa=16,cs=.9,Jt=t=>typeof t=="number"?Number.isFinite(t):typeof t=="string"&&t.trim()!==""&&Number.isFinite(+t),jo=t=>{if(typeof t=="string")return Object.prototype.hasOwnProperty.call(Io,t)?Io[t].slice():null;if(Array.isArray(t)&&t.length===4){let e=t.map(Number);return e.every(Number.isFinite)?e:null}return null},ps=t=>Jt(t.stiffness)||Jt(t.damping)||Jt(t.mass)||Jt(t.visualDuration)||Jt(t.bounce),us=t=>{let e={mode:"time"};if(Jt(t.stiffness)){let n=+t.stiffness,o=Jt(t.mass)?+t.mass:1,r=Math.sqrt(n/o);e.visualDuration=2*Math.PI/r,Jt(t.damping)&&(e.bounce=$(1-+t.damping/(2*Math.sqrt(n*o)),0,cs))}return Jt(t.visualDuration)&&(e.visualDuration=+t.visualDuration),Jt(t.bounce)&&(e.bounce=$(+t.bounce,0,cs)),e},ds=(t,e)=>t.mode==="spring"||t.mode==="easing"?t.mode:ps(t)?"spring":jo(t.curve)?"easing":e;function la(t,e){let n=zt("cubicbezier"),o=zt("spring");if(!n||!o)throw new Error("[tweaks] motion: the bezier and spring controls are not loaded");let r=xt(t.value)?t.value:{},s=ds(r,"easing"),i=jo(r.curve)??Io.ease.slice(),a=Jt(r.duration)?$(+r.duration,0,zn):ia,{root:l,trigger:h,right:u}=Wt("tw-motion",t.label??"Motion"),d=w("span","tw-trigger-chip tw-motion-chip"),p=Ot("svg");p.setAttribute("viewBox","0 0 100 100"),p.setAttribute("preserveAspectRatio","none");let N=Ot("path");p.append(N),d.append(p);let L=w("span","tw-trigger-value");u.append(d,L);let b=w("div","tw-color-pop tw-motion-pop"),g=w("div","tw-motion-body");b.append(g);let m=n({...t,type:"cubicbezier",label:"",value:i.slice()},x=>{i=x,S(),tt()});i=m.get();let M=o({...t,type:"spring",label:"",value:us(r)},()=>{S(),tt()}),C=Rt({label:"Duration",value:a,step:10,min:0,max:zn,unit:"ms"},x=>{a=$(x,0,zn),S(),tt()});a=C.get();let j=w("div","tw-motion-pane"),B=w("div","tw-motion-pane"),H=w("div","tw-fields");H.append(C.el),j.append(m.el,H),B.append(M.el);let D=w("div","tw-motion-stage"),G=w("div","tw-motion-box");D.append(G);let W=be([{value:"easing",label:"Easing"},{value:"spring",label:"Spring"}],s,x=>{(x==="easing"||x==="spring")&&x!==s&&(s=x,v(),S(),tt())},"Motion type"),P=w("div","tw-row");P.append(nt("span","tw-row-label","Type"),W.el),g.append(P,j,B,D),l.append(b);let R=()=>{if(s==="easing")return{mode:s,curve:i.slice(),duration:a,easing:`cubic-bezier(${i.join(", ")})`};let x=M.get(),V=7/Math.max(x.damping/(2*x.mass),.5),Z=$(Math.round(V*40),48,240);return{mode:s,...x,duration:Math.round(V*1e3),easing:`linear(${en(x.stiffness,x.damping,x.mass,Z,V).map(T=>+T.toFixed(3)).join(", ")})`}},tt=()=>e(R()),q=!1,U=null,at=x=>{if(x)q=!q;else if(U&&U.playState==="running")return;let V=R(),Z=Math.max(0,D.clientWidth-G.offsetWidth-2*aa),T=`translateX(${q?0:Z}px)`,Y=`translateX(${q?Z:0}px)`;if(oe.matches||typeof G.animate!="function"){G.style.transform=Y;return}U?.cancel();let st=[{transform:T},{transform:Y}];try{U=G.animate(st,{duration:V.duration,easing:V.easing,fill:"forwards"})}catch{U=G.animate(st,{duration:V.duration,fill:"forwards"})}};D.addEventListener("click",()=>at(!0)),D.tabIndex=0,D.setAttribute("role","button"),D.setAttribute("aria-label","Replay the motion"),D.addEventListener("keydown",x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),at(!0))});let A=()=>{let x;if(s==="easing"){let[T,Y,st,ut]=i;x=[];for(let Lt=0;Lt<=24;Lt++){let pt=Lt/24,kt=1-pt,ft=3*kt*kt*pt,_t=3*kt*pt*pt,Pt=pt*pt*pt;x.push([ft*T+_t*st+Pt,ft*Y+_t*ut+Pt])}}else{let T=M.get();x=en(T.stiffness,T.damping,T.mass,32).map((Y,st)=>[st/31,Y])}let V=Math.max(1,...x.map(T=>T[1])),Z=Math.min(0,...x.map(T=>T[1]));return x.map(([T,Y],st)=>`${st?"L":"M"}${(10+T*80).toFixed(1)},${(90-(Y-Z)/(V-Z)*80).toFixed(1)}`).join(" ")},F=()=>{s==="easing"?m.set(i.slice()):M.set(M.get())},v=()=>{j.style.display=s==="easing"?"":"none",B.style.display=s==="spring"?"":"none",F()},f=()=>s==="easing"?`Easing \xB7 ${a} ms`:`Spring \xB7 ${Math.round((M.get().visualDuration??0)*1e3)} ms`,S=()=>{N.setAttribute("d",A()),L.textContent=f(),at(!1)};return Xt(l,h,b,{width:240,fallbackH:380,gap:6,onOpen:()=>{W.set(s),F(),at(!0)},initialFocus:()=>W.el.querySelector('[tabindex="0"]')}),v(),S(),{el:l,set:x=>{let V=typeof x=="string"?{curve:x}:Array.isArray(x)&&x.length===4?{curve:x}:xt(x)?x:null;if(!V)return;s=ds(V,s);let Z=jo(V.curve);Z&&(m.set(Z.slice()),i=m.get()),s==="easing"&&Jt(V.duration)&&(C.set($(+V.duration,0,zn)),a=C.get()),ps(V)&&M.set(us(V)),W.set(s),v(),S()},get:R,destroy:()=>M.destroy&&M.destroy()}}lt("motion",la);Et();function ca(t,e){let n=t.components,{root:o,trigger:r,right:s}=Wt("tw-point",t.label??"Point"),i=w("span","tw-trigger-value"),a=w("div","tw-trigger-chip tw-point-preview"),l=w("div","tw-point-preview-dot");a.append(l),s.append(a,i);let h=w("div","tw-color-pop tw-point-pop"),u=w("div","tw-point-body");h.append(u);let d=t.pad!==!1&&n.length>=2,p=A=>{let F=ue(Math.abs(Number.isFinite(+A.value)?+A.value:0))[1],v=A.min??-F,f=A.max??F,S=10**Math.floor(Math.log10((f-v)/200));return{lo:v,hi:f,step:A.step??(S>0&&Number.isFinite(S)?S:1)}},N=n.map(p),L=N[0],b=N[1],g=L?.lo??-1,m=L?.hi??1,M=b?.lo??-1,C=b?.hi??1,j=(A,F,v)=>v>F?$((A-F)/(v-F),0,1):.5,B=null,H=null,D=null;if(d){B=w("div","tw-pad"),H=w("div","tw-pad-thumb");let A=Ot("svg","tw-pad-line");A.setAttribute("viewBox","0 0 100 100"),A.setAttribute("preserveAspectRatio","none"),D=Ot("line"),A.append(D);let F=j(0,M,C);D.setAttribute("x1",j(0,g,m)*100),D.setAttribute("y1",(t.invertY?F:1-F)*100),B.append(w("div","tw-pad-axis tw-pad-axis-x"),w("div","tw-pad-axis tw-pad-axis-y"),A,H),u.append(B)}let G=w("div","tw-fields");u.append(G);let W=()=>{at(),U()},P=()=>e(tt()),R=n.map((A,F)=>{let v=Rt({label:A.label,value:A.value??0,step:N[F].step,min:A.min,max:A.max},()=>{W(),P()});return G.append(v.el),v}),tt=()=>Object.fromEntries(n.map((A,F)=>[A.key,R[F].get()])),q=(A,F)=>(+A).toFixed(ce(F)),U=()=>{i.textContent=n.map((A,F)=>q(R[F].get(),N[F].step)).join(", ")},at=()=>{l.style.left="50%",l.style.top="50%"};if(d){let F=f=>`calc(${(f*100).toFixed(2)}% + ${((.5-f)*5).toFixed(2)}px)`;at=()=>{let f=j(R[0].get(),g,m),S=j(R[1].get(),M,C),k=t.invertY?S:1-S,x=f*100,V=k*100;H.style.left=x+"%",H.style.top=V+"%",l.style.left=F(f),l.style.top=F(k),D.setAttribute("x2",x),D.setAttribute("y2",V),B.setAttribute("aria-description",`${n[0].label??n[0].key} ${q(R[0].get(),L.step)}, ${n[1].label??n[1].key} ${q(R[1].get(),b.step)}`)},Fe(B,f=>{let[S,k]=_e(f,B),x=t.invertY?k:1-k;R[0].set(g+S*(m-g)),R[1].set(M+x*(C-M)),W(),P()}),B.tabIndex=0,B.setAttribute("role","group"),B.setAttribute("aria-label",`${t.label??"Point"} pad: ${n[0].label??n[0].key} and ${n[1].label??n[1].key}`),B.addEventListener("keydown",f=>{if(f.key==="Home"){f.preventDefault(),n.forEach((V,Z)=>R[Z].set(V.value??0)),W(),P();return}let S=f.key==="ArrowRight"?1:f.key==="ArrowLeft"?-1:0,k=f.key==="ArrowUp"?1:f.key==="ArrowDown"?-1:0;if(!S&&!k)return;f.preventDefault();let x=f.shiftKey?10:1;S&&R[0].set($(R[0].get()+S*L.step*x,g,m)),k&&R[1].set($(R[1].get()+(t.invertY?-k:k)*b.step*x,M,C)),W(),P()})}return o.append(h),Xt(o,r,h,{width:216,fallbackH:240,gap:6,onOpen:W}),W(),{el:o,set:A=>{A&&n.forEach((F,v)=>{A[F.key]!=null&&R[v].set(A[F.key])}),W()},get:tt}}lt("point",ca);Et();var ua=Object.assign(Object.create(null),{sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,atan2:Math.atan2,sinh:Math.sinh,cosh:Math.cosh,tanh:Math.tanh,sqrt:Math.sqrt,cbrt:Math.cbrt,abs:Math.abs,exp:Math.exp,log:Math.log,ln:Math.log,log10:Math.log10,log2:Math.log2,floor:Math.floor,ceil:Math.ceil,round:Math.round,sign:Math.sign,trunc:Math.trunc,min:Math.min,max:Math.max,pow:Math.pow,hypot:Math.hypot,mod:(t,e)=>t%e,clamp:(t,e,n)=>Math.min(Math.max(t,e),n)}),fs=Object.assign(Object.create(null),{pi:Math.PI,e:Math.E,tau:Math.PI*2,phi:(1+Math.sqrt(5))/2});function Bo(t){if(typeof t!="string"||!t.trim()||t.length>512)return null;let e=t,n=[],o=/\d*\.?\d+(?:[eE][+-]?\d+)?/y,r=/[A-Za-z_]\w*/y,s=0;for(;s<e.length;){let b=e[s];if(b===" "||b===" "||b===`
4
+ `){s++;continue}if(b>="0"&&b<="9"||b==="."&&e[s+1]>="0"&&e[s+1]<="9"){o.lastIndex=s;let g=o.exec(e);if(!g||g.index!==s)return null;n.push({t:"num",v:parseFloat(g[0])}),s=o.lastIndex;continue}if(b>="A"&&b<="Z"||b>="a"&&b<="z"||b==="_"){r.lastIndex=s;let g=r.exec(e);n.push({t:"id",v:g[0]}),s=r.lastIndex;continue}if(b==="*"&&e[s+1]==="*"){n.push({t:"op",v:"^"}),s+=2;continue}if("+-*/%^".includes(b)){n.push({t:"op",v:b}),s++;continue}if(b==="("){n.push({t:"lp"}),s++;continue}if(b===")"){n.push({t:"rp"}),s++;continue}if(b===","){n.push({t:"comma"}),s++;continue}return null}if(!n.length)return null;let i=0,a=()=>n[i],l=b=>{let g=n[i];return!g||b&&g.t!==b?null:(i++,g)},h=()=>{let b=u();if(!b)return null;for(;a()&&a().t==="op"&&(a().v==="+"||a().v==="-");){let g=l("op").v,m=u();if(!m)return null;let M=b;b=g==="+"?C=>M(C)+m(C):C=>M(C)-m(C)}return b},u=()=>{let b=d();if(!b)return null;for(;a()&&a().t==="op"&&(a().v==="*"||a().v==="/"||a().v==="%");){let g=l("op").v,m=d();if(!m)return null;let M=b;b=g==="*"?C=>M(C)*m(C):g==="/"?C=>M(C)/m(C):C=>M(C)%m(C)}return b},d=()=>{if(a()&&a().t==="op"&&(a().v==="-"||a().v==="+")){let b=l("op").v,g=d();return g?b==="-"?m=>-g(m):g:null}return p()},p=()=>{let b=N();if(!b)return null;if(a()&&a().t==="op"&&a().v==="^"){l("op");let g=d();return g?m=>Math.pow(b(m),g(m)):null}return b},N=()=>{let b=a();if(!b)return null;if(b.t==="num")return l("num"),()=>b.v;if(b.t==="lp"){l("lp");let g=h();return!g||!l("rp")?null:g}if(b.t==="id"){l("id");let g=b.v.toLowerCase();if(a()&&a().t==="lp"){let m=ua[g];if(!m)return null;l("lp");let M=[];if(a()&&a().t!=="rp")do{let C=h();if(!C)return null;M.push(C)}while(l("comma"));return l("rp")?C=>m(...M.map(j=>j(C))):null}if(g==="x")return m=>m;if(g in fs){let m=fs[g];return()=>m}return null}return null},L=h();return L&&i===n.length?L:null}function da(t,e){let n=Number(t.xMin??t.min),o=Number(t.xMax??t.max);if(Number.isFinite(n)||(n=-10),Number.isFinite(o)||(o=10),o<n){let C=n;n=o,o=C}o===n&&(n-=1,o+=1);let r=Math.max(2,Math.min(4096,t.samples|0||256)),s=Number.isFinite(t.yMin)&&Number.isFinite(t.yMax)&&+t.yMax>+t.yMin,i=typeof t.fn=="function"?t.fn:null,a=t.editable!==!1&&!i,l=t.expr!=null?String(t.expr):i?"":"sin(x)",h=i||Bo(l),u=w("div","tw-plot");t.label&&u.append(nt("div","tw-plot-label",t.label));let d=w("div","tw-plot-graph"),p=Ot("svg","tw-plot-svg");p.setAttribute("preserveAspectRatio","none");let N=Ot("line","tw-plot-axis"),L=Ot("line","tw-plot-axis"),b=Ot("path","tw-plot-curve");p.append(N,L,b),d.append(p),u.append(d);let g=null;if(a){let C=w("div","tw-plot-field");g=w("input","tw-plot-input"),g.type="text",g.value=l,g.spellcheck=!1,g.autocapitalize="off",Yt(g),g.setAttribute("aria-label",`${t.label||"Plot"} \u2014 expression in x`),g.setAttribute("aria-invalid","false"),C.append(nt("span","tw-plot-fx","y ="),g),u.append(C)}let m=6,M=()=>{let C=typeof h=="function";u.classList.toggle("is-invalid",a&&!C),g&&g.setAttribute("aria-invalid",a&&!C?"true":"false");let j=d.getBoundingClientRect(),B=j.width,H=j.height;if(B<2)return;p.setAttribute("viewBox",`0 0 ${B} ${H}`);let D=[],G=1/0,W=-1/0;if(C)for(let F=0;F<r;F++){let v=n+(o-n)*(F/(r-1)),f;try{f=h(v)}catch{f=NaN}D.push(f),Number.isFinite(f)&&(f<G&&(G=f),f>W&&(W=f))}let P=t.yMin,R=t.yMax;if(!s)if(!Number.isFinite(G)||G===W){let F=Number.isFinite(G)?G:0;P=F-1,R=F+1}else{let F=(W-G)*.12;P=G-F,R=W+F}let tt=F=>m+(F-n)/(o-n)*(B-2*m),q=F=>H-m-(F-P)/(R-P)*(H-2*m),U=(F,v,f,S,k,x)=>{F.style.display=x?"":"none",x&&(F.setAttribute("x1",v),F.setAttribute("y1",f),F.setAttribute("x2",S),F.setAttribute("y2",k))};U(N,m,q(0),B-m,q(0),P<=0&&R>=0),U(L,tt(0),m,tt(0),H-m,n<=0&&o>=0);let at="",A=!1;if(C)for(let F=0;F<r;F++){let v=D[F];if(!Number.isFinite(v)){A=!1;continue}let f=tt(n+(o-n)*(F/(r-1))),S=$(q(v),-1e4,1e4);at+=(A?"L":"M")+f.toFixed(1)+","+S.toFixed(1)+" ",A=!0}b.setAttribute("d",at)};return a&&g.addEventListener("input",()=>{l=g.value,h=Bo(l),M(),e(l)}),jt(M),Gt(u,[[window,"resize"],[window,"tw-reflow"]],M),{el:u,get:()=>l,set:C=>{C!=null&&(l=String(C),g&&(g.value=l),i||(h=Bo(l)),M())}}}lt("plot",da);Et();Et();Et();var Ve={},Kn={},pa=t=>zt(t)||!Ve[t]?null:Kn[t]||(Kn[t]=Ve[t]().catch(e=>{throw delete Kn[t],console.error(`[tweaks] control chunk "${t}" failed to load:`,e),e})),Vo=(t,e=new Set)=>{for(let n of t)if(n&&(Ve[n.type]&&e.add(n.type),n.children&&Vo(n.children,e),n.pages))for(let o of n.pages)Vo(o.children,e);return e},Ge=t=>{let e=[...Vo(t)].map(pa).filter(Boolean);return e.length?Promise.all(e):null};function Se(t,e,n=0){if(Yn(t))return null;let o=ga(t,e,n);return o&&e&&typeof e=="object"&&(typeof e.render=="function"&&(o.render=e.render),e.disabled!=null&&(o.disabled=e.disabled),e.hint!=null&&(o.hint=String(e.hint)),e.persist===!1&&(o.persist=!1)),o}var we=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Yn=t=>t==="__proto__"||t==="constructor"||t==="prototype",pe=(t,e)=>t!==e&&!(xt(t)&&xt(e)&&JSON.stringify(t)===JSON.stringify(e)),Wn=(t,e,n)=>{t.set(n),t.set(e)},ms=t=>Array.isArray(t.options)&&{type:"radiogrid",options:t.options,value:t.value??Zt(t.options[0]),cols:t.cols},fa=(t,...e)=>{let n=(e.length?e:[0]).map(s=>ue(Number.isFinite(+s)?+s:0)),o=t.min??Math.min(...n.map(s=>s[0])),r=t.max??Math.max(...n.map(s=>s[1]));return{min:o,max:r,step:t.step??Re(o,r)}},Go=(t,e)=>t.label==null?e:String(t.label),gs=t=>typeof t=="function"?t:void 0,bs=t=>typeof t=="string"&&t.trim()?t.trim().slice(0,12):void 0,Xo=["stiffness","damping","mass","visualDuration","bounce"],hs={slider:t=>{let e=fa(t,t.value??t.min??0);return{value:t.value??e.min,...e,soft:t.soft,unit:bs(t.unit),format:gs(t.format),parse:gs(t.parse)}},number:t=>({value:t.value??0,min:t.min,max:t.max,step:t.step??1,soft:t.soft,unit:bs(t.unit)}),checkbox:t=>({value:!!t.value}),radiogrid:ms,segmented:ms,list:t=>Array.isArray(t.options)&&{options:t.options,value:t.value??Zt(t.options[0])},text:t=>({value:t.value??"",rows:t.rows,placeholder:t.placeholder}),spring:t=>{let e=xt(t.value)?t.value:t,n={stiffness:e.stiffness??300,damping:e.damping??26,mass:e.mass??1};Number.isFinite(+e.visualDuration)&&(n.visualDuration=+e.visualDuration),Number.isFinite(+e.bounce)&&(n.bounce=+e.bounce);let o=t.mode??e.mode;return(o==="time"||o==="physics")&&(n.mode=o),{value:n}},motion:t=>{let e=typeof t.value=="string"||Array.isArray(t.value)?{...t,curve:t.value}:xt(t.value)?t.value:t,n=Xo.some(r=>e[r]!=null),o={curve:"ease",duration:300,...n?{}:{visualDuration:.5,bounce:.2}};for(let r of["mode","curve","duration",...Xo])e[r]!=null&&(o[r]=e[r]);return o.mode!=="easing"&&o.mode!=="spring"&&(o.mode=n?"spring":"easing"),{value:o}},point:t=>{if(!Array.isArray(t.components)||!t.components.length)return!1;let e=new Set,n=t.components.map((o,r)=>{let s=String(o.key??((o.label?String(o.label).toLowerCase():"")||`c${r}`)),i=s,a=2;for(;e.has(i);)i=`${s}-${a++}`;return e.add(i),{...o,key:i}});return{components:n,pad:t.pad,invertY:t.invertY,value:Object.fromEntries(n.map(o=>[o.key,o.value??0]))}},buttongroup:t=>({buttons:t.buttons}),separator:()=>({}),tabs:(t,e)=>{if(!t.pages||typeof t.pages!="object"||!Object.keys(t.pages).length)return!1;let n=new Set;return{pages:Object.entries(t.pages).map(([o,r])=>{let s=o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"tab",i=s,a=2;for(;n.has(i);)i=`${s}-${a++}`;return n.add(i),{key:i,title:o.trim()?o:"Tab",children:Object.entries(r).map(([l,h])=>Se(l,h,e+1)).filter(Boolean)}})}}},ma=Object.assign(Object.create(null),{list:"options",radiogrid:"options",segmented:"options",point:"components",tabs:"pages"});function ga(t,e,n=0){if(n>64)return null;let o=vn(t),r=(s,i,a=o)=>({type:s,key:t,label:a,...i});if(xt(e)&&!Array.isArray(e)&&we(hs,e.type)){let s;try{s=hs[e.type](e,n)}catch(i){return console.error(`[tweaks] malformed "${e.type}" schema value for "${t}" \u2014 control skipped:`,i),null}if(s)return r(String(e.type),s,Go(e,o));if(we(e,ma[e.type]))return console.error(`[tweaks] malformed "${e.type}" schema value for "${t}" \u2014 control skipped`),null}else if(xt(e)&&!Array.isArray(e)&&typeof e.type=="string"&&(Ve[e.type]||zt(e.type))){let{type:s,label:i,...a}=e;return r(s,a,Go(e,o))}if(Array.isArray(e)&&Array.isArray(e[0])&&e[0].length===2&&typeof e[0][0]=="number"){let s=Number.isFinite(+e[1])?+e[1]:+e[0][0],i=Number.isFinite(+e[2])?+e[2]:+e[0][1];return r("interval",{value:e[0].map(Number),min:s,max:i,step:e[3]??Re(s,i)})}if(Array.isArray(e)&&e.length<=4&&typeof e[0]=="number"){let s=e[0],[i,a]=ue(s),l=e.length>1?e[1]:i,h=e.length>2?e[2]:a;return r("slider",{value:s,min:l,max:h,step:e[3]??Re(l,h)})}if(typeof e=="number"){let[s,i]=ue(e);return r("slider",{value:e,min:s,max:i,step:Re(s,i)})}return typeof e=="boolean"?r("checkbox",{value:e}):Array.isArray(e)?r("list",{options:e,value:Zt(e[0])}):xt(e)&&typeof e.action=="function"?r("button",{action:e.action},Go(e,o)):xt(e)&&Array.isArray(e.options)?r("list",{options:e.options,value:e.value??Zt(e.options[0])}):Je(e)?r("color",{value:e}):typeof e=="string"?r("text",{value:e}):xt(e)?r("folder",{children:Object.entries(e).filter(([s,i])=>!(s==="render"&&typeof i=="function")&&!((s==="disabled"||s==="hint")&&i!=null)).map(([s,i])=>Se(s,i,n+1)).filter(Boolean)}):null}var Un=new Set(["button","fpsgraph","monitor","buttongroup","separator"]),ws=t=>({...Object.fromEntries(Xo.map(e=>[e,wt(t[e])])),mode:t.mode}),ys={slider:t=>({value:wt(t.value),min:wt(t.min),max:wt(t.max),step:wt(t.step),soft:qn(t.soft),unit:t.unit}),checkbox:t=>t.options?{type:"radiogrid",options:an(t.options),value:t.value,cols:wt(t.cols)}:{value:t.checked==="true"},radiogrid:t=>({options:an(t.options),value:t.value,cols:wt(t.cols)}),list:t=>({options:an(t.options),value:t.value}),buttongroup:t=>({buttons:an(t.buttons).map(e=>({label:e}))}),separator:()=>({}),number:t=>({value:wt(t.value),min:wt(t.min),max:wt(t.max),step:wt(t.step),unit:t.unit}),text:t=>({value:t.value??"",placeholder:t.placeholder,rows:wt(t.rows)}),fpsgraph:t=>({label:t.label??"FPS"}),interval:t=>({value:t.value?t.value.split(",").map(Number):void 0,min:wt(t.min),max:wt(t.max),step:wt(t.step)}),sides:t=>({value:t.value??t,corners:qn(t.corners),unit:t.unit,step:wt(t.step),min:wt(t.min),max:wt(t.max)}),shadow:t=>({value:t.value??{...t,inset:qn(t.inset)}}),spring:ws,motion:t=>({...ws(t),curve:t.curve&&t.curve.includes(",")?t.curve.split(",").map(Number):t.curve,duration:wt(t.duration)}),cubicbezier:t=>({value:t.value?t.value.split(",").map(Number):void 0}),point:t=>{let e=(t.value||"").split(",").map(n=>parseFloat(n));return{components:an(t.components||"X,Y").map((n,o)=>({key:n.toLowerCase(),label:n,value:isNaN(e[o])?0:e[o],step:wt(t.step),min:wt(t.min),max:wt(t.max)})),pad:qn(t.pad),invertY:t.invertY==="true"}},plot:t=>({expr:t.expr,xMin:wt(t.xmin),xMax:wt(t.xmax),yMin:wt(t.ymin),yMax:wt(t.ymax),samples:wt(t.samples),editable:t.editable!=="false"})},wt=t=>{if(t==null||t==="")return;let e=+t;return Number.isFinite(e)?e:void 0},qn=t=>t==="true"||t==="",an=t=>(t||"").split(",").map(e=>e.trim()).filter(Boolean),vs=t=>{let e=t.dataset,n=e.tw,o=e.label??vn(e.key||n),r=we(ys,n)?ys[n](e,t,o):Ve[n]||zt(n)?{...e}:null;return r?Se("v",{type:n,label:o,...r}):null};Et();Et();var Es=$t('<path class="tw-copy-back" d="m5.5 16.5-.7-.2q-1.5-.6-2.1-2.1-.2-.7-.2-2.7v-2c0-3.3 0-5 1-6s2.7-1 6-1h2c1.4 0 2 0 2.7.2q1.6.5 2.1 2.1l.2.7"/><path class="tw-copy-front" d="M7.5 14.5c0-3.3 0-5 1-6s2.7-1 6-1 5 0 6 1 1 2.7 1 6 0 5-1 6-2.7 1-6 1-5 0-6-1-1-2.7-1-6"/>',"tw-toolbar-btn__copy"),xs=$t('<path d="m5 14 3.5 3.5L19 6.5"/>',"tw-toolbar-btn__check",2.4),Ms=$t('<path d="M3 12a9 9 0 1 0 9-9 9 9 0 0 0-7.6 4.2M3.3 3l.2 2q0 2.2.6 2.7t2.7.2l2-.2"/>'),ks=$t('<path d="m17 17 4 4m-2-10a8 8 0 0 0-16 0 8 8 0 0 0 16 0"/>'),zo=t=>$t('<path d="M18 9s-4.4 6-6 6-6-6-6-6"/>',t,2.5),Cs=zo("tw-chevron"),Ls=$t('<path d="M20.2 13.5q1.8.8 1.8 1.5 0 .8-2.7 2l-5 2.2Q13 20 12 20q-.7 0-2.4-.8l-4.9-2.3Q2 16 2 15t1.8-1.5"/><path class="tw-layer-top" d="M9.6 4.8Q11.3 4 12 4t2.4.8l4.9 2.3Q22 8 22 9c0 .7-.9 1.1-2.7 2l-5 2.2Q13 14 12 14q-.7 0-2.4-.8l-4.9-2.3Q2 10 2 9c0-.7.9-1.1 2.7-2z"/>'),Ss=$t('<path d="M18 6 6 18m12 0L6 6"/>',"",2.2),Ko=$t('<circle cx="12" cy="12" r="10"/><path d="M12 16v-4m-.25-3.75a.25.25 0 0 0 .5 0 .25.25 0 0 0-.5 0"/>');var ba=3,As=32,Ts=200,Os=8;function ha(t,e){let n=t.label,{min:o,max:r,step:s}=En(t.min,t.max,t.step);t.soft||([o,r]=Pe(o,r,s));let i=(r-o)/s<=6,a=Number.isFinite(+t.value)?+t.value:o,l=t.soft&&!i?a:$(a,o,r),h=0,u=ce(s),d=w("div","tw-slider-wrap"),p=w("div","tw-slider"),N=w("div","tw-slider-hashmarks"),L=w("div","tw-slider-fill"),b=w("div","tw-slider-handle"),g=nt("span","tw-slider-label",n),m=w("span","tw-slider-value"),M=typeof t.unit=="string"?t.unit.trim():"",C=document.createTextNode(""),j=M?/^[%°]$/.test(M)?M:" "+M:"";m.append(C),M&&m.append(nt("span","tw-slider-unit",j));let B=t.format,H=t.parse,D=O=>{if(B)try{let ot=B(O);if(typeof ot=="string"&&ot)return ot}catch{}return O.toFixed(u)};p.append(N,L,b,g,m),d.append(p),p.tabIndex=0,p.setAttribute("role","slider"),p.setAttribute("aria-label",n),p.setAttribute("aria-valuemin",String(o)),p.setAttribute("aria-valuemax",String(r));let G=O=>Me(O,o,s),W=i?Array.from({length:Math.max(0,Math.round((r-o)/s)-1)},(O,ot)=>(ot+1)*s/(r-o)*100):[];for(let O of W){let ot=w("div","tw-slider-hashmark");ot.style.left=O+"%",N.append(ot)}let P=()=>{let O=$((l-o)/(r-o||1)*100,0,100),ot=h?` + ${h.toFixed(1)}px`:"",At=`${O}%${ot}`;L.style.width=h?`calc(${At})`:O+"%",b.style.left=`max(5px, calc(${At} - 9px))`;let bt=G(l),ct=D(bt);C.data=ct,p.setAttribute("aria-valuenow",String(bt)),p.setAttribute("aria-valuetext",ct+j);let Ct=d.offsetWidth,Bt=m.offsetWidth;if(Ct){Bt&&(g.style.maxWidth=Math.max(0,Ct-Bt-30)+"px");let Kt=Math.max(5,O/100*Ct+h-9);p.classList.toggle("is-dodge",xn(g,m,Kt,3))}};P();let R=null,tt=1,q=null,U=!0,at,A=null,F=null,v=`width 0.34s ${ho}`,f=`left 0.34s ${ho}, opacity 0.15s, transform 0.2s ${Qe}`,S=.2,k=O=>{if(!R)return l;let ot=d.offsetWidth||R.width,At=$((O-R.left)/tt/ot,0,1);return $(o+At*(r-o),o,r)},x=O=>{let ot=0;O<R.left?ot=-Os*Math.sqrt(Math.min(Math.max(0,R.left-O-As)/Ts,1)):O>R.right&&(ot=Os*Math.sqrt(Math.min(Math.max(0,O-R.right-As)/Ts,1))),p.style.width=`calc(100% + ${Math.abs(ot)}px)`,p.style.transform=ot<0?`translateX(${ot}px)`:""},V=(O,ot=!0)=>{O=+O,Number.isFinite(O)&&(l=i?$(G(O),o,r):t.soft?O:$(O,o,r),P(),ot&&e(G(l)))},Z=Math.max(1,Math.round((r-o)/s)),T=.2,Y=.3,st=520,ut=27,Lt=O=>(O-o)/s,pt=0,kt=0,ft=0,_t=!1,Pt=null,Tt=l,I=0,K=()=>{ft&&cancelAnimationFrame(ft),ft=0,I=0},dt=O=>{if(!p.isConnected){K();return}let ot=I?Math.min((O-I)/1e3,.05):1/60;I=O;let At=d.offsetWidth||R&&R.width||1,bt=Lt($(Tt,o,r)),ct=$(Math.round(bt+T),0,Z),Ct=_t?ct+Y*$(bt-ct,-.5,.5):ct;if(oe&&oe.matches)pt=Ct,kt=0;else{let Bt=ot,Kt=1/240;for(;Bt>1e-4;){let qt=Math.min(Kt,Bt);Bt-=qt;let Qt=st*(Ct-pt)-ut*kt;kt+=Qt*qt,pt+=kt*qt,pt<0&&(pt=0,kt=0),pt>Z&&(pt=Z,kt=0)}}h=(pt-ct)*s/(r-o||1)*At,l=$(o+ct*s,o,r),P(),ct!==Pt&&(Pt=ct,e(G(l))),!_t&&Math.abs(kt)<.004&&Math.abs(pt-ct)<.004?(pt=ct,kt=0,h=0,P(),K(),p.classList.remove("is-active")):ft=requestAnimationFrame(dt)},gt=O=>{pt=Lt(l),kt=0,_t=!0,Pt=Math.round(Lt(l)),Tt=k(O),ft||(ft=requestAnimationFrame(dt))};p.addEventListener("pointerdown",O=>{if(!m.classList.contains("is-editing")&&!(O.button!==0||q)){O.preventDefault(),p.focus({focusVisible:!1}),F=O.pointerId;try{O.target.setPointerCapture(O.pointerId)}catch{}clearTimeout(at),p.style.transition="",q={x:O.clientX,y:O.clientY},U=!0,p.classList.add("is-active"),R=d.getBoundingClientRect(),tt=R.width/(d.offsetWidth||R.width),i?(L.style.transition="",b.style.transition="",gt(O.clientX)):(L.style.transition=v,b.style.transition=f,V(k(O.clientX)))}}),p.addEventListener("pointermove",O=>{if(!(!q||O.pointerId!==F)){if(O.buttons===0){mt();return}if(U&&Math.hypot(O.clientX-q.x,O.clientY-q.y)>ba&&(U=!1,p.classList.add("is-dragging"),i||(L.style.transition="",b.style.transition="")),!U)if(x(O.clientX),i)Tt=k(O.clientX);else{let ot;if(O.altKey){A||(A={x:O.clientX,v:l});let At=d.offsetWidth||R.width;ot=$(A.v+(O.clientX-A.x)/At*(r-o)*S,o,r)}else A=null,ot=k(O.clientX);V(ot)}O.clientX>=R.left&&O.clientX<=R.right&&(p.style.width="",p.style.transform="")}});let mt=O=>{!q||O&&O.pointerId!==F||(i?(_t=!1,p.classList.remove("is-dragging"),ft||(ft=requestAnimationFrame(dt))):(at=setTimeout(()=>{L.style.transition="",b.style.transition=""},360),p.classList.remove("is-active","is-dragging")),p.style.transition=`width 0.35s ${Qe}, transform 0.35s ${Qe}`,p.style.width="",p.style.transform="",setTimeout(()=>{p.style.transition=""},360),q=null,A=null,F=null)};p.addEventListener("pointerup",mt),p.addEventListener("pointercancel",mt),p.addEventListener("lostpointercapture",mt),Mn(p,P),jt(P),Gt(p,[[window,"resize"]],P),p.addEventListener("keydown",O=>{if(O.target!==p||q)return;let ot=ge(O,l,s,o,r,(r-o)/10||s*10);ot!=null&&(O.preventDefault(),i&&(K(),h=0,p.classList.remove("is-active")),V($(ot,o,r)))});let Ht;m.addEventListener("mouseenter",()=>{Ht=setTimeout(()=>m.classList.add("is-editable"),800)}),m.addEventListener("mouseleave",()=>{clearTimeout(Ht),m.classList.contains("is-editing")||m.classList.remove("is-editable")}),m.addEventListener("pointerdown",O=>{O.pointerType&&O.pointerType!=="mouse"?(m.classList.add("is-editable"),O.stopPropagation()):m.classList.contains("is-editable")&&O.stopPropagation()});let Dt=()=>{if(m.classList.contains("is-editing"))return;let O=w("input","tw-slider-input");O.type="text",O.inputMode=H?"text":"decimal",Yt(O),O.value=H?D(G(l)):G(l).toFixed(u);let ot=O.value;O.style.width=ot.length+1+"ch",m.classList.add("is-editing"),m.replaceWith(O),O.focus(),O.select();let At=()=>{O.replaceWith(m),m.classList.remove("is-editing","is-editable")},bt=()=>{let ct=O.value,Ct=NaN;if(ct!==ot)try{Ct=H?H(ct):Number(ct.replace(M,"").trim()||NaN)}catch{}Number.isFinite(Ct)&&V(t.soft?Ct:$(Ct,o,r)),At()};O.addEventListener("pointerdown",ct=>ct.stopPropagation()),O.addEventListener("blur",bt),O.addEventListener("keydown",ct=>{ct.key==="Enter"?(O.removeEventListener("blur",bt),p.focus(),bt()):ct.key==="Escape"&&(ct.stopPropagation(),O.removeEventListener("blur",bt),p.focus(),At())})};return m.addEventListener("click",()=>{m.classList.contains("is-editable")&&Dt()}),p.addEventListener("keydown",O=>{O.key==="Enter"&&O.target===p&&!q&&(O.preventDefault(),Dt())}),{el:d,set:O=>V(O,!1),get:()=>G(l)}}function wa(t,e){let n=w("div","tw-row"),o=be([{value:"off",label:"Off"},{value:"on",label:"On"}],t.value?"on":"off",r=>e(r==="on"),t.label);return n.append(nt("span","tw-row-label",t.label),o.el),{el:n,set:r=>o.set(r?"on":"off"),get:()=>o.get()==="on"}}function ya(t,e){let n=t.options||[],o=Math.min(3,Math.max(2,t.cols||(n.length<=3?n.length:n.length===4?2:3))),r=w("div","tw-radiogrid"),s=w("div","tw-radiogrid-grid");s.style.setProperty("--tw-rg-cols",o),s.setAttribute("role","radiogroup"),s.setAttribute("aria-label",t.label);let i=t.value??Zt(n[0]),a=n.map(u=>{let d=vo("tw-radiogrid-btn",u,p=>h(p));return s.append(d),d}),l=()=>yo(a,i),h=(u,d=!0)=>{u!=null&&!a.some(p=>p._twVal===u)||(i=u,l(),d&&e(u))};return s.addEventListener("keydown",u=>{let d=Sn(a,i);if(d<0)return;let p=tn(u.key,d,a.length,o);p<0||(u.preventDefault(),p!==d&&(h(a[p]._twVal),a[p].focus()))}),l(),r.append(nt("span","tw-radiogrid-label",t.label),s),{el:r,set:u=>h(u,!1),get:()=>i}}var va=/^(?:#[0-9a-f]{3,8}|[a-z]+|(?:oklch|oklab|rgba?|hsla?|hwb|lab|lch|color|var)\([^()]*\))$/i,Ea=zo("tw-select-chevron");function xa(t,e){let n=t.value,o=t.options.map(g=>({value:Zt(g),label:uo(g),color:g&&typeof g=="object"&&typeof g.color=="string"&&va.test(g.color.trim())?g.color.trim():""})),r=w("div","tw-select"),s=Mt("tw-select-trigger");s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-expanded","false");let i=w("span","tw-select-right"),a=g=>`linear-gradient(${g}, ${g}), var(--tw-checker)`,l=g=>{let m=w("span","tw-option-swatch");return m.style.background=a(g),m},h=w("span","tw-option-swatch"),u=w("span","tw-select-value");i.append(h,u),i.insertAdjacentHTML("beforeend",Ea),s.append(nt("span","tw-select-label",t.label),i);let d=w("div","tw-select-dropdown");d.setAttribute("role","listbox");let p=o.map(g=>{let m=Mt("tw-select-option");return m.setAttribute("role","option"),g.color&&m.append(l(g.color)),m.append(nt("span","tw-option-label",g.label)),m.dataset.value=g.value,m.addEventListener("click",()=>{L(g.value),b.close()}),d.append(m),m});r.append(s,d);let N=()=>{let g=o.find(m=>m.value===n);u.textContent=g?.label??n,h.style.display=g?.color?"":"none",g?.color&&(h.style.background=a(g.color)),p.forEach(m=>{let M=m.dataset.value===String(n);m.dataset.selected=String(M),m.setAttribute("aria-selected",String(M))})},L=(g,m=!0)=>{g!=null&&!o.some(M=>M.value===g)||(n=g,N(),m&&e(g))},b=Xt(r,s,d,{width:"match",fallbackH:200,gap:4,onOpen:()=>(p.find(g=>g.dataset.value===String(n))||p[0])?.focus()});return s.addEventListener("keydown",g=>{!b.isOpen()&&(g.key==="ArrowDown"||g.key==="ArrowUp")&&(g.preventDefault(),b.open())}),d.addEventListener("keydown",g=>{let m=p.indexOf(document.activeElement),M=m;if(g.key==="ArrowDown")M=m<0?0:Math.min(p.length-1,m+1);else if(g.key==="ArrowUp")M=m<0?p.length-1:Math.max(0,m-1);else if(g.key==="Home")M=0;else if(g.key==="End")M=p.length-1;else return;g.preventDefault(),p[M]?.focus()}),N(),{el:r,set:g=>L(g,!1),get:()=>n}}function Ma(t){let e=nt("button","tw-button",t.label);return e.addEventListener("click",()=>typeof t.action=="function"&&t.action()),de(e)}function ka(t){let e=w("div","tw-row tw-buttongroup");t.label&&e.append(nt("span","tw-row-label",t.label));let n=w("div","tw-buttongroup-btns"),o=Array.isArray(t.buttons)?t.buttons.map(r=>[r.label??"Button",r.action]):Object.entries(t.buttons||{});for(let[r,s]of o){let i=nt("button","tw-buttongroup-btn",r);i.addEventListener("click",()=>typeof s=="function"&&s()),n.append(i)}return e.append(n),de(e)}var Ca=()=>de(w("div","tw-separator"));function La(t,e){let n=l=>l==null?"":typeof l=="object"?Ze(l):String(l),o=n(t.value),r=t.rows>0,s=w("div",r?"tw-row tw-row-multiline":"tw-row"),i=w(r?"textarea":"input",r?"tw-text tw-textarea":"tw-text");r?i.rows=t.rows:i.type="text",i.value=o,Yt(i),t.placeholder&&(i.placeholder=t.placeholder),i.addEventListener("input",()=>{o=i.value,e(o)});let a=()=>{let l=i.scrollHeight-i.clientHeight>1;i.classList.toggle("is-clip-top",l&&i.scrollTop>1),i.classList.toggle("is-clip-bottom",l&&i.scrollTop+i.clientHeight<i.scrollHeight-1)};return r&&(i.addEventListener("scroll",a),i.addEventListener("input",a),typeof ResizeObserver=="function"&&new ResizeObserver(a).observe(i)),s.append(nt("span","tw-row-label",t.label),i),{el:s,set:l=>{o=n(l),i.value=o,r&&a()},get:()=>o}}function ln(t){let e=w("div","tw-folder"),n=Mt("tw-folder-header");n.setAttribute("aria-expanded","true"),n.append(nt("span","tw-folder-title",t.label)),n.insertAdjacentHTML("beforeend",Cs);let o=w("div","tw-folder-body"),r=w("div","tw-controls");o.append(r),e.append(n,o);let s=i=>$e(e,n,o,i);return n.addEventListener("click",()=>s(!e.classList.contains("is-collapsed"))),{el:e,body:r,setCollapsed:s}}function Xe(t,e){let n=zt(t.type);if(!n)return null;try{return n(t,e)}catch(o){return console.error("[tweaks] control failed to build:",t&&t.type,o),null}}lt("slider",ha);lt("checkbox",wa);lt("radiogrid",ya);lt("list",xa);lt("button",Ma);lt("buttongroup",ka);lt("separator",Ca);lt("text",La);lt("folder",ln);Et();var cn=(t,e,n)=>{let o=Mt("tw-toolbar-btn"+(t?" "+t:""),e);return o.title=n,o.setAttribute("aria-label",n),o},Qn=t=>{let e=cn("tw-toolbar-btn--swap",`<span class="tw-toolbar-btn__icons">${Es}${xs}</span>`,"Copy values (\u21E7: changed only)");return e.addEventListener("click",async n=>{if(e.disabled)return;let[o,r]=t(n.shiftKey);if(!r)return ye("Nothing has changed");if(!await Wo(o))return ye("Copy failed");Sa(e),ye(r>0?`${r} changed value${r===1?"":"s"} copied`:"Values copied")}),e},Ae=null,Ns=0,ye=t=>{Ae||(Ae=w("div","tw-sr"),Ae.setAttribute("role","status")),Ae.isConnected||document.body.appendChild(Ae),Ae.textContent="",clearTimeout(Ns),Ns=setTimeout(()=>{Ae.textContent=t},100)},to=t=>{let e=cn("tw-toolbar-btn--reset",Ms,"Reset");return e.addEventListener("click",()=>{e.disabled||(qo(e),t())}),e},Sa=t=>{t.classList.add("is-copied"),clearTimeout(t._t),t._t=setTimeout(()=>t.classList.remove("is-copied"),1400)},qo=t=>{let e=t.querySelector("svg");t._spinSettle||(t._spinSettle=()=>{clearTimeout(t._t),t.classList.remove("is-spinning"),e.style.transition="none",e.style.setProperty("--tw-spin","0deg"),e.getBoundingClientRect(),e.style.transition=""},e.addEventListener("transitionend",o=>{o.propertyName==="transform"&&t.classList.contains("is-spinning")&&performance.now()-t._spinT>250&&t._spinSettle()})),t._spinT=performance.now(),e.style.setProperty("--tw-spin",`${(parseFloat(e.style.getPropertyValue("--tw-spin"))||0)-360}deg`),t.classList.add("is-spinning"),clearTimeout(t._t);let n=()=>{e.getAnimations&&e.getAnimations().length?t._t=setTimeout(n,250):t._spinSettle()};t._t=setTimeout(n,600)},Ft=null,Jn=0,Zn=null,Rs=t=>{t.key==="Escape"&&un()},un=t=>{t&&Zn&&!t.contains(Zn)||(clearTimeout(Jn),document.removeEventListener("keydown",Rs),Ft&&Ft.classList.remove("is-open"))};function Aa(t,e){Ft||(Ft=w("div","tw-tip tw-portal"),Ft.setAttribute("role","tooltip")),Ft.isConnected||document.body.appendChild(Ft),clearTimeout(Jn),Ft.textContent=e,Ne(Ft,t);let n=Ft.classList.contains("is-open");Ft.style.visibility="hidden",Ft.classList.add("is-open"),mo(t,Ft,{align:"center",prefer:"above",gap:8}),Ft.style.visibility="",document.addEventListener("keydown",Rs),Zn=t,n||requestAnimationFrame(function o(){if(Ft.classList.contains("is-open")){if(!Zn.isConnected)return un();requestAnimationFrame(o)}})}function Ps(){Ft&&(clearTimeout(Jn),Jn=setTimeout(un,80))}var Yo=".tw-slider-label, .tw-row-label, .tw-select-label, .tw-trigger-label, .tw-radiogrid-label, .tw-field-label, .tw-folder-title, .tw-fps-label, .tw-plot-label";function ze(t,e){let n=t.querySelector(Yo)||t;if(n===t&&t.classList.contains("tw-separator"))return;let o=n.closest("button"),r=o?w("span","tw-hint",Ko):Mt("tw-hint",Ko),s=()=>Aa(r,e);if(o){r.setAttribute("aria-hidden","true");let i=o.getAttribute("aria-description");o.setAttribute("aria-description",i?`${i}. ${e}`:e)}else r.setAttribute("aria-label",e),r.addEventListener("focus",s),r.addEventListener("blur",Ps),r.addEventListener("keydown",i=>{(i.key==="Enter"||i.key===" ")&&i.stopPropagation()});r.addEventListener("pointerenter",s),r.addEventListener("pointerleave",Ps),r.addEventListener("pointerdown",i=>i.stopPropagation()),r.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation()}),n.appendChild(r)}async function Wo(t){try{return await navigator.clipboard.writeText(t),!0}catch{}let e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.top="-9999px",document.body.appendChild(e),e.focus(),e.select();let n=!1;try{n=document.execCommand("copy")}catch{}return document.body.removeChild(e),n}var Ke=null,ie=null,dn=null,no=null;function _a(t,e,n={}){let o=Object.entries(e).filter(([c])=>c!=="_last"||(console.warn('[tweaks] "_last" is reserved (the changed-key channel) \u2014 schema entry skipped'),!1)).map(([c,y])=>Se(c,y)).filter(Boolean),r={},s=[],i=new Set,a=new Set,l=new Set,h=[],u=!1,d=!1,p=[],N=new Map,L=!1,b=-1,g=c=>{if(!u){if(L){console.warn("[tweaks] call ignored \u2014 the panel could not be built");return}d?c():p.push(c)}},m=null,M=function(c,y){return c==="_last"&&this===r?void 0:y===void 0?null:typeof y=="bigint"?String(y):y},C=!1,j=()=>{let c={};for(let y of s){let E=c;for(let _ of y.path.slice(0,-1))E=E[_]||(E[_]={});E[y.key]=y.get()}return JSON.parse(JSON.stringify(c,M))},B=()=>{try{return JSON.parse(JSON.stringify(r,M))}catch(c){return C||(C=!0,console.warn("[tweaks] a value parked on params can't be serialised \u2014 snapshots carry the controls' values only:",c)),j()}},H=n.persist?`tw:${n.persist===!0?t:n.persist}`:null,D=H?`${H}:presets`:null,G=c=>{try{return JSON.parse(localStorage.getItem(c)||"null")}catch{return null}},W=(c,y)=>{try{localStorage.setItem(c,JSON.stringify(y))}catch{}},P=(c,y)=>y.reduce((E,_)=>E?.[_],c),R=c=>{for(let y of s)if(!y.persist){let E=P(c,y.path.slice(0,-1));E&&typeof E=="object"&&Reflect.deleteProperty(E,y.key)}return c},tt=H?(()=>{let c=0,y=()=>{c=0,W(H,R(B()))};return h.push(()=>{c&&(clearTimeout(c),y())}),()=>{clearTimeout(c),c=setTimeout(y,150)}})():()=>{},q=(c,y=r._last)=>{(c?l:a).forEach(E=>{try{E(r,y)}catch(_){console.error("[tweaks] listener threw:",_)}}),u||tt()},U=c=>typeof c=="function"||typeof c=="symbol"||typeof c=="bigint",at=(c,y)=>{if(U(y))throw new TypeError(`a ${typeof y} is not a control value`);c.set(y),c.target[c.key]=c.get()},A=c=>{Wn(c,c.raw,c.def),c.target[c.key]=c.get()},F=!1,v=()=>{if(typeof n.onReset=="function"&&!F){F=!0;try{return n.onReset()}finally{F=!1}}for(let c of s)try{A(c)}catch(y){console.error(`[tweaks] resetting "${c.path.join(".")}" failed \u2014 control skipped:`,y)}r._last=void 0,q()},f=w("div","tw-panel");f.dataset.mode="inline",po(f);let S=w("div","tw-header"),k=Mt("tw-header-toggle");k.setAttribute("aria-expanded","true");let x=t,V=nt("span","tw-title",x);k.append(V);let Z=w("div","tw-toolbar"),T=()=>{let c={};for(let y of s)pe(y.get(),y.def)&&(c[y.path.join(".")]=y.get());return JSON.parse(JSON.stringify(c,M))},Y=Qn(c=>{if(!c)return[JSON.stringify(B(),null,2),-1];let y=T();return[JSON.stringify(y,null,2),Object.keys(y).length]}),st={panel:f,entries:s,fromJSON:c=>{fe?.flush(),xe.fromJSON(c),fe?.flush()},announce:ye,alive:()=>!u},ut=to(v),Lt=null;H&&n.presets!==!1&&(Lt=cn("",Ls,"Presets"),Lt.setAttribute("aria-haspopup","menu"),Lt.setAttribute("aria-expanded","false"),Z.append(Lt));let pt=!!n.filter&&(n.toolbar!==!1||(console.warn("[tweaks] opts.filter needs the toolbar (its search button lives there) \u2014 ignored alongside toolbar:false"),!1)),kt=pt?cn("",ks,"Filter controls"):null,ft=pt?w("input","tw-search"):null;pt&&(ft.type="text",ft.placeholder="Filter\u2026",ft.spellcheck=!1,ft.setAttribute("aria-label","Filter controls"),Yt(ft),Z.append(kt)),Z.append(Y,ut),S.append(k),pt&&S.append(ft),n.toolbar!==!1&&S.append(Z);let _t=[Y,ut,Lt,kt].filter(Boolean);for(let c of _t)c.disabled=!0;let Pt=!1,Tt=!1;S.addEventListener("click",c=>{Tt&&(Tt=!1,c.preventDefault(),c.stopPropagation())},!0),k.addEventListener("click",()=>{$e(f,k,I,!f.classList.contains("is-collapsed")),f.dataset.mode==="floating"&&setTimeout(()=>{f.dataset.mode==="floating"&&f.isConnected&&(Bt(),Ct())},270)});let I=w("div","tw-body"),K=w("div","tw-controls");I.append(K),f.append(S,I);let dt=go(n.theme);kn(f,dt),f._twTheme=dt;let gt=n.draggable!==!1,mt=8,Ht=28,Dt=()=>({maxX:Math.max(mt,window.innerWidth-f.offsetWidth-mt),maxY:Math.max(mt,window.innerHeight-f.scrollHeight-1-mt)}),O=H?`${H}:pos`:null,ot=(gt||n.floating)&&O?G(O):null,At=ot||(typeof n.floating=="object"?n.floating:null)||{x:16,y:16},bt=+At.x||16,ct=+At.y||16,Ct=()=>{f.style.left=bt+"px",f.style.top=ct+"px",f.style.maxHeight=`calc(100dvh - ${ct+mt}px)`},Bt=()=>{let{maxX:c,maxY:y}=Dt();bt=$(bt,mt,c),ct=$(ct,mt,y)};(gt||n.floating)&&(n.floating||ot)&&(f.dataset.mode="floating",Bt(),Ct(),requestAnimationFrame(()=>{!u&&f.dataset.mode==="floating"&&f.isConnected&&(Bt(),Ct())}));let Kt=c=>{A(c),r._last=c.key,q()},qt=(c,y)=>{let E=c.querySelector(".tw-slider-value")||c.querySelector(Yo)||c;E.classList.add("tw-resettable"),E.title="Double-click or hold to reset";let _=0,Q=0,X=0,it=!1,J=()=>{_&&(clearTimeout(_),_=0,E.classList.remove("tw-reset-holding"))};E.addEventListener("pointerdown",z=>{z.stopPropagation(),it=!1,!(z.pointerType!=="touch"&&z.pointerType!=="pen")&&(Q=z.clientX,X=z.clientY,E.classList.add("tw-reset-holding"),_=setTimeout(()=>{_=0,E.classList.remove("tw-reset-holding","is-editable"),it=!0,Kt(y)},500))}),E.addEventListener("pointermove",z=>{_&&Math.abs(z.clientX-Q)+Math.abs(z.clientY-X)>8&&J()}),E.addEventListener("pointerup",J),E.addEventListener("pointercancel",J),E.addEventListener("pointerleave",J),E.addEventListener("contextmenu",z=>{it&&z.preventDefault()}),E.addEventListener("click",z=>{it&&(z.preventDefault(),z.stopImmediatePropagation(),it=!1)},!0),E.addEventListener("dblclick",z=>{E===c&&z.target.closest&&z.target.closest("input, textarea")||(z.preventDefault(),z.stopPropagation(),Kt(y))}),E.classList.contains("tw-slider-value")&&c.addEventListener("dblclick",z=>{let rt=z.target;!rt.classList||!rt.classList.contains("tw-slider-input")||(z.preventDefault(),z.stopPropagation(),rt.blur(),Kt(y))}),c.addEventListener("keydown",z=>{!z.altKey||z.metaKey||z.ctrlKey||z.key!=="Backspace"&&z.key!=="Delete"||(z.preventDefault(),z.stopPropagation(),z.target.classList&&z.target.classList.contains("tw-slider-input")&&z.target.blur(),Kt(y))})},Qt=[],ve,ae=(c,y)=>!c._hid==!y?!1:(c._hid=y,ve?ve(c,y):c.classList.toggle("tw-cond-hidden",y),!y),te=(c,y)=>{y.hint&&ze(c,y.hint),(y.render||y.disabled!=null)&&Qt.push({node:c,m:y})},qe=[],Ee=[],It=[],ee=[],Ye=c=>{typeof c.destroy=="function"&&h.push(c.destroy)},Te=(c,y,E,_=[],Q=null)=>{for(let X of y){if(X.type==="tabs"){let z={};i.add(z),E[X.key]=z;let rt=zt("tabs"),et=rt&&rt(X);if(!et)continue;ee.push({path:[..._,X.key],ctrl:et,pageKeys:X.pages.map(ht=>ht.key)}),X.pages.forEach((ht,yt)=>{let Vt={};i.add(Vt),z[ht.key]=Vt,Te(et.bodies[yt],ht.children,Vt,[..._,X.key,ht.key])}),te(et.el,X),c.append(et.el);continue}if(X.type==="folder"){let z={};i.add(z),E[X.key]=z;let rt=ln(X);It.push({path:[..._,X.key],el:rt.el,setCollapsed:rt.setCollapsed}),We.set(rt.el,{kind:"folder",path:[..._,X.key],label:X.label});let et=pt?{el:rt.el,label:X.label,body:rt.body}:null;et&&Ee.push(et),Te(rt.body,X.children,z,[..._,X.key],et),te(rt.el,X),c.append(rt.el);continue}let it=!Un.has(X.type),J=Xe(X,it?z=>{pe(E[X.key],z)&&(E[X.key]=z,r._last=X.key,q())}:()=>{});if(J){if(Ye(J),it){let z=J.get();we(E,X.key)&&J.set(E[X.key]),E[X.key]=J.get();let rt={target:E,key:X.key,set:J.set,get:J.get,raw:X.value,def:z,path:[..._,X.key],persist:X.persist!==!1,m:X,el:J.el};s.push(rt),qt(J.el,rt),We.set(J.el,{kind:"row",entry:rt,label:X.label})}te(J.el,X),pt&&X.type!=="separator"&&qe.push({el:J.el,label:X.label,folder:Q}),c.append(J.el)}}};if(pt){let c=E=>{let _=E.trim().toLowerCase(),Q=!1,X=(it,J)=>{!J&&it.classList.contains("tw-filter-hidden")&&(Q=!0),it.classList.toggle("tw-filter-hidden",J)};if(!_)qe.forEach(it=>X(it.el,!1)),Ee.forEach(it=>X(it.el,!1));else{for(let it of qe){let J=it.folder&&Cn(it.folder.label,_);X(it.el,!(Cn(it.label,_)||J))}for(let it of Ee.slice().reverse()){let J=[...it.body.children].some(z=>!z.classList.contains("tw-filter-hidden"));X(it.el,!(Cn(it.label,_)||J))}}Q&&fo()},y=()=>{f.classList.remove("is-searching"),ft.value="",c("")};kt.addEventListener("click",()=>{kt.disabled||(f.classList.toggle("is-searching")?(ft.focus(),ft.select()):y())}),ft.addEventListener("input",()=>c(ft.value)),ft.addEventListener("keydown",E=>{E.key==="Escape"&&(y(),kt.focus())})}let zs=new Set(o.map(c=>c.key)),pn=(c,y)=>{if(!(!c||typeof c!="object")){for(let E of s){let _=P(c,E.path);if(_!==void 0)try{at(E,_)}catch(Q){console.error(`[tweaks] restoring "${E.path.join(".")}" failed \u2014 value skipped:`,Q)}}for(let E of Object.keys(c))if(!zs.has(E)&&E!=="_last"&&we(r,E)&&!Yn(E)&&!U(c[E]))try{r[E]=c[E]}catch(_){console.error(`[tweaks] restoring "${E}" failed \u2014 value skipped:`,_)}r._last=void 0,q(y)}},Oe=()=>{let c=D?G(D):null;return Object.assign(Object.create(null),c&&typeof c=="object"?c:{})},Jo=c=>{let y=Oe();y[c]=B(),W(D,y)},Zo=c=>{let y=Oe();y[c]&&pn(y[c])},Qo=c=>{let y=Oe();delete y[c],W(D,y)},fn=c=>c.map(y=>String(y).replace(/~/g,"~1").replace(/\./g,"~0")).join("."),Ks=()=>{let c={};if(It.length){let y={};for(let E of It)y[fn(E.path)]=E.el.classList.contains("is-collapsed");c.folders=y}if(ee.length){let y={};for(let E of ee)y[fn(E.path)]=E.pageKeys[E.ctrl.active()]??null;c.tabs=y}return c},qs=c=>{if(!(!c||typeof c!="object")){if(c.folders)for(let y of It){let E=c.folders[fn(y.path)];typeof E=="boolean"&&y.setCollapsed(E)}if(c.tabs)for(let y of ee){let E=y.pageKeys.indexOf(c.tabs[fn(y.path)]);E>=0&&E!==y.ctrl.active()&&y.ctrl.activate(E)}}};if(gt||n.floating){if(gt){f.dataset.draggable="true";let et=w("span","tw-grabber");et.setAttribute("aria-hidden","true"),S.prepend(et)}let c=()=>{if(f.dataset.mode==="floating")return;let et=f.getBoundingClientRect();if(bt=et.left,ct=et.top,f.parentNode&&(m=w("span","tw-lift-slot"),m.style.width=et.width+"px",m.style.height=et.height+"px",m.setAttribute("aria-hidden","true"),f.before(m)),bo(f,f),document.body.appendChild(f),f.dataset.mode="floating",Ct(),m&&typeof MutationObserver=="function"){let ht=new MutationObserver(()=>{m&&!m.isConnected&&(ht.disconnect(),m=null,f.remove())});ht.observe(document.documentElement,{childList:!0,subtree:!0}),h.push(()=>ht.disconnect())}},y=()=>{Ke&&Ke!==f&&(Ke.style.zIndex=""),f.style.zIndex="99991",Ke=f},E=null,_=0,Q=0,X=0,it=0,J=et=>{for(let[ht,yt]of[["pointermove",z],["pointerup",rt],["pointercancel",rt]])et?document.addEventListener(ht,yt,!0):document.removeEventListener(ht,yt,!0)};gt&&S.addEventListener("pointerdown",et=>{if(!(et.button!==0||E!==null||et.target.closest(".tw-toolbar, input, textarea, select"))&&(E=et.pointerId,_=et.clientX,Q=et.clientY,Pt=!1,J(!0),f.classList.add("is-grabbing"),f.style.transition)){let ht=getComputedStyle(f);bt=parseFloat(ht.left)||bt,ct=parseFloat(ht.top)||ct,f.style.transition="",Ct()}});let z=et=>{if(et.pointerId!==E)return;if(et.buttons===0){rt(et);return}let ht=et.clientX-_,yt=et.clientY-Q;if(!Pt){if(Math.abs(ht)+Math.abs(yt)<4)return;Pt=!0,c(),y(),X=bt,it=ct;try{S.setPointerCapture(E)}catch{}f.classList.add("is-dragging")}let{maxX:Vt,maxY:vt}=Dt();bt=$(X+ht,mt,Vt),ct=$(it+yt,mt,vt),Ct()},rt=et=>{if(et.pointerId===E){try{S.releasePointerCapture(E)}catch{}if(E=null,J(!1),Tt=Pt,Tt&&setTimeout(()=>{Tt=!1},0),Pt){let{maxX:ht,maxY:yt}=Dt();bt<=mt+Ht?bt=mt:bt>=ht-Ht&&(bt=ht),ct<=mt+Ht?ct=mt:ct>=yt-Ht&&(ct=yt),oe.matches||(f.style.transition="left 0.32s var(--tw-ease-spring), top 0.32s var(--tw-ease-spring)",setTimeout(()=>{f.style.transition=""},340)),Ct(),O&&W(O,{x:bt,y:ct})}f.classList.remove("is-dragging","is-grabbing")}};S.addEventListener("lostpointercapture",rt),h.push(()=>J(!1))}let Ys=()=>{(gt||n.floating)&&(f.dataset.mode==="floating"&&(Bt(),Ct()),h.push(Gt(f,[[window,"resize"]],()=>{f.dataset.mode==="floating"&&(Bt(),Ct())})))};if(Lt){let c=w("div","tw-presets-menu"),y=w("div","tw-presets-save"),E=w("input","tw-presets-input");E.type="text",E.placeholder="Preset name\u2026",E.spellcheck=!1,E.setAttribute("aria-label","New preset name"),Yt(E);let _=nt("button","tw-presets-savebtn","Save");y.append(E,_);let Q=w("div","tw-presets-list");c.append(y,Q);let X=()=>{let z=Oe(),rt=Object.keys(z);if(Q.replaceChildren(),!rt.length)return Q.append(nt("div","tw-presets-empty","No presets yet"));for(let et of rt){let ht=w("div","tw-presets-row"),yt=nt("button","tw-presets-load",et);yt.addEventListener("click",()=>{Zo(et),J.close(),ye(`Loaded preset ${et}`)});let Vt=Mt("tw-presets-del",Ss);Vt.setAttribute("aria-label",`Delete preset ${et}`),Vt.addEventListener("click",vt=>{vt.stopPropagation(),Qo(et),X()}),ht.append(yt,Vt),Q.append(ht)}},it=()=>{let z=E.value.trim();if(!z){E.focus();return}Jo(z),E.value="",X(),ye(`Saved preset ${z}`)},J=Xt(Lt,Lt,c,{width:208,fallbackH:160,gap:6,align:"end",onOpen:()=>{X(),E.focus()}});_.addEventListener("click",it),E.addEventListener("keydown",z=>{z.key==="Enter"&&it()})}if(n.onEditStart||n.onEditEnd){let c=".tw-slider, .tw-num-grab, .tw-pad, .tw-wg-area, .tw-wg-hue, .tw-wg-alpha, .tw-bezier-handle, .tw-gradient-bar, .tw-gradient-stop",y=!1,E=()=>{document.removeEventListener("pointerup",E,!0),document.removeEventListener("pointercancel",E,!0),y&&(y=!1,n.onEditEnd&&n.onEditEnd())},_=Q=>{y||!Q.target.closest(c)||(y=!0,n.onEditStart&&n.onEditStart(),document.addEventListener("pointerup",E,!0),document.addEventListener("pointercancel",E,!0))};f.addEventListener("pointerdown",_),f._twEditPointer=_,h.push(E)}let fe=n.undo?(()=>{let y=[],E=0,_=!1,Q=0,X=()=>{Q=0;let vt=B();JSON.stringify(vt)!==JSON.stringify(y[E])&&(y=y.slice(0,E+1),y.push(vt),y.length>200&&(y=y.slice(y.length-200)),E=y.length-1)},it=()=>{_||(clearTimeout(Q),Q=setTimeout(X,350))},J=()=>{Q&&(clearTimeout(Q),X())};a.add(it),l.add(it);let z=vt=>{_=!0,pn(y[vt]),_=!1,E=vt},rt=()=>{J(),E>0&&z(E-1)},et=()=>{J(),E<y.length-1&&z(E+1)},ht=()=>f.matches(":hover")||f.contains(document.activeElement),yt=vt=>!!(vt&&vt.matches&&(vt.matches("input, textarea")||vt.isContentEditable));return{undo:rt,redo:et,onKey:vt=>{if(!ht()||!(vt.metaKey||vt.ctrlKey)||yt(vt.target))return;let mn=vt.key.toLowerCase();mn==="z"?(vt.preventDefault(),vt.shiftKey?et():rt()):mn==="y"&&(vt.preventDefault(),et())},flush:J,arm:()=>{y=[B()],E=0}}})():null,We=new Map,Ws=c=>{for(;c&&c!==f&&f.contains(c);c=c.parentElement){let y=We.get(c);if(y)return y}},Us=c=>{for(;c&&c!==f;c=c.parentElement)if(We.get(c)?.kind==="row")return c},oo=c=>!!(c.closest(".tw-filter-hidden, .tw-cond-hidden, .tw-tabs-page:not([data-active=true])")||c.parentElement?.closest(".is-collapsed")),ne,tr=c=>{let y=c.target;!f.contains(y)&&!y.closest?.(".tw-portal")&&le()},le=()=>{ne&&(ne[0].classList.remove("is-picked"),ne=void 0,document.removeEventListener("pointerdown",tr,!0),ie?.[0]===f&&(ie=null))},Js=(c,y)=>{ie&&ie[0]!==f&&ie[1](),le(),ne=[c,y],ie=[f,le],c.classList.add("is-picked"),document.addEventListener("pointerdown",tr,!0);let E=[...c.querySelectorAll('button:not(:disabled):not([tabindex="-1"]), [tabindex="0"]')].find(_=>!_.closest(".tw-hint, .tw-portal, [inert]"));E?E.focus({preventScroll:!0,focusVisible:!1}):document.activeElement?.blur?.(),document.getSelection?.()?.removeAllRanges()};h.push(le),f.addEventListener("pointerdown",c=>{let y=c.target;if(Us(y)||y.closest(".tw-header, .tw-folder-header, button, input, textarea, select")){ne?.[0].contains(y)||le();return}if(c.button!==0||c.pointerType==="touch")return le();let E;for(let[_,Q]of We){let X=(Q.kind==="folder"?_.firstElementChild:_).getBoundingClientRect();X.height&&c.clientY>=X.top&&c.clientY<X.bottom&&!oo(_)&&(E=[_,Q])}if(!E)return le();c.preventDefault(),Js(...E)},!0);let er=c=>!!(c&&c.matches&&(c.matches("input, textarea, select")||c.isContentEditable)),Zs=c=>{if(c.key==="Escape")return le();if(!(c.metaKey||c.ctrlKey)||c.altKey||c.repeat||er(c.target))return;let y=c.key.toLowerCase();if(y!=="c"&&y!=="v")return;ie&&!ie[0].isConnected&&ie[1](),ne&&oo(ne[0])&&le();let E=document.activeElement,_=ne?ne[1]:ie||!E||oo(E)?void 0:Ws(E);if(!_||y==="c"&&String(document.getSelection?.()||""))return;let Q=y==="c"?JSON.stringify(_.kind==="row"?_.entry.get():P(B(),_.path),M,2):"",X=yt=>{u||ye(yt?`${_.label} copied`:"Copy failed")},it=ne?.[0],J=document.activeElement,z=!!J?.matches(":focus-visible");if(!dn){dn=w("textarea","tw-sr"),dn.tabIndex=-1,dn.setAttribute("aria-hidden","true");for(let yt of["copy","paste"])document.addEventListener(yt,Vt=>no?.(Vt),!0)}let rt=dn,et=()=>{no=null,document.activeElement===rt&&(rt.blur(),J?.focus?.({preventScroll:!0,focusVisible:z}))},ht=no=yt=>{if(yt.target!==rt&&er(yt.target))return;if(yt.preventDefault(),et(),Q)return yt.clipboardData?.setData("text/plain",Q),X(!!yt.clipboardData);let Vt=yt.clipboardData?.getData("text/plain")??null;Promise.resolve().then(()=>(Is(),Ds)).then(vt=>vt.pasteInto(Vt,mn=>vt.pasteScope(st,_,mn),st,it),()=>{})};rt.isConnected||document.body.appendChild(rt),rt.value=Q,rt.focus({preventScroll:!0}),rt.select(),setTimeout(()=>{no===ht&&(et(),Q&&Wo(Q).then(X))},1e3)},nr=()=>{if(!u){if(b=h.length,Te(K,o,r),Qt.length){let c=new Map;for(let _ of s)c.has(_.key)||c.set(_.key,_);let y=_=>{let Q=c.get(_);return Q?Q.target[Q.key]:r[_]},E=()=>{let _=!1;for(let{node:Q,m:X}of Qt)try{if(X.render&&ae(Q,!X.render(y))&&(_=!0),X.disabled!=null){let it=typeof X.disabled=="function"?X.disabled(y):X.disabled;Ln(Q,!!it)}}catch{}_&&fo()};a.add(E),l.add(E),E(),Promise.resolve().then(()=>(Bs(),js)).then(_=>{ve=_.fold},()=>{})}if(H&&pn(R(G(H))),!u){fe?.arm(),Ys(),h.push(Gt(f,[[document,"keydown"]],c=>{fe?.onKey(c),Zs(c)})),d=!0;for(let c of p.splice(0)){if(u)break;try{c()}catch(y){console.error("[tweaks] a call queued before ready failed:",y)}}N.clear();for(let c of _t)c.disabled=!1}}},or=(c,y)=>{if(String(c).split(".").some(Yn))return console.warn(`[tweaks] set("${c}") ignored \u2014 reserved key`),!1;let E=String(c).split("."),_;if(E.length>1){let J=r;for(let z=0;z<E.length-1&&J;z++)J=J[E[z]],i.has(J)||(J=null);if(_=J&&s.find(z=>z.target===J&&z.key===E[E.length-1]),!_)return console.warn(`[tweaks] set("${c}") \u2014 no control at that path`),!1}else{let J=s.filter(rt=>rt.key===c),z=J.find(rt=>rt.target===r);if(!z&&J.length>1)return console.warn(`[tweaks] set("${c}") is ambiguous \u2014 ${J.length} controls share that key; use a dotted path (e.g. "${J[0].path.join(".")}")`),!1;_=z||J[0]}let Q=_?_.target:r,X=_?_.key:c,it=Q[X];if(_&&U(y))return console.warn(`[tweaks] set("${c}") ignored \u2014 a ${typeof y} is not a control value`),!1;if(_)try{at(_,y)}catch(J){return console.error(`[tweaks] set("${c}") failed \u2014 value skipped:`,J),!1}else{if(i.has(r[c]))return console.warn(`[tweaks] set("${c}") ignored \u2014 it's a folder/tabs group; set its children instead`),!1;r[c]=y}return pe(it,Q[X])?(r._last=X,!0):!1},xe={el:f,params:r,on(c){return u?()=>{}:(a.add(c),()=>a.delete(c))},set(c,y,E){let _=String(c),Q=E?.silent;g(()=>{or(_,y)&&q(Q)})},setMany(c,y){if(c==null||typeof c!="object")return;let E=Object.entries(c),_=y?.silent;g(()=>{let Q=!1;for(let[X,it]of E)try{or(X,it)&&(Q=!0)}catch(J){console.error(`[tweaks] setMany("${X}") failed \u2014 key skipped:`,J)}Q&&q(_)})},reset(){d&&!u&&qo(ut),g(v)},toJSON(){return u?{values:{},ui:{}}:{values:B(),ui:Ks()}},changes(){return u?{}:T()},fromJSON(c,y){if(!c||typeof c!="object")return;let E=y?.silent,_=c.values&&typeof c.values=="object"?{...c.values}:c.values,Q=c.ui&&typeof c.ui=="object"?{...c.ui}:c.ui;g(()=>{_&&pn(_,E),qs(Q)})},setName(c){u||(x=String(c),V.textContent=x)},setTheme(c){if(!u){if(dt)for(let y in dt)f.style.removeProperty(y);dt=go(c),f._twTheme=dt,kn(f,dt),window.dispatchEvent(new Event("tw-retheme"))}},savePreset:c=>u||L||!D||!c?!1:(d||N.set(String(c),"save"),g(()=>Jo(c)),!0),loadPreset:c=>{let y=N.get(String(c));return u||L||y==="delete"||!(y==="save"||Oe()[c])?!1:(g(()=>Zo(c)),!0)},deletePreset:c=>{D&&(d||N.set(String(c),"delete"),g(()=>Qo(c)))},presets:()=>u?[]:Object.keys(Oe()),undo:()=>{fe&&g(fe.undo)},redo:()=>{fe&&g(fe.redo)},destroy(){if(!u){u=!0,ur(f),un(f);for(let c of h.splice(0))try{c()}catch{}a.clear(),m&&(m.remove(),m=null),Ke===f&&(Ke=null),f.dataset.twDestroyed="",f.remove()}}},rr=Ge(o);if(rr){let c=y=>{if(L=!0,p.length=0,b>=0)for(let E of h.splice(b))try{E()}catch{}for(let E of K.children)E.dataset.twDestroyed="";throw a.clear(),s.length=0,K.replaceChildren(),u||console.warn(`[tweaks] "${t}": the panel could not be built \u2014 ${b>=0?"the build threw":"its lazy controls failed to load"}; the API is inert`),y};xe.ready=f.ready=rr.then(nr).then(()=>xe,c),xe.ready.catch(()=>{})}else nr(),xe.ready=f.ready=Promise.resolve(xe);return xe}Et();var Ha=(t,e)=>{t.dataset.value=e==null?"":Array.isArray(e)?e.join(","):typeof e=="object"?Object.values(e).join(","):String(e)},Da=(t,e,n)=>{Ha(t,n),t.dispatchEvent(new CustomEvent("tw:change",{bubbles:!0,detail:{key:e,value:n}}))},Uo=(t,e)=>[...typeof t.matches=="function"&&t.matches(e)?[t]:[],...t.querySelectorAll(e)];async function Vs(t=document){Uo(t,'.tw-panel[data-mode="inline"]:not([data-tw-panel-bound])').forEach(o=>{let r=o.querySelector(":scope > .tw-header"),s=o.querySelector(":scope > .tw-controls");if(!r||!s)return;o.setAttribute("data-tw-panel-bound","");let i=w("div","tw-body");o.insertBefore(i,s),i.append(s);let a=r.querySelector(".tw-header-toggle"),l=r.querySelector(".tw-title");if(!a&&l&&(a=Mt("tw-header-toggle"),l.replaceWith(a),a.append(l)),!!a&&(a.setAttribute("aria-expanded","true"),a.addEventListener("click",()=>$e(o,a,i,!o.classList.contains("is-collapsed"))),!r.querySelector(".tw-toolbar"))){let h=l&&l.textContent||"Panel",u=()=>[...o.querySelectorAll("[data-tw]")].map(L=>L._tw).filter(L=>L&&L.ctrl.get()!==void 0),d=()=>{let L=Object.create(null);for(let b of u()){let g=b.key,m=2;for(;we(L,g);)g=`${b.key}-${m++}`;L[g]=b.ctrl.get()}return JSON.stringify(L,null,2)},p=()=>{for(let L of u())L.reset()},N=w("div","tw-toolbar");N.append(Qn(()=>[d(),-1]),to(p)),r.append(N)}}),Uo(t,'[data-tw="folder"]:not([data-tw-bound])').forEach(o=>{o.setAttribute("data-tw-bound","");let r=ln({label:o.dataset.label||"Folder"});[...o.children].forEach(s=>r.body.append(s)),o.append(r.el)});let e=Uo(t,"[data-tw]:not([data-tw-bound])").map(o=>({host:o,meta:vs(o)})).filter(o=>o.meta);e.forEach(({host:o})=>o.setAttribute("data-tw-bound",""));let n=Ge(e.map(o=>o.meta));n&&await n.catch(()=>{});for(let{host:o,meta:r}of e){let s=o.dataset.key||r.label,i,a=d=>{pe(i,d)&&(i=d,Da(o,s,d))},l=Xe(r,a);if(!l)continue;o.closest(".tw-panel, .tw-portal")||o.classList.add("tw-portal"),o.append(l.el),o.dataset.hint&&ze(l.el,o.dataset.hint);let h=l.get();i=h;let u={...l,set:d=>{l.set(d),a(l.get())}};o._tw={ctrl:u,raw:r.value,def:h,key:s,host:o,reset:()=>{Wn(l,r.value,h),a(l.get())}}}}if(typeof document<"u"){let t=()=>Vs(document);document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()}Et();var Gs=t=>w("div",`${t} tw-standalone tw-portal`),Xs=(t,e,n)=>{let o=Ge(t);if(!o)return e(),Promise.resolve(n);let r=o.then(e).then(()=>n);return r.catch(()=>{}),r};function Ia(t,e,n={}){let o=n.key??"value",r=Se(o,e);if(!r||r.type==="folder"||r.type==="tabs")throw new TypeError(`[tweaks] mountControl: "${o}" is not a single-control schema value`);n.label!=null&&(r.label=String(n.label));let s=!Un.has(r.type),i=Gs("tw-control");t.append(i);let a=null,l=!1,h=r.value,u,d=!1,p=b=>{pe(h,b)&&(h=b,n.onChange&&n.onChange(b,o))},N=()=>{if(l||(a=Xe(r,s?p:()=>{}),!a))return;r.hint&&ze(a.el,r.hint);let b=()=>{};try{r.render&&!r.render(b)&&a.el.classList.add("tw-cond-hidden")}catch{}try{(typeof r.disabled=="function"?r.disabled(b):r.disabled)&&Ln(a.el,!0)}catch{}i.append(a.el),s&&(h=a.get(),d&&(a.set(u),p(a.get())))},L={el:i,set:b=>{l||!s||(a?(a.set(b),p(a.get())):(u=b,d=!0))},get:()=>s?a?a.get():d?u:r.value:void 0,destroy:()=>{l=!0,a&&typeof a.destroy=="function"&&a.destroy(),i.dataset.twDestroyed="",i.remove()},ready:null};return L.ready=Xs([r],N,L),L}function ja(t={}){let e=Gs("tw-color-picker"),n=null,o=!1,r=t.value,s,i=!1,a=null,l=d=>{pe(r,d)&&(r=d,t.onChange&&t.onChange(d))},h=()=>{if(o)return;let d=zt("colorpicker");d&&(n=d({value:t.value,mode:t.mode},l),r=n.get(),e.append(n.el),a&&n.setMode(a),i&&(n.set(s),l(n.get())),jt(n.reflow))},u={el:e,set:d=>{o||(n?(n.set(d),l(n.get())):(s=d,i=!0))},get:()=>n?n.get():i?s:t.value,mode:()=>n?n.mode():a||t.mode||"oklch",setMode:d=>{n?n.setMode(d):a=d},reflow:()=>{n&&n.reflow()},destroy:()=>{o=!0,e.remove()},ready:null};return u.ready=Xs([{type:"color"}],h,u),u}yn();export{ja as createColorPicker,Vs as enhance,wn as gradientCss,ao as gradientStops,Ia as mountControl,_a as tweaks};