"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[328],{7328:(e,t,r)=>{function l(e,t,r){if(!t.has(e))throw TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function n(e,t){var r=l(e,t,"get");return r.get?r.get.call(e):r.value}function o(e,t,r){var n=l(e,t,"set");if(n.set)n.set.call(e,r);else{if(!n.writable)throw TypeError("attempted to set read only private field");n.value=r}return r}r.d(t,{N:()=>p});var a,i=r(2115),u=r(6081),c=r(6101),f=r(9708),s=r(5155);function p(e){let t=e+"CollectionProvider",[r,l]=(0,u.A)(t),[n,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),a=e=>{let{scope:t,children:r}=e,l=i.useRef(null),o=i.useRef(new Map).current;return(0,s.jsx)(n,{scope:t,itemMap:o,collectionRef:l,children:r})};a.displayName=t;let p=e+"CollectionSlot",d=(0,f.TL)(p),m=i.forwardRef((e,t)=>{let{scope:r,children:l}=e,n=o(p,r),a=(0,c.s)(t,n.collectionRef);return(0,s.jsx)(d,{ref:a,children:l})});m.displayName=p;let v=e+"CollectionItemSlot",y="data-radix-collection-item",w=(0,f.TL)(v),M=i.forwardRef((e,t)=>{let{scope:r,children:l,...n}=e,a=i.useRef(null),u=(0,c.s)(t,a),f=o(v,r);return i.useEffect(()=>(f.itemMap.set(a,{ref:a,...n}),()=>void f.itemMap.delete(a))),(0,s.jsx)(w,{...{[y]:""},ref:u,children:l})});return M.displayName=v,[{Provider:a,Slot:m,ItemSlot:M},function(t){let r=o(e+"CollectionConsumer",t);return i.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll("[".concat(y,"]")));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},l]}var d=new WeakMap;function m(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);let r=function(e,t){let r=e.length,l=v(t),n=l>=0?l:r+l;return n<0||n>=r?-1:n}(e,t);return -1===r?void 0:e[r]}function v(e){return e!=e||0===e?0:Math.trunc(e)}a=new WeakMap}}]);