@b1-road/react 0.1.0-alpha.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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +300 -0
  3. package/dist/__tests__/a11y.test.d.ts +1 -0
  4. package/dist/__tests__/contract-replay.test.d.ts +1 -0
  5. package/dist/__tests__/create-role-dialog.test.d.ts +1 -0
  6. package/dist/__tests__/form-errors.test.d.ts +1 -0
  7. package/dist/__tests__/pending-invitations.test.d.ts +1 -0
  8. package/dist/__tests__/setup.d.ts +0 -0
  9. package/dist/api/client.d.ts +253 -0
  10. package/dist/api/client.test.d.ts +1 -0
  11. package/dist/api/cookie-mode.test.d.ts +1 -0
  12. package/dist/api/errors.d.ts +107 -0
  13. package/dist/api/errors.test.d.ts +1 -0
  14. package/dist/api/hooks.d.ts +126 -0
  15. package/dist/api/hooks.test.d.ts +1 -0
  16. package/dist/api/mock-client.d.ts +121 -0
  17. package/dist/api/mock-client.test.d.ts +1 -0
  18. package/dist/api/types.d.ts +7 -0
  19. package/dist/appearance/appearance.d.ts +19 -0
  20. package/dist/components/BusinessUnitSwitcher.d.ts +15 -0
  21. package/dist/components/BusinessUnitsMgmt.d.ts +35 -0
  22. package/dist/components/business-units/BusinessUnitDetail.d.ts +6 -0
  23. package/dist/components/business-units/BusinessUnitList.d.ts +5 -0
  24. package/dist/components/business-units/BusinessUnitRow.d.ts +7 -0
  25. package/dist/components/business-units/BusinessUnitSettings.d.ts +5 -0
  26. package/dist/components/business-units/BusinessUnitsTab.d.ts +5 -0
  27. package/dist/components/business-units/CreateBusinessUnitForm.d.ts +6 -0
  28. package/dist/components/business-units/MembersList.d.ts +5 -0
  29. package/dist/components/business-units/PendingInvitations.d.ts +15 -0
  30. package/dist/components/invitations/InvitationsList.d.ts +7 -0
  31. package/dist/components/invitations/InvitationsTab.d.ts +5 -0
  32. package/dist/components/invitations/InviteForm.d.ts +7 -0
  33. package/dist/components/roles/BUSelector.d.ts +8 -0
  34. package/dist/components/roles/CreateRoleDialog.d.ts +8 -0
  35. package/dist/components/roles/PermissionPicker.d.ts +10 -0
  36. package/dist/components/roles/RoleEditor.d.ts +7 -0
  37. package/dist/components/roles/RoleRow.d.ts +7 -0
  38. package/dist/components/roles/RolesList.d.ts +7 -0
  39. package/dist/components/roles/RolesTab.d.ts +1 -0
  40. package/dist/components/shared/Avatar.d.ts +7 -0
  41. package/dist/components/shared/EmptyState.d.ts +10 -0
  42. package/dist/components/shared/LoadMoreFooter.d.ts +18 -0
  43. package/dist/i18n/context.d.ts +21 -0
  44. package/dist/i18n/en.d.ts +2 -0
  45. package/dist/i18n/pt-BR.d.ts +2 -0
  46. package/dist/i18n/types.d.ts +227 -0
  47. package/dist/index.cjs +56 -0
  48. package/dist/index.cjs.map +1 -0
  49. package/dist/index.d.ts +25 -0
  50. package/dist/index.js +16566 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/lib/cn.d.ts +2 -0
  53. package/dist/lib/use-form-errors.d.ts +34 -0
  54. package/dist/provider/RoadProvider.d.ts +93 -0
  55. package/dist/provider/context.d.ts +12 -0
  56. package/dist/provider/cookie-mode-integration.test.d.ts +1 -0
  57. package/dist/provider/current-business-unit.d.ts +37 -0
  58. package/dist/provider/current-business-unit.test.d.ts +1 -0
  59. package/dist/provider/strict-mode-checks.test.d.ts +1 -0
  60. package/dist/style.css +1 -0
  61. package/dist/ui/alert-dialog.d.ts +8 -0
  62. package/dist/ui/badge.d.ts +9 -0
  63. package/dist/ui/button.d.ts +11 -0
  64. package/dist/ui/checkbox.d.ts +2 -0
  65. package/dist/ui/dialog.d.ts +17 -0
  66. package/dist/ui/dropdown-menu.d.ts +10 -0
  67. package/dist/ui/field.d.ts +26 -0
  68. package/dist/ui/input.d.ts +4 -0
  69. package/dist/ui/label.d.ts +2 -0
  70. package/dist/ui/select.d.ts +6 -0
  71. package/dist/ui/skeleton.d.ts +2 -0
  72. package/dist/ui/tabs.d.ts +5 -0
  73. package/dist/ui/textarea.d.ts +2 -0
  74. package/dist/ui/tooltip.d.ts +5 -0
  75. package/package.json +126 -0
