pi-mega-compact 0.13.6 → 0.13.7
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.
- package/dist/extensions/dashboard-server/index-reader.js +3 -1
- package/dist/extensions/dashboard-server/resolve-snapshot.js +81 -0
- package/dist/extensions/dashboard-server/routes-core.js +8 -3
- package/dist/extensions/dashboard-server/routes-repo.js +5 -1
- package/dist/extensions/dashboard-server/routes-sessions.js +6 -3
- package/dist/extensions/mega-runtime/capture-model.js +5 -2
- package/dist/src/pricing.js +8 -0
- package/extensions/dashboard-client/dist/assets/{AreaChart-KAmp_6bL.js → AreaChart-j2VOSRp6.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AreaChart-KAmp_6bL.js.map → AreaChart-j2VOSRp6.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{CacheTab-Bk-gm-R0.js → CacheTab-Dr1HeMfc.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-Bk-gm-R0.js.map → CacheTab-Dr1HeMfc.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/EventsTab-DRG2k7FS.js +2 -0
- package/extensions/dashboard-client/dist/assets/EventsTab-DRG2k7FS.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{HealthTab-D-IzmV29.js → HealthTab-DGE9PpW3.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-D-IzmV29.js.map → HealthTab-DGE9PpW3.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-CrlkCFVj.js → MaintenanceTab-DeYRhF4q.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-CrlkCFVj.js.map → MaintenanceTab-DeYRhF4q.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-DHUdZ7RR.js → MemoryMapTab-DSnSO3nG.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-DHUdZ7RR.js.map → MemoryMapTab-DSnSO3nG.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MetricsTab-B7I4HWVg.js → MetricsTab-RIzNc1Uj.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsTab-B7I4HWVg.js.map → MetricsTab-RIzNc1Uj.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{OverviewTab-K6j4ZI7u.js → OverviewTab-_1BJ4Bmh.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{OverviewTab-K6j4ZI7u.js.map → OverviewTab-_1BJ4Bmh.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ReposTab-BSRWhn56.js → ReposTab-DkU7ywZB.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-BSRWhn56.js.map → ReposTab-DkU7ywZB.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-BXdizHN1.js → SessionsTab-Bq_F_aOk.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-BXdizHN1.js.map → SessionsTab-Bq_F_aOk.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SetupTab-CAgyfqY3.js → SetupTab-BkBD2Y97.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SetupTab-CAgyfqY3.js.map → SetupTab-BkBD2Y97.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-DwgCzPD9.js → TimeSavedCard-BXzFKU7C.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-DwgCzPD9.js.map → TimeSavedCard-BXzFKU7C.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnsTab-CVKcStBp.js → TurnsTab-Bjpp3vBH.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TurnsTab-CVKcStBp.js.map → TurnsTab-Bjpp3vBH.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{WikiTab-BNohxTbs.js → WikiTab-dBN2EA5G.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{WikiTab-BNohxTbs.js.map → WikiTab-dBN2EA5G.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{button-B4A-_dCA.js → button-Bt0b5QVp.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{button-B4A-_dCA.js.map → button-Bt0b5QVp.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-Cjn7Ifoe.js → card-D5CafXtg.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-Cjn7Ifoe.js.map → card-D5CafXtg.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-CQjCLvv7.js → index-GPHRnEN7.js} +3 -3
- package/extensions/dashboard-client/dist/assets/{index-CQjCLvv7.js.map → index-GPHRnEN7.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/pricing-DkYp8-vi.js +2 -0
- package/extensions/dashboard-client/dist/assets/pricing-DkYp8-vi.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{switch-CcdXX0Zm.js → switch-CY5Gwj1o.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-CcdXX0Zm.js.map → switch-CY5Gwj1o.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-KdBnFLu3.js → toggle-C9HpkIfH.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-KdBnFLu3.js.map → toggle-C9HpkIfH.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-B6t44vzc.js → useSSE-2JFrLDlE.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-B6t44vzc.js.map → useSSE-2JFrLDlE.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-client/src/components/EventStream.tsx +1 -1
- package/extensions/dashboard-server/index-reader.ts +3 -1
- package/extensions/dashboard-server/resolve-snapshot.ts +98 -0
- package/extensions/dashboard-server/routes-core.ts +8 -3
- package/extensions/dashboard-server/routes-repo.ts +5 -1
- package/extensions/dashboard-server/routes-sessions.ts +6 -3
- package/extensions/mega-runtime/capture-model.ts +5 -2
- package/package.json +1 -1
- package/src/pricing.ts +8 -0
- package/extensions/dashboard-client/dist/assets/EventsTab-Cyylo0of.js +0 -2
- package/extensions/dashboard-client/dist/assets/EventsTab-Cyylo0of.js.map +0 -1
- package/extensions/dashboard-client/dist/assets/pricing-CvE4NllQ.js +0 -2
- package/extensions/dashboard-client/dist/assets/pricing-CvE4NllQ.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const o={"claude-sonnet-4":3e-6,"claude-3.5-sonnet":3e-6,"claude-3-opus":15e-6,"claude-3-haiku":25e-8,"claude-3.5-haiku":8e-7,"claude-mythos-5":15e-6,"claude-fable":5e-6,"gpt-4o":25e-7,"gpt-4o-mini":15e-8,"gpt-4-turbo":1e-5,"gpt-3.5-turbo":5e-7,"gemini-2.5-pro":125e-8,"gemini-2.5-flash":15e-8,"gemini-2.0-flash":1e-7,"deepseek-chat":14e-8,"deepseek-reasoner":55e-8,"deepseek-v4-flash":14e-8,codestral:3e-7,"mistral-large":2e-6,"llama-3.1-405b":133e-8,"llama-3.1-70b":8e-7,"llama-3.1-8b":5e-8,"zai-org/GLM-5.1-FP8":15e-8,"zai-org/GLM-4.7-Flash":1e-7,"hf:zai-org/GLM-4.7-Flash":1e-7,"ozore/mimo-v2.5-pro":5e-7};function s(e){if(o[e]!=null)return o[e];for(const[t,a]of Object.entries(o))if(e.startsWith(t))return a}function n(e,t,a){if(a<=0)return{cacheReadSaved:0,cacheWriteCost:0,netSaved:0};const r=e*a*.9,c=t*a*.25;return{cacheReadSaved:r,cacheWriteCost:c,netSaved:r-c}}export{n as c,s as l};
|
|
2
|
+
//# sourceMappingURL=pricing-DkYp8-vi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricing-DkYp8-vi.js","sources":["../../../../src/pricing.ts"],"sourcesContent":["/**\n * pricing.ts — Reusable pricing constants and cache-savings computation.\n *\n * Single source of truth for provider prompt-cache pricing multipliers and\n * known model input rates. Extracted from routes-cache.ts inline arithmetic.\n *\n * PREVENT-PI-004: compute-only, zero network. No SQL, no IO.\n */\n\n// ─── Cache Pricing Multipliers ──────────────────────────────────────────────\n\n/**\n * Fraction of input cost saved per cache-read token.\n * Cache reads cost 10% of full input → you save 90% of the input cost.\n */\nexport const CACHE_READ_MULTIPLIER = 0.9;\n\n/**\n * Fraction of input cost incurred as a premium per cache-write token.\n * Cache writes cost 125% of full input → a 25% premium over a normal input token.\n */\nexport const CACHE_WRITE_MULTIPLIER = 0.25;\n\n// ─── Known Model Input Rates ─────────────────────────────────────────────────\n// USD per input token. Exact-match first, then prefix-match.\n\nexport const MODEL_INPUT_RATES: Record<string, number> = {\n\t\"claude-sonnet-4\": 3e-6, // $3/Mtok\n\t\"claude-3.5-sonnet\": 3e-6,\n\t\"claude-3-opus\": 15e-6,\n\t\"claude-3-haiku\": 0.25e-6,\n\t\"claude-3.5-haiku\": 0.8e-6,\n\t\"claude-mythos-5\": 15e-6, // Opus-class custom alias\n\t\"claude-fable\": 5e-6, // Claude 5 mid-tier\n\t\"gpt-4o\": 2.5e-6,\n\t\"gpt-4o-mini\": 0.15e-6,\n\t\"gpt-4-turbo\": 10e-6,\n\t\"gpt-3.5-turbo\": 0.5e-6,\n\t\"gemini-2.5-pro\": 1.25e-6,\n\t\"gemini-2.5-flash\": 0.15e-6,\n\t\"gemini-2.0-flash\": 0.1e-6,\n\t\"deepseek-chat\": 0.14e-6,\n\t\"deepseek-reasoner\": 0.55e-6,\n\t\"deepseek-v4-flash\": 0.14e-6, // DeepSeek v4 flash-tier\n\tcodestral: 0.3e-6,\n\t\"mistral-large\": 2e-6,\n\t\"llama-3.1-405b\": 1.33e-6,\n\t\"llama-3.1-70b\": 0.8e-6,\n\t\"llama-3.1-8b\": 0.05e-6,\n\t// GLM models (zai-org) — approximate open-weights pricing\n\t\"zai-org/GLM-5.1-FP8\": 0.15e-6,\n\t\"zai-org/GLM-4.7-Flash\": 0.1e-6,\n\t\"hf:zai-org/GLM-4.7-Flash\": 0.1e-6,\n\t\"ozore/mimo-v2.5-pro\": 0.5e-6,\n};\n\n/**\n * Look up the input-token rate (USD) for a model string.\n * Exact match first, then prefix match (e.g. \"claude-sonnet-4-20250514\" → 3e-6).\n */\nexport function lookupModelInputRate(model: string): number | undefined {\n\t// exact match first\n\tif (MODEL_INPUT_RATES[model] != null) return MODEL_INPUT_RATES[model];\n\t// prefix match\n\tfor (const [key, rate] of Object.entries(MODEL_INPUT_RATES)) {\n\t\tif (model.startsWith(key)) return rate;\n\t}\n\treturn undefined;\n}\n\n// ─── Cache Savings Computation ──────────────────────────────────────────────\n\nexport interface CacheSavings {\n\treadonly cacheReadSaved: number;\n\treadonly cacheWriteCost: number;\n\treadonly netSaved: number;\n}\n\n/**\n * Compute dollar savings from provider prompt cache read/write token counts.\n *\n * @param totalCacheRead — total cache-read tokens over the lifetime.\n * @param totalCacheWrite — total cache-write tokens over the lifetime.\n * @param inputRate — the model's input-token rate in USD (e.g. 3e-6 for Sonnet).\n * @returns `{ cacheReadSaved, cacheWriteCost, netSaved }` — or all zeros when\n * `inputRate` is zero or negative.\n */\nexport function computeCacheSavings(\n\ttotalCacheRead: number,\n\ttotalCacheWrite: number,\n\tinputRate: number,\n): CacheSavings {\n\tif (inputRate <= 0) {\n\t\treturn { cacheReadSaved: 0, cacheWriteCost: 0, netSaved: 0 };\n\t}\n\tconst cacheReadSaved = totalCacheRead * inputRate * CACHE_READ_MULTIPLIER;\n\tconst cacheWriteCost = totalCacheWrite * inputRate * CACHE_WRITE_MULTIPLIER;\n\treturn {\n\t\tcacheReadSaved,\n\t\tcacheWriteCost,\n\t\tnetSaved: cacheReadSaved - cacheWriteCost,\n\t};\n}\n"],"names":["MODEL_INPUT_RATES","lookupModelInputRate","model","key","rate","computeCacheSavings","totalCacheRead","totalCacheWrite","inputRate","cacheReadSaved","cacheWriteCost"],"mappings":"AA0BO,MAAMA,EAA4C,CACxD,kBAAmB,KACnB,oBAAqB,KACrB,gBAAiB,MACjB,iBAAkB,MAClB,mBAAoB,KACpB,kBAAmB,MACnB,eAAgB,KAChB,SAAU,MACV,cAAe,MACf,cAAe,KACf,gBAAiB,KACjB,iBAAkB,OAClB,mBAAoB,MACpB,mBAAoB,KACpB,gBAAiB,MACjB,oBAAqB,MACrB,oBAAqB,MACrB,UAAW,KACX,gBAAiB,KACjB,iBAAkB,OAClB,gBAAiB,KACjB,eAAgB,KAEhB,sBAAuB,MACvB,wBAAyB,KACzB,2BAA4B,KAC5B,sBAAuB,IACxB,EAMO,SAASC,EAAqBC,EAAmC,CAEvE,GAAIF,EAAkBE,CAAK,GAAK,KAAM,OAAOF,EAAkBE,CAAK,EAEpE,SAAW,CAACC,EAAKC,CAAI,IAAK,OAAO,QAAQJ,CAAiB,EACzD,GAAIE,EAAM,WAAWC,CAAG,EAAG,OAAOC,CAGpC,CAmBO,SAASC,EACfC,EACAC,EACAC,EACe,CACf,GAAIA,GAAa,EAChB,MAAO,CAAE,eAAgB,EAAG,eAAgB,EAAG,SAAU,CAAA,EAE1D,MAAMC,EAAiBH,EAAiBE,EAAY,GAC9CE,EAAiBH,EAAkBC,EAAY,IACrD,MAAO,CACN,eAAAC,EACA,eAAAC,EACA,SAAUD,EAAiBC,CAAA,CAE7B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as c,j as v,U as O,V as we,k as q}from"./index-CQjCLvv7.js";var Ee=Object.defineProperty,R=(e,t)=>Ee(e,"name",{value:t,configurable:!0}),Z=!!(typeof window<"u"&&window.document&&window.document.createElement);function B(e,t,{checkForDefaultPrevented:n=!0}={}){return R(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},"handleEvent")}R(B,"composeEventHandlers");function Ce(e){if(!Z)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}R(Ce,"getOwnerWindow");function N(e){if(!Z)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}R(N,"getOwnerDocument");function J(e,t=!1){const{activeElement:n}=N(e);if(!n?.nodeName)return null;if(K(n)&&n.contentDocument)return J(n.contentDocument.body,t);if(t){const o=n.getAttribute("aria-activedescendant");if(o){const r=N(n).getElementById(o);if(r)return r}}return n}R(J,"getActiveElement");function K(e){return e.tagName==="IFRAME"}R(K,"isFrame");var _e=Object.defineProperty,M=(e,t)=>_e(e,"name",{value:t,configurable:!0});function A(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}M(A,"setRef");function Q(...e){return t=>{let n=!1;const o=e.map(r=>{const s=A(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r<o.length;r++){const s=o[r];typeof s=="function"?s():A(e[r],null)}}}}M(Q,"composeRefs");function T(...e){return c.useCallback(Q(...e),e)}M(T,"useComposedRefs");var ye=Object.defineProperty,w=(e,t)=>ye(e,"name",{value:t,configurable:!0});function xe(e,t){const n=c.createContext(t);n.displayName=e+"Context";const o=w(s=>{const{children:i,...u}=s,a=c.useMemo(()=>u,Object.values(u));return v.jsx(n.Provider,{value:a,children:i})},"Provider");o.displayName=e+"Provider";function r(s,i={}){const{optional:u=!1}=i,a=c.useContext(n);if(a)return a;if(t!==void 0)return t;if(!u)throw new Error(`\`${s}\` must be used within \`${e}\``)}return w(r,"useContext"),[o,r]}w(xe,"createContext");function ee(e,t=[]){let n=[];function o(s,i){const u=c.createContext(i);u.displayName=s+"Context";const a=n.length;n=[...n,i];const f=w(l=>{const{scope:m,children:d,...h}=l,S=m?.[e]?.[a]||u,b=c.useMemo(()=>h,Object.values(h));return v.jsx(S.Provider,{value:b,children:d})},"Provider");f.displayName=s+"Provider";function p(l,m,d={}){const{optional:h=!1}=d,S=m?.[e]?.[a]||u,b=c.useContext(S);if(b)return b;if(i!==void 0)return i;if(!h)throw new Error(`\`${l}\` must be used within \`${s}\``)}return w(p,"useContext"),[f,p]}w(o,"createContext");const r=w(()=>{const s=n.map(i=>c.createContext(i));return w(function(u){const a=u?.[e]||s;return c.useMemo(()=>({[`__scope${e}`]:{...u,[e]:a}}),[u,a])},"useScope")},"createScope");return r.scopeName=e,[o,te(r,...t)]}w(ee,"createContextScope");function te(...e){const t=e[0];if(e.length===1)return t;const n=w(()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return w(function(s){const i=o.reduce((u,{useScope:a,scopeName:f})=>{const l=a(s)[`__scope${f}`];return{...u,...l}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}w(te,"composeContextScopes");var z=globalThis?.document?c.useLayoutEffect:()=>{},Pe=Object.defineProperty,Re=(e,t)=>Pe(e,"name",{value:t,configurable:!0}),Y=O[" useEffectEvent ".trim().toString()],G=O[" useInsertionEffect ".trim().toString()];function ne(e){if(typeof Y=="function")return Y(e);const t=c.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof G=="function"?G(()=>{t.current=e}):z(()=>{t.current=e}),c.useMemo(()=>(...n)=>t.current?.(...n),[])}Re(ne,"useEffectEvent");var ke=Object.defineProperty,k=(e,t)=>ke(e,"name",{value:t,configurable:!0}),Ie=O[" useInsertionEffect ".trim().toString()]||z;function re({prop:e,defaultProp:t,onChange:n=k(()=>{},"onChange"),caller:o}){const[r,s,i]=oe({defaultProp:t,onChange:n}),u=e!==void 0,a=u?e:r,f=c.useCallback(p=>{if(u){const l=ce(p)?p(e):p;l!==e&&i.current?.(l)}else s(p)},[u,e,s,i]);return[a,f]}k(re,"useControllableState");function oe({defaultProp:e,onChange:t}){const[n,o]=c.useState(e),r=c.useRef(n),s=c.useRef(t);return Ie(()=>{s.current=t},[t]),c.useEffect(()=>{r.current!==n&&(s.current?.(n),r.current=n)},[n,r]),[n,o,s]}k(oe,"useUncontrolledState");function ce(e){return typeof e=="function"}k(ce,"isFunction");var X=Symbol("RADIX:SYNC_STATE");function $e(e,t,n,o){const{prop:r,defaultProp:s,onChange:i,caller:u}=t,a=r!==void 0,f=ne(i),p=[{...n,state:s}];o&&p.push(o);const[l,m]=c.useReducer((b,C)=>{if(C.type===X)return{...b,state:C.state};const _=e(b,C);return a&&!Object.is(_.state,b.state)&&f(_.state),_},...p),d=l.state,h=c.useRef(d);c.useEffect(()=>{h.current!==d&&(h.current=d,a||f(d))},[d,h,a]);const S=c.useMemo(()=>r!==void 0?{...l,state:r}:l,[l,r]);return c.useEffect(()=>{a&&!Object.is(r,l.state)&&m({type:X,state:r})},[r,l.state,a]),[S,m]}k($e,"useControllableStateReducer");var je=Object.defineProperty,Oe=(e,t)=>je(e,"name",{value:t,configurable:!0});function se(e){const[t,n]=c.useState(void 0);return z(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let i,u;if("borderBoxSize"in s){const a=s.borderBoxSize,f=Array.isArray(a)?a[0]:a;i=f.inlineSize,u=f.blockSize}else i=e.offsetWidth,u=e.offsetHeight;n({width:i,height:u})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}Oe(se,"useSize");var Te=Object.defineProperty,E=(e,t)=>Te(e,"name",{value:t,configurable:!0});function ie(e){const t=c.forwardRef((n,o)=>{let{children:r,...s}=n,i=null,u=!1;const a=[];D(r)&&typeof j=="function"&&(r=j(r._payload)),c.Children.forEach(r,m=>{if(fe(m)){u=!0;const d=m;let h="child"in d.props?d.props.child:d.props.children;D(h)&&typeof j=="function"&&(h=j(h._payload)),i=Ae(d,h),a.push(i?.props?.children)}else a.push(m)}),i?i=c.cloneElement(i,void 0,a):!u&&c.Children.count(r)===1&&c.isValidElement(r)&&(i=r);const f=i?le(i):void 0,p=T(o,f);if(!i){if(r||r===0)throw new Error(u?Me(e):Be(e));return r}const l=ue(s,i.props??{});return i.type!==c.Fragment&&(l.ref=o?p:f),c.cloneElement(i,l)});return t.displayName=`${e}.Slot`,t}E(ie,"createSlot");var ae=Symbol.for("radix.slottable");function Ne(e){const t=E(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=ae,t}E(Ne,"createSlottable");var Ae=E((e,t)=>{if("child"in e.props){const n=e.props.child;return c.isValidElement(n)?c.cloneElement(n,void 0,e.props.children(n.props.children)):null}return c.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function ue(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...u)=>{const a=s(...u);return r(...u),a}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}E(ue,"mergeProps");function le(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}E(le,"getElementRef");function fe(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ae}E(fe,"isSlottable");var De=Symbol.for("react.lazy");function D(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===De&&"_payload"in e&&de(e._payload)}E(D,"isLazyComponent");function de(e){return typeof e=="object"&&e!==null&&"then"in e}E(de,"isPromiseLike");var Be=E(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Me=E(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),j=O[" use ".trim().toString()],ze=Object.defineProperty,Fe=(e,t)=>ze(e,"name",{value:t,configurable:!0}),Le=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],F=Le.reduce((e,t)=>{const n=ie(`Primitive.${t}`),o=c.forwardRef((r,s)=>{const{asChild:i,...u}=r,a=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(a,{...u,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function Ue(e,t){e&&we.flushSync(()=>e.dispatchEvent(t))}Fe(Ue,"dispatchDiscreteCustomEvent");var He=Object.defineProperty,x=(e,t)=>He(e,"name",{value:t,configurable:!0}),L="Switch",[We,tt]=ee(L),[Ve,U]=We(L);function pe(e){const{__scopeSwitch:t,checked:n,children:o,defaultChecked:r,disabled:s,form:i,name:u,onCheckedChange:a,required:f,value:p="on",internal_do_not_use_render:l}=e,[m,d]=re({prop:n,defaultProp:r??!1,onChange:a,caller:L}),[h,S]=c.useState(null),[b,C]=c.useState(null),_=c.useRef(!1),[g,y]=c.useReducer(P=>P+1,0),I=h?!!i||!!h.closest("form"):!0,$={checked:m,setChecked:d,disabled:s,control:h,setControl:S,name:u,form:i,value:p,hasConsumerStoppedPropagationRef:_,userInteractionCount:g,onUserInteraction:y,required:f,defaultChecked:r,isFormControl:I,bubbleInput:b,setBubbleInput:C};return v.jsx(Ve,{scope:t,...$,children:me(l)?l($):o})}x(pe,"SwitchProvider");var qe="SwitchTrigger",Ye=c.forwardRef(x(function({__scopeSwitch:t,onClick:n,...o},r){const{control:s,form:i,value:u,disabled:a,checked:f,required:p,setControl:l,setChecked:m,hasConsumerStoppedPropagationRef:d,onUserInteraction:h,isFormControl:S,bubbleInput:b}=U(qe,t),C=T(r,l),_=c.useRef(f);return c.useEffect(()=>{const g=i?s?.ownerDocument.getElementById(i):s?.form;if(g instanceof HTMLFormElement){const y=x(()=>m(_.current),"reset");return g.addEventListener("reset",y),()=>g.removeEventListener("reset",y)}},[s,i,m]),v.jsx(F.button,{type:"button",role:"switch","aria-checked":f,"aria-required":p,"data-state":H(f),"data-disabled":a?"":void 0,disabled:a,value:u,...o,ref:C,onClick:B(n,g=>{h(),m(y=>!y),b&&S&&(d.current=g.isPropagationStopped(),d.current||g.stopPropagation())})})},"SwitchTrigger")),he=c.forwardRef(x(function(t,n){const{__scopeSwitch:o,name:r,checked:s,defaultChecked:i,required:u,disabled:a,value:f,onCheckedChange:p,form:l,...m}=t;return v.jsx(pe,{__scopeSwitch:o,checked:s,defaultChecked:i,disabled:a,required:u,onCheckedChange:p,name:r,form:l,value:f,internal_do_not_use_render:({isFormControl:d})=>v.jsxs(v.Fragment,{children:[v.jsx(Ye,{...m,ref:n,__scopeSwitch:o}),d&&v.jsx(Je,{__scopeSwitch:o})]})})},"Switch")),Ge="SwitchThumb",Xe=c.forwardRef(x(function(t,n){const{__scopeSwitch:o,...r}=t,s=U(Ge,o);return v.jsx(F.span,{"data-state":H(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:n})},"SwitchThumb")),Ze="SwitchBubbleInput",Je=c.forwardRef(x(function({__scopeSwitch:t,onClick:n,...o},r){const{control:s,hasConsumerStoppedPropagationRef:i,userInteractionCount:u,checked:a,defaultChecked:f,required:p,disabled:l,name:m,value:d,form:h,bubbleInput:S,setBubbleInput:b}=U(Ze,t),C=T(r,b),_=se(s),g=c.useRef(!1),y=c.useRef(a),I=c.useRef(u);c.useEffect(()=>{const P=S;if(!P)return;const be=window.HTMLInputElement.prototype,W=Object.getOwnPropertyDescriptor(be,"checked").set,V=u!==I.current;I.current=u;const ve=y.current!==a;y.current=a;const Se=!(V&&i.current);if(ve&&W){g.current=!V;const ge=new Event("click",{bubbles:Se});W.call(P,a),P.dispatchEvent(ge),g.current=!1}},[S,a,i,u]);const $=c.useRef(a);return v.jsx(F.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??$.current,required:p,disabled:l,name:m,value:d,form:h,...o,tabIndex:-1,ref:C,onClick:B(n,P=>{g.current&&P.stopPropagation()}),style:{...o.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function me(e){return typeof e=="function"}x(me,"isFunction");function H(e){return e?"checked":"unchecked"}x(H,"getState");const Ke=c.forwardRef(({className:e,...t},n)=>v.jsx(he,{ref:n,className:q("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-border transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-bg-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:v.jsx(Xe,{className:q("pointer-events-none block h-4 w-4 rounded-full bg-foreground shadow-lg transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0.5")})}));Ke.displayName=he.displayName;export{Ke as S};
|
|
2
|
-
//# sourceMappingURL=switch-
|
|
1
|
+
import{r as c,j as v,U as O,V as we,k as q}from"./index-GPHRnEN7.js";var Ee=Object.defineProperty,R=(e,t)=>Ee(e,"name",{value:t,configurable:!0}),Z=!!(typeof window<"u"&&window.document&&window.document.createElement);function B(e,t,{checkForDefaultPrevented:n=!0}={}){return R(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},"handleEvent")}R(B,"composeEventHandlers");function Ce(e){if(!Z)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}R(Ce,"getOwnerWindow");function N(e){if(!Z)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}R(N,"getOwnerDocument");function J(e,t=!1){const{activeElement:n}=N(e);if(!n?.nodeName)return null;if(K(n)&&n.contentDocument)return J(n.contentDocument.body,t);if(t){const o=n.getAttribute("aria-activedescendant");if(o){const r=N(n).getElementById(o);if(r)return r}}return n}R(J,"getActiveElement");function K(e){return e.tagName==="IFRAME"}R(K,"isFrame");var _e=Object.defineProperty,M=(e,t)=>_e(e,"name",{value:t,configurable:!0});function A(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}M(A,"setRef");function Q(...e){return t=>{let n=!1;const o=e.map(r=>{const s=A(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r<o.length;r++){const s=o[r];typeof s=="function"?s():A(e[r],null)}}}}M(Q,"composeRefs");function T(...e){return c.useCallback(Q(...e),e)}M(T,"useComposedRefs");var ye=Object.defineProperty,w=(e,t)=>ye(e,"name",{value:t,configurable:!0});function xe(e,t){const n=c.createContext(t);n.displayName=e+"Context";const o=w(s=>{const{children:i,...u}=s,a=c.useMemo(()=>u,Object.values(u));return v.jsx(n.Provider,{value:a,children:i})},"Provider");o.displayName=e+"Provider";function r(s,i={}){const{optional:u=!1}=i,a=c.useContext(n);if(a)return a;if(t!==void 0)return t;if(!u)throw new Error(`\`${s}\` must be used within \`${e}\``)}return w(r,"useContext"),[o,r]}w(xe,"createContext");function ee(e,t=[]){let n=[];function o(s,i){const u=c.createContext(i);u.displayName=s+"Context";const a=n.length;n=[...n,i];const f=w(l=>{const{scope:m,children:d,...h}=l,S=m?.[e]?.[a]||u,b=c.useMemo(()=>h,Object.values(h));return v.jsx(S.Provider,{value:b,children:d})},"Provider");f.displayName=s+"Provider";function p(l,m,d={}){const{optional:h=!1}=d,S=m?.[e]?.[a]||u,b=c.useContext(S);if(b)return b;if(i!==void 0)return i;if(!h)throw new Error(`\`${l}\` must be used within \`${s}\``)}return w(p,"useContext"),[f,p]}w(o,"createContext");const r=w(()=>{const s=n.map(i=>c.createContext(i));return w(function(u){const a=u?.[e]||s;return c.useMemo(()=>({[`__scope${e}`]:{...u,[e]:a}}),[u,a])},"useScope")},"createScope");return r.scopeName=e,[o,te(r,...t)]}w(ee,"createContextScope");function te(...e){const t=e[0];if(e.length===1)return t;const n=w(()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return w(function(s){const i=o.reduce((u,{useScope:a,scopeName:f})=>{const l=a(s)[`__scope${f}`];return{...u,...l}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}w(te,"composeContextScopes");var z=globalThis?.document?c.useLayoutEffect:()=>{},Pe=Object.defineProperty,Re=(e,t)=>Pe(e,"name",{value:t,configurable:!0}),Y=O[" useEffectEvent ".trim().toString()],G=O[" useInsertionEffect ".trim().toString()];function ne(e){if(typeof Y=="function")return Y(e);const t=c.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof G=="function"?G(()=>{t.current=e}):z(()=>{t.current=e}),c.useMemo(()=>(...n)=>t.current?.(...n),[])}Re(ne,"useEffectEvent");var ke=Object.defineProperty,k=(e,t)=>ke(e,"name",{value:t,configurable:!0}),Ie=O[" useInsertionEffect ".trim().toString()]||z;function re({prop:e,defaultProp:t,onChange:n=k(()=>{},"onChange"),caller:o}){const[r,s,i]=oe({defaultProp:t,onChange:n}),u=e!==void 0,a=u?e:r,f=c.useCallback(p=>{if(u){const l=ce(p)?p(e):p;l!==e&&i.current?.(l)}else s(p)},[u,e,s,i]);return[a,f]}k(re,"useControllableState");function oe({defaultProp:e,onChange:t}){const[n,o]=c.useState(e),r=c.useRef(n),s=c.useRef(t);return Ie(()=>{s.current=t},[t]),c.useEffect(()=>{r.current!==n&&(s.current?.(n),r.current=n)},[n,r]),[n,o,s]}k(oe,"useUncontrolledState");function ce(e){return typeof e=="function"}k(ce,"isFunction");var X=Symbol("RADIX:SYNC_STATE");function $e(e,t,n,o){const{prop:r,defaultProp:s,onChange:i,caller:u}=t,a=r!==void 0,f=ne(i),p=[{...n,state:s}];o&&p.push(o);const[l,m]=c.useReducer((b,C)=>{if(C.type===X)return{...b,state:C.state};const _=e(b,C);return a&&!Object.is(_.state,b.state)&&f(_.state),_},...p),d=l.state,h=c.useRef(d);c.useEffect(()=>{h.current!==d&&(h.current=d,a||f(d))},[d,h,a]);const S=c.useMemo(()=>r!==void 0?{...l,state:r}:l,[l,r]);return c.useEffect(()=>{a&&!Object.is(r,l.state)&&m({type:X,state:r})},[r,l.state,a]),[S,m]}k($e,"useControllableStateReducer");var je=Object.defineProperty,Oe=(e,t)=>je(e,"name",{value:t,configurable:!0});function se(e){const[t,n]=c.useState(void 0);return z(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let i,u;if("borderBoxSize"in s){const a=s.borderBoxSize,f=Array.isArray(a)?a[0]:a;i=f.inlineSize,u=f.blockSize}else i=e.offsetWidth,u=e.offsetHeight;n({width:i,height:u})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}Oe(se,"useSize");var Te=Object.defineProperty,E=(e,t)=>Te(e,"name",{value:t,configurable:!0});function ie(e){const t=c.forwardRef((n,o)=>{let{children:r,...s}=n,i=null,u=!1;const a=[];D(r)&&typeof j=="function"&&(r=j(r._payload)),c.Children.forEach(r,m=>{if(fe(m)){u=!0;const d=m;let h="child"in d.props?d.props.child:d.props.children;D(h)&&typeof j=="function"&&(h=j(h._payload)),i=Ae(d,h),a.push(i?.props?.children)}else a.push(m)}),i?i=c.cloneElement(i,void 0,a):!u&&c.Children.count(r)===1&&c.isValidElement(r)&&(i=r);const f=i?le(i):void 0,p=T(o,f);if(!i){if(r||r===0)throw new Error(u?Me(e):Be(e));return r}const l=ue(s,i.props??{});return i.type!==c.Fragment&&(l.ref=o?p:f),c.cloneElement(i,l)});return t.displayName=`${e}.Slot`,t}E(ie,"createSlot");var ae=Symbol.for("radix.slottable");function Ne(e){const t=E(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=ae,t}E(Ne,"createSlottable");var Ae=E((e,t)=>{if("child"in e.props){const n=e.props.child;return c.isValidElement(n)?c.cloneElement(n,void 0,e.props.children(n.props.children)):null}return c.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function ue(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...u)=>{const a=s(...u);return r(...u),a}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}E(ue,"mergeProps");function le(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}E(le,"getElementRef");function fe(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ae}E(fe,"isSlottable");var De=Symbol.for("react.lazy");function D(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===De&&"_payload"in e&&de(e._payload)}E(D,"isLazyComponent");function de(e){return typeof e=="object"&&e!==null&&"then"in e}E(de,"isPromiseLike");var Be=E(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Me=E(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),j=O[" use ".trim().toString()],ze=Object.defineProperty,Fe=(e,t)=>ze(e,"name",{value:t,configurable:!0}),Le=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],F=Le.reduce((e,t)=>{const n=ie(`Primitive.${t}`),o=c.forwardRef((r,s)=>{const{asChild:i,...u}=r,a=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(a,{...u,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function Ue(e,t){e&&we.flushSync(()=>e.dispatchEvent(t))}Fe(Ue,"dispatchDiscreteCustomEvent");var He=Object.defineProperty,x=(e,t)=>He(e,"name",{value:t,configurable:!0}),L="Switch",[We,tt]=ee(L),[Ve,U]=We(L);function pe(e){const{__scopeSwitch:t,checked:n,children:o,defaultChecked:r,disabled:s,form:i,name:u,onCheckedChange:a,required:f,value:p="on",internal_do_not_use_render:l}=e,[m,d]=re({prop:n,defaultProp:r??!1,onChange:a,caller:L}),[h,S]=c.useState(null),[b,C]=c.useState(null),_=c.useRef(!1),[g,y]=c.useReducer(P=>P+1,0),I=h?!!i||!!h.closest("form"):!0,$={checked:m,setChecked:d,disabled:s,control:h,setControl:S,name:u,form:i,value:p,hasConsumerStoppedPropagationRef:_,userInteractionCount:g,onUserInteraction:y,required:f,defaultChecked:r,isFormControl:I,bubbleInput:b,setBubbleInput:C};return v.jsx(Ve,{scope:t,...$,children:me(l)?l($):o})}x(pe,"SwitchProvider");var qe="SwitchTrigger",Ye=c.forwardRef(x(function({__scopeSwitch:t,onClick:n,...o},r){const{control:s,form:i,value:u,disabled:a,checked:f,required:p,setControl:l,setChecked:m,hasConsumerStoppedPropagationRef:d,onUserInteraction:h,isFormControl:S,bubbleInput:b}=U(qe,t),C=T(r,l),_=c.useRef(f);return c.useEffect(()=>{const g=i?s?.ownerDocument.getElementById(i):s?.form;if(g instanceof HTMLFormElement){const y=x(()=>m(_.current),"reset");return g.addEventListener("reset",y),()=>g.removeEventListener("reset",y)}},[s,i,m]),v.jsx(F.button,{type:"button",role:"switch","aria-checked":f,"aria-required":p,"data-state":H(f),"data-disabled":a?"":void 0,disabled:a,value:u,...o,ref:C,onClick:B(n,g=>{h(),m(y=>!y),b&&S&&(d.current=g.isPropagationStopped(),d.current||g.stopPropagation())})})},"SwitchTrigger")),he=c.forwardRef(x(function(t,n){const{__scopeSwitch:o,name:r,checked:s,defaultChecked:i,required:u,disabled:a,value:f,onCheckedChange:p,form:l,...m}=t;return v.jsx(pe,{__scopeSwitch:o,checked:s,defaultChecked:i,disabled:a,required:u,onCheckedChange:p,name:r,form:l,value:f,internal_do_not_use_render:({isFormControl:d})=>v.jsxs(v.Fragment,{children:[v.jsx(Ye,{...m,ref:n,__scopeSwitch:o}),d&&v.jsx(Je,{__scopeSwitch:o})]})})},"Switch")),Ge="SwitchThumb",Xe=c.forwardRef(x(function(t,n){const{__scopeSwitch:o,...r}=t,s=U(Ge,o);return v.jsx(F.span,{"data-state":H(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:n})},"SwitchThumb")),Ze="SwitchBubbleInput",Je=c.forwardRef(x(function({__scopeSwitch:t,onClick:n,...o},r){const{control:s,hasConsumerStoppedPropagationRef:i,userInteractionCount:u,checked:a,defaultChecked:f,required:p,disabled:l,name:m,value:d,form:h,bubbleInput:S,setBubbleInput:b}=U(Ze,t),C=T(r,b),_=se(s),g=c.useRef(!1),y=c.useRef(a),I=c.useRef(u);c.useEffect(()=>{const P=S;if(!P)return;const be=window.HTMLInputElement.prototype,W=Object.getOwnPropertyDescriptor(be,"checked").set,V=u!==I.current;I.current=u;const ve=y.current!==a;y.current=a;const Se=!(V&&i.current);if(ve&&W){g.current=!V;const ge=new Event("click",{bubbles:Se});W.call(P,a),P.dispatchEvent(ge),g.current=!1}},[S,a,i,u]);const $=c.useRef(a);return v.jsx(F.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??$.current,required:p,disabled:l,name:m,value:d,form:h,...o,tabIndex:-1,ref:C,onClick:B(n,P=>{g.current&&P.stopPropagation()}),style:{...o.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function me(e){return typeof e=="function"}x(me,"isFunction");function H(e){return e?"checked":"unchecked"}x(H,"getState");const Ke=c.forwardRef(({className:e,...t},n)=>v.jsx(he,{ref:n,className:q("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-border transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-bg-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:v.jsx(Xe,{className:q("pointer-events-none block h-4 w-4 rounded-full bg-foreground shadow-lg transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0.5")})}));Ke.displayName=he.displayName;export{Ke as S};
|
|
2
|
+
//# sourceMappingURL=switch-CY5Gwj1o.js.map
|
package/extensions/dashboard-client/dist/assets/{switch-CcdXX0Zm.js.map → switch-CY5Gwj1o.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch-CcdXX0Zm.js","sources":["../../node_modules/@radix-ui/primitive/dist/index.mjs","../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../node_modules/@radix-ui/react-context/dist/index.mjs","../../node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs","../../node_modules/@radix-ui/react-use-effect-event/dist/index.mjs","../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs","../../node_modules/@radix-ui/react-use-size/dist/index.mjs","../../node_modules/@radix-ui/react-slot/dist/index.mjs","../../node_modules/@radix-ui/react-primitive/dist/index.mjs","../../node_modules/@radix-ui/react-switch/dist/index.mjs","../../src/components/ui/switch.tsx"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/primitive.tsx\nvar canUseDOM = !!(typeof window !== \"undefined\" && window.document && window.document.createElement);\nfunction composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {\n return /* @__PURE__ */ __name(function handleEvent(event) {\n originalEventHandler?.(event);\n if (checkForDefaultPrevented === false || !event || !event.defaultPrevented) {\n return ourEventHandler?.(event);\n }\n }, \"handleEvent\");\n}\n__name(composeEventHandlers, \"composeEventHandlers\");\nfunction getOwnerWindow(element) {\n if (!canUseDOM) {\n throw new Error(\"Cannot access window outside of the DOM\");\n }\n return element?.ownerDocument?.defaultView ?? window;\n}\n__name(getOwnerWindow, \"getOwnerWindow\");\nfunction getOwnerDocument(element) {\n if (!canUseDOM) {\n throw new Error(\"Cannot access document outside of the DOM\");\n }\n return element?.ownerDocument ?? document;\n}\n__name(getOwnerDocument, \"getOwnerDocument\");\nfunction getActiveElement(node, activeDescendant = false) {\n const { activeElement } = getOwnerDocument(node);\n if (!activeElement?.nodeName) {\n return null;\n }\n if (isFrame(activeElement) && activeElement.contentDocument) {\n return getActiveElement(activeElement.contentDocument.body, activeDescendant);\n }\n if (activeDescendant) {\n const id = activeElement.getAttribute(\"aria-activedescendant\");\n if (id) {\n const element = getOwnerDocument(activeElement).getElementById(id);\n if (element) {\n return element;\n }\n }\n }\n return activeElement;\n}\n__name(getActiveElement, \"getActiveElement\");\nfunction isFrame(element) {\n return element.tagName === \"IFRAME\";\n}\n__name(isFrame, \"isFrame\");\nexport {\n canUseDOM,\n composeEventHandlers,\n getActiveElement,\n getOwnerDocument,\n getOwnerWindow,\n isFrame\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/compose-refs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\n__name(setRef, \"setRef\");\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == \"function\") {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n__name(composeRefs, \"composeRefs\");\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\n__name(useComposedRefs, \"useComposedRefs\");\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/create-context.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\n// @__NO_SIDE_EFFECTS__\nfunction createContext2(rootComponentName, defaultContext) {\n const Context = React.createContext(defaultContext);\n Context.displayName = rootComponentName + \"Context\";\n const Provider = /* @__PURE__ */ __name((props) => {\n const { children, ...context } = props;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n }, \"Provider\");\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName, options = {}) {\n const { optional = false } = options;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n if (optional) return void 0;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n __name(useContext2, \"useContext\");\n return [Provider, useContext2];\n}\n__name(createContext2, \"createContext\");\n// @__NO_SIDE_EFFECTS__\nfunction createContextScope(scopeName, createContextScopeDeps = []) {\n let defaultContexts = [];\n function createContext3(rootComponentName, defaultContext) {\n const BaseContext = React.createContext(defaultContext);\n BaseContext.displayName = rootComponentName + \"Context\";\n const index = defaultContexts.length;\n defaultContexts = [...defaultContexts, defaultContext];\n const Provider = /* @__PURE__ */ __name((props) => {\n const { scope, children, ...context } = props;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n }, \"Provider\");\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName, scope, options = {}) {\n const { optional = false } = options;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n if (optional) return void 0;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n __name(useContext2, \"useContext\");\n return [Provider, useContext2];\n }\n __name(createContext3, \"createContext\");\n const createScope = /* @__PURE__ */ __name(() => {\n const scopeContexts = defaultContexts.map((defaultContext) => {\n return React.createContext(defaultContext);\n });\n return /* @__PURE__ */ __name(function useScope(scope) {\n const contexts = scope?.[scopeName] || scopeContexts;\n return React.useMemo(\n () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),\n [scope, contexts]\n );\n }, \"useScope\");\n }, \"createScope\");\n createScope.scopeName = scopeName;\n return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];\n}\n__name(createContextScope, \"createContextScope\");\nfunction composeContextScopes(...scopes) {\n const baseScope = scopes[0];\n if (scopes.length === 1) return baseScope;\n const createScope = /* @__PURE__ */ __name(() => {\n const scopeHooks = scopes.map((createScope2) => ({\n useScope: createScope2(),\n scopeName: createScope2.scopeName\n }));\n return /* @__PURE__ */ __name(function useComposedScopes(overrideScopes) {\n const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {\n const scopeProps = useScope(overrideScopes);\n const currentScope = scopeProps[`__scope${scopeName}`];\n return { ...nextScopes2, ...currentScope };\n }, {});\n return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);\n }, \"useComposedScopes\");\n }, \"createScope\");\n createScope.scopeName = baseScope.scopeName;\n return createScope;\n}\n__name(composeContextScopes, \"composeContextScopes\");\nexport {\n createContext2 as createContext,\n createContextScope\n};\n//# sourceMappingURL=index.mjs.map\n","// src/use-layout-effect.tsx\nimport * as React from \"react\";\nvar useLayoutEffect2 = globalThis?.document ? React.useLayoutEffect : () => {\n};\nexport {\n useLayoutEffect2 as useLayoutEffect\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/use-effect-event.tsx\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nimport * as React from \"react\";\nvar useReactEffectEvent = React[\" useEffectEvent \".trim().toString()];\nvar useReactInsertionEffect = React[\" useInsertionEffect \".trim().toString()];\nfunction useEffectEvent(callback) {\n if (typeof useReactEffectEvent === \"function\") {\n return useReactEffectEvent(callback);\n }\n const ref = React.useRef(() => {\n throw new Error(\"Cannot call an event handler while rendering.\");\n });\n if (typeof useReactInsertionEffect === \"function\") {\n useReactInsertionEffect(() => {\n ref.current = callback;\n });\n } else {\n useLayoutEffect(() => {\n ref.current = callback;\n });\n }\n return React.useMemo(() => ((...args) => ref.current?.(...args)), []);\n}\n__name(useEffectEvent, \"useEffectEvent\");\nexport {\n useEffectEvent\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/use-controllable-state.tsx\nimport * as React from \"react\";\nimport { IS_DEVELOPMENT } from \"@radix-ui/primitive/is-development\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nvar useInsertionEffect = React[\" useInsertionEffect \".trim().toString()] || useLayoutEffect;\nfunction useControllableState({\n prop,\n defaultProp,\n onChange = /* @__PURE__ */ __name(() => {\n }, \"onChange\"),\n caller\n}) {\n const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({\n defaultProp,\n onChange\n });\n const isControlled = prop !== void 0;\n const value = isControlled ? prop : uncontrolledProp;\n if (IS_DEVELOPMENT) {\n const isControlledRef = React.useRef(prop !== void 0);\n React.useEffect(() => {\n const wasControlled = isControlledRef.current;\n if (wasControlled !== isControlled) {\n const from = wasControlled ? \"controlled\" : \"uncontrolled\";\n const to = isControlled ? \"controlled\" : \"uncontrolled\";\n console.warn(\n `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`\n );\n }\n isControlledRef.current = isControlled;\n }, [isControlled, caller]);\n }\n const setValue = React.useCallback(\n (nextValue) => {\n if (isControlled) {\n const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;\n if (value2 !== prop) {\n onChangeRef.current?.(value2);\n }\n } else {\n setUncontrolledProp(nextValue);\n }\n },\n [isControlled, prop, setUncontrolledProp, onChangeRef]\n );\n return [value, setValue];\n}\n__name(useControllableState, \"useControllableState\");\nfunction useUncontrolledState({\n defaultProp,\n onChange\n}) {\n const [value, setValue] = React.useState(defaultProp);\n const prevValueRef = React.useRef(value);\n const onChangeRef = React.useRef(onChange);\n useInsertionEffect(() => {\n onChangeRef.current = onChange;\n }, [onChange]);\n React.useEffect(() => {\n if (prevValueRef.current !== value) {\n onChangeRef.current?.(value);\n prevValueRef.current = value;\n }\n }, [value, prevValueRef]);\n return [value, setValue, onChangeRef];\n}\n__name(useUncontrolledState, \"useUncontrolledState\");\nfunction isFunction(value) {\n return typeof value === \"function\";\n}\n__name(isFunction, \"isFunction\");\n\n// src/use-controllable-state-reducer.tsx\nimport * as React2 from \"react\";\nimport { IS_DEVELOPMENT as IS_DEVELOPMENT2 } from \"@radix-ui/primitive/is-development\";\nimport { useEffectEvent } from \"@radix-ui/react-use-effect-event\";\nvar SYNC_STATE = Symbol(\"RADIX:SYNC_STATE\");\nfunction useControllableStateReducer(reducer, userArgs, initialArg, init) {\n const { prop: controlledState, defaultProp, onChange: onChangeProp, caller } = userArgs;\n const isControlled = controlledState !== void 0;\n const onChange = useEffectEvent(onChangeProp);\n if (IS_DEVELOPMENT2) {\n const isControlledRef = React2.useRef(controlledState !== void 0);\n React2.useEffect(() => {\n const wasControlled = isControlledRef.current;\n if (wasControlled !== isControlled) {\n const from = wasControlled ? \"controlled\" : \"uncontrolled\";\n const to = isControlled ? \"controlled\" : \"uncontrolled\";\n console.warn(\n `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`\n );\n }\n isControlledRef.current = isControlled;\n }, [isControlled, caller]);\n }\n const args = [{ ...initialArg, state: defaultProp }];\n if (init) {\n args.push(init);\n }\n const [internalState, dispatch] = React2.useReducer(\n (state2, action) => {\n if (action.type === SYNC_STATE) {\n return { ...state2, state: action.state };\n }\n const next = reducer(state2, action);\n if (isControlled && !Object.is(next.state, state2.state)) {\n onChange(next.state);\n }\n return next;\n },\n ...args\n );\n const uncontrolledState = internalState.state;\n const prevValueRef = React2.useRef(uncontrolledState);\n React2.useEffect(() => {\n if (prevValueRef.current !== uncontrolledState) {\n prevValueRef.current = uncontrolledState;\n if (!isControlled) {\n onChange(uncontrolledState);\n }\n }\n }, [uncontrolledState, prevValueRef, isControlled]);\n const state = React2.useMemo(() => {\n const isControlled2 = controlledState !== void 0;\n if (isControlled2) {\n return { ...internalState, state: controlledState };\n }\n return internalState;\n }, [internalState, controlledState]);\n React2.useEffect(() => {\n if (isControlled && !Object.is(controlledState, internalState.state)) {\n dispatch({ type: SYNC_STATE, state: controlledState });\n }\n }, [controlledState, internalState.state, isControlled]);\n return [state, dispatch];\n}\n__name(useControllableStateReducer, \"useControllableStateReducer\");\nexport {\n useControllableState,\n useControllableStateReducer\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/use-size.tsx\nimport * as React from \"react\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nfunction useSize(element) {\n const [size, setSize] = React.useState(void 0);\n useLayoutEffect(() => {\n if (element) {\n setSize({ width: element.offsetWidth, height: element.offsetHeight });\n const resizeObserver = new ResizeObserver((entries) => {\n if (!Array.isArray(entries)) {\n return;\n }\n if (!entries.length) {\n return;\n }\n const entry = entries[0];\n let width;\n let height;\n if (\"borderBoxSize\" in entry) {\n const borderSizeEntry = entry[\"borderBoxSize\"];\n const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;\n width = borderSize[\"inlineSize\"];\n height = borderSize[\"blockSize\"];\n } else {\n width = element.offsetWidth;\n height = element.offsetHeight;\n }\n setSize({ width, height });\n });\n resizeObserver.observe(element, { box: \"border-box\" });\n return () => resizeObserver.unobserve(element);\n } else {\n setSize(void 0);\n }\n }, [element]);\n return size;\n}\n__name(useSize, \"useSize\");\nexport {\n useSize\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/slot.tsx\nimport * as React from \"react\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\n// @__NO_SIDE_EFFECTS__\nfunction createSlot(ownerName) {\n const Slot2 = React.forwardRef((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n let slottableElement = null;\n let hasSlottable = false;\n const newChildren = [];\n if (isLazyComponent(children) && typeof use === \"function\") {\n children = use(children._payload);\n }\n React.Children.forEach(children, (maybeSlottable) => {\n if (isSlottable(maybeSlottable)) {\n hasSlottable = true;\n const slottable = maybeSlottable;\n let child = \"child\" in slottable.props ? slottable.props.child : slottable.props.children;\n if (isLazyComponent(child) && typeof use === \"function\") {\n child = use(child._payload);\n }\n slottableElement = getSlottableElementFromSlottable(slottable, child);\n newChildren.push(slottableElement?.props?.children);\n } else {\n newChildren.push(maybeSlottable);\n }\n });\n if (slottableElement) {\n slottableElement = React.cloneElement(slottableElement, void 0, newChildren);\n } else if (\n // A `Slottable` was found but it didn't resolve to a single element (e.g.\n // it wrapped multiple elements, text, or a render-prop `child` that\n // wasn't an element). Don't fall back to treating the `Slottable` wrapper\n // itself as the slot target — throw a descriptive error below instead.\n !hasSlottable && React.Children.count(children) === 1 && React.isValidElement(children)\n ) {\n slottableElement = children;\n }\n const slottableElementRef = slottableElement ? getElementRef(slottableElement) : void 0;\n const composedRef = useComposedRefs(forwardedRef, slottableElementRef);\n if (!slottableElement) {\n if (children || children === 0) {\n throw new Error(\n hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName)\n );\n }\n return children;\n }\n const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});\n if (slottableElement.type !== React.Fragment) {\n mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;\n }\n return React.cloneElement(slottableElement, mergedProps);\n });\n Slot2.displayName = `${ownerName}.Slot`;\n return Slot2;\n}\n__name(createSlot, \"createSlot\");\nvar Slot = /* @__PURE__ */ createSlot(\"Slot\");\nvar SLOTTABLE_IDENTIFIER = Symbol.for(\"radix.slottable\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlottable(ownerName) {\n const Slottable2 = /* @__PURE__ */ __name((props) => \"child\" in props ? props.children(props.child) : props.children, \"Slottable\");\n Slottable2.displayName = `${ownerName}.Slottable`;\n Slottable2.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable2;\n}\n__name(createSlottable, \"createSlottable\");\nvar Slottable = /* @__PURE__ */ createSlottable(\"Slottable\");\nvar getSlottableElementFromSlottable = /* @__PURE__ */ __name((slottable, child) => {\n if (\"child\" in slottable.props) {\n const child2 = slottable.props.child;\n if (!React.isValidElement(child2)) return null;\n return React.cloneElement(child2, void 0, slottable.props.children(child2.props.children));\n }\n return React.isValidElement(child) ? child : null;\n}, \"getSlottableElementFromSlottable\");\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\n__name(mergeProps, \"mergeProps\");\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\n__name(getElementRef, \"getElementRef\");\nfunction isSlottable(child) {\n return React.isValidElement(child) && typeof child.type === \"function\" && \"__radixId\" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;\n}\n__name(isSlottable, \"isSlottable\");\nvar REACT_LAZY_TYPE = Symbol.for(\"react.lazy\");\nfunction isLazyComponent(element) {\n return element != null && typeof element === \"object\" && \"$$typeof\" in element && element.$$typeof === REACT_LAZY_TYPE && \"_payload\" in element && isPromiseLike(element._payload);\n}\n__name(isLazyComponent, \"isLazyComponent\");\nfunction isPromiseLike(value) {\n return typeof value === \"object\" && value !== null && \"then\" in value;\n}\n__name(isPromiseLike, \"isPromiseLike\");\nvar createSlotError = /* @__PURE__ */ __name((ownerName) => {\n return `${ownerName} failed to slot onto its children. Expected a single React element child or \\`Slottable\\`.`;\n}, \"createSlotError\");\nvar createSlottableError = /* @__PURE__ */ __name((ownerName) => {\n return `${ownerName} failed to slot onto its \\`Slottable\\`. Expected \\`Slottable\\` to receive a single React element child.`;\n}, \"createSlottableError\");\nvar use = React[\" use \".trim().toString()];\nexport {\n Slot as Root,\n Slot,\n Slottable,\n createSlot,\n createSlottable\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/primitive.tsx\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"select\",\n \"span\",\n \"svg\",\n \"ul\"\n];\nvar Primitive = NODES.reduce((primitive, node) => {\n const Slot = createSlot(`Primitive.${node}`);\n const Node = React.forwardRef((props, forwardedRef) => {\n const { asChild, ...primitiveProps } = props;\n const Comp = asChild ? Slot : node;\n if (typeof window !== \"undefined\") {\n window[Symbol.for(\"radix-ui\")] = true;\n }\n return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });\n });\n Node.displayName = `Primitive.${node}`;\n return { ...primitive, [node]: Node };\n}, {});\nfunction dispatchDiscreteCustomEvent(target, event) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));\n}\n__name(dispatchDiscreteCustomEvent, \"dispatchDiscreteCustomEvent\");\nvar Root = Primitive;\nexport {\n Primitive,\n Root,\n dispatchDiscreteCustomEvent\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\nvar __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/switch.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { useSize } from \"@radix-ui/react-use-size\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nvar SWITCH_NAME = \"Switch\";\nvar [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME);\nvar [SwitchProviderImpl, useSwitchContext] = createSwitchContext(SWITCH_NAME);\nfunction SwitchProvider(props) {\n const {\n __scopeSwitch,\n checked: checkedProp,\n children,\n defaultChecked,\n disabled,\n form,\n name,\n onCheckedChange,\n required,\n value = \"on\",\n // @ts-expect-error\n internal_do_not_use_render\n } = props;\n const [checked, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked ?? false,\n onChange: onCheckedChange,\n caller: SWITCH_NAME\n });\n const [control, setControl] = React.useState(null);\n const [bubbleInput, setBubbleInput] = React.useState(null);\n const hasConsumerStoppedPropagationRef = React.useRef(false);\n const [userInteractionCount, onUserInteraction] = React.useReducer(\n (count) => count + 1,\n 0\n );\n const isFormControl = control ? !!form || !!control.closest(\"form\") : (\n // We set this to true by default so that events bubble to forms without JS (SSR)\n true\n );\n const context = {\n checked,\n setChecked,\n disabled,\n control,\n setControl,\n name,\n form,\n value,\n hasConsumerStoppedPropagationRef,\n userInteractionCount,\n onUserInteraction,\n required,\n defaultChecked,\n isFormControl,\n bubbleInput,\n setBubbleInput\n };\n return /* @__PURE__ */ jsx(SwitchProviderImpl, { scope: __scopeSwitch, ...context, children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children });\n}\n__name(SwitchProvider, \"SwitchProvider\");\nvar TRIGGER_NAME = \"SwitchTrigger\";\nvar SwitchTrigger = /* @__PURE__ */ React.forwardRef(\n /* @__PURE__ */ __name(function SwitchTrigger2({ __scopeSwitch, onClick, ...switchProps }, forwardedRef) {\n const {\n control,\n form,\n value,\n disabled,\n checked,\n required,\n setControl,\n setChecked,\n hasConsumerStoppedPropagationRef,\n onUserInteraction,\n isFormControl,\n bubbleInput\n } = useSwitchContext(TRIGGER_NAME, __scopeSwitch);\n const composedRefs = useComposedRefs(forwardedRef, setControl);\n const initialCheckedStateRef = React.useRef(checked);\n React.useEffect(() => {\n const associatedForm = form ? control?.ownerDocument.getElementById(form) : control?.form;\n if (associatedForm instanceof HTMLFormElement) {\n const reset = /* @__PURE__ */ __name(() => setChecked(initialCheckedStateRef.current), \"reset\");\n associatedForm.addEventListener(\"reset\", reset);\n return () => associatedForm.removeEventListener(\"reset\", reset);\n }\n }, [control, form, setChecked]);\n return /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n role: \"switch\",\n \"aria-checked\": checked,\n \"aria-required\": required,\n \"data-state\": getState(checked),\n \"data-disabled\": disabled ? \"\" : void 0,\n disabled,\n value,\n ...switchProps,\n ref: composedRefs,\n onClick: composeEventHandlers(onClick, (event) => {\n onUserInteraction();\n setChecked((prevChecked) => !prevChecked);\n if (bubbleInput && isFormControl) {\n hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n }\n })\n }\n );\n }, \"SwitchTrigger\")\n);\nvar Switch = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n /* @__PURE__ */ __name(function Switch2(props, forwardedRef) {\n const {\n __scopeSwitch,\n name,\n checked,\n defaultChecked,\n required,\n disabled,\n value,\n onCheckedChange,\n form,\n ...switchProps\n } = props;\n return /* @__PURE__ */ jsx(\n SwitchProvider,\n {\n __scopeSwitch,\n checked,\n defaultChecked,\n disabled,\n required,\n onCheckedChange,\n name,\n form,\n value,\n internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\n SwitchTrigger,\n {\n ...switchProps,\n ref: forwardedRef,\n __scopeSwitch\n }\n ),\n isFormControl && /* @__PURE__ */ jsx(\n SwitchBubbleInput,\n {\n __scopeSwitch\n }\n )\n ] })\n }\n );\n }, \"Switch\")\n);\nvar THUMB_NAME = \"SwitchThumb\";\nvar SwitchThumb = /* @__PURE__ */ React.forwardRef(\n /* @__PURE__ */ __name(function SwitchThumb2(props, forwardedRef) {\n const { __scopeSwitch, ...thumbProps } = props;\n const context = useSwitchContext(THUMB_NAME, __scopeSwitch);\n return /* @__PURE__ */ jsx(\n Primitive.span,\n {\n \"data-state\": getState(context.checked),\n \"data-disabled\": context.disabled ? \"\" : void 0,\n ...thumbProps,\n ref: forwardedRef\n }\n );\n }, \"SwitchThumb\")\n);\nvar BUBBLE_INPUT_NAME = \"SwitchBubbleInput\";\nvar SwitchBubbleInput = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n /* @__PURE__ */ __name(function SwitchBubbleInput2({ __scopeSwitch, onClick, ...props }, forwardedRef) {\n const {\n control,\n hasConsumerStoppedPropagationRef,\n userInteractionCount,\n checked,\n defaultChecked,\n required,\n disabled,\n name,\n value,\n form,\n bubbleInput,\n setBubbleInput\n } = useSwitchContext(BUBBLE_INPUT_NAME, __scopeSwitch);\n const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);\n const controlSize = useSize(control);\n const shouldStopClickPropagationRef = React.useRef(false);\n const prevCheckedRef = React.useRef(checked);\n const prevUserInteractionCountRef = React.useRef(userInteractionCount);\n React.useEffect(() => {\n const input = bubbleInput;\n if (!input) return;\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(\n inputProto,\n \"checked\"\n );\n const setChecked = descriptor.set;\n const isUserInteraction = userInteractionCount !== prevUserInteractionCountRef.current;\n prevUserInteractionCountRef.current = userInteractionCount;\n const checkedChanged = prevCheckedRef.current !== checked;\n prevCheckedRef.current = checked;\n const bubbles = !(isUserInteraction && hasConsumerStoppedPropagationRef.current);\n if (checkedChanged && setChecked) {\n shouldStopClickPropagationRef.current = !isUserInteraction;\n const event = new Event(\"click\", { bubbles });\n setChecked.call(input, checked);\n input.dispatchEvent(event);\n shouldStopClickPropagationRef.current = false;\n }\n }, [bubbleInput, checked, hasConsumerStoppedPropagationRef, userInteractionCount]);\n const defaultCheckedRef = React.useRef(checked);\n return /* @__PURE__ */ jsx(\n Primitive.input,\n {\n type: \"checkbox\",\n \"aria-hidden\": true,\n defaultChecked: defaultChecked ?? defaultCheckedRef.current,\n required,\n disabled,\n name,\n value,\n form,\n ...props,\n tabIndex: -1,\n ref: composedRefs,\n onClick: composeEventHandlers(onClick, (event) => {\n if (shouldStopClickPropagationRef.current) {\n event.stopPropagation();\n }\n }),\n style: {\n ...props.style,\n ...controlSize,\n position: \"absolute\",\n pointerEvents: \"none\",\n opacity: 0,\n margin: 0,\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n transform: \"translateX(-100%)\"\n }\n }\n );\n }, \"SwitchBubbleInput\")\n);\nfunction isFunction(value) {\n return typeof value === \"function\";\n}\n__name(isFunction, \"isFunction\");\nfunction getState(checked) {\n return checked ? \"checked\" : \"unchecked\";\n}\n__name(getState, \"getState\");\nexport {\n Switch as Root,\n Switch,\n SwitchThumb,\n SwitchThumb as Thumb,\n createSwitchScope,\n SwitchBubbleInput as unstable_BubbleInput,\n SwitchProvider as unstable_Provider,\n SwitchBubbleInput as unstable_SwitchBubbleInput,\n SwitchProvider as unstable_SwitchProvider,\n SwitchTrigger as unstable_SwitchTrigger,\n SwitchTrigger as unstable_Trigger\n};\n//# sourceMappingURL=index.mjs.map\n","import * as React from \"react\";\nimport * as SwitchPrimitives from \"@radix-ui/react-switch\";\nimport { cn } from \"../../utils/cn\";\n\nconst Switch = React.forwardRef<\n React.ElementRef<typeof SwitchPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>\n>(({ className, ...props }, ref) => (\n <SwitchPrimitives.Root\n ref={ref}\n className={cn(\n \"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-border transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-bg-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n >\n <SwitchPrimitives.Thumb\n className={cn(\n \"pointer-events-none block h-4 w-4 rounded-full bg-foreground shadow-lg transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0.5\",\n )}\n />\n </SwitchPrimitives.Root>\n));\nSwitch.displayName = SwitchPrimitives.Root.displayName;\n\nexport { Switch };\n"],"names":["__defProp","__name","target","value","canUseDOM","composeEventHandlers","originalEventHandler","ourEventHandler","checkForDefaultPrevented","event","getOwnerWindow","element","getOwnerDocument","getActiveElement","node","activeDescendant","activeElement","isFrame","id","setRef","ref","composeRefs","refs","hasCleanup","cleanups","cleanup","i","useComposedRefs","React.useCallback","createContext2","rootComponentName","defaultContext","Context","React.createContext","Provider","props","children","context","React.useMemo","jsx","useContext2","consumerName","options","optional","React.useContext","createContextScope","scopeName","createContextScopeDeps","defaultContexts","createContext3","BaseContext","index","scope","createScope","scopeContexts","contexts","composeContextScopes","scopes","baseScope","scopeHooks","createScope2","overrideScopes","nextScopes","nextScopes2","useScope","currentScope","useLayoutEffect2","React.useLayoutEffect","useReactEffectEvent","React","useReactInsertionEffect","useEffectEvent","callback","React.useRef","useLayoutEffect","args","useInsertionEffect","useControllableState","prop","defaultProp","onChange","caller","uncontrolledProp","setUncontrolledProp","onChangeRef","useUncontrolledState","isControlled","setValue","nextValue","value2","isFunction","React.useState","prevValueRef","React.useEffect","SYNC_STATE","useControllableStateReducer","reducer","userArgs","initialArg","init","controlledState","onChangeProp","internalState","dispatch","React2.useReducer","state2","action","next","uncontrolledState","React2.useRef","React2.useEffect","state","React2.useMemo","useSize","size","setSize","resizeObserver","entries","entry","width","height","borderSizeEntry","borderSize","createSlot","ownerName","Slot2","React.forwardRef","forwardedRef","slotProps","slottableElement","hasSlottable","newChildren","isLazyComponent","use","React.Children","maybeSlottable","isSlottable","slottable","child","getSlottableElementFromSlottable","React.cloneElement","React.isValidElement","slottableElementRef","getElementRef","composedRef","createSlottableError","createSlotError","mergedProps","mergeProps","React.Fragment","SLOTTABLE_IDENTIFIER","createSlottable","Slottable2","child2","childProps","overrideProps","propName","slotPropValue","childPropValue","result","getter","mayWarn","REACT_LAZY_TYPE","isPromiseLike","NODES","Primitive","primitive","Slot","Node","asChild","primitiveProps","Comp","dispatchDiscreteCustomEvent","ReactDOM.flushSync","SWITCH_NAME","createSwitchContext","createSwitchScope","SwitchProviderImpl","useSwitchContext","SwitchProvider","__scopeSwitch","checkedProp","defaultChecked","disabled","form","name","onCheckedChange","required","internal_do_not_use_render","checked","setChecked","control","setControl","bubbleInput","setBubbleInput","hasConsumerStoppedPropagationRef","userInteractionCount","onUserInteraction","React.useReducer","count","isFormControl","TRIGGER_NAME","SwitchTrigger","onClick","switchProps","composedRefs","initialCheckedStateRef","associatedForm","reset","getState","prevChecked","Switch","jsxs","Fragment","SwitchBubbleInput","THUMB_NAME","SwitchThumb","thumbProps","BUBBLE_INPUT_NAME","controlSize","shouldStopClickPropagationRef","prevCheckedRef","prevUserInteractionCountRef","input","inputProto","isUserInteraction","checkedChanged","bubbles","defaultCheckedRef","className","SwitchPrimitives.Root","cn","SwitchPrimitives.Thumb"],"mappings":"qEAAA,IAAIA,GAAY,OAAO,eACnBC,EAAS,CAACC,EAAQC,IAAUH,GAAUE,EAAQ,OAAQ,CAAE,MAAAC,EAAO,aAAc,GAAM,EAGnFC,EAAY,CAAC,EAAE,OAAO,OAAW,KAAe,OAAO,UAAY,OAAO,SAAS,eACvF,SAASC,EAAqBC,EAAsBC,EAAiB,CAAE,yBAAAC,EAA2B,EAAI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,EACA,MAAAtL,EACA,KAAAqL,EACA,GAAGrJ,EACH,SAAU,GACV,IAAK0K,EACL,QAASxM,EAAqBsM,EAAUlM,GAAU,CAC5CmN,EAA8B,SAChCnN,EAAM,gBAAe,CAEzB,CAAC,EACD,MAAO,CACL,GAAG0B,EAAM,MACT,GAAGwL,EACH,SAAU,WACV,cAAe,OACf,QAAS,EACT,OAAQ,EAIR,UAAW,mBACrB,CACA,CACA,CACE,EAAG,mBAAmB,CACxB,EACA,SAASjI,GAAWvF,EAAO,CACzB,OAAO,OAAOA,GAAU,UAC1B,CACAF,EAAOyF,GAAY,YAAY,EAC/B,SAASuH,EAASpB,EAAS,CACzB,OAAOA,EAAU,UAAY,WAC/B,CACA5L,EAAOgN,EAAU,UAAU,EC5Q3B,MAAME,GAASrF,EAAAA,WAGb,CAAC,CAAE,UAAAuG,EAAW,GAAGlM,CAAA,EAASf,IAC1BmB,EAAAA,IAAC+L,GAAA,CACC,IAAAlN,EACA,UAAWmN,EACT,wTACAF,CAAA,EAED,GAAGlM,EAEJ,SAAAI,EAAAA,IAACiM,GAAA,CACC,UAAWD,EACT,uKAAA,CACF,CAAA,CACF,CACF,CACD,EACDpB,GAAO,YAAcmB,GAAsB","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9]}
|
|
1
|
+
{"version":3,"file":"switch-CY5Gwj1o.js","sources":["../../node_modules/@radix-ui/primitive/dist/index.mjs","../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../node_modules/@radix-ui/react-context/dist/index.mjs","../../node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs","../../node_modules/@radix-ui/react-use-effect-event/dist/index.mjs","../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs","../../node_modules/@radix-ui/react-use-size/dist/index.mjs","../../node_modules/@radix-ui/react-slot/dist/index.mjs","../../node_modules/@radix-ui/react-primitive/dist/index.mjs","../../node_modules/@radix-ui/react-switch/dist/index.mjs","../../src/components/ui/switch.tsx"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/primitive.tsx\nvar canUseDOM = !!(typeof window !== \"undefined\" && window.document && window.document.createElement);\nfunction composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {\n return /* @__PURE__ */ __name(function handleEvent(event) {\n originalEventHandler?.(event);\n if (checkForDefaultPrevented === false || !event || !event.defaultPrevented) {\n return ourEventHandler?.(event);\n }\n }, \"handleEvent\");\n}\n__name(composeEventHandlers, \"composeEventHandlers\");\nfunction getOwnerWindow(element) {\n if (!canUseDOM) {\n throw new Error(\"Cannot access window outside of the DOM\");\n }\n return element?.ownerDocument?.defaultView ?? window;\n}\n__name(getOwnerWindow, \"getOwnerWindow\");\nfunction getOwnerDocument(element) {\n if (!canUseDOM) {\n throw new Error(\"Cannot access document outside of the DOM\");\n }\n return element?.ownerDocument ?? document;\n}\n__name(getOwnerDocument, \"getOwnerDocument\");\nfunction getActiveElement(node, activeDescendant = false) {\n const { activeElement } = getOwnerDocument(node);\n if (!activeElement?.nodeName) {\n return null;\n }\n if (isFrame(activeElement) && activeElement.contentDocument) {\n return getActiveElement(activeElement.contentDocument.body, activeDescendant);\n }\n if (activeDescendant) {\n const id = activeElement.getAttribute(\"aria-activedescendant\");\n if (id) {\n const element = getOwnerDocument(activeElement).getElementById(id);\n if (element) {\n return element;\n }\n }\n }\n return activeElement;\n}\n__name(getActiveElement, \"getActiveElement\");\nfunction isFrame(element) {\n return element.tagName === \"IFRAME\";\n}\n__name(isFrame, \"isFrame\");\nexport {\n canUseDOM,\n composeEventHandlers,\n getActiveElement,\n getOwnerDocument,\n getOwnerWindow,\n isFrame\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/compose-refs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\n__name(setRef, \"setRef\");\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == \"function\") {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n__name(composeRefs, \"composeRefs\");\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\n__name(useComposedRefs, \"useComposedRefs\");\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/create-context.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\n// @__NO_SIDE_EFFECTS__\nfunction createContext2(rootComponentName, defaultContext) {\n const Context = React.createContext(defaultContext);\n Context.displayName = rootComponentName + \"Context\";\n const Provider = /* @__PURE__ */ __name((props) => {\n const { children, ...context } = props;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n }, \"Provider\");\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName, options = {}) {\n const { optional = false } = options;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n if (optional) return void 0;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n __name(useContext2, \"useContext\");\n return [Provider, useContext2];\n}\n__name(createContext2, \"createContext\");\n// @__NO_SIDE_EFFECTS__\nfunction createContextScope(scopeName, createContextScopeDeps = []) {\n let defaultContexts = [];\n function createContext3(rootComponentName, defaultContext) {\n const BaseContext = React.createContext(defaultContext);\n BaseContext.displayName = rootComponentName + \"Context\";\n const index = defaultContexts.length;\n defaultContexts = [...defaultContexts, defaultContext];\n const Provider = /* @__PURE__ */ __name((props) => {\n const { scope, children, ...context } = props;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n }, \"Provider\");\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName, scope, options = {}) {\n const { optional = false } = options;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n if (optional) return void 0;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n __name(useContext2, \"useContext\");\n return [Provider, useContext2];\n }\n __name(createContext3, \"createContext\");\n const createScope = /* @__PURE__ */ __name(() => {\n const scopeContexts = defaultContexts.map((defaultContext) => {\n return React.createContext(defaultContext);\n });\n return /* @__PURE__ */ __name(function useScope(scope) {\n const contexts = scope?.[scopeName] || scopeContexts;\n return React.useMemo(\n () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),\n [scope, contexts]\n );\n }, \"useScope\");\n }, \"createScope\");\n createScope.scopeName = scopeName;\n return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];\n}\n__name(createContextScope, \"createContextScope\");\nfunction composeContextScopes(...scopes) {\n const baseScope = scopes[0];\n if (scopes.length === 1) return baseScope;\n const createScope = /* @__PURE__ */ __name(() => {\n const scopeHooks = scopes.map((createScope2) => ({\n useScope: createScope2(),\n scopeName: createScope2.scopeName\n }));\n return /* @__PURE__ */ __name(function useComposedScopes(overrideScopes) {\n const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {\n const scopeProps = useScope(overrideScopes);\n const currentScope = scopeProps[`__scope${scopeName}`];\n return { ...nextScopes2, ...currentScope };\n }, {});\n return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);\n }, \"useComposedScopes\");\n }, \"createScope\");\n createScope.scopeName = baseScope.scopeName;\n return createScope;\n}\n__name(composeContextScopes, \"composeContextScopes\");\nexport {\n createContext2 as createContext,\n createContextScope\n};\n//# sourceMappingURL=index.mjs.map\n","// src/use-layout-effect.tsx\nimport * as React from \"react\";\nvar useLayoutEffect2 = globalThis?.document ? React.useLayoutEffect : () => {\n};\nexport {\n useLayoutEffect2 as useLayoutEffect\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/use-effect-event.tsx\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nimport * as React from \"react\";\nvar useReactEffectEvent = React[\" useEffectEvent \".trim().toString()];\nvar useReactInsertionEffect = React[\" useInsertionEffect \".trim().toString()];\nfunction useEffectEvent(callback) {\n if (typeof useReactEffectEvent === \"function\") {\n return useReactEffectEvent(callback);\n }\n const ref = React.useRef(() => {\n throw new Error(\"Cannot call an event handler while rendering.\");\n });\n if (typeof useReactInsertionEffect === \"function\") {\n useReactInsertionEffect(() => {\n ref.current = callback;\n });\n } else {\n useLayoutEffect(() => {\n ref.current = callback;\n });\n }\n return React.useMemo(() => ((...args) => ref.current?.(...args)), []);\n}\n__name(useEffectEvent, \"useEffectEvent\");\nexport {\n useEffectEvent\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/use-controllable-state.tsx\nimport * as React from \"react\";\nimport { IS_DEVELOPMENT } from \"@radix-ui/primitive/is-development\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nvar useInsertionEffect = React[\" useInsertionEffect \".trim().toString()] || useLayoutEffect;\nfunction useControllableState({\n prop,\n defaultProp,\n onChange = /* @__PURE__ */ __name(() => {\n }, \"onChange\"),\n caller\n}) {\n const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({\n defaultProp,\n onChange\n });\n const isControlled = prop !== void 0;\n const value = isControlled ? prop : uncontrolledProp;\n if (IS_DEVELOPMENT) {\n const isControlledRef = React.useRef(prop !== void 0);\n React.useEffect(() => {\n const wasControlled = isControlledRef.current;\n if (wasControlled !== isControlled) {\n const from = wasControlled ? \"controlled\" : \"uncontrolled\";\n const to = isControlled ? \"controlled\" : \"uncontrolled\";\n console.warn(\n `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`\n );\n }\n isControlledRef.current = isControlled;\n }, [isControlled, caller]);\n }\n const setValue = React.useCallback(\n (nextValue) => {\n if (isControlled) {\n const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;\n if (value2 !== prop) {\n onChangeRef.current?.(value2);\n }\n } else {\n setUncontrolledProp(nextValue);\n }\n },\n [isControlled, prop, setUncontrolledProp, onChangeRef]\n );\n return [value, setValue];\n}\n__name(useControllableState, \"useControllableState\");\nfunction useUncontrolledState({\n defaultProp,\n onChange\n}) {\n const [value, setValue] = React.useState(defaultProp);\n const prevValueRef = React.useRef(value);\n const onChangeRef = React.useRef(onChange);\n useInsertionEffect(() => {\n onChangeRef.current = onChange;\n }, [onChange]);\n React.useEffect(() => {\n if (prevValueRef.current !== value) {\n onChangeRef.current?.(value);\n prevValueRef.current = value;\n }\n }, [value, prevValueRef]);\n return [value, setValue, onChangeRef];\n}\n__name(useUncontrolledState, \"useUncontrolledState\");\nfunction isFunction(value) {\n return typeof value === \"function\";\n}\n__name(isFunction, \"isFunction\");\n\n// src/use-controllable-state-reducer.tsx\nimport * as React2 from \"react\";\nimport { IS_DEVELOPMENT as IS_DEVELOPMENT2 } from \"@radix-ui/primitive/is-development\";\nimport { useEffectEvent } from \"@radix-ui/react-use-effect-event\";\nvar SYNC_STATE = Symbol(\"RADIX:SYNC_STATE\");\nfunction useControllableStateReducer(reducer, userArgs, initialArg, init) {\n const { prop: controlledState, defaultProp, onChange: onChangeProp, caller } = userArgs;\n const isControlled = controlledState !== void 0;\n const onChange = useEffectEvent(onChangeProp);\n if (IS_DEVELOPMENT2) {\n const isControlledRef = React2.useRef(controlledState !== void 0);\n React2.useEffect(() => {\n const wasControlled = isControlledRef.current;\n if (wasControlled !== isControlled) {\n const from = wasControlled ? \"controlled\" : \"uncontrolled\";\n const to = isControlled ? \"controlled\" : \"uncontrolled\";\n console.warn(\n `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`\n );\n }\n isControlledRef.current = isControlled;\n }, [isControlled, caller]);\n }\n const args = [{ ...initialArg, state: defaultProp }];\n if (init) {\n args.push(init);\n }\n const [internalState, dispatch] = React2.useReducer(\n (state2, action) => {\n if (action.type === SYNC_STATE) {\n return { ...state2, state: action.state };\n }\n const next = reducer(state2, action);\n if (isControlled && !Object.is(next.state, state2.state)) {\n onChange(next.state);\n }\n return next;\n },\n ...args\n );\n const uncontrolledState = internalState.state;\n const prevValueRef = React2.useRef(uncontrolledState);\n React2.useEffect(() => {\n if (prevValueRef.current !== uncontrolledState) {\n prevValueRef.current = uncontrolledState;\n if (!isControlled) {\n onChange(uncontrolledState);\n }\n }\n }, [uncontrolledState, prevValueRef, isControlled]);\n const state = React2.useMemo(() => {\n const isControlled2 = controlledState !== void 0;\n if (isControlled2) {\n return { ...internalState, state: controlledState };\n }\n return internalState;\n }, [internalState, controlledState]);\n React2.useEffect(() => {\n if (isControlled && !Object.is(controlledState, internalState.state)) {\n dispatch({ type: SYNC_STATE, state: controlledState });\n }\n }, [controlledState, internalState.state, isControlled]);\n return [state, dispatch];\n}\n__name(useControllableStateReducer, \"useControllableStateReducer\");\nexport {\n useControllableState,\n useControllableStateReducer\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/use-size.tsx\nimport * as React from \"react\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nfunction useSize(element) {\n const [size, setSize] = React.useState(void 0);\n useLayoutEffect(() => {\n if (element) {\n setSize({ width: element.offsetWidth, height: element.offsetHeight });\n const resizeObserver = new ResizeObserver((entries) => {\n if (!Array.isArray(entries)) {\n return;\n }\n if (!entries.length) {\n return;\n }\n const entry = entries[0];\n let width;\n let height;\n if (\"borderBoxSize\" in entry) {\n const borderSizeEntry = entry[\"borderBoxSize\"];\n const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;\n width = borderSize[\"inlineSize\"];\n height = borderSize[\"blockSize\"];\n } else {\n width = element.offsetWidth;\n height = element.offsetHeight;\n }\n setSize({ width, height });\n });\n resizeObserver.observe(element, { box: \"border-box\" });\n return () => resizeObserver.unobserve(element);\n } else {\n setSize(void 0);\n }\n }, [element]);\n return size;\n}\n__name(useSize, \"useSize\");\nexport {\n useSize\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/slot.tsx\nimport * as React from \"react\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\n// @__NO_SIDE_EFFECTS__\nfunction createSlot(ownerName) {\n const Slot2 = React.forwardRef((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n let slottableElement = null;\n let hasSlottable = false;\n const newChildren = [];\n if (isLazyComponent(children) && typeof use === \"function\") {\n children = use(children._payload);\n }\n React.Children.forEach(children, (maybeSlottable) => {\n if (isSlottable(maybeSlottable)) {\n hasSlottable = true;\n const slottable = maybeSlottable;\n let child = \"child\" in slottable.props ? slottable.props.child : slottable.props.children;\n if (isLazyComponent(child) && typeof use === \"function\") {\n child = use(child._payload);\n }\n slottableElement = getSlottableElementFromSlottable(slottable, child);\n newChildren.push(slottableElement?.props?.children);\n } else {\n newChildren.push(maybeSlottable);\n }\n });\n if (slottableElement) {\n slottableElement = React.cloneElement(slottableElement, void 0, newChildren);\n } else if (\n // A `Slottable` was found but it didn't resolve to a single element (e.g.\n // it wrapped multiple elements, text, or a render-prop `child` that\n // wasn't an element). Don't fall back to treating the `Slottable` wrapper\n // itself as the slot target — throw a descriptive error below instead.\n !hasSlottable && React.Children.count(children) === 1 && React.isValidElement(children)\n ) {\n slottableElement = children;\n }\n const slottableElementRef = slottableElement ? getElementRef(slottableElement) : void 0;\n const composedRef = useComposedRefs(forwardedRef, slottableElementRef);\n if (!slottableElement) {\n if (children || children === 0) {\n throw new Error(\n hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName)\n );\n }\n return children;\n }\n const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});\n if (slottableElement.type !== React.Fragment) {\n mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;\n }\n return React.cloneElement(slottableElement, mergedProps);\n });\n Slot2.displayName = `${ownerName}.Slot`;\n return Slot2;\n}\n__name(createSlot, \"createSlot\");\nvar Slot = /* @__PURE__ */ createSlot(\"Slot\");\nvar SLOTTABLE_IDENTIFIER = Symbol.for(\"radix.slottable\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlottable(ownerName) {\n const Slottable2 = /* @__PURE__ */ __name((props) => \"child\" in props ? props.children(props.child) : props.children, \"Slottable\");\n Slottable2.displayName = `${ownerName}.Slottable`;\n Slottable2.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable2;\n}\n__name(createSlottable, \"createSlottable\");\nvar Slottable = /* @__PURE__ */ createSlottable(\"Slottable\");\nvar getSlottableElementFromSlottable = /* @__PURE__ */ __name((slottable, child) => {\n if (\"child\" in slottable.props) {\n const child2 = slottable.props.child;\n if (!React.isValidElement(child2)) return null;\n return React.cloneElement(child2, void 0, slottable.props.children(child2.props.children));\n }\n return React.isValidElement(child) ? child : null;\n}, \"getSlottableElementFromSlottable\");\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\n__name(mergeProps, \"mergeProps\");\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\n__name(getElementRef, \"getElementRef\");\nfunction isSlottable(child) {\n return React.isValidElement(child) && typeof child.type === \"function\" && \"__radixId\" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;\n}\n__name(isSlottable, \"isSlottable\");\nvar REACT_LAZY_TYPE = Symbol.for(\"react.lazy\");\nfunction isLazyComponent(element) {\n return element != null && typeof element === \"object\" && \"$$typeof\" in element && element.$$typeof === REACT_LAZY_TYPE && \"_payload\" in element && isPromiseLike(element._payload);\n}\n__name(isLazyComponent, \"isLazyComponent\");\nfunction isPromiseLike(value) {\n return typeof value === \"object\" && value !== null && \"then\" in value;\n}\n__name(isPromiseLike, \"isPromiseLike\");\nvar createSlotError = /* @__PURE__ */ __name((ownerName) => {\n return `${ownerName} failed to slot onto its children. Expected a single React element child or \\`Slottable\\`.`;\n}, \"createSlotError\");\nvar createSlottableError = /* @__PURE__ */ __name((ownerName) => {\n return `${ownerName} failed to slot onto its \\`Slottable\\`. Expected \\`Slottable\\` to receive a single React element child.`;\n}, \"createSlottableError\");\nvar use = React[\" use \".trim().toString()];\nexport {\n Slot as Root,\n Slot,\n Slottable,\n createSlot,\n createSlottable\n};\n//# sourceMappingURL=index.mjs.map\n","var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/primitive.tsx\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"select\",\n \"span\",\n \"svg\",\n \"ul\"\n];\nvar Primitive = NODES.reduce((primitive, node) => {\n const Slot = createSlot(`Primitive.${node}`);\n const Node = React.forwardRef((props, forwardedRef) => {\n const { asChild, ...primitiveProps } = props;\n const Comp = asChild ? Slot : node;\n if (typeof window !== \"undefined\") {\n window[Symbol.for(\"radix-ui\")] = true;\n }\n return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });\n });\n Node.displayName = `Primitive.${node}`;\n return { ...primitive, [node]: Node };\n}, {});\nfunction dispatchDiscreteCustomEvent(target, event) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));\n}\n__name(dispatchDiscreteCustomEvent, \"dispatchDiscreteCustomEvent\");\nvar Root = Primitive;\nexport {\n Primitive,\n Root,\n dispatchDiscreteCustomEvent\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\nvar __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\n// src/switch.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { useSize } from \"@radix-ui/react-use-size\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nvar SWITCH_NAME = \"Switch\";\nvar [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME);\nvar [SwitchProviderImpl, useSwitchContext] = createSwitchContext(SWITCH_NAME);\nfunction SwitchProvider(props) {\n const {\n __scopeSwitch,\n checked: checkedProp,\n children,\n defaultChecked,\n disabled,\n form,\n name,\n onCheckedChange,\n required,\n value = \"on\",\n // @ts-expect-error\n internal_do_not_use_render\n } = props;\n const [checked, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked ?? false,\n onChange: onCheckedChange,\n caller: SWITCH_NAME\n });\n const [control, setControl] = React.useState(null);\n const [bubbleInput, setBubbleInput] = React.useState(null);\n const hasConsumerStoppedPropagationRef = React.useRef(false);\n const [userInteractionCount, onUserInteraction] = React.useReducer(\n (count) => count + 1,\n 0\n );\n const isFormControl = control ? !!form || !!control.closest(\"form\") : (\n // We set this to true by default so that events bubble to forms without JS (SSR)\n true\n );\n const context = {\n checked,\n setChecked,\n disabled,\n control,\n setControl,\n name,\n form,\n value,\n hasConsumerStoppedPropagationRef,\n userInteractionCount,\n onUserInteraction,\n required,\n defaultChecked,\n isFormControl,\n bubbleInput,\n setBubbleInput\n };\n return /* @__PURE__ */ jsx(SwitchProviderImpl, { scope: __scopeSwitch, ...context, children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children });\n}\n__name(SwitchProvider, \"SwitchProvider\");\nvar TRIGGER_NAME = \"SwitchTrigger\";\nvar SwitchTrigger = /* @__PURE__ */ React.forwardRef(\n /* @__PURE__ */ __name(function SwitchTrigger2({ __scopeSwitch, onClick, ...switchProps }, forwardedRef) {\n const {\n control,\n form,\n value,\n disabled,\n checked,\n required,\n setControl,\n setChecked,\n hasConsumerStoppedPropagationRef,\n onUserInteraction,\n isFormControl,\n bubbleInput\n } = useSwitchContext(TRIGGER_NAME, __scopeSwitch);\n const composedRefs = useComposedRefs(forwardedRef, setControl);\n const initialCheckedStateRef = React.useRef(checked);\n React.useEffect(() => {\n const associatedForm = form ? control?.ownerDocument.getElementById(form) : control?.form;\n if (associatedForm instanceof HTMLFormElement) {\n const reset = /* @__PURE__ */ __name(() => setChecked(initialCheckedStateRef.current), \"reset\");\n associatedForm.addEventListener(\"reset\", reset);\n return () => associatedForm.removeEventListener(\"reset\", reset);\n }\n }, [control, form, setChecked]);\n return /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n role: \"switch\",\n \"aria-checked\": checked,\n \"aria-required\": required,\n \"data-state\": getState(checked),\n \"data-disabled\": disabled ? \"\" : void 0,\n disabled,\n value,\n ...switchProps,\n ref: composedRefs,\n onClick: composeEventHandlers(onClick, (event) => {\n onUserInteraction();\n setChecked((prevChecked) => !prevChecked);\n if (bubbleInput && isFormControl) {\n hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n }\n })\n }\n );\n }, \"SwitchTrigger\")\n);\nvar Switch = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n /* @__PURE__ */ __name(function Switch2(props, forwardedRef) {\n const {\n __scopeSwitch,\n name,\n checked,\n defaultChecked,\n required,\n disabled,\n value,\n onCheckedChange,\n form,\n ...switchProps\n } = props;\n return /* @__PURE__ */ jsx(\n SwitchProvider,\n {\n __scopeSwitch,\n checked,\n defaultChecked,\n disabled,\n required,\n onCheckedChange,\n name,\n form,\n value,\n internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\n SwitchTrigger,\n {\n ...switchProps,\n ref: forwardedRef,\n __scopeSwitch\n }\n ),\n isFormControl && /* @__PURE__ */ jsx(\n SwitchBubbleInput,\n {\n __scopeSwitch\n }\n )\n ] })\n }\n );\n }, \"Switch\")\n);\nvar THUMB_NAME = \"SwitchThumb\";\nvar SwitchThumb = /* @__PURE__ */ React.forwardRef(\n /* @__PURE__ */ __name(function SwitchThumb2(props, forwardedRef) {\n const { __scopeSwitch, ...thumbProps } = props;\n const context = useSwitchContext(THUMB_NAME, __scopeSwitch);\n return /* @__PURE__ */ jsx(\n Primitive.span,\n {\n \"data-state\": getState(context.checked),\n \"data-disabled\": context.disabled ? \"\" : void 0,\n ...thumbProps,\n ref: forwardedRef\n }\n );\n }, \"SwitchThumb\")\n);\nvar BUBBLE_INPUT_NAME = \"SwitchBubbleInput\";\nvar SwitchBubbleInput = /* @__PURE__ */ React.forwardRef(\n // blank line to reduce diff noise\n /* @__PURE__ */ __name(function SwitchBubbleInput2({ __scopeSwitch, onClick, ...props }, forwardedRef) {\n const {\n control,\n hasConsumerStoppedPropagationRef,\n userInteractionCount,\n checked,\n defaultChecked,\n required,\n disabled,\n name,\n value,\n form,\n bubbleInput,\n setBubbleInput\n } = useSwitchContext(BUBBLE_INPUT_NAME, __scopeSwitch);\n const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);\n const controlSize = useSize(control);\n const shouldStopClickPropagationRef = React.useRef(false);\n const prevCheckedRef = React.useRef(checked);\n const prevUserInteractionCountRef = React.useRef(userInteractionCount);\n React.useEffect(() => {\n const input = bubbleInput;\n if (!input) return;\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(\n inputProto,\n \"checked\"\n );\n const setChecked = descriptor.set;\n const isUserInteraction = userInteractionCount !== prevUserInteractionCountRef.current;\n prevUserInteractionCountRef.current = userInteractionCount;\n const checkedChanged = prevCheckedRef.current !== checked;\n prevCheckedRef.current = checked;\n const bubbles = !(isUserInteraction && hasConsumerStoppedPropagationRef.current);\n if (checkedChanged && setChecked) {\n shouldStopClickPropagationRef.current = !isUserInteraction;\n const event = new Event(\"click\", { bubbles });\n setChecked.call(input, checked);\n input.dispatchEvent(event);\n shouldStopClickPropagationRef.current = false;\n }\n }, [bubbleInput, checked, hasConsumerStoppedPropagationRef, userInteractionCount]);\n const defaultCheckedRef = React.useRef(checked);\n return /* @__PURE__ */ jsx(\n Primitive.input,\n {\n type: \"checkbox\",\n \"aria-hidden\": true,\n defaultChecked: defaultChecked ?? defaultCheckedRef.current,\n required,\n disabled,\n name,\n value,\n form,\n ...props,\n tabIndex: -1,\n ref: composedRefs,\n onClick: composeEventHandlers(onClick, (event) => {\n if (shouldStopClickPropagationRef.current) {\n event.stopPropagation();\n }\n }),\n style: {\n ...props.style,\n ...controlSize,\n position: \"absolute\",\n pointerEvents: \"none\",\n opacity: 0,\n margin: 0,\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n transform: \"translateX(-100%)\"\n }\n }\n );\n }, \"SwitchBubbleInput\")\n);\nfunction isFunction(value) {\n return typeof value === \"function\";\n}\n__name(isFunction, \"isFunction\");\nfunction getState(checked) {\n return checked ? \"checked\" : \"unchecked\";\n}\n__name(getState, \"getState\");\nexport {\n Switch as Root,\n Switch,\n SwitchThumb,\n SwitchThumb as Thumb,\n createSwitchScope,\n SwitchBubbleInput as unstable_BubbleInput,\n SwitchProvider as unstable_Provider,\n SwitchBubbleInput as unstable_SwitchBubbleInput,\n SwitchProvider as unstable_SwitchProvider,\n SwitchTrigger as unstable_SwitchTrigger,\n SwitchTrigger as unstable_Trigger\n};\n//# sourceMappingURL=index.mjs.map\n","import * as React from \"react\";\nimport * as SwitchPrimitives from \"@radix-ui/react-switch\";\nimport { cn } from \"../../utils/cn\";\n\nconst Switch = React.forwardRef<\n React.ElementRef<typeof SwitchPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>\n>(({ className, ...props }, ref) => (\n <SwitchPrimitives.Root\n ref={ref}\n className={cn(\n \"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-border transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-bg-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n >\n <SwitchPrimitives.Thumb\n className={cn(\n \"pointer-events-none block h-4 w-4 rounded-full bg-foreground shadow-lg transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0.5\",\n )}\n />\n </SwitchPrimitives.Root>\n));\nSwitch.displayName = SwitchPrimitives.Root.displayName;\n\nexport { Switch };\n"],"names":["__defProp","__name","target","value","canUseDOM","composeEventHandlers","originalEventHandler","ourEventHandler","checkForDefaultPrevented","event","getOwnerWindow","element","getOwnerDocument","getActiveElement","node","activeDescendant","activeElement","isFrame","id","setRef","ref","composeRefs","refs","hasCleanup","cleanups","cleanup","i","useComposedRefs","React.useCallback","createContext2","rootComponentName","defaultContext","Context","React.createContext","Provider","props","children","context","React.useMemo","jsx","useContext2","consumerName","options","optional","React.useContext","createContextScope","scopeName","createContextScopeDeps","defaultContexts","createContext3","BaseContext","index","scope","createScope","scopeContexts","contexts","composeContextScopes","scopes","baseScope","scopeHooks","createScope2","overrideScopes","nextScopes","nextScopes2","useScope","currentScope","useLayoutEffect2","React.useLayoutEffect","useReactEffectEvent","React","useReactInsertionEffect","useEffectEvent","callback","React.useRef","useLayoutEffect","args","useInsertionEffect","useControllableState","prop","defaultProp","onChange","caller","uncontrolledProp","setUncontrolledProp","onChangeRef","useUncontrolledState","isControlled","setValue","nextValue","value2","isFunction","React.useState","prevValueRef","React.useEffect","SYNC_STATE","useControllableStateReducer","reducer","userArgs","initialArg","init","controlledState","onChangeProp","internalState","dispatch","React2.useReducer","state2","action","next","uncontrolledState","React2.useRef","React2.useEffect","state","React2.useMemo","useSize","size","setSize","resizeObserver","entries","entry","width","height","borderSizeEntry","borderSize","createSlot","ownerName","Slot2","React.forwardRef","forwardedRef","slotProps","slottableElement","hasSlottable","newChildren","isLazyComponent","use","React.Children","maybeSlottable","isSlottable","slottable","child","getSlottableElementFromSlottable","React.cloneElement","React.isValidElement","slottableElementRef","getElementRef","composedRef","createSlottableError","createSlotError","mergedProps","mergeProps","React.Fragment","SLOTTABLE_IDENTIFIER","createSlottable","Slottable2","child2","childProps","overrideProps","propName","slotPropValue","childPropValue","result","getter","mayWarn","REACT_LAZY_TYPE","isPromiseLike","NODES","Primitive","primitive","Slot","Node","asChild","primitiveProps","Comp","dispatchDiscreteCustomEvent","ReactDOM.flushSync","SWITCH_NAME","createSwitchContext","createSwitchScope","SwitchProviderImpl","useSwitchContext","SwitchProvider","__scopeSwitch","checkedProp","defaultChecked","disabled","form","name","onCheckedChange","required","internal_do_not_use_render","checked","setChecked","control","setControl","bubbleInput","setBubbleInput","hasConsumerStoppedPropagationRef","userInteractionCount","onUserInteraction","React.useReducer","count","isFormControl","TRIGGER_NAME","SwitchTrigger","onClick","switchProps","composedRefs","initialCheckedStateRef","associatedForm","reset","getState","prevChecked","Switch","jsxs","Fragment","SwitchBubbleInput","THUMB_NAME","SwitchThumb","thumbProps","BUBBLE_INPUT_NAME","controlSize","shouldStopClickPropagationRef","prevCheckedRef","prevUserInteractionCountRef","input","inputProto","isUserInteraction","checkedChanged","bubbles","defaultCheckedRef","className","SwitchPrimitives.Root","cn","SwitchPrimitives.Thumb"],"mappings":"qEAAA,IAAIA,GAAY,OAAO,eACnBC,EAAS,CAACC,EAAQC,IAAUH,GAAUE,EAAQ,OAAQ,CAAE,MAAAC,EAAO,aAAc,GAAM,EAGnFC,EAAY,CAAC,EAAE,OAAO,OAAW,KAAe,OAAO,UAAY,OAAO,SAAS,eACvF,SAASC,EAAqBC,EAAsBC,EAAiB,CAAE,yBAAAC,EAA2B,EAAI,EAAK,GAAI,CAC7G,OAAuBP,EAAO,SAAqBQ,EAAO,CAExD,GADAH,IAAuBG,CAAK,EACxBD,IAA6B,IAAS,CAACC,GAAS,CAACA,EAAM,iBACzD,OAAOF,IAAkBE,CAAK,CAElC,EAAG,aAAa,CAClB,CACAR,EAAOI,EAAsB,sBAAsB,EACnD,SAASK,GAAeC,EAAS,CAC/B,GAAI,CAACP,EACH,MAAM,IAAI,MAAM,yCAAyC,EAE3D,OAA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CACxB,EACA,SAASjI,GAAWvF,EAAO,CACzB,OAAO,OAAOA,GAAU,UAC1B,CACAF,EAAOyF,GAAY,YAAY,EAC/B,SAASuH,EAASpB,EAAS,CACzB,OAAOA,EAAU,UAAY,WAC/B,CACA5L,EAAOgN,EAAU,UAAU,EC5Q3B,MAAME,GAASrF,EAAAA,WAGb,CAAC,CAAE,UAAAuG,EAAW,GAAGlM,CAAA,EAASf,IAC1BmB,EAAAA,IAAC+L,GAAA,CACC,IAAAlN,EACA,UAAWmN,EACT,wTACAF,CAAA,EAED,GAAGlM,EAEJ,SAAAI,EAAAA,IAACiM,GAAA,CACC,UAAWD,EACT,uKAAA,CACF,CAAA,CACF,CACF,CACD,EACDpB,GAAO,YAAcmB,GAAsB","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as a,k as m}from"./index-
|
|
2
|
-
//# sourceMappingURL=toggle-
|
|
1
|
+
import{j as a,k as m}from"./index-GPHRnEN7.js";function u({pressed:r,onPressedChange:t,className:e,onClick:n,...o}){return a.jsx("button",{type:"button","aria-pressed":r,onClick:i=>{n?.(i),t?.(!r)},className:m("inline-flex items-center justify-center rounded-md border px-3 py-1.5 text-sm font-medium transition-all",r?"border-primary/50 bg-primary/15 text-neon glow-primary":"border-border bg-transparent text-muted hover:text-foreground",e),...o})}export{u as T};
|
|
2
|
+
//# sourceMappingURL=toggle-C9HpkIfH.js.map
|
package/extensions/dashboard-client/dist/assets/{toggle-KdBnFLu3.js.map → toggle-C9HpkIfH.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-
|
|
1
|
+
{"version":3,"file":"toggle-C9HpkIfH.js","sources":["../../src/components/ui/toggle.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface ToggleProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n pressed?: boolean;\n onPressedChange?: (pressed: boolean) => void;\n}\n\nexport function Toggle({ pressed, onPressedChange, className, onClick, ...props }: ToggleProps) {\n return (\n <button\n type=\"button\"\n aria-pressed={pressed}\n onClick={(e) => {\n onClick?.(e);\n onPressedChange?.(!pressed);\n }}\n className={cn(\n \"inline-flex items-center justify-center rounded-md border px-3 py-1.5 text-sm font-medium transition-all\",\n pressed\n ? \"border-primary/50 bg-primary/15 text-neon glow-primary\"\n : \"border-border bg-transparent text-muted hover:text-foreground\",\n className,\n )}\n {...props}\n />\n );\n}\n"],"names":["Toggle","pressed","onPressedChange","className","onClick","props","jsx","e","cn"],"mappings":"+CAQO,SAASA,EAAO,CAAE,QAAAC,EAAS,gBAAAC,EAAiB,UAAAC,EAAW,QAAAC,EAAS,GAAGC,GAAsB,CAC9F,OACEC,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,eAAcL,EACd,QAAUM,GAAM,CACdH,IAAUG,CAAC,EACXL,IAAkB,CAACD,CAAO,CAC5B,EACA,UAAWO,EACT,2GACAP,EACI,yDACA,gEACJE,CAAA,EAED,GAAGE,CAAA,CAAA,CAGV"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./index-
|
|
2
|
-
//# sourceMappingURL=useSSE-
|
|
1
|
+
import{r as e}from"./index-GPHRnEN7.js";function R(i={}){const{maxEvents:c=500,maxReconnects:l=5}=i,[f,v]=e.useState([]),[E,n]=e.useState("connecting"),[S,p]=e.useState(0),[m,d]=e.useState(null),o=e.useRef(0),s=e.useRef(null),r=e.useCallback(()=>{s.current&&s.current.close(),n("connecting");const t=new EventSource("/api/events");s.current=t,t.onopen=()=>{n("connected"),o.current=0},t.onmessage=g=>{try{const x=JSON.parse(g.data);v(u=>{const a=[...u,x];return a.length>c?a.slice(-c):a}),p(u=>u+1),d(Date.now())}catch{}},t.onerror=()=>{t.close(),o.current<l?(o.current+=1,n("connecting"),setTimeout(r,1e3)):n("disconnected")}},[c,l]);return e.useEffect(()=>(r(),()=>{s.current?.close()}),[r]),{events:f,status:E,eventCount:S,lastEventAt:m}}export{R as u};
|
|
2
|
+
//# sourceMappingURL=useSSE-2JFrLDlE.js.map
|
package/extensions/dashboard-client/dist/assets/{useSSE-B6t44vzc.js.map → useSSE-2JFrLDlE.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSSE-
|
|
1
|
+
{"version":3,"file":"useSSE-2JFrLDlE.js","sources":["../../src/hooks/useSSE.ts"],"sourcesContent":["/**\n * dashboard-client/src/hooks/useSSE.ts — Server-Sent Events hook.\n *\n * Connects to /api/events, provides real-time event stream.\n * SPRINT-B1: basic connection. SPRINT-D1: reconnect with backoff.\n */\n\nimport { useState, useEffect, useRef, useCallback } from 'react';\nimport type { SseEvent } from '../../../dashboard-server/api-contracts';\n\nexport type SseStatus = 'connecting' | 'connected' | 'disconnected' | 'error';\n\nexport interface UseSSEResult {\n events: SseEvent[];\n status: SseStatus;\n eventCount: number;\n lastEventAt: number | null;\n}\n\nexport interface UseSSEOptions {\n /** Max events to keep in memory (ring buffer). */\n maxEvents?: number;\n /** Max reconnect attempts before giving up. */\n maxReconnects?: number;\n}\n\n// SPRINT-D1-REMAINING: exponential backoff (1s → 2s → 4s → max 30s).\n// SPRINT-D1-REMAINING: after 5 failures, set status='disconnected'.\n\nexport function useSSE(options: UseSSEOptions = {}): UseSSEResult {\n const { maxEvents = 500, maxReconnects = 5 } = options;\n const [events, setEvents] = useState<SseEvent[]>([]);\n const [status, setStatus] = useState<SseStatus>('connecting');\n const [eventCount, setEventCount] = useState(0);\n const [lastEventAt, setLastEventAt] = useState<number | null>(null);\n const reconnectCount = useRef(0);\n const sourceRef = useRef<EventSource | null>(null);\n\n const connect = useCallback(() => {\n if (sourceRef.current) {\n sourceRef.current.close();\n }\n setStatus('connecting');\n const source = new EventSource('/api/events');\n sourceRef.current = source;\n\n source.onopen = () => {\n setStatus('connected');\n reconnectCount.current = 0;\n };\n\n source.onmessage = (event) => {\n try {\n const parsed = JSON.parse(event.data) as SseEvent;\n setEvents(prev => {\n const next = [...prev, parsed];\n return next.length > maxEvents ? next.slice(-maxEvents) : next;\n });\n setEventCount(c => c + 1);\n setLastEventAt(Date.now());\n } catch {\n // non-fatal: skip malformed events\n }\n };\n\n source.onerror = () => {\n source.close();\n if (reconnectCount.current < maxReconnects) {\n reconnectCount.current += 1;\n setStatus('connecting');\n // SPRINT-D1: use exponential backoff instead of fixed delay\n setTimeout(connect, 1000);\n } else {\n setStatus('disconnected');\n }\n };\n }, [maxEvents, maxReconnects]);\n\n useEffect(() => {\n connect();\n return () => {\n sourceRef.current?.close();\n };\n }, [connect]);\n\n return { events, status, eventCount, lastEventAt };\n}\n"],"names":["useSSE","options","maxEvents","maxReconnects","events","setEvents","useState","status","setStatus","eventCount","setEventCount","lastEventAt","setLastEventAt","reconnectCount","useRef","sourceRef","connect","useCallback","source","event","parsed","prev","next","c","useEffect"],"mappings":"wCA6BO,SAASA,EAAOC,EAAyB,GAAkB,CAChE,KAAM,CAAE,UAAAC,EAAY,IAAK,cAAAC,EAAgB,GAAMF,EACzC,CAACG,EAAQC,CAAS,EAAIC,EAAAA,SAAqB,CAAA,CAAE,EAC7C,CAACC,EAAQC,CAAS,EAAIF,EAAAA,SAAoB,YAAY,EACtD,CAACG,EAAYC,CAAa,EAAIJ,EAAAA,SAAS,CAAC,EACxC,CAACK,EAAaC,CAAc,EAAIN,EAAAA,SAAwB,IAAI,EAC5DO,EAAiBC,EAAAA,OAAO,CAAC,EACzBC,EAAYD,EAAAA,OAA2B,IAAI,EAE3CE,EAAUC,EAAAA,YAAY,IAAM,CAC5BF,EAAU,SACZA,EAAU,QAAQ,MAAA,EAEpBP,EAAU,YAAY,EACtB,MAAMU,EAAS,IAAI,YAAY,aAAa,EAC5CH,EAAU,QAAUG,EAEpBA,EAAO,OAAS,IAAM,CACpBV,EAAU,WAAW,EACrBK,EAAe,QAAU,CAC3B,EAEAK,EAAO,UAAaC,GAAU,CAC5B,GAAI,CACF,MAAMC,EAAS,KAAK,MAAMD,EAAM,IAAI,EACpCd,EAAUgB,GAAQ,CAChB,MAAMC,EAAO,CAAC,GAAGD,EAAMD,CAAM,EAC7B,OAAOE,EAAK,OAASpB,EAAYoB,EAAK,MAAM,CAACpB,CAAS,EAAIoB,CAC5D,CAAC,EACDZ,EAAca,GAAKA,EAAI,CAAC,EACxBX,EAAe,KAAK,KAAK,CAC3B,MAAQ,CAER,CACF,EAEAM,EAAO,QAAU,IAAM,CACrBA,EAAO,MAAA,EACHL,EAAe,QAAUV,GAC3BU,EAAe,SAAW,EAC1BL,EAAU,YAAY,EAEtB,WAAWQ,EAAS,GAAI,GAExBR,EAAU,cAAc,CAE5B,CACF,EAAG,CAACN,EAAWC,CAAa,CAAC,EAE7BqB,OAAAA,EAAAA,UAAU,KACRR,EAAA,EACO,IAAM,CACXD,EAAU,SAAS,MAAA,CACrB,GACC,CAACC,CAAO,CAAC,EAEL,CAAE,OAAAZ,EAAQ,OAAAG,EAAQ,WAAAE,EAAY,YAAAE,CAAA,CACvC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>mega-compact dashboard</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-GPHRnEN7.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="./assets/index-CUA6EDRF.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -17,6 +17,7 @@ import type { IndexRepo, IndexIndex } from "./types.js";
|
|
|
17
17
|
import {
|
|
18
18
|
readProviderCacheForRepo,
|
|
19
19
|
} from "../../src/store/sqlite/perf-samples.js";
|
|
20
|
+
import { lookupModelInputRate } from "../../src/pricing.js";
|
|
20
21
|
|
|
21
22
|
export function getIndexDir(): string {
|
|
22
23
|
const override = process.env.MEGACOMPACT_INDEX_DIR;
|
|
@@ -51,7 +52,8 @@ export function readIndex(): IndexIndex | null {
|
|
|
51
52
|
provider: (r.provider as string | null) ?? null,
|
|
52
53
|
providerName: (r.provider_name as string | null) ?? null,
|
|
53
54
|
modelName: (r.model_name as string | null) ?? null,
|
|
54
|
-
inputRate: (r.input_rate as number | null)
|
|
55
|
+
inputRate: ((r.input_rate as number | null) ||
|
|
56
|
+
lookupModelInputRate(String(r.model_name ?? ""))) ?? null,
|
|
55
57
|
outputRate: (r.output_rate as number | null) ?? null,
|
|
56
58
|
lastSeen: Number(r.last_seen ?? 0),
|
|
57
59
|
// Defaults — enriched below from each repo's own store.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dashboard-server/resolve-snapshot.ts — dynamic per-repo snapshot resolver.
|
|
3
|
+
*
|
|
4
|
+
* The dashboard server is launched with a single static stateDir, but the
|
|
5
|
+
* active pi session may be running in a different repo. This module queries
|
|
6
|
+
* the repo registry to find the most recently active repo's dashboard.json,
|
|
7
|
+
* so the Overview always shows live data from the repo pi is actually running
|
|
8
|
+
* in — not the stale launcher dir.
|
|
9
|
+
*
|
|
10
|
+
* Resolution order:
|
|
11
|
+
* 1. Most recently seen repo (by last_seen in repo_registry) whose
|
|
12
|
+
* dashboard.json exists and has a non-null updatedAt
|
|
13
|
+
* 2. The static launch stateDir's dashboard.json (original behavior)
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { existsSync } from "node:fs";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
import { createRequire } from "node:module";
|
|
19
|
+
import { readSnapshot } from "./snapshot.js";
|
|
20
|
+
import type { Snapshot } from "./types.js";
|
|
21
|
+
import { getIndexDir } from "./index-reader.js";
|
|
22
|
+
|
|
23
|
+
export interface ResolvedSnapshot {
|
|
24
|
+
snapshot: Snapshot;
|
|
25
|
+
/** The stateDir that produced this snapshot. */
|
|
26
|
+
stateDir: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const require = createRequire(import.meta.url);
|
|
30
|
+
|
|
31
|
+
interface RepoRegistryRow {
|
|
32
|
+
state_dir: string;
|
|
33
|
+
last_seen: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Find the most recently active repo's stateDir by scanning the repo registry
|
|
38
|
+
* for repos whose dashboard.json exists and was written recently. Returns null
|
|
39
|
+
* if no suitable repo is found.
|
|
40
|
+
*/
|
|
41
|
+
function mostRecentRepoStateDir(staticStateDir: string): string | null {
|
|
42
|
+
const indexPath = join(getIndexDir(), "index.sqlite");
|
|
43
|
+
if (!existsSync(indexPath)) return null;
|
|
44
|
+
let db;
|
|
45
|
+
try {
|
|
46
|
+
const { DatabaseSync } = require("node:sqlite") as typeof import("node:sqlite");
|
|
47
|
+
db = new DatabaseSync(indexPath, { readOnly: true });
|
|
48
|
+
const rows = db
|
|
49
|
+
.prepare(
|
|
50
|
+
`SELECT state_dir, last_seen FROM repo_registry
|
|
51
|
+
WHERE state_dir IS NOT NULL AND state_dir != ?
|
|
52
|
+
ORDER BY last_seen DESC`,
|
|
53
|
+
)
|
|
54
|
+
.all(staticStateDir) as unknown as RepoRegistryRow[];
|
|
55
|
+
for (const r of rows) {
|
|
56
|
+
const dashPath = join(r.state_dir, "dashboard.json");
|
|
57
|
+
if (!existsSync(dashPath)) continue;
|
|
58
|
+
const snap = readSnapshot(dashPath);
|
|
59
|
+
if (snap.updatedAt) {
|
|
60
|
+
return r.state_dir;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
} catch {
|
|
65
|
+
return null;
|
|
66
|
+
} finally {
|
|
67
|
+
try {
|
|
68
|
+
db?.close();
|
|
69
|
+
} catch {
|
|
70
|
+
/* ignore */
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Resolve the best snapshot to serve. Tries the most recently active repo's
|
|
77
|
+
* dashboard.json first, then falls back to the static launch path.
|
|
78
|
+
*/
|
|
79
|
+
export function resolveSnapshot(
|
|
80
|
+
staticSnapshotPath: string,
|
|
81
|
+
staticStateDir: string,
|
|
82
|
+
): ResolvedSnapshot {
|
|
83
|
+
// Try the most recently active repo first.
|
|
84
|
+
const activeDir = mostRecentRepoStateDir(staticStateDir);
|
|
85
|
+
if (activeDir) {
|
|
86
|
+
const activePath = join(activeDir, "dashboard.json");
|
|
87
|
+
const snap = readSnapshot(activePath);
|
|
88
|
+
if (snap.updatedAt) {
|
|
89
|
+
return { snapshot: snap, stateDir: activeDir };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Fall back to the static launch path.
|
|
93
|
+
return {
|
|
94
|
+
snapshot: readSnapshot(staticSnapshotPath),
|
|
95
|
+
stateDir: staticStateDir,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import type { ServerResponse } from "node:http";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { resolveSnapshot } from "./resolve-snapshot.js";
|
|
12
12
|
import type { IndexIndex, Snapshot } from "./types.js";
|
|
13
13
|
|
|
14
14
|
// ---------------------------------------------------------------------------
|
|
@@ -53,14 +53,19 @@ function makeOverlayCurrentRepo(
|
|
|
53
53
|
): (idx: IndexIndex | null) => void {
|
|
54
54
|
return (idx: IndexIndex | null): void => {
|
|
55
55
|
if (!idx || !idx.repos.length) return;
|
|
56
|
+
// Dynamically resolve the most recently active repo's snapshot so the
|
|
57
|
+
// overlay matches what /api/snapshot serves (not the stale launch dir).
|
|
56
58
|
let snap: Snapshot | null = null;
|
|
59
|
+
let activeStateDir = stateDir;
|
|
57
60
|
try {
|
|
58
|
-
|
|
61
|
+
const resolved = resolveSnapshot(snapshotPath, stateDir);
|
|
62
|
+
snap = resolved.snapshot;
|
|
63
|
+
activeStateDir = resolved.stateDir;
|
|
59
64
|
} catch {
|
|
60
65
|
return;
|
|
61
66
|
}
|
|
62
67
|
if (!snap || !snap.repo) return;
|
|
63
|
-
const cur = idx.repos.find((r) => r.stateDir ===
|
|
68
|
+
const cur = idx.repos.find((r) => r.stateDir === activeStateDir);
|
|
64
69
|
if (!cur) return;
|
|
65
70
|
const prevSaved = cur.tokensSaved;
|
|
66
71
|
const prevCp = cur.checkpointCount;
|