texlite 0.16.0 → 0.17.0
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/DESIGN.md +87 -5
- package/OPERATIONS.md +27 -0
- package/dist/client/assets/AdminUsers-5cAOkdRO.js +1 -0
- package/dist/client/assets/CitationLibraryDialog-G2kKkA2f.js +1 -0
- package/dist/client/assets/Dashboard-BJDFbzQa.js +5 -0
- package/dist/client/assets/GitDialog-BEtLh2S_.js +3 -0
- package/dist/client/assets/GitHubAccountDialog-D2kdCzOs.js +1 -0
- package/dist/client/assets/{HistoryDialog-DWYErBwj.js → HistoryDialog-BwxDdj-j.js} +3 -3
- package/dist/client/assets/LatexEditor-sMjmvA6V.js +141 -0
- package/dist/client/assets/{PdfPreview-BjghzUb1.js → PdfPreview-z5KnowpL.js} +1 -1
- package/dist/client/assets/ProjectIconPickerDialog-DNV7M7vH.js +1 -0
- package/dist/client/assets/ProjectSettings-Mf8zDGRu.js +1 -0
- package/dist/client/assets/ProjectWorkspace-BJFxjMCn.js +32 -0
- package/dist/client/assets/QuickOpenDialog-C758pouQ.js +1 -0
- package/dist/client/assets/{SelectionHistoryDialog-CR5c3I8k.js → SelectionHistoryDialog-p8L2n4RS.js} +2 -2
- package/dist/client/assets/SystemMetricsDialog-DDiSuglF.js +1 -0
- package/dist/client/assets/TagManagementDialog-BTVERmQS.js +1 -0
- package/dist/client/assets/WordCountDialog-B6RvAI6V.js +1 -0
- package/dist/client/assets/check-Hlb-tLSh.js +1 -0
- package/dist/client/assets/chevron-up-D0psXvTv.js +1 -0
- package/dist/client/assets/chktex-ZnIx425m.js +3 -0
- package/dist/client/assets/clock-3-C71NmJZI.js +1 -0
- package/dist/client/assets/{editor-CLY5CgkY.js → editor-_i6aPXT4.js} +1 -1
- package/dist/client/assets/eye-swovgNYS.js +1 -0
- package/dist/client/assets/github-y6i0qxSV.js +1 -0
- package/dist/client/assets/{hard-drive-Ctj3K_zx.js → hard-drive-BqcHPdoY.js} +1 -1
- package/dist/client/assets/index-7WrjzKvC.js +5 -0
- package/dist/client/assets/index-C5T8_lAl.js +1 -0
- package/dist/client/assets/index-DF5cor0N.js +10 -0
- package/dist/client/assets/index-Do5FsFqg.js +1 -0
- package/dist/client/assets/index-Y-wXUwwe.css +1 -0
- package/dist/client/assets/{minimize-2-BiVyoWZA.js → minimize-2-CK7jUy7-.js} +1 -1
- package/dist/client/assets/{minus-Bl8l4LXq.js → minus-B2sswwWT.js} +1 -1
- package/dist/client/assets/{plus-CCxK-HNt.js → plus-Co7iyp5m.js} +1 -1
- package/dist/client/assets/{refresh-cw-BE8IbaHI.js → refresh-cw-BHVcjInn.js} +1 -1
- package/dist/client/assets/{search-CPbhRWQE.js → search-Tpi6WAga.js} +1 -1
- package/dist/client/assets/{sigma-LxGD9tK2.js → sigma-DoHJQYf7.js} +1 -1
- package/dist/client/assets/spellCheck-BSbFJY9f.js +1 -0
- package/dist/client/assets/{tags-DuN89PsZ.js → tags-BHDlIcSb.js} +1 -1
- package/dist/client/assets/{type-BiettCiY.js → type-C-6Jq_0r.js} +1 -1
- package/dist/client/index.html +15 -3
- package/dist/server/app.js +6 -1
- package/dist/server/cgroups.js +35 -0
- package/dist/server/compilerVersions.js +46 -0
- package/dist/server/config.js +8 -0
- package/dist/server/cpuMetrics.js +122 -0
- package/dist/server/db.js +13 -0
- package/dist/server/environment.js +11 -0
- package/dist/server/i18n.js +0 -2
- package/dist/server/resourceMetrics.js +214 -0
- package/dist/server/routes/projectFiles.js +1 -59
- package/dist/server/routes/system.js +32 -1
- package/dist/server/systemMemory.js +51 -0
- package/dist/server/updates.js +116 -0
- package/dist/shared/compilerVersions.js +11 -0
- package/dist/shared/resourceMetrics.js +1 -0
- package/dist/shared/updates.js +5 -0
- package/package.json +3 -1
- package/texlite.config.example.json +3 -0
- package/dist/client/assets/AdminUsers-Dyapv-3c.js +0 -1
- package/dist/client/assets/CitationLibraryDialog-CU7Q7r0Z.js +0 -1
- package/dist/client/assets/Dashboard-DsdhFENx.js +0 -2
- package/dist/client/assets/GitDialog-CZpnKw-J.js +0 -3
- package/dist/client/assets/GitHubAccountDialog-CZ8O_PjD.js +0 -1
- package/dist/client/assets/LatexEditor-CssVgypt.js +0 -141
- package/dist/client/assets/ProjectIconPickerDialog-CqRmgFBM.js +0 -1
- package/dist/client/assets/ProjectNavigationDialogs-BZxI3PJO.js +0 -1
- package/dist/client/assets/ProjectSettings-CZE_xDKn.js +0 -1
- package/dist/client/assets/ProjectWorkspace-CAX3qEYr.js +0 -32
- package/dist/client/assets/SystemMetricsDialog-DDpFwgXh.js +0 -1
- package/dist/client/assets/TagManagementDialog-CXLA9h_j.js +0 -1
- package/dist/client/assets/WordCountDialog-DUyR24vv.js +0 -1
- package/dist/client/assets/check-CwBYzomT.js +0 -1
- package/dist/client/assets/chevron-up-D5lCNKlk.js +0 -1
- package/dist/client/assets/chktex-CRkLYKcV.js +0 -3
- package/dist/client/assets/external-link-C9Td1CCj.js +0 -1
- package/dist/client/assets/github-D-JDXb-w.js +0 -1
- package/dist/client/assets/index-9hnQ8Q9x.js +0 -5
- package/dist/client/assets/index-C0qg2Ylw.css +0 -1
- package/dist/client/assets/index-DkpU9Fgs.js +0 -10
- package/dist/client/assets/index-_eYe7K9T.js +0 -1
- package/dist/client/assets/spellCheck-hpm8qZTr.js +0 -1
- package/dist/client/assets/x-C_3swJOC.js +0 -1
- package/dist/server/projectSearch.js +0 -113
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as hr,u as z,x as Ie,m as ge,o as N,p as pe,t as St,q as Sn,v as gr,w as vr}from"./index-DkpU9Fgs.js";import{r as c,R as De,j as C,a as Me,b as yr}from"./react-CltQJflK.js";const Fc=hr("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);var br=Object.defineProperty,Y=(e,t)=>br(e,"name",{value:t,configurable:!0});function Cn(e){const t=c.forwardRef((n,o)=>{let{children:r,...s}=n,i=null,a=!1;const u=[];Ct(r)&&typeof Ke=="function"&&(r=Ke(r._payload)),c.Children.forEach(r,d=>{if(An(d)){a=!0;const p=d;let m="child"in p.props?p.props.child:p.props.children;Ct(m)&&typeof Ke=="function"&&(m=Ke(m._payload)),i=xr(p,m),u.push(i?.props?.children)}else u.push(d)}),i?i=c.cloneElement(i,void 0,u):!a&&c.Children.count(r)===1&&c.isValidElement(r)&&(i=r);const l=i?On(i):void 0,h=z(o,l);if(!i){if(r||r===0)throw new Error(a?Cr(e):Sr(e));return r}const f=Pn(s,i.props??{});return i.type!==c.Fragment&&(f.ref=o?h:l),c.cloneElement(i,f)});return t.displayName=`${e}.Slot`,t}Y(Cn,"createSlot");var Rn=Symbol.for("radix.slottable");function wr(e){const t=Y(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=Rn,t}Y(wr,"createSlottable");var xr=Y((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 Pn(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]=(...a)=>{const u=s(...a);return r(...a),u}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"?n[o]=[r,s].filter(Boolean).join(" "):o==="aria-describedby"&&(n[o]=In(s,r))}return{...e,...n}}Y(Pn,"mergeProps");function On(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)}Y(On,"getElementRef");function An(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Rn}Y(An,"isSlottable");var Er=Symbol.for("react.lazy");function Ct(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Er&&"_payload"in e&&_n(e._payload)}Y(Ct,"isLazyComponent");function _n(e){return typeof e=="object"&&e!==null&&"then"in e}Y(_n,"isPromiseLike");function In(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const o of String(n).trim().split(/\s+/))o&&t.add(o);return t.size>0?Array.from(t).join(" "):void 0}Y(In,"concatAriaDescribedby");var Sr=Y(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Cr=Y(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Ke=De[" use ".trim().toString()],Rr=Object.defineProperty,Pr=(e,t)=>Rr(e,"name",{value:t,configurable:!0}),Or=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ar=Or.reduce((e,t)=>{const n=Cn(`Primitive.${t}`),o=c.forwardRef((r,s)=>{const{asChild:i,...a}=r,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),C.jsx(u,{...a,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function _r(e,t){e&&Me.flushSync(()=>e.dispatchEvent(t))}Pr(_r,"dispatchDiscreteCustomEvent");var Ir=Object.defineProperty,X=(e,t)=>Ir(e,"name",{value:t,configurable:!0});function Le(e){const t=c.forwardRef((n,o)=>{let{children:r,...s}=n,i=null,a=!1;const u=[];Rt(r)&&typeof Ge=="function"&&(r=Ge(r._payload)),c.Children.forEach(r,d=>{if($n(d)){a=!0;const p=d;let m="child"in p.props?p.props.child:p.props.children;Rt(m)&&typeof Ge=="function"&&(m=Ge(m._payload)),i=Mr(p,m),u.push(i?.props?.children)}else u.push(d)}),i?i=c.cloneElement(i,void 0,u):!a&&c.Children.count(r)===1&&c.isValidElement(r)&&(i=r);const l=i?Tn(i):void 0,h=z(o,l);if(!i){if(r||r===0)throw new Error(a?Fr(e):$r(e));return r}const f=Mn(s,i.props??{});return i.type!==c.Fragment&&(f.ref=o?h:l),c.cloneElement(i,f)});return t.displayName=`${e}.Slot`,t}X(Le,"createSlot");var Dn=Symbol.for("radix.slottable");function Dr(e){const t=X(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=Dn,t}X(Dr,"createSlottable");var Mr=X((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 Mn(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]=(...a)=>{const u=s(...a);return r(...a),u}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"?n[o]=[r,s].filter(Boolean).join(" "):o==="aria-describedby"&&(n[o]=Ln(s,r))}return{...e,...n}}X(Mn,"mergeProps");function Tn(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)}X(Tn,"getElementRef");function $n(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Dn}X($n,"isSlottable");var Tr=Symbol.for("react.lazy");function Rt(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Tr&&"_payload"in e&&Fn(e._payload)}X(Rt,"isLazyComponent");function Fn(e){return typeof e=="object"&&e!==null&&"then"in e}X(Fn,"isPromiseLike");function Ln(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const o of String(n).trim().split(/\s+/))o&&t.add(o);return t.size>0?Array.from(t).join(" "):void 0}X(Ln,"concatAriaDescribedby");var $r=X(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Fr=X(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Ge=De[" use ".trim().toString()],Lr=Object.defineProperty,H=(e,t)=>Lr(e,"name",{value:t,configurable:!0});function Wt(e){const t=e+"CollectionProvider",[n,o]=Ie(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=H(v=>{const{scope:w,children:y}=v,x=c.useRef(null),g=c.useRef(new Map).current;return C.jsx(r,{scope:w,itemMap:g,collectionRef:x,children:y})},"CollectionProvider");i.displayName=t;const a=e+"CollectionSlot",u=Le(a),l=c.forwardRef((v,w)=>{const{scope:y,children:x}=v,g=s(a,y),b=z(w,g.collectionRef);return C.jsx(u,{ref:b,children:x})});l.displayName=a;const h=e+"CollectionItemSlot",f="data-radix-collection-item",d=Le(h),p=c.forwardRef((v,w)=>{const{scope:y,children:x,...g}=v,b=c.useRef(null),S=z(w,b),E=s(h,y);return c.useEffect(()=>(E.itemMap.set(b,{ref:b,...g}),()=>{E.itemMap.delete(b)})),C.jsx(d,{[f]:"",ref:S,children:x})});p.displayName=h;function m(v){const w=s(e+"CollectionConsumer",v);return c.useCallback(()=>{const x=w.collectionRef.current;if(!x)return[];const g=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(w.itemMap.values()).sort((E,R)=>g.indexOf(E.ref.current)-g.indexOf(R.ref.current))},[w.collectionRef,w.itemMap])}return H(m,"useCollection"),[{Provider:i,Slot:l,ItemSlot:p},m,o]}H(Wt,"createCollection");var rn=new WeakMap,ht=class de extends Map{static{H(this,"OrderedDict")}#e;constructor(t){super(t),this.#e=[...super.keys()],rn.set(this,!0)}set(t,n){return rn.get(this)&&(this.has(t)?this.#e[this.#e.indexOf(t)]=t:this.#e.push(t)),super.set(t,n),this}insert(t,n,o){const r=this.has(n),s=this.#e.length,i=Vt(t);let a=i>=0?i:s+i;const u=a<0||a>=s?-1:a;if(u===this.size||r&&u===this.size-1||u===-1)return this.set(n,o),this;const l=this.size+(r?0:1);i<0&&a++;const h=[...this.#e];let f,d=!1;for(let p=a;p<l;p++)if(a===p){let m=h[p];h[p]===n&&(m=h[p+1]),r&&this.delete(n),f=this.get(m),this.set(n,o)}else{!d&&h[p-1]===n&&(d=!0);const m=h[d?p:p-1],v=f;f=this.get(m),this.delete(m),this.set(m,v)}return this}with(t,n,o){const r=new de(this);return r.insert(t,n,o),r}before(t){const n=this.#e.indexOf(t)-1;if(!(n<0))return this.entryAt(n)}setBefore(t,n,o){const r=this.#e.indexOf(t);return r===-1?this:this.insert(r,n,o)}after(t){let n=this.#e.indexOf(t);if(n=n===-1||n===this.size-1?-1:n+1,n!==-1)return this.entryAt(n)}setAfter(t,n,o){const r=this.#e.indexOf(t);return r===-1?this:this.insert(r+1,n,o)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(t){const n=super.delete(t);return n&&this.#e.splice(this.#e.indexOf(t),1),n}deleteAt(t){const n=this.keyAt(t);return n!==void 0?this.delete(n):!1}at(t){const n=Je(this.#e,t);if(n!==void 0)return this.get(n)}entryAt(t){const n=Je(this.#e,t);if(n!==void 0)return[n,this.get(n)]}indexOf(t){return this.#e.indexOf(t)}keyAt(t){return Je(this.#e,t)}from(t,n){const o=this.indexOf(t);if(o===-1)return;let r=o+n;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(t,n){const o=this.indexOf(t);if(o===-1)return;let r=o+n;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(t,n){let o=0;for(const r of this){if(Reflect.apply(t,n,[r,o,this]))return r;o++}}findIndex(t,n){let o=0;for(const r of this){if(Reflect.apply(t,n,[r,o,this]))return o;o++}return-1}filter(t,n){const o=[];let r=0;for(const s of this)Reflect.apply(t,n,[s,r,this])&&o.push(s),r++;return new de(o)}map(t,n){const o=[];let r=0;for(const s of this)o.push([s[0],Reflect.apply(t,n,[s,r,this])]),r++;return new de(o)}reduce(...t){const[n,o]=t;let r=0,s=o??this.at(0);for(const i of this)r===0&&t.length===1?s=i:s=Reflect.apply(n,this,[s,i,r,this]),r++;return s}reduceRight(...t){const[n,o]=t;let r=o??this.at(-1);for(let s=this.size-1;s>=0;s--){const i=this.at(s);s===this.size-1&&t.length===1?r=i:r=Reflect.apply(n,this,[r,i,s,this])}return r}toSorted(t){const n=[...this.entries()].sort(t);return new de(n)}toReversed(){const t=new de;for(let n=this.size-1;n>=0;n--){const o=this.keyAt(n),r=this.get(o);t.set(o,r)}return t}toSpliced(...t){const n=[...this.entries()];return n.splice(...t),new de(n)}slice(t,n){const o=new de;let r=this.size-1;if(t===void 0)return o;t<0&&(t=t+this.size),n!==void 0&&n>0&&(r=n-1);for(let s=t;s<=r;s++){const i=this.keyAt(s),a=this.get(i);o.set(i,a)}return o}every(t,n){let o=0;for(const r of this){if(!Reflect.apply(t,n,[r,o,this]))return!1;o++}return!0}some(t,n){let o=0;for(const r of this){if(Reflect.apply(t,n,[r,o,this]))return!0;o++}return!1}};function Je(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=Nn(e,t);return n===-1?void 0:e[n]}H(Je,"at");function Nn(e,t){const n=e.length,o=Vt(t),r=o>=0?o:n+o;return r<0||r>=n?-1:r}H(Nn,"toSafeIndex");function Vt(e){return e!==e||e===0?0:Math.trunc(e)}H(Vt,"toSafeInteger");function Nr(e){const t=e+"CollectionProvider",[n,o]=Ie(t),[r,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new ht,setItemMap:H(()=>{},"setItemMap")}),i=H(({state:g,...b})=>g?C.jsx(u,{...b,state:g}):C.jsx(a,{...b}),"CollectionProvider");i.displayName=t;const a=H(g=>{const b=w();return C.jsx(u,{...g,state:b})},"CollectionInit");a.displayName=t+"Init";const u=H(g=>{const{scope:b,children:S,state:E}=g,R=c.useRef(null),[P,O]=c.useState(null),T=z(R,O),[L,_]=E;return c.useEffect(()=>{if(!P)return;const M=Wn(()=>{});return M.observe(P,{childList:!0,subtree:!0}),()=>{M.disconnect()}},[P]),C.jsx(r,{scope:b,itemMap:L,setItemMap:_,collectionRef:T,collectionRefObject:R,collectionElement:P,children:S})},"CollectionProviderImpl");u.displayName=t+"Impl";const l=e+"CollectionSlot",h=Le(l),f=c.forwardRef((g,b)=>{const{scope:S,children:E}=g,R=s(l,S),P=z(b,R.collectionRef);return C.jsx(h,{ref:P,children:E})});f.displayName=l;const d=e+"CollectionItemSlot",p="data-radix-collection-item",m=Le(d),v=c.forwardRef((g,b)=>{const{scope:S,children:E,...R}=g,P=c.useRef(null),[O,T]=c.useState(null),L=z(b,P,T),_=s(d,S),{setItemMap:M}=_,$=c.useRef(R);jn($.current,R)||($.current=R);const k=$.current;return c.useEffect(()=>{const F=k;return M(D=>O?D.has(O)?D.set(O,{...F,element:O}).toSorted(Pt):(D.set(O,{...F,element:O}),D.toSorted(Pt)):D),()=>{M(D=>!O||!D.has(O)?D:(D.delete(O),new ht(D)))}},[O,k,M]),C.jsx(m,{[p]:"",ref:L,children:E})});v.displayName=d;function w(){return c.useState(new ht)}H(w,"useInitCollection");function y(g){const{itemMap:b}=s(e+"CollectionConsumer",g);return b}return H(y,"useCollection"),[{Provider:i,Slot:f,ItemSlot:v},{createCollectionScope:o,useCollection:y,useInitCollection:w}]}H(Nr,"createCollection");function jn(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}H(jn,"shallowEqual");function kn(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}H(kn,"isElementPreceding");function Pt(e,t){return!e[1].element||!t[1].element?0:kn(e[1].element,t[1].element)?-1:1}H(Pt,"sortByDocumentPosition");function Wn(e){return new MutationObserver(n=>{for(const o of n)if(o.type==="childList"){e();return}})}H(Wn,"getChildListObserver");var jr=Object.defineProperty,kr=(e,t)=>jr(e,"name",{value:t,configurable:!0}),Wr={LTR:"ltr"},Vr=c.createContext(void 0);function zt(e){const t=c.useContext(Vr);return e||t||Wr.LTR}kr(zt,"useDirection");var zr=Object.defineProperty,Z=(e,t)=>zr(e,"name",{value:t,configurable:!0});function Bt(e){const t=c.forwardRef((n,o)=>{let{children:r,...s}=n,i=null,a=!1;const u=[];Ot(r)&&typeof Ye=="function"&&(r=Ye(r._payload)),c.Children.forEach(r,d=>{if(Hn(d)){a=!0;const p=d;let m="child"in p.props?p.props.child:p.props.children;Ot(m)&&typeof Ye=="function"&&(m=Ye(m._payload)),i=Hr(p,m),u.push(i?.props?.children)}else u.push(d)}),i?i=c.cloneElement(i,void 0,u):!a&&c.Children.count(r)===1&&c.isValidElement(r)&&(i=r);const l=i?Bn(i):void 0,h=z(o,l);if(!i){if(r||r===0)throw new Error(a?Gr(e):Kr(e));return r}const f=zn(s,i.props??{});return i.type!==c.Fragment&&(f.ref=o?h:l),c.cloneElement(i,f)});return t.displayName=`${e}.Slot`,t}Z(Bt,"createSlot");var Vn=Symbol.for("radix.slottable");function Br(e){const t=Z(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=Vn,t}Z(Br,"createSlottable");var Hr=Z((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 zn(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]=(...a)=>{const u=s(...a);return r(...a),u}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"?n[o]=[r,s].filter(Boolean).join(" "):o==="aria-describedby"&&(n[o]=Kn(s,r))}return{...e,...n}}Z(zn,"mergeProps");function Bn(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)}Z(Bn,"getElementRef");function Hn(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Vn}Z(Hn,"isSlottable");var Ur=Symbol.for("react.lazy");function Ot(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Ur&&"_payload"in e&&Un(e._payload)}Z(Ot,"isLazyComponent");function Un(e){return typeof e=="object"&&e!==null&&"then"in e}Z(Un,"isPromiseLike");function Kn(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const o of String(n).trim().split(/\s+/))o&&t.add(o);return t.size>0?Array.from(t).join(" "):void 0}Z(Kn,"concatAriaDescribedby");var Kr=Z(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Gr=Z(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Ye=De[" use ".trim().toString()],Yr=Object.defineProperty,Xr=(e,t)=>Yr(e,"name",{value:t,configurable:!0}),Zr=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],it=Zr.reduce((e,t)=>{const n=Bt(`Primitive.${t}`),o=c.forwardRef((r,s)=>{const{asChild:i,...a}=r,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),C.jsx(u,{...a,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function Ht(e,t){e&&Me.flushSync(()=>e.dispatchEvent(t))}Xr(Ht,"dispatchDiscreteCustomEvent");var qr=Object.defineProperty,B=(e,t)=>qr(e,"name",{value:t,configurable:!0}),At="dismissableLayer.update",Jr="dismissableLayer.pointerDownOutside",Qr="dismissableLayer.focusOutside",sn,Gn=c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),ei=c.forwardRef(B(function(t,n){const{disableOutsidePointerEvents:o=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:u,onDismiss:l,...h}=t,f=c.useContext(Gn),[d,p]=c.useState(null),m=d?.ownerDocument??globalThis?.document,[,v]=c.useState({}),w=z(n,p),y=Array.from(f.layers),[x]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),g=x?y.indexOf(x):-1,b=d?y.indexOf(d):-1,S=f.layersWithOutsidePointerEventsDisabled.size>0,E=b>=g,R=c.useRef(!1),P=Yn(_=>{i?.(_),u?.(_),_.defaultPrevented||l?.()},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:R,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:c.useCallback(_=>{if(!(_ instanceof Node))return!1;const M=[...f.branches].some($=>$.contains(_));return E&&!M},[f.branches,E])}),O=Xn(_=>{if(r&&R.current)return;const M=_.target;[...f.branches].some(k=>k.contains(M))||(a?.(_),u?.(_),_.defaultPrevented||l?.())},m),T=d?b===y.length-1:!1,L=ge(_=>{_.key==="Escape"&&(s?.(_),!_.defaultPrevented&&l&&(_.preventDefault(),l()))});return c.useEffect(()=>{if(T)return m.addEventListener("keydown",L,{capture:!0}),()=>m.removeEventListener("keydown",L,{capture:!0})},[m,T,L]),c.useEffect(()=>{if(d)return o&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(sn=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(d)),f.layers.add(d),_t(),()=>{o&&(f.layersWithOutsidePointerEventsDisabled.delete(d),f.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=sn))}},[d,m,o,f]),c.useEffect(()=>()=>{d&&(f.layers.delete(d),f.layersWithOutsidePointerEventsDisabled.delete(d),_t())},[d,f]),c.useEffect(()=>{const _=B(()=>v({}),"handleUpdate");return document.addEventListener(At,_),()=>document.removeEventListener(At,_)},[]),C.jsx(it.div,{...h,ref:w,style:{pointerEvents:S?E?"auto":"none":void 0,...t.style},onFocusCapture:N(t.onFocusCapture,O.onFocusCapture),onBlurCapture:N(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:N(t.onPointerDownCapture,P.onPointerDownCapture)})},"DismissableLayer"));function ti(){const e=c.useContext(Gn),[t,n]=c.useState(null);return c.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}B(ti,"useDismissableLayerSurface");var ni=B(()=>!0,"IS_TRUE");function Yn(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:o=!1,isDeferredPointerDownOutsideRef:r,dismissableSurfaces:s,shouldHandlePointerDownOutside:i=ni}=t,a=ge(e),u=c.useRef(!1),l=c.useRef(!1),h=c.useRef(new Map),f=c.useRef(()=>{});return c.useEffect(()=>{function d(){l.current=!1,r.current=!1,h.current.clear()}B(d,"resetOutsideInteraction");function p(){return Array.from(h.current.values()).some(Boolean)}B(p,"isOutsideInteractionIntercepted");function m(g){if(!l.current)return;const b=g.target;b instanceof Node&&[...s].some(E=>E.contains(b))||h.current.set(g.type,!0),g.type==="click"&&window.setTimeout(()=>{l.current&&f.current()},0)}B(m,"handleInteractionCapture");function v(g){l.current&&h.current.set(g.type,!1)}B(v,"handleInteractionBubble");const w=B(g=>{if(g.target&&!u.current){let b=function(){n.removeEventListener("click",f.current);const E=p();d(),E||Ut(Jr,a,S,{discrete:!0})};if(B(b,"handleAndDispatchPointerDownOutsideEvent"),!i(g.target)){n.removeEventListener("click",f.current),d(),u.current=!1;return}const S={originalEvent:g};l.current=!0,r.current=o&&g.button===0,h.current.clear(),!o||g.button!==0?b():(n.removeEventListener("click",f.current),f.current=b,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),d();u.current=!1},"handlePointerDown"),y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const g of y)n.addEventListener(g,m,!0),n.addEventListener(g,v);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",w)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",w),n.removeEventListener("click",f.current);for(const g of y)n.removeEventListener(g,m,!0),n.removeEventListener(g,v)}},[n,a,o,r,s,i]),{onPointerDownCapture:B(()=>u.current=!0,"onPointerDownCapture")}}B(Yn,"usePointerDownOutside");function Xn(e,t=globalThis?.document){const n=ge(e),o=c.useRef(!1);return c.useEffect(()=>{const r=B(s=>{s.target&&!o.current&&Ut(Qr,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:B(()=>o.current=!0,"onFocusCapture"),onBlurCapture:B(()=>o.current=!1,"onBlurCapture")}}B(Xn,"useFocusOutside");function _t(){const e=new CustomEvent(At);document.dispatchEvent(e)}B(_t,"dispatchUpdate");function Ut(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?Ht(r,s):r.dispatchEvent(s)}B(Ut,"handleAndDispatchCustomEvent");var oi=Object.defineProperty,V=(e,t)=>oi(e,"name",{value:t,configurable:!0}),gt="focusScope.autoFocusOnMount",vt="focusScope.autoFocusOnUnmount",cn={bubbles:!1,cancelable:!0},ri=c.forwardRef(V(function(t,n){const{loop:o=!1,trapped:r=!1,branches:s,onMountAutoFocus:i,onUnmountAutoFocus:a,...u}=t,[l,h]=c.useState(null),f=ge(i),d=ge(a),p=c.useRef(null),m=z(n,h),v=c.useRef(s);c.useEffect(()=>{v.current=s});const w=c.useCallback(g=>g?l?.contains(g)?!0:!!v.current?.some(b=>b.contains(g)):!1,[l]),y=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(r){let g=function(R){if(y.paused||!l)return;const P=R.target;w(P)?p.current=P:re(p.current,{select:!0})},b=function(R){if(y.paused||!l)return;const P=R.relatedTarget;P!==null&&(w(P)||re(p.current,{select:!0}))},S=function(R){if(document.activeElement===document.body)for(const O of R)O.removedNodes.length>0&&re(l)};V(g,"handleFocusIn"),V(b,"handleFocusOut"),V(S,"handleMutations"),document.addEventListener("focusin",g),document.addEventListener("focusout",b);const E=new MutationObserver(S);return l&&E.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",b),E.disconnect()}}},[r,l,y.paused,w]),c.useEffect(()=>{if(l){an.add(y);const g=document.activeElement;if(!l.contains(g)){const S=new CustomEvent(gt,cn);l.addEventListener(gt,f),l.dispatchEvent(S),S.defaultPrevented||(eo(io(Kt(l)),{select:!0}),document.activeElement===g&&re(l))}return()=>{l.removeEventListener(gt,f),setTimeout(()=>{const S=new CustomEvent(vt,cn);l.addEventListener(vt,d),l.dispatchEvent(S),S.defaultPrevented||re(g??document.body,{select:!0}),l.removeEventListener(vt,d),an.remove(y)},0)}}},[l,f,d,y]);const x=c.useCallback(g=>{if(!o&&!r||y.paused)return;const b=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,S=document.activeElement;if(b&&S){const E=g.currentTarget,[R,P]=to(E);R&&P?!g.shiftKey&&S===P?(g.preventDefault(),o&&re(R,{select:!0})):g.shiftKey&&S===R&&(g.preventDefault(),o&&re(P,{select:!0})):S===E&&g.preventDefault()}},[o,r,y.paused]);return C.jsx(it.div,{tabIndex:-1,...u,ref:m,onKeyDown:x})},"FocusScope")),Zn=c.createContext(null);function qn({registry:e,children:t}){return e?C.jsx(Zn.Provider,{value:e,children:t}):t}V(qn,"FocusScopeBranchProvider");function Jn(){const[e,t]=c.useState([]),n=c.useMemo(()=>({add:V(o=>t(r=>r.includes(o)?r:[...r,o]),"add"),remove:V(o=>t(r=>r.filter(s=>s!==o)),"remove")}),[]);return{nodes:e,registry:n}}V(Jn,"useFocusScopeBranchRegistry");function Qn(e){const t=c.useContext(Zn);c.useEffect(()=>{if(!(!e||!t))return t.add(e),()=>t.remove(e)},[e,t])}V(Qn,"useFocusScopeBranch");function eo(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(re(o,{select:t}),document.activeElement!==n)return}V(eo,"focusFirst");function to(e){const t=Kt(e),n=It(t,e),o=It(t.reverse(),e);return[n,o]}V(to,"getTabbableEdges");function Kt(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:V(o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}V(Kt,"getTabbableCandidates");function It(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const o of e)if(!(n?!o.checkVisibility({checkVisibilityCSS:!0}):no(o,{upTo:t})))return o}V(It,"findVisible");function no(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}V(no,"isHidden");function oo(e){return e instanceof HTMLInputElement&&"select"in e}V(oo,"isSelectableInput");function re(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&oo(e)&&t&&e.select()}}V(re,"focus");var an=ro();function ro(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Dt(e,t),e.unshift(t)},remove(t){e=Dt(e,t),e[0]?.resume()}}}V(ro,"createFocusScopesStack");function Dt(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}V(Dt,"arrayRemove");function io(e){return e.filter(t=>t.tagName!=="A")}V(io,"removeLinks");const ii=["top","right","bottom","left"],ve=Math.min,ie=Math.max,et=Math.round,Xe=Math.floor,se=e=>({x:e,y:e}),si={left:"right",right:"left",bottom:"top",top:"bottom"};function so(e,t,n){return ie(e,ve(t,n))}function ce(e,t){return typeof e=="function"?e(t):e}function ye(e){return e.split("-")[0]}function Te(e){return e.split("-")[1]}function Gt(e){return e==="x"?"y":"x"}function Yt(e){return e==="y"?"height":"width"}function Q(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Xt(e){return Gt(Q(e))}function ci(e,t,n){n===void 0&&(n=!1);const o=Te(e),r=Xt(e),s=Yt(r);let i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=tt(i)),[i,tt(i)]}function ai(e){const t=tt(e);return[Mt(e),t,Mt(t)]}function Mt(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ln=["left","right"],un=["right","left"],li=["top","bottom"],ui=["bottom","top"];function fi(e,t,n){switch(e){case"top":case"bottom":return n?t?un:ln:t?ln:un;case"left":case"right":return t?li:ui;default:return[]}}function di(e,t,n,o){const r=Te(e);let s=fi(ye(e),n==="start",o);return r&&(s=s.map(i=>i+"-"+r),t&&(s=s.concat(s.map(Mt)))),s}function tt(e){const t=ye(e);return si[t]+e.slice(t.length)}function pi(e){var t,n,o,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(o=e.bottom)!=null?o:0,left:(r=e.left)!=null?r:0}}function co(e){return typeof e!="number"?pi(e):{top:e,right:e,bottom:e,left:e}}function nt(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function fn(e,t,n){let{reference:o,floating:r}=e;const s=Q(t),i=Xt(t),a=Yt(i),u=ye(t),l=s==="y",h=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,d=o[a]/2-r[a]/2;let p;switch(u){case"top":p={x:h,y:o.y-r.height};break;case"bottom":p={x:h,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:f};break;case"left":p={x:o.x-r.width,y:f};break;default:p={x:o.x,y:o.y}}const m=Te(t);return m&&(p[i]+=d*(m==="end"?1:-1)*(n&&l?-1:1)),p}async function mi(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:i,elements:a,strategy:u}=e,{boundary:l="clippingAncestors",rootBoundary:h="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=ce(t,e),m=co(p),w=a[d?f==="floating"?"reference":"floating":f],y=nt(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:h,strategy:u})),x=f==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,g=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),b=await(s.isElement==null?void 0:s.isElement(g))&&await(s.getScale==null?void 0:s.getScale(g))||{x:1,y:1},S=nt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:g,strategy:u}):x);return{top:(y.top-S.top+m.top)/b.y,bottom:(S.bottom-y.bottom+m.bottom)/b.y,left:(y.left-S.left+m.left)/b.x,right:(S.right-y.right+m.right)/b.x}}const hi=50,gi=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:mi},u=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:h,y:f}=fn(l,o,u),d=o,p=0;const m={};for(let v=0;v<s.length;v++){const w=s[v];if(!w)continue;const{name:y,fn:x}=w,{x:g,y:b,data:S,reset:E}=await x({x:h,y:f,initialPlacement:o,placement:d,strategy:r,middlewareData:m,rects:l,platform:a,elements:{reference:e,floating:t}});h=g??h,f=b??f,m[y]={...m[y],...S},E&&p<hi&&(p++,typeof E=="object"&&(E.placement&&(d=E.placement),E.rects&&(l=E.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):E.rects),{x:h,y:f}=fn(l,d,u)),v=-1)}return{x:h,y:f,placement:d,strategy:r,middlewareData:m}},vi=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:i,elements:a,middlewareData:u}=t,{element:l,padding:h=0}=ce(e,t)||{};if(l==null)return{};const f=co(h),d={x:n,y:o},p=Xt(r),m=Yt(p),v=await i.getDimensions(l),w=p==="y",y=w?"top":"left",x=w?"bottom":"right",g=w?"clientHeight":"clientWidth",b=s.reference[m]+s.reference[p]-d[p]-s.floating[m],S=d[p]-s.reference[p],E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let R=E?E[g]:0;(!R||!await(i.isElement==null?void 0:i.isElement(E)))&&(R=a.floating[g]||s.floating[m]);const P=b/2-S/2,O=R/2-v[m]/2-1,T=ve(f[y],O),L=ve(f[x],O),_=R-v[m]-L,M=R/2-v[m]/2+P,$=so(T,M,_),k=!u.arrow&&Te(r)!=null&&M!==$&&s.reference[m]/2-(M<T?T:L)-v[m]/2<0,F=k?M<T?M-T:M-_:0;return{[p]:d[p]+F,data:{[p]:$,centerOffset:M-$-F,...k&&{alignmentOffset:F}},reset:k}}}),yi=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:a,platform:u,elements:l}=t,{mainAxis:h=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...w}=ce(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=ye(r),x=Q(a),g=ye(a)===a,b=await(u.isRTL==null?void 0:u.isRTL(l.floating)),S=d||(g||!v?[tt(a)]:ai(a)),E=m!=="none";!d&&E&&S.push(...di(a,v,m,b));const R=[a,...S],P=await u.detectOverflow(t,w),O=[];let T=((o=s.flip)==null?void 0:o.overflows)||[];if(h&&O.push(P[y]),f){const $=ci(r,i,b);O.push(P[$[0]],P[$[1]])}if(T=[...T,{placement:r,overflows:O}],!O.every($=>$<=0)){var L,_;const $=(((L=s.flip)==null?void 0:L.index)||0)+1,k=R[$];if(k&&(!(f==="alignment"?x!==Q(k):!1)||T.every(I=>Q(I.placement)===x?I.overflows[0]>0:!0)))return{data:{index:$,overflows:T},reset:{placement:k}};let F=(_=T.filter(D=>D.overflows[0]<=0).sort((D,I)=>D.overflows[1]-I.overflows[1])[0])==null?void 0:_.placement;if(!F)switch(p){case"bestFit":{var M;const D=(M=T.filter(I=>{if(E){const W=Q(I.placement);return W===x||W==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(W=>W>0).reduce((W,U)=>W+U,0)]).sort((I,W)=>I[1]-W[1])[0])==null?void 0:M[0];D&&(F=D);break}case"initialPlacement":F=a;break}if(r!==F)return{reset:{placement:F}}}return{}}}};function dn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function pn(e){return ii.some(t=>e[t]>=0)}const bi=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=ce(e,t);switch(r){case"referenceHidden":{const i=await o.detectOverflow(t,{...s,elementContext:"reference"}),a=dn(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:pn(a)}}}case"escaped":{const i=await o.detectOverflow(t,{...s,altBoundary:!0}),a=dn(i,n.floating);return{data:{escapedOffsets:a,escaped:pn(a)}}}default:return{}}}}},ao=new Set(["left","top"]);async function wi(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=ye(n),a=Te(n),u=Q(n)==="y",l=ao.has(i)?-1:1,h=s&&u?-1:1,f=ce(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),u?{x:p*h,y:d*l}:{x:d*l,y:p*h}}const xi=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:i,middlewareData:a}=t,u=await wi(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+u.x,y:s+u.y,data:{...u,placement:i}}}}},Ei=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:u={fn:x=>{let{x:g,y:b}=x;return{x:g,y:b}}},...l}=ce(e,t),h={x:n,y:o},f=await s.detectOverflow(t,l),d=Q(r),p=Gt(d);let m=h[p],v=h[d];const w=(x,g)=>so(g+f[x==="y"?"top":"left"],g,g-f[x==="y"?"bottom":"right"]);i&&(m=w(p,m)),a&&(v=w(d,v));const y=u.fn({...t,[p]:m,[d]:v});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[p]:i,[d]:a}}}}}},Si=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,o;const{x:r,y:s,placement:i,rects:a,middlewareData:u}=t,{offset:l=0,mainAxis:h=!0,crossAxis:f=!0}=ce(e,t),d={x:r,y:s},p=Q(i),m=Gt(p);let v=d[m],w=d[p];const y=ce(l,t),x=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(o=y.crossAxis)!=null?o:0};if(h){const S=m==="y"?"height":"width",E=a.reference[m]-a.floating[S]+x.mainAxis,R=a.reference[m]+a.reference[S]-x.mainAxis;v<E?v=E:v>R&&(v=R)}if(f){var g,b;const S=m==="y"?"width":"height",E=ao.has(ye(i)),R=a.reference[p]-a.floating[S]+(E&&((g=u.offset)==null?void 0:g[p])||0)+(E?0:x.crossAxis),P=a.reference[p]+a.reference[S]+(E?0:((b=u.offset)==null?void 0:b[p])||0)-(E?x.crossAxis:0);w<R?w=R:w>P&&(w=P)}return{[m]:v,[p]:w}}}},Ci=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:o,platform:r,elements:s}=t,{apply:i=()=>{},...a}=ce(e,t),u=await r.detectOverflow(t,a),l=ye(n),h=Te(n),f=Q(n)==="y",{width:d,height:p}=o.floating;let m,v;l==="top"||l==="bottom"?(m=l,v=h===(await(r.isRTL==null?void 0:r.isRTL(s.floating))?"start":"end")?"left":"right"):(v=l,m=h==="end"?"top":"bottom");const w=p-u.top-u.bottom,y=d-u.left-u.right,x=ve(p-u[m],w),g=ve(d-u[v],y),b=t.middlewareData.shift,S=!b;let E=x,R=g;b!=null&&b.enabled.x&&(R=y),b!=null&&b.enabled.y&&(E=w),S&&!h&&(f?R=d-2*ie(u.left,u.right):E=p-2*ie(u.top,u.bottom)),await i({...t,availableWidth:R,availableHeight:E});const P=await r.getDimensions(s.floating);return d!==P.width||p!==P.height?{reset:{rects:!0}}:{}}}};function st(){return typeof window<"u"}function $e(e){return lo(e)?(e.nodeName||"").toLowerCase():"#document"}function G(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function le(e){var t;return(t=(lo(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function lo(e){return st()?e instanceof Node||e instanceof G(e).Node:!1}function ee(e){return st()?e instanceof Element||e instanceof G(e).Element:!1}function be(e){return st()?e instanceof HTMLElement||e instanceof G(e).HTMLElement:!1}function mn(e){return!st()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof G(e).ShadowRoot}function ct(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=te(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function Ri(e){return/^(table|td|th)$/.test($e(e))}function at(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Pi=/transform|translate|scale|rotate|perspective|filter/,Oi=/paint|layout|strict|content/,Ee=e=>!!e&&e!=="none";let yt;function Zt(e){const t=ee(e)?te(e):e;return Ee(t.transform)||Ee(t.translate)||Ee(t.scale)||Ee(t.rotate)||Ee(t.perspective)||!qt()&&(Ee(t.backdropFilter)||Ee(t.filter))||Pi.test(t.willChange||"")||Oi.test(t.contain||"")}function Ai(e){let t=Se(e);for(;be(t)&&!Ne(t);){if(Zt(t))return t;if(at(t))return null;t=Se(t)}return null}function qt(){return yt==null&&(yt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),yt}function Ne(e){return/^(html|body|#document)$/.test($e(e))}function te(e){return G(e).getComputedStyle(e)}function lt(e){return ee(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Se(e){if($e(e)==="html")return e;const t=e.assignedSlot||e.parentNode||mn(e)&&e.host||le(e);return mn(t)?t.host:t}function uo(e){const t=Se(e);return Ne(t)?(e.ownerDocument||e).body:be(t)&&ct(t)?t:uo(t)}function je(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=uo(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),i=G(r);if(s){const a=Tt(i);return t.concat(i,i.visualViewport||[],ct(r)?r:[],a&&n?je(a):[])}else return t.concat(r,je(r,[],n))}function Tt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function fo(e){const t=te(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=be(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o,a=et(n)!==s||et(o)!==i;return a&&(n=s,o=i),{width:n,height:o,$:a}}function Jt(e){return ee(e)?e:e.contextElement}function _e(e){const t=Jt(e);if(!be(t))return se(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=fo(t);let i=(s?et(n.width):n.width)/o,a=(s?et(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const _i=se(0);function po(e){const t=G(e);return!qt()||!t.visualViewport?_i:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ii(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===G(e)}function Ce(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=Jt(e);let i=se(1);t&&(o?ee(o)&&(i=_e(o)):i=_e(e));const a=Ii(s,n,o)?po(s):se(0);let u=(r.left+a.x)/i.x,l=(r.top+a.y)/i.y,h=r.width/i.x,f=r.height/i.y;if(s&&o){const d=G(s),p=ee(o)?G(o):o;let m=d,v=Tt(m);for(;v&&p!==m;){const w=_e(v),y=v.getBoundingClientRect(),x=te(v),g=y.left+(v.clientLeft+parseFloat(x.paddingLeft))*w.x,b=y.top+(v.clientTop+parseFloat(x.paddingTop))*w.y;u*=w.x,l*=w.y,h*=w.x,f*=w.y,u+=g,l+=b,m=G(v),v=Tt(m)}}return nt({width:h,height:f,x:u,y:l})}function ut(e,t){const n=lt(e).scrollLeft;return t?t.left+n:Ce(le(e)).left+n}function mo(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-ut(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Di(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",i=le(o),a=t?at(t.floating):!1;if(o===i||a&&s)return n;let u={scrollLeft:0,scrollTop:0},l=se(1);const h=se(0),f=be(o);if((f||!s)&&(($e(o)!=="body"||ct(i))&&(u=lt(o)),f)){const p=Ce(o);l=_e(o),h.x=p.x+o.clientLeft,h.y=p.y+o.clientTop}const d=i&&!f&&!s?mo(i,u):se(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-u.scrollLeft*l.x+h.x+d.x,y:n.y*l.y-u.scrollTop*l.y+h.y+d.y}}function Mi(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ti(e){const t=lt(e),n=e.ownerDocument.body,o=ie(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=ie(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+ut(e);const i=-t.scrollTop;return te(n).direction==="rtl"&&(s+=ie(e.clientWidth,n.clientWidth)-o),{width:o,height:r,x:s,y:i}}const $i=25;function Fi(e,t,n){n===void 0&&(n="viewport");const o=n==="layoutViewport",r=G(e),s=le(e),i=r.visualViewport;let a=s.clientWidth,u=s.clientHeight,l=0,h=0;if(i){const d=!qt()||t==="fixed";o?d||(l=-i.offsetLeft,h=-i.offsetTop):(a=i.width,u=i.height,d&&(l=i.offsetLeft,h=i.offsetTop))}if(ut(s)<=0){const d=s.ownerDocument,p=d.body,m=getComputedStyle(p),v=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,w=Math.abs(s.clientWidth-p.clientWidth-v),y=getComputedStyle(s).scrollbarGutter==="stable both-edges"?w/2:w;y<=$i&&(a-=y)}return{width:a,height:u,x:l,y:h}}function Li(e,t){const n=Ce(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=_e(e),i=e.clientWidth*s.x,a=e.clientHeight*s.y,u=r*s.x,l=o*s.y;return{width:i,height:a,x:u,y:l}}function hn(e,t,n){let o;if(t==="viewport"||t==="layoutViewport")o=Fi(e,n,t);else if(t==="document")o=Ti(le(e));else if(ee(t))o=Li(t,n);else{const r=po(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return nt(o)}function Ni(e,t){const n=t.get(e);if(n)return n;let o=je(e,[],!1).filter(a=>ee(a)&&$e(a)!=="body"),r=null;const s=te(e).position==="fixed";let i=s?Se(e):e;for(;ee(i)&&!Ne(i);){const a=te(i),u=Zt(i),l=r?r.position:s?"fixed":"";!u&&(l==="fixed"||l==="absolute"&&a.position==="static")?o=o.filter(f=>f!==i):r=a,i=Se(i)}return t.set(e,o),o}function ji(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[...n==="clippingAncestors"?at(t)?[]:Ni(t,this._c):[].concat(n),o],a=hn(t,i[0],r);let u=a.top,l=a.right,h=a.bottom,f=a.left;for(let d=1;d<i.length;d++){const p=hn(t,i[d],r);u=ie(p.top,u),l=ve(p.right,l),h=ve(p.bottom,h),f=ie(p.left,f)}return{width:l-f,height:h-u,x:f,y:u}}function ki(e){const{width:t,height:n}=fo(e);return{width:t,height:n}}function Wi(e,t,n){const o=be(t),r=le(t),s=n==="fixed",i=Ce(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const u=se(0);if((o||!s)&&(($e(t)!=="body"||ct(r))&&(a=lt(t)),o)){const d=Ce(t,!0,s,t);u.x=d.x+t.clientLeft,u.y=d.y+t.clientTop}!o&&r&&(u.x=ut(r));const l=r&&!o&&!s?mo(r,a):se(0),h=i.left+a.scrollLeft-u.x-l.x,f=i.top+a.scrollTop-u.y-l.y;return{x:h,y:f,width:i.width,height:i.height}}function bt(e){return te(e).position==="static"}function gn(e,t){if(!be(e)||te(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return le(e)===n&&(n=n.ownerDocument.body),n}function ho(e,t){const n=G(e);if(at(e))return n;if(!be(e)){let r=Se(e);for(;r&&!Ne(r);){if(ee(r)&&!bt(r))return r;r=Se(r)}return n}let o=gn(e,t);for(;o&&Ri(o)&&bt(o);)o=gn(o,t);return o&&Ne(o)&&bt(o)&&!Zt(o)?n:o||Ai(e)||n}const Vi=async function(e){const t=this.getOffsetParent||ho,n=this.getDimensions,o=await n(e.floating);return{reference:Wi(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function zi(e){return te(e).direction==="rtl"}const Bi={convertOffsetParentRelativeRectToViewportRelativeRect:Di,getDocumentElement:le,getClippingRect:ji,getOffsetParent:ho,getElementRects:Vi,getClientRects:Mi,getDimensions:ki,getScale:_e,isElement:ee,isRTL:zi};function go(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Hi(e,t,n){let o=null,r;const s=le(e);function i(){var h;clearTimeout(r),(h=o)==null||h.disconnect(),o=null}function a(h,f){h===void 0&&(h=!1),f===void 0&&(f=1),i();const d=e.getBoundingClientRect(),{left:p,top:m,width:v,height:w}=d;if(h||t(),!v||!w)return;const y=Xe(m),x=Xe(s.clientWidth-(p+v)),g=Xe(s.clientHeight-(m+w)),b=Xe(p),E={rootMargin:-y+"px "+-x+"px "+-g+"px "+-b+"px",threshold:ie(0,ve(1,f))||1};let R=!0;function P(O){const T=O[0].intersectionRatio;if(!go(d,e.getBoundingClientRect()))return a();if(T!==f){if(!R)return a();T?a(!1,T):r=setTimeout(()=>{a(!1,1e-7)},1e3)}R=!1}try{o=new IntersectionObserver(P,{...E,root:s.ownerDocument})}catch{o=new IntersectionObserver(P,E)}o.observe(e)}const u=G(e),l=()=>a(n);return u.addEventListener("resize",l),a(!0),()=>{u.removeEventListener("resize",l),i()}}function Ui(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:u=!1}=o,l=Jt(e),h=r||s?[...l?je(l):[],...t?je(t):[]]:[];h.forEach(y=>{r&&y.addEventListener("scroll",n),s&&y.addEventListener("resize",n)});const f=l&&a?Hi(l,n,s):null;let d=-1,p=null;i&&(p=new ResizeObserver(y=>{let[x]=y;x&&x.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var g;(g=p)==null||g.observe(t)})),n()}),l&&!u&&p.observe(l),t&&p.observe(t));let m,v=u?Ce(e):null;u&&w();function w(){const y=Ce(e);v&&!go(v,y)&&n(),v=y,m=requestAnimationFrame(w)}return n(),()=>{var y;h.forEach(x=>{r&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f?.(),(y=p)==null||y.disconnect(),p=null,u&&cancelAnimationFrame(m)}}const Ki=xi,Gi=Ei,Yi=yi,Xi=Ci,Zi=bi,vn=vi,qi=Si,Ji=(e,t,n)=>{const o=new Map,r=n??{},s={...Bi,...r.platform,_c:o};return gi(e,t,{...r,platform:s})};var Qi=typeof document<"u",es=function(){},Qe=Qi?c.useLayoutEffect:es;function ot(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!ot(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!ot(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function vo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yn(e,t){const n=vo(e);return Math.round(t*n)/n}function wt(e){const t=c.useRef(e);return Qe(()=>{t.current=e}),t}function ts(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:u,open:l}=e,[h,f]=c.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=c.useState(o);ot(d,o)||p(o);const[m,v]=c.useState(null),[w,y]=c.useState(null),x=c.useCallback(I=>{I!==E.current&&(E.current=I,v(I))},[]),g=c.useCallback(I=>{I!==R.current&&(R.current=I,y(I))},[]),b=s||m,S=i||w,E=c.useRef(null),R=c.useRef(null),P=c.useRef(h),O=u!=null,T=wt(u),L=wt(r),_=wt(l),M=c.useCallback(()=>{if(!E.current||!R.current)return;const I={placement:t,strategy:n,middleware:d};L.current&&(I.platform=L.current),Ji(E.current,R.current,I).then(W=>{const U={...W,isPositioned:_.current!==!1};$.current&&!ot(P.current,U)&&(P.current=U,Me.flushSync(()=>{f(U)}))})},[d,t,n,L,_]);Qe(()=>{l===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f(I=>({...I,isPositioned:!1})))},[l]);const $=c.useRef(!1);Qe(()=>($.current=!0,()=>{$.current=!1}),[]),Qe(()=>{if(b&&(E.current=b),S&&(R.current=S),b&&S){if(T.current)return T.current(b,S,M);M()}},[b,S,M,T,O]);const k=c.useMemo(()=>({reference:E,floating:R,setReference:x,setFloating:g}),[x,g]),F=c.useMemo(()=>({reference:b,floating:S}),[b,S]),D=c.useMemo(()=>{const I={position:n,left:0,top:0};if(!F.floating)return I;const W=yn(F.floating,h.x),U=yn(F.floating,h.y);return a?{...I,transform:"translate("+W+"px, "+U+"px)",...vo(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:U}},[n,a,F.floating,h.x,h.y]);return c.useMemo(()=>({...h,update:M,refs:k,elements:F,floatingStyles:D}),[h,M,k,F,D])}const ns=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?vn({element:o.current,padding:r}).fn(n):{}:o?vn({element:o,padding:r}).fn(n):{}}}},os=(e,t)=>{const n=Ki(e);return{name:n.name,fn:n.fn,options:[e,t]}},rs=(e,t)=>{const n=Gi(e);return{name:n.name,fn:n.fn,options:[e,t]}},is=(e,t)=>({fn:qi(e).fn,options:[e,t]}),ss=(e,t)=>{const n=Yi(e);return{name:n.name,fn:n.fn,options:[e,t]}},cs=(e,t)=>{const n=Xi(e);return{name:n.name,fn:n.fn,options:[e,t]}},as=(e,t)=>{const n=Zi(e);return{name:n.name,fn:n.fn,options:[e,t]}},ls=(e,t)=>{const n=ns(e);return{name:n.name,fn:n.fn,options:[e,t]}};var us=Object.defineProperty,q=(e,t)=>us(e,"name",{value:t,configurable:!0});function yo(e){const t=c.forwardRef((n,o)=>{let{children:r,...s}=n,i=null,a=!1;const u=[];$t(r)&&typeof Ze=="function"&&(r=Ze(r._payload)),c.Children.forEach(r,d=>{if(Eo(d)){a=!0;const p=d;let m="child"in p.props?p.props.child:p.props.children;$t(m)&&typeof Ze=="function"&&(m=Ze(m._payload)),i=ds(p,m),u.push(i?.props?.children)}else u.push(d)}),i?i=c.cloneElement(i,void 0,u):!a&&c.Children.count(r)===1&&c.isValidElement(r)&&(i=r);const l=i?xo(i):void 0,h=z(o,l);if(!i){if(r||r===0)throw new Error(a?hs(e):ms(e));return r}const f=wo(s,i.props??{});return i.type!==c.Fragment&&(f.ref=o?h:l),c.cloneElement(i,f)});return t.displayName=`${e}.Slot`,t}q(yo,"createSlot");var bo=Symbol.for("radix.slottable");function fs(e){const t=q(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=bo,t}q(fs,"createSlottable");var ds=q((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 wo(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]=(...a)=>{const u=s(...a);return r(...a),u}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"?n[o]=[r,s].filter(Boolean).join(" "):o==="aria-describedby"&&(n[o]=Co(s,r))}return{...e,...n}}q(wo,"mergeProps");function xo(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)}q(xo,"getElementRef");function Eo(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===bo}q(Eo,"isSlottable");var ps=Symbol.for("react.lazy");function $t(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ps&&"_payload"in e&&So(e._payload)}q($t,"isLazyComponent");function So(e){return typeof e=="object"&&e!==null&&"then"in e}q(So,"isPromiseLike");function Co(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const o of String(n).trim().split(/\s+/))o&&t.add(o);return t.size>0?Array.from(t).join(" "):void 0}q(Co,"concatAriaDescribedby");var ms=q(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),hs=q(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Ze=De[" use ".trim().toString()],gs=Object.defineProperty,vs=(e,t)=>gs(e,"name",{value:t,configurable:!0}),ys=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ro=ys.reduce((e,t)=>{const n=yo(`Primitive.${t}`),o=c.forwardRef((r,s)=>{const{asChild:i,...a}=r,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),C.jsx(u,{...a,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function bs(e,t){e&&Me.flushSync(()=>e.dispatchEvent(t))}vs(bs,"dispatchDiscreteCustomEvent");var ws=Object.defineProperty,xs=(e,t)=>ws(e,"name",{value:t,configurable:!0});function Po(e){const[t,n]=c.useState(void 0);return pe(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let o=0;const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];window.cancelAnimationFrame(o),o=window.requestAnimationFrame(()=>{let a,u;if("borderBoxSize"in i){const l=i.borderBoxSize,h=Array.isArray(l)?l[0]:l;a=h.inlineSize,u=h.blockSize}else a=e.offsetWidth,u=e.offsetHeight;n({width:a,height:u})})});return r.observe(e,{box:"border-box"}),()=>{window.cancelAnimationFrame(o),r.unobserve(e)}}else n(void 0)},[e]),t}xs(Po,"useSize");var Es=Object.defineProperty,me=(e,t)=>Es(e,"name",{value:t,configurable:!0}),bn={Partial:"partial"},wn={Optimized:"optimized",Always:"always"},Oo="Popper",[Ao,_o]=Ie(Oo),[Ss,Io]=Ao(Oo),Cs=me(e=>{const{__scopePopper:t,children:n}=e,[o,r]=c.useState(null),[s,i]=c.useState(void 0);return C.jsx(Ss,{scope:t,anchor:o,onAnchorChange:r,placementState:s,setPlacementState:i,children:n})},"Popper"),Rs="PopperAnchor",Ps=c.forwardRef(me(function(t,n){const{__scopePopper:o,virtualRef:r,...s}=t,i=Io(Rs,o),a=c.useRef(null),u=i.onAnchorChange,l=c.useCallback(v=>{a.current=v,v&&u(v)},[u]),h=z(n,l),f=c.useRef(null);c.useEffect(()=>{if(!r)return;const v=f.current;f.current=r.current,v!==f.current&&u(f.current)});const d=i.placementState&&ft(i.placementState),p=d?.[0],m=d?.[1];return r?null:C.jsx(Ro.div,{"data-radix-popper-side":p,"data-radix-popper-align":m,...s,ref:h})},"PopperAnchor")),Do="PopperContent",[Os,Lc]=Ao(Do),As=c.forwardRef(me(function(t,n){const{__scopePopper:o,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,arrowPadding:u=0,avoidCollisions:l=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:d=bn.Partial,hideWhenDetached:p=!1,updatePositionStrategy:m=wn.Optimized,onPlaced:v,...w}=t,y=Io(Do,o),[x,g]=c.useState(null),b=z(n,g),[S,E]=c.useState(null),R=Po(S),P=R?.width??0,O=R?.height??0,T=r+(i!=="center"?"-"+i:""),L=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},_=Array.isArray(h)?h:[h],M=_.length>0,$={padding:L,boundary:_.filter(Mo),altBoundary:M},{refs:k,floatingStyles:F,placement:D,isPositioned:I,middlewareData:W}=ts({strategy:"fixed",placement:T,whileElementsMounted:me((...oe)=>Ui(...oe,{animationFrame:m===wn.Always}),"whileElementsMounted"),elements:{reference:y.anchor},middleware:[os({mainAxis:s+O,alignmentAxis:a}),l&&rs({mainAxis:!0,crossAxis:!1,limiter:d===bn.Partial?is():void 0,...$}),l&&ss({...$}),cs({...$,apply:me(({elements:oe,rects:Oe,availableWidth:Fe,availableHeight:Ue})=>{const{width:we,height:K}=Oe.reference,xe=oe.floating.style;xe.setProperty("--radix-popper-available-width",`${Fe}px`),xe.setProperty("--radix-popper-available-height",`${Ue}px`),xe.setProperty("--radix-popper-anchor-width",`${we}px`),xe.setProperty("--radix-popper-anchor-height",`${K}px`)},"apply")}),S&&ls({element:S,padding:u}),_s({arrowWidth:P,arrowHeight:O}),p&&as({strategy:"referenceHidden",...$,boundary:M?$.boundary:void 0})]}),U=y.setPlacementState;pe(()=>(U(D),()=>{U(void 0)}),[D,U]);const[ze,Be]=ft(D),He=ge(v);pe(()=>{I&&He?.()},[I,He]);const mt=W.arrow?.x,ue=W.arrow?.y,A=W.arrow?.centerOffset!==0,[fe,ne]=c.useState();return pe(()=>{x&&ne(window.getComputedStyle(x).zIndex)},[x]),C.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:I?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:fe,"--radix-popper-transform-origin":[W.transformOrigin?.x,W.transformOrigin?.y].join(" "),...W.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:C.jsx(Os,{scope:o,placedSide:ze,placedAlign:Be,onArrowChange:E,arrowX:mt,arrowY:ue,shouldHideArrow:A,children:C.jsx(Ro.div,{"data-side":ze,"data-align":Be,...w,ref:b,style:{...w.style,animation:I?w.style?.animation:"none"}})})})},"PopperContent"));function Mo(e){return e!==null}me(Mo,"isNotNull");var _s=me(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:o,middlewareData:r}=t,i=r.arrow?.centerOffset!==0,a=i?0:e.arrowWidth,u=i?0:e.arrowHeight,[l,h]=ft(n),f={start:"0%",center:"50%",end:"100%"}[h],d=(r.arrow?.x??0)+a/2,p=(r.arrow?.y??0)+u/2;let m="",v="";return l==="bottom"?(m=i?f:`${d}px`,v=`${-u}px`):l==="top"?(m=i?f:`${d}px`,v=`${o.floating.height+u}px`):l==="right"?(m=`${-u}px`,v=i?f:`${p}px`):l==="left"&&(m=`${o.floating.width+u}px`,v=i?f:`${p}px`),{data:{x:m,y:v}}}}),"transformOrigin");function ft(e){const[t,n="center"]=e.split("-");return[t,n]}me(ft,"getSideAndAlignFromPlacement");var Is=Object.defineProperty,Ds=(e,t)=>Is(e,"name",{value:t,configurable:!0}),Ms=c.forwardRef(Ds(function(t,n){const{container:o,...r}=t,[s,i]=c.useState(!1);pe(()=>i(!0),[]);const a=o||s&&globalThis?.document?.body;return a?Me.createPortal(C.jsx(it.div,{...r,ref:n}),a):null},"Portal")),Ts=Object.defineProperty,ae=(e,t)=>Ts(e,"name",{value:t,configurable:!0});function To(e,t){return c.useReducer((n,o)=>t[n][o]??n,e)}ae(To,"useStateMachine");var $o=ae(e=>{const{present:t,children:n}=e,o=Fo(t),r=typeof n=="function"?n({present:o.isPresent}):c.Children.only(n),s=Lo(o.ref,No(r));return typeof n=="function"||o.isPresent?c.cloneElement(r,{ref:s}):null},"Presence");function Fo(e){const[t,n]=c.useState(),o=c.useRef(null),r=c.useRef(e),s=c.useRef("none"),i=c.useRef(void 0),a=e?"mounted":"unmounted",[u,l]=To(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return c.useEffect(()=>{u==="mounted"?(s.current=i.current??Ae(o.current),i.current=void 0):s.current="none"},[u]),pe(()=>{const h=o.current,f=r.current;if(f!==e){const p=s.current,m=Ae(h);e?(i.current=m,l("MOUNT")):m==="none"||h?.display==="none"?l("UNMOUNT"):l(f&&p!==m?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),pe(()=>{if(t){let h;const f=t.ownerDocument.defaultView??window,d=ae(m=>{const w=Ae(o.current).includes(CSS.escape(m.animationName));if(m.target===t&&w&&(l("ANIMATION_END"),!r.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",h=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},"handleAnimationEnd"),p=ae(m=>{m.target===t&&(s.current=Ae(o.current))},"handleAnimationStart");return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{f.clearTimeout(h),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:c.useCallback(h=>{if(h){const f=getComputedStyle(h);o.current=f,i.current=Ae(f)}else o.current=null;n(h)},[])}}ae(Fo,"usePresence");function Ft(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}ae(Ft,"setRef");function Lo(...e){const t=c.useRef(e);return t.current=e,c.useCallback(n=>{const o=t.current;let r=!1;const s=o.map(i=>{const a=Ft(i,n);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let i=0;i<s.length;i++){const a=s[i];typeof a=="function"?a():Ft(o[i],null)}}},[])}ae(Lo,"useStableComposedRefs");function Ae(e){return e?.animationName||"none"}ae(Ae,"getAnimationName");function No(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)}ae(No,"getElementRef");var $s=Object.defineProperty,J=(e,t)=>$s(e,"name",{value:t,configurable:!0});function jo(e){const t=c.forwardRef((n,o)=>{let{children:r,...s}=n,i=null,a=!1;const u=[];Lt(r)&&typeof qe=="function"&&(r=qe(r._payload)),c.Children.forEach(r,d=>{if(zo(d)){a=!0;const p=d;let m="child"in p.props?p.props.child:p.props.children;Lt(m)&&typeof qe=="function"&&(m=qe(m._payload)),i=Ls(p,m),u.push(i?.props?.children)}else u.push(d)}),i?i=c.cloneElement(i,void 0,u):!a&&c.Children.count(r)===1&&c.isValidElement(r)&&(i=r);const l=i?Vo(i):void 0,h=z(o,l);if(!i){if(r||r===0)throw new Error(a?ks(e):js(e));return r}const f=Wo(s,i.props??{});return i.type!==c.Fragment&&(f.ref=o?h:l),c.cloneElement(i,f)});return t.displayName=`${e}.Slot`,t}J(jo,"createSlot");var ko=Symbol.for("radix.slottable");function Fs(e){const t=J(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=ko,t}J(Fs,"createSlottable");var Ls=J((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 Wo(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]=(...a)=>{const u=s(...a);return r(...a),u}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"?n[o]=[r,s].filter(Boolean).join(" "):o==="aria-describedby"&&(n[o]=Ho(s,r))}return{...e,...n}}J(Wo,"mergeProps");function Vo(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)}J(Vo,"getElementRef");function zo(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ko}J(zo,"isSlottable");var Ns=Symbol.for("react.lazy");function Lt(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Ns&&"_payload"in e&&Bo(e._payload)}J(Lt,"isLazyComponent");function Bo(e){return typeof e=="object"&&e!==null&&"then"in e}J(Bo,"isPromiseLike");function Ho(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const o of String(n).trim().split(/\s+/))o&&t.add(o);return t.size>0?Array.from(t).join(" "):void 0}J(Ho,"concatAriaDescribedby");var js=J(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),ks=J(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),qe=De[" use ".trim().toString()],Ws=Object.defineProperty,Vs=(e,t)=>Ws(e,"name",{value:t,configurable:!0}),zs=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Uo=zs.reduce((e,t)=>{const n=jo(`Primitive.${t}`),o=c.forwardRef((r,s)=>{const{asChild:i,...a}=r,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),C.jsx(u,{...a,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function Bs(e,t){e&&Me.flushSync(()=>e.dispatchEvent(t))}Vs(Bs,"dispatchDiscreteCustomEvent");var Hs=Object.defineProperty,Qt=(e,t)=>Hs(e,"name",{value:t,configurable:!0}),xt=!1;function Ko(){const[e,t]=c.useState(xt);return c.useEffect(()=>{xt||(xt=!0,t(!0))},[]),e}Qt(Ko,"useIsHydrated");var Go=De[" useSyncExternalStore ".trim().toString()];function Yo(){return()=>{}}Qt(Yo,"subscribe");function Xo(){return Go(Yo,()=>!0,()=>!1)}Qt(Xo,"useIsHydratedModern");var Us=typeof Go=="function"?Xo:Ko,Ks=Object.defineProperty,Re=(e,t)=>Ks(e,"name",{value:t,configurable:!0}),Et="rovingFocusGroup.onEntryFocus",Gs={bubbles:!1,cancelable:!0},dt="RovingFocusGroup",[Nt,Zo,Ys]=Wt(dt),[Xs,qo]=Ie(dt,[Ys]),xn={Vertical:"vertical",Horizontal:"horizontal"},Zs={RTL:"rtl"},[qs,Js]=Xs(dt),Qs=c.forwardRef(Re(function(t,n){return C.jsx(Nt.Provider,{scope:t.__scopeRovingFocusGroup,children:C.jsx(Nt.Slot,{scope:t.__scopeRovingFocusGroup,children:C.jsx(ec,{...t,ref:n})})})},"RovingFocusGroup")),ec=c.forwardRef(Re(function(t,n){const{__scopeRovingFocusGroup:o,orientation:r,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:l,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...d}=t,p=c.useRef(null),m=z(n,p),v=zt(i),[w,y]=Sn({prop:a,defaultProp:u??null,onChange:l,caller:dt}),[x,g]=c.useState(!1),b=ge(h),S=Zo(o),E=c.useRef(!1),[R,P]=c.useState(0);return c.useEffect(()=>{const O=p.current;if(O)return O.addEventListener(Et,b),()=>O.removeEventListener(Et,b)},[b]),C.jsx(qs,{scope:o,orientation:r,dir:v,loop:s,currentTabStopId:w,onItemFocus:c.useCallback(O=>y(O),[y]),onItemShiftTab:c.useCallback(()=>g(!0),[]),onFocusableItemAdd:c.useCallback(()=>P(O=>O+1),[]),onFocusableItemRemove:c.useCallback(()=>P(O=>O-1),[]),children:C.jsx(Uo.div,{tabIndex:x||R===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...t.style},onMouseDown:N(t.onMouseDown,()=>{E.current=!0}),onFocus:N(t.onFocus,O=>{const T=!E.current;if(O.target===O.currentTarget&&T&&!x){const L=new CustomEvent(Et,Gs);if(O.currentTarget.dispatchEvent(L),!L.defaultPrevented){const _=S().filter(D=>D.focusable),M=_.find(D=>D.active),$=_.find(D=>D.id===w),F=[M,$,..._].filter(Boolean).map(D=>D.ref.current);en(F,f)}}E.current=!1}),onBlur:N(t.onBlur,()=>g(!1))})})},"RovingFocusGroupImpl")),tc="RovingFocusGroupItem",nc=c.forwardRef(Re(function(t,n){const{__scopeRovingFocusGroup:o,focusable:r=!0,active:s=!1,tabStopId:i,children:a,...u}=t,l=St(),h=i||l,f=Js(tc,o),d=f.currentTabStopId===h,p=Zo(o),{onFocusableItemAdd:m,onFocusableItemRemove:v,currentTabStopId:w}=f,y=Us();return pe(()=>{if(!(!y||!r))return m(),()=>v()},[y,r,m,v]),c.useEffect(()=>{if(!(y||!r))return m(),()=>v()},[y,r,m,v]),C.jsx(Nt.ItemSlot,{scope:o,id:h,focusable:r,active:s,children:C.jsx(Uo.span,{tabIndex:d?0:-1,"data-orientation":f.orientation,...u,ref:n,onMouseDown:N(t.onMouseDown,x=>{r?f.onItemFocus(h):x.preventDefault()}),onFocus:N(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:N(t.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const g=Qo(x,f.orientation,f.dir);if(g!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let S=p().filter(E=>E.focusable).map(E=>E.ref.current);if(g==="last")S.reverse();else if(g==="prev"||g==="next"){g==="prev"&&S.reverse();const E=S.indexOf(x.currentTarget);S=f.loop?er(S,E+1):S.slice(E+1)}setTimeout(()=>en(S))}}),children:typeof a=="function"?a({isCurrentTabStop:d,hasTabStop:w!=null}):a})})},"RovingFocusGroupItem")),oc={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Jo(e,t){return t!==Zs.RTL?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Re(Jo,"getDirectionAwareKey");function Qo(e,t,n){const o=Jo(e.key,n);if(!(t===xn.Vertical&&["ArrowLeft","ArrowRight"].includes(o))&&!(t===xn.Horizontal&&["ArrowUp","ArrowDown"].includes(o)))return oc[o]}Re(Qo,"getFocusIntent");function en(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}Re(en,"focusFirst");function er(e,t){return e.map((n,o)=>e[(t+o)%e.length])}Re(er,"wrapArray");var rc=Object.defineProperty,j=(e,t)=>rc(e,"name",{value:t,configurable:!0}),ic=["Enter"," "],sc=["ArrowDown","PageUp","Home"],tr=["ArrowUp","PageDown","End"],cc=[...sc,...tr],pt="Menu",[jt,ac,lc]=Wt(pt),[Pe,nr]=Ie(pt,[lc,_o,qo]),tn=_o(),or=qo(),[uc,ke]=Pe(pt),[fc,nn]=Pe(pt),dc=j(e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:s,modal:i=!0}=e,a=tn(t),[u,l]=c.useState(null),h=c.useRef(!1),f=ge(s),d=zt(r);return c.useEffect(()=>{const p=j(()=>{h.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},"handleKeyDown"),m=j(()=>h.current=!1,"handlePointer");return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),c.useEffect(()=>{if(!n)return;const p=j(()=>f(!1),"handleBlur");return window.addEventListener("blur",p),()=>window.removeEventListener("blur",p)},[n,f]),C.jsx(Cs,{...a,children:C.jsx(uc,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:C.jsx(fc,{scope:t,onClose:c.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:h,dir:d,modal:i,children:o})})})},"Menu"),pc=c.forwardRef(j(function(t,n){const{__scopeMenu:o,...r}=t,s=tn(o);return C.jsx(Ps,{...s,...r,ref:n})},"MenuAnchor")),rr="MenuPortal",[mc,hc]=Pe(rr,{forceMount:void 0}),gc=j(e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,s=ke(rr,t);return C.jsx(mc,{scope:t,forceMount:n,children:C.jsx($o,{present:n||s.open,children:C.jsx(Ms,{asChild:!0,container:r,children:o})})})},"MenuPortal"),he="MenuContent",[vc,ir]=Pe(he),yc=c.forwardRef(j(function(t,n){const o=hc(he,t.__scopeMenu),{forceMount:r=o.forceMount,...s}=t,i=ke(he,t.__scopeMenu),a=nn(he,t.__scopeMenu);return C.jsx(jt.Provider,{scope:t.__scopeMenu,children:C.jsx($o,{present:r||i.open,children:C.jsx(jt.Slot,{scope:t.__scopeMenu,children:a.modal?C.jsx(bc,{...s,ref:n}):C.jsx(wc,{...s,ref:n})})})})},"MenuContent")),bc=c.forwardRef(j(function(t,n){const o=ke(he,t.__scopeMenu),r=c.useRef(null),s=z(n,r);return c.useEffect(()=>{const i=r.current;if(i)return gr(i)},[]),C.jsx(sr,{...t,ref:s,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:N(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentModal")),wc=c.forwardRef(j(function(t,n){const o=ke(he,t.__scopeMenu);return C.jsx(sr,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>o.onOpenChange(!1)})},"MenuRootContentNonModal")),xc=Bt("MenuContent.ScrollLock"),sr=c.forwardRef(j(function(t,n){const{__scopeMenu:o,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:u,onEntryFocus:l,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:d,onInteractOutside:p,onDismiss:m,disableOutsideScroll:v,...w}=t,y=ke(he,o),x=nn(he,o),g=tn(o),b=or(o),S=ac(o),[E,R]=c.useState(null),P=c.useRef(null),[O,T]=c.useState(null);Qn(O);const{nodes:L,registry:_}=Jn(),M=!!(s||v),$=z(n,P,y.onContentChange,T),k=c.useRef(0),F=c.useRef(""),D=c.useRef(0),I=c.useRef(null),W=c.useRef("right"),U=c.useRef(0),ze=c.useMemo(()=>v?[P,...L.map(A=>({current:A}))]:[],[P,L,v]),Be=v?yr:c.Fragment,He=v?{as:xc,allowPinchZoom:!0,shards:ze}:void 0,mt=j(A=>{const fe=F.current+A,ne=S().filter(K=>!K.disabled),oe=document.activeElement,Oe=ne.find(K=>K.ref.current===oe)?.textValue,Fe=ne.map(K=>K.textValue),Ue=fr(Fe,fe,Oe),we=ne.find(K=>K.textValue===Ue)?.ref.current;j((function K(xe){F.current=xe,window.clearTimeout(k.current),xe!==""&&(k.current=window.setTimeout(()=>K(""),1e3))}),"updateSearch")(fe),we&&setTimeout(()=>we.focus())},"handleTypeaheadSearch");c.useEffect(()=>()=>window.clearTimeout(k.current),[]),vr();const ue=c.useCallback(A=>W.current===I.current?.side&&pr(A,I.current?.area),[]);return C.jsx(vc,{scope:o,searchRef:F,onItemEnter:c.useCallback(A=>{ue(A)&&A.preventDefault()},[ue]),onItemLeave:c.useCallback(A=>{ue(A)||(P.current?.focus(),R(null))},[ue]),onTriggerLeave:c.useCallback(A=>{ue(A)&&A.preventDefault()},[ue]),pointerGraceTimerRef:D,onPointerGraceIntentChange:c.useCallback(A=>{I.current=A},[]),children:C.jsx(qn,{registry:M?_:null,children:C.jsx(Be,{...He,children:C.jsx(ri,{asChild:!0,trapped:s,branches:L,onMountAutoFocus:N(i,A=>{A.preventDefault(),P.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:C.jsx(ei,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:d,onInteractOutside:p,onDismiss:m,children:C.jsx(Qs,{asChild:!0,...b,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:R,onEntryFocus:N(l,A=>{x.isUsingKeyboardRef.current||A.preventDefault()}),preventScrollOnEntryFocus:!0,children:C.jsx(As,{role:"menu","aria-orientation":"vertical","data-state":cr(y.open),"data-radix-menu-content":"",dir:x.dir,...g,...w,ref:$,style:{outline:"none",...w.style},onKeyDown:N(w.onKeyDown,A=>{const ne=A.target.closest("[data-radix-menu-content]")===A.currentTarget,oe=A.ctrlKey||A.altKey||A.metaKey,Oe=A.key.length===1;ne&&(A.key==="Tab"&&A.preventDefault(),!oe&&Oe&&mt(A.key));const Fe=P.current;if(A.target!==Fe||!cc.includes(A.key))return;A.preventDefault();const we=S().filter(K=>!K.disabled).map(K=>K.ref.current);tr.includes(A.key)&&we.reverse(),lr(we)}),onBlur:N(t.onBlur,A=>{A.currentTarget.contains(A.target)||(window.clearTimeout(k.current),F.current="")}),onPointerMove:N(t.onPointerMove,rt(A=>{const fe=A.target,ne=U.current!==A.clientX;if(A.currentTarget.contains(fe)&&ne){const oe=A.clientX>U.current?"right":"left";W.current=oe,U.current=A.clientX}}))})})})})})})})},"MenuContentImpl")),kt="MenuItem",En="menu.itemSelect",Ec=c.forwardRef(j(function(t,n){const{disabled:o=!1,onSelect:r,...s}=t,i=c.useRef(null),a=nn(kt,t.__scopeMenu),u=ir(kt,t.__scopeMenu),l=z(n,i),h=c.useRef(!1),f=j(()=>{const d=i.current;if(!o&&d){const p=new CustomEvent(En,{bubbles:!0,cancelable:!0});d.addEventListener(En,m=>r?.(m),{once:!0}),Ht(d,p),p.defaultPrevented?h.current=!1:a.onClose()}},"handleSelect");return C.jsx(Sc,{...s,ref:l,disabled:o,onClick:N(t.onClick,f),onPointerDown:d=>{t.onPointerDown?.(d),h.current=!0},onPointerUp:N(t.onPointerUp,d=>{h.current||d.currentTarget?.click()}),onKeyDown:N(t.onKeyDown,d=>{o||d.target!==d.currentTarget||u.searchRef.current!==""&&d.key===" "||ic.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})},"MenuItem")),Sc=c.forwardRef(j(function(t,n){const{__scopeMenu:o,disabled:r=!1,textValue:s,...i}=t,a=ir(kt,o),u=or(o),l=c.useRef(null),h=z(n,l),[f,d]=c.useState(!1),[p,m]=c.useState("");return c.useEffect(()=>{const v=l.current;v&&m((v.textContent??"").trim())},[i.children]),C.jsx(jt.ItemSlot,{scope:o,disabled:r,textValue:s??p,children:C.jsx(nc,{asChild:!0,...u,focusable:!r,children:C.jsx(it.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:N(t.onPointerMove,rt(v=>{r?a.onItemLeave(v):(a.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:N(t.onPointerLeave,rt(v=>a.onItemLeave(v))),onFocus:N(t.onFocus,()=>d(!0)),onBlur:N(t.onBlur,()=>d(!1))})})})},"MenuItemImpl")),Cc="MenuRadioGroup",[Nc,jc]=Pe(Cc,{value:void 0,onValueChange:j(()=>{},"onValueChange")}),Rc="MenuItemIndicator",[kc,Wc]=Pe(Rc,{checked:!1}),Pc="MenuSub",[Vc,zc]=Pe(Pc);function cr(e){return e?"open":"closed"}j(cr,"getOpenState");function ar(e){return e==="indeterminate"}j(ar,"isIndeterminate");function Oc(e){return ar(e)?"indeterminate":e?"checked":"unchecked"}j(Oc,"getCheckedState");function lr(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}j(lr,"focusFirst");function ur(e,t){return e.map((n,o)=>e[(t+o)%e.length])}j(ur,"wrapArray");function fr(e,t,n){const r=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=ur(e,Math.max(s,0));r.length===1&&(i=i.filter(l=>l!==n));const u=i.find(l=>l.toLowerCase().startsWith(r.toLowerCase()));return u!==n?u:void 0}j(fr,"getNextMatch");function dr(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],u=t[i],l=a.x,h=a.y,f=u.x,d=u.y;h>o!=d>o&&n<(f-l)*(o-h)/(d-h)+l&&(r=!r)}return r}j(dr,"isPointInPolygon");function pr(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return dr(n,t)}j(pr,"isPointerInGraceArea");function rt(e){return t=>t.pointerType==="mouse"?e(t):void 0}j(rt,"whenMouse");var Ac=Object.defineProperty,We=(e,t)=>Ac(e,"name",{value:t,configurable:!0}),on="DropdownMenu",[_c,Bc]=Ie(on,[nr]),Ve=nr(),[Ic,mr]=_c(on),Hc=We(e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:s,onOpenChange:i,modal:a=!0}=e,u=Ve(t),l=c.useRef(null),[h,f]=Sn({prop:r,defaultProp:s??!1,onChange:i,caller:on});return C.jsx(Ic,{scope:t,triggerId:St(),triggerRef:l,contentId:St(),open:h,onOpenChange:f,onOpenToggle:c.useCallback(()=>f(d=>!d),[f]),modal:a,children:C.jsx(dc,{...u,open:h,onOpenChange:f,dir:o,modal:a,children:n})})},"DropdownMenu"),Dc="DropdownMenuTrigger",Uc=c.forwardRef(We(function(t,n){const{__scopeDropdownMenu:o,disabled:r=!1,...s}=t,i=mr(Dc,o),a=Ve(o),u=z(n,i.triggerRef);return C.jsx(pc,{asChild:!0,...a,children:C.jsx(Ar.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:u,onPointerDown:N(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:N(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})},"DropdownMenuTrigger")),Kc=We(e=>{const{__scopeDropdownMenu:t,...n}=e,o=Ve(t);return C.jsx(gc,{...o,...n})},"DropdownMenuPortal"),Mc="DropdownMenuContent",Gc=c.forwardRef(We(function(t,n){const{__scopeDropdownMenu:o,...r}=t,s=mr(Mc,o),i=Ve(o),a=c.useRef(!1);return C.jsx(yc,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...r,ref:n,onCloseAutoFocus:N(t.onCloseAutoFocus,u=>{a.current||s.triggerRef.current?.focus(),a.current=!1,u.preventDefault()}),onInteractOutside:N(t.onInteractOutside,u=>{const l=u.detail.originalEvent,h=l.button===0&&l.ctrlKey===!0,f=l.button===2||h;(!s.modal||f)&&(a.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),Yc=c.forwardRef(We(function(t,n){const{__scopeDropdownMenu:o,...r}=t,s=Ve(o);return C.jsx(Ec,{...s,...r,ref:n})},"DropdownMenuItem"));export{Hc as D,Cs as P,Fc as U,Uc as a,Kc as b,Gc as c,Yc as d,_o as e,Ps as f,As as g};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as w,A as L}from"./index-DkpU9Fgs.js";import{s as y,c as S}from"./ProjectWorkspace-CAX3qEYr.js";import"./react-CltQJflK.js";import"./chevron-up-D5lCNKlk.js";import"./check-CwBYzomT.js";import"./x-C_3swJOC.js";import"./search-CPbhRWQE.js";import"./index-_eYe7K9T.js";import"./refresh-cw-BE8IbaHI.js";const k=5,f=new Map,C=12,x=S();let E=0;class p extends Error{constructor(){super("A newer writing check replaced this request."),this.name="HarperLintSupersededError"}}function N(e){return e instanceof p}function $(e){const t=[0];let r=0;for(const n of e)r+=n.length,t.push(r);return t}function d(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))].sort((t,r)=>t.localeCompare(r)).join("\0")}async function v(e,t,r,n){try{return(await w(`/api/projects/${e}/spellcheck`,{method:"POST",body:JSON.stringify({path:t,source:r,clientId:x,sequence:n})})).lints}catch(o){throw o instanceof L&&o.code==="SPELLCHECK_SUPERSEDED"?new p:o}}function A(e,t,r){if(!t.problem)return null;const n={from:t.start,to:t.end},o={from:r[t.start]??-1,to:r[t.end]??-1},i=c=>c.from>=0&&c.to>c.from&&c.to<=e.length,a=c=>i(c)&&e.slice(c.from,c.to)===t.problem;return a(o)?o:a(n)?n:null}function H(e,t,r){const n=A(e,t,r);if(!n)return null;const{from:o,to:i}=n,a=e.slice(o,i);if(!a.trim()||!/[A-Za-z]/.test(a)||t.kind==="Formatting")return null;const c=t.kind==="Spelling"||t.kind==="Typo"?"spelling":"grammar",u=t.suggestions.filter((m,s,l)=>s<k&&l.indexOf(m)===s);return{from:o,to:i,word:a,kind:c,message:t.message,suggestions:u}}function h(e,t){let r=2166136261;for(let n=0;n<t.length;n+=1)r^=t.charCodeAt(n),r=Math.imul(r,16777619);return`${e}\0${t.length}:${r>>>0}`}function g(e,t,r){const n=h(e,t),o=f.get(n);return!o||o.path!==e||o.source!==t||o.dictionary!==r?null:(f.delete(n),f.set(n,o),o.issues)}function R(e,t,r,n){const o=h(e,t);for(f.set(o,{path:e,source:t,dictionary:r,issues:n});f.size>C;){const i=f.keys().next().value;if(i===void 0)break;f.delete(i)}}async function b(e,t,r,n="main.tex"){const o=d(t),i=g(n,e,o);if(i)return i;const a=$(e),c=new Set(t.map(s=>s.trim().toLocaleLowerCase("en-US")).filter(Boolean)),u=new Set,m=r.map(s=>H(e,s,a)).filter(s=>!!s).filter(s=>s.kind!=="spelling"||!c.has(s.word.trim().toLocaleLowerCase("en-US"))).filter(s=>{const l=`${s.from}:${s.to}:${s.kind}`;return u.has(l)?!1:(u.add(l),!0)}).sort((s,l)=>s.from-l.from||s.to-l.to);return R(n,e,o,m),m}async function P(e,t,r,n){const o=d(n),i=g(t,r,o);if(i)return i;const a=await v(e,t,r,++E);return b(r,n,a,t)}function T(e,t,r,n=[]){return y(t)?P(e,t,r,n):Promise.resolve([])}export{p as HarperLintSupersededError,N as isHarperLintSupersededError,T as lintLatex,b as mapLatexLints};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as a}from"./index-DkpU9Fgs.js";const t=a("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const h=a("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);const y=a("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);const k=a("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);const d=a("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const p=a("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const c=a("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const s=a("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);const r=a("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);const l=a("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);const o=a("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);const n=a("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);const M=a("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const i=a("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const v=a("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const x=a("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);const m=a("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);const H=a("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);const q=a("NotepadText",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"16",height:"18",x:"4",y:"4",rx:"2",key:"1u9h20"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);const u=a("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const g=a("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);const f=a("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const w=a("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const z=a("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);const b=a("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);const F=a("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);export{h as A,y as B,p as C,c as D,s as E,o as F,x as G,m as L,H as M,q as N,u as P,g as S,f as T,b as U,F as X,v as a,n as b,l as c,k as d,M as e,t as f,z as g,i as h,d as i,r as j,w as k};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import { listProjectFilesAsync, resolveSourcePath } from "./files.js";
|
|
3
|
-
import { httpError } from "./http.js";
|
|
4
|
-
const textExtension = /(?:\.(?:tex|bib|sty|cls|txt|md)|latexmkrc)$/i;
|
|
5
|
-
const maxFiles = 500;
|
|
6
|
-
const maxFileBytes = 3 * 1024 * 1024;
|
|
7
|
-
const maxTotalBytes = 24 * 1024 * 1024;
|
|
8
|
-
const maxMatches = 500;
|
|
9
|
-
export async function searchProject(config, projectId, options) {
|
|
10
|
-
const pattern = searchPattern(options);
|
|
11
|
-
const matches = [];
|
|
12
|
-
let total = 0;
|
|
13
|
-
let indexedBytes = 0;
|
|
14
|
-
const entries = (await listProjectFilesAsync(config, projectId)).filter((entry) => entry.type === "file" && textExtension.test(entry.path)).slice(0, maxFiles);
|
|
15
|
-
for (const entry of entries) {
|
|
16
|
-
if ((entry.size ?? 0) > maxFileBytes || indexedBytes + (entry.size ?? 0) > maxTotalBytes)
|
|
17
|
-
continue;
|
|
18
|
-
indexedBytes += entry.size ?? 0;
|
|
19
|
-
let content;
|
|
20
|
-
try {
|
|
21
|
-
content = await fs.promises.readFile(resolveSourcePath(config, projectId, entry.path), "utf8");
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
pattern.lastIndex = 0;
|
|
27
|
-
let line = 1;
|
|
28
|
-
let lineStart = 0;
|
|
29
|
-
let nextLineBreak = content.indexOf("\n");
|
|
30
|
-
for (const match of content.matchAll(pattern)) {
|
|
31
|
-
total += 1;
|
|
32
|
-
if (matches.length >= maxMatches)
|
|
33
|
-
continue;
|
|
34
|
-
const offset = match.index;
|
|
35
|
-
while (nextLineBreak >= 0 && nextLineBreak < offset) {
|
|
36
|
-
line += 1;
|
|
37
|
-
lineStart = nextLineBreak + 1;
|
|
38
|
-
nextLineBreak = content.indexOf("\n", lineStart);
|
|
39
|
-
}
|
|
40
|
-
const lineEndCandidate = content.indexOf("\n", offset);
|
|
41
|
-
const lineEnd = lineEndCandidate < 0 ? content.length : lineEndCandidate;
|
|
42
|
-
const preview = content.slice(lineStart, lineEnd).slice(0, 500);
|
|
43
|
-
const previewOffset = Math.min(offset - lineStart, 500);
|
|
44
|
-
matches.push({
|
|
45
|
-
path: entry.path,
|
|
46
|
-
line,
|
|
47
|
-
column: offset - lineStart + 1,
|
|
48
|
-
preview,
|
|
49
|
-
matchStart: previewOffset,
|
|
50
|
-
matchEnd: Math.min(preview.length, previewOffset + match[0].length)
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return { matches, total, truncated: total > matches.length };
|
|
55
|
-
}
|
|
56
|
-
export async function replaceProject(config, projectId, options, replacement) {
|
|
57
|
-
const pattern = searchPattern(options);
|
|
58
|
-
const staged = [];
|
|
59
|
-
let indexedBytes = 0;
|
|
60
|
-
const entries = (await listProjectFilesAsync(config, projectId)).filter((entry) => entry.type === "file" && textExtension.test(entry.path)).slice(0, maxFiles);
|
|
61
|
-
for (const entry of entries) {
|
|
62
|
-
if ((entry.size ?? 0) > maxFileBytes || indexedBytes + (entry.size ?? 0) > maxTotalBytes)
|
|
63
|
-
continue;
|
|
64
|
-
indexedBytes += entry.size ?? 0;
|
|
65
|
-
const absolute = resolveSourcePath(config, projectId, entry.path);
|
|
66
|
-
let previous;
|
|
67
|
-
try {
|
|
68
|
-
previous = await fs.promises.readFile(absolute, "utf8");
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
pattern.lastIndex = 0;
|
|
74
|
-
let count = 0;
|
|
75
|
-
const content = previous.replace(pattern, () => { count += 1; return replacement; });
|
|
76
|
-
if (!count || content === previous)
|
|
77
|
-
continue;
|
|
78
|
-
if (options.maxFileBytes !== undefined && Buffer.byteLength(content, "utf8") > options.maxFileBytes) {
|
|
79
|
-
await Promise.allSettled(staged.map((entry) => fs.promises.rm(entry.temporary, { force: true })));
|
|
80
|
-
throw httpError(413, "FILE_TOO_LARGE", { size: Math.floor(options.maxFileBytes / 1024 / 1024) });
|
|
81
|
-
}
|
|
82
|
-
const temporary = `${absolute}.search-${process.pid}-${Date.now()}-${staged.length}.tmp`;
|
|
83
|
-
await fs.promises.writeFile(temporary, content, { encoding: "utf8", mode: 0o600 });
|
|
84
|
-
staged.push({ path: entry.path, absolute, temporary, previous, content, count });
|
|
85
|
-
}
|
|
86
|
-
const installed = [];
|
|
87
|
-
try {
|
|
88
|
-
for (const entry of staged) {
|
|
89
|
-
await fs.promises.rename(entry.temporary, entry.absolute);
|
|
90
|
-
installed.push(entry);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
// A project-wide replacement is presented as one operation. Restore every
|
|
95
|
-
// file already installed if a later rename fails, and remove unused stages.
|
|
96
|
-
for (const entry of installed.reverse()) {
|
|
97
|
-
const rollback = `${entry.absolute}.search-rollback-${process.pid}-${Date.now()}.tmp`;
|
|
98
|
-
await fs.promises.writeFile(rollback, entry.previous, { encoding: "utf8", mode: 0o600 });
|
|
99
|
-
await fs.promises.rename(rollback, entry.absolute);
|
|
100
|
-
}
|
|
101
|
-
await Promise.allSettled(staged.map((entry) => fs.promises.rm(entry.temporary, { force: true })));
|
|
102
|
-
throw error;
|
|
103
|
-
}
|
|
104
|
-
return staged.map(({ path: filePath, previous, content, count }) => ({ path: filePath, previous, content, count }));
|
|
105
|
-
}
|
|
106
|
-
function searchPattern(options) {
|
|
107
|
-
const query = options.query.trim();
|
|
108
|
-
if (!query || query.length > 500)
|
|
109
|
-
throw httpError(400, "SEARCH_QUERY_INVALID");
|
|
110
|
-
const escaped = query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
111
|
-
const source = options.wholeWord ? `(?<![\\p{L}\\p{N}_])${escaped}(?![\\p{L}\\p{N}_])` : escaped;
|
|
112
|
-
return new RegExp(source, `${options.caseSensitive ? "" : "i"}gu`);
|
|
113
|
-
}
|