package/dist/index.cjs ADDED
@@ -0,0 +1,56 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),x=require("react"),As=require("react-dom"),Rn=require("@b1-road/types");function Xi(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const m=Xi(x),mr=Xi(As);var on=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Cu=class extends on{#t;#e;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},ks=new Cu,Su={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Nu=class{#t=Su;#e=!1;setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&this.#e&&e!==this.#t&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#t,provider:e}),this.#t=e,process.env.NODE_ENV!=="production"&&(this.#e=!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&(this.#e=!0),this.#t.setTimeout(e,t)}clearTimeout(e){this.#t.clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&(this.#e=!0),this.#t.setInterval(e,t)}clearInterval(e){this.#t.clearInterval(e)}},kt=new Nu;function Ru(e){setTimeout(e,0)}var Eu=typeof window>"u"||"Deno"in globalThis;function Ce(){}function ju(e,t){return typeof e=="function"?e(t):e}function rs(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ji(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ht(e,t){return typeof e=="function"?e(t):e}function Pe(e,t){return typeof e=="function"?e(t):e}function zo(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:o,queryKey:a,stale:c}=e;if(a){if(r){if(t.queryHash!==Is(a,t.options))return!1}else if(!bn(t.queryKey,a))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||s&&s!==t.state.fetchStatus||o&&!o(t))}function Vo(e,t){const{exact:n,status:r,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Ot(t.options.mutationKey)!==Ot(o))return!1}else if(!bn(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Is(e,t){return(t?.queryKeyHashFn||Ot)(e)}function Ot(e){return JSON.stringify(e,(t,n)=>os(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function bn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>bn(e[n],t[n])):!1}var Pu=Object.prototype.hasOwnProperty;function ss(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Ho(e)&&Ho(t);if(!r&&!(os(e)&&os(t)))return t;const o=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),c=a.length,l=r?new Array(c):{};let f=0;for(let u=0;u<c;u++){const d=r?u:a[u],p=e[d],g=t[d];if(p===g){l[d]=p,(r?u<o:Pu.call(e,d))&&f++;continue}if(p===null||g===null||typeof p!="object"||typeof g!="object"){l[d]=g;continue}const v=ss(p,g,n+1);l[d]=v,v===p&&f++}return o===c&&f===o?e:l}function Jn(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Ho(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function os(e){if(!qo(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!qo(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function qo(e){return Object.prototype.toString.call(e)==="[object Object]"}function Tu(e){return new Promise(t=>{kt.setTimeout(t,e)})}function is(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return ss(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return ss(e,t)}return t}function Mu(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Au(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Zn=Symbol();function Zi(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Zn&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Zn?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ds(e,t){return typeof e=="function"?e(...t):!!e}function ku(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t(),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var yn=(()=>{let e=()=>Eu;return{isServer(){return e()},setIsServer(t){e=t}}})();function as(){let e,t;const n=new Promise((s,o)=>{e=s,t=o});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var Iu=Ru;function Du(){let e=[],t=0,n=c=>{c()},r=c=>{c()},s=Iu;const o=c=>{t?e.push(c):s(()=>{n(c)})},a=()=>{const c=e;e=[],c.length&&s(()=>{r(()=>{c.forEach(l=>{n(l)})})})};return{batch:c=>{let l;t++;try{l=c()}finally{t--,t||a()}return l},batchCalls:c=>(...l)=>{o(()=>{c(...l)})},schedule:o,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{s=c}}}var he=Du(),Ou=class extends on{#t=!0;#e;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#t}},er=new Ou;function _u(e){return Math.min(1e3*2**e,3e4)}function ea(e){return(e??"online")==="online"?er.isOnline():!0}var cs=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function ta(e){let t=!1,n=0,r;const s=as(),o=()=>s.status!=="pending",a=h=>{if(!o()){const b=new cs(h);p(b),e.onCancel?.(b)}},c=()=>{t=!0},l=()=>{t=!1},f=()=>ks.isFocused()&&(e.networkMode==="always"||er.isOnline())&&e.canRun(),u=()=>ea(e.networkMode)&&e.canRun(),d=h=>{o()||(r?.(),s.resolve(h))},p=h=>{o()||(r?.(),s.reject(h))},g=()=>new Promise(h=>{r=b=>{(o()||f())&&h(b)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),v=()=>{if(o())return;let h;const b=n===0?e.initialPromise:void 0;try{h=b??e.fn()}catch(y){h=Promise.reject(y)}Promise.resolve(h).then(d).catch(y=>{if(o())return;const w=e.retry??(yn.isServer()?0:3),C=e.retryDelay??_u,S=typeof C=="function"?C(n,y):C,E=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,y);if(t||!E){p(y);return}n++,e.onFail?.(n,y),Tu(S).then(()=>f()?void 0:g()).then(()=>{t?p(y):v()})})};return{promise:s,status:()=>s.status,cancel:a,continue:()=>(r?.(),s),cancelRetry:c,continueRetry:l,canStart:u,start:()=>(u()?v():g().then(v),s)}}var na=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),rs(this.gcTime)&&(this.#t=kt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(yn.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#t!==void 0&&(kt.clearTimeout(this.#t),this.#t=void 0)}};function Lu(e){return{onFetch:(t,n)=>{const r=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let c={pages:[],pageParams:[]},l=0;const f=async()=>{let u=!1;const d=v=>{ku(v,()=>t.signal,()=>u=!0)},p=Zi(t.options,t.fetchOptions),g=async(v,h,b)=>{if(u)return Promise.reject(t.signal.reason);if(h==null&&v.pages.length)return Promise.resolve(v);const w=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:h,direction:b?"backward":"forward",meta:t.options.meta};return d(P),P})(),C=await p(w),{maxPages:S}=t.options,E=b?Au:Mu;return{pages:E(v.pages,C,S),pageParams:E(v.pageParams,h,S)}};if(s&&o.length){const v=s==="backward",h=v?ra:ls,b={pages:o,pageParams:a},y=h(r,b);c=await g(b,y,v)}else{const v=e??o.length;do{const h=l===0?a[0]??r.initialPageParam:ls(r,c);if(l>0&&h==null)break;c=await g(c,h),l++}while(l<v)}return c};t.options.persister?t.fetchFn=()=>t.options.persister?.(f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=f}}}function ls(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function ra(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Fu(e,t){return t?ls(e,t)!=null:!1}function Bu(e,t){return!t||!e.getPreviousPageParam?!1:ra(e,t)!=null}var Uu=class extends na{#t;#e;#n;#r;#o;#s;#a;#i;constructor(e){super(),this.#i=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#o=e.client,this.#r=this.#o.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Ko(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#t}get promise(){return this.#s?.promise}setOptions(e){if(this.options={...this.#a,...e},e?._type&&(this.#t=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=Ko(this.options);t.data!==void 0&&(this.setState(Wo(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const n=is(this.state.data,e,this.options);return this.#c({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:"setState",state:e})}cancel(e){const t=this.#s?.promise;return this.#s?.cancel(e),t?t.then(Ce).catch(Ce):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Pe(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Zn||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ht(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Ji(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#s?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#s?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#s&&(this.#i||this.#d()?this.#s.cancel({revert:!0}):this.#s.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#d(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#c({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#s?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#s)return this.#s.continueRetry(),this.#s.promise}if(e&&this.setOptions(e),!this.options.queryFn){const l=this.observers.find(f=>f.options.queryFn);l&&this.setOptions(l.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,r=l=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(this.#i=!0,n.signal)})},s=()=>{const l=Zi(this.options,t),u=(()=>{const d={client:this.#o,queryKey:this.queryKey,meta:this.meta};return r(d),d})();return this.#i=!1,this.options.persister?this.options.persister(l,u,this):l(u)},a=(()=>{const l={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#o,state:this.state,fetchFn:s};return r(l),l})();(this.#t==="infinite"?Lu(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:"fetch",meta:a.fetchOptions?.meta}),this.#s=ta({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:l=>{l instanceof cs&&l.revert&&this.setState({...this.#n,fetchStatus:"idle"}),n.abort()},onFail:(l,f)=>{this.#c({type:"failed",failureCount:l,error:f})},onPause:()=>{this.#c({type:"pause"})},onContinue:()=>{this.#c({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const l=await this.#s.start();if(l===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(l),this.#r.config.onSuccess?.(l,this),this.#r.config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof cs){if(l.silent)return this.#s.promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw this.#c({type:"error",error:l}),this.#r.config.onError?.(l,this),this.#r.config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc()}}#c(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...sa(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...Wo(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?r:void 0,r;case"error":const s=e.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),he.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function sa(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ea(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Wo(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ko(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var oa=class extends on{constructor(e,t){super(),this.options=t,this.#t=e,this.#i=null,this.#a=as(),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#n=void 0;#r=void 0;#o;#s;#a;#i;#d;#c;#h;#u;#f;#l;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Go(this.#e,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ds(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ds(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,n=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Pe(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#C(),this.#e.setOptions(this.options),t._defaulted&&!Jn(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&Qo(this.#e,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#e!==n||Pe(this.options.enabled,this.#e)!==Pe(t.enabled,this.#e)||ht(this.options.staleTime,this.#e)!==ht(t.staleTime,this.#e))&&this.#g();const s=this.#v();r&&(this.#e!==n||Pe(this.options.enabled,this.#e)!==Pe(t.enabled,this.#e)||s!==this.#l)&&this.#b(s)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),n=this.createResult(t,e);return zu(this,n)&&(this.#r=n,this.#s=this.options,this.#o=this.#e.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),n=this.#t.getQueryCache().build(this.#t,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#C();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Ce)),t}#g(){this.#x();const e=ht(this.options.staleTime,this.#e);if(yn.isServer()||this.#r.isStale||!rs(e))return;const n=Ji(this.#r.dataUpdatedAt,e)+1;this.#u=kt.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#b(e){this.#w(),this.#l=e,!(yn.isServer()||Pe(this.options.enabled,this.#e)===!1||!rs(this.#l)||this.#l===0)&&(this.#f=kt.setInterval(()=>{(this.options.refetchIntervalInBackground||ks.isFocused())&&this.#m()},this.#l))}#y(){this.#g(),this.#b(this.#v())}#x(){this.#u!==void 0&&(kt.clearTimeout(this.#u),this.#u=void 0)}#w(){this.#f!==void 0&&(kt.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){const n=this.#e,r=this.options,s=this.#r,o=this.#o,a=this.#s,l=e!==n?e.state:this.#n,{state:f}=e;let u={...f},d=!1,p;if(t._optimisticResults){const N=this.hasListeners(),A=!N&&Go(e,t),$=N&&Qo(e,n,t,r);(A||$)&&(u={...u,...sa(f.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:g,errorUpdatedAt:v,status:h}=u;p=u.data;let b=!1;if(t.placeholderData!==void 0&&p===void 0&&h==="pending"){let N;s?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(N=s.data,b=!0):N=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,N!==void 0&&(h="success",p=is(s?.data,N,t),d=!0)}if(t.select&&p!==void 0&&!b)if(s&&p===o?.data&&t.select===this.#d)p=this.#c;else try{this.#d=t.select,p=t.select(p),p=is(s?.data,p,t),this.#c=p,this.#i=null}catch(N){this.#i=N}this.#i&&(g=this.#i,p=this.#c,v=Date.now(),h="error");const y=u.fetchStatus==="fetching",w=h==="pending",C=h==="error",S=w&&y,E=p!==void 0,R={status:h,fetchStatus:u.fetchStatus,isPending:w,isSuccess:h==="success",isError:C,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:u.dataUpdatedAt,error:g,errorUpdatedAt:v,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>l.dataUpdateCount||u.errorUpdateCount>l.errorUpdateCount,isFetching:y,isRefetching:y&&!w,isLoadingError:C&&!E,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:C&&E,isStale:Os(e,t),refetch:this.refetch,promise:this.#a,isEnabled:Pe(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const N=R.data!==void 0,A=R.status==="error"&&!N,$=F=>{A?F.reject(R.error):N&&F.resolve(R.data)},L=()=>{const F=this.#a=R.promise=as();$(F)},B=this.#a;switch(B.status){case"pending":e.queryHash===n.queryHash&&$(B);break;case"fulfilled":(A||R.data!==B.value)&&L();break;case"rejected":(!A||R.error!==B.reason)&&L();break}}return R}updateResult(){const e=this.#r,t=this.createResult(this.#e,this.options);if(this.#o=this.#e.state,this.#s=this.options,this.#o.data!==void 0&&(this.#h=this.#e),Jn(t,e))return;this.#r=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,s=typeof r=="function"?r():r;if(s==="all"||!s&&!this.#p.size)return!0;const o=new Set(s??this.#p);return this.options.throwOnError&&o.add("error"),Object.keys(this.#r).some(a=>{const c=a;return this.#r[c]!==e[c]&&o.has(c)})};this.#S({listeners:n()})}#C(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#S(e){he.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function $u(e,t){return Pe(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Pe(t.retryOnMount,e)===!1)}function Go(e,t){return $u(e,t)||e.state.data!==void 0&&ds(e,t,t.refetchOnMount)}function ds(e,t,n){if(Pe(t.enabled,e)!==!1&&ht(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Os(e,t)}return!1}function Qo(e,t,n,r){return(e!==t||Pe(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Os(e,n)}function Os(e,t){return Pe(t.enabled,e)!==!1&&e.isStaleByTime(ht(t.staleTime,e))}function zu(e,t){return!Jn(e.getCurrentResult(),t)}var Vu=class extends oa{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,r=super.createResult(e,t),{isFetching:s,isRefetching:o,isError:a,isRefetchError:c}=r,l=n.fetchMeta?.fetchMore?.direction,f=a&&l==="forward",u=s&&l==="forward",d=a&&l==="backward",p=s&&l==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Fu(t,n.data),hasPreviousPage:Bu(t,n.data),isFetchNextPageError:f,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:p,isRefetchError:c&&!f&&!d,isRefetching:o&&!u&&!p}}},Hu=class extends na{#t;#e;#n;#r;constructor(e){super(),this.#t=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#e=[],this.state=e.state||ia(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#e.includes(e)||(this.#e.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#e=this.#e.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#o({type:"continue"})},n={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=ta({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(o,a)=>{this.#o({type:"failed",failureCount:o,error:a})},onPause:()=>{this.#o({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",s=!this.#r.canStart();try{if(r)t();else{this.#o({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const a=await this.options.onMutate?.(e,n);a!==this.state.context&&this.#o({type:"pending",context:a,variables:e,isPaused:s})}const o=await this.#r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#o({type:"success",data:o}),o}catch(o){try{await this.#n.config.onError?.(o,e,this.state.context,this,n)}catch(a){Promise.reject(a)}try{await this.options.onError?.(o,e,this.state.context,n)}catch(a){Promise.reject(a)}try{await this.#n.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,n)}catch(a){Promise.reject(a)}try{await this.options.onSettled?.(void 0,o,e,this.state.context,n)}catch(a){Promise.reject(a)}throw this.#o({type:"error",error:o}),o}finally{this.#n.runNext(this)}}#o(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),he.batch(()=>{this.#e.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function ia(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var qu=class extends on{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#n=0}#t;#e;#n;build(e,t,n){const r=new Hu({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#t.add(e);const t=_n(e);if(typeof t=="string"){const n=this.#e.get(t);n?n.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=_n(e);if(typeof t=="string"){const n=this.#e.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=_n(e);if(typeof t=="string"){const r=this.#e.get(t)?.find(s=>s.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=_n(e);return typeof t=="string"?this.#e.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){he.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Vo(t,n))}findAll(e={}){return this.getAll().filter(t=>Vo(e,t))}notify(e){he.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return he.batch(()=>Promise.all(e.map(t=>t.continue().catch(Ce))))}};function _n(e){return e.options.scope?.id}var Wu=class extends on{#t;#e=void 0;#n;#r;constructor(t,n){super(),this.#t=t,this.setOptions(n),this.bindMethods(),this.#o()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#t.defaultMutationOptions(t),Jn(this.options,n)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&Ot(n.mutationKey)!==Ot(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#o(),this.#s(t)}getCurrentResult(){return this.#e}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#o(),this.#s()}mutate(t,n){return this.#r=n,this.#n?.removeObserver(this),this.#n=this.#t.getMutationCache().build(this.#t,this.options),this.#n.addObserver(this),this.#n.execute(t)}#o(){const t=this.#n?.state??ia();this.#e={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#s(t){he.batch(()=>{if(this.#r&&this.hasListeners()){const n=this.#e.variables,r=this.#e.context,s={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#r.onSuccess?.(t.data,n,r,s)}catch(o){Promise.reject(o)}try{this.#r.onSettled?.(t.data,null,n,r,s)}catch(o){Promise.reject(o)}}else if(t?.type==="error"){try{this.#r.onError?.(t.error,n,r,s)}catch(o){Promise.reject(o)}try{this.#r.onSettled?.(void 0,t.error,n,r,s)}catch(o){Promise.reject(o)}}}this.listeners.forEach(n=>{n(this.#e)})})}},Ku=class extends on{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,n){const r=t.queryKey,s=t.queryHash??Is(r,t);let o=this.get(s);return o||(o=new Uu({client:e,queryKey:r,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){he.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>zo(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>zo(e,n)):t}notify(e){he.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){he.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){he.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Gu=class{#t;#e;#n;#r;#o;#s;#a;#i;constructor(e={}){this.#t=e.queryCache||new Ku,this.#e=e.mutationCache||new qu,this.#n=e.defaultOptions||{},this.#r=new Map,this.#o=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#a=ks.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#i=er.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#a?.(),this.#a=void 0,this.#i?.(),this.#i=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#t.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ht(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=this.#t.get(r.queryHash)?.state.data,a=ju(t,o);if(a!==void 0)return this.#t.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return he.batch(()=>this.#t.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;he.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#t;return he.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=he.batch(()=>this.#t.findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ce).catch(Ce)}invalidateQueries(e,t={}){return he.batch(()=>(this.#t.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=he.batch(()=>this.#t.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(Ce)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(Ce)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#t.build(this,t);return n.isStaleByTime(ht(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ce).catch(Ce)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ce).catch(Ce)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return er.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Ot(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{bn(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#o.set(Ot(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#o.values()],n={};return t.forEach(r=>{bn(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Is(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Zn&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},aa=m.createContext(void 0),Se=e=>{const t=m.useContext(aa);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Qu=({client:e,children:t})=>(m.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),i.jsx(aa.Provider,{value:e,children:t})),ca=m.createContext(!1),Yu=()=>m.useContext(ca);ca.Provider;function Xu(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ju=m.createContext(Xu()),Zu=()=>m.useContext(Ju),ef=(e,t,n)=>{const r=n?.state.error&&typeof e.throwOnError=="function"?Ds(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},tf=e=>{m.useEffect(()=>{e.clearReset()},[e])},nf=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Ds(n,[e.error,r])),rf=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},sf=(e,t)=>e.isLoading&&e.isFetching&&!t,of=(e,t)=>e?.suspense&&t.isPending,Yo=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function la(e,t,n){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=Yu(),s=Zu(),o=Se(),a=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const c=o.getQueryCache().get(a.queryHash);process.env.NODE_ENV!=="production"&&(a.queryFn||console.error(`[${a.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const l=e.subscribed!==!1;a._optimisticResults=r?"isRestoring":l?"optimistic":void 0,rf(a),ef(a,s,c),tf(s);const f=!o.getQueryCache().get(a.queryHash),[u]=m.useState(()=>new t(o,a)),d=u.getOptimisticResult(a),p=!r&&l;if(m.useSyncExternalStore(m.useCallback(g=>{const v=p?u.subscribe(he.batchCalls(g)):Ce;return u.updateResult(),v},[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),m.useEffect(()=>{u.setOptions(a)},[a,u]),of(a,d))throw Yo(a,u,s);if(nf({result:d,errorResetBoundary:s,throwOnError:a.throwOnError,query:c,suspense:a.suspense}))throw d.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(a,d),a.experimental_prefetchInRender&&!yn.isServer()&&sf(d,r)&&(f?Yo(a,u,s):c?.promise)?.catch(Ce).finally(()=>{u.updateResult()}),a.notifyOnChangeProps?d:u.trackResult(d)}function wt(e,t){return la(e,oa)}function ke(e,t){const n=Se(),[r]=m.useState(()=>new Wu(n,e));m.useEffect(()=>{r.setOptions(e)},[r,e]);const s=m.useSyncExternalStore(m.useCallback(a=>r.subscribe(he.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=m.useCallback((a,c)=>{r.mutate(a,c).catch(Ce)},[r]);if(s.error&&Ds(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}function _s(e,t){return la(e,Vu)}function af(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const cf=e=>{switch(e){case"success":return uf;case"info":return mf;case"warning":return ff;case"error":return hf;default:return null}},lf=Array(12).fill(0),df=({visible:e,className:t})=>x.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},x.createElement("div",{className:"sonner-spinner"},lf.map((n,r)=>x.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),uf=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},x.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),ff=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},x.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),mf=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},x.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),hf=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},x.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),pf=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},x.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),x.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),gf=()=>{const[e,t]=x.useState(document.hidden);return x.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let us=1;class vf{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,o=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:us++,a=this.toasts.find(l=>l.id===o),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),a?this.toasts=this.toasts.map(l=>l.id===o?(this.publish({...l,...t,id:o,title:r}),{...l,...t,id:o,dismissible:c,title:r}):l):this.addToast({title:r,...s,dismissible:c,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let o=r!==void 0,a;const c=s.then(async f=>{if(a=["resolve",f],x.isValidElement(f))o=!1,this.create({id:r,type:"default",message:f});else if(yf(f)&&!f.ok){o=!1;const d=typeof n.error=="function"?await n.error(`HTTP error! status: ${f.status}`):n.error,p=typeof n.description=="function"?await n.description(`HTTP error! status: ${f.status}`):n.description,v=typeof d=="object"&&!x.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:p,...v})}else if(f instanceof Error){o=!1;const d=typeof n.error=="function"?await n.error(f):n.error,p=typeof n.description=="function"?await n.description(f):n.description,v=typeof d=="object"&&!x.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:p,...v})}else if(n.success!==void 0){o=!1;const d=typeof n.success=="function"?await n.success(f):n.success,p=typeof n.description=="function"?await n.description(f):n.description,v=typeof d=="object"&&!x.isValidElement(d)?d:{message:d};this.create({id:r,type:"success",description:p,...v})}}).catch(async f=>{if(a=["reject",f],n.error!==void 0){o=!1;const u=typeof n.error=="function"?await n.error(f):n.error,d=typeof n.description=="function"?await n.description(f):n.description,g=typeof u=="object"&&!x.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:d,...g})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((f,u)=>c.then(()=>a[0]==="reject"?u(a[1]):f(a[1])).catch(u));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(t,n)=>{const r=n?.id||us++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Re=new vf,bf=(e,t)=>{const n=t?.id||us++;return Re.addToast({title:e,...t,id:n}),n},yf=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",xf=bf,wf=()=>Re.toasts,Cf=()=>Re.getActiveToasts(),ie=Object.assign(xf,{success:Re.success,info:Re.info,warning:Re.warning,error:Re.error,custom:Re.custom,message:Re.message,promise:Re.promise,dismiss:Re.dismiss,loading:Re.loading},{getHistory:wf,getToasts:Cf});af("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Ln(e){return e.label!==void 0}const Sf=3,Nf="24px",Rf="16px",Xo=4e3,Ef=356,jf=14,Pf=45,Tf=200;function Qe(...e){return e.filter(Boolean).join(" ")}function Mf(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const Af=e=>{var t,n,r,s,o,a,c,l,f;const{invert:u,toast:d,unstyled:p,interacting:g,setHeights:v,visibleToasts:h,heights:b,index:y,toasts:w,expanded:C,removeToast:S,defaultRichColors:E,closeButton:P,style:R,cancelButtonStyle:N,actionButtonStyle:A,className:$="",descriptionClassName:L="",duration:B,position:F,gap:q,expandByDefault:K,classNames:M,icons:U,closeButtonAriaLabel:O="Close toast"}=e,[j,T]=x.useState(null),[ae,fe]=x.useState(null),[G,ee]=x.useState(!1),[H,Q]=x.useState(!1),[k,V]=x.useState(!1),[X,re]=x.useState(!1),[ne,oe]=x.useState(!1),[pe,be]=x.useState(0),[mn,Vt]=x.useState(0),nt=x.useRef(d.duration||B||Xo),Do=x.useRef(null),rt=x.useRef(null),fu=y===0,mu=y+1<=h,Ee=d.type,Ht=d.dismissible!==!1,hu=d.className||"",pu=d.descriptionClassName||"",In=x.useMemo(()=>b.findIndex(J=>J.toastId===d.id)||0,[b,d.id]),gu=x.useMemo(()=>{var J;return(J=d.closeButton)!=null?J:P},[d.closeButton,P]),Oo=x.useMemo(()=>d.duration||B||Xo,[d.duration,B]),zr=x.useRef(0),qt=x.useRef(0),_o=x.useRef(0),Wt=x.useRef(null),[vu,bu]=F.split("-"),Lo=x.useMemo(()=>b.reduce((J,ge,ye)=>ye>=In?J:J+ge.height,0),[b,In]),Fo=gf(),yu=d.invert||u,Vr=Ee==="loading";qt.current=x.useMemo(()=>In*q+Lo,[In,Lo]),x.useEffect(()=>{nt.current=Oo},[Oo]),x.useEffect(()=>{ee(!0)},[]),x.useEffect(()=>{const J=rt.current;if(J){const ge=J.getBoundingClientRect().height;return Vt(ge),v(ye=>[{toastId:d.id,height:ge,position:d.position},...ye]),()=>v(ye=>ye.filter(je=>je.toastId!==d.id))}},[v,d.id]),x.useLayoutEffect(()=>{if(!G)return;const J=rt.current,ge=J.style.height;J.style.height="auto";const ye=J.getBoundingClientRect().height;J.style.height=ge,Vt(ye),v(je=>je.find(ve=>ve.toastId===d.id)?je.map(ve=>ve.toastId===d.id?{...ve,height:ye}:ve):[{toastId:d.id,height:ye,position:d.position},...je])},[G,d.title,d.description,v,d.id,d.jsx,d.action,d.cancel]);const ut=x.useCallback(()=>{Q(!0),be(qt.current),v(J=>J.filter(ge=>ge.toastId!==d.id)),setTimeout(()=>{S(d)},Tf)},[d,S,v,qt]);x.useEffect(()=>{if(d.promise&&Ee==="loading"||d.duration===1/0||d.type==="loading")return;let J;return C||g||Fo?(()=>{if(_o.current<zr.current){const je=new Date().getTime()-zr.current;nt.current=nt.current-je}_o.current=new Date().getTime()})():nt.current!==1/0&&(zr.current=new Date().getTime(),J=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),ut()},nt.current)),()=>clearTimeout(J)},[C,g,d,Ee,Fo,ut]),x.useEffect(()=>{d.delete&&(ut(),d.onDismiss==null||d.onDismiss.call(d,d))},[ut,d.delete]);function xu(){var J;if(U?.loading){var ge;return x.createElement("div",{className:Qe(M?.loader,d==null||(ge=d.classNames)==null?void 0:ge.loader,"sonner-loader"),"data-visible":Ee==="loading"},U.loading)}return x.createElement(df,{className:Qe(M?.loader,d==null||(J=d.classNames)==null?void 0:J.loader),visible:Ee==="loading"})}const wu=d.icon||U?.[Ee]||cf(Ee);var Bo,Uo;return x.createElement("li",{tabIndex:0,ref:rt,className:Qe($,hu,M?.toast,d==null||(t=d.classNames)==null?void 0:t.toast,M?.default,M?.[Ee],d==null||(n=d.classNames)==null?void 0:n[Ee]),"data-sonner-toast":"","data-rich-colors":(Bo=d.richColors)!=null?Bo:E,"data-styled":!(d.jsx||d.unstyled||p),"data-mounted":G,"data-promise":!!d.promise,"data-swiped":ne,"data-removed":H,"data-visible":mu,"data-y-position":vu,"data-x-position":bu,"data-index":y,"data-front":fu,"data-swiping":k,"data-dismissible":Ht,"data-type":Ee,"data-invert":yu,"data-swipe-out":X,"data-swipe-direction":ae,"data-expanded":!!(C||K&&G),"data-testid":d.testId,style:{"--index":y,"--toasts-before":y,"--z-index":w.length-y,"--offset":`${H?pe:qt.current}px`,"--initial-height":K?"auto":`${mn}px`,...R,...d.style},onDragEnd:()=>{V(!1),T(null),Wt.current=null},onPointerDown:J=>{J.button!==2&&(Vr||!Ht||(Do.current=new Date,be(qt.current),J.target.setPointerCapture(J.pointerId),J.target.tagName!=="BUTTON"&&(V(!0),Wt.current={x:J.clientX,y:J.clientY})))},onPointerUp:()=>{var J,ge,ye;if(X||!Ht)return;Wt.current=null;const je=Number(((J=rt.current)==null?void 0:J.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Dn=Number(((ge=rt.current)==null?void 0:ge.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ve=new Date().getTime()-((ye=Do.current)==null?void 0:ye.getTime()),Ie=j==="x"?je:Dn,On=Math.abs(Ie)/ve;if(Math.abs(Ie)>=Pf||On>.11){be(qt.current),d.onDismiss==null||d.onDismiss.call(d,d),fe(j==="x"?je>0?"right":"left":Dn>0?"down":"up"),ut(),re(!0);return}else{var Fe,Be;(Fe=rt.current)==null||Fe.style.setProperty("--swipe-amount-x","0px"),(Be=rt.current)==null||Be.style.setProperty("--swipe-amount-y","0px")}oe(!1),V(!1),T(null)},onPointerMove:J=>{var ge,ye,je;if(!Wt.current||!Ht||((ge=window.getSelection())==null?void 0:ge.toString().length)>0)return;const ve=J.clientY-Wt.current.y,Ie=J.clientX-Wt.current.x;var On;const Fe=(On=e.swipeDirections)!=null?On:Mf(F);!j&&(Math.abs(Ie)>1||Math.abs(ve)>1)&&T(Math.abs(Ie)>Math.abs(ve)?"x":"y");let Be={x:0,y:0};const $o=Tt=>1/(1.5+Math.abs(Tt)/20);if(j==="y"){if(Fe.includes("top")||Fe.includes("bottom"))if(Fe.includes("top")&&ve<0||Fe.includes("bottom")&&ve>0)Be.y=ve;else{const Tt=ve*$o(ve);Be.y=Math.abs(Tt)<Math.abs(ve)?Tt:ve}}else if(j==="x"&&(Fe.includes("left")||Fe.includes("right")))if(Fe.includes("left")&&Ie<0||Fe.includes("right")&&Ie>0)Be.x=Ie;else{const Tt=Ie*$o(Ie);Be.x=Math.abs(Tt)<Math.abs(Ie)?Tt:Ie}(Math.abs(Be.x)>0||Math.abs(Be.y)>0)&&oe(!0),(ye=rt.current)==null||ye.style.setProperty("--swipe-amount-x",`${Be.x}px`),(je=rt.current)==null||je.style.setProperty("--swipe-amount-y",`${Be.y}px`)}},gu&&!d.jsx&&Ee!=="loading"?x.createElement("button",{"aria-label":O,"data-disabled":Vr,"data-close-button":!0,onClick:Vr||!Ht?()=>{}:()=>{ut(),d.onDismiss==null||d.onDismiss.call(d,d)},className:Qe(M?.closeButton,d==null||(r=d.classNames)==null?void 0:r.closeButton)},(Uo=U?.close)!=null?Uo:pf):null,(Ee||d.icon||d.promise)&&d.icon!==null&&(U?.[Ee]!==null||d.icon)?x.createElement("div",{"data-icon":"",className:Qe(M?.icon,d==null||(s=d.classNames)==null?void 0:s.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||xu():null,d.type!=="loading"?wu:null):null,x.createElement("div",{"data-content":"",className:Qe(M?.content,d==null||(o=d.classNames)==null?void 0:o.content)},x.createElement("div",{"data-title":"",className:Qe(M?.title,d==null||(a=d.classNames)==null?void 0:a.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?x.createElement("div",{"data-description":"",className:Qe(L,pu,M?.description,d==null||(c=d.classNames)==null?void 0:c.description)},typeof d.description=="function"?d.description():d.description):null),x.isValidElement(d.cancel)?d.cancel:d.cancel&&Ln(d.cancel)?x.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||N,onClick:J=>{Ln(d.cancel)&&Ht&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,J),ut())},className:Qe(M?.cancelButton,d==null||(l=d.classNames)==null?void 0:l.cancelButton)},d.cancel.label):null,x.isValidElement(d.action)?d.action:d.action&&Ln(d.action)?x.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||A,onClick:J=>{Ln(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,J),!J.defaultPrevented&&ut())},className:Qe(M?.actionButton,d==null||(f=d.classNames)==null?void 0:f.actionButton)},d.action.label):null)};function Jo(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function kf(e,t){const n={};return[e,t].forEach((r,s)=>{const o=s===1,a=o?"--mobile-offset":"--offset",c=o?Rf:Nf;function l(f){["top","right","bottom","left"].forEach(u=>{n[`${a}-${u}`]=typeof f=="number"?`${f}px`:f})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(f=>{r[f]===void 0?n[`${a}-${f}`]=c:n[`${a}-${f}`]=typeof r[f]=="number"?`${r[f]}px`:r[f]}):l(c)}),n}const If=x.forwardRef(function(t,n){const{id:r,invert:s,position:o="bottom-right",hotkey:a=["altKey","KeyT"],expand:c,closeButton:l,className:f,offset:u,mobileOffset:d,theme:p="light",richColors:g,duration:v,style:h,visibleToasts:b=Sf,toastOptions:y,dir:w=Jo(),gap:C=jf,icons:S,containerAriaLabel:E="Notifications"}=t,[P,R]=x.useState([]),N=x.useMemo(()=>r?P.filter(G=>G.toasterId===r):P.filter(G=>!G.toasterId),[P,r]),A=x.useMemo(()=>Array.from(new Set([o].concat(N.filter(G=>G.position).map(G=>G.position)))),[N,o]),[$,L]=x.useState([]),[B,F]=x.useState(!1),[q,K]=x.useState(!1),[M,U]=x.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),O=x.useRef(null),j=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),T=x.useRef(null),ae=x.useRef(!1),fe=x.useCallback(G=>{R(ee=>{var H;return(H=ee.find(Q=>Q.id===G.id))!=null&&H.delete||Re.dismiss(G.id),ee.filter(({id:Q})=>Q!==G.id)})},[]);return x.useEffect(()=>Re.subscribe(G=>{if(G.dismiss){requestAnimationFrame(()=>{R(ee=>ee.map(H=>H.id===G.id?{...H,delete:!0}:H))});return}setTimeout(()=>{As.flushSync(()=>{R(ee=>{const H=ee.findIndex(Q=>Q.id===G.id);return H!==-1?[...ee.slice(0,H),{...ee[H],...G},...ee.slice(H+1)]:[G,...ee]})})})}),[P]),x.useEffect(()=>{if(p!=="system"){U(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?U("dark"):U("light")),typeof window>"u")return;const G=window.matchMedia("(prefers-color-scheme: dark)");try{G.addEventListener("change",({matches:ee})=>{U(ee?"dark":"light")})}catch{G.addListener(({matches:H})=>{try{U(H?"dark":"light")}catch(Q){console.error(Q)}})}},[p]),x.useEffect(()=>{P.length<=1&&F(!1)},[P]),x.useEffect(()=>{const G=ee=>{var H;if(a.every(V=>ee[V]||ee.code===V)){var k;F(!0),(k=O.current)==null||k.focus()}ee.code==="Escape"&&(document.activeElement===O.current||(H=O.current)!=null&&H.contains(document.activeElement))&&F(!1)};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[a]),x.useEffect(()=>{if(O.current)return()=>{T.current&&(T.current.focus({preventScroll:!0}),T.current=null,ae.current=!1)}},[O.current]),x.createElement("section",{ref:n,"aria-label":`${E} ${j}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},A.map((G,ee)=>{var H;const[Q,k]=G.split("-");return N.length?x.createElement("ol",{key:G,dir:w==="auto"?Jo():w,tabIndex:-1,ref:O,className:f,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":Q,"data-x-position":k,style:{"--front-toast-height":`${((H=$[0])==null?void 0:H.height)||0}px`,"--width":`${Ef}px`,"--gap":`${C}px`,...h,...kf(u,d)},onBlur:V=>{ae.current&&!V.currentTarget.contains(V.relatedTarget)&&(ae.current=!1,T.current&&(T.current.focus({preventScroll:!0}),T.current=null))},onFocus:V=>{V.target instanceof HTMLElement&&V.target.dataset.dismissible==="false"||ae.current||(ae.current=!0,T.current=V.relatedTarget)},onMouseEnter:()=>F(!0),onMouseMove:()=>F(!0),onMouseLeave:()=>{q||F(!1)},onDragEnd:()=>F(!1),onPointerDown:V=>{V.target instanceof HTMLElement&&V.target.dataset.dismissible==="false"||K(!0)},onPointerUp:()=>K(!1)},N.filter(V=>!V.position&&ee===0||V.position===G).map((V,X)=>{var re,ne;return x.createElement(Af,{key:V.id,icons:S,index:X,toast:V,defaultRichColors:g,duration:(re=y?.duration)!=null?re:v,className:y?.className,descriptionClassName:y?.descriptionClassName,invert:s,visibleToasts:b,closeButton:(ne=y?.closeButton)!=null?ne:l,interacting:q,position:G,style:y?.style,unstyled:y?.unstyled,classNames:y?.classNames,cancelButtonStyle:y?.cancelButtonStyle,actionButtonStyle:y?.actionButtonStyle,closeButtonAriaLabel:y?.closeButtonAriaLabel,removeToast:fe,toasts:N.filter(oe=>oe.position==V.position),heights:$.filter(oe=>oe.position==V.position),setHeights:L,expandByDefault:c,gap:C,expanded:B,swipeDirections:t.swipeDirections})})):null}))}),da=x.createContext(null);function te(){const e=x.useContext(da);if(!e)throw new Error("useRoad must be used inside <RoadProvider>");return e}const ce={me:["road","me","profile"],myBUs:["road","me","business-units"],myPermissions:["road","me","permissions"],bu:e=>["road","bu",e],members:e=>["road","bu",e,"members"],invitations:e=>["road","bu",e,"invitations"],roles:e=>["road","bu",e,"roles"],role:(e,t)=>["road","bu",e,"roles",t],permissions:e=>["road","bu",e,"permissions"]};function Df(){const{client:e}=te();return wt({queryKey:ce.me,queryFn:()=>e.getCurrentUser()})}function an(){const{client:e}=te();return wt({queryKey:ce.myBUs,queryFn:()=>e.getMyBusinessUnits()})}function hr(){const{client:e}=te();return wt({queryKey:ce.myPermissions,queryFn:()=>e.getMyPermissions()})}function Ct(e){const t=gr(),n=e===void 0?t:e,{data:r}=hr();return x.useCallback(s=>{if(!n||!r)return!1;const o=r[n];return o?o.includes("*")?!0:o.includes(s):!1},[r,n])}function Of(){return te().client}function _f(e,t){const{client:n}=te(),r=gr(),s=t===void 0?r:t,o=e.join("|"),{data:a}=wt({queryKey:["road","authorize-batch",s,o],queryFn:()=>n.authorizeBatch(s,e),enabled:!!s&&e.length>0}),c={};let l=!1,f=!0;for(const u of e){const d=a?.[u]??!1;c[u]=d,d?l=!0:f=!1}return{permissions:c,canAll:f,canAny:l}}function ua(e){const{client:t}=te();return wt({queryKey:e?ce.bu(e):["road","bu","null"],queryFn:()=>t.getBusinessUnit(e),enabled:!!e})}function fa(e,t){const{client:n}=te();return _s({queryKey:e?[...ce.members(e),"infinite",t??null]:["road","bu","null","members","infinite"],queryFn:({pageParam:r})=>n.listMembers(e,{cursor:r,limit:t}),initialPageParam:void 0,getNextPageParam:r=>r.pagination.cursor??void 0,enabled:!!e})}function ma(e,t){const{client:n}=te();return _s({queryKey:e?[...ce.invitations(e),"infinite",t??null]:["road","bu","null","invitations","infinite"],queryFn:({pageParam:r})=>n.listInvitations(e,{cursor:r,limit:t}),initialPageParam:void 0,getNextPageParam:r=>r.pagination.cursor??void 0,enabled:!!e})}function Lf(){const{client:e}=te(),t=Se();return ke({mutationFn:n=>e.createBusinessUnit(n),onSuccess:()=>{t.invalidateQueries({queryKey:ce.myBUs})}})}function Ff(e){const{client:t}=te(),n=Se();return ke({mutationFn:r=>t.updateBusinessUnit(e,r),onSuccess:r=>{n.setQueryData(ce.bu(e),r),n.invalidateQueries({queryKey:ce.myBUs})}})}function Bf(e){const{client:t}=te(),n=Se();return ke({mutationFn:r=>t.suspendMember(e,r),onSuccess:()=>n.invalidateQueries({queryKey:ce.members(e)})})}function Uf(e){const{client:t}=te(),n=Se();return ke({mutationFn:r=>t.reinstateMember(e,r),onSuccess:()=>n.invalidateQueries({queryKey:ce.members(e)})})}function $f(e){const{client:t}=te(),n=Se();return ke({mutationFn:r=>t.removeMember(e,r),onSuccess:()=>{n.invalidateQueries({queryKey:ce.members(e)}),n.invalidateQueries({queryKey:ce.bu(e)})}})}function zf(e){const{client:t}=te(),n=Se();return ke({mutationFn:r=>t.createInvitation(e,r),onSuccess:()=>n.invalidateQueries({queryKey:ce.invitations(e)})})}function Vf(e){const{client:t}=te(),n=Se();return ke({mutationFn:r=>t.cancelInvitation(e,r),onSuccess:()=>n.invalidateQueries({queryKey:ce.invitations(e)})})}function Hf(e){const{client:t}=te(),n=Se();return ke({mutationFn:r=>t.resendInvitation(e,r),onSuccess:()=>n.invalidateQueries({queryKey:ce.invitations(e)})})}function ha(){const{client:e}=te(),t=Se();return ke({mutationFn:n=>e.acceptInvitation(n),onSuccess:()=>t.invalidateQueries({queryKey:ce.myBUs})})}function pa(){const{client:e}=te(),t=Se();return ke({mutationFn:n=>e.rejectInvitation(n),onSuccess:()=>t.invalidateQueries({queryKey:ce.myBUs})})}function ga(e,t){const{client:n}=te();return wt({queryKey:e?[...ce.roles(e),"limit",t]:["road","bu","null","roles"],queryFn:async()=>(await n.listRoles(e,{limit:t})).data,enabled:!!e})}function va(e,t){const{client:n}=te();return _s({queryKey:e?[...ce.roles(e),"infinite",t??null]:["road","bu","null","roles","infinite"],queryFn:({pageParam:r})=>n.listRoles(e,{cursor:r,limit:t}),initialPageParam:void 0,getNextPageParam:r=>r.pagination.cursor??void 0,enabled:!!e})}function qf(e,t){const{client:n}=te();return wt({queryKey:e&&t?ce.role(e,t):["road","bu","null","roles","null"],queryFn:()=>n.getRole(e,t),enabled:!!e&&!!t})}function ba(e){const{client:t}=te();return wt({queryKey:e?ce.permissions(e):["road","bu","null","permissions"],queryFn:()=>t.listPermissions(e),enabled:!!e})}function Wf(e){const{client:t}=te(),n=Se();return ke({mutationFn:r=>t.createRole(e,r),onSuccess:()=>n.invalidateQueries({queryKey:ce.roles(e)})})}function Kf(e,t){const{client:n}=te(),r=Se();return ke({mutationFn:s=>n.updateRole(e,t,s),onSuccess:s=>{r.setQueryData(ce.role(e,t),s),r.invalidateQueries({queryKey:ce.roles(e)})}})}function Gf(e){const{client:t}=te(),n=Se();return ke({mutationFn:r=>t.deleteRole(e,r),onSuccess:()=>n.invalidateQueries({queryKey:ce.roles(e)})})}const Qf={get(e){if(typeof window>"u")return null;try{return window.localStorage.getItem(e)}catch{return null}},set(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}},remove(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(e)}catch{}}},pr=x.createContext(null);function Yf({initialBusinessUnitId:e,storageKey:t,storage:n=Qf,onSelect:r,children:s}){const[o,a]=x.useState(()=>e||n.get(t)),c=x.useCallback(f=>{a(f),n.set(t,f),r?.(f)},[n,t,r]),l=x.useMemo(()=>({currentBusinessUnitId:o,setCurrentBusinessUnitId:c}),[o,c]);return i.jsxs(pr.Provider,{value:l,children:[i.jsx(Xf,{}),s]})}function Xf(){const e=x.useContext(pr),{data:t}=an();return x.useEffect(()=>{if(!e||!t?.memberships)return;const n=t.memberships[0]?.businessUnit.id,r=e.currentBusinessUnitId;r!==null&&t.memberships.some(o=>o.businessUnit.id===r)||n&&e.setCurrentBusinessUnitId(n)},[e,t]),null}function gr(){return x.useContext(pr)?.currentBusinessUnitId??null}function ya(){const e=gr(),{data:t}=an();return e?t?.memberships.find(n=>n.businessUnit.id===e)?.businessUnit??null:null}function xa(){const e=x.useContext(pr);if(!e)throw new Error("useSetCurrentBusinessUnit must be used inside <RoadProvider>");return e.setCurrentBusinessUnitId}const Jf={colorPrimary:"--primary",colorPrimaryForeground:"--primary-foreground",colorBackground:"--background",colorForeground:"--foreground",colorMuted:"--muted",colorAccent:"--accent",colorDanger:"--destructive",colorBorder:"--border",borderRadius:"--radius",fontFamily:"--font-family"};function St(e){if(!e?.variables)return{};const t={};for(const[n,r]of Object.entries(e.variables)){if(r===void 0)continue;const s=Jf[n];s&&(t[s]=r)}return t}function Nt(e){return e==="dark"?"dark":e==="light"?"light":typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}class We extends Error{status;statusText;body;problem;requestId;traceId;constructor(t){const n=t.problem?.detail??t.body??t.statusText;super(`Road API ${t.status} ${t.statusText}: ${n}`),this.name="RoadApiError",this.status=t.status,this.statusText=t.statusText,this.body=t.body,this.problem=t.problem,this.requestId=t.requestId,this.traceId=t.traceId}}class vn extends We{constructor(t){super(t),this.name="RoadAuthError"}}class wa extends We{constructor(t){super(t),this.name="RoadForbiddenError"}}class Ca extends We{constructor(t){super(t),this.name="RoadNotFoundError"}}class Ls extends We{constructor(t){super(t),this.name="RoadConflictError"}}class Fs extends We{fieldErrors;constructor(t){super(t),this.name="RoadValidationError",this.fieldErrors=Zf(t.problem)}}class Sa extends We{retryAfter;constructor(t){super(t),this.name="RoadRateLimitError",this.retryAfter=t.retryAfter}}class Bs extends We{constructor(t){super(t),this.name="RoadServerError"}}class Us extends We{cause;constructor(t,n){super({status:0,statusText:"Network Error",body:t}),this.name="RoadNetworkError",this.cause=n}}function Zf(e){if(!e?.errors)return{};const t={};for(const n of e.errors){const r=n.field||"_root";(t[r]??=[]).push(n.message)}return t}function em(e){const{status:t}=e;return t===401?new vn(e):t===403?new wa(e):t===404?new Ca(e):t===409?new Ls(e):t===422||t===400?new Fs(e):t===429?new Sa(e):t>=500&&t<600?new Bs(e):new We(e)}function Fn(e){return{id:e.id,name:e.name,description:e.description??"",permissions:e.permissions,isSystem:e.isSystem,assignmentCount:e.assignmentCount,createdAt:e.createdAt??""}}const tm={maxAttempts:3,baseDelay:250},nm=50,rm=1e3,sm=e=>new Promise(t=>setTimeout(t,e));function om(){return typeof globalThis.crypto<"u"&&typeof globalThis.crypto.randomUUID=="function"?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}class Na{constructor(t){this.config=t}config;scopeIdByBuId=new Map;lastUnauthAt=0;notifyUnauthenticated(){if(!this.config.onUnauthenticated)return;const t=Date.now();if(!(t-this.lastUnauthAt<rm)){this.lastUnauthAt=t;try{this.config.onUnauthenticated()}catch{}}}async resolveJwt(){const t=this.config.jwt;if(t){if(typeof t=="string")return t;try{return await t()??void 0}catch{return}}}async request(t,n={}){const r=(n.method??"GET").toUpperCase(),s={...tm,...this.config.retry,...n.retry},o=n.idempotencyKey??(Zo(r)?om():void 0),c=r==="GET"||r==="HEAD"||!!o?s.maxAttempts:1,l=Date.now();let f=0,u;for(;f<c;){f+=1;try{const{value:p,status:g,requestId:v,traceId:h}=await this.executeRequest(t,{method:r,body:n.body,headers:n.headers,idempotencyKey:o});return this.config.telemetry?.onRequest?.({method:r,path:t,status:g,durationMs:Date.now()-l,requestId:v,traceId:h,attempts:f}),p}catch(p){if(!(p instanceof We))throw p;if(u=p,!dm(p)||f>=c)break;await sm(um(s.baseDelay,f))}}const d=u;throw this.config.telemetry?.onError?.(d,{method:r,path:t,status:d.status,durationMs:Date.now()-l,requestId:d.requestId,traceId:d.traceId,attempts:f}),d}async executeRequest(t,n){const r=this.config.authMode??"cookie",s={Accept:"application/json",...n.headers??{}};if(r==="bearer"){const u=await this.resolveJwt();u&&(s.Authorization=`Bearer ${u}`)}else if(Zo(n.method)){const u=this.config.csrfCookieName??"XSRF-TOKEN",d=this.config.csrfHeaderName??"X-XSRF-TOKEN",p=im(u);p&&(s[d]=p)}n.body&&!s["Content-Type"]&&(s["Content-Type"]="application/json"),n.idempotencyKey&&(s["Idempotency-Key"]=n.idempotencyKey);const o=r==="cookie"||this.config.withCredentials===!0?"include":"same-origin";let a;try{a=await fetch(`${this.config.apiBaseUrl}${t}`,{method:n.method,body:n.body??void 0,headers:s,credentials:o})}catch(u){throw new Us("Network request failed",u)}const c=a.headers.get("x-request-id")??a.headers.get("X-Request-Id")??void 0,l=a.headers.get("traceparent")??void 0;if(!a.ok){const u=await fm(a,c,l);throw u instanceof vn&&this.notifyUnauthenticated(),u}return a.status===204?{value:void 0,status:204,requestId:c,traceId:l}:{value:await a.json(),status:a.status,requestId:c,traceId:l}}async fetchData(t,n){return(await this.request(t,n)).data}async fetchPaginated(t,n,r){const s=lm(n,r),o=await this.request(`${t}${s}`),a=o.pagination??o.meta?.pagination??{cursor:null,hasMore:!1,totalCount:o.data.length};return{data:o.data,pagination:a}}async resolveScopeId(t){const n=this.scopeIdByBuId.get(t);if(n)return n;const r=await this.getBusinessUnit(t);return this.scopeIdByBuId.set(t,r.iamScopeId),r.iamScopeId}async getCurrentUser(){if((this.config.authMode??"cookie")==="cookie")return this.fetchData("/me/profile");const t=await this.resolveJwt(),n=ei(t);if(!n)throw new vn({status:401,statusText:"Unauthorized",body:"getCurrentUser: no JWT available on RoadClient"});const r=typeof n.sub=="string"?n.sub:"",s=typeof n.email=="string"?n.email:"",o=typeof n.name=="string"&&n.name?n.name:s||r,a=typeof n.picture=="string"?n.picture:void 0;return a?{id:r,name:o,email:s,avatarUrl:a}:{id:r,name:o,email:s}}getMyBusinessUnits(){return this.fetchData("/me/business-units")}async getMyPermissions(){const{memberships:t}=await this.getMyBusinessUnits();if(t.length===0)return{};const n=await Promise.all(t.map(async c=>{const l=c.businessUnit.id,f=await this.resolveScopeId(l);return[l,f]})),r=Array.from(new Set(n.map(([,c])=>c))),s={},o=await Promise.all(am(r,nm).map(c=>this.fetchData(`/iam/authorization/me/permissions?scopes=${c.map(encodeURIComponent).join(",")}`)));for(const c of o)Object.assign(s,c);const a={};for(const[c,l]of n){const f=s[l]??[];a[c]=f.map(u=>u.action==="*"&&u.subject==="*"?"*":`${u.action}:${u.subject}`)}return a}async getBusinessUnit(t){const n=await this.fetchData(`/organization/business-units/${t}`);return this.scopeIdByBuId.set(t,n.iamScopeId),n}async createBusinessUnit(t){const n={...t,slug:t.slug??cm(t.name)},r=await this.fetchData("/organization/business-units",{method:"POST",body:JSON.stringify(n)});return this.scopeIdByBuId.set(r.id,r.iamScopeId),r}async updateBusinessUnit(t,n){return this.fetchData(`/organization/business-units/${t}`,{method:"PATCH",body:JSON.stringify(n)})}async listMembers(t,n){return this.fetchPaginated(`/organization/business-units/${t}/members`,n,{includeRoles:"true",includeProfile:"true"})}async suspendMember(t,n){await this.request(`/organization/business-units/${t}/members/${n}/suspend`,{method:"POST"})}async reinstateMember(t,n){await this.request(`/organization/business-units/${t}/members/${n}/reinstate`,{method:"POST"})}async removeMember(t,n){await this.request(`/organization/business-units/${t}/members/${n}`,{method:"DELETE"})}listInvitations(t,n){return this.fetchPaginated(`/organization/business-units/${t}/invitations`,n)}createInvitation(t,n){return this.fetchData(`/organization/business-units/${t}/invitations`,{method:"POST",body:JSON.stringify(n)})}async cancelInvitation(t,n){await this.request(`/organization/business-units/${t}/invitations/${n}/cancel`,{method:"POST"})}async resendInvitation(t,n){await this.request(`/organization/business-units/${t}/invitations/${n}/resend`,{method:"POST"})}async acceptInvitation(t){await this.request(`/organization/invitations/${t}/accept`,{method:"POST"})}async rejectInvitation(t){await this.request(`/organization/invitations/${t}/reject`,{method:"POST"})}async listRoles(t,n){const r=await this.resolveScopeId(t),s=await this.fetchPaginated(`/iam/authorization/scopes/${encodeURIComponent(r)}/roles`,n);return{data:s.data.map(Fn),pagination:s.pagination}}async getRole(t,n){const r=await this.resolveScopeId(t),s=await this.fetchData(`/iam/authorization/scopes/${encodeURIComponent(r)}/roles/${n}`);return Fn(s)}async createRole(t,n){const r=await this.resolveScopeId(t),s=await this.fetchData(`/iam/authorization/scopes/${encodeURIComponent(r)}/roles`,{method:"POST",body:JSON.stringify({name:n.name,description:n.description??null,permissions:n.permissions})});return Fn(s)}async updateRole(t,n,r){const s=await this.resolveScopeId(t),o=await this.fetchData(`/iam/authorization/scopes/${encodeURIComponent(s)}/roles/${n}`,{method:"PATCH",body:JSON.stringify(r)});return Fn(o)}async deleteRole(t,n){const r=await this.resolveScopeId(t);await this.request(`/iam/authorization/scopes/${encodeURIComponent(r)}/roles/${n}`,{method:"DELETE"})}async listPermissions(t){const n=await this.resolveScopeId(t);return this.fetchData(`/iam/authorization/scopes/${encodeURIComponent(n)}/permissions`)}async authorizeBatch(t,n){if(n.length===0)return{};const r=this.config.authMode??"cookie",o={subjectType:"user",scopeId:await this.resolveScopeId(t),permissions:[...n]};if(r==="bearer"){const c=await this.resolveJwt(),l=ei(c),f=l&&typeof l.sub=="string"?l.sub:null;if(!f)throw new vn({status:401,statusText:"Unauthorized",body:"authorizeBatch: JWT missing or malformed (no sub claim)"});o.subjectId=f}const{results:a}=await this.fetchData("/iam/authorization/authorize/batch",{method:"POST",body:JSON.stringify(o)});return Object.fromEntries(a.map(c=>[c.permission,c.allowed]))}}function Zo(e){return e==="POST"||e==="PUT"||e==="PATCH"||e==="DELETE"}function im(e){if(typeof document>"u")return;const t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));if(n)try{return decodeURIComponent(n[1])}catch{return n[1]}}function am(e,t){const n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function cm(e){return e.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"business-unit"}function lm(e,t){const n=new URLSearchParams;if(t)for(const[s,o]of Object.entries(t))n.set(s,o);e?.cursor&&n.set("cursor",e.cursor),e?.limit!==void 0&&n.set("limit",String(e.limit));const r=n.toString();return r?`?${r}`:""}function dm(e){return e instanceof Us||e instanceof Bs}function um(e,t){const n=e*Math.pow(2,t-1),r=Math.random()*e;return n+r}async function fm(e,t,n){const r=await e.text().catch(()=>""),s=mm(r),o=e.headers.get("retry-after")??e.headers.get("Retry-After"),a=o?parseInt(o,10):void 0;return em({status:e.status,statusText:e.statusText,body:r,problem:s,requestId:t??s?.meta?.requestId??void 0,traceId:n,retryAfter:Number.isFinite(a)?a:void 0})}function mm(e){if(e)try{const t=JSON.parse(e);if(t&&typeof t=="object")return t}catch{}}function ei(e){if(!e)return null;const t=e.split(".");if(t.length<2)return null;try{const n=t[1].replace(/-/g,"+").replace(/_/g,"/"),r=n+"=".repeat((4-n.length%4)%4);return JSON.parse(atob(r))}catch{return null}}function Ra(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Ra(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ea(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Ra(e))&&(r&&(r+=" "),r+=t);return r}const hm=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},pm=(e,t)=>({classGroupId:e,validator:t}),ja=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),tr="-",ti=[],gm="arbitrary..",vm=e=>{const t=ym(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return bm(a);const c=a.split(tr),l=c[0]===""&&c.length>1?1:0;return Pa(c,l,t)},getConflictingClassGroupIds:(a,c)=>{if(c){const l=r[a],f=n[a];return l?f?hm(f,l):l:f||ti}return n[a]||ti}}},Pa=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const f=Pa(e,t+1,o);if(f)return f}const a=n.validators;if(a===null)return;const c=t===0?e.join(tr):e.slice(t).join(tr),l=a.length;for(let f=0;f<l;f++){const u=a[f];if(u.validator(c))return u.classGroupId}},bm=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?gm+r:void 0})(),ym=e=>{const{theme:t,classGroups:n}=e;return xm(n,t)},xm=(e,t)=>{const n=ja();for(const r in e){const s=e[r];$s(s,n,r,t)}return n},$s=(e,t,n,r)=>{const s=e.length;for(let o=0;o<s;o++){const a=e[o];wm(a,t,n,r)}},wm=(e,t,n,r)=>{if(typeof e=="string"){Cm(e,t,n);return}if(typeof e=="function"){Sm(e,t,n,r);return}Nm(e,t,n,r)},Cm=(e,t,n)=>{const r=e===""?t:Ta(t,e);r.classGroupId=n},Sm=(e,t,n,r)=>{if(Rm(e)){$s(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(pm(n,e))},Nm=(e,t,n,r)=>{const s=Object.entries(e),o=s.length;for(let a=0;a<o;a++){const[c,l]=s[a];$s(l,Ta(t,c),n,r)}},Ta=(e,t)=>{let n=e;const r=t.split(tr),s=r.length;for(let o=0;o<s;o++){const a=r[o];let c=n.nextPart.get(a);c||(c=ja(),n.nextPart.set(a,c)),n=c}return n},Rm=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Em=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(o,a)=>{n[o]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let a=n[o];if(a!==void 0)return a;if((a=r[o])!==void 0)return s(o,a),a},set(o,a){o in n?n[o]=a:s(o,a)}}},fs="!",ni=":",jm=[],ri=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),Pm=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const o=[];let a=0,c=0,l=0,f;const u=s.length;for(let h=0;h<u;h++){const b=s[h];if(a===0&&c===0){if(b===ni){o.push(s.slice(l,h)),l=h+1;continue}if(b==="/"){f=h;continue}}b==="["?a++:b==="]"?a--:b==="("?c++:b===")"&&c--}const d=o.length===0?s:s.slice(l);let p=d,g=!1;d.endsWith(fs)?(p=d.slice(0,-1),g=!0):d.startsWith(fs)&&(p=d.slice(1),g=!0);const v=f&&f>l?f-l:void 0;return ri(o,g,p,v)};if(t){const s=t+ni,o=r;r=a=>a.startsWith(s)?o(a.slice(s.length)):ri(jm,!1,a,void 0,!0)}if(n){const s=r;r=o=>n({className:o,parseClassName:s})}return r},Tm=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let o=0;o<n.length;o++){const a=n[o],c=a[0]==="[",l=t.has(a);c||l?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},Mm=e=>({cache:Em(e.cacheSize),parseClassName:Pm(e),sortModifiers:Tm(e),postfixLookupClassGroupIds:Am(e),...vm(e)}),Am=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},km=/\s+/,Im=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:o,postfixLookupClassGroupIds:a}=t,c=[],l=e.trim().split(km);let f="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:g,hasImportantModifier:v,baseClassName:h,maybePostfixModifierPosition:b}=n(d);if(p){f=d+(f.length>0?" "+f:f);continue}let y=!!b,w;if(y){const R=h.substring(0,b);w=r(R);const N=w&&a[w]?r(h):void 0;N&&N!==w&&(w=N,y=!1)}else w=r(h);if(!w){if(!y){f=d+(f.length>0?" "+f:f);continue}if(w=r(h),!w){f=d+(f.length>0?" "+f:f);continue}y=!1}const C=g.length===0?"":g.length===1?g[0]:o(g).join(":"),S=v?C+fs:C,E=S+w;if(c.indexOf(E)>-1)continue;c.push(E);const P=s(w,y);for(let R=0;R<P.length;++R){const N=P[R];c.push(S+N)}f=d+(f.length>0?" "+f:f)}return f},Dm=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=Ma(n))&&(s&&(s+=" "),s+=r);return s},Ma=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Ma(e[r]))&&(n&&(n+=" "),n+=t);return n},Om=(e,...t)=>{let n,r,s,o;const a=l=>{const f=t.reduce((u,d)=>d(u),e());return n=Mm(f),r=n.cache.get,s=n.cache.set,o=c,c(l)},c=l=>{const f=r(l);if(f)return f;const u=Im(l,n);return s(l,u),u};return o=a,(...l)=>o(Dm(...l))},_m=[],me=e=>{const t=n=>n[e]||_m;return t.isThemeGetter=!0,t},Aa=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ka=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Lm=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Fm=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Bm=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Um=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$m=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zm=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ft=e=>Lm.test(e),Z=e=>!!e&&!Number.isNaN(Number(e)),Ye=e=>!!e&&Number.isInteger(Number(e)),Hr=e=>e.endsWith("%")&&Z(e.slice(0,-1)),st=e=>Fm.test(e),Ia=()=>!0,Vm=e=>Bm.test(e)&&!Um.test(e),zs=()=>!1,Hm=e=>$m.test(e),qm=e=>zm.test(e),Wm=e=>!D(e)&&!_(e),Km=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Gm=e=>Rt(e,_a,zs),D=e=>Aa.test(e),Mt=e=>Rt(e,La,Vm),si=e=>Rt(e,nh,Z),Qm=e=>Rt(e,Ba,Ia),Ym=e=>Rt(e,Fa,zs),oi=e=>Rt(e,Da,zs),Xm=e=>Rt(e,Oa,qm),Bn=e=>Rt(e,Ua,Hm),_=e=>ka.test(e),hn=e=>Ut(e,La),Jm=e=>Ut(e,Fa),ii=e=>Ut(e,Da),Zm=e=>Ut(e,_a),eh=e=>Ut(e,Oa),Un=e=>Ut(e,Ua,!0),th=e=>Ut(e,Ba,!0),Rt=(e,t,n)=>{const r=Aa.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Ut=(e,t,n=!1)=>{const r=ka.exec(e);return r?r[1]?t(r[1]):n:!1},Da=e=>e==="position"||e==="percentage",Oa=e=>e==="image"||e==="url",_a=e=>e==="length"||e==="size"||e==="bg-size",La=e=>e==="length",nh=e=>e==="number",Fa=e=>e==="family-name",Ba=e=>e==="number"||e==="weight",Ua=e=>e==="shadow",rh=()=>{const e=me("color"),t=me("font"),n=me("text"),r=me("font-weight"),s=me("tracking"),o=me("leading"),a=me("breakpoint"),c=me("container"),l=me("spacing"),f=me("radius"),u=me("shadow"),d=me("inset-shadow"),p=me("text-shadow"),g=me("drop-shadow"),v=me("blur"),h=me("perspective"),b=me("aspect"),y=me("ease"),w=me("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...S(),_,D],P=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],N=()=>[_,D,l],A=()=>[ft,"full","auto",...N()],$=()=>[Ye,"none","subgrid",_,D],L=()=>["auto",{span:["full",Ye,_,D]},Ye,_,D],B=()=>[Ye,"auto",_,D],F=()=>["auto","min","max","fr",_,D],q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],K=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...N()],U=()=>[ft,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],O=()=>[ft,"screen","full","dvw","lvw","svw","min","max","fit",...N()],j=()=>[ft,"screen","full","lh","dvh","lvh","svh","min","max","fit",...N()],T=()=>[e,_,D],ae=()=>[...S(),ii,oi,{position:[_,D]}],fe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",Zm,Gm,{size:[_,D]}],ee=()=>[Hr,hn,Mt],H=()=>["","none","full",f,_,D],Q=()=>["",Z,hn,Mt],k=()=>["solid","dashed","dotted","double"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[Z,Hr,ii,oi],re=()=>["","none",v,_,D],ne=()=>["none",Z,_,D],oe=()=>["none",Z,_,D],pe=()=>[Z,_,D],be=()=>[ft,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[st],breakpoint:[st],color:[Ia],container:[st],"drop-shadow":[st],ease:["in","out","in-out"],font:[Wm],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[st],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[st],shadow:[st],spacing:["px",Z],text:[st],"text-shadow":[st],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ft,D,_,b]}],container:["container"],"container-type":[{"@container":["","normal","size",_,D]}],"container-named":[Km],columns:[{columns:[Z,D,_,c]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{"inset-s":A(),start:A()}],end:[{"inset-e":A(),end:A()}],"inset-bs":[{"inset-bs":A()}],"inset-be":[{"inset-be":A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[Ye,"auto",_,D]}],basis:[{basis:[ft,"full","auto",c,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Z,ft,"auto","initial","none",D]}],grow:[{grow:["",Z,_,D]}],shrink:[{shrink:["",Z,_,D]}],order:[{order:[Ye,"first","last","none",_,D]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...q(),"normal"]}],"justify-items":[{"justify-items":[...K(),"normal"]}],"justify-self":[{"justify-self":["auto",...K()]}],"align-content":[{content:["normal",...q()]}],"align-items":[{items:[...K(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...K(),{baseline:["","last"]}]}],"place-content":[{"place-content":q()}],"place-items":[{"place-items":[...K(),"baseline"]}],"place-self":[{"place-self":["auto",...K()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pbs:[{pbs:N()}],pbe:[{pbe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],"inline-size":[{inline:["auto",...O()]}],"min-inline-size":[{"min-inline":["auto",...O()]}],"max-inline-size":[{"max-inline":["none",...O()]}],"block-size":[{block:["auto",...j()]}],"min-block-size":[{"min-block":["auto",...j()]}],"max-block-size":[{"max-block":["none",...j()]}],w:[{w:[c,"screen",...U()]}],"min-w":[{"min-w":[c,"screen","none",...U()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[a]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",n,hn,Mt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,th,Qm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Hr,D]}],"font-family":[{font:[Jm,Ym,t]}],"font-features":[{"font-features":[D]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,_,D]}],"line-clamp":[{"line-clamp":[Z,"none",_,si]}],leading:[{leading:[o,...N()]}],"list-image":[{"list-image":["none",_,D]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",_,D]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...k(),"wavy"]}],"text-decoration-thickness":[{decoration:[Z,"from-font","auto",_,Mt]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[Z,"auto",_,D]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"tab-size":[{tab:[Ye,_,D]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_,D]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",_,D]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ae()}],"bg-repeat":[{bg:fe()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ye,_,D],radial:["",_,D],conic:[Ye,_,D]},eh,Xm]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-bs":[{"border-bs":Q()}],"border-w-be":[{"border-be":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...k(),"hidden","none"]}],"divide-style":[{divide:[...k(),"hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-bs":[{"border-bs":T()}],"border-color-be":[{"border-be":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:[...k(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Z,_,D]}],"outline-w":[{outline:["",Z,hn,Mt]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",u,Un,Bn]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",d,Un,Bn]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[Z,Mt]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",p,Un,Bn]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[Z,_,D]}],"mix-blend":[{"mix-blend":[...V(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":V()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Z]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[_,D]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[Z]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ae()}],"mask-repeat":[{mask:fe()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",_,D]}],filter:[{filter:["","none",_,D]}],blur:[{blur:re()}],brightness:[{brightness:[Z,_,D]}],contrast:[{contrast:[Z,_,D]}],"drop-shadow":[{"drop-shadow":["","none",g,Un,Bn]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",Z,_,D]}],"hue-rotate":[{"hue-rotate":[Z,_,D]}],invert:[{invert:["",Z,_,D]}],saturate:[{saturate:[Z,_,D]}],sepia:[{sepia:["",Z,_,D]}],"backdrop-filter":[{"backdrop-filter":["","none",_,D]}],"backdrop-blur":[{"backdrop-blur":re()}],"backdrop-brightness":[{"backdrop-brightness":[Z,_,D]}],"backdrop-contrast":[{"backdrop-contrast":[Z,_,D]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Z,_,D]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Z,_,D]}],"backdrop-invert":[{"backdrop-invert":["",Z,_,D]}],"backdrop-opacity":[{"backdrop-opacity":[Z,_,D]}],"backdrop-saturate":[{"backdrop-saturate":[Z,_,D]}],"backdrop-sepia":[{"backdrop-sepia":["",Z,_,D]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",_,D]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Z,"initial",_,D]}],ease:[{ease:["linear","initial",y,_,D]}],delay:[{delay:[Z,_,D]}],animate:[{animate:["none",w,_,D]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,_,D]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:ne()}],"rotate-x":[{"rotate-x":ne()}],"rotate-y":[{"rotate-y":ne()}],"rotate-z":[{"rotate-z":ne()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:pe()}],"skew-x":[{"skew-x":pe()}],"skew-y":[{"skew-y":pe()}],transform:[{transform:[_,D,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],zoom:[{zoom:[Ye,_,D]}],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",_,D]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":T()}],"scrollbar-track-color":[{"scrollbar-track":T()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mbs":[{"scroll-mbs":N()}],"scroll-mbe":[{"scroll-mbe":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pbs":[{"scroll-pbs":N()}],"scroll-pbe":[{"scroll-pbe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",_,D]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[Z,hn,Mt,si]}],stroke:[{stroke:["none",...T()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},sh=Om(rh);function z(...e){return sh(Ea(e))}const oh=Rn.ROAD_API_URLS.production,ai="road:current-bu";function ih({authMode:e,jwt:t,onUnauthenticated:n,csrfCookieName:r,csrfHeaderName:s,withCredentials:o,appearance:a,apiBaseUrl:c=oh,locale:l="en",localization:f,client:u,businessUnitId:d,businessUnitStorage:p,storageNamespace:g,onSelectBusinessUnit:v,retry:h,telemetry:b,children:y}){const w=x.useRef(!1);let C;if(u)C=e??"cookie";else{if(e===void 0&&t!==void 0)throw new Error(`<RoadProvider>: 'jwt' is provided but 'authMode' is not. In @b1-road/react, cookie mode is the default. Existing bearer-mode integrations must opt in explicitly:
2
+
3
+ <RoadProvider apiBaseUrl="..." authMode="bearer" jwt={...}>
4
+
5
+ See docs/plans/10-react-cookie-mode-spec.md#6-versioning-and-migration`);if(C=e??"cookie",C==="bearer"&&t===void 0)throw new Error(`<RoadProvider authMode="bearer">: 'jwt' prop is required. Pass a static string or a () => Promise<string> getter.`);C==="cookie"&&n===void 0&&!w.current&&(console.warn(`<RoadProvider authMode="cookie"> without 'onUnauthenticated'. Terminal 401s will be silent. Wire the handler to redirect to your BFF login URL.`),w.current=!0)}const S=x.useMemo(()=>new Gu({defaultOptions:{queries:{staleTime:3e4,retry:1,refetchOnWindowFocus:!1}}}),[]),E=x.useMemo(()=>u??new Na({apiBaseUrl:c,authMode:C,jwt:t,onUnauthenticated:n,csrfCookieName:r,csrfHeaderName:s,withCredentials:o,retry:h,telemetry:b}),[u,c,C,t,n,r,s,o,h,b]),P=x.useMemo(()=>({appearance:a,apiBaseUrl:c,locale:l,localization:f,client:E}),[a,c,l,f,E]),R=g?`${ai}:${g}`:ai;return i.jsx(da.Provider,{value:P,children:i.jsx(Qu,{client:S,children:i.jsxs(Yf,{initialBusinessUnitId:d,storageKey:R,storage:p,onSelect:v,children:[y,i.jsx(ah,{})]})})})}function ah(){const{appearance:e}=te(),t=Nt(e?.colorScheme),n=St(e);return i.jsx("div",{className:z("road-ui",t==="dark"&&"dark"),style:n,children:i.jsx(If,{theme:t,richColors:!0,position:"bottom-right",toastOptions:{classNames:{toast:z("road-ui",t==="dark"&&"dark")}}})})}function ci(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ct(...e){return t=>{let n=!1;const r=e.map(s=>{const o=ci(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():ci(e[s],null)}}}}function se(...e){return m.useCallback(ct(...e),e)}var ch=Symbol.for("react.lazy"),nr=m[" use ".trim().toString()];function lh(e){return typeof e=="object"&&e!==null&&"then"in e}function $a(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ch&&"_payload"in e&&lh(e._payload)}function dh(e){const t=fh(e),n=m.forwardRef((r,s)=>{let{children:o,...a}=r;$a(o)&&typeof nr=="function"&&(o=nr(o._payload));const c=m.Children.toArray(o),l=c.find(hh);if(l){const f=l.props.children,u=c.map(d=>d===l?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:d);return i.jsx(t,{...a,ref:s,children:m.isValidElement(f)?m.cloneElement(f,void 0,u):null})}return i.jsx(t,{...a,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var uh=dh("Slot");function fh(e){const t=m.forwardRef((n,r)=>{let{children:s,...o}=n;if($a(s)&&typeof nr=="function"&&(s=nr(s._payload)),m.isValidElement(s)){const a=gh(s),c=ph(o,s.props);return s.type!==m.Fragment&&(c.ref=r?ct(r,a):a),m.cloneElement(s,c)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var mh=Symbol("radix.slottable");function hh(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===mh}function ph(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const l=o(...c);return s(...c),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function gh(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)}const li=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,di=Ea,za=(e,t)=>n=>{var r;if(t?.variants==null)return di(e,n?.class,n?.className);const{variants:s,defaultVariants:o}=t,a=Object.keys(s).map(f=>{const u=n?.[f],d=o?.[f];if(u===null)return null;const p=li(u)||li(d);return s[f][p]}),c=n&&Object.entries(n).reduce((f,u)=>{let[d,p]=u;return p===void 0||(f[d]=p),f},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,u)=>{let{class:d,className:p,...g}=u;return Object.entries(g).every(v=>{let[h,b]=v;return Array.isArray(b)?b.includes({...o,...c}[h]):{...o,...c}[h]===b})?[...f,d,p]:f},[]);return di(e,a,l,n?.class,n?.className)},vh=za("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90"},size:{sm:"h-8 px-3",md:"h-9 px-4 py-2",lg:"h-10 px-6",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"md"}}),W=x.forwardRef(({className:e,variant:t,size:n,asChild:r,...s},o)=>{const a=r?uh:"button";return i.jsx(a,{ref:o,className:z(vh({variant:t,size:n}),e),...s})});W.displayName="Button";function I(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}function bh(e,t){const n=m.createContext(t),r=o=>{const{children:a,...c}=o,l=m.useMemo(()=>c,Object.values(c));return i.jsx(n.Provider,{value:l,children:a})};r.displayName=e+"Provider";function s(o){const a=m.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,s]}function Ke(e,t=[]){let n=[];function r(o,a){const c=m.createContext(a),l=n.length;n=[...n,a];const f=d=>{const{scope:p,children:g,...v}=d,h=p?.[e]?.[l]||c,b=m.useMemo(()=>v,Object.values(v));return i.jsx(h.Provider,{value:b,children:g})};f.displayName=o+"Provider";function u(d,p){const g=p?.[e]?.[l]||c,v=m.useContext(g);if(v)return v;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[f,u]}const s=()=>{const o=n.map(a=>m.createContext(a));return function(c){const l=c?.[e]||o;return m.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return s.scopeName=e,[r,yh(s,...t)]}function yh(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const a=r.reduce((c,{useScope:l,scopeName:f})=>{const d=l(o)[`__scope${f}`];return{...c,...d}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var we=globalThis?.document?m.useLayoutEffect:()=>{},xh=m[" useId ".trim().toString()]||(()=>{}),wh=0;function $e(e){const[t,n]=m.useState(xh());return we(()=>{n(r=>r??String(wh++))},[e]),t?`radix-${t}`:""}var Ch=m[" useInsertionEffect ".trim().toString()]||we;function bt({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,a]=Sh({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:s;{const u=m.useRef(e!==void 0);m.useEffect(()=>{const d=u.current;d!==c&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=c},[c,r])}const f=m.useCallback(u=>{if(c){const d=Nh(u)?u(e):u;d!==e&&a.current?.(d)}else o(u)},[c,e,o,a]);return[l,f]}function Sh({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),s=m.useRef(n),o=m.useRef(t);return Ch(()=>{o.current=t},[t]),m.useEffect(()=>{s.current!==n&&(o.current?.(n),s.current=n)},[n,s]),[n,r,o]}function Nh(e){return typeof e=="function"}function Rh(e){const t=Eh(e),n=m.forwardRef((r,s)=>{const{children:o,...a}=r,c=m.Children.toArray(o),l=c.find(Ph);if(l){const f=l.props.children,u=c.map(d=>d===l?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:d);return i.jsx(t,{...a,ref:s,children:m.isValidElement(f)?m.cloneElement(f,void 0,u):null})}return i.jsx(t,{...a,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function Eh(e){const t=m.forwardRef((n,r)=>{const{children:s,...o}=n;if(m.isValidElement(s)){const a=Mh(s),c=Th(o,s.props);return s.type!==m.Fragment&&(c.ref=r?ct(r,a):a),m.cloneElement(s,c)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jh=Symbol("radix.slottable");function Ph(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jh}function Th(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const l=o(...c);return s(...c),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function Mh(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)}var Ah=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Y=Ah.reduce((e,t)=>{const n=Rh(`Primitive.${t}`),r=m.forwardRef((s,o)=>{const{asChild:a,...c}=s,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(l,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Va(e,t){e&&mr.flushSync(()=>e.dispatchEvent(t))}function et(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>t.current?.(...n),[])}function kh(e,t=globalThis?.document){const n=et(e);m.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Ih="DismissableLayer",ms="dismissableLayer.update",Dh="dismissableLayer.pointerDownOutside",Oh="dismissableLayer.focusOutside",ui,Ha=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),En=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:c,...l}=e,f=m.useContext(Ha),[u,d]=m.useState(null),p=u?.ownerDocument??globalThis?.document,[,g]=m.useState({}),v=se(t,R=>d(R)),h=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),y=h.indexOf(b),w=u?h.indexOf(u):-1,C=f.layersWithOutsidePointerEventsDisabled.size>0,S=w>=y,E=Fh(R=>{const N=R.target,A=[...f.branches].some($=>$.contains(N));!S||A||(s?.(R),a?.(R),R.defaultPrevented||c?.())},p),P=Bh(R=>{const N=R.target;[...f.branches].some($=>$.contains(N))||(o?.(R),a?.(R),R.defaultPrevented||c?.())},p);return kh(R=>{w===f.layers.size-1&&(r?.(R),!R.defaultPrevented&&c&&(R.preventDefault(),c()))},p),m.useEffect(()=>{if(u)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(ui=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(u)),f.layers.add(u),fi(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=ui)}},[u,p,n,f]),m.useEffect(()=>()=>{u&&(f.layers.delete(u),f.layersWithOutsidePointerEventsDisabled.delete(u),fi())},[u,f]),m.useEffect(()=>{const R=()=>g({});return document.addEventListener(ms,R),()=>document.removeEventListener(ms,R)},[]),i.jsx(Y.div,{...l,ref:v,style:{pointerEvents:C?S?"auto":"none":void 0,...e.style},onFocusCapture:I(e.onFocusCapture,P.onFocusCapture),onBlurCapture:I(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:I(e.onPointerDownCapture,E.onPointerDownCapture)})});En.displayName=Ih;var _h="DismissableLayerBranch",Lh=m.forwardRef((e,t)=>{const n=m.useContext(Ha),r=m.useRef(null),s=se(t,r);return m.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),i.jsx(Y.div,{...e,ref:s})});Lh.displayName=_h;function Fh(e,t=globalThis?.document){const n=et(e),r=m.useRef(!1),s=m.useRef(()=>{});return m.useEffect(()=>{const o=c=>{if(c.target&&!r.current){let l=function(){qa(Dh,n,f,{discrete:!0})};const f={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=l,t.addEventListener("click",s.current,{once:!0})):l()}else t.removeEventListener("click",s.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Bh(e,t=globalThis?.document){const n=et(e),r=m.useRef(!1);return m.useEffect(()=>{const s=o=>{o.target&&!r.current&&qa(Oh,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function fi(){const e=new CustomEvent(ms);document.dispatchEvent(e)}function qa(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Va(s,o):s.dispatchEvent(o)}var qr="focusScope.autoFocusOnMount",Wr="focusScope.autoFocusOnUnmount",mi={bubbles:!1,cancelable:!0},Uh="FocusScope",vr=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...a}=e,[c,l]=m.useState(null),f=et(s),u=et(o),d=m.useRef(null),p=se(t,h=>l(h)),g=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let h=function(C){if(g.paused||!c)return;const S=C.target;c.contains(S)?d.current=S:mt(d.current,{select:!0})},b=function(C){if(g.paused||!c)return;const S=C.relatedTarget;S!==null&&(c.contains(S)||mt(d.current,{select:!0}))},y=function(C){if(document.activeElement===document.body)for(const E of C)E.removedNodes.length>0&&mt(c)};document.addEventListener("focusin",h),document.addEventListener("focusout",b);const w=new MutationObserver(y);return c&&w.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",b),w.disconnect()}}},[r,c,g.paused]),m.useEffect(()=>{if(c){pi.add(g);const h=document.activeElement;if(!c.contains(h)){const y=new CustomEvent(qr,mi);c.addEventListener(qr,f),c.dispatchEvent(y),y.defaultPrevented||($h(Wh(Wa(c)),{select:!0}),document.activeElement===h&&mt(c))}return()=>{c.removeEventListener(qr,f),setTimeout(()=>{const y=new CustomEvent(Wr,mi);c.addEventListener(Wr,u),c.dispatchEvent(y),y.defaultPrevented||mt(h??document.body,{select:!0}),c.removeEventListener(Wr,u),pi.remove(g)},0)}}},[c,f,u,g]);const v=m.useCallback(h=>{if(!n&&!r||g.paused)return;const b=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,y=document.activeElement;if(b&&y){const w=h.currentTarget,[C,S]=zh(w);C&&S?!h.shiftKey&&y===S?(h.preventDefault(),n&&mt(C,{select:!0})):h.shiftKey&&y===C&&(h.preventDefault(),n&&mt(S,{select:!0})):y===w&&h.preventDefault()}},[n,r,g.paused]);return i.jsx(Y.div,{tabIndex:-1,...a,ref:p,onKeyDown:v})});vr.displayName=Uh;function $h(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(mt(r,{select:t}),document.activeElement!==n)return}function zh(e){const t=Wa(e),n=hi(t,e),r=hi(t.reverse(),e);return[n,r]}function Wa(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function hi(e,t){for(const n of e)if(!Vh(n,{upTo:t}))return n}function Vh(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}function Hh(e){return e instanceof HTMLInputElement&&"select"in e}function mt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Hh(e)&&t&&e.select()}}var pi=qh();function qh(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=gi(e,t),e.unshift(t)},remove(t){e=gi(e,t),e[0]?.resume()}}}function gi(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Wh(e){return e.filter(t=>t.tagName!=="A")}var Kh="Portal",jn=m.forwardRef((e,t)=>{const{container:n,...r}=e,[s,o]=m.useState(!1);we(()=>o(!0),[]);const a=n||s&&globalThis?.document?.body;return a?As.createPortal(i.jsx(Y.div,{...r,ref:t}),a):null});jn.displayName=Kh;function Gh(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var Le=e=>{const{present:t,children:n}=e,r=Qh(t),s=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),o=se(r.ref,Yh(s));return typeof n=="function"||r.isPresent?m.cloneElement(s,{ref:o}):null};Le.displayName="Presence";function Qh(e){const[t,n]=m.useState(),r=m.useRef(null),s=m.useRef(e),o=m.useRef("none"),a=e?"mounted":"unmounted",[c,l]=Gh(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const f=$n(r.current);o.current=c==="mounted"?f:"none"},[c]),we(()=>{const f=r.current,u=s.current;if(u!==e){const p=o.current,g=$n(f);e?l("MOUNT"):g==="none"||f?.display==="none"?l("UNMOUNT"):l(u&&p!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,l]),we(()=>{if(t){let f;const u=t.ownerDocument.defaultView??window,d=g=>{const h=$n(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&h&&(l("ANIMATION_END"),!s.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",f=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},p=g=>{g.target===t&&(o.current=$n(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(f),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:m.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function $n(e){return e?.animationName||"none"}function Yh(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)}var Kr=0;function Vs(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??vi()),document.body.insertAdjacentElement("beforeend",e[1]??vi()),Kr++,()=>{Kr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Kr--}},[])}function vi(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Xe=function(){return Xe=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Xe.apply(this,arguments)};function Ka(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function Xh(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Kn="right-scroll-bar-position",Gn="width-before-scroll-bar",Jh="with-scroll-bars-hidden",Zh="--removed-body-scroll-bar-size";function Gr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function ep(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var tp=typeof window<"u"?m.useLayoutEffect:m.useEffect,bi=new WeakMap;function np(e,t){var n=ep(null,function(r){return e.forEach(function(s){return Gr(s,r)})});return tp(function(){var r=bi.get(n);if(r){var s=new Set(r),o=new Set(e),a=n.current;s.forEach(function(c){o.has(c)||Gr(c,null)}),o.forEach(function(c){s.has(c)||Gr(c,a)})}bi.set(n,e)},[e]),n}function rp(e){return e}function sp(e,t){t===void 0&&(t=rp);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var a=t(o,r);return n.push(a),function(){n=n.filter(function(c){return c!==a})}},assignSyncMedium:function(o){for(r=!0;n.length;){var a=n;n=[],a.forEach(o)}n={push:function(c){return o(c)},filter:function(){return n}}},assignMedium:function(o){r=!0;var a=[];if(n.length){var c=n;n=[],c.forEach(o),a=n}var l=function(){var u=a;a=[],u.forEach(o)},f=function(){return Promise.resolve().then(l)};f(),n={push:function(u){a.push(u),f()},filter:function(u){return a=a.filter(u),n}}}};return s}function op(e){e===void 0&&(e={});var t=sp(null);return t.options=Xe({async:!0,ssr:!1},e),t}var Ga=function(e){var t=e.sideCar,n=Ka(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return m.createElement(r,Xe({},n))};Ga.isSideCarExport=!0;function ip(e,t){return e.useMedium(t),Ga}var Qa=op(),Qr=function(){},br=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:Qr,onWheelCapture:Qr,onTouchMoveCapture:Qr}),s=r[0],o=r[1],a=e.forwardProps,c=e.children,l=e.className,f=e.removeScrollBar,u=e.enabled,d=e.shards,p=e.sideCar,g=e.noRelative,v=e.noIsolation,h=e.inert,b=e.allowPinchZoom,y=e.as,w=y===void 0?"div":y,C=e.gapMode,S=Ka(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=p,P=np([n,t]),R=Xe(Xe({},S),s);return m.createElement(m.Fragment,null,u&&m.createElement(E,{sideCar:Qa,removeScrollBar:f,shards:d,noRelative:g,noIsolation:v,inert:h,setCallbacks:o,allowPinchZoom:!!b,lockRef:n,gapMode:C}),a?m.cloneElement(m.Children.only(c),Xe(Xe({},R),{ref:P})):m.createElement(w,Xe({},R,{className:l,ref:P}),c))});br.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};br.classNames={fullWidth:Gn,zeroRight:Kn};var ap=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function cp(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ap();return t&&e.setAttribute("nonce",t),e}function lp(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function dp(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var up=function(){var e=0,t=null;return{add:function(n){e==0&&(t=cp())&&(lp(t,n),dp(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},fp=function(){var e=up();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ya=function(){var e=fp(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},mp={left:0,top:0,right:0,gap:0},Yr=function(e){return parseInt(e||"",10)||0},hp=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Yr(n),Yr(r),Yr(s)]},pp=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return mp;var t=hp(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},gp=Ya(),Yt="data-scroll-locked",vp=function(e,t,n,r){var s=e.left,o=e.top,a=e.right,c=e.gap;return n===void 0&&(n="margin"),`
6
+ .`.concat(Jh,` {
7
+ overflow: hidden `).concat(r,`;
8
+ padding-right: `).concat(c,"px ").concat(r,`;
9
+ }
10
+ body[`).concat(Yt,`] {
11
+ overflow: hidden `).concat(r,`;
12
+ overscroll-behavior: contain;
13
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
14
+ padding-left: `.concat(s,`px;
15
+ padding-top: `).concat(o,`px;
16
+ padding-right: `).concat(a,`px;
17
+ margin-left:0;
18
+ margin-top:0;
19
+ margin-right: `).concat(c,"px ").concat(r,`;
20
+ `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
21
+ }
22
+
23
+ .`).concat(Kn,` {
24
+ right: `).concat(c,"px ").concat(r,`;
25
+ }
26
+
27
+ .`).concat(Gn,` {
28
+ margin-right: `).concat(c,"px ").concat(r,`;
29
+ }
30
+
31
+ .`).concat(Kn," .").concat(Kn,` {
32
+ right: 0 `).concat(r,`;
33
+ }
34
+
35
+ .`).concat(Gn," .").concat(Gn,` {
36
+ margin-right: 0 `).concat(r,`;
37
+ }
38
+
39
+ body[`).concat(Yt,`] {
40
+ `).concat(Zh,": ").concat(c,`px;
41
+ }
42
+ `)},yi=function(){var e=parseInt(document.body.getAttribute(Yt)||"0",10);return isFinite(e)?e:0},bp=function(){m.useEffect(function(){return document.body.setAttribute(Yt,(yi()+1).toString()),function(){var e=yi()-1;e<=0?document.body.removeAttribute(Yt):document.body.setAttribute(Yt,e.toString())}},[])},yp=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;bp();var o=m.useMemo(function(){return pp(s)},[s]);return m.createElement(gp,{styles:vp(o,!t,s,n?"":"!important")})},hs=!1;if(typeof window<"u")try{var zn=Object.defineProperty({},"passive",{get:function(){return hs=!0,!0}});window.addEventListener("test",zn,zn),window.removeEventListener("test",zn,zn)}catch{hs=!1}var Kt=hs?{passive:!1}:!1,xp=function(e){return e.tagName==="TEXTAREA"},Xa=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!xp(e)&&n[t]==="visible")},wp=function(e){return Xa(e,"overflowY")},Cp=function(e){return Xa(e,"overflowX")},xi=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Ja(e,r);if(s){var o=Za(e,r),a=o[1],c=o[2];if(a>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Sp=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Np=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Ja=function(e,t){return e==="v"?wp(t):Cp(t)},Za=function(e,t){return e==="v"?Sp(t):Np(t)},Rp=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ep=function(e,t,n,r,s){var o=Rp(e,window.getComputedStyle(t).direction),a=o*r,c=n.target,l=t.contains(c),f=!1,u=a>0,d=0,p=0;do{if(!c)break;var g=Za(e,c),v=g[0],h=g[1],b=g[2],y=h-b-o*v;(v||y)&&Ja(e,c)&&(d+=y,p+=v);var w=c.parentNode;c=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!l&&c!==document.body||l&&(t.contains(c)||t===c));return(u&&Math.abs(d)<1||!u&&Math.abs(p)<1)&&(f=!0),f},Vn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},wi=function(e){return[e.deltaX,e.deltaY]},Ci=function(e){return e&&"current"in e?e.current:e},jp=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Pp=function(e){return`
43
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
44
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
45
+ `)},Tp=0,Gt=[];function Mp(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),s=m.useState(Tp++)[0],o=m.useState(Ya)[0],a=m.useRef(e);m.useEffect(function(){a.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var h=Xh([e.lockRef.current],(e.shards||[]).map(Ci),!0).filter(Boolean);return h.forEach(function(b){return b.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),h.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var c=m.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var y=Vn(h),w=n.current,C="deltaX"in h?h.deltaX:w[0]-y[0],S="deltaY"in h?h.deltaY:w[1]-y[1],E,P=h.target,R=Math.abs(C)>Math.abs(S)?"h":"v";if("touches"in h&&R==="h"&&P.type==="range")return!1;var N=window.getSelection(),A=N&&N.anchorNode,$=A?A===P||A.contains(P):!1;if($)return!1;var L=xi(R,P);if(!L)return!0;if(L?E=R:(E=R==="v"?"h":"v",L=xi(R,P)),!L)return!1;if(!r.current&&"changedTouches"in h&&(C||S)&&(r.current=E),!E)return!0;var B=r.current||E;return Ep(B,b,h,B==="h"?C:S)},[]),l=m.useCallback(function(h){var b=h;if(!(!Gt.length||Gt[Gt.length-1]!==o)){var y="deltaY"in b?wi(b):Vn(b),w=t.current.filter(function(E){return E.name===b.type&&(E.target===b.target||b.target===E.shadowParent)&&jp(E.delta,y)})[0];if(w&&w.should){b.cancelable&&b.preventDefault();return}if(!w){var C=(a.current.shards||[]).map(Ci).filter(Boolean).filter(function(E){return E.contains(b.target)}),S=C.length>0?c(b,C[0]):!a.current.noIsolation;S&&b.cancelable&&b.preventDefault()}}},[]),f=m.useCallback(function(h,b,y,w){var C={name:h,delta:b,target:y,should:w,shadowParent:Ap(y)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(S){return S!==C})},1)},[]),u=m.useCallback(function(h){n.current=Vn(h),r.current=void 0},[]),d=m.useCallback(function(h){f(h.type,wi(h),h.target,c(h,e.lockRef.current))},[]),p=m.useCallback(function(h){f(h.type,Vn(h),h.target,c(h,e.lockRef.current))},[]);m.useEffect(function(){return Gt.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Kt),document.addEventListener("touchmove",l,Kt),document.addEventListener("touchstart",u,Kt),function(){Gt=Gt.filter(function(h){return h!==o}),document.removeEventListener("wheel",l,Kt),document.removeEventListener("touchmove",l,Kt),document.removeEventListener("touchstart",u,Kt)}},[]);var g=e.removeScrollBar,v=e.inert;return m.createElement(m.Fragment,null,v?m.createElement(o,{styles:Pp(s)}):null,g?m.createElement(yp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ap(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const kp=ip(Qa,Mp);var yr=m.forwardRef(function(e,t){return m.createElement(br,Xe({},e,{ref:t,sideCar:kp}))});yr.classNames=br.classNames;var Ip=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Qt=new WeakMap,Hn=new WeakMap,qn={},Xr=0,ec=function(e){return e&&(e.host||ec(e.parentNode))},Dp=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=ec(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Op=function(e,t,n,r){var s=Dp(t,Array.isArray(e)?e:[e]);qn[n]||(qn[n]=new WeakMap);var o=qn[n],a=[],c=new Set,l=new Set(s),f=function(d){!d||c.has(d)||(c.add(d),f(d.parentNode))};s.forEach(f);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(p){if(c.has(p))u(p);else try{var g=p.getAttribute(r),v=g!==null&&g!=="false",h=(Qt.get(p)||0)+1,b=(o.get(p)||0)+1;Qt.set(p,h),o.set(p,b),a.push(p),h===1&&v&&Hn.set(p,!0),b===1&&p.setAttribute(n,"true"),v||p.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return u(t),c.clear(),Xr++,function(){a.forEach(function(d){var p=Qt.get(d)-1,g=o.get(d)-1;Qt.set(d,p),o.set(d,g),p||(Hn.has(d)||d.removeAttribute(r),Hn.delete(d)),g||d.removeAttribute(n)}),Xr--,Xr||(Qt=new WeakMap,Qt=new WeakMap,Hn=new WeakMap,qn={})}},Hs=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Ip(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Op(r,s,n,"aria-hidden")):function(){return null}};function _p(e){const t=Lp(e),n=m.forwardRef((r,s)=>{const{children:o,...a}=r,c=m.Children.toArray(o),l=c.find(Bp);if(l){const f=l.props.children,u=c.map(d=>d===l?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:d);return i.jsx(t,{...a,ref:s,children:m.isValidElement(f)?m.cloneElement(f,void 0,u):null})}return i.jsx(t,{...a,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function Lp(e){const t=m.forwardRef((n,r)=>{const{children:s,...o}=n;if(m.isValidElement(s)){const a=$p(s),c=Up(o,s.props);return s.type!==m.Fragment&&(c.ref=r?ct(r,a):a),m.cloneElement(s,c)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Fp=Symbol("radix.slottable");function Bp(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Fp}function Up(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const l=o(...c);return s(...c),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function $p(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)}var xr="Dialog",[tc,nc]=Ke(xr),[zp,Ge]=tc(xr),rc=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=m.useRef(null),l=m.useRef(null),[f,u]=bt({prop:r,defaultProp:s??!1,onChange:o,caller:xr});return i.jsx(zp,{scope:t,triggerRef:c,contentRef:l,contentId:$e(),titleId:$e(),descriptionId:$e(),open:f,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(d=>!d),[u]),modal:a,children:n})};rc.displayName=xr;var sc="DialogTrigger",oc=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ge(sc,n),o=se(t,s.triggerRef);return i.jsx(Y.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Ks(s.open),...r,ref:o,onClick:I(e.onClick,s.onOpenToggle)})});oc.displayName=sc;var qs="DialogPortal",[Vp,ic]=tc(qs,{forceMount:void 0}),ac=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=Ge(qs,t);return i.jsx(Vp,{scope:t,forceMount:n,children:m.Children.map(r,a=>i.jsx(Le,{present:n||o.open,children:i.jsx(jn,{asChild:!0,container:s,children:a})}))})};ac.displayName=qs;var rr="DialogOverlay",cc=m.forwardRef((e,t)=>{const n=ic(rr,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Ge(rr,e.__scopeDialog);return o.modal?i.jsx(Le,{present:r||o.open,children:i.jsx(qp,{...s,ref:t})}):null});cc.displayName=rr;var Hp=_p("DialogOverlay.RemoveScroll"),qp=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ge(rr,n);return i.jsx(yr,{as:Hp,allowPinchZoom:!0,shards:[s.contentRef],children:i.jsx(Y.div,{"data-state":Ks(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),_t="DialogContent",lc=m.forwardRef((e,t)=>{const n=ic(_t,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Ge(_t,e.__scopeDialog);return i.jsx(Le,{present:r||o.open,children:o.modal?i.jsx(Wp,{...s,ref:t}):i.jsx(Kp,{...s,ref:t})})});lc.displayName=_t;var Wp=m.forwardRef((e,t)=>{const n=Ge(_t,e.__scopeDialog),r=m.useRef(null),s=se(t,n.contentRef,r);return m.useEffect(()=>{const o=r.current;if(o)return Hs(o)},[]),i.jsx(dc,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:I(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:I(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0;(a.button===2||c)&&o.preventDefault()}),onFocusOutside:I(e.onFocusOutside,o=>o.preventDefault())})}),Kp=m.forwardRef((e,t)=>{const n=Ge(_t,e.__scopeDialog),r=m.useRef(!1),s=m.useRef(!1);return i.jsx(dc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=o.target;n.triggerRef.current?.contains(a)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),dc=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,...a}=e,c=Ge(_t,n),l=m.useRef(null),f=se(t,l);return Vs(),i.jsxs(i.Fragment,{children:[i.jsx(vr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:i.jsx(En,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Ks(c.open),...a,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(Qp,{titleId:c.titleId}),i.jsx(Xp,{contentRef:l,descriptionId:c.descriptionId})]})]})}),Ws="DialogTitle",uc=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ge(Ws,n);return i.jsx(Y.h2,{id:s.titleId,...r,ref:t})});uc.displayName=Ws;var fc="DialogDescription",mc=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ge(fc,n);return i.jsx(Y.p,{id:s.descriptionId,...r,ref:t})});mc.displayName=fc;var hc="DialogClose",pc=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ge(hc,n);return i.jsx(Y.button,{type:"button",...r,ref:t,onClick:I(e.onClick,()=>s.onOpenChange(!1))})});pc.displayName=hc;function Ks(e){return e?"open":"closed"}var gc="DialogTitleWarning",[Gp,vc]=bh(gc,{contentName:_t,titleName:Ws,docsSlug:"dialog"}),Qp=({titleId:e})=>{const t=vc(gc),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
46
+
47
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
48
+
49
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Yp="DialogDescriptionWarning",Xp=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${vc(Yp).contentName}}.`;return m.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},bc=rc,yc=oc,xc=ac,wc=cc,Cc=lc,Sc=uc,Nc=mc,Gs=pc;const Rc=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const Jp=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Zp=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const Si=e=>{const t=Zp(e);return t.charAt(0).toUpperCase()+t.slice(1)};var eg={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const tg=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const ng=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:a,...c},l)=>x.createElement("svg",{ref:l,...eg,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Rc("lucide",s),...!o&&!tg(c)&&{"aria-hidden":"true"},...c},[...a.map(([f,u])=>x.createElement(f,u)),...Array.isArray(o)?o:[o]]));const ue=(e,t)=>{const n=x.forwardRef(({className:r,...s},o)=>x.createElement(ng,{ref:o,iconNode:t,className:Rc(`lucide-${Jp(Si(e))}`,`lucide-${e}`,r),...s}));return n.displayName=Si(e),n};const rg=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Qn=ue("arrow-left",rg);const sg=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],Ec=ue("building-2",sg);const og=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],cn=ue("check",og);const ig=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ps=ue("chevron-down",ig);const ag=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],jc=ue("chevron-right",ag);const cg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],lg=ue("circle-alert",cg);const dg=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Pc=ue("copy",dg);const ug=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ve=ue("loader-circle",ug);const fg=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Qs=ue("lock",fg);const mg=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],wr=ue("mail",mg);const hg=[["path",{d:"M5 12h14",key:"1ays0h"}]],pg=ue("minus",hg);const gg=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],vg=ue("pause",gg);const bg=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],yg=ue("play",bg);const xg=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ot=ue("plus",xg);const wg=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],pt=ue("refresh-cw",wg);const Cg=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Sg=ue("rotate-cw",Cg);const Ng=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],sr=ue("search",Ng);const Rg=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Eg=ue("settings",Rg);const jg=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Pg=ue("shield-check",jg);const Tg=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Mg=ue("sparkles",Tg);const Ag=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Tc=ue("trash-2",Ag);const kg=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],xn=ue("users",kg);const Ig=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ys=ue("x",Ig),Mc=bc,Dg=yc,Ac=x.forwardRef(({className:e,...t},n)=>i.jsx(wc,{ref:n,className:z("fixed inset-0 z-50 bg-black/50","data-[state=open]:animate-in data-[state=open]:fade-in-0","data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t}));Ac.displayName="DialogOverlay";const Xs=x.forwardRef(({className:e,children:t,hideCloseButton:n,...r},s)=>{const{appearance:o}=te(),a=Nt(o?.colorScheme),c=St(o);return i.jsx(xc,{children:i.jsxs("div",{className:z("road-ui",a==="dark"&&"dark"),style:c,children:[i.jsx(Ac,{}),i.jsxs(Cc,{ref:s,className:z("fixed left-[50%] top-[50%] z-50 flex w-full max-w-3xl max-h-[85vh] translate-x-[-50%] translate-y-[-50%] flex-col border border-border bg-background shadow-lg rounded-lg overflow-hidden","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...r,children:[t,!n&&i.jsx(Gs,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring z-10","aria-label":"Close",children:i.jsx(Ys,{className:"h-4 w-4"})})]})]})})});Xs.displayName="DialogContent";function kc({className:e,...t}){return i.jsx("div",{className:z("flex flex-col gap-1.5",e),...t})}const Js=x.forwardRef(({className:e,...t},n)=>i.jsx(Sc,{ref:n,className:z("text-lg font-semibold leading-none tracking-tight",e),...t}));Js.displayName="DialogTitle";const Zs=x.forwardRef(({className:e,...t},n)=>i.jsx(Nc,{ref:n,className:z("text-sm text-muted-foreground",e),...t}));Zs.displayName="DialogDescription";function Ni(e){const t=Og(e),n=m.forwardRef((r,s)=>{const{children:o,...a}=r,c=m.Children.toArray(o),l=c.find(Lg);if(l){const f=l.props.children,u=c.map(d=>d===l?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:d);return i.jsx(t,{...a,ref:s,children:m.isValidElement(f)?m.cloneElement(f,void 0,u):null})}return i.jsx(t,{...a,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function Og(e){const t=m.forwardRef((n,r)=>{const{children:s,...o}=n;if(m.isValidElement(s)){const a=Bg(s),c=Fg(o,s.props);return s.type!==m.Fragment&&(c.ref=r?ct(r,a):a),m.cloneElement(s,c)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _g=Symbol("radix.slottable");function Lg(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_g}function Fg(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const l=o(...c);return s(...c),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function Bg(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)}function eo(e){const t=e+"CollectionProvider",[n,r]=Ke(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=h=>{const{scope:b,children:y}=h,w=x.useRef(null),C=x.useRef(new Map).current;return i.jsx(s,{scope:b,itemMap:C,collectionRef:w,children:y})};a.displayName=t;const c=e+"CollectionSlot",l=Ni(c),f=x.forwardRef((h,b)=>{const{scope:y,children:w}=h,C=o(c,y),S=se(b,C.collectionRef);return i.jsx(l,{ref:S,children:w})});f.displayName=c;const u=e+"CollectionItemSlot",d="data-radix-collection-item",p=Ni(u),g=x.forwardRef((h,b)=>{const{scope:y,children:w,...C}=h,S=x.useRef(null),E=se(b,S),P=o(u,y);return x.useEffect(()=>(P.itemMap.set(S,{ref:S,...C}),()=>{P.itemMap.delete(S)})),i.jsx(p,{[d]:"",ref:E,children:w})});g.displayName=u;function v(h){const b=o(e+"CollectionConsumer",h);return x.useCallback(()=>{const w=b.collectionRef.current;if(!w)return[];const C=Array.from(w.querySelectorAll(`[${d}]`));return Array.from(b.itemMap.values()).sort((P,R)=>C.indexOf(P.ref.current)-C.indexOf(R.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:a,Slot:f,ItemSlot:g},v,r]}var Ug=m.createContext(void 0);function Cr(e){const t=m.useContext(Ug);return e||t||"ltr"}var Jr="rovingFocusGroup.onEntryFocus",$g={bubbles:!1,cancelable:!0},Pn="RovingFocusGroup",[gs,Ic,zg]=eo(Pn),[Vg,Sr]=Ke(Pn,[zg]),[Hg,qg]=Vg(Pn),Dc=m.forwardRef((e,t)=>i.jsx(gs.Provider,{scope:e.__scopeRovingFocusGroup,children:i.jsx(gs.Slot,{scope:e.__scopeRovingFocusGroup,children:i.jsx(Wg,{...e,ref:t})})}));Dc.displayName=Pn;var Wg=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:f,preventScrollOnEntryFocus:u=!1,...d}=e,p=m.useRef(null),g=se(t,p),v=Cr(o),[h,b]=bt({prop:a,defaultProp:c??null,onChange:l,caller:Pn}),[y,w]=m.useState(!1),C=et(f),S=Ic(n),E=m.useRef(!1),[P,R]=m.useState(0);return m.useEffect(()=>{const N=p.current;if(N)return N.addEventListener(Jr,C),()=>N.removeEventListener(Jr,C)},[C]),i.jsx(Hg,{scope:n,orientation:r,dir:v,loop:s,currentTabStopId:h,onItemFocus:m.useCallback(N=>b(N),[b]),onItemShiftTab:m.useCallback(()=>w(!0),[]),onFocusableItemAdd:m.useCallback(()=>R(N=>N+1),[]),onFocusableItemRemove:m.useCallback(()=>R(N=>N-1),[]),children:i.jsx(Y.div,{tabIndex:y||P===0?-1:0,"data-orientation":r,...d,ref:g,style:{outline:"none",...e.style},onMouseDown:I(e.onMouseDown,()=>{E.current=!0}),onFocus:I(e.onFocus,N=>{const A=!E.current;if(N.target===N.currentTarget&&A&&!y){const $=new CustomEvent(Jr,$g);if(N.currentTarget.dispatchEvent($),!$.defaultPrevented){const L=S().filter(M=>M.focusable),B=L.find(M=>M.active),F=L.find(M=>M.id===h),K=[B,F,...L].filter(Boolean).map(M=>M.ref.current);Lc(K,u)}}E.current=!1}),onBlur:I(e.onBlur,()=>w(!1))})})}),Oc="RovingFocusGroupItem",_c=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:a,...c}=e,l=$e(),f=o||l,u=qg(Oc,n),d=u.currentTabStopId===f,p=Ic(n),{onFocusableItemAdd:g,onFocusableItemRemove:v,currentTabStopId:h}=u;return m.useEffect(()=>{if(r)return g(),()=>v()},[r,g,v]),i.jsx(gs.ItemSlot,{scope:n,id:f,focusable:r,active:s,children:i.jsx(Y.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...c,ref:t,onMouseDown:I(e.onMouseDown,b=>{r?u.onItemFocus(f):b.preventDefault()}),onFocus:I(e.onFocus,()=>u.onItemFocus(f)),onKeyDown:I(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const y=Qg(b,u.orientation,u.dir);if(y!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let C=p().filter(S=>S.focusable).map(S=>S.ref.current);if(y==="last")C.reverse();else if(y==="prev"||y==="next"){y==="prev"&&C.reverse();const S=C.indexOf(b.currentTarget);C=u.loop?Yg(C,S+1):C.slice(S+1)}setTimeout(()=>Lc(C))}}),children:typeof a=="function"?a({isCurrentTabStop:d,hasTabStop:h!=null}):a})})});_c.displayName=Oc;var Kg={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Gg(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Qg(e,t,n){const r=Gg(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Kg[r]}function Lc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Yg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Fc=Dc,Bc=_c,Nr="Tabs",[Xg]=Ke(Nr,[Sr]),Uc=Sr(),[Jg,to]=Xg(Nr),$c=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:o,orientation:a="horizontal",dir:c,activationMode:l="automatic",...f}=e,u=Cr(c),[d,p]=bt({prop:r,onChange:s,defaultProp:o??"",caller:Nr});return i.jsx(Jg,{scope:n,baseId:$e(),value:d,onValueChange:p,orientation:a,dir:u,activationMode:l,children:i.jsx(Y.div,{dir:u,"data-orientation":a,...f,ref:t})})});$c.displayName=Nr;var zc="TabsList",Vc=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,o=to(zc,n),a=Uc(n);return i.jsx(Fc,{asChild:!0,...a,orientation:o.orientation,dir:o.dir,loop:r,children:i.jsx(Y.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});Vc.displayName=zc;var Hc="TabsTrigger",qc=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...o}=e,a=to(Hc,n),c=Uc(n),l=Gc(a.baseId,r),f=Qc(a.baseId,r),u=r===a.value;return i.jsx(Bc,{asChild:!0,...c,focusable:!s,active:u,children:i.jsx(Y.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":f,"data-state":u?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:l,...o,ref:t,onMouseDown:I(e.onMouseDown,d=>{!s&&d.button===0&&d.ctrlKey===!1?a.onValueChange(r):d.preventDefault()}),onKeyDown:I(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&a.onValueChange(r)}),onFocus:I(e.onFocus,()=>{const d=a.activationMode!=="manual";!u&&!s&&d&&a.onValueChange(r)})})})});qc.displayName=Hc;var Wc="TabsContent",Kc=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:o,...a}=e,c=to(Wc,n),l=Gc(c.baseId,r),f=Qc(c.baseId,r),u=r===c.value,d=m.useRef(u);return m.useEffect(()=>{const p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),i.jsx(Le,{present:s||u,children:({present:p})=>i.jsx(Y.div,{"data-state":u?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:f,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:p&&o})})});Kc.displayName=Wc;function Gc(e,t){return`${e}-trigger-${t}`}function Qc(e,t){return`${e}-content-${t}`}var Zg=$c,ev=Vc,tv=qc,nv=Kc;const Yc=Zg,no=x.forwardRef(({className:e,...t},n)=>i.jsx(ev,{ref:n,className:z("inline-flex h-9 items-center justify-start gap-1 rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));no.displayName="TabsList";const Xt=x.forwardRef(({className:e,...t},n)=>i.jsx(tv,{ref:n,className:z("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50","data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));Xt.displayName="TabsTrigger";const Jt=x.forwardRef(({className:e,...t},n)=>i.jsx(nv,{ref:n,className:z("mt-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","data-[state=active]:animate-in data-[state=active]:fade-in-0",e),...t}));Jt.displayName="TabsContent";const rv={common:{cancel:"Cancel",save:"Save",saveChanges:"Save changes",discard:"Discard",delete:"Delete",remove:"Remove",edit:"Edit",create:"Create",search:"Search",refresh:"Refresh",back:"Back",close:"Close",submit:"Submit",tryAgain:"Try again",noMatches:"No matches",noMatchesQuery:'No results match "{{query}}".',yes:"Yes",no:"No",you:"You",system:"System",suspended:"Suspended",member:{one:"member",other:"members"},permission:{one:"permission",other:"permissions"},day:{one:"day",other:"days"},invitation:{one:"invitation",other:"invitations"},selectedCountOf:"{{selected}} of {{total}}",sendCount:"Send {{count}} {{label}}",loadMore:"Load more",loading:"Loading…",showingOf:"Showing {{shown}} of {{total}}",actionFailed:"Couldn't complete that. Try again."},shell:{triggerLabel:"Manage business units",modalTitle:"Business units",modalDescription:"Manage business units, their members, and roles.",tabBusinessUnits:"Business Units",tabRoles:"Roles"},switcher:{triggerCurrentLabel:"Current business unit",triggerSelectLabel:"Select business unit",triggerEmptyLabel:"Create business unit",triggerLoadingLabel:"Loading…",triggerErrorLabel:"Couldn't load",switcherHeader:"Business units",pendingInvitationsHeader:"Pending invitations",invitedTitle:"You've been invited",pendingCount:{one:"{{count}} pending invitation",other:"{{count}} pending invitations"},searchPlaceholder:"Search business units…",noMatches:"No business units match",manageCta:"Manage units",currentBadge:"Current",emptyTitle:"No business units yet",emptyCta:"Create business unit",errorTitle:"Couldn't load business units",errorRetry:"Retry"},businessUnits:{emptyTitle:"No business units yet",emptyDescription:"Business units organize your members and roles. Create one to get started.",emptyCta:"Create business unit",listSearchPlaceholder:"Search business units…",newButton:"New",errorTitle:"Couldn't load your business units",errorDescription:"Check your connection and try again.",createFormName:"Name",createNamePlaceholder:"Acme Corp",createSubmit:"Create business unit",createNameTaken:"A business unit with this name already exists. Choose a different name.",detailMemberCount:{one:"{{count}} member",other:"{{count}} members"},detailTabMembers:"Members",detailTabInvitations:"Invitations",detailTabSettings:"Settings",settingsName:"Name",settingsIdentifier:"Identifier",settingsIdentifierHelp:"A unique, lowercase identifier for this business unit. Auto-generated from the name.",settingsMemberLimit:"Member limit",settingsMemberLimitHelp:"Leave empty for no limit.",memberLimitInvalid:"Member limit must be a positive whole number.",settingsJoinCode:"Join code",settingsJoinCodeHelp:"Anyone with this code can join this business unit."},members:{emptyTitle:"No members yet",emptyDescription:"Invite people to this business unit to get started.",searchPlaceholder:"Search members…",suspend:"Suspend",reinstate:"Reinstate",suspendToast:"{{name}} suspended",reinstateToast:"{{name}} reinstated",undo:"Undo",removeTitle:"Remove {{name}}?",removeDescription:"They will lose access immediately. You can invite them again later.",removeConfirm:"Remove",removeToast:"{{name}} removed",perBuSearchPlaceholder:"Search members…",crossBuSearchPlaceholder:"Search members or business units…",pendingInvitationsHeader:"Pending invitations",invitedToJoin:"You've been invited to join.",invitedAs:"Invited as {{role}}",expiresInDays:{one:"Expires in {{count}} day.",other:"Expires in {{count}} days."},expiresToday:"Expires today",accept:"Accept",decline:"Decline",joined:"Joined {{businessUnit}}",declined:"Declined invitation to {{businessUnit}}",couldNotLoad:"Couldn't load members",partialLoadWarning:"Couldn't load members from some business units. The list below may be incomplete."},roles:{emptyTitle:"No roles yet",emptyDescription:"Roles bundle permissions so members can do specific things in this business unit.",emptyCta:"Create role",newButton:"New role",buSelectorLabel:"Business unit:",noBusinessUnits:"No business units",noAccessTitle:"You don't have access to roles",noAccessDescription:"Managing roles is available to business unit owners and admins.",couldNotLoad:"Couldn't load roles",couldNotLoadDescription:"Check your connection and try again.",notFound:"This role no longer exists.",rowAllPermissions:"All permissions",rowPermissionsCount:{one:"{{count}} permission",other:"{{count}} permissions"},systemBadge:"System",systemBannerNote:"System roles are managed by Road and can't be edited or deleted. Clone this role if you want a customized version.",editorName:"Name",editorDescription:"Description",editorDescriptionPlaceholder:"Short, helpful summary of what this role can do.",permissionsHeader:"Permissions",deleteRole:"Delete role",deleteTitle:'Delete role "{{name}}"?',deleteDescription:"Members currently assigned to this role will lose its permissions. This can't be undone.",deleteConfirm:"Delete role",deleteToast:'Role "{{name}}" deleted',savedToast:'"{{name}}" saved',allPermissionsBadge:"All permissions",allPermissionsDescription:"This role has full access to every action in this business unit.",create:{title:"Create role",descChoose:"Start blank or duplicate an existing role's permissions.",descBlank:"Name the role and choose its permissions.",descClonePick:"Pick which role to clone.",descCloneName:"Name the role and review its permissions.",blankTitle:"Start blank",blankDescription:"Build a role from scratch and pick the exact permissions.",cloneTitle:"Clone from existing",cloneDescriptionAvailable:"Duplicate an existing role and tweak its permissions.",cloneDescriptionUnavailable:"No roles yet to clone from. Create one blank first.",pickSourcePrompt:"Pick a role to clone:",cloningFromBanner:"Cloning from {{role}} — its {{permissions}} will be copied over (you can adjust them after).",nameField:"Name",namePlaceholder:"e.g. Editor",descriptionField:"Description (optional)",descriptionPlaceholder:"Short, helpful summary of what this role can do.",permissionsHint:"Select at least one permission for this role.",permissionsError:"Couldn't load permissions.",submit:"Create role",createdToast:'Role "{{name}}" created'}},invitations:{emptyTitle:"No invitations yet",emptyDescription:"Invite people by email and assign them a role.",inviteButton:"Invite people",formEmailsField:"Email{{plural}}",formEmailsPlaceholder:"alex@example.com, sam@example.com",formEmailsHelp:"Comma- or space-separated for multiple invitations.",formEmailsValidCount:"{{count}} valid.",formEmailsInvalidCount:"{{count}} invalid: {{examples}}",formRoleField:"Role",formRolePlaceholder:"Pick a role",formSubmitSingle:"Send invitation",formSubmitMany:"Send {{count}} invitations",sentToast:"Sent {{count}} invitations",sentSingleToast:"Invitation sent",sentPartialToast:"Sent {{succeeded}} of {{total}}. Some failed.",sentErrorToast:"Couldn't send invitations",resend:"Resend",cancel:"Cancel",resendToast:"Invitation resent to {{email}}",cancelToast:"Invitation to {{email}} cancelled",cancelTitle:"Cancel invitation to {{email}}?",cancelDescription:"The invite link will no longer work. You can send a fresh invitation any time.",cancelConfirm:"Cancel invitation",cancelKeep:"Keep invitation",couldNotLoad:"Couldn't load invitations",statusPending:"pending",statusAccepted:"accepted",statusExpired:"expired",statusCancelled:"cancelled",statusRejected:"rejected",invitedRelative:"invited {{relative}}",expiresRelative:"expires {{relative}}"},validation:{required:"This field is required.",tooLong:"Use at most {{max}} characters.",slugFormat:"Use only lowercase letters, numbers, and hyphens (e.g. acme-corp).",emailInvalid:"Enter a valid email address.",urlInvalid:"Enter a valid URL (starting with https://).",atLeastOne:"Select at least one option.",generic:"Check this field.",formSummary:"Please review the highlighted fields."}},sv={common:{cancel:"Cancelar",save:"Salvar",saveChanges:"Salvar alterações",discard:"Descartar",delete:"Excluir",remove:"Remover",edit:"Editar",create:"Criar",search:"Buscar",refresh:"Atualizar",back:"Voltar",close:"Fechar",submit:"Enviar",tryAgain:"Tentar novamente",noMatches:"Nenhum resultado",noMatchesQuery:'Nenhum resultado para "{{query}}".',yes:"Sim",no:"Não",you:"Você",system:"Sistema",suspended:"Suspenso",member:{one:"membro",other:"membros"},permission:{one:"permissão",other:"permissões"},day:{one:"dia",other:"dias"},invitation:{one:"convite",other:"convites"},selectedCountOf:"{{selected}} de {{total}}",sendCount:"Enviar {{count}} {{label}}",loadMore:"Carregar mais",loading:"Carregando…",showingOf:"Mostrando {{shown}} de {{total}}",actionFailed:"Não foi possível concluir. Tente novamente."},shell:{triggerLabel:"Gerenciar unidades de negócio",modalTitle:"Unidades de negócio",modalDescription:"Gerencie unidades de negócio, seus membros e funções.",tabBusinessUnits:"Unidades",tabRoles:"Funções"},switcher:{triggerCurrentLabel:"Unidade de negócio atual",triggerSelectLabel:"Selecionar unidade",triggerEmptyLabel:"Criar unidade",triggerLoadingLabel:"Carregando…",triggerErrorLabel:"Não foi possível carregar",switcherHeader:"Unidades de negócio",pendingInvitationsHeader:"Convites pendentes",invitedTitle:"Você foi convidado",pendingCount:{one:"{{count}} convite pendente",other:"{{count}} convites pendentes"},searchPlaceholder:"Buscar unidades…",noMatches:"Nenhuma unidade encontrada",manageCta:"Gerenciar unidades",currentBadge:"Atual",emptyTitle:"Nenhuma unidade ainda",emptyCta:"Criar unidade",errorTitle:"Não foi possível carregar unidades",errorRetry:"Tentar novamente"},businessUnits:{emptyTitle:"Nenhuma unidade ainda",emptyDescription:"Unidades de negócio organizam seus membros e funções. Crie uma para começar.",emptyCta:"Criar unidade",listSearchPlaceholder:"Buscar unidades…",newButton:"Nova",errorTitle:"Não foi possível carregar suas unidades",errorDescription:"Verifique sua conexão e tente novamente.",createFormName:"Nome",createNamePlaceholder:"Acme Corp",createSubmit:"Criar unidade",createNameTaken:"Já existe uma unidade de negócio com esse nome. Escolha outro.",detailMemberCount:{one:"{{count}} membro",other:"{{count}} membros"},detailTabMembers:"Membros",detailTabInvitations:"Convites",detailTabSettings:"Configurações",settingsName:"Nome",settingsIdentifier:"Identificador",settingsIdentifierHelp:"Identificador único em minúsculas para esta unidade. Gerado automaticamente a partir do nome.",settingsMemberLimit:"Limite de membros",settingsMemberLimitHelp:"Deixe vazio para não ter limite.",memberLimitInvalid:"O limite de membros deve ser um número inteiro positivo.",settingsJoinCode:"Código de entrada",settingsJoinCodeHelp:"Qualquer pessoa com este código pode entrar nesta unidade."},members:{emptyTitle:"Nenhum membro ainda",emptyDescription:"Convide pessoas para esta unidade para começar.",searchPlaceholder:"Buscar membros…",suspend:"Suspender",reinstate:"Reativar",suspendToast:"{{name}} suspenso",reinstateToast:"{{name}} reativado",undo:"Desfazer",removeTitle:"Remover {{name}}?",removeDescription:"A pessoa perderá o acesso imediatamente. Você pode convidá-la novamente mais tarde.",removeConfirm:"Remover",removeToast:"{{name}} removido",perBuSearchPlaceholder:"Buscar membros…",crossBuSearchPlaceholder:"Buscar membros ou unidades…",pendingInvitationsHeader:"Convites pendentes",invitedToJoin:"Você foi convidado para participar.",invitedAs:"Convidado como {{role}}",expiresInDays:{one:"Expira em {{count}} dia.",other:"Expira em {{count}} dias."},expiresToday:"Expira hoje",accept:"Aceitar",decline:"Recusar",joined:"Você entrou em {{businessUnit}}",declined:"Convite para {{businessUnit}} recusado",couldNotLoad:"Não foi possível carregar os membros",partialLoadWarning:"Não foi possível carregar membros de algumas unidades de negócio. A lista abaixo pode estar incompleta."},roles:{emptyTitle:"Nenhuma função ainda",emptyDescription:"Funções agrupam permissões para que os membros possam realizar ações específicas nesta unidade.",emptyCta:"Criar função",newButton:"Nova função",buSelectorLabel:"Unidade:",noBusinessUnits:"Nenhuma unidade",noAccessTitle:"Você não tem acesso às funções",noAccessDescription:"A gestão de funções é disponível para proprietários e admins da unidade.",couldNotLoad:"Não foi possível carregar as funções",couldNotLoadDescription:"Verifique sua conexão e tente novamente.",notFound:"Esta função não existe mais.",rowAllPermissions:"Todas as permissões",rowPermissionsCount:{one:"{{count}} permissão",other:"{{count}} permissões"},systemBadge:"Sistema",systemBannerNote:"Funções de sistema são gerenciadas pela Road e não podem ser editadas ou excluídas. Clone esta função se quiser uma versão personalizada.",editorName:"Nome",editorDescription:"Descrição",editorDescriptionPlaceholder:"Resumo curto do que esta função pode fazer.",permissionsHeader:"Permissões",deleteRole:"Excluir função",deleteTitle:'Excluir a função "{{name}}"?',deleteDescription:"Membros atualmente atribuídos a esta função perderão suas permissões. Esta ação não pode ser desfeita.",deleteConfirm:"Excluir função",deleteToast:'Função "{{name}}" excluída',savedToast:'"{{name}}" salva',allPermissionsBadge:"Todas as permissões",allPermissionsDescription:"Esta função tem acesso total a todas as ações desta unidade.",create:{title:"Criar função",descChoose:"Comece em branco ou duplique as permissões de uma função existente.",descBlank:"Dê um nome à função e escolha suas permissões.",descClonePick:"Escolha qual função clonar.",descCloneName:"Dê um nome à função e revise suas permissões.",blankTitle:"Começar em branco",blankDescription:"Crie uma função do zero escolhendo as permissões exatas.",cloneTitle:"Clonar de existente",cloneDescriptionAvailable:"Duplique uma função existente e ajuste suas permissões.",cloneDescriptionUnavailable:"Nenhuma função para clonar ainda. Crie uma em branco primeiro.",pickSourcePrompt:"Escolha uma função para clonar:",cloningFromBanner:"Clonando de {{role}} — suas {{permissions}} serão copiadas (você pode ajustá-las depois).",nameField:"Nome",namePlaceholder:"ex: Editor",descriptionField:"Descrição (opcional)",descriptionPlaceholder:"Resumo curto do que esta função pode fazer.",permissionsHint:"Selecione ao menos uma permissão para esta função.",permissionsError:"Não foi possível carregar as permissões.",submit:"Criar função",createdToast:'Função "{{name}}" criada'}},invitations:{emptyTitle:"Nenhum convite ainda",emptyDescription:"Convide pessoas por e-mail e atribua uma função.",inviteButton:"Convidar pessoas",formEmailsField:"E-mail{{plural}}",formEmailsPlaceholder:"alex@exemplo.com, sam@exemplo.com",formEmailsHelp:"Separe por vírgula ou espaço para múltiplos convites.",formEmailsValidCount:"{{count}} válido(s).",formEmailsInvalidCount:"{{count}} inválido(s): {{examples}}",formRoleField:"Função",formRolePlaceholder:"Escolha uma função",formSubmitSingle:"Enviar convite",formSubmitMany:"Enviar {{count}} convites",sentToast:"{{count}} convites enviados",sentSingleToast:"Convite enviado",sentPartialToast:"{{succeeded}} de {{total}} enviados. Alguns falharam.",sentErrorToast:"Não foi possível enviar os convites",resend:"Reenviar",cancel:"Cancelar",resendToast:"Convite reenviado para {{email}}",cancelToast:"Convite para {{email}} cancelado",cancelTitle:"Cancelar convite para {{email}}?",cancelDescription:"O link do convite não funcionará mais. Você pode enviar um novo convite a qualquer momento.",cancelConfirm:"Cancelar convite",cancelKeep:"Manter convite",couldNotLoad:"Não foi possível carregar os convites",statusPending:"pendente",statusAccepted:"aceito",statusExpired:"expirado",statusCancelled:"cancelado",statusRejected:"recusado",invitedRelative:"convidado {{relative}}",expiresRelative:"expira {{relative}}"},validation:{required:"Campo obrigatório.",tooLong:"Use no máximo {{max}} caracteres.",slugFormat:"Use apenas letras minúsculas, números e hifens (ex.: acme-corp).",emailInvalid:"Informe um e-mail válido.",urlInvalid:"Informe uma URL válida (começando com https://).",atLeastOne:"Selecione pelo menos uma opção.",generic:"Verifique este campo.",formSummary:"Revise os campos destacados."}},Ri={en:rv,"pt-BR":sv};function ov(e){return typeof e=="object"&&e!==null&&"one"in e&&"other"in e&&typeof e.one=="string"&&typeof e.other=="string"}function Xc(e,t){if(!t)return e;if(typeof e!="object"||e===null||ov(e))return t??e;const n={...e};for(const r of Object.keys(t)){const s=t[r];s!==void 0&&(n[r]=Xc(e[r],s))}return n}function Jc(e,t){return t?e.replace(/\{\{(\w+)\}\}/g,(n,r)=>{const s=t[r];return s===void 0?"":String(s)}):e}function iv(e,t,n){const r=t===1?e.one:e.other;return Jc(r,{count:t,...n})}function av(e,t){const n=new Date(e).getTime()-Date.now(),r=Math.round(n/864e5);try{return new Intl.RelativeTimeFormat(t,{numeric:"auto"}).format(r,"day")}catch{return new Intl.RelativeTimeFormat("en",{numeric:"auto"}).format(r,"day")}}function le(){const{locale:e,localization:t}=te();return x.useMemo(()=>{const n=Ri[e]??Ri.en;return{dict:Xc(n,t),locale:e,format:Jc,plural:iv,relative:s=>av(s,e)}},[e,t])}const ze=x.forwardRef(({className:e,...t},n)=>i.jsx("input",{ref:n,className:z("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1","disabled:cursor-not-allowed disabled:opacity-50","transition-colors",e),...t}));ze.displayName="Input";function de({className:e,...t}){return i.jsx("div",{className:z("animate-pulse rounded-md bg-muted",e),...t})}function Me({icon:e,title:t,description:n,action:r,className:s}){return i.jsxs("div",{className:z("flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border bg-card/50 px-6 py-12 text-center",s),children:[e&&i.jsx("div",{className:"rounded-full bg-muted p-3 text-muted-foreground","aria-hidden":!0,children:e}),i.jsxs("div",{className:"max-w-sm",children:[i.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t}),n&&i.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:n})]}),r&&i.jsx("div",{className:"mt-2",children:r})]})}const Ei=["from-rose-400 to-orange-400","from-amber-400 to-yellow-400","from-emerald-400 to-cyan-400","from-sky-400 to-indigo-400","from-violet-400 to-fuchsia-400","from-pink-400 to-rose-400"];function cv(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)}function lv(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}const dv={sm:"h-7 w-7 text-[10px]",md:"h-9 w-9 text-xs",lg:"h-12 w-12 text-sm"};function Et({name:e,size:t="md",className:n}){const r=Ei[cv(e)%Ei.length];return i.jsx("div",{"aria-hidden":!0,className:z("flex items-center justify-center rounded-full bg-gradient-to-br text-white font-semibold shrink-0",r,dv[t],n),children:lv(e)})}const uv=za("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium transition-colors",{variants:{variant:{default:"border-transparent bg-secondary text-secondary-foreground",outline:"border-border text-foreground",success:"border-transparent bg-emerald-100 text-emerald-900 dark:bg-emerald-950 dark:text-emerald-100",warning:"border-transparent bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-100",danger:"border-transparent bg-rose-100 text-rose-900 dark:bg-rose-950 dark:text-rose-100",muted:"border-transparent bg-muted text-muted-foreground"}},defaultVariants:{variant:"default"}});function _e({className:e,variant:t,...n}){return i.jsx("span",{className:z(uv({variant:t}),e),...n})}function fv({membership:e,onSelect:t}){const{businessUnit:n,roles:r}=e,s=r[0]?.name;return i.jsxs("button",{type:"button",onClick:()=>t(n.id),className:z("group flex w-full items-center gap-3 rounded-lg border border-border bg-card px-3 py-3 text-left","transition-all hover:border-foreground/20 hover:bg-accent/50","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1"),children:[i.jsx(Et,{name:n.name,size:"md"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n.name}),s&&i.jsx(_e,{variant:"muted",className:"shrink-0",children:s})]}),i.jsx("div",{className:"mt-0.5 flex items-center gap-1 text-xs text-muted-foreground",children:i.jsx("span",{className:"font-mono truncate",children:n.slug})})]}),i.jsx(jc,{className:"h-4 w-4 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5 group-hover:text-muted-foreground","aria-hidden":!0}),i.jsx(xn,{className:"sr-only"})]})}const It=x.forwardRef(({className:e,...t},n)=>i.jsx("label",{ref:n,className:z("text-sm font-medium leading-none text-foreground",e),...t}));It.displayName="Label";function nn({id:e,label:t,error:n,hint:r,required:s,children:o,className:a}){const c=`${e}-error`,l=`${e}-hint`,f=n?c:r?l:void 0;let u=o;if(x.isValidElement(o)){const d=o.props,p=[d["aria-describedby"],f].filter(Boolean).join(" ");u=x.cloneElement(o,{id:e,"aria-invalid":n?!0:void 0,"aria-describedby":p||void 0,className:z(d.className,n&&"border-destructive focus-visible:ring-destructive")})}return i.jsxs("div",{className:z("space-y-1.5",a),children:[i.jsxs(It,{htmlFor:e,children:[t,s?i.jsx("span",{"aria-hidden":!0,className:"ml-0.5 text-destructive",children:"*"}):null]}),u,n?i.jsx("p",{id:c,role:"alert",className:"text-sm text-destructive",children:n}):r?i.jsx("p",{id:l,className:"text-sm text-muted-foreground",children:r}):null]})}function ji(e){typeof window>"u"||e.length===0||typeof window.requestAnimationFrame=="function"&&window.requestAnimationFrame(()=>{for(const t of e){const n=document.getElementById(t);if(n){n.focus();return}}})}function Rr(e){const[t,n]=x.useState({}),[r,s]=x.useState(null),{generic:o,formSummary:a}=e,c=x.useCallback(d=>{const p=Object.keys(d);return n(d),s(null),ji(p),p.length>0},[]),l=x.useCallback((d,p,g)=>{if(!(d instanceof Fs))return!1;const v=d.fieldErrors;if(Object.keys(v).length===0)return!1;console.debug("[road] field validation",v);const h=new Set;let b=!1;for(const w of Object.keys(v)){const C=g?.[w]??w;p.includes(C)?h.add(C):b=!0}const y={};for(const w of p)h.has(w)&&(y[w]=o);return n(y),s(Object.keys(y).length===0||b?a:null),ji(Object.keys(y)),!0},[o,a]),f=x.useCallback(d=>{n(p=>{if(!(d in p))return p;const g={...p};return delete g[d],g}),s(null)},[]),u=x.useCallback(()=>{n({}),s(null)},[]);return{errors:t,formError:r,failClient:c,applyServer:l,clear:f,reset:u}}const Pi=120;function Ti({onCancel:e,onCreated:t}){const[n,r]=x.useState(""),s=x.useRef(null),o=le(),a=Lf(),c=Rr({generic:o.dict.validation.generic,formSummary:o.dict.validation.formSummary});x.useEffect(()=>{s.current?.focus()},[]);const l=async()=>{const f={},u=n.trim();if(u?u.length>Pi&&(f["bu-name"]=o.format(o.dict.validation.tooLong,{max:Pi})):f["bu-name"]=o.dict.validation.required,!c.failClient(f))try{const d=await a.mutateAsync({name:u});t(d.id)}catch(d){if(c.applyServer(d,["bu-name"],{name:"bu-name"}))return;if(d instanceof Ls){c.failClient({"bu-name":o.dict.businessUnits.createNameTaken});return}ie.error(o.dict.common.actionFailed)}};return i.jsxs("form",{onSubmit:f=>{f.preventDefault(),l()},className:"rounded-lg border border-border bg-card p-4 animate-in fade-in-0 slide-in-from-top-2 duration-200",children:[c.formError&&i.jsx("p",{role:"alert",className:"mb-3 text-sm text-destructive",children:c.formError}),i.jsx(nn,{id:"bu-name",label:o.dict.businessUnits.createFormName,error:c.errors["bu-name"],children:i.jsx(ze,{ref:s,value:n,onChange:f=>{r(f.target.value),c.clear("bu-name")},placeholder:o.dict.businessUnits.createNamePlaceholder,disabled:a.isPending})}),i.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[i.jsx(W,{type:"button",variant:"ghost",onClick:e,disabled:a.isPending,children:o.dict.common.cancel}),i.jsxs(W,{type:"submit",disabled:a.isPending,children:[a.isPending&&i.jsx(Ve,{className:"h-3.5 w-3.5 animate-spin"}),o.dict.businessUnits.createSubmit]})]})]})}function Mi({invitations:e}){const t=le();return e.length===0?null:i.jsxs("section",{"aria-label":t.dict.members.pendingInvitationsHeader,className:"rounded-lg border border-primary/20 bg-primary/[0.04] p-3 animate-in fade-in-0 slide-in-from-top-1 duration-200",children:[i.jsxs("div",{className:"mb-2 flex items-center gap-2 px-0.5",children:[i.jsx(wr,{className:"h-3.5 w-3.5 text-primary","aria-hidden":!0}),i.jsx("span",{className:"text-sm font-medium",children:t.dict.members.pendingInvitationsHeader}),i.jsx("span",{className:"flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold leading-none text-primary-foreground",children:e.length})]}),i.jsx("ul",{role:"list",className:"space-y-2",children:e.map(n=>i.jsx("li",{children:i.jsx(mv,{invitation:n})},n.id))})]})}function mv({invitation:e}){const t=le(),n=ha(),r=pa(),s=n.isPending||r.isPending,o=hv(e.expiresAt,t),a=async()=>{try{await n.mutateAsync(e.id),ie.success(t.format(t.dict.members.joined,{businessUnit:e.businessUnit.name}))}catch{ie.error(t.dict.common.actionFailed)}},c=async()=>{try{await r.mutateAsync(e.id),ie.message(t.format(t.dict.members.declined,{businessUnit:e.businessUnit.name}))}catch{ie.error(t.dict.common.actionFailed)}};return i.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border bg-card p-2.5",children:[i.jsx(Et,{name:e.businessUnit.name,size:"md"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-sm font-medium",children:e.businessUnit.name}),i.jsxs("div",{className:"flex items-center gap-1.5 truncate text-xs text-muted-foreground",children:[i.jsx("span",{className:"truncate",children:t.format(t.dict.members.invitedAs,{role:e.roleName})}),o&&i.jsxs(i.Fragment,{children:[i.jsx("span",{"aria-hidden":!0,children:"·"}),i.jsx("span",{className:o.soon?"text-amber-600 dark:text-amber-500":void 0,children:o.label})]})]})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[i.jsxs(W,{variant:"ghost",size:"sm",onClick:c,disabled:s,children:[r.isPending&&i.jsx(Ve,{className:"h-3.5 w-3.5 animate-spin"}),t.dict.members.decline]}),i.jsxs(W,{size:"sm",onClick:a,disabled:s,children:[n.isPending?i.jsx(Ve,{className:"h-3.5 w-3.5 animate-spin"}):i.jsx(cn,{className:"h-3.5 w-3.5"}),t.dict.members.accept]})]})]})}function hv(e,t){return x.useMemo(()=>{const n=new Date(e).getTime()-Date.now();if(Number.isNaN(n))return null;const r=Math.ceil(n/864e5);return r<=0?{label:t.dict.members.expiresToday,soon:!0}:{label:t.plural(t.dict.members.expiresInDays,r),soon:r<=2}},[e,t])}function pv({onSelect:e}){const[t,n]=x.useState(!1),[r,s]=x.useState(""),{data:o,isPending:a,isError:c,refetch:l,isRefetching:f}=an(),u=le(),d=x.useMemo(()=>{if(!o)return[];const h=r.trim().toLowerCase();return h?o.memberships.filter(b=>b.businessUnit.name.toLowerCase().includes(h)||b.businessUnit.slug.toLowerCase().includes(h)):o.memberships},[o,r]);if(a)return i.jsxs("div",{className:"space-y-3","aria-busy":!0,children:[i.jsx(de,{className:"h-9 w-full max-w-xs"}),i.jsx("div",{className:"space-y-2",children:[0,1,2].map(h=>i.jsx(de,{className:"h-16 w-full"},h))})]});if(c)return i.jsx(Me,{icon:i.jsx(pt,{className:"h-5 w-5"}),title:u.dict.businessUnits.errorTitle,description:u.dict.businessUnits.errorDescription,action:i.jsxs(W,{variant:"outline",onClick:()=>{l()},children:[i.jsx(pt,{className:"h-3.5 w-3.5"})," ",u.dict.common.tryAgain]})});const p=o.memberships,g=o.pendingInvitations,v=p.length>=5;return p.length===0?t?i.jsx(Ti,{onCancel:()=>n(!1),onCreated:h=>{n(!1),e(h)}}):g.length>0?i.jsxs("div",{className:"space-y-4",children:[i.jsx(Mi,{invitations:g}),i.jsx("div",{className:"flex justify-center",children:i.jsxs(W,{variant:"ghost",size:"sm",onClick:()=>n(!0),children:[i.jsx(ot,{className:"h-3.5 w-3.5"})," ",u.dict.businessUnits.emptyCta]})})]}):i.jsx(Me,{icon:i.jsx(Ec,{className:"h-5 w-5"}),title:u.dict.businessUnits.emptyTitle,description:u.dict.businessUnits.emptyDescription,action:i.jsxs(W,{onClick:()=>n(!0),children:[i.jsx(ot,{className:"h-3.5 w-3.5"})," ",u.dict.businessUnits.emptyCta]})}):i.jsxs("div",{className:"space-y-3",children:[g.length>0&&i.jsx(Mi,{invitations:g}),i.jsxs("div",{className:"flex items-center gap-2",children:[v?i.jsxs("div",{className:"relative flex-1",children:[i.jsx(sr,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),i.jsx(ze,{value:r,onChange:h=>s(h.target.value),placeholder:u.dict.businessUnits.listSearchPlaceholder,className:"pl-9"})]}):i.jsx("div",{className:"flex-1"}),i.jsxs(W,{variant:"outline",size:"sm",onClick:()=>{l()},disabled:f,children:[i.jsx(pt,{className:f?"h-3.5 w-3.5 animate-spin":"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only",children:u.dict.common.refresh})]}),i.jsxs(W,{size:"sm",onClick:()=>n(!0),disabled:t,children:[i.jsx(ot,{className:"h-3.5 w-3.5"})," ",u.dict.businessUnits.newButton]})]}),t&&i.jsx(Ti,{onCancel:()=>n(!1),onCreated:h=>{n(!1),e(h)}}),d.length===0?i.jsx(Me,{icon:i.jsx(sr,{className:"h-5 w-5"}),title:u.dict.common.noMatches,description:u.format(u.dict.common.noMatchesQuery,{query:r})}):i.jsx("ul",{className:"space-y-2",role:"list",children:d.map(h=>i.jsx("li",{children:i.jsx(fv,{membership:h,onSelect:e})},h.businessUnit.id))})]})}var gv=Symbol("radix.slottable");function vv(e){const t=({children:n})=>i.jsx(i.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=gv,t}var Zc="AlertDialog",[bv]=Ke(Zc,[nc]),lt=nc(),el=e=>{const{__scopeAlertDialog:t,...n}=e,r=lt(t);return i.jsx(bc,{...r,...n,modal:!0})};el.displayName=Zc;var yv="AlertDialogTrigger",tl=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=lt(n);return i.jsx(yc,{...s,...r,ref:t})});tl.displayName=yv;var xv="AlertDialogPortal",nl=e=>{const{__scopeAlertDialog:t,...n}=e,r=lt(t);return i.jsx(xc,{...r,...n})};nl.displayName=xv;var wv="AlertDialogOverlay",rl=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=lt(n);return i.jsx(wc,{...s,...r,ref:t})});rl.displayName=wv;var Zt="AlertDialogContent",[Cv,Sv]=bv(Zt),Nv=vv("AlertDialogContent"),sl=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,o=lt(n),a=m.useRef(null),c=se(t,a),l=m.useRef(null);return i.jsx(Gp,{contentName:Zt,titleName:ol,docsSlug:"alert-dialog",children:i.jsx(Cv,{scope:n,cancelRef:l,children:i.jsxs(Cc,{role:"alertdialog",...o,...s,ref:c,onOpenAutoFocus:I(s.onOpenAutoFocus,f=>{f.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[i.jsx(Nv,{children:r}),i.jsx(Ev,{contentRef:a})]})})})});sl.displayName=Zt;var ol="AlertDialogTitle",il=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=lt(n);return i.jsx(Sc,{...s,...r,ref:t})});il.displayName=ol;var al="AlertDialogDescription",cl=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=lt(n);return i.jsx(Nc,{...s,...r,ref:t})});cl.displayName=al;var Rv="AlertDialogAction",ll=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=lt(n);return i.jsx(Gs,{...s,...r,ref:t})});ll.displayName=Rv;var dl="AlertDialogCancel",ul=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=Sv(dl,n),o=lt(n),a=se(t,s);return i.jsx(Gs,{...o,...r,ref:a})});ul.displayName=dl;var Ev=({contentRef:e})=>{const t=`\`${Zt}\` requires a description for the component to be accessible for screen reader users.
50
+
51
+ You can add a description to the \`${Zt}\` by passing a \`${al}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
52
+
53
+ Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Zt}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
54
+
55
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return m.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},jv=el,Pv=tl,Tv=nl,Mv=rl,Av=sl,kv=ll,Iv=ul,Dv=il,Ov=cl;const ro=jv,so=Pv,Er=x.forwardRef(({className:e,children:t,...n},r)=>{const{appearance:s}=te(),o=Nt(s?.colorScheme),a=St(s);return i.jsx(Tv,{children:i.jsxs("div",{className:z("road-ui",o==="dark"&&"dark"),style:a,children:[i.jsx(Mv,{className:z("fixed inset-0 z-[60] bg-black/50","data-[state=open]:animate-in data-[state=open]:fade-in-0","data-[state=closed]:animate-out data-[state=closed]:fade-out-0")}),i.jsx(Av,{ref:r,className:z("fixed left-[50%] top-[50%] z-[60] grid w-full max-w-md translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-background p-6 shadow-lg rounded-lg","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...n,children:t})]})})});Er.displayName="AlertDialogContent";const jr=x.forwardRef(({className:e,...t},n)=>i.jsx(Dv,{ref:n,className:z("text-base font-semibold text-foreground",e),...t}));jr.displayName="AlertDialogTitle";const Pr=x.forwardRef(({className:e,...t},n)=>i.jsx(Ov,{ref:n,className:z("text-sm text-muted-foreground",e),...t}));Pr.displayName="AlertDialogDescription";const oo=kv,io=Iv;function ao({shown:e,total:t,hasNextPage:n,isFetchingNextPage:r,onLoadMore:s}){const o=le();return t===0?null:i.jsxs("div",{className:"flex items-center justify-between gap-3 pt-1 text-xs text-muted-foreground",children:[i.jsx("span",{children:o.format(o.dict.common.showingOf,{shown:e,total:t})}),n&&i.jsx(W,{variant:"outline",size:"sm",onClick:s,disabled:r,children:r?i.jsxs(i.Fragment,{children:[i.jsx(Ve,{className:"h-3.5 w-3.5 animate-spin"})," ",o.dict.common.loading]}):o.dict.common.loadMore})]})}function _v({buId:e}){const[t,n]=x.useState(""),{data:r,isPending:s,isError:o,hasNextPage:a,isFetchingNextPage:c,fetchNextPage:l}=fa(e),f=le(),u=x.useMemo(()=>r?r.pages.flatMap(g=>g.data):[],[r]),d=r?.pages[0]?.pagination.totalCount??0,p=x.useMemo(()=>{const g=t.trim().toLowerCase();return g?u.filter(v=>v.name.toLowerCase().includes(g)||v.email.toLowerCase().includes(g)):u},[u,t]);return s?i.jsx("div",{className:"space-y-2",children:[0,1,2,3].map(g=>i.jsx(de,{className:"h-14 w-full"},g))}):o?i.jsx(Me,{icon:i.jsx(xn,{className:"h-5 w-5"}),title:f.dict.members.couldNotLoad,description:f.dict.businessUnits.errorDescription}):d===0?i.jsx(Me,{icon:i.jsx(xn,{className:"h-5 w-5"}),title:f.dict.members.emptyTitle,description:f.dict.members.emptyDescription}):i.jsxs("div",{className:"space-y-3",children:[u.length>=5&&i.jsxs("div",{className:"relative",children:[i.jsx(sr,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),i.jsx(ze,{value:t,onChange:g=>n(g.target.value),placeholder:f.dict.members.perBuSearchPlaceholder,className:"pl-9"})]}),p.length===0?i.jsx(Me,{icon:i.jsx(sr,{className:"h-5 w-5"}),title:f.dict.common.noMatches,description:f.format(f.dict.common.noMatchesQuery,{query:t})}):i.jsx("ul",{className:"divide-y divide-border rounded-lg border border-border bg-card",role:"list",children:p.map(g=>i.jsx("li",{children:i.jsx(Lv,{member:g,buId:e})},g.id))}),i.jsx(ao,{shown:u.length,total:d,hasNextPage:a,isFetchingNextPage:c,onLoadMore:()=>{l()}})]})}function Lv({member:e,buId:t}){const n=Bf(t),r=Uf(t),s=$f(t),o=le(),c=Ct(t)("manage:Member"),l=e.status==="suspended",f=async()=>{try{l?(await r.mutateAsync(e.id),ie.success(o.format(o.dict.members.reinstateToast,{name:e.name}))):(await n.mutateAsync(e.id),ie.message(o.format(o.dict.members.suspendToast,{name:e.name}),{action:{label:o.dict.members.undo,onClick:()=>{r.mutateAsync(e.id)}}}))}catch{ie.error(o.dict.businessUnits.errorTitle)}},u=async()=>{try{await s.mutateAsync(e.id),ie.success(o.format(o.dict.members.removeToast,{name:e.name}))}catch{ie.error(o.dict.members.couldNotLoad)}};return i.jsxs("div",{className:"flex items-center gap-3 px-3 py-3",children:[i.jsx(Et,{name:e.name}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.name}),l&&i.jsx(_e,{variant:"warning",className:"shrink-0",children:o.dict.common.suspended})]}),i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:e.email})]}),i.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:e.roles.map(d=>i.jsx(_e,{variant:"muted",children:d.name},d.id))}),c&&i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsxs(W,{variant:"ghost",size:"icon",onClick:f,disabled:n.isPending||r.isPending,title:l?o.dict.members.reinstate:o.dict.members.suspend,children:[l?i.jsx(yg,{className:"h-4 w-4"}):i.jsx(vg,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:l?o.dict.members.reinstate:o.dict.members.suspend})]}),i.jsxs(ro,{children:[i.jsx(so,{asChild:!0,children:i.jsxs(W,{variant:"ghost",size:"icon",title:o.dict.common.remove,children:[i.jsx(Tc,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:o.dict.common.remove})]})}),i.jsxs(Er,{children:[i.jsx(jr,{children:o.format(o.dict.members.removeTitle,{name:e.name})}),i.jsx(Pr,{children:o.dict.members.removeDescription}),i.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[i.jsx(io,{asChild:!0,children:i.jsx(W,{variant:"outline",children:o.dict.common.cancel})}),i.jsx(oo,{asChild:!0,children:i.jsx(W,{variant:"destructive",onClick:u,children:o.dict.members.removeConfirm})})]})]})]})]})]})}function Fv({buId:e}){const{data:t,isPending:n}=ua(e),r=Ff(e),s=le(),a=Ct(e)("manage:BUSettings"),[c,l]=x.useState(""),[f,u]=x.useState(""),[d,p]=x.useState(!1);if(x.useEffect(()=>{t&&(l(t.name),u(t.memberLimit?.toString()??""))},[t]),n)return i.jsxs("div",{className:"space-y-4",children:[i.jsx(de,{className:"h-9 w-full max-w-sm"}),i.jsx(de,{className:"h-9 w-full max-w-sm"}),i.jsx(de,{className:"h-9 w-32"})]});if(!t)return null;const g=c!==t.name||f!==(t.memberLimit?.toString()??""),v=async()=>{let b;if(f==="")b=null;else{const y=Number(f);if(!Number.isInteger(y)||y<=0){ie.error(s.dict.businessUnits.memberLimitInvalid);return}b=y}try{await r.mutateAsync({name:c.trim(),memberLimit:b}),ie.success(s.dict.common.saveChanges)}catch{ie.error(s.dict.common.saveChanges)}},h=async()=>{t.joinCode&&(await navigator.clipboard.writeText(t.joinCode),p(!0),setTimeout(()=>p(!1),1500))};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("section",{className:"space-y-4",children:[i.jsxs("div",{className:"grid gap-1.5",children:[i.jsx(It,{htmlFor:"settings-name",children:s.dict.businessUnits.settingsName}),i.jsx(ze,{id:"settings-name",value:c,onChange:b=>l(b.target.value),className:"max-w-sm",disabled:!a||r.isPending})]}),i.jsxs("div",{className:"grid gap-1.5",children:[i.jsx(It,{htmlFor:"settings-slug",children:s.dict.businessUnits.settingsIdentifier}),i.jsx(ze,{id:"settings-slug",value:t.slug,readOnly:!0,className:"max-w-sm font-mono text-xs"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:s.dict.businessUnits.settingsIdentifierHelp})]}),i.jsxs("div",{className:"grid gap-1.5",children:[i.jsx(It,{htmlFor:"settings-limit",children:s.dict.businessUnits.settingsMemberLimit}),i.jsx(ze,{id:"settings-limit",type:"number",min:1,value:f,onChange:b=>u(b.target.value),className:"max-w-sm",disabled:!a||r.isPending}),i.jsx("p",{className:"text-xs text-muted-foreground",children:s.dict.businessUnits.settingsMemberLimitHelp})]})]}),t.joinCode&&i.jsxs("section",{className:"space-y-2",children:[i.jsx(It,{children:s.dict.businessUnits.settingsJoinCode}),i.jsxs("div",{className:"flex max-w-sm items-center gap-2 rounded-md border border-border bg-muted/50 px-3 py-2",children:[i.jsx("code",{className:"flex-1 font-mono text-sm",children:t.joinCode}),i.jsxs(W,{variant:"ghost",size:"icon",onClick:h,children:[d?i.jsx(cn,{className:"h-4 w-4 text-emerald-600"}):i.jsx(Pc,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:s.dict.businessUnits.settingsJoinCode})]})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:s.dict.businessUnits.settingsJoinCodeHelp})]}),a&&i.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[i.jsx(W,{variant:"ghost",onClick:()=>{l(t.name),u(t.memberLimit?.toString()??"")},disabled:!g||r.isPending,children:s.dict.common.discard}),i.jsxs(W,{onClick:v,disabled:!g||r.isPending,children:[r.isPending&&i.jsx(Ve,{className:"h-3.5 w-3.5 animate-spin"}),s.dict.common.saveChanges]})]})]})}function Ai(e,[t,n]){return Math.min(n,Math.max(t,e))}const Bv=["top","right","bottom","left"],yt=Math.min,Te=Math.max,or=Math.round,Wn=Math.floor,Ze=e=>({x:e,y:e}),Uv={left:"right",right:"left",bottom:"top",top:"bottom"};function vs(e,t,n){return Te(e,yt(t,n))}function it(e,t){return typeof e=="function"?e(t):e}function at(e){return e.split("-")[0]}function ln(e){return e.split("-")[1]}function co(e){return e==="x"?"y":"x"}function lo(e){return e==="y"?"height":"width"}function Je(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function uo(e){return co(Je(e))}function $v(e,t,n){n===void 0&&(n=!1);const r=ln(e),s=uo(e),o=lo(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=ir(a)),[a,ir(a)]}function zv(e){const t=ir(e);return[bs(e),t,bs(t)]}function bs(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ki=["left","right"],Ii=["right","left"],Vv=["top","bottom"],Hv=["bottom","top"];function qv(e,t,n){switch(e){case"top":case"bottom":return n?t?Ii:ki:t?ki:Ii;case"left":case"right":return t?Vv:Hv;default:return[]}}function Wv(e,t,n,r){const s=ln(e);let o=qv(at(e),n==="start",r);return s&&(o=o.map(a=>a+"-"+s),t&&(o=o.concat(o.map(bs)))),o}function ir(e){const t=at(e);return Uv[t]+e.slice(t.length)}function Kv(e){return{top:0,right:0,bottom:0,left:0,...e}}function fl(e){return typeof e!="number"?Kv(e):{top:e,right:e,bottom:e,left:e}}function ar(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function Di(e,t,n){let{reference:r,floating:s}=e;const o=Je(t),a=uo(t),c=lo(a),l=at(t),f=o==="y",u=r.x+r.width/2-s.width/2,d=r.y+r.height/2-s.height/2,p=r[c]/2-s[c]/2;let g;switch(l){case"top":g={x:u,y:r.y-s.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:d};break;case"left":g={x:r.x-s.width,y:d};break;default:g={x:r.x,y:r.y}}switch(ln(t)){case"start":g[a]-=p*(n&&f?-1:1);break;case"end":g[a]+=p*(n&&f?-1:1);break}return g}async function Gv(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:a,elements:c,strategy:l}=e,{boundary:f="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:g=0}=it(t,e),v=fl(g),b=c[p?d==="floating"?"reference":"floating":d],y=ar(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(b)))==null||n?b:b.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:f,rootBoundary:u,strategy:l})),w=d==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),S=await(o.isElement==null?void 0:o.isElement(C))?await(o.getScale==null?void 0:o.getScale(C))||{x:1,y:1}:{x:1,y:1},E=ar(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:w,offsetParent:C,strategy:l}):w);return{top:(y.top-E.top+v.top)/S.y,bottom:(E.bottom-y.bottom+v.bottom)/S.y,left:(y.left-E.left+v.left)/S.x,right:(E.right-y.right+v.right)/S.x}}const Qv=50,Yv=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:a}=n,c=a.detectOverflow?a:{...a,detectOverflow:Gv},l=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:d}=Di(f,r,l),p=r,g=0;const v={};for(let h=0;h<o.length;h++){const b=o[h];if(!b)continue;const{name:y,fn:w}=b,{x:C,y:S,data:E,reset:P}=await w({x:u,y:d,initialPlacement:r,placement:p,strategy:s,middlewareData:v,rects:f,platform:c,elements:{reference:e,floating:t}});u=C??u,d=S??d,v[y]={...v[y],...E},P&&g<Qv&&(g++,typeof P=="object"&&(P.placement&&(p=P.placement),P.rects&&(f=P.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):P.rects),{x:u,y:d}=Di(f,p,l)),h=-1)}return{x:u,y:d,placement:p,strategy:s,middlewareData:v}},Xv=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:a,elements:c,middlewareData:l}=t,{element:f,padding:u=0}=it(e,t)||{};if(f==null)return{};const d=fl(u),p={x:n,y:r},g=uo(s),v=lo(g),h=await a.getDimensions(f),b=g==="y",y=b?"top":"left",w=b?"bottom":"right",C=b?"clientHeight":"clientWidth",S=o.reference[v]+o.reference[g]-p[g]-o.floating[v],E=p[g]-o.reference[g],P=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let R=P?P[C]:0;(!R||!await(a.isElement==null?void 0:a.isElement(P)))&&(R=c.floating[C]||o.floating[v]);const N=S/2-E/2,A=R/2-h[v]/2-1,$=yt(d[y],A),L=yt(d[w],A),B=$,F=R-h[v]-L,q=R/2-h[v]/2+N,K=vs(B,q,F),M=!l.arrow&&ln(s)!=null&&q!==K&&o.reference[v]/2-(q<B?$:L)-h[v]/2<0,U=M?q<B?q-B:q-F:0;return{[g]:p[g]+U,data:{[g]:K,centerOffset:q-K-U,...M&&{alignmentOffset:U}},reset:M}}}),Jv=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:a,initialPlacement:c,platform:l,elements:f}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:h=!0,...b}=it(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=at(s),w=Je(c),C=at(c)===c,S=await(l.isRTL==null?void 0:l.isRTL(f.floating)),E=p||(C||!h?[ir(c)]:zv(c)),P=v!=="none";!p&&P&&E.push(...Wv(c,h,v,S));const R=[c,...E],N=await l.detectOverflow(t,b),A=[];let $=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&A.push(N[y]),d){const q=$v(s,a,S);A.push(N[q[0]],N[q[1]])}if($=[...$,{placement:s,overflows:A}],!A.every(q=>q<=0)){var L,B;const q=(((L=o.flip)==null?void 0:L.index)||0)+1,K=R[q];if(K&&(!(d==="alignment"?w!==Je(K):!1)||$.every(O=>Je(O.placement)===w?O.overflows[0]>0:!0)))return{data:{index:q,overflows:$},reset:{placement:K}};let M=(B=$.filter(U=>U.overflows[0]<=0).sort((U,O)=>U.overflows[1]-O.overflows[1])[0])==null?void 0:B.placement;if(!M)switch(g){case"bestFit":{var F;const U=(F=$.filter(O=>{if(P){const j=Je(O.placement);return j===w||j==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(j=>j>0).reduce((j,T)=>j+T,0)]).sort((O,j)=>O[1]-j[1])[0])==null?void 0:F[0];U&&(M=U);break}case"initialPlacement":M=c;break}if(s!==M)return{reset:{placement:M}}}return{}}}};function Oi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function _i(e){return Bv.some(t=>e[t]>=0)}const Zv=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=it(e,t);switch(s){case"referenceHidden":{const a=await r.detectOverflow(t,{...o,elementContext:"reference"}),c=Oi(a,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:_i(c)}}}case"escaped":{const a=await r.detectOverflow(t,{...o,altBoundary:!0}),c=Oi(a,n.floating);return{data:{escapedOffsets:c,escaped:_i(c)}}}default:return{}}}}},ml=new Set(["left","top"]);async function eb(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=at(n),c=ln(n),l=Je(n)==="y",f=ml.has(a)?-1:1,u=o&&l?-1:1,d=it(t,e);let{mainAxis:p,crossAxis:g,alignmentAxis:v}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof v=="number"&&(g=c==="end"?v*-1:v),l?{x:g*u,y:p*f}:{x:p*f,y:g*u}}const tb=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:a,middlewareData:c}=t,l=await eb(t,e);return a===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:o+l.y,data:{...l,placement:a}}}}},nb=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:a=!0,crossAxis:c=!1,limiter:l={fn:y=>{let{x:w,y:C}=y;return{x:w,y:C}}},...f}=it(e,t),u={x:n,y:r},d=await o.detectOverflow(t,f),p=Je(at(s)),g=co(p);let v=u[g],h=u[p];if(a){const y=g==="y"?"top":"left",w=g==="y"?"bottom":"right",C=v+d[y],S=v-d[w];v=vs(C,v,S)}if(c){const y=p==="y"?"top":"left",w=p==="y"?"bottom":"right",C=h+d[y],S=h-d[w];h=vs(C,h,S)}const b=l.fn({...t,[g]:v,[p]:h});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[g]:a,[p]:c}}}}}},rb=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:a}=t,{offset:c=0,mainAxis:l=!0,crossAxis:f=!0}=it(e,t),u={x:n,y:r},d=Je(s),p=co(d);let g=u[p],v=u[d];const h=it(c,t),b=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const C=p==="y"?"height":"width",S=o.reference[p]-o.floating[C]+b.mainAxis,E=o.reference[p]+o.reference[C]-b.mainAxis;g<S?g=S:g>E&&(g=E)}if(f){var y,w;const C=p==="y"?"width":"height",S=ml.has(at(s)),E=o.reference[d]-o.floating[C]+(S&&((y=a.offset)==null?void 0:y[d])||0)+(S?0:b.crossAxis),P=o.reference[d]+o.reference[C]+(S?0:((w=a.offset)==null?void 0:w[d])||0)-(S?b.crossAxis:0);v<E?v=E:v>P&&(v=P)}return{[p]:g,[d]:v}}}},sb=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:a,elements:c}=t,{apply:l=()=>{},...f}=it(e,t),u=await a.detectOverflow(t,f),d=at(s),p=ln(s),g=Je(s)==="y",{width:v,height:h}=o.floating;let b,y;d==="top"||d==="bottom"?(b=d,y=p===(await(a.isRTL==null?void 0:a.isRTL(c.floating))?"start":"end")?"left":"right"):(y=d,b=p==="end"?"top":"bottom");const w=h-u.top-u.bottom,C=v-u.left-u.right,S=yt(h-u[b],w),E=yt(v-u[y],C),P=!t.middlewareData.shift;let R=S,N=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=C),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=w),P&&!p){const $=Te(u.left,0),L=Te(u.right,0),B=Te(u.top,0),F=Te(u.bottom,0);g?N=v-2*($!==0||L!==0?$+L:Te(u.left,u.right)):R=h-2*(B!==0||F!==0?B+F:Te(u.top,u.bottom))}await l({...t,availableWidth:N,availableHeight:R});const A=await a.getDimensions(c.floating);return v!==A.width||h!==A.height?{reset:{rects:!0}}:{}}}};function Tr(){return typeof window<"u"}function dn(e){return hl(e)?(e.nodeName||"").toLowerCase():"#document"}function Ae(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function tt(e){var t;return(t=(hl(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function hl(e){return Tr()?e instanceof Node||e instanceof Ae(e).Node:!1}function He(e){return Tr()?e instanceof Element||e instanceof Ae(e).Element:!1}function dt(e){return Tr()?e instanceof HTMLElement||e instanceof Ae(e).HTMLElement:!1}function Li(e){return!Tr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ae(e).ShadowRoot}function Tn(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=qe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function ob(e){return/^(table|td|th)$/.test(dn(e))}function Mr(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const ib=/transform|translate|scale|rotate|perspective|filter/,ab=/paint|layout|strict|content/,At=e=>!!e&&e!=="none";let Zr;function fo(e){const t=He(e)?qe(e):e;return At(t.transform)||At(t.translate)||At(t.scale)||At(t.rotate)||At(t.perspective)||!mo()&&(At(t.backdropFilter)||At(t.filter))||ib.test(t.willChange||"")||ab.test(t.contain||"")}function cb(e){let t=xt(e);for(;dt(t)&&!rn(t);){if(fo(t))return t;if(Mr(t))return null;t=xt(t)}return null}function mo(){return Zr==null&&(Zr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Zr}function rn(e){return/^(html|body|#document)$/.test(dn(e))}function qe(e){return Ae(e).getComputedStyle(e)}function Ar(e){return He(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xt(e){if(dn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Li(e)&&e.host||tt(e);return Li(t)?t.host:t}function pl(e){const t=xt(e);return rn(t)?e.ownerDocument?e.ownerDocument.body:e.body:dt(t)&&Tn(t)?t:pl(t)}function wn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=pl(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),a=Ae(s);if(o){const c=ys(a);return t.concat(a,a.visualViewport||[],Tn(s)?s:[],c&&n?wn(c):[])}else return t.concat(s,wn(s,[],n))}function ys(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gl(e){const t=qe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=dt(e),o=s?e.offsetWidth:n,a=s?e.offsetHeight:r,c=or(n)!==o||or(r)!==a;return c&&(n=o,r=a),{width:n,height:r,$:c}}function ho(e){return He(e)?e:e.contextElement}function en(e){const t=ho(e);if(!dt(t))return Ze(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=gl(t);let a=(o?or(n.width):n.width)/r,c=(o?or(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!c||!Number.isFinite(c))&&(c=1),{x:a,y:c}}const lb=Ze(0);function vl(e){const t=Ae(e);return!mo()||!t.visualViewport?lb:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function db(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ae(e)?!1:t}function Lt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=ho(e);let a=Ze(1);t&&(r?He(r)&&(a=en(r)):a=en(e));const c=db(o,n,r)?vl(o):Ze(0);let l=(s.left+c.x)/a.x,f=(s.top+c.y)/a.y,u=s.width/a.x,d=s.height/a.y;if(o){const p=Ae(o),g=r&&He(r)?Ae(r):r;let v=p,h=ys(v);for(;h&&r&&g!==v;){const b=en(h),y=h.getBoundingClientRect(),w=qe(h),C=y.left+(h.clientLeft+parseFloat(w.paddingLeft))*b.x,S=y.top+(h.clientTop+parseFloat(w.paddingTop))*b.y;l*=b.x,f*=b.y,u*=b.x,d*=b.y,l+=C,f+=S,v=Ae(h),h=ys(v)}}return ar({width:u,height:d,x:l,y:f})}function kr(e,t){const n=Ar(e).scrollLeft;return t?t.left+n:Lt(tt(e)).left+n}function bl(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-kr(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function ub(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",a=tt(r),c=t?Mr(t.floating):!1;if(r===a||c&&o)return n;let l={scrollLeft:0,scrollTop:0},f=Ze(1);const u=Ze(0),d=dt(r);if((d||!d&&!o)&&((dn(r)!=="body"||Tn(a))&&(l=Ar(r)),d)){const g=Lt(r);f=en(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}const p=a&&!d&&!o?bl(a,l):Ze(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-l.scrollLeft*f.x+u.x+p.x,y:n.y*f.y-l.scrollTop*f.y+u.y+p.y}}function fb(e){return Array.from(e.getClientRects())}function mb(e){const t=tt(e),n=Ar(e),r=e.ownerDocument.body,s=Te(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Te(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+kr(e);const c=-n.scrollTop;return qe(r).direction==="rtl"&&(a+=Te(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:a,y:c}}const Fi=25;function hb(e,t){const n=Ae(e),r=tt(e),s=n.visualViewport;let o=r.clientWidth,a=r.clientHeight,c=0,l=0;if(s){o=s.width,a=s.height;const u=mo();(!u||u&&t==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}const f=kr(r);if(f<=0){const u=r.ownerDocument,d=u.body,p=getComputedStyle(d),g=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,v=Math.abs(r.clientWidth-d.clientWidth-g);v<=Fi&&(o-=v)}else f<=Fi&&(o+=f);return{width:o,height:a,x:c,y:l}}function pb(e,t){const n=Lt(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=dt(e)?en(e):Ze(1),a=e.clientWidth*o.x,c=e.clientHeight*o.y,l=s*o.x,f=r*o.y;return{width:a,height:c,x:l,y:f}}function Bi(e,t,n){let r;if(t==="viewport")r=hb(e,n);else if(t==="document")r=mb(tt(e));else if(He(t))r=pb(t,n);else{const s=vl(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ar(r)}function yl(e,t){const n=xt(e);return n===t||!He(n)||rn(n)?!1:qe(n).position==="fixed"||yl(n,t)}function gb(e,t){const n=t.get(e);if(n)return n;let r=wn(e,[],!1).filter(c=>He(c)&&dn(c)!=="body"),s=null;const o=qe(e).position==="fixed";let a=o?xt(e):e;for(;He(a)&&!rn(a);){const c=qe(a),l=fo(a);!l&&c.position==="fixed"&&(s=null),(o?!l&&!s:!l&&c.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Tn(a)&&!l&&yl(e,a))?r=r.filter(u=>u!==a):s=c,a=xt(a)}return t.set(e,r),r}function vb(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?Mr(t)?[]:gb(t,this._c):[].concat(n),r],c=Bi(t,a[0],s);let l=c.top,f=c.right,u=c.bottom,d=c.left;for(let p=1;p<a.length;p++){const g=Bi(t,a[p],s);l=Te(g.top,l),f=yt(g.right,f),u=yt(g.bottom,u),d=Te(g.left,d)}return{width:f-d,height:u-l,x:d,y:l}}function bb(e){const{width:t,height:n}=gl(e);return{width:t,height:n}}function yb(e,t,n){const r=dt(t),s=tt(t),o=n==="fixed",a=Lt(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const l=Ze(0);function f(){l.x=kr(s)}if(r||!r&&!o)if((dn(t)!=="body"||Tn(s))&&(c=Ar(t)),r){const g=Lt(t,!0,o,t);l.x=g.x+t.clientLeft,l.y=g.y+t.clientTop}else s&&f();o&&!r&&s&&f();const u=s&&!r&&!o?bl(s,c):Ze(0),d=a.left+c.scrollLeft-l.x-u.x,p=a.top+c.scrollTop-l.y-u.y;return{x:d,y:p,width:a.width,height:a.height}}function es(e){return qe(e).position==="static"}function Ui(e,t){if(!dt(e)||qe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return tt(e)===n&&(n=n.ownerDocument.body),n}function xl(e,t){const n=Ae(e);if(Mr(e))return n;if(!dt(e)){let s=xt(e);for(;s&&!rn(s);){if(He(s)&&!es(s))return s;s=xt(s)}return n}let r=Ui(e,t);for(;r&&ob(r)&&es(r);)r=Ui(r,t);return r&&rn(r)&&es(r)&&!fo(r)?n:r||cb(e)||n}const xb=async function(e){const t=this.getOffsetParent||xl,n=this.getDimensions,r=await n(e.floating);return{reference:yb(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wb(e){return qe(e).direction==="rtl"}const Cb={convertOffsetParentRelativeRectToViewportRelativeRect:ub,getDocumentElement:tt,getClippingRect:vb,getOffsetParent:xl,getElementRects:xb,getClientRects:fb,getDimensions:bb,getScale:en,isElement:He,isRTL:wb};function wl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Sb(e,t){let n=null,r;const s=tt(e);function o(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function a(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),o();const f=e.getBoundingClientRect(),{left:u,top:d,width:p,height:g}=f;if(c||t(),!p||!g)return;const v=Wn(d),h=Wn(s.clientWidth-(u+p)),b=Wn(s.clientHeight-(d+g)),y=Wn(u),C={rootMargin:-v+"px "+-h+"px "+-b+"px "+-y+"px",threshold:Te(0,yt(1,l))||1};let S=!0;function E(P){const R=P[0].intersectionRatio;if(R!==l){if(!S)return a();R?a(!1,R):r=setTimeout(()=>{a(!1,1e-7)},1e3)}R===1&&!wl(f,e.getBoundingClientRect())&&a(),S=!1}try{n=new IntersectionObserver(E,{...C,root:s.ownerDocument})}catch{n=new IntersectionObserver(E,C)}n.observe(e)}return a(!0),o}function Nb(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,f=ho(e),u=s||o?[...f?wn(f):[],...t?wn(t):[]]:[];u.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),o&&y.addEventListener("resize",n)});const d=f&&c?Sb(f,n):null;let p=-1,g=null;a&&(g=new ResizeObserver(y=>{let[w]=y;w&&w.target===f&&g&&t&&(g.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var C;(C=g)==null||C.observe(t)})),n()}),f&&!l&&g.observe(f),t&&g.observe(t));let v,h=l?Lt(e):null;l&&b();function b(){const y=Lt(e);h&&!wl(h,y)&&n(),h=y,v=requestAnimationFrame(b)}return n(),()=>{var y;u.forEach(w=>{s&&w.removeEventListener("scroll",n),o&&w.removeEventListener("resize",n)}),d?.(),(y=g)==null||y.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const Rb=tb,Eb=nb,jb=Jv,Pb=sb,Tb=Zv,$i=Xv,Mb=rb,Ab=(e,t,n)=>{const r=new Map,s={platform:Cb,...n},o={...s.platform,_c:r};return Yv(e,t,{...s,platform:o})};var kb=typeof document<"u",Ib=function(){},Yn=kb?x.useLayoutEffect:Ib;function cr(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,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!cr(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!cr(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Cl(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function zi(e,t){const n=Cl(e);return Math.round(t*n)/n}function ts(e){const t=m.useRef(e);return Yn(()=>{t.current=e}),t}function Db(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:a}={},transform:c=!0,whileElementsMounted:l,open:f}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,g]=m.useState(r);cr(p,r)||g(r);const[v,h]=m.useState(null),[b,y]=m.useState(null),w=m.useCallback(O=>{O!==P.current&&(P.current=O,h(O))},[]),C=m.useCallback(O=>{O!==R.current&&(R.current=O,y(O))},[]),S=o||v,E=a||b,P=m.useRef(null),R=m.useRef(null),N=m.useRef(u),A=l!=null,$=ts(l),L=ts(s),B=ts(f),F=m.useCallback(()=>{if(!P.current||!R.current)return;const O={placement:t,strategy:n,middleware:p};L.current&&(O.platform=L.current),Ab(P.current,R.current,O).then(j=>{const T={...j,isPositioned:B.current!==!1};q.current&&!cr(N.current,T)&&(N.current=T,mr.flushSync(()=>{d(T)}))})},[p,t,n,L,B]);Yn(()=>{f===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,d(O=>({...O,isPositioned:!1})))},[f]);const q=m.useRef(!1);Yn(()=>(q.current=!0,()=>{q.current=!1}),[]),Yn(()=>{if(S&&(P.current=S),E&&(R.current=E),S&&E){if($.current)return $.current(S,E,F);F()}},[S,E,F,$,A]);const K=m.useMemo(()=>({reference:P,floating:R,setReference:w,setFloating:C}),[w,C]),M=m.useMemo(()=>({reference:S,floating:E}),[S,E]),U=m.useMemo(()=>{const O={position:n,left:0,top:0};if(!M.floating)return O;const j=zi(M.floating,u.x),T=zi(M.floating,u.y);return c?{...O,transform:"translate("+j+"px, "+T+"px)",...Cl(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:j,top:T}},[n,c,M.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:F,refs:K,elements:M,floatingStyles:U}),[u,F,K,M,U])}const Ob=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?$i({element:r.current,padding:s}).fn(n):{}:r?$i({element:r,padding:s}).fn(n):{}}}},_b=(e,t)=>{const n=Rb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Lb=(e,t)=>{const n=Eb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fb=(e,t)=>({fn:Mb(e).fn,options:[e,t]}),Bb=(e,t)=>{const n=jb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ub=(e,t)=>{const n=Pb(e);return{name:n.name,fn:n.fn,options:[e,t]}},$b=(e,t)=>{const n=Tb(e);return{name:n.name,fn:n.fn,options:[e,t]}},zb=(e,t)=>{const n=Ob(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Vb="Arrow",Sl=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return i.jsx(Y.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});Sl.displayName=Vb;var Hb=Sl;function Nl(e){const[t,n]=m.useState(void 0);return we(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let a,c;if("borderBoxSize"in o){const l=o.borderBoxSize,f=Array.isArray(l)?l[0]:l;a=f.inlineSize,c=f.blockSize}else a=e.offsetWidth,c=e.offsetHeight;n({width:a,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var po="Popper",[Rl,un]=Ke(po),[qb,El]=Rl(po),jl=e=>{const{__scopePopper:t,children:n}=e,[r,s]=m.useState(null);return i.jsx(qb,{scope:t,anchor:r,onAnchorChange:s,children:n})};jl.displayName=po;var Pl="PopperAnchor",Tl=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=El(Pl,n),a=m.useRef(null),c=se(t,a),l=m.useRef(null);return m.useEffect(()=>{const f=l.current;l.current=r?.current||a.current,f!==l.current&&o.onAnchorChange(l.current)}),r?null:i.jsx(Y.div,{...s,ref:c})});Tl.displayName=Pl;var go="PopperContent",[Wb,Kb]=Rl(go),Ml=m.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:a=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:f=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:p=!1,updatePositionStrategy:g="optimized",onPlaced:v,...h}=e,b=El(go,n),[y,w]=m.useState(null),C=se(t,k=>w(k)),[S,E]=m.useState(null),P=Nl(S),R=P?.width??0,N=P?.height??0,A=r+(o!=="center"?"-"+o:""),$=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},L=Array.isArray(f)?f:[f],B=L.length>0,F={padding:$,boundary:L.filter(Qb),altBoundary:B},{refs:q,floatingStyles:K,placement:M,isPositioned:U,middlewareData:O}=Db({strategy:"fixed",placement:A,whileElementsMounted:(...k)=>Nb(...k,{animationFrame:g==="always"}),elements:{reference:b.anchor},middleware:[_b({mainAxis:s+N,alignmentAxis:a}),l&&Lb({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?Fb():void 0,...F}),l&&Bb({...F}),Ub({...F,apply:({elements:k,rects:V,availableWidth:X,availableHeight:re})=>{const{width:ne,height:oe}=V.reference,pe=k.floating.style;pe.setProperty("--radix-popper-available-width",`${X}px`),pe.setProperty("--radix-popper-available-height",`${re}px`),pe.setProperty("--radix-popper-anchor-width",`${ne}px`),pe.setProperty("--radix-popper-anchor-height",`${oe}px`)}}),S&&zb({element:S,padding:c}),Yb({arrowWidth:R,arrowHeight:N}),p&&$b({strategy:"referenceHidden",...F})]}),[j,T]=Il(M),ae=et(v);we(()=>{U&&ae?.()},[U,ae]);const fe=O.arrow?.x,G=O.arrow?.y,ee=O.arrow?.centerOffset!==0,[H,Q]=m.useState();return we(()=>{y&&Q(window.getComputedStyle(y).zIndex)},[y]),i.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:U?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[O.transformOrigin?.x,O.transformOrigin?.y].join(" "),...O.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(Wb,{scope:n,placedSide:j,onArrowChange:E,arrowX:fe,arrowY:G,shouldHideArrow:ee,children:i.jsx(Y.div,{"data-side":j,"data-align":T,...h,ref:C,style:{...h.style,animation:U?void 0:"none"}})})})});Ml.displayName=go;var Al="PopperArrow",Gb={top:"bottom",right:"left",bottom:"top",left:"right"},kl=m.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=Kb(Al,r),a=Gb[o.placedSide];return i.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:i.jsx(Hb,{...s,ref:n,style:{...s.style,display:"block"}})})});kl.displayName=Al;function Qb(e){return e!==null}var Yb=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:s}=t,a=s.arrow?.centerOffset!==0,c=a?0:e.arrowWidth,l=a?0:e.arrowHeight,[f,u]=Il(n),d={start:"0%",center:"50%",end:"100%"}[u],p=(s.arrow?.x??0)+c/2,g=(s.arrow?.y??0)+l/2;let v="",h="";return f==="bottom"?(v=a?d:`${p}px`,h=`${-l}px`):f==="top"?(v=a?d:`${p}px`,h=`${r.floating.height+l}px`):f==="right"?(v=`${-l}px`,h=a?d:`${g}px`):f==="left"&&(v=`${r.floating.width+l}px`,h=a?d:`${g}px`),{data:{x:v,y:h}}}});function Il(e){const[t,n="center"]=e.split("-");return[t,n]}var vo=jl,bo=Tl,yo=Ml,xo=kl;function Xb(e){const t=Jb(e),n=m.forwardRef((r,s)=>{const{children:o,...a}=r,c=m.Children.toArray(o),l=c.find(ey);if(l){const f=l.props.children,u=c.map(d=>d===l?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:d);return i.jsx(t,{...a,ref:s,children:m.isValidElement(f)?m.cloneElement(f,void 0,u):null})}return i.jsx(t,{...a,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function Jb(e){const t=m.forwardRef((n,r)=>{const{children:s,...o}=n;if(m.isValidElement(s)){const a=ny(s),c=ty(o,s.props);return s.type!==m.Fragment&&(c.ref=r?ct(r,a):a),m.cloneElement(s,c)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Zb=Symbol("radix.slottable");function ey(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Zb}function ty(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const l=o(...c);return s(...c),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function ny(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)}function Dl(e){const t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Ol=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),ry="VisuallyHidden",_l=m.forwardRef((e,t)=>i.jsx(Y.span,{...e,ref:t,style:{...Ol,...e.style}}));_l.displayName=ry;var sy=_l,oy=[" ","Enter","ArrowUp","ArrowDown"],iy=[" ","Enter"],Ft="Select",[Ir,Dr,ay]=eo(Ft),[fn]=Ke(Ft,[ay,un]),Or=un(),[cy,jt]=fn(Ft),[ly,dy]=fn(Ft),Ll=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:o,value:a,defaultValue:c,onValueChange:l,dir:f,name:u,autoComplete:d,disabled:p,required:g,form:v}=e,h=Or(t),[b,y]=m.useState(null),[w,C]=m.useState(null),[S,E]=m.useState(!1),P=Cr(f),[R,N]=bt({prop:r,defaultProp:s??!1,onChange:o,caller:Ft}),[A,$]=bt({prop:a,defaultProp:c,onChange:l,caller:Ft}),L=m.useRef(null),B=b?v||!!b.closest("form"):!0,[F,q]=m.useState(new Set),K=Array.from(F).map(M=>M.props.value).join(";");return i.jsx(vo,{...h,children:i.jsxs(cy,{required:g,scope:t,trigger:b,onTriggerChange:y,valueNode:w,onValueNodeChange:C,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:$e(),value:A,onValueChange:$,open:R,onOpenChange:N,dir:P,triggerPointerDownPosRef:L,disabled:p,children:[i.jsx(Ir.Provider,{scope:t,children:i.jsx(ly,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback(M=>{q(U=>new Set(U).add(M))},[]),onNativeOptionRemove:m.useCallback(M=>{q(U=>{const O=new Set(U);return O.delete(M),O})},[]),children:n})}),B?i.jsxs(rd,{"aria-hidden":!0,required:g,tabIndex:-1,name:u,autoComplete:d,value:A,onChange:M=>$(M.target.value),disabled:p,form:v,children:[A===void 0?i.jsx("option",{value:""}):null,Array.from(F)]},K):null]})})};Ll.displayName=Ft;var Fl="SelectTrigger",Bl=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,o=Or(n),a=jt(Fl,n),c=a.disabled||r,l=se(t,a.onTriggerChange),f=Dr(n),u=m.useRef("touch"),[d,p,g]=od(h=>{const b=f().filter(C=>!C.disabled),y=b.find(C=>C.value===a.value),w=id(b,h,y);w!==void 0&&a.onValueChange(w.value)}),v=h=>{c||(a.onOpenChange(!0),g()),h&&(a.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return i.jsx(bo,{asChild:!0,...o,children:i.jsx(Y.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":sd(a.value)?"":void 0,...s,ref:l,onClick:I(s.onClick,h=>{h.currentTarget.focus(),u.current!=="mouse"&&v(h)}),onPointerDown:I(s.onPointerDown,h=>{u.current=h.pointerType;const b=h.target;b.hasPointerCapture(h.pointerId)&&b.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(v(h),h.preventDefault())}),onKeyDown:I(s.onKeyDown,h=>{const b=d.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&p(h.key),!(b&&h.key===" ")&&oy.includes(h.key)&&(v(),h.preventDefault())})})})});Bl.displayName=Fl;var Ul="SelectValue",$l=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:o,placeholder:a="",...c}=e,l=jt(Ul,n),{onValueNodeHasChildrenChange:f}=l,u=o!==void 0,d=se(t,l.onValueNodeChange);return we(()=>{f(u)},[f,u]),i.jsx(Y.span,{...c,ref:d,style:{pointerEvents:"none"},children:sd(l.value)?i.jsx(i.Fragment,{children:a}):o})});$l.displayName=Ul;var uy="SelectIcon",zl=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return i.jsx(Y.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});zl.displayName=uy;var fy="SelectPortal",Vl=e=>i.jsx(jn,{asChild:!0,...e});Vl.displayName=fy;var Bt="SelectContent",Hl=m.forwardRef((e,t)=>{const n=jt(Bt,e.__scopeSelect),[r,s]=m.useState();if(we(()=>{s(new DocumentFragment)},[]),!n.open){const o=r;return o?mr.createPortal(i.jsx(ql,{scope:e.__scopeSelect,children:i.jsx(Ir.Slot,{scope:e.__scopeSelect,children:i.jsx("div",{children:e.children})})}),o):null}return i.jsx(Wl,{...e,ref:t})});Hl.displayName=Bt;var Ue=10,[ql,Pt]=fn(Bt),my="SelectContentImpl",hy=Xb("SelectContent.RemoveScroll"),Wl=m.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:a,side:c,sideOffset:l,align:f,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:g,sticky:v,hideWhenDetached:h,avoidCollisions:b,...y}=e,w=jt(Bt,n),[C,S]=m.useState(null),[E,P]=m.useState(null),R=se(t,k=>S(k)),[N,A]=m.useState(null),[$,L]=m.useState(null),B=Dr(n),[F,q]=m.useState(!1),K=m.useRef(!1);m.useEffect(()=>{if(C)return Hs(C)},[C]),Vs();const M=m.useCallback(k=>{const[V,...X]=B().map(oe=>oe.ref.current),[re]=X.slice(-1),ne=document.activeElement;for(const oe of k)if(oe===ne||(oe?.scrollIntoView({block:"nearest"}),oe===V&&E&&(E.scrollTop=0),oe===re&&E&&(E.scrollTop=E.scrollHeight),oe?.focus(),document.activeElement!==ne))return},[B,E]),U=m.useCallback(()=>M([N,C]),[M,N,C]);m.useEffect(()=>{F&&U()},[F,U]);const{onOpenChange:O,triggerPointerDownPosRef:j}=w;m.useEffect(()=>{if(C){let k={x:0,y:0};const V=re=>{k={x:Math.abs(Math.round(re.pageX)-(j.current?.x??0)),y:Math.abs(Math.round(re.pageY)-(j.current?.y??0))}},X=re=>{k.x<=10&&k.y<=10?re.preventDefault():C.contains(re.target)||O(!1),document.removeEventListener("pointermove",V),j.current=null};return j.current!==null&&(document.addEventListener("pointermove",V),document.addEventListener("pointerup",X,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",V),document.removeEventListener("pointerup",X,{capture:!0})}}},[C,O,j]),m.useEffect(()=>{const k=()=>O(!1);return window.addEventListener("blur",k),window.addEventListener("resize",k),()=>{window.removeEventListener("blur",k),window.removeEventListener("resize",k)}},[O]);const[T,ae]=od(k=>{const V=B().filter(ne=>!ne.disabled),X=V.find(ne=>ne.ref.current===document.activeElement),re=id(V,k,X);re&&setTimeout(()=>re.ref.current.focus())}),fe=m.useCallback((k,V,X)=>{const re=!K.current&&!X;(w.value!==void 0&&w.value===V||re)&&(A(k),re&&(K.current=!0))},[w.value]),G=m.useCallback(()=>C?.focus(),[C]),ee=m.useCallback((k,V,X)=>{const re=!K.current&&!X;(w.value!==void 0&&w.value===V||re)&&L(k)},[w.value]),H=r==="popper"?xs:Kl,Q=H===xs?{side:c,sideOffset:l,align:f,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:g,sticky:v,hideWhenDetached:h,avoidCollisions:b}:{};return i.jsx(ql,{scope:n,content:C,viewport:E,onViewportChange:P,itemRefCallback:fe,selectedItem:N,onItemLeave:G,itemTextRefCallback:ee,focusSelectedItem:U,selectedItemText:$,position:r,isPositioned:F,searchRef:T,children:i.jsx(yr,{as:hy,allowPinchZoom:!0,children:i.jsx(vr,{asChild:!0,trapped:w.open,onMountAutoFocus:k=>{k.preventDefault()},onUnmountAutoFocus:I(s,k=>{w.trigger?.focus({preventScroll:!0}),k.preventDefault()}),children:i.jsx(En,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:k=>k.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:i.jsx(H,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:k=>k.preventDefault(),...y,...Q,onPlaced:()=>q(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:I(y.onKeyDown,k=>{const V=k.ctrlKey||k.altKey||k.metaKey;if(k.key==="Tab"&&k.preventDefault(),!V&&k.key.length===1&&ae(k.key),["ArrowUp","ArrowDown","Home","End"].includes(k.key)){let re=B().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);if(["ArrowUp","End"].includes(k.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(k.key)){const ne=k.target,oe=re.indexOf(ne);re=re.slice(oe+1)}setTimeout(()=>M(re)),k.preventDefault()}})})})})})})});Wl.displayName=my;var py="SelectItemAlignedPosition",Kl=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,o=jt(Bt,n),a=Pt(Bt,n),[c,l]=m.useState(null),[f,u]=m.useState(null),d=se(t,R=>u(R)),p=Dr(n),g=m.useRef(!1),v=m.useRef(!0),{viewport:h,selectedItem:b,selectedItemText:y,focusSelectedItem:w}=a,C=m.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&f&&h&&b&&y){const R=o.trigger.getBoundingClientRect(),N=f.getBoundingClientRect(),A=o.valueNode.getBoundingClientRect(),$=y.getBoundingClientRect();if(o.dir!=="rtl"){const ne=$.left-N.left,oe=A.left-ne,pe=R.left-oe,be=R.width+pe,mn=Math.max(be,N.width),Vt=window.innerWidth-Ue,nt=Ai(oe,[Ue,Math.max(Ue,Vt-mn)]);c.style.minWidth=be+"px",c.style.left=nt+"px"}else{const ne=N.right-$.right,oe=window.innerWidth-A.right-ne,pe=window.innerWidth-R.right-oe,be=R.width+pe,mn=Math.max(be,N.width),Vt=window.innerWidth-Ue,nt=Ai(oe,[Ue,Math.max(Ue,Vt-mn)]);c.style.minWidth=be+"px",c.style.right=nt+"px"}const L=p(),B=window.innerHeight-Ue*2,F=h.scrollHeight,q=window.getComputedStyle(f),K=parseInt(q.borderTopWidth,10),M=parseInt(q.paddingTop,10),U=parseInt(q.borderBottomWidth,10),O=parseInt(q.paddingBottom,10),j=K+M+F+O+U,T=Math.min(b.offsetHeight*5,j),ae=window.getComputedStyle(h),fe=parseInt(ae.paddingTop,10),G=parseInt(ae.paddingBottom,10),ee=R.top+R.height/2-Ue,H=B-ee,Q=b.offsetHeight/2,k=b.offsetTop+Q,V=K+M+k,X=j-V;if(V<=ee){const ne=L.length>0&&b===L[L.length-1].ref.current;c.style.bottom="0px";const oe=f.clientHeight-h.offsetTop-h.offsetHeight,pe=Math.max(H,Q+(ne?G:0)+oe+U),be=V+pe;c.style.height=be+"px"}else{const ne=L.length>0&&b===L[0].ref.current;c.style.top="0px";const pe=Math.max(ee,K+h.offsetTop+(ne?fe:0)+Q)+X;c.style.height=pe+"px",h.scrollTop=V-ee+h.offsetTop}c.style.margin=`${Ue}px 0`,c.style.minHeight=T+"px",c.style.maxHeight=B+"px",r?.(),requestAnimationFrame(()=>g.current=!0)}},[p,o.trigger,o.valueNode,c,f,h,b,y,o.dir,r]);we(()=>C(),[C]);const[S,E]=m.useState();we(()=>{f&&E(window.getComputedStyle(f).zIndex)},[f]);const P=m.useCallback(R=>{R&&v.current===!0&&(C(),w?.(),v.current=!1)},[C,w]);return i.jsx(vy,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:P,children:i.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:i.jsx(Y.div,{...s,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Kl.displayName=py;var gy="SelectPopperPosition",xs=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Ue,...o}=e,a=Or(n);return i.jsx(yo,{...a,...o,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});xs.displayName=gy;var[vy,wo]=fn(Bt,{}),ws="SelectViewport",Gl=m.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,o=Pt(ws,n),a=wo(ws,n),c=se(t,o.onViewportChange),l=m.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),i.jsx(Ir.Slot,{scope:n,children:i.jsx(Y.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:I(s.onScroll,f=>{const u=f.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:p}=a;if(p?.current&&d){const g=Math.abs(l.current-u.scrollTop);if(g>0){const v=window.innerHeight-Ue*2,h=parseFloat(d.style.minHeight),b=parseFloat(d.style.height),y=Math.max(h,b);if(y<v){const w=y+g,C=Math.min(v,w),S=w-C;d.style.height=C+"px",d.style.bottom==="0px"&&(u.scrollTop=S>0?S:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});Gl.displayName=ws;var Ql="SelectGroup",[by,yy]=fn(Ql),xy=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=$e();return i.jsx(by,{scope:n,id:s,children:i.jsx(Y.div,{role:"group","aria-labelledby":s,...r,ref:t})})});xy.displayName=Ql;var Yl="SelectLabel",wy=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=yy(Yl,n);return i.jsx(Y.div,{id:s.id,...r,ref:t})});wy.displayName=Yl;var lr="SelectItem",[Cy,Xl]=fn(lr),Jl=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:o,...a}=e,c=jt(lr,n),l=Pt(lr,n),f=c.value===r,[u,d]=m.useState(o??""),[p,g]=m.useState(!1),v=se(t,w=>l.itemRefCallback?.(w,r,s)),h=$e(),b=m.useRef("touch"),y=()=>{s||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return i.jsx(Cy,{scope:n,value:r,disabled:s,textId:h,isSelected:f,onItemTextChange:m.useCallback(w=>{d(C=>C||(w?.textContent??"").trim())},[]),children:i.jsx(Ir.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:i.jsx(Y.div,{role:"option","aria-labelledby":h,"data-highlighted":p?"":void 0,"aria-selected":f&&p,"data-state":f?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...a,ref:v,onFocus:I(a.onFocus,()=>g(!0)),onBlur:I(a.onBlur,()=>g(!1)),onClick:I(a.onClick,()=>{b.current!=="mouse"&&y()}),onPointerUp:I(a.onPointerUp,()=>{b.current==="mouse"&&y()}),onPointerDown:I(a.onPointerDown,w=>{b.current=w.pointerType}),onPointerMove:I(a.onPointerMove,w=>{b.current=w.pointerType,s?l.onItemLeave?.():b.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:I(a.onPointerLeave,w=>{w.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:I(a.onKeyDown,w=>{l.searchRef?.current!==""&&w.key===" "||(iy.includes(w.key)&&y(),w.key===" "&&w.preventDefault())})})})})});Jl.displayName=lr;var pn="SelectItemText",Zl=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...o}=e,a=jt(pn,n),c=Pt(pn,n),l=Xl(pn,n),f=dy(pn,n),[u,d]=m.useState(null),p=se(t,y=>d(y),l.onItemTextChange,y=>c.itemTextRefCallback?.(y,l.value,l.disabled)),g=u?.textContent,v=m.useMemo(()=>i.jsx("option",{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:h,onNativeOptionRemove:b}=f;return we(()=>(h(v),()=>b(v)),[h,b,v]),i.jsxs(i.Fragment,{children:[i.jsx(Y.span,{id:l.textId,...o,ref:p}),l.isSelected&&a.valueNode&&!a.valueNodeHasChildren?mr.createPortal(o.children,a.valueNode):null]})});Zl.displayName=pn;var ed="SelectItemIndicator",td=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Xl(ed,n).isSelected?i.jsx(Y.span,{"aria-hidden":!0,...r,ref:t}):null});td.displayName=ed;var Cs="SelectScrollUpButton",Sy=m.forwardRef((e,t)=>{const n=Pt(Cs,e.__scopeSelect),r=wo(Cs,e.__scopeSelect),[s,o]=m.useState(!1),a=se(t,r.onScrollButtonChange);return we(()=>{if(n.viewport&&n.isPositioned){let c=function(){const f=l.scrollTop>0;o(f)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?i.jsx(nd,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop-l.offsetHeight)}}):null});Sy.displayName=Cs;var Ss="SelectScrollDownButton",Ny=m.forwardRef((e,t)=>{const n=Pt(Ss,e.__scopeSelect),r=wo(Ss,e.__scopeSelect),[s,o]=m.useState(!1),a=se(t,r.onScrollButtonChange);return we(()=>{if(n.viewport&&n.isPositioned){let c=function(){const f=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<f;o(u)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?i.jsx(nd,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop+l.offsetHeight)}}):null});Ny.displayName=Ss;var nd=m.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,o=Pt("SelectScrollButton",n),a=m.useRef(null),c=Dr(n),l=m.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return m.useEffect(()=>()=>l(),[l]),we(()=>{c().find(u=>u.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),i.jsx(Y.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:I(s.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:I(s.onPointerMove,()=>{o.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:I(s.onPointerLeave,()=>{l()})})}),Ry="SelectSeparator",Ey=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return i.jsx(Y.div,{"aria-hidden":!0,...r,ref:t})});Ey.displayName=Ry;var Ns="SelectArrow",jy=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Or(n),o=jt(Ns,n),a=Pt(Ns,n);return o.open&&a.position==="popper"?i.jsx(xo,{...s,...r,ref:t}):null});jy.displayName=Ns;var Py="SelectBubbleInput",rd=m.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=m.useRef(null),o=se(r,s),a=Dl(t);return m.useEffect(()=>{const c=s.current;if(!c)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==t&&u){const d=new Event("change",{bubbles:!0});u.call(c,t),c.dispatchEvent(d)}},[a,t]),i.jsx(Y.select,{...n,style:{...Ol,...n.style},ref:o,defaultValue:t})});rd.displayName=Py;function sd(e){return e===""||e===void 0}function od(e){const t=et(e),n=m.useRef(""),r=m.useRef(0),s=m.useCallback(a=>{const c=n.current+a;t(c),(function l(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(c)},[t]),o=m.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,o]}function id(e,t,n){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=Ty(e,Math.max(o,0));s.length===1&&(a=a.filter(f=>f!==n));const l=a.find(f=>f.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function Ty(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var My=Ll,Ay=Bl,ky=$l,Iy=zl,Dy=Vl,Oy=Hl,_y=Gl,Ly=Jl,Fy=Zl,By=td;const Uy=My,$y=ky,ad=x.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(Ay,{ref:r,className:z("flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1","disabled:cursor-not-allowed disabled:opacity-50","data-[placeholder]:text-muted-foreground","transition-colors",e),...n,children:[t,i.jsx(Iy,{asChild:!0,children:i.jsx(ps,{className:"h-3.5 w-3.5 opacity-60"})})]}));ad.displayName="SelectTrigger";const cd=x.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>{const{appearance:o}=te(),a=Nt(o?.colorScheme),c=St(o);return i.jsx(Dy,{children:i.jsx("div",{className:z("road-ui",a==="dark"&&"dark"),style:c,children:i.jsx(Oy,{ref:s,position:n,className:z("relative z-[70] max-h-[300px] min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),...r,children:i.jsx(_y,{className:z("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})})})});cd.displayName="SelectContent";const ld=x.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(Ly,{ref:r,className:z("relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-2 pr-7 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[i.jsx(Fy,{children:t}),i.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(By,{children:i.jsx(cn,{className:"h-3.5 w-3.5"})})})]}));ld.displayName="SelectItem";const zy=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Vy(e){const t=e.split(/[\s,;]+/).map(s=>s.trim()).filter(Boolean),n=[],r=[];for(const s of t)zy.test(s)?n.push(s):r.push(s);return{valid:n,invalid:r}}function Hy({buId:e,onCancel:t,onInvited:n}){const[r,s]=x.useState(""),[o,a]=x.useState(void 0),[c,l]=x.useState(!1),f=x.useRef(null),{data:u,isPending:d}=ga(e,100),p=zf(e),g=le(),v=Rr({generic:g.dict.validation.generic,formSummary:g.dict.validation.formSummary});x.useEffect(()=>{f.current?.focus()},[]),x.useEffect(()=>{if(!o&&u&&u.length>0){const C=u.find(S=>!S.isSystem)??u[0];a(C.id)}},[u,o]);const h=Vy(r),b=async()=>{const C={};if(h.valid.length===0&&h.invalid.length===0?C["invite-emails"]=g.dict.validation.required:h.invalid.length>0&&(C["invite-emails"]=g.dict.validation.emailInvalid),o||(C["invite-role"]=g.dict.validation.required),!v.failClient(C)&&o){l(!0);try{let S=0;for(const E of h.valid)try{await p.mutateAsync({email:E,roleId:o}),S++}catch{}S===h.valid.length?(ie.success(S===1?g.dict.invitations.sentSingleToast:g.format(g.dict.invitations.sentToast,{count:S})),n()):S>0?(ie.warning(g.format(g.dict.invitations.sentPartialToast,{succeeded:S,total:h.valid.length})),n()):ie.error(g.dict.invitations.sentErrorToast)}finally{l(!1)}}},y=v.errors["invite-role"],w=i.jsxs(i.Fragment,{children:[g.dict.invitations.formEmailsHelp,h.valid.length>0&&i.jsxs(i.Fragment,{children:[" ",i.jsx("span",{className:"text-foreground",children:g.format(g.dict.invitations.formEmailsValidCount,{count:h.valid.length})})]}),h.invalid.length>0&&i.jsxs(i.Fragment,{children:[" ",i.jsx("span",{className:"text-destructive",children:g.format(g.dict.invitations.formEmailsInvalidCount,{count:h.invalid.length,examples:h.invalid.slice(0,3).join(", ")+(h.invalid.length>3?"…":"")})})]})]});return i.jsxs("form",{onSubmit:C=>{C.preventDefault(),b()},className:"rounded-lg border border-border bg-card p-4 animate-in fade-in-0 slide-in-from-top-2 duration-200",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsx(nn,{id:"invite-emails",label:g.format(g.dict.invitations.formEmailsField,{plural:h.valid.length>1?"s":""}),error:v.errors["invite-emails"],hint:w,children:i.jsx(ze,{ref:f,value:r,onChange:C=>{s(C.target.value),v.clear("invite-emails")},placeholder:g.dict.invitations.formEmailsPlaceholder,disabled:c})}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(It,{htmlFor:"invite-role",children:g.dict.invitations.formRoleField}),d?i.jsx(de,{className:"h-9 w-full max-w-sm"}):i.jsxs(Uy,{value:o,onValueChange:C=>{a(C),v.clear("invite-role")},disabled:c,children:[i.jsx(ad,{id:"invite-role",className:`max-w-sm${y?" border-destructive focus-visible:ring-destructive":""}`,"aria-invalid":y?!0:void 0,"aria-describedby":y?"invite-role-error":void 0,children:i.jsx($y,{placeholder:g.dict.invitations.formRolePlaceholder})}),i.jsx(cd,{children:(u??[]).map(C=>i.jsxs(ld,{value:C.id,children:[C.name,C.isSystem&&i.jsxs("span",{className:"ml-1 text-xs text-muted-foreground",children:["(",g.dict.common.system.toLowerCase(),")"]})]},C.id))})]}),y&&i.jsx("p",{id:"invite-role-error",role:"alert",className:"text-sm text-destructive",children:y})]})]}),v.formError&&i.jsx("p",{role:"alert",className:"mt-3 text-sm text-destructive",children:v.formError}),i.jsxs("div",{className:"mt-4 flex items-center justify-end gap-2",children:[i.jsx(W,{type:"button",variant:"ghost",onClick:t,disabled:c,children:g.dict.common.cancel}),i.jsxs(W,{type:"submit",disabled:c,children:[c&&i.jsx(Ve,{className:"h-3.5 w-3.5 animate-spin"}),h.valid.length>1?g.format(g.dict.invitations.formSubmitMany,{count:h.valid.length}):g.dict.invitations.formSubmitSingle]})]})]})}function qy(e){switch(e){case"pending":return"default";case"accepted":return"muted";case"expired":return"warning";case"cancelled":return"danger";case"rejected":return"danger"}}function Wy(e,t){switch(t){case"pending":return e.dict.invitations.statusPending;case"accepted":return e.dict.invitations.statusAccepted;case"expired":return e.dict.invitations.statusExpired;case"cancelled":return e.dict.invitations.statusCancelled;case"rejected":return e.dict.invitations.statusRejected}}function Ky({buId:e,invitations:t}){const n=[...t].sort((r,s)=>r.status==="pending"&&s.status!=="pending"?-1:s.status==="pending"&&r.status!=="pending"?1:new Date(s.invitedAt).getTime()-new Date(r.invitedAt).getTime());return i.jsx("ul",{className:"divide-y divide-border rounded-lg border border-border bg-card",role:"list",children:n.map(r=>i.jsx("li",{children:i.jsx(Gy,{buId:e,invitation:r})},r.id))})}function Gy({buId:e,invitation:t}){const n=Vf(e),r=Hf(e),s=le(),a=Ct(e)("manage:Invitation"),c=t.status==="pending",l=async()=>{try{await r.mutateAsync(t.id),ie.success(s.format(s.dict.invitations.resendToast,{email:t.email}))}catch{ie.error(s.dict.invitations.couldNotLoad)}},f=async()=>{try{await n.mutateAsync(t.id),ie.message(s.format(s.dict.invitations.cancelToast,{email:t.email}))}catch{ie.error(s.dict.invitations.couldNotLoad)}},u=s.relative(c?t.expiresAt:t.invitedAt),d=s.format(c?s.dict.invitations.expiresRelative:s.dict.invitations.invitedRelative,{relative:u});return i.jsxs("div",{className:"flex items-center gap-3 px-3 py-3",children:[i.jsx(Et,{name:t.email}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:t.email}),i.jsx(_e,{variant:qy(t.status),children:Wy(s,t.status)})]}),i.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[t.roleName," · ",d]})]}),c&&a&&i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsxs(W,{variant:"ghost",size:"icon",onClick:l,disabled:r.isPending,title:s.dict.invitations.resend,children:[r.isPending?i.jsx(Ve,{className:"h-4 w-4 animate-spin"}):i.jsx(Sg,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:s.dict.invitations.resend})]}),i.jsxs(ro,{children:[i.jsx(so,{asChild:!0,children:i.jsxs(W,{variant:"ghost",size:"icon",title:s.dict.invitations.cancel,children:[i.jsx(Ys,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:s.dict.invitations.cancel})]})}),i.jsxs(Er,{children:[i.jsx(jr,{children:s.format(s.dict.invitations.cancelTitle,{email:t.email})}),i.jsx(Pr,{children:s.dict.invitations.cancelDescription}),i.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[i.jsx(io,{asChild:!0,children:i.jsx(W,{variant:"outline",children:s.dict.invitations.cancelKeep})}),i.jsx(oo,{asChild:!0,children:i.jsx(W,{variant:"destructive",onClick:f,children:s.dict.invitations.cancelConfirm})})]})]})]})]})]})}function Qy({buId:e}){const[t,n]=x.useState(!1),{data:r,isPending:s,isError:o,refetch:a,hasNextPage:c,isFetchingNextPage:l,fetchNextPage:f}=ma(e),u=le(),p=Ct(e)("manage:Invitation"),g=x.useMemo(()=>r?r.pages.flatMap(h=>h.data):[],[r]),v=r?.pages[0]?.pagination.totalCount??0;return s?i.jsx("div",{className:"space-y-2",children:[0,1,2].map(h=>i.jsx(de,{className:"h-16 w-full"},h))}):o?i.jsx(Me,{icon:i.jsx(pt,{className:"h-5 w-5"}),title:u.dict.invitations.couldNotLoad,description:u.dict.businessUnits.errorDescription,action:i.jsxs(W,{variant:"outline",onClick:()=>{a()},children:[i.jsx(pt,{className:"h-3.5 w-3.5"})," ",u.dict.common.tryAgain]})}):v===0&&!t?i.jsx(Me,{icon:i.jsx(wr,{className:"h-5 w-5"}),title:u.dict.invitations.emptyTitle,description:u.dict.invitations.emptyDescription,action:p?i.jsxs(W,{onClick:()=>n(!0),children:[i.jsx(ot,{className:"h-3.5 w-3.5"})," ",u.dict.invitations.inviteButton]}):void 0}):i.jsxs("div",{className:"space-y-3",children:[p&&i.jsx("div",{className:"flex items-center justify-end",children:!t&&i.jsxs(W,{size:"sm",onClick:()=>n(!0),children:[i.jsx(ot,{className:"h-3.5 w-3.5"})," ",u.dict.invitations.inviteButton]})}),t&&p&&i.jsx(Hy,{buId:e,onCancel:()=>n(!1),onInvited:()=>n(!1)}),g.length>0&&i.jsx(Ky,{buId:e,invitations:g}),i.jsx(ao,{shown:g.length,total:v,hasNextPage:c,isFetchingNextPage:l,onLoadMore:()=>{f()}})]})}function Yy({buId:e,onBack:t}){const{data:n,isPending:r}=ua(e),{isPending:s}=hr(),o=Ct(e),a=le(),c=o("read:Member"),l=o("manage:Invitation"),f=c?"members":l?"invitations":"settings";return i.jsxs("div",{className:"animate-in fade-in-0 slide-in-from-right-2 duration-200",children:[i.jsxs("header",{className:"mb-4 flex items-center gap-3",children:[i.jsx(W,{variant:"ghost",size:"icon",onClick:t,"aria-label":a.dict.common.back,children:i.jsx(Qn,{className:"h-4 w-4"})}),r||!n?i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(de,{className:"h-9 w-9 rounded-full"}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(de,{className:"h-4 w-32"}),i.jsx(de,{className:"h-3 w-24"})]})]}):i.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[i.jsx(Et,{name:n.name}),i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h3",{className:"truncate text-base font-semibold text-foreground",children:n.name}),i.jsx(_e,{variant:"muted",className:"shrink-0",children:a.plural(a.dict.businessUnits.detailMemberCount,n.memberCount)})]}),i.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:n.slug})]})]})]}),i.jsxs(Yc,{defaultValue:f,children:[i.jsxs(no,{children:[c&&i.jsx(Xt,{value:"members",children:a.dict.businessUnits.detailTabMembers}),l&&i.jsx(Xt,{value:"invitations",children:a.dict.businessUnits.detailTabInvitations}),i.jsx(Xt,{value:"settings",children:a.dict.businessUnits.detailTabSettings})]}),c&&i.jsx(Jt,{value:"members",children:i.jsx(_v,{buId:e})}),l&&i.jsx(Jt,{value:"invitations",children:i.jsx(Qy,{buId:e})}),i.jsx(Jt,{value:"settings",children:i.jsx(Fv,{buId:e})})]},s?"perms-loading":"perms-ready")]})}function Xy({initialBuId:e=null}={}){const[t,n]=x.useState(e);return t?i.jsx(Yy,{buId:t,onBack:()=>n(null)}):i.jsx("div",{className:"animate-in fade-in-0 duration-200",children:i.jsx(pv,{onSelect:n})})}function Jy({businessUnits:e,value:t,onChange:n}){const r=le();return e.length<=1?null:i.jsxs("div",{className:"flex items-center gap-1.5 overflow-x-auto pb-1",role:"tablist",children:[i.jsx("span",{className:"shrink-0 text-xs font-medium text-muted-foreground",children:r.dict.roles.buSelectorLabel}),e.map(s=>{const o=s.id===t;return i.jsx("button",{type:"button",role:"tab","aria-selected":o,onClick:()=>n(s.id),className:z("shrink-0 rounded-full px-3 py-1 text-xs font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",o?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:s.name},s.id)})]})}function Zy({role:e,onSelect:t}){const n=le(),r=e.permissions.includes("*")?n.dict.roles.rowAllPermissions:n.plural(n.dict.roles.rowPermissionsCount,e.permissions.length);return i.jsxs("button",{type:"button",onClick:()=>t(e.id),className:z("group flex w-full items-start gap-3 rounded-lg border border-border bg-card px-3 py-3 text-left","transition-all hover:border-foreground/20 hover:bg-accent/50","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1"),children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.name}),e.isSystem&&i.jsxs(_e,{variant:"muted",className:"shrink-0 gap-1",children:[i.jsx(Qs,{className:"h-3 w-3","aria-hidden":!0})," ",n.dict.roles.systemBadge]})]}),e.description&&i.jsx("p",{className:"mt-0.5 line-clamp-1 text-xs text-muted-foreground",children:e.description}),i.jsxs("div",{className:"mt-1.5 flex items-center gap-3 text-xs text-muted-foreground",children:[i.jsx("span",{children:r}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(xn,{className:"h-3 w-3","aria-hidden":!0}),e.assignmentCount," ",n.plural(n.dict.common.member,e.assignmentCount).replace(/\{\{count\}\}/g,"")]})]})]}),i.jsx(jc,{className:"mt-1 h-4 w-4 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5 group-hover:text-muted-foreground","aria-hidden":!0})]})}function ex({buId:e,onSelect:t,onCreate:n}){const{data:r,isPending:s,isError:o,refetch:a,isRefetching:c,hasNextPage:l,isFetchingNextPage:f,fetchNextPage:u}=va(e),d=le(),g=Ct(e)("manage:Role"),v=x.useMemo(()=>r?r.pages.flatMap(b=>b.data):[],[r]),h=r?.pages[0]?.pagination.totalCount??0;return s?i.jsx("div",{className:"space-y-2",children:[0,1,2].map(b=>i.jsx(de,{className:"h-16 w-full"},b))}):o?i.jsx(Me,{icon:i.jsx(pt,{className:"h-5 w-5"}),title:d.dict.roles.couldNotLoad,description:d.dict.roles.couldNotLoadDescription,action:i.jsxs(W,{variant:"outline",onClick:()=>{a()},children:[i.jsx(pt,{className:"h-3.5 w-3.5"})," ",d.dict.common.tryAgain]})}):h===0?i.jsx(Me,{icon:i.jsx(Pg,{className:"h-5 w-5"}),title:d.dict.roles.emptyTitle,description:d.dict.roles.emptyDescription,action:g?i.jsxs(W,{onClick:n,children:[i.jsx(ot,{className:"h-3.5 w-3.5"})," ",d.dict.roles.emptyCta]}):void 0}):i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsxs(W,{variant:"outline",size:"sm",onClick:()=>{a()},disabled:c,children:[i.jsx(pt,{className:c?"h-3.5 w-3.5 animate-spin":"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only",children:d.dict.common.refresh})]}),g&&i.jsxs(W,{size:"sm",onClick:n,children:[i.jsx(ot,{className:"h-3.5 w-3.5"})," ",d.dict.roles.newButton]})]}),i.jsx("ul",{className:"space-y-2",role:"list",children:v.map(b=>i.jsx("li",{children:i.jsx(Zy,{role:b,onSelect:t})},b.id))}),i.jsx(ao,{shown:v.length,total:h,hasNextPage:l,isFetchingNextPage:f,onLoadMore:()=>{u()}})]})}const Co=x.forwardRef(({className:e,...t},n)=>i.jsx("textarea",{ref:n,className:z("flex min-h-[60px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1","disabled:cursor-not-allowed disabled:opacity-50","transition-colors resize-y",e),...t}));Co.displayName="Textarea";var _r="Checkbox",[tx]=Ke(_r),[nx,So]=tx(_r);function rx(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:s,disabled:o,form:a,name:c,onCheckedChange:l,required:f,value:u="on",internal_do_not_use_render:d}=e,[p,g]=bt({prop:n,defaultProp:s??!1,onChange:l,caller:_r}),[v,h]=m.useState(null),[b,y]=m.useState(null),w=m.useRef(!1),C=v?!!a||!!v.closest("form"):!0,S={checked:p,disabled:o,setChecked:g,control:v,setControl:h,name:c,form:a,value:u,hasConsumerStoppedPropagationRef:w,required:f,defaultChecked:gt(s)?!1:s,isFormControl:C,bubbleInput:b,setBubbleInput:y};return i.jsx(nx,{scope:t,...S,children:sx(d)?d(S):r})}var dd="CheckboxTrigger",ud=m.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},s)=>{const{control:o,value:a,disabled:c,checked:l,required:f,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:p,isFormControl:g,bubbleInput:v}=So(dd,e),h=se(s,u),b=m.useRef(l);return m.useEffect(()=>{const y=o?.form;if(y){const w=()=>d(b.current);return y.addEventListener("reset",w),()=>y.removeEventListener("reset",w)}},[o,d]),i.jsx(Y.button,{type:"button",role:"checkbox","aria-checked":gt(l)?"mixed":l,"aria-required":f,"data-state":vd(l),"data-disabled":c?"":void 0,disabled:c,value:a,...r,ref:h,onKeyDown:I(t,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:I(n,y=>{d(w=>gt(w)?!0:!w),v&&g&&(p.current=y.isPropagationStopped(),p.current||y.stopPropagation())})})});ud.displayName=dd;var fd=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:o,required:a,disabled:c,value:l,onCheckedChange:f,form:u,...d}=e;return i.jsx(rx,{__scopeCheckbox:n,checked:s,defaultChecked:o,disabled:c,required:a,onCheckedChange:f,name:r,form:u,value:l,internal_do_not_use_render:({isFormControl:p})=>i.jsxs(i.Fragment,{children:[i.jsx(ud,{...d,ref:t,__scopeCheckbox:n}),p&&i.jsx(gd,{__scopeCheckbox:n})]})})});fd.displayName=_r;var md="CheckboxIndicator",hd=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,o=So(md,n);return i.jsx(Le,{present:r||gt(o.checked)||o.checked===!0,children:i.jsx(Y.span,{"data-state":vd(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});hd.displayName=md;var pd="CheckboxBubbleInput",gd=m.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:a,required:c,disabled:l,name:f,value:u,form:d,bubbleInput:p,setBubbleInput:g}=So(pd,e),v=se(n,g),h=Dl(o),b=Nl(r);m.useEffect(()=>{const w=p;if(!w)return;const C=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(C,"checked").set,P=!s.current;if(h!==o&&E){const R=new Event("click",{bubbles:P});w.indeterminate=gt(o),E.call(w,gt(o)?!1:o),w.dispatchEvent(R)}},[p,h,o,s]);const y=m.useRef(gt(o)?!1:o);return i.jsx(Y.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??y.current,required:c,disabled:l,name:f,value:u,form:d,...t,tabIndex:-1,ref:v,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});gd.displayName=pd;function sx(e){return typeof e=="function"}function gt(e){return e==="indeterminate"}function vd(e){return gt(e)?"indeterminate":e?"checked":"unchecked"}const Rs=x.forwardRef(({className:e,...t},n)=>i.jsx(fd,{ref:n,className:z("peer h-4 w-4 shrink-0 rounded-[4px] border border-input bg-background shadow-sm","transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-primary-foreground","data-[state=indeterminate]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:text-primary-foreground",e),...t,children:i.jsx(hd,{className:"flex items-center justify-center",children:t.checked==="indeterminate"?i.jsx(pg,{className:"h-3 w-3",strokeWidth:3}):i.jsx(cn,{className:"h-3 w-3",strokeWidth:3})})}));Rs.displayName="Checkbox";function ox(e){const t=new Map;for(const n of e)t.has(n.category)||t.set(n.category,[]),t.get(n.category).push(n);return Array.from(t,([n,r])=>({category:n,perms:r}))}function bd({permissions:e,value:t,onChange:n,disabled:r}){const s=le(),o=t.includes("*"),a=x.useMemo(()=>new Set(t),[t]),c=x.useMemo(()=>ox(e),[e]);if(o)return i.jsx("div",{className:"rounded-lg border border-border bg-muted/30 p-4 text-sm",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_e,{variant:"default",children:s.dict.roles.allPermissionsBadge}),i.jsx("span",{className:"text-muted-foreground",children:s.dict.roles.allPermissionsDescription})]})});const l=(u,d)=>{r||n(d?[...t,u]:t.filter(p=>p!==u))},f=(u,d)=>{if(r)return;const p=u.perms.map(g=>g.code);if(d){const g=new Set(t);for(const v of p)g.add(v);n(Array.from(g))}else n(t.filter(g=>!p.includes(g)))};return i.jsx("div",{className:"space-y-3",children:c.map(u=>{const d=u.perms.filter(v=>a.has(v.code)).length,p=d===u.perms.length,g=d>0&&!p;return i.jsxs("section",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[i.jsxs("header",{className:"flex items-center justify-between gap-3 border-b border-border bg-muted/30 px-3 py-2",children:[i.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer",children:[i.jsx(Rs,{checked:p?!0:g?"indeterminate":!1,onCheckedChange:v=>f(u,!!v),disabled:r,"aria-label":`Toggle all ${u.category} permissions`}),i.jsx("span",{className:"text-sm font-medium text-foreground",children:u.category})]}),i.jsx("span",{className:"text-xs text-muted-foreground",children:s.format(s.dict.common.selectedCountOf,{selected:d,total:u.perms.length})})]}),i.jsx("ul",{className:"divide-y divide-border",children:u.perms.map(v=>{const h=a.has(v.code);return i.jsx("li",{children:i.jsxs("label",{className:z("flex cursor-pointer items-start gap-2.5 px-3 py-2.5 transition-colors",!r&&"hover:bg-accent/30",r&&"cursor-not-allowed opacity-70"),children:[i.jsx(Rs,{className:"mt-0.5",checked:h,onCheckedChange:b=>l(v.code,!!b),disabled:r}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"truncate text-sm text-foreground",children:v.name}),i.jsx("code",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:v.code})]}),v.description&&i.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:v.description})]})]})},v.code)})})]},u.category)})})}function ix({buId:e,roleId:t,onBack:n}){const{data:r,isPending:s,isError:o,refetch:a}=qf(e,t),{data:c}=ba(e),l=Kf(e,t),f=Gf(e),u=le(),d=Rr({generic:u.dict.validation.generic,formSummary:u.dict.validation.formSummary}),g=Ct(e)("manage:Role"),[v,h]=x.useState(""),[b,y]=x.useState(""),[w,C]=x.useState([]);if(x.useEffect(()=>{r&&(h(r.name),y(r.description),C(r.permissions))},[r]),s)return i.jsxs("div",{className:"animate-in fade-in-0 duration-200 space-y-4",children:[i.jsx(de,{className:"h-9 w-40"}),i.jsx(de,{className:"h-32 w-full"}),i.jsx(de,{className:"h-64 w-full"})]});if(o)return i.jsxs("div",{className:"space-y-4",children:[i.jsxs(W,{type:"button",variant:"ghost",size:"sm",onClick:n,children:[i.jsx(Qn,{className:"h-4 w-4"}),u.dict.common.back]}),i.jsxs("div",{role:"alert",className:"rounded-md border border-destructive/40 bg-destructive/5 px-4 py-6 text-sm text-destructive",children:[i.jsx("p",{className:"font-medium",children:u.dict.roles.couldNotLoad}),i.jsx("p",{className:"mt-1 text-destructive/80",children:u.dict.roles.couldNotLoadDescription}),i.jsx(W,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:()=>a(),children:u.dict.common.tryAgain})]})]});if(!r)return i.jsxs("div",{className:"space-y-4",children:[i.jsxs(W,{type:"button",variant:"ghost",size:"sm",onClick:n,children:[i.jsx(Qn,{className:"h-4 w-4"}),u.dict.common.back]}),i.jsx("div",{className:"rounded-md border border-border bg-muted/40 px-4 py-6 text-sm text-muted-foreground",children:u.dict.roles.notFound})]});const S=v!==r.name||b!==r.description||!ax(w,r.permissions),E=r.isSystem||!g,P=async()=>{const N={},A=v.trim();if(A?A.length>80&&(N["role-name-edit"]=u.format(u.dict.validation.tooLong,{max:80})):N["role-name-edit"]=u.dict.validation.required,b.trim().length>300&&(N["role-description-edit"]=u.format(u.dict.validation.tooLong,{max:300})),!d.failClient(N))try{await l.mutateAsync({name:A,description:b.trim(),permissions:w}),ie.success(u.format(u.dict.roles.savedToast,{name:r.name}))}catch($){d.applyServer($,["role-name-edit","role-description-edit"])||ie.error(u.dict.common.actionFailed)}},R=async()=>{try{await f.mutateAsync(t),ie.success(u.format(u.dict.roles.deleteToast,{name:r.name})),n()}catch{ie.error(u.dict.roles.deleteRole)}};return i.jsxs("div",{className:"animate-in fade-in-0 slide-in-from-right-2 duration-200 space-y-5 pb-2",children:[i.jsxs("header",{className:"flex items-center gap-2",children:[i.jsx(W,{variant:"ghost",size:"icon",onClick:n,"aria-label":u.dict.common.back,children:i.jsx(Qn,{className:"h-4 w-4"})}),i.jsx("h3",{className:"text-base font-semibold text-foreground",children:r.name}),r.isSystem&&i.jsxs(_e,{variant:"muted",className:"gap-1",children:[i.jsx(Qs,{className:"h-3 w-3","aria-hidden":!0})," ",u.dict.roles.systemBadge]}),i.jsxs("span",{className:"ml-auto flex items-center gap-1 text-xs text-muted-foreground",children:[i.jsx(xn,{className:"h-3 w-3","aria-hidden":!0}),r.assignmentCount," ",u.plural(u.dict.common.member,r.assignmentCount).replace(/\{\{count\}\}/g,"")]})]}),r.isSystem&&i.jsx("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:u.dict.roles.systemBannerNote}),i.jsxs("section",{className:"space-y-3",children:[i.jsx(nn,{id:"role-name-edit",label:u.dict.roles.editorName,error:d.errors["role-name-edit"],children:i.jsx(ze,{value:v,onChange:N=>{h(N.target.value),d.clear("role-name-edit")},className:"max-w-sm",disabled:E||l.isPending})}),i.jsx(nn,{id:"role-description-edit",label:u.dict.roles.editorDescription,error:d.errors["role-description-edit"],children:i.jsx(Co,{value:b,onChange:N=>{y(N.target.value),d.clear("role-description-edit")},rows:2,placeholder:u.dict.roles.editorDescriptionPlaceholder,disabled:E||l.isPending})})]}),i.jsxs("section",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h4",{className:"text-sm font-semibold text-foreground",children:u.dict.roles.permissionsHeader}),!w.includes("*")&&i.jsx("span",{className:"text-xs text-muted-foreground",children:u.format(u.dict.common.selectedCountOf,{selected:w.length,total:c?.length??0})})]}),c?i.jsx(bd,{permissions:c,value:w,onChange:C,disabled:E||l.isPending}):i.jsx(de,{className:"h-48 w-full"})]}),!E&&i.jsxs(i.Fragment,{children:[d.formError&&i.jsx("p",{role:"alert",className:"text-sm text-destructive",children:d.formError}),i.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-border pt-4",children:[i.jsxs(ro,{children:[i.jsx(so,{asChild:!0,children:i.jsxs(W,{variant:"ghost",size:"sm",className:"text-destructive hover:bg-destructive/10",children:[i.jsx(Tc,{className:"h-3.5 w-3.5"}),u.dict.roles.deleteRole]})}),i.jsxs(Er,{children:[i.jsx(jr,{children:u.format(u.dict.roles.deleteTitle,{name:r.name})}),i.jsx(Pr,{children:u.dict.roles.deleteDescription}),i.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[i.jsx(io,{asChild:!0,children:i.jsx(W,{variant:"outline",children:u.dict.common.cancel})}),i.jsx(oo,{asChild:!0,children:i.jsx(W,{variant:"destructive",onClick:R,children:u.dict.roles.deleteConfirm})})]})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(W,{variant:"ghost",onClick:()=>{h(r.name),y(r.description),C(r.permissions),d.reset()},disabled:!S||l.isPending,children:u.dict.common.discard}),i.jsxs(W,{onClick:P,disabled:!S||l.isPending,children:[l.isPending&&i.jsx(Ve,{className:"h-3.5 w-3.5 animate-spin"}),u.dict.common.saveChanges]})]})]})]})]})}function ax(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function cx(e){return e?e.permissions.includes("*")?["*"]:[...e.permissions]:[]}function lx({buId:e,open:t,onOpenChange:n,onCreated:r}){const[s,o]=x.useState("choose"),[a,c]=x.useState(""),[l,f]=x.useState(""),[u,d]=x.useState(null),[p,g]=x.useState([]),v=x.useRef(null),{data:h}=ga(e,100),{data:b,isError:y,refetch:w}=ba(e),C=Wf(e),S=le(),E=Rr({generic:S.dict.validation.generic,formSummary:S.dict.validation.formSummary}),P=E.reset;x.useEffect(()=>{t||(o("choose"),c(""),f(""),d(null),g([]),v.current=null,P())},[t,P]);const R=h?.find(L=>L.id===u);x.useEffect(()=>{s==="clone"&&R&&v.current!==R.id&&(v.current=R.id,g(cx(R)))},[s,R]);const N=L=>{o(L),L==="blank"&&g([])},A=()=>{o("choose"),v.current=null},$=async()=>{const L={},B=a.trim();if(B?B.length>80&&(L["role-name"]=S.format(S.dict.validation.tooLong,{max:80})):L["role-name"]=S.dict.validation.required,l.trim().length>300&&(L["role-description"]=S.format(S.dict.validation.tooLong,{max:300})),!E.failClient(L))try{const F=await C.mutateAsync({name:B,description:l.trim()||void 0,permissions:p,cloneFromRoleId:s==="clone"?u??void 0:void 0});ie.success(S.format(S.dict.roles.create.createdToast,{name:F.name})),r(F.id)}catch(F){E.applyServer(F,["role-name","role-description"])||ie.error(S.dict.common.actionFailed)}};return i.jsx(Mc,{open:t,onOpenChange:n,children:i.jsxs(Xs,{className:"max-w-lg",children:[i.jsx("div",{className:"px-6 pt-6 pb-4",children:i.jsxs(kc,{children:[i.jsx(Js,{children:S.dict.roles.create.title}),i.jsxs(Zs,{children:[s==="choose"&&S.dict.roles.create.descChoose,s==="blank"&&S.dict.roles.create.descBlank,s==="clone"&&!u&&S.dict.roles.create.descClonePick,s==="clone"&&u&&S.dict.roles.create.descCloneName]})]})}),i.jsx("div",{className:"px-6 pb-6",children:s==="choose"?i.jsx(dx,{onPick:N,hasRoles:!!h&&h.length>0,t:S}):s==="clone"&&!u?i.jsx(ux,{roles:h??[],onPick:L=>d(L),t:S}):i.jsx(fx,{cloneSource:s==="clone"?R??null:null,name:a,description:l,permissions:b,permissionsError:y,onRetryPermissions:()=>{w()},perms:p,onChangePerms:g,onChangeName:L=>{c(L),E.clear("role-name")},onChangeDescription:L=>{f(L),E.clear("role-description")},errors:E.errors,formError:E.formError,onBack:A,onSubmit:()=>{$()},submitting:C.isPending,t:S})})]})})}function dx({onPick:e,hasRoles:t,t:n}){return i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Vi,{icon:i.jsx(Mg,{className:"h-4 w-4"}),title:n.dict.roles.create.blankTitle,description:n.dict.roles.create.blankDescription,onClick:()=>e("blank")}),i.jsx(Vi,{icon:i.jsx(Pc,{className:"h-4 w-4"}),title:n.dict.roles.create.cloneTitle,description:t?n.dict.roles.create.cloneDescriptionAvailable:n.dict.roles.create.cloneDescriptionUnavailable,onClick:()=>e("clone"),disabled:!t})]})}function Vi({icon:e,title:t,description:n,onClick:r,disabled:s}){return i.jsxs("button",{type:"button",onClick:r,disabled:s,className:z("flex items-start gap-3 rounded-lg border border-border bg-card p-3 text-left transition-all","hover:border-foreground/20 hover:bg-accent/50","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-card disabled:hover:border-border"),children:[i.jsx("div",{className:"mt-0.5 rounded-md bg-muted p-2 text-muted-foreground",children:e}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"text-sm font-medium text-foreground",children:t}),i.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:n})]})]})}function ux({roles:e,onPick:t,t:n}){return i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:n.dict.roles.create.pickSourcePrompt}),i.jsx("ul",{className:"space-y-1.5",role:"list",children:e.map(r=>i.jsx("li",{children:i.jsxs("button",{type:"button",onClick:()=>t(r.id),className:z("flex w-full items-center justify-between gap-3 rounded-md border border-border bg-card px-3 py-2 text-left transition-all","hover:border-foreground/20 hover:bg-accent/50","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1"),children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[i.jsx("span",{className:"truncate",children:r.name}),r.isSystem&&i.jsx(_e,{variant:"muted",className:"shrink-0",children:n.dict.roles.systemBadge})]}),r.description&&i.jsx("p",{className:"mt-0.5 line-clamp-1 text-xs text-muted-foreground",children:r.description})]}),i.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:r.permissions.includes("*")?n.dict.roles.rowAllPermissions:n.plural(n.dict.common.permission,r.permissions.length,{count:r.permissions.length})})]})},r.id))})]})}function fx({cloneSource:e,name:t,description:n,permissions:r,permissionsError:s,onRetryPermissions:o,perms:a,onChangePerms:c,onChangeName:l,onChangeDescription:f,errors:u,formError:d,onBack:p,onSubmit:g,submitting:v,t:h}){const b=a.includes("*"),y=t.trim().length>0&&a.length>0,w=e?e.permissions.includes("*")?h.dict.roles.rowAllPermissions.toLowerCase():h.plural(h.dict.common.permission,e.permissions.length,{count:e.permissions.length}):"";return i.jsxs("form",{onSubmit:C=>{C.preventDefault(),g()},className:"space-y-4",children:[e&&i.jsx("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:h.format(h.dict.roles.create.cloningFromBanner,{role:e.name,permissions:w})}),i.jsx(nn,{id:"role-name",label:h.dict.roles.create.nameField,error:u["role-name"],children:i.jsx(ze,{autoFocus:!0,value:t,onChange:C=>l(C.target.value),placeholder:h.dict.roles.create.namePlaceholder,disabled:v})}),i.jsx(nn,{id:"role-description",label:h.dict.roles.create.descriptionField,error:u["role-description"],children:i.jsx(Co,{value:n,onChange:C=>f(C.target.value),placeholder:h.dict.roles.create.descriptionPlaceholder,rows:2,disabled:v})}),i.jsxs("section",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm font-medium text-foreground",children:h.dict.roles.permissionsHeader}),!b&&r&&i.jsx("span",{className:"text-xs text-muted-foreground",children:h.format(h.dict.common.selectedCountOf,{selected:a.length,total:r.length})})]}),s?i.jsxs("div",{role:"alert",className:"rounded-lg border border-destructive/40 bg-destructive/5 px-3 py-3 text-sm text-destructive",children:[i.jsx("p",{children:h.dict.roles.create.permissionsError}),i.jsx(W,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:o,children:h.dict.common.tryAgain})]}):r?i.jsx("div",{className:"max-h-64 overflow-y-auto pr-1",children:i.jsx(bd,{permissions:r,value:a,onChange:c,disabled:v})}):i.jsx(de,{className:"h-40 w-full"}),r&&!s&&a.length===0&&i.jsx("p",{className:"text-xs text-muted-foreground",children:h.dict.roles.create.permissionsHint})]}),d&&i.jsx("p",{role:"alert",className:"text-sm text-destructive",children:d}),i.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2",children:[i.jsx(W,{type:"button",variant:"ghost",onClick:p,disabled:v,children:h.dict.common.back}),i.jsxs(W,{type:"submit",disabled:v||!y,children:[v&&i.jsx(Ve,{className:"h-3.5 w-3.5 animate-spin"}),h.dict.roles.create.submit]})]})]})}function mx(){const{data:e,isPending:t,isError:n}=an(),{data:r,isPending:s}=hr(),[o,a]=x.useState(null),[c,l]=x.useState(null),[f,u]=x.useState(!1),d=le(),p=x.useMemo(()=>!e||!r?[]:e.memberships.map(g=>g.businessUnit).filter(g=>{const v=r[g.id];return!!v&&(v.includes("*")||v.includes("manage:Role"))}),[e,r]);return x.useEffect(()=>{p.length>0&&(!o||!p.some(g=>g.id===o))&&a(p[0].id)},[o,p]),t||s?i.jsxs("div",{className:"space-y-3",children:[i.jsx(de,{className:"h-7 w-48"}),i.jsx(de,{className:"h-16 w-full"}),i.jsx(de,{className:"h-16 w-full"})]}):n?i.jsx(Me,{title:d.dict.roles.couldNotLoad,description:d.dict.roles.couldNotLoadDescription}):e.memberships.length===0?i.jsx(Me,{icon:i.jsx(Ec,{className:"h-5 w-5"}),title:d.dict.roles.noBusinessUnits,description:d.dict.businessUnits.emptyDescription}):p.length===0?i.jsx(Me,{icon:i.jsx(Qs,{className:"h-5 w-5"}),title:d.dict.roles.noAccessTitle,description:d.dict.roles.noAccessDescription}):o?i.jsxs("div",{className:"space-y-4 animate-in fade-in-0 duration-200",children:[i.jsx(Jy,{businessUnits:p,value:o,onChange:g=>{a(g),l(null)}}),c?i.jsx(ix,{buId:o,roleId:c,onBack:()=>l(null)}):i.jsx(ex,{buId:o,onSelect:l,onCreate:()=>u(!0)}),i.jsx(lx,{buId:o,open:f,onOpenChange:u,onCreated:g=>{u(!1),l(g)}})]}):null}function yd({trigger:e,open:t,onOpenChange:n,initialTab:r="business-units",initialBusinessUnitId:s}){const o=t!==void 0,{appearance:a}=te(),c=le(),l=Nt(a?.colorScheme),f=St(a),[u,d]=x.useState(0),p=x.useCallback(v=>{v&&d(h=>h+1),n?.(v)},[n]),g=r==="roles"?"roles":"business-units";return i.jsxs(Mc,{open:t,onOpenChange:p,children:[!o&&i.jsx("span",{className:z("road-ui inline-block",l==="dark"&&"dark"),style:f,children:i.jsx(Dg,{asChild:!0,children:e??i.jsx(W,{children:c.dict.shell.triggerLabel})})}),i.jsx(Xs,{className:"max-w-4xl",children:i.jsxs(Yc,{defaultValue:g,className:"flex min-h-0 flex-1 flex-col",children:[i.jsxs("div",{className:"border-b border-border px-6 pt-6 pb-3 space-y-3",children:[i.jsxs(kc,{children:[i.jsx(Js,{children:c.dict.shell.modalTitle}),i.jsx(Zs,{children:c.dict.shell.modalDescription})]}),i.jsxs(no,{children:[i.jsx(Xt,{value:"business-units",children:c.dict.shell.tabBusinessUnits}),i.jsx(Xt,{value:"roles",children:c.dict.shell.tabRoles})]})]}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 py-4",children:[i.jsx(Jt,{value:"business-units",className:"mt-0",children:i.jsx(Xy,{initialBuId:s??null})}),i.jsx(Jt,{value:"roles",className:"mt-0",children:i.jsx(mx,{})})]})]},u)})]})}function hx(e){const t=px(e),n=m.forwardRef((r,s)=>{const{children:o,...a}=r,c=m.Children.toArray(o),l=c.find(vx);if(l){const f=l.props.children,u=c.map(d=>d===l?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:d);return i.jsx(t,{...a,ref:s,children:m.isValidElement(f)?m.cloneElement(f,void 0,u):null})}return i.jsx(t,{...a,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function px(e){const t=m.forwardRef((n,r)=>{const{children:s,...o}=n;if(m.isValidElement(s)){const a=yx(s),c=bx(o,s.props);return s.type!==m.Fragment&&(c.ref=r?ct(r,a):a),m.cloneElement(s,c)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var gx=Symbol("radix.slottable");function vx(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===gx}function bx(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const l=o(...c);return s(...c),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function yx(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)}var Es=["Enter"," "],xx=["ArrowDown","PageUp","Home"],xd=["ArrowUp","PageDown","End"],wx=[...xx,...xd],Cx={ltr:[...Es,"ArrowRight"],rtl:[...Es,"ArrowLeft"]},Sx={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Mn="Menu",[Cn,Nx,Rx]=eo(Mn),[$t,wd]=Ke(Mn,[Rx,un,Sr]),Lr=un(),Cd=Sr(),[Ex,zt]=$t(Mn),[jx,An]=$t(Mn),Sd=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:a=!0}=e,c=Lr(t),[l,f]=m.useState(null),u=m.useRef(!1),d=et(o),p=Cr(s);return m.useEffect(()=>{const g=()=>{u.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>u.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),i.jsx(vo,{...c,children:i.jsx(Ex,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:f,children:i.jsx(jx,{scope:t,onClose:m.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:p,modal:a,children:r})})})};Sd.displayName=Mn;var Px="MenuAnchor",No=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Lr(n);return i.jsx(bo,{...s,...r,ref:t})});No.displayName=Px;var Ro="MenuPortal",[Tx,Nd]=$t(Ro,{forceMount:void 0}),Rd=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=zt(Ro,t);return i.jsx(Tx,{scope:t,forceMount:n,children:i.jsx(Le,{present:n||o.open,children:i.jsx(jn,{asChild:!0,container:s,children:r})})})};Rd.displayName=Ro;var Oe="MenuContent",[Mx,Eo]=$t(Oe),Ed=m.forwardRef((e,t)=>{const n=Nd(Oe,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=zt(Oe,e.__scopeMenu),a=An(Oe,e.__scopeMenu);return i.jsx(Cn.Provider,{scope:e.__scopeMenu,children:i.jsx(Le,{present:r||o.open,children:i.jsx(Cn.Slot,{scope:e.__scopeMenu,children:a.modal?i.jsx(Ax,{...s,ref:t}):i.jsx(kx,{...s,ref:t})})})})}),Ax=m.forwardRef((e,t)=>{const n=zt(Oe,e.__scopeMenu),r=m.useRef(null),s=se(t,r);return m.useEffect(()=>{const o=r.current;if(o)return Hs(o)},[]),i.jsx(jo,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:I(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),kx=m.forwardRef((e,t)=>{const n=zt(Oe,e.__scopeMenu);return i.jsx(jo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ix=hx("MenuContent.ScrollLock"),jo=m.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:f,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:p,onDismiss:g,disableOutsideScroll:v,...h}=e,b=zt(Oe,n),y=An(Oe,n),w=Lr(n),C=Cd(n),S=Nx(n),[E,P]=m.useState(null),R=m.useRef(null),N=se(t,R,b.onContentChange),A=m.useRef(0),$=m.useRef(""),L=m.useRef(0),B=m.useRef(null),F=m.useRef("right"),q=m.useRef(0),K=v?yr:m.Fragment,M=v?{as:Ix,allowPinchZoom:!0}:void 0,U=j=>{const T=$.current+j,ae=S().filter(k=>!k.disabled),fe=document.activeElement,G=ae.find(k=>k.ref.current===fe)?.textValue,ee=ae.map(k=>k.textValue),H=qx(ee,T,G),Q=ae.find(k=>k.textValue===H)?.ref.current;(function k(V){$.current=V,window.clearTimeout(A.current),V!==""&&(A.current=window.setTimeout(()=>k(""),1e3))})(T),Q&&setTimeout(()=>Q.focus())};m.useEffect(()=>()=>window.clearTimeout(A.current),[]),Vs();const O=m.useCallback(j=>F.current===B.current?.side&&Kx(j,B.current?.area),[]);return i.jsx(Mx,{scope:n,searchRef:$,onItemEnter:m.useCallback(j=>{O(j)&&j.preventDefault()},[O]),onItemLeave:m.useCallback(j=>{O(j)||(R.current?.focus(),P(null))},[O]),onTriggerLeave:m.useCallback(j=>{O(j)&&j.preventDefault()},[O]),pointerGraceTimerRef:L,onPointerGraceIntentChange:m.useCallback(j=>{B.current=j},[]),children:i.jsx(K,{...M,children:i.jsx(vr,{asChild:!0,trapped:s,onMountAutoFocus:I(o,j=>{j.preventDefault(),R.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:i.jsx(En,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:f,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:p,onDismiss:g,children:i.jsx(Fc,{asChild:!0,...C,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:P,onEntryFocus:I(l,j=>{y.isUsingKeyboardRef.current||j.preventDefault()}),preventScrollOnEntryFocus:!0,children:i.jsx(yo,{role:"menu","aria-orientation":"vertical","data-state":zd(b.open),"data-radix-menu-content":"",dir:y.dir,...w,...h,ref:N,style:{outline:"none",...h.style},onKeyDown:I(h.onKeyDown,j=>{const ae=j.target.closest("[data-radix-menu-content]")===j.currentTarget,fe=j.ctrlKey||j.altKey||j.metaKey,G=j.key.length===1;ae&&(j.key==="Tab"&&j.preventDefault(),!fe&&G&&U(j.key));const ee=R.current;if(j.target!==ee||!wx.includes(j.key))return;j.preventDefault();const Q=S().filter(k=>!k.disabled).map(k=>k.ref.current);xd.includes(j.key)&&Q.reverse(),Vx(Q)}),onBlur:I(e.onBlur,j=>{j.currentTarget.contains(j.target)||(window.clearTimeout(A.current),$.current="")}),onPointerMove:I(e.onPointerMove,Sn(j=>{const T=j.target,ae=q.current!==j.clientX;if(j.currentTarget.contains(T)&&ae){const fe=j.clientX>q.current?"right":"left";F.current=fe,q.current=j.clientX}}))})})})})})})});Ed.displayName=Oe;var Dx="MenuGroup",Po=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Y.div,{role:"group",...r,ref:t})});Po.displayName=Dx;var Ox="MenuLabel",jd=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Y.div,{...r,ref:t})});jd.displayName=Ox;var dr="MenuItem",Hi="menu.itemSelect",Fr=m.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=m.useRef(null),a=An(dr,e.__scopeMenu),c=Eo(dr,e.__scopeMenu),l=se(t,o),f=m.useRef(!1),u=()=>{const d=o.current;if(!n&&d){const p=new CustomEvent(Hi,{bubbles:!0,cancelable:!0});d.addEventListener(Hi,g=>r?.(g),{once:!0}),Va(d,p),p.defaultPrevented?f.current=!1:a.onClose()}};return i.jsx(Pd,{...s,ref:l,disabled:n,onClick:I(e.onClick,u),onPointerDown:d=>{e.onPointerDown?.(d),f.current=!0},onPointerUp:I(e.onPointerUp,d=>{f.current||d.currentTarget?.click()}),onKeyDown:I(e.onKeyDown,d=>{const p=c.searchRef.current!=="";n||p&&d.key===" "||Es.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Fr.displayName=dr;var Pd=m.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,a=Eo(dr,n),c=Cd(n),l=m.useRef(null),f=se(t,l),[u,d]=m.useState(!1),[p,g]=m.useState("");return m.useEffect(()=>{const v=l.current;v&&g((v.textContent??"").trim())},[o.children]),i.jsx(Cn.ItemSlot,{scope:n,disabled:r,textValue:s??p,children:i.jsx(Bc,{asChild:!0,...c,focusable:!r,children:i.jsx(Y.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:f,onPointerMove:I(e.onPointerMove,Sn(v=>{r?a.onItemLeave(v):(a.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:I(e.onPointerLeave,Sn(v=>a.onItemLeave(v))),onFocus:I(e.onFocus,()=>d(!0)),onBlur:I(e.onBlur,()=>d(!1))})})})}),_x="MenuCheckboxItem",Td=m.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return i.jsx(Dd,{scope:e.__scopeMenu,checked:n,children:i.jsx(Fr,{role:"menuitemcheckbox","aria-checked":ur(n)?"mixed":n,...s,ref:t,"data-state":Mo(n),onSelect:I(s.onSelect,()=>r?.(ur(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Td.displayName=_x;var Md="MenuRadioGroup",[Lx,Fx]=$t(Md,{value:void 0,onValueChange:()=>{}}),Ad=m.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=et(r);return i.jsx(Lx,{scope:e.__scopeMenu,value:n,onValueChange:o,children:i.jsx(Po,{...s,ref:t})})});Ad.displayName=Md;var kd="MenuRadioItem",Id=m.forwardRef((e,t)=>{const{value:n,...r}=e,s=Fx(kd,e.__scopeMenu),o=n===s.value;return i.jsx(Dd,{scope:e.__scopeMenu,checked:o,children:i.jsx(Fr,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":Mo(o),onSelect:I(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Id.displayName=kd;var To="MenuItemIndicator",[Dd,Bx]=$t(To,{checked:!1}),Od=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=Bx(To,n);return i.jsx(Le,{present:r||ur(o.checked)||o.checked===!0,children:i.jsx(Y.span,{...s,ref:t,"data-state":Mo(o.checked)})})});Od.displayName=To;var Ux="MenuSeparator",_d=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Y.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});_d.displayName=Ux;var $x="MenuArrow",Ld=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Lr(n);return i.jsx(xo,{...s,...r,ref:t})});Ld.displayName=$x;var zx="MenuSub",[y0,Fd]=$t(zx),gn="MenuSubTrigger",Bd=m.forwardRef((e,t)=>{const n=zt(gn,e.__scopeMenu),r=An(gn,e.__scopeMenu),s=Fd(gn,e.__scopeMenu),o=Eo(gn,e.__scopeMenu),a=m.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,f={__scopeMenu:e.__scopeMenu},u=m.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return m.useEffect(()=>u,[u]),m.useEffect(()=>{const d=c.current;return()=>{window.clearTimeout(d),l(null)}},[c,l]),i.jsx(No,{asChild:!0,...f,children:i.jsx(Pd,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":zd(n.open),...e,ref:ct(t,s.onTriggerChange),onClick:d=>{e.onClick?.(d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:I(e.onPointerMove,Sn(d=>{o.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:I(e.onPointerLeave,Sn(d=>{u();const p=n.content?.getBoundingClientRect();if(p){const g=n.content?.dataset.side,v=g==="right",h=v?-5:5,b=p[v?"left":"right"],y=p[v?"right":"left"];o.onPointerGraceIntentChange({area:[{x:d.clientX+h,y:d.clientY},{x:b,y:p.top},{x:y,y:p.top},{x:y,y:p.bottom},{x:b,y:p.bottom}],side:g}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(d),d.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:I(e.onKeyDown,d=>{const p=o.searchRef.current!=="";e.disabled||p&&d.key===" "||Cx[r.dir].includes(d.key)&&(n.onOpenChange(!0),n.content?.focus(),d.preventDefault())})})})});Bd.displayName=gn;var Ud="MenuSubContent",$d=m.forwardRef((e,t)=>{const n=Nd(Oe,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=zt(Oe,e.__scopeMenu),a=An(Oe,e.__scopeMenu),c=Fd(Ud,e.__scopeMenu),l=m.useRef(null),f=se(t,l);return i.jsx(Cn.Provider,{scope:e.__scopeMenu,children:i.jsx(Le,{present:r||o.open,children:i.jsx(Cn.Slot,{scope:e.__scopeMenu,children:i.jsx(jo,{id:c.contentId,"aria-labelledby":c.triggerId,...s,ref:f,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{a.isUsingKeyboardRef.current&&l.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:I(e.onFocusOutside,u=>{u.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:I(e.onEscapeKeyDown,u=>{a.onClose(),u.preventDefault()}),onKeyDown:I(e.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),p=Sx[a.dir].includes(u.key);d&&p&&(o.onOpenChange(!1),c.trigger?.focus(),u.preventDefault())})})})})})});$d.displayName=Ud;function zd(e){return e?"open":"closed"}function ur(e){return e==="indeterminate"}function Mo(e){return ur(e)?"indeterminate":e?"checked":"unchecked"}function Vx(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Hx(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function qx(e,t,n){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=Hx(e,Math.max(o,0));s.length===1&&(a=a.filter(f=>f!==n));const l=a.find(f=>f.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function Wx(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const c=t[o],l=t[a],f=c.x,u=c.y,d=l.x,p=l.y;u>r!=p>r&&n<(d-f)*(r-u)/(p-u)+f&&(s=!s)}return s}function Kx(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Wx(n,t)}function Sn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Gx=Sd,Qx=No,Yx=Rd,Xx=Ed,Jx=Po,Zx=jd,ew=Fr,tw=Td,nw=Ad,rw=Id,sw=Od,ow=_d,iw=Ld,aw=Bd,cw=$d,Br="DropdownMenu",[lw]=Ke(Br,[wd]),Ne=wd(),[dw,Vd]=lw(Br),Hd=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:o,onOpenChange:a,modal:c=!0}=e,l=Ne(t),f=m.useRef(null),[u,d]=bt({prop:s,defaultProp:o??!1,onChange:a,caller:Br});return i.jsx(dw,{scope:t,triggerId:$e(),triggerRef:f,contentId:$e(),open:u,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(p=>!p),[d]),modal:c,children:i.jsx(Gx,{...l,open:u,onOpenChange:d,dir:r,modal:c,children:n})})};Hd.displayName=Br;var qd="DropdownMenuTrigger",Wd=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=Vd(qd,n),a=Ne(n);return i.jsx(Qx,{asChild:!0,...a,children:i.jsx(Y.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:ct(t,o.triggerRef),onPointerDown:I(e.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(o.onOpenToggle(),o.open||c.preventDefault())}),onKeyDown:I(e.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&o.onOpenToggle(),c.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});Wd.displayName=qd;var uw="DropdownMenuPortal",Kd=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ne(t);return i.jsx(Yx,{...r,...n})};Kd.displayName=uw;var Gd="DropdownMenuContent",Qd=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Vd(Gd,n),o=Ne(n),a=m.useRef(!1);return i.jsx(Xx,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:t,onCloseAutoFocus:I(e.onCloseAutoFocus,c=>{a.current||s.triggerRef.current?.focus(),a.current=!1,c.preventDefault()}),onInteractOutside:I(e.onInteractOutside,c=>{const l=c.detail.originalEvent,f=l.button===0&&l.ctrlKey===!0,u=l.button===2||f;(!s.modal||u)&&(a.current=!0)}),style:{...e.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)"}})});Qd.displayName=Gd;var fw="DropdownMenuGroup",mw=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ne(n);return i.jsx(Jx,{...s,...r,ref:t})});mw.displayName=fw;var hw="DropdownMenuLabel",Yd=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ne(n);return i.jsx(Zx,{...s,...r,ref:t})});Yd.displayName=hw;var pw="DropdownMenuItem",Xd=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ne(n);return i.jsx(ew,{...s,...r,ref:t})});Xd.displayName=pw;var gw="DropdownMenuCheckboxItem",vw=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ne(n);return i.jsx(tw,{...s,...r,ref:t})});vw.displayName=gw;var bw="DropdownMenuRadioGroup",yw=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ne(n);return i.jsx(nw,{...s,...r,ref:t})});yw.displayName=bw;var xw="DropdownMenuRadioItem",ww=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ne(n);return i.jsx(rw,{...s,...r,ref:t})});ww.displayName=xw;var Cw="DropdownMenuItemIndicator",Sw=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ne(n);return i.jsx(sw,{...s,...r,ref:t})});Sw.displayName=Cw;var Nw="DropdownMenuSeparator",Jd=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ne(n);return i.jsx(ow,{...s,...r,ref:t})});Jd.displayName=Nw;var Rw="DropdownMenuArrow",Ew=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ne(n);return i.jsx(iw,{...s,...r,ref:t})});Ew.displayName=Rw;var jw="DropdownMenuSubTrigger",Pw=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ne(n);return i.jsx(aw,{...s,...r,ref:t})});Pw.displayName=jw;var Tw="DropdownMenuSubContent",Mw=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Ne(n);return i.jsx(cw,{...s,...r,ref:t,style:{...e.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)"}})});Mw.displayName=Tw;var Aw=Hd,kw=Wd,Iw=Kd,Dw=Qd,Ow=Yd,_w=Xd,Lw=Jd;const Fw=Aw,qi=kw,Xn=x.forwardRef(({className:e,...t},n)=>i.jsx(Lw,{ref:n,className:z("-mx-1 my-1 h-px bg-border",e),...t}));Xn.displayName="DropdownMenuSeparator";const Ao=x.forwardRef(({className:e,...t},n)=>i.jsx(Ow,{ref:n,className:z("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t}));Ao.displayName="DropdownMenuLabel";const js=x.forwardRef(({className:e,sideOffset:t=6,...n},r)=>{const{appearance:s}=te(),o=Nt(s?.colorScheme),a=St(s);return i.jsx(Iw,{children:i.jsx("div",{className:z("road-ui",o==="dark"&&"dark"),style:a,children:i.jsx(Dw,{ref:r,sideOffset:t,className:z("z-[70] min-w-[16rem] overflow-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95","data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),...n})})})});js.displayName="DropdownMenuContent";const fr=x.forwardRef(({className:e,inset:t,...n},r)=>i.jsx(_w,{ref:r,className:z("relative flex w-full cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));fr.displayName="DropdownMenuItem";var Bw=Symbol("radix.slottable");function Uw(e){const t=({children:n})=>i.jsx(i.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Bw,t}var[Ur]=Ke("Tooltip",[un]),$r=un(),Zd="TooltipProvider",$w=700,Ps="tooltip.open",[zw,ko]=Ur(Zd),eu=e=>{const{__scopeTooltip:t,delayDuration:n=$w,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:o}=e,a=m.useRef(!0),c=m.useRef(!1),l=m.useRef(0);return m.useEffect(()=>{const f=l.current;return()=>window.clearTimeout(f)},[]),i.jsx(zw,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(l.current),a.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:m.useCallback(f=>{c.current=f},[]),disableHoverableContent:s,children:o})};eu.displayName=Zd;var Nn="Tooltip",[Vw,kn]=Ur(Nn),tu=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:o,disableHoverableContent:a,delayDuration:c}=e,l=ko(Nn,e.__scopeTooltip),f=$r(t),[u,d]=m.useState(null),p=$e(),g=m.useRef(0),v=a??l.disableHoverableContent,h=c??l.delayDuration,b=m.useRef(!1),[y,w]=bt({prop:r,defaultProp:s??!1,onChange:R=>{R?(l.onOpen(),document.dispatchEvent(new CustomEvent(Ps))):l.onClose(),o?.(R)},caller:Nn}),C=m.useMemo(()=>y?b.current?"delayed-open":"instant-open":"closed",[y]),S=m.useCallback(()=>{window.clearTimeout(g.current),g.current=0,b.current=!1,w(!0)},[w]),E=m.useCallback(()=>{window.clearTimeout(g.current),g.current=0,w(!1)},[w]),P=m.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{b.current=!0,w(!0),g.current=0},h)},[h,w]);return m.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]),i.jsx(vo,{...f,children:i.jsx(Vw,{scope:t,contentId:p,open:y,stateAttribute:C,trigger:u,onTriggerChange:d,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayedRef.current?P():S()},[l.isOpenDelayedRef,P,S]),onTriggerLeave:m.useCallback(()=>{v?E():(window.clearTimeout(g.current),g.current=0)},[E,v]),onOpen:S,onClose:E,disableHoverableContent:v,children:n})})};tu.displayName=Nn;var Ts="TooltipTrigger",nu=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=kn(Ts,n),o=ko(Ts,n),a=$r(n),c=m.useRef(null),l=se(t,c,s.onTriggerChange),f=m.useRef(!1),u=m.useRef(!1),d=m.useCallback(()=>f.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),i.jsx(bo,{asChild:!0,...a,children:i.jsx(Y.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:l,onPointerMove:I(e.onPointerMove,p=>{p.pointerType!=="touch"&&!u.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),u.current=!0)}),onPointerLeave:I(e.onPointerLeave,()=>{s.onTriggerLeave(),u.current=!1}),onPointerDown:I(e.onPointerDown,()=>{s.open&&s.onClose(),f.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:I(e.onFocus,()=>{f.current||s.onOpen()}),onBlur:I(e.onBlur,s.onClose),onClick:I(e.onClick,s.onClose)})})});nu.displayName=Ts;var Io="TooltipPortal",[Hw,qw]=Ur(Io,{forceMount:void 0}),ru=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,o=kn(Io,t);return i.jsx(Hw,{scope:t,forceMount:n,children:i.jsx(Le,{present:n||o.open,children:i.jsx(jn,{asChild:!0,container:s,children:r})})})};ru.displayName=Io;var sn="TooltipContent",su=m.forwardRef((e,t)=>{const n=qw(sn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...o}=e,a=kn(sn,e.__scopeTooltip);return i.jsx(Le,{present:r||a.open,children:a.disableHoverableContent?i.jsx(ou,{side:s,...o,ref:t}):i.jsx(Ww,{side:s,...o,ref:t})})}),Ww=m.forwardRef((e,t)=>{const n=kn(sn,e.__scopeTooltip),r=ko(sn,e.__scopeTooltip),s=m.useRef(null),o=se(t,s),[a,c]=m.useState(null),{trigger:l,onClose:f}=n,u=s.current,{onPointerInTransitChange:d}=r,p=m.useCallback(()=>{c(null),d(!1)},[d]),g=m.useCallback((v,h)=>{const b=v.currentTarget,y={x:v.clientX,y:v.clientY},w=Xw(y,b.getBoundingClientRect()),C=Jw(y,w),S=Zw(h.getBoundingClientRect()),E=t0([...C,...S]);c(E),d(!0)},[d]);return m.useEffect(()=>()=>p(),[p]),m.useEffect(()=>{if(l&&u){const v=b=>g(b,u),h=b=>g(b,l);return l.addEventListener("pointerleave",v),u.addEventListener("pointerleave",h),()=>{l.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",h)}}},[l,u,g,p]),m.useEffect(()=>{if(a){const v=h=>{const b=h.target,y={x:h.clientX,y:h.clientY},w=l?.contains(b)||u?.contains(b),C=!e0(y,a);w?p():C&&(p(),f())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,u,a,f,p]),i.jsx(ou,{...e,ref:o})}),[Kw,Gw]=Ur(Nn,{isInside:!1}),Qw=Uw("TooltipContent"),ou=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:a,...c}=e,l=kn(sn,n),f=$r(n),{onClose:u}=l;return m.useEffect(()=>(document.addEventListener(Ps,u),()=>document.removeEventListener(Ps,u)),[u]),m.useEffect(()=>{if(l.trigger){const d=p=>{p.target?.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),i.jsx(En,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:i.jsxs(yo,{"data-state":l.stateAttribute,...f,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[i.jsx(Qw,{children:r}),i.jsx(Kw,{scope:n,isInside:!0,children:i.jsx(sy,{id:l.contentId,role:"tooltip",children:s||r})})]})})});su.displayName=sn;var iu="TooltipArrow",Yw=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=$r(n);return Gw(iu,n).isInside?null:i.jsx(xo,{...s,...r,ref:t})});Yw.displayName=iu;function Xw(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,s,o)){case o:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Jw(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Zw(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function e0(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const c=t[o],l=t[a],f=c.x,u=c.y,d=l.x,p=l.y;u>r!=p>r&&n<(d-f)*(r-u)/(p-u)+f&&(s=!s)}return s}function t0(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),n0(t)}function n0(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const o=t[t.length-1],a=t[t.length-2];if((o.x-a.x)*(s.y-a.y)>=(o.y-a.y)*(s.x-a.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const o=n[n.length-1],a=n[n.length-2];if((o.x-a.x)*(s.y-a.y)>=(o.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var r0=eu,s0=tu,o0=nu,i0=ru,a0=su;const c0=r0,Wi=s0,Ki=o0,Ms=x.forwardRef(({className:e,sideOffset:t=6,...n},r)=>{const{appearance:s}=te(),o=Nt(s?.colorScheme),a=St(s);return i.jsx(i0,{children:i.jsx("div",{className:z("road-ui",o==="dark"&&"dark"),style:a,children:i.jsx(a0,{ref:r,sideOffset:t,className:z("z-[70] overflow-hidden rounded-md border border-border bg-popover px-2.5 py-1.5 text-xs text-popover-foreground shadow-md","data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...n})})})});Ms.displayName="TooltipContent";const l0=5,Gi=180;function d0({collapsed:e,className:t}){const{data:n,isLoading:r,isError:s,refetch:o}=an(),a=ya(),c=xa(),l=le(),{appearance:f}=te(),u=Nt(f?.colorScheme),d=St(f),p=x.useRef(null),[g,v]=x.useState(!1);x.useEffect(()=>{if(e!==void 0)return;const j=p.current;if(!j)return;v(j.getBoundingClientRect().width<Gi);const T=new ResizeObserver(([ae])=>{ae&&v(ae.contentRect.width<Gi)});return T.observe(j),()=>T.disconnect()},[e]);const h=e??g,[b,y]=x.useState(!1),[w,C]=x.useState("business-units"),[S,E]=x.useState(void 0),[P,R]=x.useState(""),N=n?.memberships??[],A=n?.pendingInvitations??[],$=N.length>=l0,L=x.useMemo(()=>{if(!P.trim())return N;const j=P.trim().toLowerCase();return N.filter(T=>T.businessUnit.name.toLowerCase().includes(j)||T.businessUnit.slug.toLowerCase().includes(j))},[N,P]),B=x.useMemo(()=>N.find(j=>j.businessUnit.id===a?.id)??null,[N,a]),F=j=>{C(j?.tab??"business-units"),E(j?.buId),y(!0)},q=j=>{j!==a?.id&&c(j),R("")},K=(j,T)=>i.jsxs(i.Fragment,{children:[i.jsx("span",{ref:p,className:z("road-ui inline-block w-full",u==="dark"&&"dark"),style:d,children:i.jsx(c0,{delayDuration:250,children:i.jsxs(Fw,{children:[j,T]})})}),i.jsx(yd,{open:b,onOpenChange:y,initialTab:w,initialBusinessUnitId:S})]});if(r)return K(i.jsxs("div",{className:z("flex w-full items-center gap-3 rounded-lg p-2",h&&"justify-center",t),children:[i.jsx(de,{className:"h-9 w-9 shrink-0 rounded-full"}),!h&&i.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[i.jsx(de,{className:"h-3.5 w-24"}),i.jsx(de,{className:"h-2.5 w-16"})]})]}),null);if(s)return K(i.jsxs("button",{type:"button",onClick:()=>{o()},className:z("flex w-full items-center gap-3 rounded-lg border border-destructive/40 bg-destructive/5 p-2 text-left text-sm text-destructive transition-colors hover:bg-destructive/10",h&&"justify-center",t),"aria-label":l.dict.switcher.errorTitle,children:[i.jsx(lg,{className:"h-5 w-5 shrink-0","aria-hidden":!0}),!h&&i.jsx("span",{className:"truncate",children:l.dict.switcher.errorRetry})]}),null);if(N.length===0&&A.length===0)return K(i.jsxs("button",{type:"button",onClick:()=>F({tab:"business-units"}),className:z("flex w-full items-center gap-3 rounded-lg border border-dashed border-border p-2 text-left text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",h&&"justify-center",t),"aria-label":l.dict.switcher.emptyCta,children:[i.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-dashed border-border",children:i.jsx(ot,{className:"h-4 w-4","aria-hidden":!0})}),!h&&i.jsx("span",{className:"truncate",children:l.dict.switcher.emptyCta})]}),null);if(N.length===0){const j=i.jsx(qi,{asChild:!0,children:i.jsxs("button",{type:"button",className:z("flex w-full items-center gap-3 rounded-lg border border-primary/30 bg-primary/5 p-2 text-left transition-colors hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","data-[state=open]:bg-primary/10",h&&"justify-center",t),"aria-label":l.plural(l.dict.switcher.pendingCount,A.length),children:[i.jsxs("div",{className:"relative shrink-0",children:[i.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-primary/10 text-primary",children:i.jsx(wr,{className:"h-4 w-4","aria-hidden":!0})}),i.jsx("span",{className:"absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold text-primary-foreground ring-2 ring-background",children:A.length})]}),!h&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:l.dict.switcher.invitedTitle}),i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:l.plural(l.dict.switcher.pendingCount,A.length)})]}),i.jsx(ps,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0})]})]})});return K(h?i.jsxs(Wi,{children:[i.jsx(Ki,{asChild:!0,children:j}),i.jsxs(Ms,{side:"right",children:[i.jsx("div",{className:"font-medium",children:l.dict.switcher.invitedTitle}),i.jsx("div",{className:"text-muted-foreground",children:l.plural(l.dict.switcher.pendingCount,A.length)})]})]}):j,i.jsxs(js,{align:h?"start":"end",side:h?"right":"bottom",className:"w-80",children:[i.jsx(Qi,{invitations:A}),i.jsx(Xn,{}),i.jsxs(fr,{onSelect:()=>F({tab:"business-units"}),children:[i.jsx(ot,{className:"h-4 w-4 text-muted-foreground","aria-hidden":!0}),i.jsx("span",{children:l.dict.switcher.emptyCta})]})]}))}const M=i.jsx(qi,{asChild:!0,children:i.jsxs("button",{type:"button",className:z("flex w-full items-center gap-3 rounded-lg p-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",h&&"justify-center",t),"aria-label":a?`${l.dict.switcher.triggerCurrentLabel}: ${a.name}`:l.dict.switcher.triggerSelectLabel,children:[i.jsxs("div",{className:"relative shrink-0",children:[i.jsx(Et,{name:a?.name??"?",size:"md"}),A.length>0&&i.jsx("span",{className:z("absolute -right-1 -top-1 flex items-center justify-center rounded-full bg-primary text-[10px] font-semibold text-primary-foreground ring-2 ring-background",h?"h-4 w-4":"h-4 min-w-4 px-1"),"aria-label":l.plural(l.dict.switcher.pendingCount,A.length),children:h?"":A.length})]}),!h&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:a?.name??l.dict.switcher.triggerSelectLabel}),B&&B.roles[0]&&i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:B.roles[0].name})]}),i.jsx(ps,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0})]})]})}),U=h?i.jsxs(Wi,{children:[i.jsx(Ki,{asChild:!0,children:M}),i.jsxs(Ms,{side:"right",children:[i.jsx("div",{className:"font-medium",children:a?.name??l.dict.switcher.triggerSelectLabel}),B?.roles[0]&&i.jsx("div",{className:"text-muted-foreground",children:B.roles[0].name}),A.length>0&&i.jsx("div",{className:"mt-1 text-primary",children:l.plural(l.dict.switcher.pendingCount,A.length)})]})]}):M,O=i.jsxs(js,{align:h?"start":"end",side:h?"right":"bottom",className:"w-80",children:[A.length>0&&i.jsxs(i.Fragment,{children:[i.jsx(Qi,{invitations:A}),i.jsx(Xn,{})]}),i.jsx(Ao,{children:l.dict.switcher.switcherHeader}),$&&i.jsx("div",{className:"px-1 pb-1.5",children:i.jsx(ze,{value:P,onChange:j=>R(j.target.value),placeholder:l.dict.switcher.searchPlaceholder,className:"h-8 text-xs",onKeyDown:j=>j.stopPropagation(),autoFocus:!0})}),L.length===0?i.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:l.dict.switcher.noMatches}):i.jsx("div",{className:"max-h-72 overflow-y-auto",children:L.map(j=>i.jsx(u0,{membership:j,isCurrent:j.businessUnit.id===a?.id,onSelect:()=>q(j.businessUnit.id),currentBadge:l.dict.switcher.currentBadge,suspendedLabel:l.dict.common.suspended},j.businessUnit.id))}),i.jsx(Xn,{}),i.jsxs(fr,{onSelect:()=>F({tab:"business-units"}),children:[i.jsx(Eg,{className:"h-4 w-4 text-muted-foreground","aria-hidden":!0}),i.jsx("span",{children:l.dict.switcher.manageCta})]})]});return K(U,O)}function u0({membership:e,isCurrent:t,onSelect:n,currentBadge:r,suspendedLabel:s}){const{businessUnit:o,status:a,roles:c}=e,l=c[0],f=a==="suspended";return i.jsxs(fr,{onSelect:u=>{if(f){u.preventDefault();return}n()},"aria-current":t?"true":void 0,className:z("py-2",t&&"bg-accent/40",f&&"opacity-60"),children:[i.jsx(Et,{name:o.name,size:"sm"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"truncate text-sm font-medium",children:o.name}),t&&i.jsx(_e,{variant:"muted",className:"h-4 px-1.5 text-[10px]",children:r}),f&&i.jsx(_e,{variant:"danger",className:"h-4 px-1.5 text-[10px]",children:s})]}),l&&i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:l.name})]}),t&&i.jsx(cn,{className:"h-4 w-4 shrink-0 text-primary","aria-hidden":!0})]})}function Qi({invitations:e}){const t=le();return i.jsxs(i.Fragment,{children:[i.jsxs(Ao,{className:"flex items-center gap-2",children:[i.jsx(wr,{className:"h-3.5 w-3.5","aria-hidden":!0}),t.dict.switcher.pendingInvitationsHeader,i.jsx(_e,{variant:"default",className:"h-4 px-1.5",children:e.length})]}),e.map(n=>i.jsx(f0,{invitation:n},n.id))]})}function f0({invitation:e}){const t=ha(),n=pa(),r=le(),s=t.isPending||n.isPending,o=async c=>{c.stopPropagation(),c.preventDefault();try{await t.mutateAsync(e.id),ie.success(r.format(r.dict.members.joined,{businessUnit:e.businessUnit.name}))}catch{ie.error(r.dict.members.couldNotLoad)}},a=async c=>{c.stopPropagation(),c.preventDefault();try{await n.mutateAsync(e.id),ie.message(r.format(r.dict.members.declined,{businessUnit:e.businessUnit.name}))}catch{ie.error(r.dict.members.couldNotLoad)}};return i.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-2",children:[i.jsx(Et,{name:e.businessUnit.name,size:"sm"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-sm font-medium",children:e.businessUnit.name}),i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:e.roleName})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsx(W,{variant:"ghost",size:"sm",onClick:a,disabled:s,"aria-label":r.dict.members.decline,className:"h-7 w-7 p-0",children:n.isPending?i.jsx(Ve,{className:"h-3.5 w-3.5 animate-spin"}):i.jsx(Ys,{className:"h-3.5 w-3.5"})}),i.jsx(W,{size:"sm",onClick:o,disabled:s,"aria-label":r.dict.members.accept,className:"h-7 w-7 p-0",children:t.isPending?i.jsx(Ve,{className:"h-3.5 w-3.5 animate-spin"}):i.jsx(cn,{className:"h-3.5 w-3.5"})})]})]})}const au=e=>new Promise(t=>setTimeout(t,e)),xe=()=>Math.random().toString(36).slice(2,10);function tn(e,t){const n=t?.limit??20,r=t?.cursor?Math.max(0,parseInt(t.cursor,10)||0):0,s=e.slice(r,r+n),o=r+n,a=o<e.length;return{data:s,pagination:{cursor:a?String(o):null,hasMore:a,totalCount:e.length}}}function De(e){return e.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function m0(e={}){const t=e.latency??350,n=e.empty?cu():lu();async function r(){if(await au(t),e.failWith)throw new Error(e.failWith)}return{async getCurrentUser(){return await r(),{id:"current-user",name:"You",email:"you@example.com"}},async getMyBusinessUnits(){return await r(),{memberships:n.businessUnits.map(o=>({businessUnit:{id:o.id,name:o.name,slug:o.slug},status:"active",joinedAt:o.createdAt,roles:n.userRoles[o.id]??[]})),pendingInvitations:n.pendingInvitations}},async getMyPermissions(){await r();const s={};for(const o of n.businessUnits){const a=n.userRoles[o.id]??[],c=(n.roles[o.id]??[]).filter(l=>a.some(f=>f.id===l.id));if(c.some(l=>l.permissions.includes("*")))s[o.id]=["*"];else{const l=new Set;for(const f of c)for(const u of f.permissions)l.add(u);s[o.id]=Array.from(l)}}return s},async getBusinessUnit(s){await r();const o=n.businessUnits.find(a=>a.id===s);if(!o)throw new Error("Business unit not found");return{...o,memberCount:(n.members[s]??[]).length}},async createBusinessUnit(s){await r();const o={id:xe(),name:s.name,slug:s.slug??De(s.name),status:"active",memberCount:1,memberLimit:s.memberLimit??null,joinCode:xe().toUpperCase(),createdAt:new Date().toISOString(),iamScopeId:`scope-${xe()}`};return n.businessUnits=[o,...n.businessUnits],n.userRoles[o.id]=[{id:"role-owner",name:"Owner"}],n.members[o.id]=[{id:xe(),userId:"current-user",status:"active",joinedAt:o.createdAt,name:"You",email:"you@example.com",roles:[{id:"role-owner",name:"Owner"}]}],n.roles[o.id]=Dt({includeBilling:!1,customCount:0}),n.permissions[o.id]=vt(o.iamScopeId),o},async updateBusinessUnit(s,o){await r();const a=n.businessUnits.find(c=>c.id===s);if(!a)throw new Error("Business unit not found");return o.name!==void 0&&(a.name=o.name),o.joinCode!==void 0&&(a.joinCode=o.joinCode),o.memberLimit!==void 0&&(a.memberLimit=o.memberLimit),{...a,memberCount:(n.members[s]??[]).length}},async listMembers(s,o){return await r(),tn(n.members[s]??[],o)},async suspendMember(s,o){await r();const a=(n.members[s]??[]).find(c=>c.id===o);a&&(a.status="suspended")},async reinstateMember(s,o){await r();const a=(n.members[s]??[]).find(c=>c.id===o);a&&(a.status="active")},async removeMember(s,o){await r(),n.members[s]=(n.members[s]??[]).filter(a=>a.id!==o)},async listInvitations(s,o){return await r(),tn(n.invitations[s]??[],o)},async createInvitation(s,o){await r();const a=(n.roles[s]??[]).find(l=>l.id===o.roleId),c={id:xe(),email:o.email,roleId:o.roleId,roleName:a?.name??"Member",status:"pending",invitedAt:new Date().toISOString(),expiresAt:new Date(Date.now()+14*864e5).toISOString()};return n.invitations[s]=[c,...n.invitations[s]??[]],c},async cancelInvitation(s,o){await r(),n.invitations[s]=(n.invitations[s]??[]).map(a=>a.id===o?{...a,status:"cancelled"}:a)},async resendInvitation(s,o){await r(),n.invitations[s]=(n.invitations[s]??[]).map(a=>a.id===o?{...a,invitedAt:new Date().toISOString(),expiresAt:new Date(Date.now()+14*864e5).toISOString()}:a)},async acceptInvitation(s){await r();const o=n.pendingInvitations.findIndex(f=>f.id===s);if(o<0)throw new Error("Invitation not found");const a=n.pendingInvitations[o];n.pendingInvitations.splice(o,1);const c={id:a.businessUnit.id,name:a.businessUnit.name,slug:a.businessUnit.slug,status:"active",memberCount:1,memberLimit:null,joinCode:null,createdAt:new Date().toISOString(),iamScopeId:`scope-${a.businessUnit.id}`};n.businessUnits.find(f=>f.id===c.id)||(n.businessUnits=[c,...n.businessUnits]);const l=a.roleName;n.userRoles[c.id]=[{id:`role-${l.toLowerCase()}`,name:l}],n.members[c.id]=[{id:xe(),userId:"current-user",status:"active",joinedAt:new Date().toISOString(),name:"You",email:"you@example.com",roles:[{id:`role-${l.toLowerCase()}`,name:l}]}],n.roles[c.id]=Dt({includeBilling:!1,customCount:0}),n.permissions[c.id]=vt(c.iamScopeId)},async rejectInvitation(s){await r(),n.pendingInvitations=n.pendingInvitations.filter(o=>o.id!==s)},async listRoles(s,o){return await r(),tn(n.roles[s]??[],o)},async getRole(s,o){await r();const a=(n.roles[s]??[]).find(c=>c.id===o);if(!a)throw new Error("Role not found");return a},async createRole(s,o){await r();const a={id:xe(),name:o.name,description:o.description??"",permissions:[...o.permissions],isSystem:!1,assignmentCount:0,createdAt:new Date().toISOString()};return n.roles[s]=[a,...n.roles[s]??[]],a},async updateRole(s,o,a){await r();const c=(n.roles[s]??[]).find(l=>l.id===o);if(!c)throw new Error("Role not found");return a.name!==void 0&&(c.name=a.name),a.description!==void 0&&(c.description=a.description??""),a.permissions!==void 0&&(c.permissions=[...a.permissions]),{...c}},async deleteRole(s,o){if(await r(),(n.roles[s]??[]).find(c=>c.id===o)?.isSystem)throw new Error("System roles cannot be deleted");n.roles[s]=(n.roles[s]??[]).filter(c=>c.id!==o)},async listPermissions(s){return await r(),n.permissions[s]??[]},async authorizeBatch(s,o){if(await r(),o.length===0)return{};const a=n.userRoles[s]??[],c=(n.roles[s]??[]).filter(d=>a.some(p=>p.id===d.id));if(c.some(d=>d.permissions.includes("*")))return Object.fromEntries(o.map(d=>[d,!0]));const f=new Set;for(const d of c)for(const p of d.permissions)f.add(p);const u=["create","read","update","delete"];for(const d of[...f]){const[p,g]=d.split(":");if(p==="manage"&&g)for(const v of u)f.add(`${v}:${g}`)}return Object.fromEntries(o.map(d=>[d,f.has(d)]))}}}function cu(){return{businessUnits:[],userRoles:{},members:{},invitations:{},pendingInvitations:[],roles:{},permissions:{}}}function lu(){const e={id:"bu-acme",name:"Acme Corp",slug:"acme-corp",status:"active",memberCount:12,memberLimit:50,joinCode:"ACME-7K9P",createdAt:"2025-09-14T10:30:00Z",iamScopeId:"scope-bu-acme"},t={id:"bu-horizon",name:"Horizon Labs",slug:"horizon-labs",status:"active",memberCount:4,memberLimit:null,joinCode:null,createdAt:"2026-01-08T14:12:00Z",iamScopeId:"scope-bu-horizon"},n={id:"bu-aurora",name:"Aurora Studio",slug:"aurora-studio",status:"active",memberCount:28,memberLimit:30,joinCode:"AUR-2025",createdAt:"2024-11-02T09:00:00Z",iamScopeId:"scope-bu-aurora"};return{businessUnits:[e,t,n],userRoles:{[e.id]:[{id:"role-owner",name:"Owner"}],[t.id]:[{id:"role-admin",name:"Admin"}],[n.id]:[{id:"role-member",name:"Member"}]},members:{[e.id]:ns(e.id,12,"Owner"),[t.id]:ns(t.id,4,"Admin"),[n.id]:ns(n.id,28,"Member")},invitations:{[e.id]:[{id:"inv-1",email:"alex@example.com",roleId:"role-member",roleName:"Member",status:"pending",invitedAt:"2026-05-20T08:00:00Z",expiresAt:"2026-06-03T08:00:00Z"}],[t.id]:[],[n.id]:[]},pendingInvitations:[{id:"my-inv-1",businessUnit:{id:"bu-northwind",name:"Northwind Trading",slug:"northwind"},roleName:"Member",expiresAt:new Date(Date.now()+5*864e5).toISOString()}],roles:{[e.id]:Dt({includeBilling:!0,customCount:1}),[t.id]:Dt({includeBilling:!1,customCount:0}),[n.id]:Dt({includeBilling:!0,customCount:2})},permissions:{[e.id]:vt(e.iamScopeId),[t.id]:vt(t.iamScopeId),[n.id]:vt(n.iamScopeId)}}}const du=[{code:"read:Member",name:"View members",description:"View members of this business unit",category:"Member"},{code:"manage:Member",name:"Manage members",description:"Invite, suspend, or remove members",category:"Member"},{code:"read:Role",name:"View roles",description:"View roles defined in this business unit",category:"Role"},{code:"manage:Role",name:"Manage roles",description:"Create, edit, or delete roles",category:"Role"},{code:"read:BUDashboard",name:"View business unit",description:"View business unit details and dashboard",category:"Business unit"},{code:"update:BUSettings",name:"Edit business unit settings",description:"Update name, identifier, member limit, etc.",category:"Business unit"},{code:"manage:BUSettings",name:"Manage business unit settings",description:"Full control over business unit settings (implies update).",category:"Business unit"},{code:"read:Invitation",name:"View invitations",description:"View pending invitations",category:"Invitation"},{code:"manage:Invitation",name:"Manage invitations",description:"Send, resend, or cancel invitations",category:"Invitation"},{code:"read:Billing",name:"View billing",description:"View billing details and invoices",category:"Billing"},{code:"manage:Billing",name:"Manage billing",description:"Update payment methods and billing settings",category:"Billing"}];function vt(e){return du.map(t=>({id:`perm-${t.code}`,...t,scopeId:e,createdAt:"2024-01-01T00:00:00.000Z"}))}function Dt({includeBilling:e,customCount:t}){const n=du.filter(a=>e||a.category!=="Billing").map(a=>a.code),r=n.filter(a=>a.startsWith("read:")),s=n.filter(a=>!a.startsWith("manage:Billing")),o=[{id:"role-owner",name:"Owner",description:"Full access to everything in this business unit.",permissions:["*"],isSystem:!0,assignmentCount:1,createdAt:"2024-01-01T00:00:00.000Z"},{id:"role-admin",name:"Admin",description:"Manage members, roles, and business unit settings.",permissions:s,isSystem:!0,assignmentCount:2,createdAt:"2024-01-01T00:00:00.000Z"},{id:"role-member",name:"Member",description:"Read-only access to members, roles, and business unit details.",permissions:r,isSystem:!0,assignmentCount:9,createdAt:"2024-01-01T00:00:00.000Z"}];return t>=1&&o.push({id:"role-custom-support",name:"Support",description:"Read members and invitations; can manage invitations.",permissions:["read:Member","read:Invitation","manage:Invitation"],isSystem:!1,assignmentCount:3,createdAt:"2024-01-01T00:00:00.000Z"}),t>=2&&o.push({id:"role-custom-billing",name:"Billing manager",description:"Manage billing without member or role access.",permissions:["read:Billing","manage:Billing"],isSystem:!1,assignmentCount:1,createdAt:"2024-01-01T00:00:00.000Z"}),o}const Yi=["Alex","Bea","Caio","Dani","Eva","Felipe","Gabi","Hugo","Ines","João","Karina","Lucas","Maria","Nico","Olivia","Pedro","Quintino","Rita","Sofia","Tomás","Ulysses","Vera","Wagner","Xavier","Yara","Zé","Antonio","Bia"];function ns(e,t,n){return Array.from({length:t}).map((r,s)=>{const o=Yi[s%Yi.length],a=s===0?"You":`${o} ${["Silva","Santos","Oliveira","Costa"][s%4]}`,c=s===0?n:["Admin","Member","Member","Member"][s%4]??"Member";return{id:`m-${e}-${s}`,userId:s===0?"current-user":`u-${s}`,status:s===3?"suspended":"active",joinedAt:new Date(Date.now()-s*864e5*7).toISOString(),name:a,email:s===0?"you@example.com":`${o.toLowerCase()}.${s}@example.com`,roles:[{id:`role-${c.toLowerCase()}`,name:c}]}})}class uu{draft;constructor(){this.draft={state:cu(),latency:0}}withLatency(t){return this.draft.latency=t,this}withRichSeed(){return this.draft.state=lu(),this}withBusinessUnit(t){const n=t.id??`bu-${De(t.name)}`,r=t.slug??De(t.name),s=t.role??"Owner",o=t.wildcard??s==="Owner",a={id:n,name:t.name,slug:r,status:"active",memberCount:1,memberLimit:t.memberLimit??null,joinCode:null,createdAt:new Date().toISOString(),iamScopeId:`scope-${n}`};this.draft.state.businessUnits.push(a);const c=`role-${De(s)}`,l=[{id:c,name:s,description:o?`Full access (${s}).`:`${s} access.`,permissions:o?["*"]:["read:Member","read:Role","read:BUDashboard"],isSystem:!0,assignmentCount:1,createdAt:a.createdAt}];return this.draft.state.roles[n]=l,this.draft.state.userRoles[n]=[{id:c,name:s}],this.draft.state.members[n]=[{id:`m-${n}-self`,userId:"current-user",status:"active",joinedAt:a.createdAt,name:"You",email:"you@example.com",roles:[{id:c,name:s}]}],this.draft.state.invitations[n]=[],this.draft.state.permissions[n]=vt(a.iamScopeId),this}withMember(t,n){const r=this.requireBu(t),s=n.role??"Member",o={id:`m-${r.id}-${this.draft.state.members[r.id]?.length??0}`,userId:`u-${De(n.email)}`,status:n.status??"active",joinedAt:new Date().toISOString(),name:n.name,email:n.email,roles:[{id:`role-${De(s)}`,name:s}]};return this.draft.state.members[r.id]=[...this.draft.state.members[r.id]??[],o],this}withRole(t,n){const r=this.requireBu(t),s={id:`role-${De(n.name)}`,name:n.name,description:n.description??"",permissions:[...n.permissions],isSystem:n.isSystem??!1,assignmentCount:0,createdAt:r.createdAt};return this.draft.state.roles[r.id]=[...this.draft.state.roles[r.id]??[],s],this}withInvitation(t,n){const r=this.requireBu(t),s={id:`inv-${De(n.email)}-${xe()}`,email:n.email,roleId:`role-${De(n.roleName)}`,roleName:n.roleName,status:"pending",invitedAt:new Date().toISOString(),expiresAt:new Date(Date.now()+(n.expiresInDays??14)*864e5).toISOString()};return this.draft.state.invitations[r.id]=[s,...this.draft.state.invitations[r.id]??[]],this}withPendingInvitation(t){return this.draft.state.pendingInvitations.push({id:`pinv-${xe()}`,businessUnit:{id:t.businessUnit.id??`bu-${De(t.businessUnit.name)}`,name:t.businessUnit.name,slug:t.businessUnit.slug??De(t.businessUnit.name)},roleName:t.roleName,expiresAt:new Date(Date.now()+(t.expiresInDays??5)*864e5).toISOString()}),this}withScenario(t){return this.draft.scenario=t,this}withCookieMode(t={}){return this.draft.onUnauthenticated=t.onUnauthenticated,this}build(){return g0(this.draft)}requireBu(t){const n=this.draft.state.businessUnits.find(r=>r.name===t);if(!n)throw new Error(`MockClientBuilder: business unit "${t}" not found — call withBusinessUnit("${t}") first.`);return n}}function h0(){return new uu}const p0=1e3;function g0(e){const t=e.state;let n=0;async function r(){if(e.latency>0&&await au(e.latency),!!e.scenario)switch(e.scenario){case"network-error":throw new Error("Mock scenario: network-error");case"auth-error":{if(e.onUnauthenticated){const s=Date.now();if(s-n>=p0){n=s;try{e.onUnauthenticated()}catch{}}}throw new Error("Mock scenario: auth-error (401)")}case"rate-limit":throw new Error("Mock scenario: rate-limit (429)");case"server-error":throw new Error("Mock scenario: server-error (5xx)")}}return{async getCurrentUser(){return await r(),{id:"current-user",name:"You",email:"you@example.com"}},async getMyBusinessUnits(){return await r(),{memberships:t.businessUnits.map(o=>({businessUnit:{id:o.id,name:o.name,slug:o.slug},status:"active",joinedAt:o.createdAt,roles:t.userRoles[o.id]??[]})),pendingInvitations:t.pendingInvitations}},async getMyPermissions(){await r();const s={};for(const o of t.businessUnits){const a=t.userRoles[o.id]??[],c=(t.roles[o.id]??[]).filter(l=>a.some(f=>f.id===l.id));if(c.some(l=>l.permissions.includes("*")))s[o.id]=["*"];else{const l=new Set;for(const f of c)for(const u of f.permissions)l.add(u);s[o.id]=Array.from(l)}}return s},async getBusinessUnit(s){await r();const o=t.businessUnits.find(a=>a.id===s);if(!o)throw new Error("Business unit not found");return{...o,memberCount:(t.members[s]??[]).length}},async createBusinessUnit(s){await r();const o={id:xe(),name:s.name,slug:s.slug??De(s.name),status:"active",memberCount:1,memberLimit:s.memberLimit??null,joinCode:xe().toUpperCase(),createdAt:new Date().toISOString(),iamScopeId:`scope-${xe()}`};return t.businessUnits=[o,...t.businessUnits],t.userRoles[o.id]=[{id:"role-owner",name:"Owner"}],t.members[o.id]=[{id:xe(),userId:"current-user",status:"active",joinedAt:o.createdAt,name:"You",email:"you@example.com",roles:[{id:"role-owner",name:"Owner"}]}],t.roles[o.id]=Dt({includeBilling:!1,customCount:0}),t.permissions[o.id]=vt(o.iamScopeId),o},async updateBusinessUnit(s,o){await r();const a=t.businessUnits.find(c=>c.id===s);if(!a)throw new Error("Business unit not found");return o.name!==void 0&&(a.name=o.name),o.joinCode!==void 0&&(a.joinCode=o.joinCode),o.memberLimit!==void 0&&(a.memberLimit=o.memberLimit),{...a,memberCount:(t.members[s]??[]).length}},async listMembers(s,o){return await r(),tn(t.members[s]??[],o)},async suspendMember(s,o){await r();const a=(t.members[s]??[]).find(c=>c.id===o);a&&(a.status="suspended")},async reinstateMember(s,o){await r();const a=(t.members[s]??[]).find(c=>c.id===o);a&&(a.status="active")},async removeMember(s,o){await r(),t.members[s]=(t.members[s]??[]).filter(a=>a.id!==o)},async listInvitations(s,o){return await r(),tn(t.invitations[s]??[],o)},async createInvitation(s,o){await r();const a=(t.roles[s]??[]).find(l=>l.id===o.roleId),c={id:xe(),email:o.email,roleId:o.roleId,roleName:a?.name??"Member",status:"pending",invitedAt:new Date().toISOString(),expiresAt:new Date(Date.now()+14*864e5).toISOString()};return t.invitations[s]=[c,...t.invitations[s]??[]],c},async cancelInvitation(s,o){await r(),t.invitations[s]=(t.invitations[s]??[]).map(a=>a.id===o?{...a,status:"cancelled"}:a)},async resendInvitation(s,o){await r(),t.invitations[s]=(t.invitations[s]??[]).map(a=>a.id===o?{...a,invitedAt:new Date().toISOString(),expiresAt:new Date(Date.now()+14*864e5).toISOString()}:a)},async acceptInvitation(s){await r();const o=t.pendingInvitations.findIndex(u=>u.id===s);if(o<0)throw new Error("Invitation not found");const a=t.pendingInvitations[o];t.pendingInvitations.splice(o,1);const c={id:a.businessUnit.id,name:a.businessUnit.name,slug:a.businessUnit.slug,status:"active",memberCount:1,memberLimit:null,joinCode:null,createdAt:new Date().toISOString(),iamScopeId:`scope-${a.businessUnit.id}`};t.businessUnits.find(u=>u.id===c.id)||(t.businessUnits=[c,...t.businessUnits]);const l=a.roleName,f=`role-${l.toLowerCase()}`;t.userRoles[c.id]=[{id:f,name:l}],t.members[c.id]=[{id:xe(),userId:"current-user",status:"active",joinedAt:new Date().toISOString(),name:"You",email:"you@example.com",roles:[{id:f,name:l}]}],t.roles[c.id]=Dt({includeBilling:!1,customCount:0}),t.permissions[c.id]=vt(c.iamScopeId)},async rejectInvitation(s){await r(),t.pendingInvitations=t.pendingInvitations.filter(o=>o.id!==s)},async listRoles(s,o){return await r(),tn(t.roles[s]??[],o)},async getRole(s,o){await r();const a=(t.roles[s]??[]).find(c=>c.id===o);if(!a)throw new Error("Role not found");return a},async createRole(s,o){await r();const a={id:xe(),name:o.name,description:o.description??"",permissions:[...o.permissions],isSystem:!1,assignmentCount:0,createdAt:new Date().toISOString()};return t.roles[s]=[a,...t.roles[s]??[]],a},async updateRole(s,o,a){await r();const c=(t.roles[s]??[]).find(l=>l.id===o);if(!c)throw new Error("Role not found");return a.name!==void 0&&(c.name=a.name),a.description!==void 0&&(c.description=a.description??""),a.permissions!==void 0&&(c.permissions=[...a.permissions]),{...c}},async deleteRole(s,o){if(await r(),(t.roles[s]??[]).find(c=>c.id===o)?.isSystem)throw new Error("System roles cannot be deleted");t.roles[s]=(t.roles[s]??[]).filter(c=>c.id!==o)},async listPermissions(s){return await r(),t.permissions[s]??[]},async authorizeBatch(s,o){if(await r(),o.length===0)return{};const a=t.userRoles[s]??[],c=(t.roles[s]??[]).filter(d=>a.some(p=>p.id===d.id));if(c.some(d=>d.permissions.includes("*")))return Object.fromEntries(o.map(d=>[d,!0]));const f=new Set;for(const d of c)for(const p of d.permissions)f.add(p);const u=["create","read","update","delete"];for(const d of[...f]){const[p,g]=d.split(":");if(p==="manage"&&g)for(const v of u)f.add(`${v}:${g}`)}return Object.fromEntries(o.map(d=>[d,f.has(d)]))}}}Object.defineProperty(exports,"ROAD_API_URLS",{enumerable:!0,get:()=>Rn.ROAD_API_URLS});Object.defineProperty(exports,"ROAD_CORE_ACTIONS",{enumerable:!0,get:()=>Rn.ROAD_CORE_ACTIONS});Object.defineProperty(exports,"ROAD_CORE_SUBJECTS",{enumerable:!0,get:()=>Rn.ROAD_CORE_SUBJECTS});Object.defineProperty(exports,"ROAD_WILDCARD_PERMISSION",{enumerable:!0,get:()=>Rn.ROAD_WILDCARD_PERMISSION});exports.BusinessUnitSwitcher=d0;exports.BusinessUnitsMgmt=yd;exports.HttpRoadClient=Na;exports.MockClientBuilder=uu;exports.RoadApiError=We;exports.RoadAuthError=vn;exports.RoadConflictError=Ls;exports.RoadForbiddenError=wa;exports.RoadNetworkError=Us;exports.RoadNotFoundError=Ca;exports.RoadProvider=ih;exports.RoadRateLimitError=Sa;exports.RoadServerError=Bs;exports.RoadValidationError=Fs;exports.createMockClient=m0;exports.mockClientBuilder=h0;exports.useCan=Ct;exports.useCanMany=_f;exports.useCurrentBusinessUnit=ya;exports.useCurrentBusinessUnitId=gr;exports.useCurrentUser=Df;exports.useInfiniteInvitations=ma;exports.useInfiniteMembers=fa;exports.useInfiniteRoles=va;exports.useMyBusinessUnits=an;exports.useMyPermissions=hr;exports.useRoad=te;exports.useRoadClient=Of;exports.useSetCurrentBusinessUnit=xa;exports.useT=le;
56
+ //# sourceMappingURL=index.cjs.map