@nest-my-admin/ui 0.9.1 → 0.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index-D0EWijdw.css +1 -0
- package/dist/assets/{index-DZLnB_iH.js → index-DhqKuO_A.js} +7 -7
- package/dist/assets/{rich-text-input-C7t6OWlx.js → rich-text-input-CIWHT51G.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/messages.json +1 -1
- package/package.json +1 -1
- package/dist/assets/index-DLKcT4XT.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./rich-text-input-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./rich-text-input-CIWHT51G.js","./rich-text-input-CmZdYwUT.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var j=/\/+/g;function M(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function N(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ee(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ee(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+M(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(j,`$&/`)+`/`),ee(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(j,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+M(a,u),c+=ee(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+M(a,u++),c+=ee(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ee(N(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return ee(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var te=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function ne(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,te)}catch(e){te(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function re(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else ne(re.bind(null,e))}var ie={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ie,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=re,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return D(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)E.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=ne,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.0`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.0`})),m=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=f(),n=u(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}function h(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&h(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function g(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=g(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var x=null,S=null;function C(e,t,n){return e===n||e===t&&(x=e,!0)}function w(e,t,n){return e===n?(S=e,!1):e===t&&(S!==null&&(x=e),!0)}function T(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function E(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var D=Object.assign,O=Symbol.for(`react.element`),k=Symbol.for(`react.transitional.element`),A=Symbol.for(`react.portal`),j=Symbol.for(`react.fragment`),M=Symbol.for(`react.strict_mode`),N=Symbol.for(`react.profiler`),ee=Symbol.for(`react.consumer`),P=Symbol.for(`react.context`),F=Symbol.for(`react.forward_ref`),te=Symbol.for(`react.suspense`),ne=Symbol.for(`react.suspense_list`),re=Symbol.for(`react.memo`),ie=Symbol.for(`react.lazy`),ae=Symbol.for(`react.activity`),oe=Symbol.for(`react.legacy_hidden`),se=Symbol.for(`react.memo_cache_sentinel`),ce=Symbol.for(`react.view_transition`),le=Symbol.for(`react.recoverable`),ue=Symbol.iterator;function de(e){return typeof e!=`object`||!e?null:(e=ue&&e[ue]||e[`@@iterator`],typeof e==`function`?e:null)}var fe=Symbol.for(`react.client.reference`);function pe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===fe?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case j:return`Fragment`;case N:return`Profiler`;case M:return`StrictMode`;case te:return`Suspense`;case ne:return`SuspenseList`;case ae:return`Activity`;case ce:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case A:return`Portal`;case P:return e.displayName||`Context`;case ee:return(e._context.displayName||`Context`)+`.Consumer`;case F:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case re:return t=e.displayName||null,t===null?pe(e.type)||`Memo`:t;case ie:t=e._payload,e=e._init;try{return pe(e(t))}catch{}}return null}var me=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},ge=[],_e=-1;function ve(e){return{current:e}}function ye(e){0>_e||(e.current=ge[_e],ge[_e]=null,_e--)}function be(e,t){_e++,ge[_e]=e.current,e.current=t}var xe=ve(null),Se=ve(null),Ce=ve(null),we=ve(null);function Te(e,t){switch(be(Ce,t),be(Se,e),be(xe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?_p(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=_p(t),e=vp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ye(xe),be(xe,e)}function Ee(){ye(xe),ye(Se),ye(Ce)}function De(e){var t=e.memoizedState;t!==null&&(mh._currentValue=t.memoizedState,be(we,e)),t=xe.current;var n=vp(t,e.type);t!==n&&(be(Se,e),be(xe,n))}function Oe(e){Se.current===e&&(ye(xe),ye(Se)),we.current===e&&(ye(we),mh._currentValue=he)}var ke,Ae;function je(e){if(ke===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ke=t&&t[1]||``,Ae=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+ke+e+Ae}var Me=!1;function Ne(e,t){if(!e||Me)return``;Me=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -47,11 +47,11 @@ Error generating stack: `+e.message+`
|
|
|
47
47
|
`},ad=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},od=function(){y.useEffect(function(){return document.body.setAttribute(G,(ad()+1).toString()),function(){var e=ad()-1;e<=0?document.body.removeAttribute(G):document.body.setAttribute(G,e.toString())}},[])},sd=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;od();var a=y.useMemo(function(){return nd(i)},[i]);return y.createElement(rd,{styles:id(a,!t,i,n?``:`!important`)})},cd=!1;if(typeof window<`u`)try{var ld=Object.defineProperty({},"passive",{get:function(){return cd=!0,!0}});window.addEventListener(`test`,ld,ld),window.removeEventListener(`test`,ld,ld)}catch{cd=!1}var ud=cd?{passive:!1}:!1,dd=function(e){return e.tagName===`TEXTAREA`},fd=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!dd(e)&&n[t]===`visible`)},pd=function(e){return fd(e,`overflowY`)},md=function(e){return fd(e,`overflowX`)},hd=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),vd(e,r)){var i=yd(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},gd=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},_d=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},vd=function(e,t){return e===`v`?pd(t):md(t)},yd=function(e,t){return e===`v`?gd(t):_d(t)},bd=function(e,t){return e===`h`&&t===`rtl`?-1:1},xd=function(e,t,n,r,i){var a=bd(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=yd(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&vd(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Sd=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Cd=function(e){return[e.deltaX,e.deltaY]},wd=function(e){return e&&`current`in e?e.current:e},Td=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Ed=function(e){return`
|
|
48
48
|
.block-interactivity-${e} {pointer-events: none;}
|
|
49
49
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
50
|
-
`},Dd=0,Od=[];function kd(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),i=y.useState(Dd++)[0],a=y.useState(Qu)[0],o=y.useRef(e);y.useEffect(function(){o.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Ou([e.lockRef.current],(e.shards||[]).map(wd),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=y.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Sd(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=hd(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=hd(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return xd(h,t,e,h===`h`?s:c,!0)},[]),c=y.useCallback(function(e){var n=e;if(Od.length&&Od[Od.length-1]===a){var r=`deltaY`in n?Cd(n):Sd(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Td(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(wd).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=y.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Ad(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=y.useCallback(function(e){n.current=Sd(e),r.current=void 0},[]),d=y.useCallback(function(t){l(t.type,Cd(t),t.target,s(t,e.lockRef.current))},[]),f=y.useCallback(function(t){l(t.type,Sd(t),t.target,s(t,e.lockRef.current))},[]);y.useEffect(function(){return Od.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,ud),document.addEventListener(`touchmove`,c,ud),document.addEventListener(`touchstart`,u,ud),function(){Od=Od.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,ud),document.removeEventListener(`touchmove`,c,ud),document.removeEventListener(`touchstart`,u,ud)}},[]);var p=e.removeScrollBar,m=e.inert;return y.createElement(y.Fragment,null,m?y.createElement(a,{styles:Ed(i)}):null,p?y.createElement(sd,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ad(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var jd=Hu(Uu,kd),Md=y.forwardRef(function(e,t){return y.createElement(Gu,Eu({},e,{ref:t,sideCar:jd}))});Md.classNames=Gu.classNames;var Nd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Pd=new WeakMap,Fd=new WeakMap,Id={},Ld=0,Rd=function(e){return e&&(e.host||Rd(e.parentNode))},zd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Rd(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Bd=function(e,t,n,r){var i=zd(t,Array.isArray(e)?e:[e]);Id[n]||(Id[n]=new WeakMap);var a=Id[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Pd.get(e)||0)+1,l=(a.get(e)||0)+1;Pd.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Fd.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Ld++,function(){o.forEach(function(e){var t=Pd.get(e)-1,i=a.get(e)-1;Pd.set(e,t),a.set(e,i),t||(Fd.has(e)||e.removeAttribute(r),Fd.delete(e)),i||e.removeAttribute(n)}),Ld--,Ld||(Pd=new WeakMap,Pd=new WeakMap,Fd=new WeakMap,Id={})}},Vd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Nd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Bd(r,i,n,`aria-hidden`)):function(){return null}},Hd=Object.defineProperty,Ud=(e,t)=>Hd(e,`name`,{value:t,configurable:!0}),Wd=`Dialog`,[Gd,Kd]=Ic(Wd),[qd,Jd]=Gd(Wd),Yd=Ud(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=y.useRef(null),c=y.useRef(null),[l,u]=ml({prop:r,defaultProp:i??!1,onChange:a,caller:Wd}),[d,f]=y.useState(0),[p,m]=y.useState(0);return(0,b.jsx)(qd,{scope:t,triggerRef:s,contentRef:c,contentId:Ml(),titleId:Ml(),descriptionId:Ml(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:y.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Xd=`DialogTrigger`,Zd=y.forwardRef(Ud(function(e,t){let{__scopeDialog:n,...r}=e,i=Jd(Xd,n),a=uc(t,i.triggerRef);return(0,b.jsx)(Ac.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":gf(i.open),...r,ref:a,onClick:el(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),Qd=`DialogPortal`,[$d,ef]=Gd(Qd,{forceMount:void 0}),tf=Ud(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Jd(Qd,t);return(0,b.jsx)($d,{scope:t,forceMount:n,children:y.Children.map(r,e=>(0,b.jsx)(Sl,{present:n||a.open,children:(0,b.jsx)(vu,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),nf=`DialogOverlay`,rf=y.forwardRef(Ud(function(e,t){let n=ef(nf,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Jd(nf,e.__scopeDialog);return a.modal?(0,b.jsx)(Sl,{present:r||a.open,children:(0,b.jsx)(of,{...i,ref:t})}):null},`DialogOverlay`)),af=pc(`DialogOverlay.RemoveScroll`),of=y.forwardRef(Ud(function(e,t){let{__scopeDialog:n,...r}=e,i=Jd(nf,n),a=uc(t,Jl());return(0,b.jsx)(Md,{as:af,allowPinchZoom:!0,shards:[i.contentRef],children:(0,b.jsx)(Ac.div,{"data-state":gf(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),sf=`DialogContent`,cf=y.forwardRef(Ud(function(e,t){let n=ef(sf,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Jd(sf,e.__scopeDialog);return(0,b.jsx)(Sl,{present:r||a.open,children:a.modal?(0,b.jsx)(lf,{...i,ref:t}):(0,b.jsx)(uf,{...i,ref:t})})},`DialogContent`)),lf=y.forwardRef(Ud(function(e,t){let n=Jd(sf,e.__scopeDialog),r=y.useRef(null),i=uc(t,n.contentRef,r);return y.useEffect(()=>{let e=r.current;if(e)return Vd(e)},[]),(0,b.jsx)(df,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:el(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:el(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:el(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),uf=y.forwardRef(Ud(function(e,t){let n=Jd(sf,e.__scopeDialog),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(df,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),df=y.forwardRef(Ud(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Jd(sf,n);return wu(),(0,b.jsx)(b.Fragment,{children:(0,b.jsx)(au,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,b.jsx)(ql,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":gf(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),ff=`DialogTitle`,pf=y.forwardRef(Ud(function(e,t){let{__scopeDialog:n,...r}=e,i=Jd(ff,n),{setTitleCount:a}=i;return al(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,b.jsx)(Ac.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),mf=`DialogClose`,hf=y.forwardRef(Ud(function(e,t){let{__scopeDialog:n,...r}=e,i=Jd(mf,n);return(0,b.jsx)(Ac.button,{type:`button`,...r,ref:t,onClick:el(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function gf(e){return e?`open`:`closed`}Ud(gf,`getState`);var _f=Object.defineProperty,vf=(e,t)=>_f(e,`name`,{value:t,configurable:!0});function yf(e){let[t,n]=y.useState(void 0);return al(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}vf(yf,`useSize`);var bf=Object.defineProperty,xf=(e,t)=>bf(e,`name`,{value:t,configurable:!0}),Sf=`Checkbox`,[Cf,wf]=Ic(Sf),[Tf,Ef]=Cf(Sf);function Df(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=ml({prop:n,defaultProp:i??!1,onChange:c,caller:Sf}),[m,h]=y.useState(null),[g,_]=y.useState(null),v=y.useRef(!1),[x,S]=y.useReducer(e=>e+1,0),C=!m||!!o||!!m.closest(`form`),w={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:x,onUserInteraction:S,required:l,defaultChecked:!If(i)&&i,isFormControl:C,bubbleInput:g,setBubbleInput:_};return(0,b.jsx)(Tf,{scope:t,...w,children:Ff(d)?d(w):r})}xf(Df,`CheckboxProvider`);var Of=`CheckboxTrigger`,kf=y.forwardRef(xf(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=Ef(Of,e),g=uc(i,u),_=y.useRef(c);return y.useEffect(()=>{let e=a?.form;if(e){let t=xf(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,b.jsx)(Ac.button,{type:`button`,role:`checkbox`,"aria-checked":If(c)?`mixed`:c,"aria-required":l,"data-state":Lf(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:el(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:el(n,e=>{p(),d(e=>If(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),Af=y.forwardRef(xf(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,b.jsx)(Df,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(kf,{...d,ref:t,__scopeCheckbox:n}),e&&(0,b.jsx)(Pf,{__scopeCheckbox:n})]})})},`Checkbox`)),jf=`CheckboxIndicator`,Mf=y.forwardRef(xf(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Ef(jf,n);return(0,b.jsx)(Sl,{present:r||If(a.checked)||a.checked===!0,children:(0,b.jsx)(Ac.span,{"data-state":Lf(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),Nf=`CheckboxBubbleInput`,Pf=y.forwardRef(xf(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=Ef(Nf,e),g=uc(r,h),_=yf(i),v=y.useRef(!1),x=y.useRef(s),S=y.useRef(o);y.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==S.current;S.current=o;let i=x.current!==s;x.current=s;let c=!(r&&a.current);if(i&&n){v.current=!r;let t=new Event(`click`,{bubbles:c});e.indeterminate=If(s),n.call(e,!If(s)&&s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let C=y.useRef(!If(s)&&s);return(0,b.jsx)(Ac.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??C.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:el(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function Ff(e){return typeof e==`function`}xf(Ff,`isFunction`);function If(e){return e===`indeterminate`}xf(If,`isIndeterminate`);function Lf(e){return If(e)?`indeterminate`:e?`checked`:`unchecked`}xf(Lf,`getState`);var Rf=[`top`,`right`,`bottom`,`left`],zf=Math.min,Bf=Math.max,Vf=Math.round,Hf=Math.floor,Uf=e=>({x:e,y:e}),Wf={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Gf(e,t,n){return Bf(e,zf(t,n))}function Kf(e,t){return typeof e==`function`?e(t):e}function qf(e){return e.split(`-`)[0]}function K(e){return e.split(`-`)[1]}function Jf(e){return e===`x`?`y`:`x`}function Yf(e){return e===`y`?`height`:`width`}function Xf(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Zf(e){return Jf(Xf(e))}function Qf(e,t,n){n===void 0&&(n=!1);let r=K(e),i=Zf(e),a=Yf(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=sp(o)),[o,sp(o)]}function $f(e){let t=sp(e);return[ep(e),t,ep(t)]}function ep(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var tp=[`left`,`right`],np=[`right`,`left`],rp=[`top`,`bottom`],ip=[`bottom`,`top`];function ap(e,t,n){switch(e){case`top`:case`bottom`:return n?t?np:tp:t?tp:np;case`left`:case`right`:return t?rp:ip;default:return[]}}function op(e,t,n,r){let i=K(e),a=ap(qf(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ep)))),a}function sp(e){let t=qf(e);return Wf[t]+e.slice(t.length)}function cp(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function lp(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:cp(e)}function up(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function dp(e,t,n){let{reference:r,floating:i}=e,a=Xf(t),o=Zf(t),s=Yf(o),c=qf(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=K(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function fp(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Kf(t,e),p=lp(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=up(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=up(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var pp=50,mp=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:fp},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=dp(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<pp&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=dp(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},hp=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Kf(e,t)||{};if(l==null)return{};let d=lp(u),f={x:n,y:r},p=Zf(i),m=Yf(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=zf(d[_],T),D=zf(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=Gf(E,k,O),j=!c.arrow&&K(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),gp=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Kf(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=qf(r),_=Xf(o),v=qf(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[sp(o)]:$f(o)),x=p!==`none`;!d&&x&&b.push(...op(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Qf(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Xf(t)||T.every(e=>Xf(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Xf(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function _p(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function vp(e){return Rf.some(t=>e[t]>=0)}var yp=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Kf(e,t);switch(i){case`referenceHidden`:{let e=_p(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:vp(e)}}}case`escaped`:{let e=_p(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:vp(e)}}}default:return{}}}}},bp=new Set([`left`,`top`]);async function xp(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=qf(n),s=K(n),c=Xf(n)===`y`,l=bp.has(o)?-1:1,u=a&&c?-1:1,d=Kf(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Sp=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await xp(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Cp=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Kf(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Xf(i),p=Jf(f),m=u[p],h=u[f],g=(e,t)=>Gf(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},wp=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Kf(e,t),u={x:n,y:r},d=Xf(i),f=Jf(d),p=u[f],m=u[d],h=Kf(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=bp.has(qf(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Tp=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Kf(e,t),c=await i.detectOverflow(t,s),l=qf(n),u=K(n),d=Xf(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=zf(p-c[m],g),y=zf(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Bf(c.left,c.right):S=p-2*Bf(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Ep(){return typeof window<`u`}function Dp(e){return Ap(e)?(e.nodeName||``).toLowerCase():`#document`}function Op(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function kp(e){return((Ap(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ap(e){return Ep()?e instanceof Node||e instanceof Op(e).Node:!1}function jp(e){return Ep()?e instanceof Element||e instanceof Op(e).Element:!1}function Mp(e){return Ep()?e instanceof HTMLElement||e instanceof Op(e).HTMLElement:!1}function Np(e){return!Ep()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Op(e).ShadowRoot}function Pp(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Gp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Fp(e){return/^(table|td|th)$/.test(Dp(e))}function Ip(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Lp=/transform|translate|scale|rotate|perspective|filter/,Rp=/paint|layout|strict|content/,zp=e=>!!e&&e!==`none`,Bp;function Vp(e){let t=jp(e)?Gp(e):e;return zp(t.transform)||zp(t.translate)||zp(t.scale)||zp(t.rotate)||zp(t.perspective)||!Up()&&(zp(t.backdropFilter)||zp(t.filter))||Lp.test(t.willChange||``)||Rp.test(t.contain||``)}function Hp(e){let t=qp(e);for(;Mp(t)&&!Wp(t);){if(Vp(t))return t;if(Ip(t))return null;t=qp(t)}return null}function Up(){return Bp??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Bp}function Wp(e){return/^(html|body|#document)$/.test(Dp(e))}function Gp(e){return Op(e).getComputedStyle(e)}function Kp(e){return jp(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function qp(e){if(Dp(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Np(e)&&e.host||kp(e);return Np(t)?t.host:t}function Jp(e){let t=qp(e);return Wp(t)?(e.ownerDocument||e).body:Mp(t)&&Pp(t)?t:Jp(t)}function Yp(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Jp(e),i=r===e.ownerDocument?.body,a=Op(r);if(i){let e=Xp(a);return t.concat(a,a.visualViewport||[],Pp(r)?r:[],e&&n?Yp(e):[])}return t.concat(r,Yp(r,[],n))}function Xp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Zp(e){let t=Gp(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Mp(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Vf(n)!==a||Vf(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Qp(e){return jp(e)?e:e.contextElement}function $p(e){let t=Qp(e);if(!Mp(t))return Uf(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Zp(t),o=(a?Vf(n.width):n.width)/r,s=(a?Vf(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var em=Uf(0);function tm(e){let t=Op(e);return!Up()||!t.visualViewport?em:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nm(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Op(e)}function rm(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Qp(e),o=Uf(1);t&&(r?jp(r)&&(o=$p(r)):o=$p(e));let s=nm(a,n,r)?tm(a):Uf(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Op(a),t=jp(r)?Op(r):r,n=e,i=Xp(n);for(;i&&t!==n;){let e=$p(i),t=i.getBoundingClientRect(),r=Gp(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Op(i),i=Xp(n)}}return up({width:u,height:d,x:c,y:l})}function im(e,t){let n=Kp(e).scrollLeft;return t?t.left+n:rm(kp(e)).left+n}function am(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-im(e,n),y:n.top+t.scrollTop}}function om(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=kp(r),s=t?Ip(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Uf(1),u=Uf(0),d=Mp(r);if((d||!a)&&((Dp(r)!==`body`||Pp(o))&&(c=Kp(r)),d)){let e=rm(r);l=$p(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?am(o,c):Uf(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function sm(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function cm(e){let t=Kp(e),n=e.ownerDocument.body,r=Bf(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Bf(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+im(e),o=-t.scrollTop;return Gp(n).direction===`rtl`&&(a+=Bf(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var lm=25;function um(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Op(e),a=kp(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Up()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(im(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=lm&&(s-=o)}return{width:s,height:c,x:l,y:u}}function dm(e,t){let n=rm(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=$p(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function fm(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=um(e,n,t);else if(t===`document`)r=cm(kp(e));else if(jp(t))r=dm(t,n);else{let n=tm(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return up(r)}function pm(e,t){let n=t.get(e);if(n)return n;let r=Yp(e,[],!1).filter(e=>jp(e)&&Dp(e)!==`body`),i=null,a=Gp(e).position===`fixed`,o=a?qp(e):e;for(;jp(o)&&!Wp(o);){let e=Gp(o),t=Vp(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=qp(o)}return t.set(e,r),r}function mm(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Ip(t)?[]:pm(t,this._c):[].concat(n),r],o=fm(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=fm(t,a[e],i);s=Bf(n.top,s),c=zf(n.right,c),l=zf(n.bottom,l),u=Bf(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function hm(e){let{width:t,height:n}=Zp(e);return{width:t,height:n}}function gm(e,t,n){let r=Mp(t),i=kp(t),a=n===`fixed`,o=rm(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Uf(0);if((r||!a)&&((Dp(t)!==`body`||Pp(i))&&(s=Kp(t)),r)){let e=rm(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=im(i));let l=i&&!r&&!a?am(i,s):Uf(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function _m(e){return Gp(e).position===`static`}function vm(e,t){if(!Mp(e)||Gp(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return kp(e)===n&&(n=n.ownerDocument.body),n}function ym(e,t){let n=Op(e);if(Ip(e))return n;if(!Mp(e)){let t=qp(e);for(;t&&!Wp(t);){if(jp(t)&&!_m(t))return t;t=qp(t)}return n}let r=vm(e,t);for(;r&&Fp(r)&&_m(r);)r=vm(r,t);return r&&Wp(r)&&_m(r)&&!Vp(r)?n:r||Hp(e)||n}var bm=async function(e){let t=this.getOffsetParent||ym,n=this.getDimensions,r=await n(e.floating);return{reference:gm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function xm(e){return Gp(e).direction===`rtl`}var Sm={convertOffsetParentRelativeRectToViewportRelativeRect:om,getDocumentElement:kp,getClippingRect:mm,getOffsetParent:ym,getElementRects:bm,getClientRects:sm,getDimensions:hm,getScale:$p,isElement:jp,isRTL:xm};function Cm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wm(e,t,n){let r=null,i,a=kp(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Hf(d),h=Hf(a.clientWidth-(u+f)),g=Hf(a.clientHeight-(d+p)),_=Hf(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Bf(0,zf(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Cm(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Op(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Tm(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Qp(e),u=i||a?[...l?Yp(l):[],...t?Yp(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?wm(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?rm(e):null;c&&g();function g(){let t=rm(e);h&&!Cm(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Em=Sp,Dm=Cp,Om=gp,km=Tp,Am=yp,jm=hp,Mm=wp,Nm=(e,t,n)=>{let r=new Map,i=n??{},a={...Sm,...i.platform,_c:r};return mp(e,t,{...i,platform:a})},Pm=typeof document<`u`?y.useLayoutEffect:function(){};function Fm(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,i;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(!Fm(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Fm(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Im(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Lm(e,t){let n=Im(e);return Math.round(t*n)/n}function Rm(e){let t=y.useRef(e);return Pm(()=>{t.current=e}),t}function zm(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=y.useState(r);Fm(f,r)||p(r);let[m,h]=y.useState(null),[g,_]=y.useState(null),v=y.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=y.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=y.useRef(null),w=y.useRef(null),T=y.useRef(u),E=c!=null,D=Rm(c),O=Rm(i),k=Rm(l),A=y.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Nm(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Fm(T.current,t)&&(T.current=t,Dc.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Pm(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=y.useRef(!1);Pm(()=>(j.current=!0,()=>{j.current=!1}),[]),Pm(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=y.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:b}),[v,b]),N=y.useMemo(()=>({reference:x,floating:S}),[x,S]),ee=y.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=Lm(N.floating,u.x),r=Lm(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Im(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:ee}),[u,A,M,N,ee])}var Bm=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:jm({element:r.current,padding:i}).fn(n):r?jm({element:r,padding:i}).fn(n):{}}}},Vm=(e,t)=>{let n=Em(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hm=(e,t)=>{let n=Dm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Um=(e,t)=>({fn:Mm(e).fn,options:[e,t]}),Wm=(e,t)=>{let n=Om(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gm=(e,t)=>{let n=km(e);return{name:n.name,fn:n.fn,options:[e,t]}},Km=(e,t)=>{let n=Am(e);return{name:n.name,fn:n.fn,options:[e,t]}},qm=(e,t)=>{let n=Bm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jm=Object.defineProperty,Ym=(e,t)=>Jm(e,`name`,{value:t,configurable:!0}),Xm=`Popper`,[Zm,Qm]=Ic(Xm),[$m,eh]=Zm(Xm),th=Ym(e=>{let{__scopePopper:t,children:n}=e,[r,i]=y.useState(null),[a,o]=y.useState(void 0);return(0,b.jsx)($m,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),nh=`PopperAnchor`,rh=y.forwardRef(Ym(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=eh(nh,n),o=y.useRef(null),s=a.onAnchorChange,c=uc(t,y.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=y.useRef(null);y.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&uh(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,b.jsx)(Ac.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),ih=`PopperContent`,[ah,oh]=Zm(ih),sh=y.forwardRef(Ym(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=eh(ih,n),[_,v]=y.useState(null),x=uc(t,v),[S,C]=y.useState(null),w=yf(S),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,j={padding:O,boundary:k.filter(ch),altBoundary:A},{refs:M,floatingStyles:N,placement:ee,isPositioned:P,middlewareData:F}=zm({strategy:`fixed`,placement:D,whileElementsMounted:Ym((...e)=>Tm(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Vm({mainAxis:i+E,alignmentAxis:o}),c&&Hm({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Um():void 0,...j}),c&&Wm({...j}),Gm({...j,apply:Ym(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),S&&qm({element:S,padding:s}),lh({arrowWidth:T,arrowHeight:E}),f&&Km({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),te=g.setPlacementState;al(()=>(te(ee),()=>{te(void 0)}),[ee,te]);let[ne,re]=uh(ee),ie=zl(m);al(()=>{P&&ie?.()},[P,ie]);let ae=F.arrow?.x,oe=F.arrow?.y,se=F.arrow?.centerOffset!==0,[ce,le]=y.useState();return al(()=>{_&&le(window.getComputedStyle(_).zIndex)},[_]),(0,b.jsx)(`div`,{ref:M.setFloating,"data-radix-popper-content-wrapper":``,style:{...N,transform:P?N.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ce,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,b.jsx)(ah,{scope:n,placedSide:ne,placedAlign:re,onArrowChange:C,arrowX:ae,arrowY:oe,shouldHideArrow:se,children:(0,b.jsx)(Ac.div,{"data-side":ne,"data-align":re,...h,ref:x,style:{...h.style,animation:P?h.style?.animation:`none`}})})})},`PopperContent`));function ch(e){return e!==null}Ym(ch,`isNotNull`);var lh=Ym(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=uh(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function uh(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Ym(uh,`getSideAndAlignFromPlacement`);var dh=th,fh=rh,ph=sh,mh=Object.defineProperty,hh=y.forwardRef(((e,t)=>mh(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,b.jsx)(Ac.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),gh=Object.defineProperty,_h=(e,t)=>gh(e,`name`,{value:t,configurable:!0});function vh(e){let t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}_h(vh,`usePrevious`);var yh=Object.defineProperty,bh=(e,t)=>yh(e,`name`,{value:t,configurable:!0});function xh(e,[t,n]){return Math.min(n,Math.max(t,e))}bh(xh,`clamp`);var Sh=Object.defineProperty,Ch=(e,t)=>Sh(e,`name`,{value:t,configurable:!0}),wh=`Popover`,[Th,Eh]=Ic(wh,[Qm]),Dh=Qm(),[Oh,kh]=Th(wh),Ah=Ch(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Dh(t),c=y.useRef(null),[l,u]=y.useState(!1),[d,f]=ml({prop:r,defaultProp:i??!1,onChange:a,caller:wh});return(0,b.jsx)(dh,{...s,children:(0,b.jsx)(Oh,{scope:t,contentId:Ml(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:y.useCallback(()=>u(!0),[]),onCustomAnchorRemove:y.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),jh=`PopoverTrigger`,Mh=y.forwardRef(Ch(function(e,t){let{__scopePopover:n,...r}=e,i=kh(jh,n),a=Dh(n),o=uc(t,i.triggerRef),s=(0,b.jsx)(Ac.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Gh(i.open),...r,ref:o,onClick:el(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,b.jsx)(fh,{asChild:!0,...a,children:s})},`PopoverTrigger`)),Nh=`PopoverPortal`,[Ph,Fh]=Th(Nh,{forceMount:void 0}),Ih=Ch(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=kh(Nh,t);return(0,b.jsx)(Ph,{scope:t,forceMount:n,children:(0,b.jsx)(Sl,{present:n||a.open,children:(0,b.jsx)(vu,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Lh=`PopoverContent`,Rh=y.forwardRef(Ch(function(e,t){let n=Fh(Lh,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=kh(Lh,e.__scopePopover);return(0,b.jsx)(Sl,{present:r||a.open,children:a.modal?(0,b.jsx)(Bh,{...i,ref:t}):(0,b.jsx)(Vh,{...i,ref:t})})},`PopoverContent`)),zh=pc(`PopoverContent.RemoveScroll`),Bh=y.forwardRef(Ch(function(e,t){let n=kh(Lh,e.__scopePopover),r=y.useRef(null),i=uc(t,r),a=y.useRef(!1);return y.useEffect(()=>{let e=r.current;if(e)return Vd(e)},[]),(0,b.jsx)(Md,{as:zh,allowPinchZoom:!0,children:(0,b.jsx)(Hh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:el(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:el(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:el(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),Vh=y.forwardRef(Ch(function(e,t){let n=kh(Lh,e.__scopePopover),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(Hh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Hh=y.forwardRef(Ch(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=kh(Lh,n),p=Dh(n);return wu(),(0,b.jsx)(au,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,b.jsx)(ql,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,b.jsx)(ph,{"data-state":Gh(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`)),Uh=`PopoverClose`,Wh=y.forwardRef(Ch(function(e,t){let{__scopePopover:n,...r}=e,i=kh(Uh,n);return(0,b.jsx)(Ac.button,{type:`button`,...r,ref:t,onClick:el(e.onClick,()=>i.onOpenChange(!1))})},`PopoverClose`));function Gh(e){return e?`open`:`closed`}Ch(Gh,`getState`);var Kh=Ah,qh=Mh,Jh=Ih,Yh=Rh,Xh=Wh,Zh=Object.defineProperty,Qh=(e,t)=>Zh(e,`name`,{value:t,configurable:!0}),$h=[` `,`Enter`,`ArrowUp`,`ArrowDown`],eg=[` `,`Enter`],tg=`Select`,[ng,rg,ig]=Bc(tg),[ag,og]=Ic(tg,[ig,Qm]),sg=Qm(),[cg,lg]=ag(tg),[ug,dg]=ag(tg);function fg(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=sg(t),[_,v]=y.useState(null),[x,S]=y.useState(null),[C,w]=y.useState(!1),T=Il(l),[E,D]=ml({prop:r,defaultProp:i??!1,onChange:a,caller:tg}),[O,k]=ml({prop:o,defaultProp:s,onChange:c,caller:tg}),A=y.useRef(null),j=y.useRef(O);y.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=Qh(()=>k(j.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,k]);let M=!_||!!m||!!_.closest(`form`),[N,ee]=y.useState(new Set),P=Ml(),F=Array.from(N).map(e=>e.props.value).join(`;`),te=y.useCallback(e=>{ee(t=>new Set(t).add(e))},[]),ne=y.useCallback(e=>{ee(t=>{let n=new Set(t);return n.delete(e),n})},[]),re={required:p,trigger:_,onTriggerChange:v,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:P,value:O,onValueChange:k,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:A,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:N,nativeSelectKey:F,isFormControl:M};return(0,b.jsx)(dh,{...g,children:(0,b.jsx)(cg,{scope:t,...re,children:(0,b.jsx)(ng.Provider,{scope:t,children:(0,b.jsx)(ug,{scope:t,onNativeOptionAdd:te,onNativeOptionRemove:ne,children:Jg(h)?h(re):n})})})})}Qh(fg,`SelectProvider`);var pg=Qh(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,b.jsx)(fg,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,b.jsxs)(b.Fragment,{children:[n,e?(0,b.jsx)(qg,{__scopeSelect:t}):null]})})},`Select`),mg=`SelectTrigger`,hg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=sg(n),o=lg(mg,n),s=o.disabled||r,c=uc(t,o.onTriggerChange),l=rg(n),u=y.useRef(`touch`),[d,f,p]=Xg(e=>{let t=l().filter(e=>!e.disabled),n=Zg(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=Qh(e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,b.jsx)(fh,{asChild:!0,...a,children:(0,b.jsx)(Ac.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Yg(o.value)?``:void 0,...i,ref:c,onClick:el(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:el(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:el(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&$h.includes(e.key)&&(m(),e.preventDefault())})})})},`SelectTrigger`)),gg=`SelectValue`,_g=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=lg(gg,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=uc(t,c.onValueNodeChange);al(()=>{l(u)},[l,u]);let f=Yg(c.value);return(0,b.jsx)(Ac.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,b.jsx)(y.Fragment,{children:f?o:a},f?`placeholder`:`value`)})},`SelectValue`)),vg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,b.jsx)(Ac.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[yg,bg]=ag(`SelectPortal`,{forceMount:void 0}),xg=Qh(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,b.jsx)(yg,{scope:e.__scopeSelect,forceMount:n,children:(0,b.jsx)(vu,{asChild:!0,...r})})},`SelectPortal`),Sg=`SelectContent`,Cg=y.forwardRef(Qh(function(e,t){let n=bg(Sg,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=lg(Sg,e.__scopeSelect),[o,s]=y.useState();return al(()=>{s(new DocumentFragment)},[]),(0,b.jsx)(Sl,{present:r||a.open,children:({present:e})=>e?(0,b.jsx)(kg,{...i,ref:t}):(0,b.jsx)(wg,{...i,fragment:o})})},`SelectContent`)),wg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?Dc.createPortal((0,b.jsx)(Eg,{scope:n,children:(0,b.jsx)(ng.Slot,{scope:n,children:(0,b.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),Tg=10,[Eg,Dg]=ag(Sg),Og=pc(`SelectContent.RemoveScroll`),kg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=lg(Sg,n),[x,S]=y.useState(null),[C,w]=y.useState(null),T=uc(t,S),[E,D]=y.useState(null),[O,k]=y.useState(null),A=rg(n),[j,M]=y.useState(!1),N=y.useRef(!1);y.useEffect(()=>{if(x)return Vd(x)},[x]),wu();let ee=y.useCallback(e=>{let[t,...n]=A().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&C&&(C.scrollTop=0),n===r&&C&&(C.scrollTop=C.scrollHeight),n?.focus(),document.activeElement!==i))return},[A,C]),P=y.useCallback(()=>ee([E,x]),[ee,E,x]);y.useEffect(()=>{j&&P()},[j,P]);let{onOpenChange:F,triggerPointerDownPosRef:te}=v;y.useEffect(()=>{if(x){let e={x:0,y:0},t=Qh(t=>{e={x:Math.abs(Math.round(t.pageX)-(te.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(te.current?.y??0))}},`handlePointerMove`),n=Qh(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(x)||F(!1),document.removeEventListener(`pointermove`,t),te.current=null},`handlePointerUp`);return te.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[x,F,te]),y.useEffect(()=>{let e=Qh(()=>F(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[ne,re]=Xg(e=>{let t=A().filter(e=>!e.disabled),n=Zg(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ie=y.useCallback((e,t,n)=>{let r=!N.current&&!n;(v.value!==void 0&&v.value===t||r)&&(D(e),r&&(N.current=!0))},[v.value]),ae=y.useCallback(()=>x?.focus(),[x]),oe=y.useCallback((e,t,n)=>{let r=!N.current&&!n;(v.value!==void 0&&v.value===t||r)&&k(e)},[v.value]),se=r===`popper`?jg:Ag,ce=se===jg?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,b.jsx)(Eg,{scope:n,content:x,viewport:C,onViewportChange:w,itemRefCallback:ie,selectedItem:E,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:P,selectedItemText:O,position:r,isPositioned:j,searchRef:ne,children:(0,b.jsx)(Md,{as:Og,allowPinchZoom:!0,children:(0,b.jsx)(au,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:el(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,b.jsx)(ql,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,b.jsx)(se,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ce,onPlaced:()=>M(!0),ref:T,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:el(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=A().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>ee(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),Ag=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=lg(Sg,n),o=Dg(Sg,n),[s,c]=y.useState(null),[l,u]=y.useState(null),d=uc(t,u),f=rg(n),p=y.useRef(!1),m=y.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,x=y.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Tg,d=xh(a,[Tg,Math.max(Tg,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Tg,d=xh(a,[Tg,Math.max(Tg,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Tg*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Tg,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Tg}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);al(()=>x(),[x]);let[S,C]=y.useState();al(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]);let w=y.useCallback(e=>{e&&m.current===!0&&(x(),v?.(),m.current=!1)},[x,v]);return(0,b.jsx)(Mg,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:w,children:(0,b.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,b.jsx)(Ac.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),jg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Tg,...a}=e,o=sg(n);return(0,b.jsx)(ph,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.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)`}})},`SelectPopperPosition`)),[Mg,Ng]=ag(Sg,{}),Pg=`SelectViewport`,Fg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=Dg(Pg,n),o=Ng(Pg,n),s=uc(t,a.onViewportChange),c=y.useRef(0);return(0,b.jsxs)(b.Fragment,{children:[(0,b.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}),(0,b.jsx)(ng.Slot,{scope:n,children:(0,b.jsx)(Ac.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:el(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Tg*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})},`SelectViewport`)),[Ig,Lg]=ag(`SelectGroup`),Rg=`SelectItem`,[zg,Bg]=ag(Rg),Vg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=lg(Rg,n),c=Dg(Rg,n),l=s.value===r,[u,d]=y.useState(a??``),[f,p]=y.useState(!1),m=uc(t,zl(e=>c.itemRefCallback?.(e,r,i))),h=Ml(),g=y.useRef(`touch`),_=Qh(()=>{i||(s.onValueChange(r),s.onOpenChange(!1))},`handleSelect`);return(0,b.jsx)(zg,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:y.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,b.jsx)(ng.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,b.jsx)(Ac.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:el(o.onFocus,()=>p(!0)),onBlur:el(o.onBlur,()=>p(!1)),onClick:el(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:el(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:el(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:el(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:el(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:el(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(c.searchRef?.current===``||e.key!==` `)&&(eg.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Hg=`SelectItemText`,Ug=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=lg(Hg,n),s=Dg(Hg,n),c=Bg(Hg,n),l=dg(Hg,n),[u,d]=y.useState(null),f=zl(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=uc(t,d,c.onItemTextChange,f),m=u?.textContent,h=y.useMemo(()=>(0,b.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return al(()=>(g(h),()=>_(h)),[g,_,h]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Ac.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Yg(o.value)?Dc.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),Wg=`SelectItemIndicator`,Gg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,...r}=e;return Bg(Wg,n).isSelected?(0,b.jsx)(Ac.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Kg=`SelectBubbleInput`,qg=y.forwardRef(Qh(function({__scopeSelect:e,...t},n){let r=lg(Kg,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=y.useRef(null),m=uc(n,p),h=i??``,g=vh(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return y.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,b.jsxs)(Ac.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...Mc,...t.style},ref:m,defaultValue:h,children:[Yg(i)&&!_?(0,b.jsx)(`option`,{value:``}):null,Array.from(d)]},f)},`SelectBubbleInput`));function Jg(e){return typeof e==`function`}Qh(Jg,`isFunction`);function Yg(e){return e===``||e===void 0}Qh(Yg,`shouldShowPlaceholder`);function Xg(e){let t=zl(e),n=y.useRef(``),r=y.useRef(0),i=y.useCallback(e=>{let i=n.current+e;t(i),Qh((function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(i)},[t]),a=y.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}Qh(Xg,`useTypeaheadSearch`);function Zg(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Qg(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Qh(Zg,`findNextItem`);function Qg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Qh(Qg,`wrapArray`);var $g=ac(`group/button inline-flex shrink-0 items-center justify-center rounded-control border border-transparent bg-clip-padding text-[13px] font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 cursor-pointer`,{variants:{variant:{default:`border-primary bg-primary text-primary-foreground hover:opacity-92`,outline:`border-input bg-card hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`border-input bg-card text-bad hover:bg-muted focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 gap-1.5 px-3.5 has-data-[icon=inline-end]:pe-3 has-data-[icon=inline-start]:ps-3`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1.5 px-2.5 text-[12.5px] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2`,icon:`size-9`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function q({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?mc:`button`;return(0,b.jsx)(a,{"data-slot":`button`,"data-variant":t,"data-size":n,className:U($g({variant:t,size:n,className:e})),...i})}function e_({className:e,type:t,...n}){return(0,b.jsx)(`input`,{type:t,"data-slot":`input`,className:U(`h-9 w-full min-w-0 rounded-control border border-input bg-card px-3 py-1 text-[13px] transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function t_({className:e,...t}){return(0,b.jsx)(hh,{"data-slot":`label`,className:U(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var n_=`۰۱۲۳۴۵۶۷۸۹`,r_=`٠١٢٣٤٥٦٧٨٩`;function i_(e){return e.replace(/[۰-۹٠-٩]/g,e=>String(Math.max(n_.indexOf(e),r_.indexOf(e))))}function a_(e){return i_(e).replace(/٫/g,`.`).replace(/٬/g,`,`)}function o_(e){return e.replace(/[0-9]/g,e=>n_[Number(e)])}function s_(e){return o_(e).replace(/\./g,`٫`).replace(/,/g,`٬`)}var c_=`nma.calendar`,l_=`nma.digits`;function u_(e){try{return localStorage.getItem(e)}catch{return null}}function d_(e){let t=u_(c_),n=u_(l_);return{calendar:t===`gregorian`||t===`persian`?t:e.split(`-`)[0]===`fa`?`persian`:`gregorian`,digits:n===`latn`||n===`arabext`?n:e.split(`-`)[0]===`fa`?`arabext`:`latn`}}function f_(e){try{e.calendar&&localStorage.setItem(c_,e.calendar),e.digits&&localStorage.setItem(l_,e.digits)}catch{}}var p_={"common.loading":`Loading…`,"common.yes":`Yes`,"common.no":`No`,"common.empty":`—`,"common.all":`All`,"common.cancel":`Cancel`,"common.pageNotFound":`Page not found.`,"common.requestFailed":`Request failed ({status})`,"common.reference":`{message} (reference: {id})`,"shell.adminPanel":`Admin panel`,"palette.move":`Move`,"palette.openItem":`Open`,"palette.close":`Close`,"shell.menu":`Menu`,"shell.closeMenu":`Close menu`,"shell.resources":`Resources`,"shell.filterResources":`Filter resources`,"shell.pinned":`Pinned`,"shell.recent":`Recent`,"shell.pin":`Pin {name}`,"shell.unpin":`Unpin {name}`,"shell.collapseGroup":`Collapse {name}`,"shell.expandGroup":`Expand {name}`,"shell.collapseSidebar":`Collapse sidebar`,"shell.expandSidebar":`Expand sidebar`,"shell.breadcrumbs":`Breadcrumbs`,"shell.home":`Home`,"shell.dashboard":`Dashboard`,"shell.noMatches":`No resources match.`,"shell.theme":`Theme`,"shell.themeLight":`Light`,"shell.themeDark":`Dark`,"shell.themeSystem":`System`,"shell.language":`Language`,"shell.noResources":`No admin resources are registered yet. Decorate a provider with @AdminResource.`,"shell.records":`{count} records`,"shell.aboutRecords":`about {count} records`,"list.select":`Select`,"list.done":`Done`,"list.loadMore":`Load more`,"list.showing":`{shown} shown`,"list.showingOf":`{shown} of {total}`,"list.new":`New`,"list.trash":`Trash`,"list.trashNote":`Records in the trash. Restore one to edit it again.`,"list.restore":`Restore`,"list.restoreRecord":`Restore {name}`,"list.actions":`Actions`,"list.noMatches":`No records match.`,"list.noRecords":`No records yet.`,"list.total":`{count} total`,"list.about":`about {count}`,"list.page":`Page {page}`,"list.pageOf":`Page {page} of {pages}`,"list.range":`Showing {from} to {to} of {total}`,"list.rowsPerPage":`Rows per page`,"list.toggleRow":`{column}: {name}`,"list.previousPage":`Previous page`,"list.nextPage":`Next page`,"list.columns":`Columns`,"list.density":`Density`,"list.comfortable":`Comfortable`,"list.compact":`Compact`,"list.moveUp":`Move {name} up`,"list.moveDown":`Move {name} down`,"list.resetColumns":`Reset columns`,"list.resize":`Resize {name}`,"list.retry":`Try again`,"list.loadFailed":`The list could not be loaded.`,"list.selectPage":`Select all on this page`,"list.selectRow":`Select {name}`,"print.open":`Print {name}`,"list.export":`Export to Excel`,"list.exporting":`Exporting…`,"list.exportTruncated":`Only the first {count} rows were exported.`,"list.exportDone":`{file} downloaded.`,"list.selected":`{count} selected`,"list.deleteSelected":`Delete selected`,"list.confirmDeleteSelected":`Delete {count}`,"list.clearSelection":`Clear selection`,"list.bulkDeleted":`{count} deleted`,"list.bulkFailed":`{count} failed`,"list.quickView":`Quick view: {name}`,"list.edit":`Edit`,"list.close":`Close`,"list.editCell":`Edit {name}: {value}`,"action.running":`Running…`,"action.choicesFailed":`The choices could not be loaded: {error}`,"action.choicesRetry":`Try again`,"action.confirm":`Run “{action}”?`,"action.confirmRecord":`Run “{action}” on {name}?`,"action.confirmSelected":`Run “{action}” on {count} records?`,"action.eachNote":`Each of the {count} records is handled on its own: one that fails does not stop the others.`,"action.atomicNote":`All or nothing: if one of the {count} records fails, none is changed.`,"action.done":`“{action}” done.`,"action.doneGone":`“{action}” done. The record is no longer in your view.`,"action.bulkDone":`{action}: {count} done`,"action.saveFirst":`Save or discard your changes first.`,"action.more":`More actions`,"toast.region":`Notifications`,"toast.dismiss":`Dismiss`,"settings.viewOnly":`You can view these settings but not change them.`,"settings.discard":`Discard changes`,"secret.set":`Set`,"secret.notSet":`Not set`,"secret.replace":`Replace`,"secret.replaceName":`Replace {name}`,"secret.clear":`Clear`,"secret.clearName":`Clear {name}`,"secret.keep":`Keep the current value`,"secret.willClear":`Will be cleared when you save.`,"secret.undo":`Undo`,"filters.search":`Search`,"filters.searchIn":`Search {fields}`,"filters.filtersAndSort":`Filters and sort`,"filters.showResults":`Show results`,"filters.sortBy":`Sort by`,"filters.ascending":`{name}, ascending`,"filters.descending":`{name}, descending`,"filters.filters":`Filters`,"filters.clear":`Clear filters`,"filters.from":`From`,"filters.to":`To`,"filters.contains":`{field} contains`,"filters.empty":`empty`,"filters.notEmpty":`not empty`,"filters.not":`not `,"filters.removeChip":`Remove filter {label}`,"filters.active":`Active filters`,"filters.any":`Any`,"filters.onlyEmpty":`Empty`,"filters.hideEmpty":`Not empty`,"filters.emptyValues":`{field}: empty values`,"filters.selected":`{count} selected`,"date.placeholder":`yyyy/mm/dd`,"date.openCalendar":`Choose {name} from a calendar`,"date.calendar":`{name} calendar`,"date.previous":`Previous`,"date.next":`Next`,"date.chooseMonth":`Choose a month`,"date.chooseYear":`Choose a year`,"date.today":`Today`,"date.clear":`Clear`,"date.time":`{name} time`,"auth.title":`Sign in`,"auth.username":`Username`,"auth.password":`Password`,"auth.signIn":`Sign in`,"auth.signingIn":`Signing in…`,"auth.required":`Enter your username and password.`,"auth.failed":`Signing in failed. Try again.`,"auth.userMenu":`Account menu for {name}`,"auth.account":`Account`,"auth.signOut":`Sign out`,"auth.changePassword":`Change password`,"auth.currentPassword":`Current password`,"auth.newPassword":`New password`,"auth.confirmPassword":`New password again`,"auth.mismatch":`does not match the new password`,"auth.passwordChanged":`Password changed. Your other sessions were signed out.`,"auth.sessions":`Signed-in devices`,"auth.signOutOthers":`Sign out everywhere else`,"auth.thisDevice":`This device`,"auth.unknownDevice":`Unknown device`,"auth.lastSeen":`Last active {when}`,"auth.revoke":`Sign out`,"auth.revokeSession":`Sign out {name}`,"rbac.administration":`Administration`,"rbac.users":`Users`,"rbac.groups":`Groups`,"rbac.roles":`Roles`,"rbac.user":`User`,"rbac.group":`Group`,"rbac.role":`Role`,"rbac.newUser":`New user`,"rbac.newGroup":`New group`,"rbac.newRole":`New role`,"rbac.createUser":`Create user`,"rbac.export":`Export`,"rbac.import":`Import`,"rbac.importFile":`Roles file to import`,"rbac.imported":`{count} roles imported.`,"rbac.notJson":`That file is not JSON.`,"rbac.permissionCount":`{count} permissions`,"rbac.system":`System`,"rbac.systemNote":`This role is defined in code: change it there.`,"rbac.name":`Name`,"rbac.labelIn":`Label ({language})`,"rbac.matrix":`Permissions`,"rbac.resource":`Resource`,"rbac.op.view":`View`,"rbac.op.create":`Create`,"rbac.op.update":`Change`,"rbac.op.delete":`Delete`,"rbac.op.purge":`Purge`,"rbac.grant":`{operation} {resource}`,"rbac.details":`Fields and scopes of {resource}`,"rbac.fields":`Fields`,"rbac.restricted":`restricted`,"rbac.fieldRule":`Access to {field}`,"rbac.rule.default":`As the permissions allow`,"rbac.rule.defaultHidden":`Hidden (restricted)`,"rbac.rule.hidden":`Hidden`,"rbac.rule.readonly":`Read-only`,"rbac.rule.edit":`Editable`,"rbac.scopes":`Rows`,"rbac.allRows":`all rows`,"rbac.custom":`Other permissions`,"rbac.global":`General permissions`,"rbac.actions":`Actions`,"rbac.actionNote":`Actions on records also need Change.`,"rbac.pages":`Settings pages`,"rbac.page":`Page`,"rbac.viewImplied":`Whoever may change a page may view it.`,"rbac.noGroups":`No groups yet.`,"rbac.groupSummary":`{roles} roles · {members} members`,"rbac.members":`Members`,"rbac.noMembers":`No members yet.`,"rbac.addMember":`Add a member`,"rbac.searchUsers":`Search users`,"rbac.searchResults":`Matching users`,"rbac.usersFromMemberships":`Your sign-in adapter cannot list users: these are the users that have roles or groups here.`,"rbac.superuser":`Superuser`,"rbac.superuserNote":`Only superusers can change a superuser.`,"rbac.inactive":`Inactive`,"rbac.active":`Active`,"rbac.displayName":`Display name`,"rbac.email":`Email`,"rbac.saved":`Saved.`,"rbac.setPassword":`Set password`,"rbac.setPasswordNote":`The user is signed out everywhere.`,"rbac.passwordSet":`Password set; the user was signed out everywhere.`,"auth.otpTitle":`Two-step verification`,"auth.otp":`Code`,"auth.otpHelp":`Enter the 6-digit code from your authenticator app, or one of your recovery codes.`,"auth.verify":`Verify`,"auth.otpRequired":`Enter the code.`,"auth.startOver":`Use another account`,"twoFactor.title":`Two-factor sign-in`,"twoFactor.on":`On`,"twoFactor.off":`Off`,"twoFactor.intro":`Ask for a code from an authenticator app after the password.`,"twoFactor.setUp":`Set up`,"twoFactor.scan":`Scan the code with your authenticator app, or type the key into it. Then enter the code the app shows.`,"twoFactor.qr":`QR code for your authenticator app`,"twoFactor.key":`Key`,"twoFactor.code":`Code from the app`,"twoFactor.turnOn":`Turn on`,"twoFactor.recoveryTitle":`Recovery codes`,"twoFactor.recoveryIntro":`Keep these somewhere safe. Each one signs you in once if you lose your device. They are not shown again.`,"twoFactor.copy":`Copy codes`,"twoFactor.copied":`Copied`,"twoFactor.done":`I saved them`,"twoFactor.left":`{count} unused recovery codes.`,"twoFactor.newCodes":`New recovery codes`,"twoFactor.turnOff":`Turn off`,"twoFactor.password":`Your password`,"twoFactor.enabledNote":`Two-factor sign-in is on. Your other sessions were signed out.`,"twoFactor.disabledNote":`Two-factor sign-in is off.`,"viewAs.start":`View as this user`,"viewAs.banner":`Viewing as {name}. Read-only.`,"viewAs.stop":`Stop viewing`,"rbac.twoFactor":`2FA`,"rbac.resetTwoFactor":`Reset two-factor sign-in`,"rbac.resetTwoFactorNote":`Turns off their second factor (a lost phone) and signs them out everywhere.`,"rbac.twoFactorReset":`Two-factor sign-in is off for this user.`,"debugger.title":`Permission debugger`,"debugger.intro":`Why a user can or cannot see and change things.`,"debugger.user":`User`,"debugger.resource":`Resource`,"debugger.record":`Record id (optional)`,"debugger.explain":`Explain`,"debugger.pick":`Choose a user and a resource.`,"debugger.roles":`Roles`,"debugger.noRoles":`No roles: nothing is allowed.`,"debugger.superuser":`A superuser may do everything.`,"debugger.source.direct":`assigned directly`,"debugger.source.group":`through group {group}`,"debugger.source.resolveRoles":`from resolveRoles`,"debugger.source.adapter":`from the sign-in adapter`,"debugger.unknownRole":`not a role, grants nothing`,"debugger.operations":`Operations`,"debugger.allowed":`Allowed`,"debugger.denied":`Denied`,"debugger.noGrant":`No role grants it`,"debugger.viaUpdate":`{pattern} in {role} (changing implies viewing)`,"debugger.grant":`{pattern} in {role}`,"debugger.fields":`Fields`,"debugger.field":`Field`,"debugger.result":`Result`,"debugger.byRole":`Per role`,"debugger.forced":`Always shown: keys and the version`,"debugger.scopes":`Rows`,"debugger.allRows":`All rows`,"debugger.noRows":`No rows`,"debugger.someRows":`Rows of {scopes}`,"debugger.globalScopes":`Also limited by {scopes}`,"debugger.recordTitle":`Record {id}`,"debugger.reason.permission":`no permission`,"debugger.reason.scope":`outside their rows`,"debugger.reason.rule":`a rule on this record says no`,"debugger.reason.missing":`no such record`,"debugger.actions":`Actions`,"debugger.needsUpdate":`actions on records also need Change`,"debugger.noRecordActions":`none on this record`,"debugger.pages":`Settings pages`,"audit.title":`Audit log`,"audit.history":`History`,"audit.details":`Details`,"audit.recordTabs":`Record and its history`,"audit.entries":`Recorded changes`,"audit.notAllowed":`You may not read the audit log`,"audit.off":`The audit log is not enabled in this admin`,"audit.empty":`Nothing has been recorded yet.`,"audit.noMatches":`No entries match.`,"audit.noActor":`Nobody signed in`,"audit.viewAsBy":`while user {id} was viewing as them`,"audit.filterByActor":`Show only what {name} did`,"audit.changedFields":`Changed fields`,"audit.before":`Before`,"audit.after":`After`,"audit.becomes":`became`,"audit.field.changed":`changed`,"audit.field.hidden":`hidden`,"audit.field.dropped":`too large to keep`,"audit.field.truncated":`cut short`,"audit.showMore":`Show more`,"audit.showLess":`Show less`,"audit.input":`Input`,"audit.inputTruncated":`The input was too large to keep.`,"audit.restrictedRecord":`A record you cannot see: its details are withheld.`,"audit.restrictedChanges":`You may not see what was changed.`,"audit.suppressedNote":`They came in the same minute and were not recorded one by one.`,"audit.limitedNote":`Further failures in this minute are only counted.`,"audit.actionDeleted":`The action deleted the record.`,"audit.filter.actor":`Actor (user id)`,"audit.filter.event":`Event`,"audit.filter.eventHint":`order.updated or auth.*`,"audit.filter.resource":`Resource`,"audit.filter.record":`Record id`,"audit.filter.recordHint":`Choose a resource first`,"audit.event.unseen":`A change you cannot see`,"audit.event.created":`Created`,"audit.event.updated":`Changed`,"audit.event.deleted":`Deleted`,"audit.event.trashed":`Moved to trash`,"audit.event.restored":`Restored`,"audit.event.purged":`Deleted for good`,"audit.event.action":`Ran “{action}”`,"audit.event.page":`Changed {page}`,"audit.event.login":`Signed in`,"audit.event.logout":`Signed out`,"audit.event.loginFailed":`Failed sign-in`,"audit.event.loginFailedCode":`Failed sign-in: wrong two-factor code`,"audit.event.loginFailedLimited":`Failed sign-in: too many attempts`,"audit.event.loginFailedMore":`{count} more failed sign-ins`,"audit.event.viewAs":`Viewed the admin as a user`,"audit.event.roleChanged":`Role changed`,"audit.event.groupChanged":`Group changed`,"audit.event.userRolesChanged":`Roles and groups of a user changed`,"audit.event.userCreated":`User created`,"audit.event.userChanged":`User changed`,"audit.event.passwordChanged":`Password changed`,"audit.event.passwordReset":`Password set by an administrator`,"audit.event.twoFactorEnabled":`Two-factor sign-in turned on`,"audit.event.twoFactorDisabled":`Two-factor sign-in turned off`,"audit.event.twoFactorReset":`Two-factor sign-in reset`,"audit.event.recoveryCodes":`New recovery codes`,"audit.event.sessions":`Sessions signed out`,"audit.event.sessionsOthers":`Signed out everywhere else`,"audit.event.sessionsOne":`Signed out one device`,"display.title":`Display settings`,"display.calendar":`Calendar`,"display.gregorian":`Gregorian`,"display.jalali":`Jalali`,"display.digits":`Digits`,"display.accent":`Accent colour`,"display.customAccent":`Another colour`,"display.defaultAccent":`Default`,"display.accentForEveryone":`Use for everyone`,"display.resetForEveryone":`Reset for everyone`,"display.logo":`Logo`,"display.favicon":`Tab icon`,"display.uploadPicture":`Upload`,"display.removePicture":`Remove`,"display.latinDigits":`Latin 123`,"display.persianDigits":`Persian ۱۲۳`,"inline.row":`{name} row {index}`,"inline.newRow":`New {name} {index}`,"inline.moveUp":`Move {name} up`,"inline.moveDown":`Move {name} down`,"inline.remove":`Remove {name}`,"inline.rowActions":`Row actions`,"inline.empty":`None yet.`,"inline.limitsMax":`{count} · at most {max}`,"inline.limitsBetween":`{count} · {min} to {max}`,"inline.countMin":`Needs at least {min} (has {count}).`,"inline.countMax":`Can have at most {max} (has {count}).`,"inline.truncated":`{count} more are not shown here, so these cannot be edited in this form.`,"inline.openList":`Open the list`,"inline.duplicateNote":`Duplicate copies this record only, not its {names}.`,"form.new":`New {name}`,"form.back":`Back`,"form.edit":`Edit`,"dashboard.title":`Dashboard`,"dashboard.subtitle":`Your shop over the chosen period`,"dashboard.period":`Period`,"dashboard.day":`Today`,"dashboard.week":`Week`,"dashboard.month":`Month`,"dashboard.year":`Year`,"dashboard.range":`Choose dates`,"dashboard.apply":`Show`,"dashboard.failed":`This widget could not load.`,"dashboard.retry":`Try again`,"dashboard.viewAll":`View all`,"dashboard.thisPeriod":`This period`,"dashboard.previousPeriod":`Previous period`,"stepper.since":`since {time}`,"form.viewProfile":`View`,"form.viewOnly":`You can view this record but not change it.`,"form.save":`Save`,"form.saving":`Saving…`,"form.delete":`Delete`,"form.confirmDelete":`Confirm delete`,"form.moveToTrash":`Move to trash`,"form.confirmMoveToTrash":`Confirm move to trash`,"form.deleting":`Deleting…`,"form.keep":`Keep`,"form.related":`Related`,"form.add":`Add {name}`,"form.remove":`Remove {name} {index}`,"form.conflictTitle":`Someone else saved this record while you were editing it.`,"form.conflictNone":`None of the fields on this form changed.`,"form.keepMine":`Keep my changes`,"form.loadTheirs":`Load theirs`,"form.saveAndNew":`Save & new`,"form.duplicate":`Duplicate`,"form.savedName":`“{name}” saved.`,"form.leaveTitle":`Leave without saving? Your changes will be lost.`,"form.stay":`Stay`,"form.leave":`Leave`,"form.unsaved":`Unsaved changes`,"form.formatJson":`Format`,"form.tabHasErrors":`(has errors)`,"form.readOnly":`Read-only`,"form.externalLink":`{name} (opens in a new tab)`,"form.colorCode":`{name} colour code`,"upload.choose":`Choose a file`,"upload.chooseMany":`Choose files`,"upload.chooseImage":`Choose an image`,"upload.chooseImages":`Choose images`,"upload.replace":`Replace`,"upload.drop":`or drop it here`,"upload.dropMany":`or drop them here`,"upload.limit":`Up to {max}`,"upload.uploading":`Uploading {name}`,"upload.cancel":`Cancel uploading {name}`,"upload.remove":`Remove {name}`,"upload.open":`Open {name}`,"upload.more":`+{count}`,"upload.failed":`{name}: {message}`,"upload.busy":`Wait for the uploads to finish, then save.`,"upload.tooLarge":`The file is too large.`,"upload.tooLargeMax":`The file is too large (at most {max}).`,"upload.typeRefused":`This type of file is not accepted here.`,"upload.empty":`The file is empty.`,"upload.network":`The upload failed. Check your connection and try again.`,"upload.bytes":`{value} B`,"upload.kilobytes":`{value} KB`,"upload.megabytes":`{value} MB`,"upload.gigabytes":`{value} GB`,"upload.terabytes":`{value} TB`,"editor.loading":`Loading the editor…`,"editor.toolbar":`{name} formatting`,"editor.paragraph":`Paragraph`,"editor.heading":`Heading {level}`,"editor.bold":`Bold`,"editor.italic":`Italic`,"editor.strike":`Strikethrough`,"editor.bulletList":`Bulleted list`,"editor.orderedList":`Numbered list`,"editor.blockquote":`Quote`,"editor.rule":`Horizontal line`,"editor.link":`Link`,"editor.linkAddress":`Link address`,"editor.linkApply":`Apply`,"editor.unlink":`Remove link`,"editor.image":`Insert image`,"editor.imageNoAddress":`the server gave no address to show the image from`,"editor.table":`Insert table`,"editor.addRow":`Add row`,"editor.addColumn":`Add column`,"editor.deleteRow":`Delete row`,"editor.deleteColumn":`Delete column`,"editor.deleteTable":`Delete table`,"editor.undo":`Undo`,"editor.redo":`Redo`,"palette.open":`Search and go to`,"palette.placeholder":`Go to, create, or find records…`,"palette.results":`Results`,"palette.goTo":`Go to`,"palette.actions":`Actions`,"palette.toggleTheme":`Toggle theme`,"palette.records":`Records`,"palette.new":`New {name}`,"palette.searching":`Searching…`,"palette.noResults":`Nothing found`,"picker.typeToSearch":`Type to search…`,"picker.typeToAdd":`Type to add…`,"picker.searching":`Searching…`,"picker.noMatches":`No matches`,"picker.remove":`Remove {name}`,"picker.clear":`Clear {name}`,"picker.selected":`Selected {name}`,"validation.required":`is required`,"validation.number":`must be a number`,"validation.json":`must be valid JSON`,"validation.date":`must be a valid date`,"validation.datetime":`must be a valid date and time`,"validation.minLength":`must be at least {min} characters`,"validation.maxLength":`must be at most {max} characters`,"validation.pattern":`is not in the expected format`,"validation.email":`must be an email address`,"validation.url":`must be a URL`,"validation.uuid":`must be a UUID`,"validation.oneOf":`must be one of: {values}`,"validation.integer":`must be an integer`,"validation.min":`must be at least {min}`,"validation.max":`must be at most {max}`},m_={en:p_,fa:{"common.loading":`در حال بارگذاری…`,"common.yes":`بله`,"common.no":`خیر`,"common.empty":`—`,"common.all":`همه`,"common.cancel":`انصراف`,"common.pageNotFound":`صفحه پیدا نشد.`,"common.requestFailed":`درخواست ناموفق بود ({status})`,"common.reference":`{message} (کد پیگیری: {id})`,"shell.adminPanel":`پنل مدیریت`,"palette.move":`جابهجایی`,"palette.openItem":`باز کردن`,"palette.close":`بستن`,"shell.menu":`منو`,"shell.closeMenu":`بستن منو`,"shell.resources":`بخشها`,"shell.filterResources":`جستوجوی بخشها`,"shell.pinned":`سنجاقشده`,"shell.recent":`اخیر`,"shell.pin":`سنجاق کردن {name}`,"shell.unpin":`برداشتن سنجاق {name}`,"shell.collapseGroup":`بستن {name}`,"shell.expandGroup":`باز کردن {name}`,"shell.collapseSidebar":`جمع کردن نوار کناری`,"shell.expandSidebar":`باز کردن نوار کناری`,"shell.breadcrumbs":`مسیر صفحه`,"shell.home":`خانه`,"shell.dashboard":`داشبورد`,"shell.noMatches":`بخشی پیدا نشد.`,"shell.theme":`پوسته`,"shell.themeLight":`روشن`,"shell.themeDark":`تیره`,"shell.themeSystem":`سیستم`,"shell.language":`زبان`,"shell.noResources":`هنوز بخشی ثبت نشده است. یک provider را با @AdminResource علامت بزنید.`,"shell.records":`{count} رکورد`,"shell.aboutRecords":`حدود {count} رکورد`,"list.select":`انتخاب`,"list.done":`تمام`,"list.loadMore":`بیشتر`,"list.showing":`{shown} مورد`,"list.showingOf":`{shown} از {total}`,"list.new":`جدید`,"list.trash":`سطل زباله`,"list.trashNote":`رکوردهای سطل زباله. برای ویرایش دوباره، آن را بازگردانید.`,"list.restore":`بازگردانی`,"list.restoreRecord":`بازگردانی {name}`,"list.actions":`عملیات`,"list.noMatches":`رکوردی با این شرایط نیست.`,"list.noRecords":`هنوز رکوردی نیست.`,"list.total":`{count} مورد`,"list.about":`حدود {count}`,"list.page":`صفحه {page}`,"list.pageOf":`صفحه {page} از {pages}`,"list.range":`نمایش {from} تا {to} از {total}`,"list.rowsPerPage":`ردیف در صفحه`,"list.toggleRow":`{column}: {name}`,"list.previousPage":`صفحه قبل`,"list.nextPage":`صفحه بعد`,"list.columns":`ستونها`,"list.density":`تراکم`,"list.comfortable":`راحت`,"list.compact":`فشرده`,"list.moveUp":`جابهجایی {name} به بالا`,"list.moveDown":`جابهجایی {name} به پایین`,"list.resetColumns":`بازنشانی ستونها`,"list.resize":`تغییر اندازهی {name}`,"list.retry":`تلاش دوباره`,"list.loadFailed":`فهرست بارگذاری نشد.`,"list.selectPage":`انتخاب همهی این صفحه`,"list.selectRow":`انتخاب {name}`,"print.open":`چاپ {name}`,"list.export":`خروجی Excel`,"list.exporting":`در حال ساخت فایل…`,"list.exportTruncated":`فقط {count} ردیف اول در فایل آمد.`,"list.exportDone":`{file} دانلود شد.`,"list.selected":`{count} مورد انتخاب شده`,"list.deleteSelected":`حذف انتخابشدهها`,"list.confirmDeleteSelected":`حذف {count} مورد`,"list.clearSelection":`لغو انتخاب`,"list.bulkDeleted":`{count} مورد حذف شد`,"list.bulkFailed":`{count} مورد ناموفق`,"list.quickView":`نمای سریع: {name}`,"list.edit":`ویرایش`,"list.close":`بستن`,"list.editCell":`ویرایش {name}: {value}`,"action.running":`در حال اجرا…`,"action.choicesFailed":`گزینهها بارگذاری نشدند: {error}`,"action.choicesRetry":`دوباره`,"action.confirm":`«{action}» اجرا شود؟`,"action.confirmRecord":`«{action}» روی {name} اجرا شود؟`,"action.confirmSelected":`«{action}» روی {count} رکورد اجرا شود؟`,"action.eachNote":`هر یک از {count} رکورد جداگانه انجام میشود: خطای یکی بقیه را متوقف نمیکند.`,"action.atomicNote":`همه یا هیچ: اگر یکی از {count} رکورد خطا بدهد، هیچکدام تغییر نمیکند.`,"action.done":`«{action}» انجام شد.`,"action.doneGone":`«{action}» انجام شد. این رکورد دیگر در دسترس شما نیست.`,"action.bulkDone":`{action}: {count} مورد انجام شد`,"action.saveFirst":`ابتدا تغییرات را ذخیره یا لغو کنید.`,"action.more":`کارهای بیشتر`,"toast.region":`اعلانها`,"toast.dismiss":`بستن`,"settings.viewOnly":`میتوانید این تنظیمات را ببینید ولی نمیتوانید تغییرشان دهید.`,"settings.discard":`لغو تغییرات`,"secret.set":`تنظیم شده`,"secret.notSet":`تنظیم نشده`,"secret.replace":`جایگزینی`,"secret.replaceName":`جایگزینی {name}`,"secret.clear":`پاک کردن`,"secret.clearName":`پاک کردن {name}`,"secret.keep":`نگه داشتن مقدار فعلی`,"secret.willClear":`هنگام ذخیره پاک میشود.`,"secret.undo":`بازگردانی`,"filters.search":`جستوجو`,"filters.searchIn":`جستوجو در {fields}`,"filters.filtersAndSort":`فیلتر و مرتبسازی`,"filters.showResults":`نمایش نتایج`,"filters.sortBy":`مرتبسازی بر اساس`,"filters.ascending":`{name}، صعودی`,"filters.descending":`{name}، نزولی`,"filters.filters":`فیلترها`,"filters.clear":`پاک کردن فیلترها`,"filters.from":`از`,"filters.to":`تا`,"filters.contains":`{field} شامل`,"filters.empty":`خالی`,"filters.notEmpty":`غیرخالی`,"filters.not":`بهجز `,"filters.removeChip":`حذف فیلتر {label}`,"filters.active":`فیلترهای فعال`,"filters.any":`همه`,"filters.onlyEmpty":`خالی`,"filters.hideEmpty":`غیرخالی`,"filters.emptyValues":`{field}: مقدارهای خالی`,"filters.selected":`{count} مورد`,"date.placeholder":`yyyy/mm/dd`,"date.openCalendar":`انتخاب {name} از تقویم`,"date.calendar":`تقویم {name}`,"date.previous":`قبلی`,"date.next":`بعدی`,"date.chooseMonth":`انتخاب ماه`,"date.chooseYear":`انتخاب سال`,"date.today":`امروز`,"date.clear":`پاک کردن`,"date.time":`ساعت {name}`,"auth.title":`ورود`,"auth.username":`نام کاربری`,"auth.password":`گذرواژه`,"auth.signIn":`ورود`,"auth.signingIn":`در حال ورود…`,"auth.required":`نام کاربری و گذرواژه را وارد کنید.`,"auth.failed":`ورود انجام نشد. دوباره تلاش کنید.`,"auth.userMenu":`منوی حساب {name}`,"auth.account":`حساب کاربری`,"auth.signOut":`خروج`,"auth.changePassword":`تغییر گذرواژه`,"auth.currentPassword":`گذرواژهی فعلی`,"auth.newPassword":`گذرواژهی جدید`,"auth.confirmPassword":`تکرار گذرواژهی جدید`,"auth.mismatch":`با گذرواژهی جدید یکسان نیست`,"auth.passwordChanged":`گذرواژه تغییر کرد. نشستهای دیگر شما بسته شدند.`,"auth.sessions":`دستگاههای واردشده`,"auth.signOutOthers":`خروج از همهی دستگاههای دیگر`,"auth.thisDevice":`همین دستگاه`,"auth.unknownDevice":`دستگاه ناشناخته`,"auth.lastSeen":`آخرین فعالیت {when}`,"auth.revoke":`خروج`,"auth.revokeSession":`خروج {name}`,"rbac.administration":`مدیریت`,"rbac.users":`کاربران`,"rbac.groups":`گروهها`,"rbac.roles":`نقشها`,"rbac.user":`کاربر`,"rbac.group":`گروه`,"rbac.role":`نقش`,"rbac.newUser":`کاربر جدید`,"rbac.newGroup":`گروه جدید`,"rbac.newRole":`نقش جدید`,"rbac.createUser":`ساختن کاربر`,"rbac.export":`خروجی`,"rbac.import":`ورود`,"rbac.importFile":`پروندهی نقشها برای ورود`,"rbac.imported":`{count} نقش وارد شد.`,"rbac.notJson":`این پرونده JSON نیست.`,"rbac.permissionCount":`{count} مجوز`,"rbac.system":`سیستمی`,"rbac.systemNote":`این نقش در کد تعریف شده است؛ آن را همانجا تغییر دهید.`,"rbac.name":`نام`,"rbac.labelIn":`عنوان ({language})`,"rbac.matrix":`مجوزها`,"rbac.resource":`بخش`,"rbac.op.view":`دیدن`,"rbac.op.create":`ساختن`,"rbac.op.update":`تغییر`,"rbac.op.delete":`حذف`,"rbac.op.purge":`حذف دائمی`,"rbac.grant":`{operation} {resource}`,"rbac.details":`فیلدها و ردیفهای {resource}`,"rbac.fields":`فیلدها`,"rbac.restricted":`محدود`,"rbac.fieldRule":`دسترسی به {field}`,"rbac.rule.default":`مطابق مجوزها`,"rbac.rule.defaultHidden":`پنهان (محدود)`,"rbac.rule.hidden":`پنهان`,"rbac.rule.readonly":`فقط خواندنی`,"rbac.rule.edit":`قابل ویرایش`,"rbac.scopes":`ردیفها`,"rbac.allRows":`همهی ردیفها`,"rbac.custom":`مجوزهای دیگر`,"rbac.global":`مجوزهای عمومی`,"rbac.actions":`عملیات`,"rbac.actionNote":`عملیات روی رکوردها به مجوز تغییر هم نیاز دارد.`,"rbac.pages":`صفحههای تنظیمات`,"rbac.page":`صفحه`,"rbac.viewImplied":`هر کس بتواند صفحهای را تغییر دهد، میتواند آن را ببیند.`,"rbac.noGroups":`هنوز گروهی نیست.`,"rbac.groupSummary":`{roles} نقش · {members} عضو`,"rbac.members":`اعضا`,"rbac.noMembers":`هنوز عضوی نیست.`,"rbac.addMember":`افزودن عضو`,"rbac.searchUsers":`جستوجوی کاربران`,"rbac.searchResults":`کاربران یافتهشده`,"rbac.usersFromMemberships":`سامانهی ورود شما نمیتواند کاربران را فهرست کند: اینها کاربرانی هستند که اینجا نقش یا گروه دارند.`,"rbac.superuser":`ابرکاربر`,"rbac.superuserNote":`فقط ابرکاربرها میتوانند ابرکاربر را تغییر دهند.`,"rbac.inactive":`غیرفعال`,"rbac.active":`فعال`,"rbac.displayName":`نام نمایشی`,"rbac.email":`ایمیل`,"rbac.saved":`ذخیره شد.`,"rbac.setPassword":`تعیین گذرواژه`,"rbac.setPasswordNote":`کاربر از همهجا خارج میشود.`,"rbac.passwordSet":`گذرواژه تعیین شد؛ کاربر از همهجا خارج شد.`,"auth.otpTitle":`تأیید دومرحلهای`,"auth.otp":`کد`,"auth.otpHelp":`کد ۶ رقمی برنامهٔ احراز هویت یا یکی از کدهای بازیابی را وارد کنید.`,"auth.verify":`تأیید`,"auth.otpRequired":`کد را وارد کنید.`,"auth.startOver":`ورود با حساب دیگر`,"twoFactor.title":`ورود دومرحلهای`,"twoFactor.on":`روشن`,"twoFactor.off":`خاموش`,"twoFactor.intro":`پس از گذرواژه، کدی از برنامهٔ احراز هویت خواسته شود.`,"twoFactor.setUp":`راهاندازی`,"twoFactor.scan":`کد را با برنامهٔ احراز هویت اسکن کنید یا کلید را در آن وارد کنید. سپس کدی را که برنامه نشان میدهد بنویسید.`,"twoFactor.qr":`کد QR برای برنامهٔ احراز هویت`,"twoFactor.key":`کلید`,"twoFactor.code":`کد برنامه`,"twoFactor.turnOn":`روشن کردن`,"twoFactor.recoveryTitle":`کدهای بازیابی`,"twoFactor.recoveryIntro":`این کدها را جای امنی نگه دارید. اگر دستگاهتان را گم کنید، هر کد یک بار شما را وارد میکند. دوباره نشان داده نمیشوند.`,"twoFactor.copy":`کپی کدها`,"twoFactor.copied":`کپی شد`,"twoFactor.done":`ذخیرهشان کردم`,"twoFactor.left":`{count} کد بازیابی استفادهنشده.`,"twoFactor.newCodes":`کدهای بازیابی تازه`,"twoFactor.turnOff":`خاموش کردن`,"twoFactor.password":`گذرواژهٔ شما`,"twoFactor.enabledNote":`ورود دومرحلهای روشن شد. نشستهای دیگر شما بسته شدند.`,"twoFactor.disabledNote":`ورود دومرحلهای خاموش است.`,"viewAs.start":`دیدن از نگاه این کاربر`,"viewAs.banner":`از نگاه {name}. فقط خواندنی.`,"viewAs.stop":`پایان`,"rbac.twoFactor":`ورود دومرحلهای`,"rbac.resetTwoFactor":`بازنشانی ورود دومرحلهای`,"rbac.resetTwoFactorNote":`عامل دوم کاربر را (مثلاً گوشی گمشده) خاموش میکند و او را از همهجا خارج میکند.`,"rbac.twoFactorReset":`ورود دومرحلهای این کاربر خاموش شد.`,"debugger.title":`اشکالیاب دسترسی`,"debugger.intro":`چرا کاربری چیزی را میبیند یا نمیبیند، تغییر میدهد یا نمیدهد.`,"debugger.user":`کاربر`,"debugger.resource":`منبع`,"debugger.record":`شناسهٔ رکورد (اختیاری)`,"debugger.explain":`توضیح بده`,"debugger.pick":`یک کاربر و یک منبع انتخاب کنید.`,"debugger.roles":`نقشها`,"debugger.noRoles":`بدون نقش: هیچ کاری مجاز نیست.`,"debugger.superuser":`ابرکاربر همهکاری میتواند بکند.`,"debugger.source.direct":`مستقیم داده شده`,"debugger.source.group":`از گروه {group}`,"debugger.source.resolveRoles":`از resolveRoles`,"debugger.source.adapter":`از سامانهٔ ورود`,"debugger.unknownRole":`نقشی با این نام نیست؛ چیزی نمیدهد`,"debugger.operations":`عملیات`,"debugger.allowed":`مجاز`,"debugger.denied":`غیرمجاز`,"debugger.noGrant":`هیچ نقشی آن را نمیدهد`,"debugger.viaUpdate":`{pattern} در {role} (تغییر، دیدن را هم میدهد)`,"debugger.grant":`{pattern} در {role}`,"debugger.fields":`فیلدها`,"debugger.field":`فیلد`,"debugger.result":`نتیجه`,"debugger.byRole":`به تفکیک نقش`,"debugger.forced":`همیشه دیده میشود: کلیدها و نسخه`,"debugger.scopes":`ردیفها`,"debugger.allRows":`همهٔ ردیفها`,"debugger.noRows":`هیچ ردیفی`,"debugger.someRows":`ردیفهای {scopes}`,"debugger.globalScopes":`محدود به {scopes} نیز`,"debugger.recordTitle":`رکورد {id}`,"debugger.reason.permission":`بدون مجوز`,"debugger.reason.scope":`بیرون از ردیفهایش`,"debugger.reason.rule":`قاعدهٔ این رکورد اجازه نمیدهد`,"debugger.reason.missing":`چنین رکوردی نیست`,"debugger.actions":`عملیات`,"debugger.needsUpdate":`عملیات روی رکوردها به مجوز تغییر هم نیاز دارد`,"debugger.noRecordActions":`هیچکدام روی این رکورد`,"debugger.pages":`صفحههای تنظیمات`,"audit.title":`گزارش تغییرات`,"audit.history":`تاریخچه`,"audit.details":`جزئیات`,"audit.recordTabs":`رکورد و تاریخچهی آن`,"audit.entries":`تغییرهای ثبتشده`,"audit.notAllowed":`اجازهی خواندن گزارش تغییرات را ندارید`,"audit.off":`گزارش تغییرات در این پنل فعال نیست`,"audit.empty":`هنوز چیزی ثبت نشده است.`,"audit.noMatches":`موردی پیدا نشد.`,"audit.noActor":`بدون ورود`,"audit.viewAsBy":`هنگامی که کاربر {id} از دید او نگاه میکرد`,"audit.filterByActor":`فقط کارهای {name} را نشان بده`,"audit.changedFields":`فیلدهای تغییرکرده`,"audit.before":`قبل`,"audit.after":`بعد`,"audit.becomes":`شد`,"audit.field.changed":`تغییر کرد`,"audit.field.hidden":`پنهان`,"audit.field.dropped":`بزرگتر از آن بود که نگه داشته شود`,"audit.field.truncated":`کوتاهشده`,"audit.showMore":`بیشتر`,"audit.showLess":`کمتر`,"audit.input":`ورودی`,"audit.inputTruncated":`ورودی بزرگتر از آن بود که نگه داشته شود.`,"audit.restrictedRecord":`رکوردی که نمیتوانید ببینید: جزئیات آن نشان داده نمیشود.`,"audit.restrictedChanges":`اجازهی دیدن تغییرها را ندارید.`,"audit.suppressedNote":`در همان دقیقه رخ دادند و تکتک ثبت نشدند.`,"audit.limitedNote":`ورودهای ناموفق بعدی در این دقیقه فقط شمرده میشوند.`,"audit.actionDeleted":`این عملیات رکورد را حذف کرد.`,"audit.filter.actor":`انجامدهنده (شناسهی کاربر)`,"audit.filter.event":`رویداد`,"audit.filter.eventHint":`order.updated یا auth.*`,"audit.filter.resource":`بخش`,"audit.filter.record":`شناسهی رکورد`,"audit.filter.recordHint":`نخست یک بخش انتخاب کنید`,"audit.event.unseen":`تغییری که نمیتوانید ببینید`,"audit.event.created":`ایجاد شد`,"audit.event.updated":`تغییر کرد`,"audit.event.deleted":`حذف شد`,"audit.event.trashed":`به سطل زباله رفت`,"audit.event.restored":`بازیابی شد`,"audit.event.purged":`برای همیشه حذف شد`,"audit.event.action":`«{action}» اجرا شد`,"audit.event.page":`{page} تغییر کرد`,"audit.event.login":`وارد شد`,"audit.event.logout":`خارج شد`,"audit.event.loginFailed":`ورود ناموفق`,"audit.event.loginFailedCode":`ورود ناموفق: کد دومرحلهای نادرست`,"audit.event.loginFailedLimited":`ورود ناموفق: تلاشهای بیش از حد`,"audit.event.loginFailedMore":`{count} ورود ناموفق دیگر`,"audit.event.viewAs":`پنل را از دید یک کاربر دید`,"audit.event.roleChanged":`نقش تغییر کرد`,"audit.event.groupChanged":`گروه تغییر کرد`,"audit.event.userRolesChanged":`نقشها و گروههای یک کاربر تغییر کرد`,"audit.event.userCreated":`کاربر ایجاد شد`,"audit.event.userChanged":`کاربر تغییر کرد`,"audit.event.passwordChanged":`رمز عبور تغییر کرد`,"audit.event.passwordReset":`مدیر رمز عبور را تعیین کرد`,"audit.event.twoFactorEnabled":`ورود دومرحلهای روشن شد`,"audit.event.twoFactorDisabled":`ورود دومرحلهای خاموش شد`,"audit.event.twoFactorReset":`ورود دومرحلهای بازنشانی شد`,"audit.event.recoveryCodes":`کدهای بازیابی تازه`,"audit.event.sessions":`نشستها بسته شدند`,"audit.event.sessionsOthers":`از همهی دستگاههای دیگر خارج شد`,"audit.event.sessionsOne":`از یک دستگاه خارج شد`,"display.title":`تنظیمات نمایش`,"display.calendar":`تقویم`,"display.gregorian":`میلادی`,"display.jalali":`شمسی`,"display.digits":`ارقام`,"display.accent":`رنگ اصلی`,"display.customAccent":`رنگ دیگر`,"display.defaultAccent":`پیشفرض`,"display.accentForEveryone":`برای همه`,"display.resetForEveryone":`بازگشت برای همه`,"display.logo":`لوگو`,"display.favicon":`آیکون زبانه`,"display.uploadPicture":`بارگذاری`,"display.removePicture":`حذف`,"display.latinDigits":`لاتین 123`,"display.persianDigits":`فارسی ۱۲۳`,"inline.row":`{name} ردیف {index}`,"inline.newRow":`{name} جدید {index}`,"inline.moveUp":`بردن {name} به بالا`,"inline.moveDown":`بردن {name} به پایین`,"inline.remove":`حذف {name}`,"inline.rowActions":`کارهای ردیف`,"inline.empty":`هنوز چیزی نیست.`,"inline.limitsMax":`{count} · حداکثر {max}`,"inline.limitsBetween":`{count} · از {min} تا {max}`,"inline.countMin":`دستکم {min} لازم است ({count} هست).`,"inline.countMax":`حداکثر {max} میتواند باشد ({count} هست).`,"inline.truncated":`{count} مورد دیگر اینجا نشان داده نمیشود، پس اینها در این فرم ویرایش نمیشوند.`,"inline.openList":`باز کردن فهرست`,"inline.duplicateNote":`تکثیر فقط همین رکورد را کپی میکند، نه {names} آن را.`,"form.new":`{name} جدید`,"form.back":`بازگشت`,"form.edit":`ویرایش`,"dashboard.title":`داشبورد`,"dashboard.subtitle":`وضعیت فروشگاه در بازه انتخابشده`,"dashboard.period":`بازه زمانی`,"dashboard.day":`امروز`,"dashboard.week":`هفته`,"dashboard.month":`ماه`,"dashboard.year":`سال`,"dashboard.range":`انتخاب بازه تاریخ`,"dashboard.apply":`نمایش`,"dashboard.failed":`این ویجت بارگذاری نشد.`,"dashboard.retry":`تلاش دوباره`,"dashboard.viewAll":`مشاهده همه`,"dashboard.thisPeriod":`این دوره`,"dashboard.previousPeriod":`دوره قبل`,"stepper.since":`از {time}`,"form.viewProfile":`مشاهده پروفایل`,"form.viewOnly":`میتوانید این رکورد را ببینید اما نمیتوانید آن را تغییر دهید.`,"form.save":`ذخیره`,"form.saving":`در حال ذخیره…`,"form.delete":`حذف`,"form.confirmDelete":`تأیید حذف`,"form.moveToTrash":`انتقال به سطل زباله`,"form.confirmMoveToTrash":`تأیید انتقال به سطل زباله`,"form.deleting":`در حال حذف…`,"form.keep":`نگهداشتن`,"form.related":`مرتبط`,"form.add":`افزودن {name}`,"form.remove":`حذف {name} {index}`,"form.conflictTitle":`در حین ویرایش شما، شخص دیگری این رکورد را ذخیره کرد.`,"form.conflictNone":`هیچیک از فیلدهای این فرم تغییر نکرده است.`,"form.keepMine":`تغییرات من بماند`,"form.loadTheirs":`نسخهی آنها را بارگذاری کن`,"form.saveAndNew":`ذخیره و مورد جدید`,"form.duplicate":`تکثیر`,"form.savedName":`«{name}» ذخیره شد.`,"form.leaveTitle":`بدون ذخیره خارج میشوید؟ تغییرات از دست میرود.`,"form.stay":`بمان`,"form.leave":`خروج`,"form.unsaved":`تغییرات ذخیره نشده`,"form.formatJson":`مرتبسازی`,"form.tabHasErrors":`(دارای خطا)`,"form.readOnly":`فقط خواندنی`,"form.externalLink":`{name} (در زبانهی جدید باز میشود)`,"form.colorCode":`کد رنگ {name}`,"upload.choose":`انتخاب فایل`,"upload.chooseMany":`انتخاب فایلها`,"upload.chooseImage":`انتخاب تصویر`,"upload.chooseImages":`انتخاب تصویرها`,"upload.replace":`جایگزینی`,"upload.drop":`یا آن را اینجا رها کنید`,"upload.dropMany":`یا آنها را اینجا رها کنید`,"upload.limit":`حداکثر {max}`,"upload.uploading":`در حال بارگذاری {name}`,"upload.cancel":`لغو بارگذاری {name}`,"upload.remove":`حذف {name}`,"upload.open":`باز کردن {name}`,"upload.more":`+{count}`,"upload.failed":`{name}: {message}`,"upload.busy":`تا پایان بارگذاریها صبر کنید، سپس ذخیره کنید.`,"upload.tooLarge":`فایل بیش از حد بزرگ است.`,"upload.tooLargeMax":`فایل بیش از حد بزرگ است (حداکثر {max}).`,"upload.typeRefused":`این نوع فایل اینجا پذیرفته نمیشود.`,"upload.empty":`فایل خالی است.`,"upload.network":`بارگذاری ناموفق بود. اتصال خود را بررسی کنید و دوباره تلاش کنید.`,"upload.bytes":`{value} بایت`,"upload.kilobytes":`{value} کیلوبایت`,"upload.megabytes":`{value} مگابایت`,"upload.gigabytes":`{value} گیگابایت`,"upload.terabytes":`{value} ترابایت`,"editor.loading":`در حال بارگذاری ویرایشگر…`,"editor.toolbar":`قالببندی {name}`,"editor.paragraph":`پاراگراف`,"editor.heading":`عنوان {level}`,"editor.bold":`پررنگ`,"editor.italic":`کج`,"editor.strike":`خطخورده`,"editor.bulletList":`فهرست نشانهدار`,"editor.orderedList":`فهرست شمارهدار`,"editor.blockquote":`نقلقول`,"editor.rule":`خط افقی`,"editor.link":`پیوند`,"editor.linkAddress":`نشانی پیوند`,"editor.linkApply":`اعمال`,"editor.unlink":`حذف پیوند`,"editor.image":`درج تصویر`,"editor.imageNoAddress":`سرور نشانیای برای نمایش تصویر نداد`,"editor.table":`درج جدول`,"editor.addRow":`افزودن سطر`,"editor.addColumn":`افزودن ستون`,"editor.deleteRow":`حذف سطر`,"editor.deleteColumn":`حذف ستون`,"editor.deleteTable":`حذف جدول`,"editor.undo":`واگرد`,"editor.redo":`ازنو`,"palette.open":`جستوجو و رفتن به`,"palette.placeholder":`رفتن به، ساختن، یا یافتن رکورد…`,"palette.results":`نتایج`,"palette.goTo":`رفتن به`,"palette.actions":`کارها`,"palette.toggleTheme":`تغییر تم`,"palette.records":`رکوردها`,"palette.new":`{name} جدید`,"palette.searching":`در حال جستوجو…`,"palette.noResults":`چیزی پیدا نشد`,"picker.typeToSearch":`برای جستوجو تایپ کنید…`,"picker.typeToAdd":`برای افزودن تایپ کنید…`,"picker.searching":`در حال جستوجو…`,"picker.noMatches":`موردی پیدا نشد`,"picker.remove":`حذف {name}`,"picker.clear":`پاک کردن {name}`,"picker.selected":`{name} انتخابشده`,"validation.required":`الزامی است`,"validation.number":`باید عدد باشد`,"validation.json":`باید JSON معتبر باشد`,"validation.date":`باید تاریخ معتبری باشد`,"validation.datetime":`باید تاریخ و زمان معتبر باشد`,"validation.minLength":`باید دستکم {min} نویسه باشد`,"validation.maxLength":`باید حداکثر {max} نویسه باشد`,"validation.pattern":`قالب آن درست نیست`,"validation.email":`باید نشانی ایمیل باشد`,"validation.url":`باید نشانی اینترنتی باشد`,"validation.uuid":`باید UUID باشد`,"validation.oneOf":`باید یکی از اینها باشد: {values}`,"validation.integer":`باید عدد صحیح باشد`,"validation.min":`باید دستکم {min} باشد`,"validation.max":`باید حداکثر {max} باشد`}},h_=new Set([`fa`,`ar`,`he`,`ur`]),g_=`nma.locale`,__=`en`,v_={calendar:`gregorian`,digits:`latn`};function y_(){return v_}function b_(e){v_=e}function x_(){return __}var S_={};function C_(e){S_=e??{}}function J(e,t={},n=__){return(S_[n]?.[e]??(m_[n]??p_)[e]??p_[e]).replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e)}function w_(e){return h_.has(e.split(`-`)[0])}var T_=e=>`-u-ca-${e.calendar===`persian`?`persian`:`gregory`}-nu-${e.digits}`;function E_(e,t=__){return new Intl.NumberFormat(`${t}-u-nu-${v_.digits}`).format(e)}function D_(e){return v_.digits===`arabext`?s_(e):e}function O_(e,t=__){return new Intl.DateTimeFormat(`${t}${T_(v_)}`,{dateStyle:`medium`,timeStyle:`short`}).format(e)}function k_(e,t=__){return new Intl.DateTimeFormat(`${t}${T_(v_)}`,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).format(e)}function A_(e,t=__){let n=Date.parse(`${e}T00:00:00Z`);return!/^\d{4}-\d{2}-\d{2}$/.test(e)||Number.isNaN(n)?e:new Intl.DateTimeFormat(`${t}${T_(v_)}`,{dateStyle:`medium`,timeZone:`UTC`}).format(n)}function j_(e,t=new Date,n=__){let r=Math.min(0,Math.round((e.getTime()-t.getTime())/1e3)),i=new Intl.RelativeTimeFormat(`${n}-u-nu-${v_.digits}`,{numeric:`auto`});for(let[e,t]of[[`year`,31536e3],[`month`,2592e3],[`day`,86400],[`hour`,3600],[`minute`,60]])if(Math.abs(r)>=t)return i.format(Math.trunc(r/t),e);return i.format(Math.abs(r)<10?0:r,`second`)}function M_(e){__=e,typeof document<`u`&&(document.documentElement.lang=e,document.documentElement.dir=w_(e)?`rtl`:`ltr`)}function N_(e,t){try{let t=localStorage.getItem(g_);if(t&&e.includes(t))return t}catch{}return t}var P_=(0,y.createContext)(void 0);function F_({locales:e,fallback:t,children:n}){let[r,i]=(0,y.useState)(()=>{let n=N_(e,t);return M_(n),n}),[a,o]=(0,y.useState)(()=>{let e=d_(r);return b_(e),e});return(0,b.jsx)(P_.Provider,{value:{locale:r,locales:e,setLocale:e=>{M_(e);try{localStorage.setItem(g_,e)}catch{}let t=d_(e);b_(t),o(t),i(e)},t:(e,t)=>J(e,t,r),calendar:a.calendar,digits:a.digits,setDisplay:e=>{f_(e);let t={...a,...e};b_(t),o(t)}},children:n})}function Y(){let e=(0,y.useContext)(P_);if(!e)throw Error(`useLocale() outside LocaleProvider`);return e}function X(){return Y().t}function I_(){let e=document.getElementById(`nma-config`)?.textContent;if(e)return JSON.parse(e);throw Error(`nest-my-admin: runtime config missing`)}var L_=I_(),R_=class extends Error{status;body;constructor(e,t){super(t.code===`INTERNAL`&&t.correlationId?J(`common.reference`,{message:t.message,id:t.correlationId}):t.message),this.status=e,this.body=t,this.name=`ApiError`}get fields(){return this.body.fields??{}}};function z_(e){if(!(e instanceof R_))return e.message;let t=Object.entries(e.fields).map(([e,t])=>`${e}: ${t.join(`, `)}`);return[e.message,...t].join(` — `)}var B_,V_;function H_(e){B_=e}function U_(){return B_}function W_(e){V_=e}function G_(){B_=void 0,V_?.()}function K_(e,t){let n=t.replace(/\/+$/,``);return n===``||e!==n&&!e.startsWith(`${n}/`)?e:e.slice(n.length)||`/`}function q_(e,t=``){if(!e||!e.startsWith(`/`)||e.startsWith(`//`)||e.startsWith(`/\\`))return`/`;let n=K_(e,t);return n.startsWith(`/login`)?`/`:n}var J_=`nma-view-as`;function Y_(){try{return sessionStorage.getItem(J_)??void 0}catch{return}}function X_(e){try{e===void 0?sessionStorage.removeItem(J_):sessionStorage.setItem(J_,e)}catch{}}var Z_=class extends Error{constructor(){super(`Upload aborted`),this.name=`UploadAbortedError`}},Q_=`application/octet-stream`;function $_(e){return typeof e==`object`&&!!e&&`code`in e&&`message`in e}function ev(e){return typeof e==`object`&&!!e&&typeof e.token==`string`}function tv(e,t,n,r){let i=n.createXhr?n.createXhr():new XMLHttpRequest,a=!1;return{promise:new Promise((o,s)=>{let c=e=>{a||(a=!0,e())};i.open(`POST`,`${n.apiBase}/uploads?${new URLSearchParams({resource:t.resource,field:t.field})}`),i.setRequestHeader(`Accept`,`application/json`),i.setRequestHeader(`Accept-Language`,n.locale),i.setRequestHeader(`Content-Type`,Q_),i.setRequestHeader(`X-File-Name`,encodeURIComponent(e.name)),n.csrfToken&&i.setRequestHeader(`X-CSRF-Token`,n.csrfToken),n.viewAs&&i.setRequestHeader(`X-View-As`,n.viewAs),i.upload.onprogress=e=>{e.lengthComputable&&e.total>0&&r?.(e.loaded/e.total)},i.onload=()=>{let e;try{e=i.responseText?JSON.parse(i.responseText):void 0}catch{e=void 0}let t=i.status>=200&&i.status<300&&ev(e);i.status===401&&n.onSignedOut?.(),c(()=>{t?(r?.(1),o(e)):$_(e)?s(new R_(i.status,e)):i.status===413?s(new R_(413,{code:`BAD_REQUEST`,message:J(`upload.tooLarge`,{},n.locale),correlationId:``})):s(new R_(i.status,{code:`INTERNAL`,message:J(`common.requestFailed`,{status:i.status},n.locale),correlationId:``}))})},i.onerror=()=>c(()=>s(Error(J(`upload.network`,{},n.locale)))),i.onabort=()=>c(()=>s(new Z_)),i.send(e)}),abort:()=>{a||i.abort()}}}function nv(e){if(e instanceof R_){let t=Object.values(e.fields).flat();if(t.length>0)return t.join(` `)}return e instanceof Error?e.message:String(e)}function rv(e,t){if(t.length===0)return!0;let n=e.toLowerCase();return t.some(e=>{let t=e.trim().toLowerCase();return t===`*`||t===`*/*`?!0:t.endsWith(`/*`)?n.startsWith(t.slice(0,-1)):n===t})}function iv(e,t,n){if(e.size===0)return J(`upload.empty`,{},n);if(e.size>t.maxBytes)return J(`upload.tooLargeMax`,{max:ov(t.maxBytes,n)},n);if(e.type!==``&&!rv(e.type.split(`;`)[0].trim(),t.accept))return J(`upload.typeRefused`,{},n)}var av=[`upload.bytes`,`upload.kilobytes`,`upload.megabytes`,`upload.gigabytes`,`upload.terabytes`];function ov(e,t){let n=e,r=0;for(;n>=1024&&r<av.length-1;)n/=1024,r+=1;let i=new Intl.NumberFormat(t??`${x_()}-u-nu-${y_().digits}`,{maximumFractionDigits:r===0?0:1}).format(n);return J(av[r],{value:i},t)}function sv(e,t,n){let r=[...e];if(t<0||t>=r.length||n<0||n>=r.length||t===n)return r;let[i]=r.splice(t,1);return r.splice(n,0,i),r}function cv(e){return{...e,creatable:!1,actions:[],prints:[],permissions:{create:!1,update:!1,delete:!1,purge:!1},list:{...e.list,editable:[]},form:{...e.form,create:[],update:[],requiredOnCreate:[],readonly:[...new Set([...e.form.readonly,...e.form.update,...e.form.create])]},...e.inlines?{inlines:Object.fromEntries(Object.entries(e.inlines).map(([e,t])=>[e,cv(t)]))}:{}}}function lv(e){return e.schema.readonly?e:{...e,schema:{...e.schema,readonly:!0}}}function uv(e){return e.viewAs?{...e,rbac:{...e.rbac,manage:!1}}:e}function dv(e){return typeof e==`object`&&!!e&&`code`in e&&`message`in e}async function Z(e,t={}){let n=t.method??`GET`,r=U_(),i=e===`/session`&&n===`POST`?void 0:Y_(),a=await fetch(`${L_.apiBase}${e}`,{...t,credentials:`same-origin`,headers:{Accept:`application/json`,"Accept-Language":x_(),...t.body?{"Content-Type":`application/json`}:{},...n!==`GET`&&r?{"X-CSRF-Token":r}:{},...i?{"X-View-As":i}:{},...t.headers}});a.status===401&&!e.startsWith(`/session`)&&G_();let o=await a.text(),s;try{s=o?JSON.parse(o):void 0}catch{s=void 0}if(!a.ok)throw new R_(a.status,dv(s)?s:{code:`INTERNAL`,message:J(`common.requestFailed`,{status:a.status}),correlationId:``});return s}var fv=encodeURIComponent,pv=e=>typeof e==`number`||typeof e==`string`?{"If-Match":`"${e}"`}:{};function mv(e,t,n){let r=new URLSearchParams([...n.map(e=>[`id`,e]),[`lang`,x_()]]);return`${L_.apiBase}/resources/${encodeURIComponent(e)}/print/${encodeURIComponent(t)}?${r}`}async function hv(e,t){let n=new URLSearchParams(t);n.set(`offset`,String(-new Date().getTimezoneOffset()));let r=Y_(),i=await fetch(`${L_.apiBase}/resources/${encodeURIComponent(e)}/export?${n}`,{credentials:`same-origin`,headers:{"Accept-Language":x_(),...r?{"X-View-As":r}:{}}});if(i.status===401&&G_(),!i.ok){let e=await i.json().catch(()=>void 0);throw new R_(i.status,dv(e)?e:{code:`INTERNAL`,message:J(`common.requestFailed`,{status:i.status}),correlationId:``})}let a=/filename="([^"]+)"/.exec(i.headers.get(`Content-Disposition`)??``)?.[1]??`${e}.xlsx`,o=i.headers.get(`X-Export-Truncated`);return{blob:await i.blob(),filename:a,...o?{truncated:Number(o)}:{}}}var Q={exportList:hv,session:async()=>uv(await Z(`/session`)),login:(e,t,n)=>Z(`/session`,{method:`POST`,body:JSON.stringify({username:e,password:t,...n?{otp:n}:{}})}),logout:()=>Z(`/session`,{method:`DELETE`}),sessions:()=>Z(`/account/sessions`),revokeSession:e=>Z(`/account/sessions/${fv(e)}`,{method:`DELETE`}),revokeOtherSessions:()=>Z(`/account/sessions`,{method:`DELETE`}),changePassword:(e,t)=>Z(`/account/password`,{method:`POST`,body:JSON.stringify({current:e,next:t})}),twoFactor:{status:()=>Z(`/account/2fa`),setup:()=>Z(`/account/2fa/setup`,{method:`POST`,body:`{}`}),confirm:e=>Z(`/account/2fa/confirm`,{method:`POST`,body:JSON.stringify({code:e})}),disable:e=>Z(`/account/2fa/disable`,{method:`POST`,body:JSON.stringify({password:e})}),recoveryCodes:e=>Z(`/account/2fa/recovery-codes`,{method:`POST`,body:JSON.stringify({password:e})})},meta:()=>Z(`/meta`),menuBadges:()=>Z(`/menu/badges`),dashboard:()=>Z(`/dashboard`),setPicture:(e,t)=>Z(`/appearance/${e}`,{method:`PUT`,body:t,headers:{"Content-Type":gv(t)}}),removePicture:e=>Z(`/appearance/${e}`,{method:`DELETE`}),setAppearance:e=>Z(`/appearance`,{method:`PUT`,body:JSON.stringify({accent:e})}),widget:(e,t)=>Z(`/dashboard/${encodeURIComponent(e)}?${new URLSearchParams({...t})}`),tabCounts:e=>Z(`/resources/${encodeURIComponent(e)}/tab-counts`),rbac:{catalog:()=>Z(`/rbac/catalog`),roles:()=>Z(`/rbac/roles`),role:e=>Z(`/rbac/roles/${fv(e)}`),createRole:e=>Z(`/rbac/roles`,{method:`POST`,body:JSON.stringify(e)}),updateRole:(e,t)=>Z(`/rbac/roles/${fv(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteRole:e=>Z(`/rbac/roles/${fv(e)}`,{method:`DELETE`}),exportRoles:()=>Z(`/rbac/roles/export`),importRoles:e=>Z(`/rbac/roles/import`,{method:`POST`,body:JSON.stringify(e)}),groups:()=>Z(`/rbac/groups`),group:e=>Z(`/rbac/groups/${e}`),saveGroup:(e,t)=>Z(t===void 0?`/rbac/groups`:`/rbac/groups/${t}`,{method:t===void 0?`POST`:`PATCH`,body:JSON.stringify(e)}),deleteGroup:e=>Z(`/rbac/groups/${e}`,{method:`DELETE`}),users:e=>Z(`/rbac/users?${new URLSearchParams(Object.entries(e).filter(([,e])=>e!==void 0&&e!==``).map(([e,t])=>[e,String(t)]))}`),user:e=>Z(`/rbac/users/${fv(e)}`),createUser:e=>Z(`/rbac/users`,{method:`POST`,body:JSON.stringify(e)}),updateUser:(e,t)=>Z(`/rbac/users/${fv(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),setPassword:(e,t)=>Z(`/rbac/users/${fv(e)}/password`,{method:`POST`,body:JSON.stringify({password:t})}),resetTwoFactor:e=>Z(`/rbac/users/${fv(e)}/2fa/reset`,{method:`POST`,body:`{}`}),explain:e=>Z(`/rbac/explain?${new URLSearchParams(Object.entries(e).filter(([,e])=>e!==void 0&&e!==``))}`)},upload:(e,t,n)=>tv(e,t,{apiBase:L_.apiBase,csrfToken:U_(),viewAs:Y_(),locale:x_(),onSignedOut:G_},n),search:e=>Z(`/search?${new URLSearchParams({q:e})}`),schema:async e=>{let t=await Z(`/meta/resources/${fv(e)}`);return Y_()?cv(t):t},list:(e,t)=>Z(`/resources/${fv(e)}?${t}`),remove:(e,t,n)=>Z(`/resources/${fv(e)}/${fv(t)}`,{method:`DELETE`,headers:pv(n)}),actionChoices:(e,t,n)=>Z(`/resources/${fv(e)}/actions/${fv(t)}/choices/${fv(n)}`),options:(e,t,n)=>{let r=new URLSearchParams;return n.ids?r.set(`ids`,n.ids.join(`,`)):n.search&&r.set(`search`,n.search),n.values&&r.set(`values`,n.values),n.parent&&n.values&&r.set(`parent`,n.parent),Z(`/resources/${fv(e)}/fields/${fv(t)}/options${r.size?`?${r}`:``}`)},bulkDelete:(e,t)=>Z(`/resources/${fv(e)}/bulk-delete`,{method:`POST`,body:JSON.stringify({ids:t})}),runAction:(e,t,n)=>Z(`/resources/${fv(e)}/actions/${fv(t)}`,{method:`POST`,body:JSON.stringify(n)}),page:async e=>{let t=await Z(`/pages/${fv(e)}`);return Y_()?lv(t):t},savePage:(e,t)=>Z(`/pages/${fv(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),history:(e,t,n)=>Z(`/resources/${fv(e)}/${fv(t)}/history${n?`?${new URLSearchParams({before:n})}`:``}`),audit:(e,t)=>{let n=new URLSearchParams(e);return t&&n.set(`before`,t),Z(`/audit${n.size?`?${n}`:``}`)},restore:(e,t)=>Z(`/resources/${fv(e)}/${fv(t)}/restore`,{method:`POST`,body:`{}`}),get:(e,t)=>Z(`/resources/${fv(e)}/${fv(t)}`),create:(e,t)=>Z(`/resources/${fv(e)}`,{method:`POST`,body:JSON.stringify(t)}),update:(e,t,n,r)=>Z(`/resources/${fv(e)}/${fv(t)}`,{method:`PATCH`,body:JSON.stringify(n),headers:pv(r)})};function gv(e){return/\.ico$/i.test(e.name)?`image/x-icon`:e.type?e.type:/\.svg$/i.test(e.name)?`image/svg+xml`:`application/octet-stream`}var _v=()=>ft({queryKey:[`session`],queryFn:async()=>{let e=await Q.session();return H_(e.csrfToken),e},retry:!1,staleTime:3e5}),vv=()=>{let{locale:e}=Y();return ft({queryKey:[`meta`,e],queryFn:Q.meta})},yv=(e,t=!0)=>{let{locale:n}=Y();return ft({queryKey:[`schema`,e,n],queryFn:()=>Q.schema(e),enabled:t})},bv=e=>ft({queryKey:[`menu-badges`],queryFn:Q.menuBadges,enabled:e,refetchInterval:6e4,refetchOnWindowFocus:!0}),xv=e=>{let{locale:t}=Y();return ft({queryKey:[`page`,e,t],queryFn:()=>Q.page(e)})},Sv=(e,t,n=!0)=>ft({queryKey:[`list`,e,t],queryFn:()=>Q.list(e,new URLSearchParams(t)),placeholderData:ue,enabled:n}),Cv=(e,t)=>ft({queryKey:[`record`,e,t],queryFn:()=>Q.get(e,t),enabled:t!==void 0}),wv=(e,t,n,r,i,a)=>ft({queryKey:[`options`,e,t,n,i??``,a??``],queryFn:()=>Q.options(e,t,{search:n,values:i,parent:a}),enabled:r,placeholderData:ue}),Tv=(e,t,n)=>ft({queryKey:[`action-choices`,e,t,n],queryFn:()=>Q.actionChoices(e,t,n),staleTime:0,gcTime:0,retry:1}),Ev=(e,t,n)=>ft({queryKey:[`options`,e,t,`ids`,n],queryFn:()=>Q.options(e,t,{ids:n}),enabled:n.length>0}),Dv=function(e,t){let n=e,r=kv[t],i=null,a=0,o=null,s=[],c={},l=function(e,t){a=n*4+17,i=function(e){let t=Array(e);for(let n=0;n<e;n+=1){t[n]=Array(e);for(let r=0;r<e;r+=1)t[n][r]=null}return t}(a),u(0,0),u(a-7,0),u(0,a-7),p(),f(),h(e,t),n>=7&&m(e),o??=v(n,r,s),g(o,t)},u=function(e,t){for(let n=-1;n<=7;n+=1)if(!(e+n<=-1||a<=e+n))for(let r=-1;r<=7;r+=1)t+r<=-1||a<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?i[e+n][t+r]=!0:i[e+n][t+r]=!1)},d=function(){let e=0,t=0;for(let n=0;n<8;n+=1){l(!0,n);let r=jv.getLostPoint(c);(n==0||e>r)&&(e=r,t=n)}return t},f=function(){for(let e=8;e<a-8;e+=1)i[e][6]??(i[e][6]=e%2==0);for(let e=8;e<a-8;e+=1)i[6][e]??(i[6][e]=e%2==0)},p=function(){let e=jv.getPatternPosition(n);for(let t=0;t<e.length;t+=1)for(let n=0;n<e.length;n+=1){let r=e[t],a=e[n];if(i[r][a]==null)for(let e=-2;e<=2;e+=1)for(let t=-2;t<=2;t+=1)e==-2||e==2||t==-2||t==2||e==0&&t==0?i[r+e][a+t]=!0:i[r+e][a+t]=!1}},m=function(e){let t=jv.getBCHTypeNumber(n);for(let n=0;n<18;n+=1){let r=!e&&(t>>n&1)==1;i[Math.floor(n/3)][n%3+a-8-3]=r}for(let n=0;n<18;n+=1){let r=!e&&(t>>n&1)==1;i[n%3+a-8-3][Math.floor(n/3)]=r}},h=function(e,t){let n=r<<3|t,o=jv.getBCHTypeInfo(n);for(let t=0;t<15;t+=1){let n=!e&&(o>>t&1)==1;t<6?i[t][8]=n:t<8?i[t+1][8]=n:i[a-15+t][8]=n}for(let t=0;t<15;t+=1){let n=!e&&(o>>t&1)==1;t<8?i[8][a-t-1]=n:t<9?i[8][15-t-1+1]=n:i[8][15-t-1]=n}i[a-8][8]=!e},g=function(e,t){let n=-1,r=a-1,o=7,s=0,c=jv.getMaskFunction(t);for(let t=a-1;t>0;t-=2)for(t==6&&--t;;){for(let n=0;n<2;n+=1)if(i[r][t-n]==null){let a=!1;s<e.length&&(a=(e[s]>>>o&1)==1),c(r,t-n)&&(a=!a),i[r][t-n]=a,--o,o==-1&&(s+=1,o=7)}if(r+=n,r<0||a<=r){r-=n,n=-n;break}}},_=function(e,t){let n=0,r=0,i=0,a=Array(t.length),o=Array(t.length);for(let s=0;s<t.length;s+=1){let c=t[s].dataCount,l=t[s].totalCount-c;r=Math.max(r,c),i=Math.max(i,l),a[s]=Array(c);for(let t=0;t<a[s].length;t+=1)a[s][t]=255&e.getBuffer()[t+n];n+=c;let u=jv.getErrorCorrectPolynomial(l),d=Nv(a[s],u.getLength()-1).mod(u);o[s]=Array(u.getLength()-1);for(let e=0;e<o[s].length;e+=1){let t=e+d.getLength()-o[s].length;o[s][e]=t>=0?d.getAt(t):0}}let s=0;for(let e=0;e<t.length;e+=1)s+=t[e].totalCount;let c=Array(s),l=0;for(let e=0;e<r;e+=1)for(let n=0;n<t.length;n+=1)e<a[n].length&&(c[l]=a[n][e],l+=1);for(let e=0;e<i;e+=1)for(let n=0;n<t.length;n+=1)e<o[n].length&&(c[l]=o[n][e],l+=1);return c},v=function(e,t,n){let r=Pv.getRSBlocks(e,t),i=Fv();for(let t=0;t<n.length;t+=1){let r=n[t];i.put(r.getMode(),4),i.put(r.getLength(),jv.getLengthInBits(r.getMode(),e)),r.write(i)}let a=0;for(let e=0;e<r.length;e+=1)a+=r[e].dataCount;if(i.getLengthInBits()>a*8)throw`code length overflow. (`+i.getLengthInBits()+`>`+a*8+`)`;for(i.getLengthInBits()+4<=a*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=a*8||(i.put(236,8),i.getLengthInBits()>=a*8));)i.put(17,8);return _(i,r)};c.addData=function(e,t){t||=`Byte`;let n=null;switch(t){case`Numeric`:n=Iv(e);break;case`Alphanumeric`:n=Lv(e);break;case`Byte`:n=Rv(e);break;case`Kanji`:n=zv(e);break;default:throw`mode:`+t}s.push(n),o=null},c.isDark=function(e,t){if(e<0||a<=e||t<0||a<=t)throw e+`,`+t;return i[e][t]},c.getModuleCount=function(){return a},c.make=function(){if(n<1){let e=1;for(;e<40;e++){let t=Pv.getRSBlocks(e,r),n=Fv();for(let t=0;t<s.length;t++){let r=s[t];n.put(r.getMode(),4),n.put(r.getLength(),jv.getLengthInBits(r.getMode(),e)),r.write(n)}let i=0;for(let e=0;e<t.length;e++)i+=t[e].dataCount;if(n.getLengthInBits()<=i*8)break}n=e}l(!1,d())},c.createTableTag=function(e,t){e||=2,t=t===void 0?e*4:t;let n=``;n+=`<table style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: `+t+`px;`,n+=`">`,n+=`<tbody>`;for(let t=0;t<c.getModuleCount();t+=1){n+=`<tr>`;for(let r=0;r<c.getModuleCount();r+=1)n+=`<td style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: 0px;`,n+=` width: `+e+`px;`,n+=` height: `+e+`px;`,n+=` background-color: `,n+=c.isDark(t,r)?`#000000`:`#ffffff`,n+=`;`,n+=`"/>`;n+=`</tr>`}return n+=`</tbody>`,n+=`</table>`,n},c.createSvgTag=function(e,t,n,r){let i={};typeof arguments[0]==`object`&&(i=arguments[0],e=i.cellSize,t=i.margin,n=i.alt,r=i.title),e||=2,t=t===void 0?e*4:t,n=typeof n==`string`?{text:n}:n||{},n.text=n.text||null,n.id=n.text?n.id||`qrcode-description`:null,r=typeof r==`string`?{text:r}:r||{},r.text=r.text||null,r.id=r.text?r.id||`qrcode-title`:null;let a=c.getModuleCount()*e+t*2,o,s,l,u,d=``,f;for(f=`l`+e+`,0 0,`+e+` -`+e+`,0 0,-`+e+`z `,d+=`<svg version="1.1" xmlns="http://www.w3.org/2000/svg"`,d+=i.scalable?``:` width="`+a+`px" height="`+a+`px"`,d+=` viewBox="0 0 `+a+` `+a+`" `,d+=` preserveAspectRatio="xMinYMin meet"`,d+=r.text||n.text?` role="img" aria-labelledby="`+y([r.id,n.id].join(` `).trim())+`"`:``,d+=`>`,d+=r.text?`<title id="`+y(r.id)+`">`+y(r.text)+`</title>`:``,d+=n.text?`<description id="`+y(n.id)+`">`+y(n.text)+`</description>`:``,d+=`<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>`,d+=`<path d="`,l=0;l<c.getModuleCount();l+=1)for(u=l*e+t,o=0;o<c.getModuleCount();o+=1)c.isDark(l,o)&&(s=o*e+t,d+=`M`+s+`,`+u+f);return d+=`" stroke="transparent" fill="black"/>`,d+=`</svg>`,d},c.createDataURL=function(e,t){e||=2,t=t===void 0?e*4:t;let n=c.getModuleCount()*e+t*2,r=t,i=n-t;return Wv(n,n,function(t,n){if(r<=t&&t<i&&r<=n&&n<i){let i=Math.floor((t-r)/e),a=Math.floor((n-r)/e);return+!c.isDark(a,i)}return 1})},c.createImgTag=function(e,t,n){e||=2,t=t===void 0?e*4:t;let r=c.getModuleCount()*e+t*2,i=``;return i+=`<img`,i+=` src="`,i+=c.createDataURL(e,t),i+=`"`,i+=` width="`,i+=r,i+=`"`,i+=` height="`,i+=r,i+=`"`,n&&(i+=` alt="`,i+=y(n),i+=`"`),i+=`/>`,i};let y=function(e){let t=``;for(let n=0;n<e.length;n+=1){let r=e.charAt(n);switch(r){case`<`:t+=`<`;break;case`>`:t+=`>`;break;case`&`:t+=`&`;break;case`"`:t+=`"`;break;default:t+=r}}return t},b=function(e){e=e===void 0?2:e;let t=c.getModuleCount()*1+e*2,n=e,r=t-e,i,a,o,s,l,u={"██":`█`,"█ ":`▀`," █":`▄`," ":` `},d={"██":`▀`,"█ ":`▀`," █":` `," ":` `},f=``;for(i=0;i<t;i+=2){for(o=Math.floor((i-n)/1),s=Math.floor((i+1-n)/1),a=0;a<t;a+=1)l=`█`,n<=a&&a<r&&n<=i&&i<r&&c.isDark(o,Math.floor((a-n)/1))&&(l=` `),n<=a&&a<r&&n<=i+1&&i+1<r&&c.isDark(s,Math.floor((a-n)/1))?l+=` `:l+=`█`,f+=e<1&&i+1>=r?d[l]:u[l];f+=`
|
|
50
|
+
`},Dd=0,Od=[];function kd(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),i=y.useState(Dd++)[0],a=y.useState(Qu)[0],o=y.useRef(e);y.useEffect(function(){o.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Ou([e.lockRef.current],(e.shards||[]).map(wd),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=y.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Sd(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=hd(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=hd(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return xd(h,t,e,h===`h`?s:c,!0)},[]),c=y.useCallback(function(e){var n=e;if(Od.length&&Od[Od.length-1]===a){var r=`deltaY`in n?Cd(n):Sd(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Td(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(wd).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=y.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Ad(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=y.useCallback(function(e){n.current=Sd(e),r.current=void 0},[]),d=y.useCallback(function(t){l(t.type,Cd(t),t.target,s(t,e.lockRef.current))},[]),f=y.useCallback(function(t){l(t.type,Sd(t),t.target,s(t,e.lockRef.current))},[]);y.useEffect(function(){return Od.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,ud),document.addEventListener(`touchmove`,c,ud),document.addEventListener(`touchstart`,u,ud),function(){Od=Od.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,ud),document.removeEventListener(`touchmove`,c,ud),document.removeEventListener(`touchstart`,u,ud)}},[]);var p=e.removeScrollBar,m=e.inert;return y.createElement(y.Fragment,null,m?y.createElement(a,{styles:Ed(i)}):null,p?y.createElement(sd,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ad(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var jd=Hu(Uu,kd),Md=y.forwardRef(function(e,t){return y.createElement(Gu,Eu({},e,{ref:t,sideCar:jd}))});Md.classNames=Gu.classNames;var Nd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Pd=new WeakMap,Fd=new WeakMap,Id={},Ld=0,Rd=function(e){return e&&(e.host||Rd(e.parentNode))},zd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Rd(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Bd=function(e,t,n,r){var i=zd(t,Array.isArray(e)?e:[e]);Id[n]||(Id[n]=new WeakMap);var a=Id[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Pd.get(e)||0)+1,l=(a.get(e)||0)+1;Pd.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Fd.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Ld++,function(){o.forEach(function(e){var t=Pd.get(e)-1,i=a.get(e)-1;Pd.set(e,t),a.set(e,i),t||(Fd.has(e)||e.removeAttribute(r),Fd.delete(e)),i||e.removeAttribute(n)}),Ld--,Ld||(Pd=new WeakMap,Pd=new WeakMap,Fd=new WeakMap,Id={})}},Vd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Nd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Bd(r,i,n,`aria-hidden`)):function(){return null}},Hd=Object.defineProperty,Ud=(e,t)=>Hd(e,`name`,{value:t,configurable:!0}),Wd=`Dialog`,[Gd,Kd]=Ic(Wd),[qd,Jd]=Gd(Wd),Yd=Ud(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=y.useRef(null),c=y.useRef(null),[l,u]=ml({prop:r,defaultProp:i??!1,onChange:a,caller:Wd}),[d,f]=y.useState(0),[p,m]=y.useState(0);return(0,b.jsx)(qd,{scope:t,triggerRef:s,contentRef:c,contentId:Ml(),titleId:Ml(),descriptionId:Ml(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:y.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Xd=`DialogTrigger`,Zd=y.forwardRef(Ud(function(e,t){let{__scopeDialog:n,...r}=e,i=Jd(Xd,n),a=uc(t,i.triggerRef);return(0,b.jsx)(Ac.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":gf(i.open),...r,ref:a,onClick:el(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),Qd=`DialogPortal`,[$d,ef]=Gd(Qd,{forceMount:void 0}),tf=Ud(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Jd(Qd,t);return(0,b.jsx)($d,{scope:t,forceMount:n,children:y.Children.map(r,e=>(0,b.jsx)(Sl,{present:n||a.open,children:(0,b.jsx)(vu,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),nf=`DialogOverlay`,rf=y.forwardRef(Ud(function(e,t){let n=ef(nf,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Jd(nf,e.__scopeDialog);return a.modal?(0,b.jsx)(Sl,{present:r||a.open,children:(0,b.jsx)(of,{...i,ref:t})}):null},`DialogOverlay`)),af=pc(`DialogOverlay.RemoveScroll`),of=y.forwardRef(Ud(function(e,t){let{__scopeDialog:n,...r}=e,i=Jd(nf,n),a=uc(t,Jl());return(0,b.jsx)(Md,{as:af,allowPinchZoom:!0,shards:[i.contentRef],children:(0,b.jsx)(Ac.div,{"data-state":gf(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),sf=`DialogContent`,cf=y.forwardRef(Ud(function(e,t){let n=ef(sf,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Jd(sf,e.__scopeDialog);return(0,b.jsx)(Sl,{present:r||a.open,children:a.modal?(0,b.jsx)(lf,{...i,ref:t}):(0,b.jsx)(uf,{...i,ref:t})})},`DialogContent`)),lf=y.forwardRef(Ud(function(e,t){let n=Jd(sf,e.__scopeDialog),r=y.useRef(null),i=uc(t,n.contentRef,r);return y.useEffect(()=>{let e=r.current;if(e)return Vd(e)},[]),(0,b.jsx)(df,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:el(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:el(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:el(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),uf=y.forwardRef(Ud(function(e,t){let n=Jd(sf,e.__scopeDialog),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(df,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),df=y.forwardRef(Ud(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Jd(sf,n);return wu(),(0,b.jsx)(b.Fragment,{children:(0,b.jsx)(au,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,b.jsx)(ql,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":gf(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),ff=`DialogTitle`,pf=y.forwardRef(Ud(function(e,t){let{__scopeDialog:n,...r}=e,i=Jd(ff,n),{setTitleCount:a}=i;return al(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,b.jsx)(Ac.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),mf=`DialogClose`,hf=y.forwardRef(Ud(function(e,t){let{__scopeDialog:n,...r}=e,i=Jd(mf,n);return(0,b.jsx)(Ac.button,{type:`button`,...r,ref:t,onClick:el(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function gf(e){return e?`open`:`closed`}Ud(gf,`getState`);var _f=Object.defineProperty,vf=(e,t)=>_f(e,`name`,{value:t,configurable:!0});function yf(e){let[t,n]=y.useState(void 0);return al(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}vf(yf,`useSize`);var bf=Object.defineProperty,xf=(e,t)=>bf(e,`name`,{value:t,configurable:!0}),Sf=`Checkbox`,[Cf,wf]=Ic(Sf),[Tf,Ef]=Cf(Sf);function Df(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=ml({prop:n,defaultProp:i??!1,onChange:c,caller:Sf}),[m,h]=y.useState(null),[g,_]=y.useState(null),v=y.useRef(!1),[x,S]=y.useReducer(e=>e+1,0),C=!m||!!o||!!m.closest(`form`),w={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:x,onUserInteraction:S,required:l,defaultChecked:!If(i)&&i,isFormControl:C,bubbleInput:g,setBubbleInput:_};return(0,b.jsx)(Tf,{scope:t,...w,children:Ff(d)?d(w):r})}xf(Df,`CheckboxProvider`);var Of=`CheckboxTrigger`,kf=y.forwardRef(xf(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=Ef(Of,e),g=uc(i,u),_=y.useRef(c);return y.useEffect(()=>{let e=a?.form;if(e){let t=xf(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,b.jsx)(Ac.button,{type:`button`,role:`checkbox`,"aria-checked":If(c)?`mixed`:c,"aria-required":l,"data-state":Lf(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:el(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:el(n,e=>{p(),d(e=>If(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),Af=y.forwardRef(xf(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,b.jsx)(Df,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(kf,{...d,ref:t,__scopeCheckbox:n}),e&&(0,b.jsx)(Pf,{__scopeCheckbox:n})]})})},`Checkbox`)),jf=`CheckboxIndicator`,Mf=y.forwardRef(xf(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Ef(jf,n);return(0,b.jsx)(Sl,{present:r||If(a.checked)||a.checked===!0,children:(0,b.jsx)(Ac.span,{"data-state":Lf(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),Nf=`CheckboxBubbleInput`,Pf=y.forwardRef(xf(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=Ef(Nf,e),g=uc(r,h),_=yf(i),v=y.useRef(!1),x=y.useRef(s),S=y.useRef(o);y.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==S.current;S.current=o;let i=x.current!==s;x.current=s;let c=!(r&&a.current);if(i&&n){v.current=!r;let t=new Event(`click`,{bubbles:c});e.indeterminate=If(s),n.call(e,!If(s)&&s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let C=y.useRef(!If(s)&&s);return(0,b.jsx)(Ac.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??C.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:el(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function Ff(e){return typeof e==`function`}xf(Ff,`isFunction`);function If(e){return e===`indeterminate`}xf(If,`isIndeterminate`);function Lf(e){return If(e)?`indeterminate`:e?`checked`:`unchecked`}xf(Lf,`getState`);var Rf=[`top`,`right`,`bottom`,`left`],zf=Math.min,Bf=Math.max,Vf=Math.round,Hf=Math.floor,Uf=e=>({x:e,y:e}),Wf={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Gf(e,t,n){return Bf(e,zf(t,n))}function Kf(e,t){return typeof e==`function`?e(t):e}function qf(e){return e.split(`-`)[0]}function K(e){return e.split(`-`)[1]}function Jf(e){return e===`x`?`y`:`x`}function Yf(e){return e===`y`?`height`:`width`}function Xf(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Zf(e){return Jf(Xf(e))}function Qf(e,t,n){n===void 0&&(n=!1);let r=K(e),i=Zf(e),a=Yf(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=sp(o)),[o,sp(o)]}function $f(e){let t=sp(e);return[ep(e),t,ep(t)]}function ep(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var tp=[`left`,`right`],np=[`right`,`left`],rp=[`top`,`bottom`],ip=[`bottom`,`top`];function ap(e,t,n){switch(e){case`top`:case`bottom`:return n?t?np:tp:t?tp:np;case`left`:case`right`:return t?rp:ip;default:return[]}}function op(e,t,n,r){let i=K(e),a=ap(qf(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ep)))),a}function sp(e){let t=qf(e);return Wf[t]+e.slice(t.length)}function cp(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function lp(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:cp(e)}function up(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function dp(e,t,n){let{reference:r,floating:i}=e,a=Xf(t),o=Zf(t),s=Yf(o),c=qf(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=K(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function fp(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Kf(t,e),p=lp(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=up(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=up(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var pp=50,mp=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:fp},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=dp(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<pp&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=dp(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},hp=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Kf(e,t)||{};if(l==null)return{};let d=lp(u),f={x:n,y:r},p=Zf(i),m=Yf(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=zf(d[_],T),D=zf(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=Gf(E,k,O),j=!c.arrow&&K(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),gp=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Kf(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=qf(r),_=Xf(o),v=qf(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[sp(o)]:$f(o)),x=p!==`none`;!d&&x&&b.push(...op(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Qf(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Xf(t)||T.every(e=>Xf(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Xf(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function _p(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function vp(e){return Rf.some(t=>e[t]>=0)}var yp=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Kf(e,t);switch(i){case`referenceHidden`:{let e=_p(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:vp(e)}}}case`escaped`:{let e=_p(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:vp(e)}}}default:return{}}}}},bp=new Set([`left`,`top`]);async function xp(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=qf(n),s=K(n),c=Xf(n)===`y`,l=bp.has(o)?-1:1,u=a&&c?-1:1,d=Kf(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Sp=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await xp(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Cp=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Kf(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Xf(i),p=Jf(f),m=u[p],h=u[f],g=(e,t)=>Gf(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},wp=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Kf(e,t),u={x:n,y:r},d=Xf(i),f=Jf(d),p=u[f],m=u[d],h=Kf(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=bp.has(qf(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Tp=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Kf(e,t),c=await i.detectOverflow(t,s),l=qf(n),u=K(n),d=Xf(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=zf(p-c[m],g),y=zf(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Bf(c.left,c.right):S=p-2*Bf(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Ep(){return typeof window<`u`}function Dp(e){return Ap(e)?(e.nodeName||``).toLowerCase():`#document`}function Op(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function kp(e){return((Ap(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ap(e){return Ep()?e instanceof Node||e instanceof Op(e).Node:!1}function jp(e){return Ep()?e instanceof Element||e instanceof Op(e).Element:!1}function Mp(e){return Ep()?e instanceof HTMLElement||e instanceof Op(e).HTMLElement:!1}function Np(e){return!Ep()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Op(e).ShadowRoot}function Pp(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Gp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Fp(e){return/^(table|td|th)$/.test(Dp(e))}function Ip(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Lp=/transform|translate|scale|rotate|perspective|filter/,Rp=/paint|layout|strict|content/,zp=e=>!!e&&e!==`none`,Bp;function Vp(e){let t=jp(e)?Gp(e):e;return zp(t.transform)||zp(t.translate)||zp(t.scale)||zp(t.rotate)||zp(t.perspective)||!Up()&&(zp(t.backdropFilter)||zp(t.filter))||Lp.test(t.willChange||``)||Rp.test(t.contain||``)}function Hp(e){let t=qp(e);for(;Mp(t)&&!Wp(t);){if(Vp(t))return t;if(Ip(t))return null;t=qp(t)}return null}function Up(){return Bp??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Bp}function Wp(e){return/^(html|body|#document)$/.test(Dp(e))}function Gp(e){return Op(e).getComputedStyle(e)}function Kp(e){return jp(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function qp(e){if(Dp(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Np(e)&&e.host||kp(e);return Np(t)?t.host:t}function Jp(e){let t=qp(e);return Wp(t)?(e.ownerDocument||e).body:Mp(t)&&Pp(t)?t:Jp(t)}function Yp(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Jp(e),i=r===e.ownerDocument?.body,a=Op(r);if(i){let e=Xp(a);return t.concat(a,a.visualViewport||[],Pp(r)?r:[],e&&n?Yp(e):[])}return t.concat(r,Yp(r,[],n))}function Xp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Zp(e){let t=Gp(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Mp(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Vf(n)!==a||Vf(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Qp(e){return jp(e)?e:e.contextElement}function $p(e){let t=Qp(e);if(!Mp(t))return Uf(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Zp(t),o=(a?Vf(n.width):n.width)/r,s=(a?Vf(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var em=Uf(0);function tm(e){let t=Op(e);return!Up()||!t.visualViewport?em:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nm(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Op(e)}function rm(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Qp(e),o=Uf(1);t&&(r?jp(r)&&(o=$p(r)):o=$p(e));let s=nm(a,n,r)?tm(a):Uf(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Op(a),t=jp(r)?Op(r):r,n=e,i=Xp(n);for(;i&&t!==n;){let e=$p(i),t=i.getBoundingClientRect(),r=Gp(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Op(i),i=Xp(n)}}return up({width:u,height:d,x:c,y:l})}function im(e,t){let n=Kp(e).scrollLeft;return t?t.left+n:rm(kp(e)).left+n}function am(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-im(e,n),y:n.top+t.scrollTop}}function om(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=kp(r),s=t?Ip(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Uf(1),u=Uf(0),d=Mp(r);if((d||!a)&&((Dp(r)!==`body`||Pp(o))&&(c=Kp(r)),d)){let e=rm(r);l=$p(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?am(o,c):Uf(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function sm(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function cm(e){let t=Kp(e),n=e.ownerDocument.body,r=Bf(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Bf(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+im(e),o=-t.scrollTop;return Gp(n).direction===`rtl`&&(a+=Bf(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var lm=25;function um(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Op(e),a=kp(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Up()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(im(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=lm&&(s-=o)}return{width:s,height:c,x:l,y:u}}function dm(e,t){let n=rm(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=$p(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function fm(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=um(e,n,t);else if(t===`document`)r=cm(kp(e));else if(jp(t))r=dm(t,n);else{let n=tm(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return up(r)}function pm(e,t){let n=t.get(e);if(n)return n;let r=Yp(e,[],!1).filter(e=>jp(e)&&Dp(e)!==`body`),i=null,a=Gp(e).position===`fixed`,o=a?qp(e):e;for(;jp(o)&&!Wp(o);){let e=Gp(o),t=Vp(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=qp(o)}return t.set(e,r),r}function mm(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Ip(t)?[]:pm(t,this._c):[].concat(n),r],o=fm(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=fm(t,a[e],i);s=Bf(n.top,s),c=zf(n.right,c),l=zf(n.bottom,l),u=Bf(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function hm(e){let{width:t,height:n}=Zp(e);return{width:t,height:n}}function gm(e,t,n){let r=Mp(t),i=kp(t),a=n===`fixed`,o=rm(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Uf(0);if((r||!a)&&((Dp(t)!==`body`||Pp(i))&&(s=Kp(t)),r)){let e=rm(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=im(i));let l=i&&!r&&!a?am(i,s):Uf(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function _m(e){return Gp(e).position===`static`}function vm(e,t){if(!Mp(e)||Gp(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return kp(e)===n&&(n=n.ownerDocument.body),n}function ym(e,t){let n=Op(e);if(Ip(e))return n;if(!Mp(e)){let t=qp(e);for(;t&&!Wp(t);){if(jp(t)&&!_m(t))return t;t=qp(t)}return n}let r=vm(e,t);for(;r&&Fp(r)&&_m(r);)r=vm(r,t);return r&&Wp(r)&&_m(r)&&!Vp(r)?n:r||Hp(e)||n}var bm=async function(e){let t=this.getOffsetParent||ym,n=this.getDimensions,r=await n(e.floating);return{reference:gm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function xm(e){return Gp(e).direction===`rtl`}var Sm={convertOffsetParentRelativeRectToViewportRelativeRect:om,getDocumentElement:kp,getClippingRect:mm,getOffsetParent:ym,getElementRects:bm,getClientRects:sm,getDimensions:hm,getScale:$p,isElement:jp,isRTL:xm};function Cm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wm(e,t,n){let r=null,i,a=kp(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Hf(d),h=Hf(a.clientWidth-(u+f)),g=Hf(a.clientHeight-(d+p)),_=Hf(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Bf(0,zf(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Cm(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Op(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Tm(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Qp(e),u=i||a?[...l?Yp(l):[],...t?Yp(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?wm(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?rm(e):null;c&&g();function g(){let t=rm(e);h&&!Cm(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Em=Sp,Dm=Cp,Om=gp,km=Tp,Am=yp,jm=hp,Mm=wp,Nm=(e,t,n)=>{let r=new Map,i=n??{},a={...Sm,...i.platform,_c:r};return mp(e,t,{...i,platform:a})},Pm=typeof document<`u`?y.useLayoutEffect:function(){};function Fm(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,i;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(!Fm(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Fm(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Im(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Lm(e,t){let n=Im(e);return Math.round(t*n)/n}function Rm(e){let t=y.useRef(e);return Pm(()=>{t.current=e}),t}function zm(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=y.useState(r);Fm(f,r)||p(r);let[m,h]=y.useState(null),[g,_]=y.useState(null),v=y.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=y.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=y.useRef(null),w=y.useRef(null),T=y.useRef(u),E=c!=null,D=Rm(c),O=Rm(i),k=Rm(l),A=y.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Nm(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Fm(T.current,t)&&(T.current=t,Dc.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Pm(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=y.useRef(!1);Pm(()=>(j.current=!0,()=>{j.current=!1}),[]),Pm(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=y.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:b}),[v,b]),N=y.useMemo(()=>({reference:x,floating:S}),[x,S]),ee=y.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=Lm(N.floating,u.x),r=Lm(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Im(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:ee}),[u,A,M,N,ee])}var Bm=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:jm({element:r.current,padding:i}).fn(n):r?jm({element:r,padding:i}).fn(n):{}}}},Vm=(e,t)=>{let n=Em(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hm=(e,t)=>{let n=Dm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Um=(e,t)=>({fn:Mm(e).fn,options:[e,t]}),Wm=(e,t)=>{let n=Om(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gm=(e,t)=>{let n=km(e);return{name:n.name,fn:n.fn,options:[e,t]}},Km=(e,t)=>{let n=Am(e);return{name:n.name,fn:n.fn,options:[e,t]}},qm=(e,t)=>{let n=Bm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jm=Object.defineProperty,Ym=(e,t)=>Jm(e,`name`,{value:t,configurable:!0}),Xm=`Popper`,[Zm,Qm]=Ic(Xm),[$m,eh]=Zm(Xm),th=Ym(e=>{let{__scopePopper:t,children:n}=e,[r,i]=y.useState(null),[a,o]=y.useState(void 0);return(0,b.jsx)($m,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),nh=`PopperAnchor`,rh=y.forwardRef(Ym(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=eh(nh,n),o=y.useRef(null),s=a.onAnchorChange,c=uc(t,y.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=y.useRef(null);y.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&uh(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,b.jsx)(Ac.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),ih=`PopperContent`,[ah,oh]=Zm(ih),sh=y.forwardRef(Ym(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=eh(ih,n),[_,v]=y.useState(null),x=uc(t,v),[S,C]=y.useState(null),w=yf(S),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,j={padding:O,boundary:k.filter(ch),altBoundary:A},{refs:M,floatingStyles:N,placement:ee,isPositioned:P,middlewareData:F}=zm({strategy:`fixed`,placement:D,whileElementsMounted:Ym((...e)=>Tm(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Vm({mainAxis:i+E,alignmentAxis:o}),c&&Hm({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Um():void 0,...j}),c&&Wm({...j}),Gm({...j,apply:Ym(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),S&&qm({element:S,padding:s}),lh({arrowWidth:T,arrowHeight:E}),f&&Km({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),te=g.setPlacementState;al(()=>(te(ee),()=>{te(void 0)}),[ee,te]);let[ne,re]=uh(ee),ie=zl(m);al(()=>{P&&ie?.()},[P,ie]);let ae=F.arrow?.x,oe=F.arrow?.y,se=F.arrow?.centerOffset!==0,[ce,le]=y.useState();return al(()=>{_&&le(window.getComputedStyle(_).zIndex)},[_]),(0,b.jsx)(`div`,{ref:M.setFloating,"data-radix-popper-content-wrapper":``,style:{...N,transform:P?N.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ce,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,b.jsx)(ah,{scope:n,placedSide:ne,placedAlign:re,onArrowChange:C,arrowX:ae,arrowY:oe,shouldHideArrow:se,children:(0,b.jsx)(Ac.div,{"data-side":ne,"data-align":re,...h,ref:x,style:{...h.style,animation:P?h.style?.animation:`none`}})})})},`PopperContent`));function ch(e){return e!==null}Ym(ch,`isNotNull`);var lh=Ym(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=uh(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function uh(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Ym(uh,`getSideAndAlignFromPlacement`);var dh=th,fh=rh,ph=sh,mh=Object.defineProperty,hh=y.forwardRef(((e,t)=>mh(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,b.jsx)(Ac.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),gh=Object.defineProperty,_h=(e,t)=>gh(e,`name`,{value:t,configurable:!0});function vh(e){let t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}_h(vh,`usePrevious`);var yh=Object.defineProperty,bh=(e,t)=>yh(e,`name`,{value:t,configurable:!0});function xh(e,[t,n]){return Math.min(n,Math.max(t,e))}bh(xh,`clamp`);var Sh=Object.defineProperty,Ch=(e,t)=>Sh(e,`name`,{value:t,configurable:!0}),wh=`Popover`,[Th,Eh]=Ic(wh,[Qm]),Dh=Qm(),[Oh,kh]=Th(wh),Ah=Ch(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Dh(t),c=y.useRef(null),[l,u]=y.useState(!1),[d,f]=ml({prop:r,defaultProp:i??!1,onChange:a,caller:wh});return(0,b.jsx)(dh,{...s,children:(0,b.jsx)(Oh,{scope:t,contentId:Ml(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:y.useCallback(()=>u(!0),[]),onCustomAnchorRemove:y.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),jh=`PopoverTrigger`,Mh=y.forwardRef(Ch(function(e,t){let{__scopePopover:n,...r}=e,i=kh(jh,n),a=Dh(n),o=uc(t,i.triggerRef),s=(0,b.jsx)(Ac.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Gh(i.open),...r,ref:o,onClick:el(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,b.jsx)(fh,{asChild:!0,...a,children:s})},`PopoverTrigger`)),Nh=`PopoverPortal`,[Ph,Fh]=Th(Nh,{forceMount:void 0}),Ih=Ch(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=kh(Nh,t);return(0,b.jsx)(Ph,{scope:t,forceMount:n,children:(0,b.jsx)(Sl,{present:n||a.open,children:(0,b.jsx)(vu,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Lh=`PopoverContent`,Rh=y.forwardRef(Ch(function(e,t){let n=Fh(Lh,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=kh(Lh,e.__scopePopover);return(0,b.jsx)(Sl,{present:r||a.open,children:a.modal?(0,b.jsx)(Bh,{...i,ref:t}):(0,b.jsx)(Vh,{...i,ref:t})})},`PopoverContent`)),zh=pc(`PopoverContent.RemoveScroll`),Bh=y.forwardRef(Ch(function(e,t){let n=kh(Lh,e.__scopePopover),r=y.useRef(null),i=uc(t,r),a=y.useRef(!1);return y.useEffect(()=>{let e=r.current;if(e)return Vd(e)},[]),(0,b.jsx)(Md,{as:zh,allowPinchZoom:!0,children:(0,b.jsx)(Hh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:el(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:el(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:el(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),Vh=y.forwardRef(Ch(function(e,t){let n=kh(Lh,e.__scopePopover),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(Hh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Hh=y.forwardRef(Ch(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=kh(Lh,n),p=Dh(n);return wu(),(0,b.jsx)(au,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,b.jsx)(ql,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,b.jsx)(ph,{"data-state":Gh(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`)),Uh=`PopoverClose`,Wh=y.forwardRef(Ch(function(e,t){let{__scopePopover:n,...r}=e,i=kh(Uh,n);return(0,b.jsx)(Ac.button,{type:`button`,...r,ref:t,onClick:el(e.onClick,()=>i.onOpenChange(!1))})},`PopoverClose`));function Gh(e){return e?`open`:`closed`}Ch(Gh,`getState`);var Kh=Ah,qh=Mh,Jh=Ih,Yh=Rh,Xh=Wh,Zh=Object.defineProperty,Qh=(e,t)=>Zh(e,`name`,{value:t,configurable:!0}),$h=[` `,`Enter`,`ArrowUp`,`ArrowDown`],eg=[` `,`Enter`],tg=`Select`,[ng,rg,ig]=Bc(tg),[ag,og]=Ic(tg,[ig,Qm]),sg=Qm(),[cg,lg]=ag(tg),[ug,dg]=ag(tg);function fg(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=sg(t),[_,v]=y.useState(null),[x,S]=y.useState(null),[C,w]=y.useState(!1),T=Il(l),[E,D]=ml({prop:r,defaultProp:i??!1,onChange:a,caller:tg}),[O,k]=ml({prop:o,defaultProp:s,onChange:c,caller:tg}),A=y.useRef(null),j=y.useRef(O);y.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=Qh(()=>k(j.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,k]);let M=!_||!!m||!!_.closest(`form`),[N,ee]=y.useState(new Set),P=Ml(),F=Array.from(N).map(e=>e.props.value).join(`;`),te=y.useCallback(e=>{ee(t=>new Set(t).add(e))},[]),ne=y.useCallback(e=>{ee(t=>{let n=new Set(t);return n.delete(e),n})},[]),re={required:p,trigger:_,onTriggerChange:v,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:P,value:O,onValueChange:k,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:A,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:N,nativeSelectKey:F,isFormControl:M};return(0,b.jsx)(dh,{...g,children:(0,b.jsx)(cg,{scope:t,...re,children:(0,b.jsx)(ng.Provider,{scope:t,children:(0,b.jsx)(ug,{scope:t,onNativeOptionAdd:te,onNativeOptionRemove:ne,children:Jg(h)?h(re):n})})})})}Qh(fg,`SelectProvider`);var pg=Qh(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,b.jsx)(fg,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,b.jsxs)(b.Fragment,{children:[n,e?(0,b.jsx)(qg,{__scopeSelect:t}):null]})})},`Select`),mg=`SelectTrigger`,hg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=sg(n),o=lg(mg,n),s=o.disabled||r,c=uc(t,o.onTriggerChange),l=rg(n),u=y.useRef(`touch`),[d,f,p]=Xg(e=>{let t=l().filter(e=>!e.disabled),n=Zg(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=Qh(e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,b.jsx)(fh,{asChild:!0,...a,children:(0,b.jsx)(Ac.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Yg(o.value)?``:void 0,...i,ref:c,onClick:el(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:el(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:el(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&$h.includes(e.key)&&(m(),e.preventDefault())})})})},`SelectTrigger`)),gg=`SelectValue`,_g=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=lg(gg,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=uc(t,c.onValueNodeChange);al(()=>{l(u)},[l,u]);let f=Yg(c.value);return(0,b.jsx)(Ac.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,b.jsx)(y.Fragment,{children:f?o:a},f?`placeholder`:`value`)})},`SelectValue`)),vg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,b.jsx)(Ac.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[yg,bg]=ag(`SelectPortal`,{forceMount:void 0}),xg=Qh(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,b.jsx)(yg,{scope:e.__scopeSelect,forceMount:n,children:(0,b.jsx)(vu,{asChild:!0,...r})})},`SelectPortal`),Sg=`SelectContent`,Cg=y.forwardRef(Qh(function(e,t){let n=bg(Sg,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=lg(Sg,e.__scopeSelect),[o,s]=y.useState();return al(()=>{s(new DocumentFragment)},[]),(0,b.jsx)(Sl,{present:r||a.open,children:({present:e})=>e?(0,b.jsx)(kg,{...i,ref:t}):(0,b.jsx)(wg,{...i,fragment:o})})},`SelectContent`)),wg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?Dc.createPortal((0,b.jsx)(Eg,{scope:n,children:(0,b.jsx)(ng.Slot,{scope:n,children:(0,b.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),Tg=10,[Eg,Dg]=ag(Sg),Og=pc(`SelectContent.RemoveScroll`),kg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=lg(Sg,n),[x,S]=y.useState(null),[C,w]=y.useState(null),T=uc(t,S),[E,D]=y.useState(null),[O,k]=y.useState(null),A=rg(n),[j,M]=y.useState(!1),N=y.useRef(!1);y.useEffect(()=>{if(x)return Vd(x)},[x]),wu();let ee=y.useCallback(e=>{let[t,...n]=A().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&C&&(C.scrollTop=0),n===r&&C&&(C.scrollTop=C.scrollHeight),n?.focus(),document.activeElement!==i))return},[A,C]),P=y.useCallback(()=>ee([E,x]),[ee,E,x]);y.useEffect(()=>{j&&P()},[j,P]);let{onOpenChange:F,triggerPointerDownPosRef:te}=v;y.useEffect(()=>{if(x){let e={x:0,y:0},t=Qh(t=>{e={x:Math.abs(Math.round(t.pageX)-(te.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(te.current?.y??0))}},`handlePointerMove`),n=Qh(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(x)||F(!1),document.removeEventListener(`pointermove`,t),te.current=null},`handlePointerUp`);return te.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[x,F,te]),y.useEffect(()=>{let e=Qh(()=>F(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[ne,re]=Xg(e=>{let t=A().filter(e=>!e.disabled),n=Zg(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ie=y.useCallback((e,t,n)=>{let r=!N.current&&!n;(v.value!==void 0&&v.value===t||r)&&(D(e),r&&(N.current=!0))},[v.value]),ae=y.useCallback(()=>x?.focus(),[x]),oe=y.useCallback((e,t,n)=>{let r=!N.current&&!n;(v.value!==void 0&&v.value===t||r)&&k(e)},[v.value]),se=r===`popper`?jg:Ag,ce=se===jg?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,b.jsx)(Eg,{scope:n,content:x,viewport:C,onViewportChange:w,itemRefCallback:ie,selectedItem:E,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:P,selectedItemText:O,position:r,isPositioned:j,searchRef:ne,children:(0,b.jsx)(Md,{as:Og,allowPinchZoom:!0,children:(0,b.jsx)(au,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:el(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,b.jsx)(ql,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,b.jsx)(se,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ce,onPlaced:()=>M(!0),ref:T,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:el(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=A().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>ee(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),Ag=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=lg(Sg,n),o=Dg(Sg,n),[s,c]=y.useState(null),[l,u]=y.useState(null),d=uc(t,u),f=rg(n),p=y.useRef(!1),m=y.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,x=y.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Tg,d=xh(a,[Tg,Math.max(Tg,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Tg,d=xh(a,[Tg,Math.max(Tg,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Tg*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Tg,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Tg}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);al(()=>x(),[x]);let[S,C]=y.useState();al(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]);let w=y.useCallback(e=>{e&&m.current===!0&&(x(),v?.(),m.current=!1)},[x,v]);return(0,b.jsx)(Mg,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:w,children:(0,b.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,b.jsx)(Ac.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),jg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Tg,...a}=e,o=sg(n);return(0,b.jsx)(ph,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.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)`}})},`SelectPopperPosition`)),[Mg,Ng]=ag(Sg,{}),Pg=`SelectViewport`,Fg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=Dg(Pg,n),o=Ng(Pg,n),s=uc(t,a.onViewportChange),c=y.useRef(0);return(0,b.jsxs)(b.Fragment,{children:[(0,b.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}),(0,b.jsx)(ng.Slot,{scope:n,children:(0,b.jsx)(Ac.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:el(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Tg*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})},`SelectViewport`)),[Ig,Lg]=ag(`SelectGroup`),Rg=`SelectItem`,[zg,Bg]=ag(Rg),Vg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=lg(Rg,n),c=Dg(Rg,n),l=s.value===r,[u,d]=y.useState(a??``),[f,p]=y.useState(!1),m=uc(t,zl(e=>c.itemRefCallback?.(e,r,i))),h=Ml(),g=y.useRef(`touch`),_=Qh(()=>{i||(s.onValueChange(r),s.onOpenChange(!1))},`handleSelect`);return(0,b.jsx)(zg,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:y.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,b.jsx)(ng.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,b.jsx)(Ac.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:el(o.onFocus,()=>p(!0)),onBlur:el(o.onBlur,()=>p(!1)),onClick:el(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:el(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:el(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:el(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:el(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:el(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(c.searchRef?.current===``||e.key!==` `)&&(eg.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Hg=`SelectItemText`,Ug=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=lg(Hg,n),s=Dg(Hg,n),c=Bg(Hg,n),l=dg(Hg,n),[u,d]=y.useState(null),f=zl(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=uc(t,d,c.onItemTextChange,f),m=u?.textContent,h=y.useMemo(()=>(0,b.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return al(()=>(g(h),()=>_(h)),[g,_,h]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Ac.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Yg(o.value)?Dc.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),Wg=`SelectItemIndicator`,Gg=y.forwardRef(Qh(function(e,t){let{__scopeSelect:n,...r}=e;return Bg(Wg,n).isSelected?(0,b.jsx)(Ac.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Kg=`SelectBubbleInput`,qg=y.forwardRef(Qh(function({__scopeSelect:e,...t},n){let r=lg(Kg,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=y.useRef(null),m=uc(n,p),h=i??``,g=vh(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return y.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,b.jsxs)(Ac.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...Mc,...t.style},ref:m,defaultValue:h,children:[Yg(i)&&!_?(0,b.jsx)(`option`,{value:``}):null,Array.from(d)]},f)},`SelectBubbleInput`));function Jg(e){return typeof e==`function`}Qh(Jg,`isFunction`);function Yg(e){return e===``||e===void 0}Qh(Yg,`shouldShowPlaceholder`);function Xg(e){let t=zl(e),n=y.useRef(``),r=y.useRef(0),i=y.useCallback(e=>{let i=n.current+e;t(i),Qh((function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(i)},[t]),a=y.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}Qh(Xg,`useTypeaheadSearch`);function Zg(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Qg(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Qh(Zg,`findNextItem`);function Qg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Qh(Qg,`wrapArray`);var $g=ac(`group/button inline-flex shrink-0 items-center justify-center rounded-control border border-transparent bg-clip-padding text-[13px] font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 cursor-pointer`,{variants:{variant:{default:`border-primary bg-primary text-primary-foreground hover:opacity-92`,outline:`border-input bg-card hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`border-input bg-card text-bad hover:bg-muted focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 gap-1.5 px-3.5 has-data-[icon=inline-end]:pe-3 has-data-[icon=inline-start]:ps-3`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1.5 px-2.5 text-[12.5px] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2`,icon:`size-9`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function q({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?mc:`button`;return(0,b.jsx)(a,{"data-slot":`button`,"data-variant":t,"data-size":n,className:U($g({variant:t,size:n,className:e})),...i})}function e_({className:e,type:t,...n}){return(0,b.jsx)(`input`,{type:t,"data-slot":`input`,className:U(`h-9 w-full min-w-0 rounded-control border border-input bg-card px-3 py-1 text-[13px] transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function t_({className:e,...t}){return(0,b.jsx)(hh,{"data-slot":`label`,className:U(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var n_=`۰۱۲۳۴۵۶۷۸۹`,r_=`٠١٢٣٤٥٦٧٨٩`;function i_(e){return e.replace(/[۰-۹٠-٩]/g,e=>String(Math.max(n_.indexOf(e),r_.indexOf(e))))}function a_(e){return i_(e).replace(/٫/g,`.`).replace(/٬/g,`,`)}function o_(e){return e.replace(/[0-9]/g,e=>n_[Number(e)])}function s_(e){return o_(e).replace(/\./g,`٫`).replace(/,/g,`٬`)}var c_=`nma.calendar`,l_=`nma.digits`;function u_(e){try{return localStorage.getItem(e)}catch{return null}}function d_(e){let t=u_(c_),n=u_(l_);return{calendar:t===`gregorian`||t===`persian`?t:e.split(`-`)[0]===`fa`?`persian`:`gregorian`,digits:n===`latn`||n===`arabext`?n:e.split(`-`)[0]===`fa`?`arabext`:`latn`}}function f_(e){try{e.calendar&&localStorage.setItem(c_,e.calendar),e.digits&&localStorage.setItem(l_,e.digits)}catch{}}var p_={"common.loading":`Loading…`,"common.yes":`Yes`,"common.no":`No`,"common.empty":`—`,"common.all":`All`,"common.cancel":`Cancel`,"common.pageNotFound":`Page not found.`,"common.requestFailed":`Request failed ({status})`,"common.reference":`{message} (reference: {id})`,"shell.adminPanel":`Admin panel`,"palette.move":`Move`,"palette.openItem":`Open`,"palette.close":`Close`,"shell.menu":`Menu`,"shell.closeMenu":`Close menu`,"shell.resources":`Resources`,"shell.filterResources":`Filter resources`,"shell.pinned":`Pinned`,"shell.recent":`Recent`,"shell.pin":`Pin {name}`,"shell.unpin":`Unpin {name}`,"shell.collapseGroup":`Collapse {name}`,"shell.expandGroup":`Expand {name}`,"shell.collapseSidebar":`Collapse sidebar`,"shell.expandSidebar":`Expand sidebar`,"shell.breadcrumbs":`Breadcrumbs`,"shell.home":`Home`,"shell.dashboard":`Dashboard`,"shell.noMatches":`No resources match.`,"shell.theme":`Theme`,"shell.themeLight":`Light`,"shell.themeDark":`Dark`,"shell.themeSystem":`System`,"shell.language":`Language`,"shell.noResources":`No admin resources are registered yet. Decorate a provider with @AdminResource.`,"shell.records":`{count} records`,"shell.aboutRecords":`about {count} records`,"list.select":`Select`,"list.done":`Done`,"list.loadMore":`Load more`,"list.showing":`{shown} shown`,"list.showingOf":`{shown} of {total}`,"list.new":`New`,"list.trash":`Trash`,"list.trashNote":`Records in the trash. Restore one to edit it again.`,"list.restore":`Restore`,"list.restoreRecord":`Restore {name}`,"list.actions":`Actions`,"list.noMatches":`No records match.`,"list.noRecords":`No records yet.`,"list.total":`{count} total`,"list.about":`about {count}`,"list.page":`Page {page}`,"list.pageOf":`Page {page} of {pages}`,"list.range":`Showing {from} to {to} of {total}`,"list.rowsPerPage":`Rows per page`,"list.toggleRow":`{column}: {name}`,"list.previousPage":`Previous page`,"list.nextPage":`Next page`,"list.columns":`Columns`,"list.density":`Density`,"list.comfortable":`Comfortable`,"list.compact":`Compact`,"list.moveUp":`Move {name} up`,"list.moveDown":`Move {name} down`,"list.resetColumns":`Reset columns`,"list.resize":`Resize {name}`,"list.retry":`Try again`,"list.loadFailed":`The list could not be loaded.`,"list.selectPage":`Select all on this page`,"list.selectRow":`Select {name}`,"print.open":`Print {name}`,"list.export":`Export to Excel`,"list.exporting":`Exporting…`,"list.exportTruncated":`Only the first {count} rows were exported.`,"list.exportDone":`{file} downloaded.`,"list.selected":`{count} selected`,"list.deleteSelected":`Delete selected`,"list.confirmDeleteSelected":`Delete {count}`,"list.clearSelection":`Clear selection`,"list.bulkDeleted":`{count} deleted`,"list.bulkFailed":`{count} failed`,"list.quickView":`Quick view: {name}`,"list.edit":`Edit`,"list.close":`Close`,"list.editCell":`Edit {name}: {value}`,"action.running":`Running…`,"action.choicesFailed":`The choices could not be loaded: {error}`,"action.choicesRetry":`Try again`,"action.confirm":`Run “{action}”?`,"action.confirmRecord":`Run “{action}” on {name}?`,"action.confirmSelected":`Run “{action}” on {count} records?`,"action.eachNote":`Each of the {count} records is handled on its own: one that fails does not stop the others.`,"action.atomicNote":`All or nothing: if one of the {count} records fails, none is changed.`,"action.done":`“{action}” done.`,"action.doneGone":`“{action}” done. The record is no longer in your view.`,"action.bulkDone":`{action}: {count} done`,"action.saveFirst":`Save or discard your changes first.`,"action.more":`More actions`,"toast.region":`Notifications`,"toast.dismiss":`Dismiss`,"settings.viewOnly":`You can view these settings but not change them.`,"settings.discard":`Discard changes`,"secret.set":`Set`,"secret.notSet":`Not set`,"secret.replace":`Replace`,"secret.replaceName":`Replace {name}`,"secret.clear":`Clear`,"secret.clearName":`Clear {name}`,"secret.keep":`Keep the current value`,"secret.willClear":`Will be cleared when you save.`,"secret.undo":`Undo`,"filters.filterBy":`Filter by {field}`,"filters.relationHint":`Shows only the rows whose «{field}» is what you pick. Remove the filter to see every row again.`,"filters.moreChoices":`More choices for {field}`,"filters.onlyThese":`Only {field}`,"server.validationFailed":`Validation failed`,"server.alreadyExists":`already exists`,"server.recordExists":`A record with this value already exists`,"server.requiredMissing":`A required value is missing`,"server.doesNotExist":`does not exist`,"server.relatedMissing":`A related record does not exist`,"server.notAllowed":`is not allowed`,"server.valueNotAllowed":`A value is not allowed`,"server.invalid":`is invalid`,"server.valueInvalid":`A value is invalid for its column`,"server.readOnly":`is read-only`,"server.someReadOnly":`Some fields are read-only`,"server.conflictsWithRelated":`The change conflicts with related records`,"server.stillReferred":`Other records still refer to this record`,"server.taken":`is taken`,"server.wrong":`is wrong`,"server.mustBeText":`must be text`,"server.mustBeBoolean":`must be true or false`,"server.mustBeList":`must be a list`,"server.notAChoice":`is not one of the choices`,"server.usedTwice":`is used twice`,"server.fileType":`is not an accepted file type`,"server.uploadedFile":`must be an uploaded file`,"server.signIn":`Sign in first`,"server.reload":`Missing or wrong X-CSRF-Token header; reload the page and try again`,"server.viewAsReadOnly":`Viewing as another user is read-only`,"server.tooLarge":`Request body is too large`,"server.twoFactorOn":`two-factor sign-in is already on`,"server.twoFactorOff":`two-factor sign-in is off`,"server.setupFirst":`start the setup first`,"server.minLength":`must be at least {n} characters`,"server.maxLength":`must be at most {n} characters`,"server.max":`must not be more than {n}`,"server.min":`must not be less than {n}`,"server.integer":`must be a whole number`,"server.number":`must be a number`,"server.email":`must be an email address`,"server.url":`must be a web address`,"server.date":`must be a date`,"server.positive":`must be above zero`,"server.format":`has the wrong format`,"server.maxRows":`may have at most {n} rows`,"server.changedByOther":`someone else changed this record; open the page again`,"server.recordsReadOnly":`these records are read-only`,"server.systemRole":`this is a system role and cannot be changed here`,"server.forbidden":`you may not do this`,"filters.search":`Search`,"filters.searchIn":`Search {fields}`,"filters.filtersAndSort":`Filters and sort`,"filters.showResults":`Show results`,"filters.sortBy":`Sort by`,"filters.ascending":`{name}, ascending`,"filters.descending":`{name}, descending`,"filters.filters":`Filters`,"filters.clear":`Clear filters`,"filters.from":`From`,"filters.to":`To`,"filters.contains":`{field} contains`,"filters.empty":`empty`,"filters.notEmpty":`not empty`,"filters.not":`not `,"filters.removeChip":`Remove filter {label}`,"filters.active":`Active filters`,"filters.any":`Any`,"filters.onlyEmpty":`Empty`,"filters.hideEmpty":`Not empty`,"filters.emptyValues":`{field}: empty values`,"filters.selected":`{count} selected`,"date.placeholder":`yyyy/mm/dd`,"date.openCalendar":`Choose {name} from a calendar`,"date.calendar":`{name} calendar`,"date.previous":`Previous`,"date.next":`Next`,"date.chooseMonth":`Choose a month`,"date.chooseYear":`Choose a year`,"date.today":`Today`,"date.clear":`Clear`,"date.time":`{name} time`,"auth.title":`Sign in`,"auth.username":`Username`,"auth.password":`Password`,"auth.signIn":`Sign in`,"auth.signingIn":`Signing in…`,"auth.required":`Enter your username and password.`,"auth.failed":`Signing in failed. Try again.`,"auth.userMenu":`Account menu for {name}`,"auth.account":`Account`,"auth.signOut":`Sign out`,"auth.changePassword":`Change password`,"auth.currentPassword":`Current password`,"auth.newPassword":`New password`,"auth.confirmPassword":`New password again`,"auth.mismatch":`does not match the new password`,"auth.passwordChanged":`Password changed. Your other sessions were signed out.`,"auth.sessions":`Signed-in devices`,"auth.signOutOthers":`Sign out everywhere else`,"auth.thisDevice":`This device`,"auth.unknownDevice":`Unknown device`,"auth.lastSeen":`Last active {when}`,"auth.revoke":`Sign out`,"auth.revokeSession":`Sign out {name}`,"rbac.administration":`Administration`,"rbac.users":`Users`,"rbac.groups":`Groups`,"rbac.roles":`Roles`,"rbac.user":`User`,"rbac.group":`Group`,"rbac.role":`Role`,"rbac.newUser":`New user`,"rbac.newGroup":`New group`,"rbac.newRole":`New role`,"rbac.createUser":`Create user`,"rbac.export":`Export`,"rbac.import":`Import`,"rbac.importFile":`Roles file to import`,"rbac.imported":`{count} roles imported.`,"rbac.notJson":`That file is not JSON.`,"rbac.permissionCount":`{count} permissions`,"rbac.system":`System`,"rbac.systemNote":`This role is defined in code: change it there.`,"rbac.name":`Name`,"rbac.labelIn":`Label ({language})`,"rbac.matrix":`Permissions`,"rbac.resource":`Resource`,"rbac.op.view":`View`,"rbac.op.create":`Create`,"rbac.op.update":`Change`,"rbac.op.delete":`Delete`,"rbac.op.purge":`Purge`,"rbac.grant":`{operation} {resource}`,"rbac.details":`Fields and scopes of {resource}`,"rbac.fields":`Fields`,"rbac.restricted":`restricted`,"rbac.fieldRule":`Access to {field}`,"rbac.rule.default":`As the permissions allow`,"rbac.rule.defaultHidden":`Hidden (restricted)`,"rbac.rule.hidden":`Hidden`,"rbac.rule.readonly":`Read-only`,"rbac.rule.edit":`Editable`,"rbac.scopes":`Rows`,"rbac.allRows":`all rows`,"rbac.custom":`Other permissions`,"rbac.global":`General permissions`,"rbac.actions":`Actions`,"rbac.actionNote":`Actions on records also need Change.`,"rbac.pages":`Settings pages`,"rbac.page":`Page`,"rbac.viewImplied":`Whoever may change a page may view it.`,"rbac.noGroups":`No groups yet.`,"rbac.groupSummary":`{roles} roles · {members} members`,"rbac.members":`Members`,"rbac.noMembers":`No members yet.`,"rbac.addMember":`Add a member`,"rbac.searchUsers":`Search users`,"rbac.searchResults":`Matching users`,"rbac.usersFromMemberships":`Your sign-in adapter cannot list users: these are the users that have roles or groups here.`,"rbac.superuser":`Superuser`,"rbac.superuserNote":`Only superusers can change a superuser.`,"rbac.inactive":`Inactive`,"rbac.active":`Active`,"rbac.displayName":`Display name`,"rbac.email":`Email`,"rbac.saved":`Saved.`,"rbac.setPassword":`Set password`,"rbac.setPasswordNote":`The user is signed out everywhere.`,"rbac.passwordSet":`Password set; the user was signed out everywhere.`,"auth.otpTitle":`Two-step verification`,"auth.otp":`Code`,"auth.otpHelp":`Enter the 6-digit code from your authenticator app, or one of your recovery codes.`,"auth.verify":`Verify`,"auth.otpRequired":`Enter the code.`,"auth.startOver":`Use another account`,"twoFactor.title":`Two-factor sign-in`,"twoFactor.on":`On`,"twoFactor.off":`Off`,"twoFactor.intro":`Ask for a code from an authenticator app after the password.`,"twoFactor.setUp":`Set up`,"twoFactor.scan":`Scan the code with your authenticator app, or type the key into it. Then enter the code the app shows.`,"twoFactor.qr":`QR code for your authenticator app`,"twoFactor.key":`Key`,"twoFactor.code":`Code from the app`,"twoFactor.turnOn":`Turn on`,"twoFactor.recoveryTitle":`Recovery codes`,"twoFactor.recoveryIntro":`Keep these somewhere safe. Each one signs you in once if you lose your device. They are not shown again.`,"twoFactor.copy":`Copy codes`,"twoFactor.copied":`Copied`,"twoFactor.done":`I saved them`,"twoFactor.left":`{count} unused recovery codes.`,"twoFactor.newCodes":`New recovery codes`,"twoFactor.turnOff":`Turn off`,"twoFactor.password":`Your password`,"twoFactor.enabledNote":`Two-factor sign-in is on. Your other sessions were signed out.`,"twoFactor.disabledNote":`Two-factor sign-in is off.`,"viewAs.start":`View as this user`,"viewAs.banner":`Viewing as {name}. Read-only.`,"viewAs.stop":`Stop viewing`,"rbac.twoFactor":`2FA`,"rbac.resetTwoFactor":`Reset two-factor sign-in`,"rbac.resetTwoFactorNote":`Turns off their second factor (a lost phone) and signs them out everywhere.`,"rbac.twoFactorReset":`Two-factor sign-in is off for this user.`,"debugger.title":`Permission debugger`,"debugger.intro":`Why a user can or cannot see and change things.`,"debugger.user":`User`,"debugger.resource":`Resource`,"debugger.record":`Record id (optional)`,"debugger.explain":`Explain`,"debugger.pick":`Choose a user and a resource.`,"debugger.roles":`Roles`,"debugger.noRoles":`No roles: nothing is allowed.`,"debugger.superuser":`A superuser may do everything.`,"debugger.source.direct":`assigned directly`,"debugger.source.group":`through group {group}`,"debugger.source.resolveRoles":`from resolveRoles`,"debugger.source.adapter":`from the sign-in adapter`,"debugger.unknownRole":`not a role, grants nothing`,"debugger.operations":`Operations`,"debugger.allowed":`Allowed`,"debugger.denied":`Denied`,"debugger.noGrant":`No role grants it`,"debugger.viaUpdate":`{pattern} in {role} (changing implies viewing)`,"debugger.grant":`{pattern} in {role}`,"debugger.fields":`Fields`,"debugger.field":`Field`,"debugger.result":`Result`,"debugger.byRole":`Per role`,"debugger.forced":`Always shown: keys and the version`,"debugger.scopes":`Rows`,"debugger.allRows":`All rows`,"debugger.noRows":`No rows`,"debugger.someRows":`Rows of {scopes}`,"debugger.globalScopes":`Also limited by {scopes}`,"debugger.recordTitle":`Record {id}`,"debugger.reason.permission":`no permission`,"debugger.reason.scope":`outside their rows`,"debugger.reason.rule":`a rule on this record says no`,"debugger.reason.missing":`no such record`,"debugger.actions":`Actions`,"debugger.needsUpdate":`actions on records also need Change`,"debugger.noRecordActions":`none on this record`,"debugger.pages":`Settings pages`,"audit.title":`Audit log`,"audit.history":`History`,"audit.details":`Details`,"audit.recordTabs":`Record and its history`,"audit.entries":`Recorded changes`,"audit.notAllowed":`You may not read the audit log`,"audit.off":`The audit log is not enabled in this admin`,"audit.empty":`Nothing has been recorded yet.`,"audit.noMatches":`No entries match.`,"audit.noActor":`Nobody signed in`,"audit.viewAsBy":`while user {id} was viewing as them`,"audit.filterByActor":`Show only what {name} did`,"audit.changedFields":`Changed fields`,"audit.before":`Before`,"audit.after":`After`,"audit.becomes":`became`,"audit.field.changed":`changed`,"audit.field.hidden":`hidden`,"audit.field.dropped":`too large to keep`,"audit.field.truncated":`cut short`,"audit.showMore":`Show more`,"audit.showLess":`Show less`,"audit.input":`Input`,"audit.inputTruncated":`The input was too large to keep.`,"audit.restrictedRecord":`A record you cannot see: its details are withheld.`,"audit.restrictedChanges":`You may not see what was changed.`,"audit.suppressedNote":`They came in the same minute and were not recorded one by one.`,"audit.limitedNote":`Further failures in this minute are only counted.`,"audit.actionDeleted":`The action deleted the record.`,"audit.filter.actor":`Actor (user id)`,"audit.filter.event":`Event`,"audit.filter.eventHint":`order.updated or auth.*`,"audit.filter.resource":`Resource`,"audit.filter.record":`Record id`,"audit.filter.recordHint":`Choose a resource first`,"audit.event.unseen":`A change you cannot see`,"audit.event.created":`Created`,"audit.event.updated":`Changed`,"audit.event.deleted":`Deleted`,"audit.event.trashed":`Moved to trash`,"audit.event.restored":`Restored`,"audit.event.purged":`Deleted for good`,"audit.event.action":`Ran “{action}”`,"audit.event.page":`Changed {page}`,"audit.event.login":`Signed in`,"audit.event.logout":`Signed out`,"audit.event.loginFailed":`Failed sign-in`,"audit.event.loginFailedCode":`Failed sign-in: wrong two-factor code`,"audit.event.loginFailedLimited":`Failed sign-in: too many attempts`,"audit.event.loginFailedMore":`{count} more failed sign-ins`,"audit.event.viewAs":`Viewed the admin as a user`,"audit.event.roleChanged":`Role changed`,"audit.event.groupChanged":`Group changed`,"audit.event.userRolesChanged":`Roles and groups of a user changed`,"audit.event.userCreated":`User created`,"audit.event.userChanged":`User changed`,"audit.event.passwordChanged":`Password changed`,"audit.event.passwordReset":`Password set by an administrator`,"audit.event.twoFactorEnabled":`Two-factor sign-in turned on`,"audit.event.twoFactorDisabled":`Two-factor sign-in turned off`,"audit.event.twoFactorReset":`Two-factor sign-in reset`,"audit.event.recoveryCodes":`New recovery codes`,"audit.event.sessions":`Sessions signed out`,"audit.event.sessionsOthers":`Signed out everywhere else`,"audit.event.sessionsOne":`Signed out one device`,"display.title":`Display settings`,"display.calendar":`Calendar`,"display.gregorian":`Gregorian`,"display.jalali":`Jalali`,"display.digits":`Digits`,"display.accent":`Accent colour`,"display.customAccent":`Another colour`,"display.defaultAccent":`Default`,"display.accentForEveryone":`Use for everyone`,"display.resetForEveryone":`Reset for everyone`,"display.logo":`Logo`,"display.favicon":`Tab icon`,"display.uploadPicture":`Upload`,"display.removePicture":`Remove`,"display.latinDigits":`Latin 123`,"display.persianDigits":`Persian ۱۲۳`,"inline.row":`{name} row {index}`,"inline.newRow":`New {name} {index}`,"inline.moveUp":`Move {name} up`,"inline.moveDown":`Move {name} down`,"inline.remove":`Remove {name}`,"inline.rowActions":`Row actions`,"inline.empty":`None yet.`,"inline.limitsMax":`{count} · at most {max}`,"inline.limitsBetween":`{count} · {min} to {max}`,"inline.countMin":`Needs at least {min} (has {count}).`,"inline.countMax":`Can have at most {max} (has {count}).`,"inline.truncated":`{count} more are not shown here, so these cannot be edited in this form.`,"inline.openList":`Open the list`,"inline.duplicateNote":`Duplicate copies this record only, not its {names}.`,"form.new":`New {name}`,"form.back":`Back`,"form.edit":`Edit`,"dashboard.title":`Dashboard`,"dashboard.subtitle":`Your shop over the chosen period`,"dashboard.period":`Period`,"dashboard.day":`Today`,"dashboard.week":`Week`,"dashboard.month":`Month`,"dashboard.year":`Year`,"dashboard.range":`Choose dates`,"dashboard.apply":`Show`,"dashboard.failed":`This widget could not load.`,"dashboard.retry":`Try again`,"dashboard.viewAll":`View all`,"dashboard.thisPeriod":`This period`,"dashboard.previousPeriod":`Previous period`,"stepper.since":`since {time}`,"form.viewProfile":`View`,"form.viewOnly":`You can view this record but not change it.`,"form.save":`Save`,"form.saving":`Saving…`,"form.delete":`Delete`,"form.confirmDelete":`Confirm delete`,"form.moveToTrash":`Move to trash`,"form.confirmMoveToTrash":`Confirm move to trash`,"form.deleting":`Deleting…`,"form.keep":`Keep`,"form.related":`Related`,"form.add":`Add {name}`,"form.remove":`Remove {name} {index}`,"form.conflictTitle":`Someone else saved this record while you were editing it.`,"form.conflictNone":`None of the fields on this form changed.`,"form.keepMine":`Keep my changes`,"form.loadTheirs":`Load theirs`,"form.saveAndNew":`Save & new`,"form.duplicate":`Duplicate`,"form.savedName":`“{name}” saved.`,"form.leaveTitle":`Leave without saving? Your changes will be lost.`,"form.stay":`Stay`,"form.leave":`Leave`,"form.unsaved":`Unsaved changes`,"form.formatJson":`Format`,"form.tabHasErrors":`(has errors)`,"form.readOnly":`Read-only`,"form.externalLink":`{name} (opens in a new tab)`,"form.colorCode":`{name} colour code`,"upload.choose":`Choose a file`,"upload.chooseMany":`Choose files`,"upload.chooseImage":`Choose an image`,"upload.chooseImages":`Choose images`,"upload.replace":`Replace`,"upload.drop":`or drop it here`,"upload.dropMany":`or drop them here`,"upload.limit":`Up to {max}`,"upload.uploading":`Uploading {name}`,"upload.cancel":`Cancel uploading {name}`,"upload.remove":`Remove {name}`,"upload.open":`Open {name}`,"upload.more":`+{count}`,"upload.failed":`{name}: {message}`,"upload.busy":`Wait for the uploads to finish, then save.`,"upload.tooLarge":`The file is too large.`,"upload.tooLargeMax":`The file is too large (at most {max}).`,"upload.typeRefused":`This type of file is not accepted here.`,"upload.empty":`The file is empty.`,"upload.network":`The upload failed. Check your connection and try again.`,"upload.bytes":`{value} B`,"upload.kilobytes":`{value} KB`,"upload.megabytes":`{value} MB`,"upload.gigabytes":`{value} GB`,"upload.terabytes":`{value} TB`,"editor.loading":`Loading the editor…`,"editor.toolbar":`{name} formatting`,"editor.paragraph":`Paragraph`,"editor.heading":`Heading {level}`,"editor.bold":`Bold`,"editor.italic":`Italic`,"editor.strike":`Strikethrough`,"editor.bulletList":`Bulleted list`,"editor.orderedList":`Numbered list`,"editor.blockquote":`Quote`,"editor.rule":`Horizontal line`,"editor.link":`Link`,"editor.linkAddress":`Link address`,"editor.linkApply":`Apply`,"editor.unlink":`Remove link`,"editor.image":`Insert image`,"editor.imageNoAddress":`the server gave no address to show the image from`,"editor.table":`Insert table`,"editor.addRow":`Add row`,"editor.addColumn":`Add column`,"editor.deleteRow":`Delete row`,"editor.deleteColumn":`Delete column`,"editor.deleteTable":`Delete table`,"editor.undo":`Undo`,"editor.redo":`Redo`,"palette.open":`Search and go to`,"palette.placeholder":`Go to, create, or find records…`,"palette.results":`Results`,"palette.goTo":`Go to`,"palette.actions":`Actions`,"palette.toggleTheme":`Toggle theme`,"palette.records":`Records`,"palette.new":`New {name}`,"palette.searching":`Searching…`,"palette.noResults":`Nothing found`,"picker.typeToSearch":`Type to search…`,"picker.typeToAdd":`Type to add…`,"picker.searching":`Searching…`,"picker.noMatches":`No matches`,"picker.remove":`Remove {name}`,"picker.clear":`Clear {name}`,"picker.selected":`Selected {name}`,"validation.required":`is required`,"validation.number":`must be a number`,"validation.json":`must be valid JSON`,"validation.date":`must be a valid date`,"validation.datetime":`must be a valid date and time`,"validation.minLength":`must be at least {min} characters`,"validation.maxLength":`must be at most {max} characters`,"validation.pattern":`is not in the expected format`,"validation.email":`must be an email address`,"validation.url":`must be a URL`,"validation.uuid":`must be a UUID`,"validation.oneOf":`must be one of: {values}`,"validation.integer":`must be an integer`,"validation.min":`must be at least {min}`,"validation.max":`must be at most {max}`},m_={en:p_,fa:{"common.loading":`در حال بارگذاری…`,"common.yes":`بله`,"common.no":`خیر`,"common.empty":`—`,"common.all":`همه`,"common.cancel":`انصراف`,"common.pageNotFound":`صفحه پیدا نشد.`,"common.requestFailed":`درخواست ناموفق بود ({status})`,"common.reference":`{message} (کد پیگیری: {id})`,"shell.adminPanel":`پنل مدیریت`,"palette.move":`جابهجایی`,"palette.openItem":`باز کردن`,"palette.close":`بستن`,"shell.menu":`منو`,"shell.closeMenu":`بستن منو`,"shell.resources":`بخشها`,"shell.filterResources":`جستوجوی بخشها`,"shell.pinned":`سنجاقشده`,"shell.recent":`اخیر`,"shell.pin":`سنجاق کردن {name}`,"shell.unpin":`برداشتن سنجاق {name}`,"shell.collapseGroup":`بستن {name}`,"shell.expandGroup":`باز کردن {name}`,"shell.collapseSidebar":`جمع کردن نوار کناری`,"shell.expandSidebar":`باز کردن نوار کناری`,"shell.breadcrumbs":`مسیر صفحه`,"shell.home":`خانه`,"shell.dashboard":`داشبورد`,"shell.noMatches":`بخشی پیدا نشد.`,"shell.theme":`پوسته`,"shell.themeLight":`روشن`,"shell.themeDark":`تیره`,"shell.themeSystem":`سیستم`,"shell.language":`زبان`,"shell.noResources":`هنوز بخشی ثبت نشده است. یک provider را با @AdminResource علامت بزنید.`,"shell.records":`{count} رکورد`,"shell.aboutRecords":`حدود {count} رکورد`,"list.select":`انتخاب`,"list.done":`تمام`,"list.loadMore":`بیشتر`,"list.showing":`{shown} مورد`,"list.showingOf":`{shown} از {total}`,"list.new":`جدید`,"list.trash":`سطل زباله`,"list.trashNote":`رکوردهای سطل زباله. برای ویرایش دوباره، آن را بازگردانید.`,"list.restore":`بازگردانی`,"list.restoreRecord":`بازگردانی {name}`,"list.actions":`عملیات`,"list.noMatches":`رکوردی با این شرایط نیست.`,"list.noRecords":`هنوز رکوردی نیست.`,"list.total":`{count} مورد`,"list.about":`حدود {count}`,"list.page":`صفحه {page}`,"list.pageOf":`صفحه {page} از {pages}`,"list.range":`نمایش {from} تا {to} از {total}`,"list.rowsPerPage":`ردیف در صفحه`,"list.toggleRow":`{column}: {name}`,"list.previousPage":`صفحه قبل`,"list.nextPage":`صفحه بعد`,"list.columns":`ستونها`,"list.density":`تراکم`,"list.comfortable":`راحت`,"list.compact":`فشرده`,"list.moveUp":`جابهجایی {name} به بالا`,"list.moveDown":`جابهجایی {name} به پایین`,"list.resetColumns":`بازنشانی ستونها`,"list.resize":`تغییر اندازهی {name}`,"list.retry":`تلاش دوباره`,"list.loadFailed":`فهرست بارگذاری نشد.`,"list.selectPage":`انتخاب همهی این صفحه`,"list.selectRow":`انتخاب {name}`,"print.open":`چاپ {name}`,"list.export":`خروجی Excel`,"list.exporting":`در حال ساخت فایل…`,"list.exportTruncated":`فقط {count} ردیف اول در فایل آمد.`,"list.exportDone":`{file} دانلود شد.`,"list.selected":`{count} مورد انتخاب شده`,"list.deleteSelected":`حذف انتخابشدهها`,"list.confirmDeleteSelected":`حذف {count} مورد`,"list.clearSelection":`لغو انتخاب`,"list.bulkDeleted":`{count} مورد حذف شد`,"list.bulkFailed":`{count} مورد ناموفق`,"list.quickView":`نمای سریع: {name}`,"list.edit":`ویرایش`,"list.close":`بستن`,"list.editCell":`ویرایش {name}: {value}`,"action.running":`در حال اجرا…`,"action.choicesFailed":`گزینهها بارگذاری نشدند: {error}`,"action.choicesRetry":`دوباره`,"action.confirm":`«{action}» اجرا شود؟`,"action.confirmRecord":`«{action}» روی {name} اجرا شود؟`,"action.confirmSelected":`«{action}» روی {count} رکورد اجرا شود؟`,"action.eachNote":`هر یک از {count} رکورد جداگانه انجام میشود: خطای یکی بقیه را متوقف نمیکند.`,"action.atomicNote":`همه یا هیچ: اگر یکی از {count} رکورد خطا بدهد، هیچکدام تغییر نمیکند.`,"action.done":`«{action}» انجام شد.`,"action.doneGone":`«{action}» انجام شد. این رکورد دیگر در دسترس شما نیست.`,"action.bulkDone":`{action}: {count} مورد انجام شد`,"action.saveFirst":`ابتدا تغییرات را ذخیره یا لغو کنید.`,"action.more":`کارهای بیشتر`,"toast.region":`اعلانها`,"toast.dismiss":`بستن`,"settings.viewOnly":`میتوانید این تنظیمات را ببینید ولی نمیتوانید تغییرشان دهید.`,"settings.discard":`لغو تغییرات`,"secret.set":`تنظیم شده`,"secret.notSet":`تنظیم نشده`,"secret.replace":`جایگزینی`,"secret.replaceName":`جایگزینی {name}`,"secret.clear":`پاک کردن`,"secret.clearName":`پاک کردن {name}`,"secret.keep":`نگه داشتن مقدار فعلی`,"secret.willClear":`هنگام ذخیره پاک میشود.`,"secret.undo":`بازگردانی`,"filters.filterBy":`فیلتر بر اساس {field}`,"filters.relationHint":`فقط ردیفهایی را نشان میدهد که «{field}» آنها همان انتخاب شما باشد. با برداشتن فیلتر همهی ردیفها برمیگردند.`,"filters.moreChoices":`گزینههای بیشتر برای {field}`,"filters.onlyThese":`فقط {field}`,"server.validationFailed":`مقادیر فرم درست نیست`,"server.alreadyExists":`این مقدار قبلاً ثبت شده است`,"server.recordExists":`رکوردی با همین مقدار از قبل وجود دارد`,"server.requiredMissing":`یک مقدار الزامی خالی است`,"server.doesNotExist":`وجود ندارد`,"server.relatedMissing":`رکورد مرتبط وجود ندارد`,"server.notAllowed":`مجاز نیست`,"server.valueNotAllowed":`یکی از مقادیر مجاز نیست`,"server.invalid":`نامعتبر است`,"server.valueInvalid":`یکی از مقادیر نامعتبر است`,"server.readOnly":`فقط خواندنی است`,"server.someReadOnly":`بعضی از فیلدها فقط خواندنی هستند`,"server.conflictsWithRelated":`این تغییر با رکوردهای مرتبط تداخل دارد`,"server.stillReferred":`رکوردهای دیگری هنوز به این رکورد وابستهاند`,"server.taken":`قبلاً گرفته شده است`,"server.wrong":`درست نیست`,"server.mustBeText":`باید متن باشد`,"server.mustBeBoolean":`باید بله یا خیر باشد`,"server.mustBeList":`باید فهرست باشد`,"server.notAChoice":`یکی از گزینهها را انتخاب کنید`,"server.usedTwice":`دو بار آمده است`,"server.fileType":`این نوع فایل پذیرفته نیست`,"server.uploadedFile":`باید فایل بارگذاریشده باشد`,"server.signIn":`ابتدا وارد شوید`,"server.reload":`نشست شما تازه نیست؛ صفحه را دوباره باز کنید و دوباره امتحان کنید`,"server.viewAsReadOnly":`در حالت مشاهده بهجای کاربر دیگر نمیتوان چیزی را تغییر داد`,"server.tooLarge":`حجم این درخواست بیش از حد مجاز است`,"server.twoFactorOn":`ورود دومرحلهای از قبل روشن است`,"server.twoFactorOff":`ورود دومرحلهای خاموش است`,"server.setupFirst":`ابتدا راهاندازی را شروع کنید`,"server.minLength":`دستکم {n} نویسه لازم است`,"server.maxLength":`حداکثر {n} نویسه مجاز است`,"server.max":`نباید بیشتر از {n} باشد`,"server.min":`نباید کمتر از {n} باشد`,"server.integer":`باید عدد صحیح باشد`,"server.number":`باید عدد باشد`,"server.email":`ایمیل درست نیست`,"server.url":`نشانی اینترنتی درست نیست`,"server.date":`تاریخ درست نیست`,"server.positive":`باید بزرگتر از صفر باشد`,"server.format":`قالب این مقدار درست نیست`,"server.maxRows":`حداکثر {n} ردیف مجاز است`,"server.changedByOther":`این رکورد را کس دیگری تغییر داده است؛ صفحه را دوباره باز کنید`,"server.recordsReadOnly":`این رکوردها فقط خواندنی هستند`,"server.systemRole":`این نقش سیستمی است و از اینجا تغییر نمیکند`,"server.forbidden":`اجازهی این کار را ندارید`,"filters.search":`جستوجو`,"filters.searchIn":`جستوجو در {fields}`,"filters.filtersAndSort":`فیلتر و مرتبسازی`,"filters.showResults":`نمایش نتایج`,"filters.sortBy":`مرتبسازی بر اساس`,"filters.ascending":`{name}، صعودی`,"filters.descending":`{name}، نزولی`,"filters.filters":`فیلترها`,"filters.clear":`پاک کردن فیلترها`,"filters.from":`از`,"filters.to":`تا`,"filters.contains":`{field} شامل`,"filters.empty":`خالی`,"filters.notEmpty":`غیرخالی`,"filters.not":`بهجز `,"filters.removeChip":`حذف فیلتر {label}`,"filters.active":`فیلترهای فعال`,"filters.any":`همه`,"filters.onlyEmpty":`خالی`,"filters.hideEmpty":`غیرخالی`,"filters.emptyValues":`{field}: مقدارهای خالی`,"filters.selected":`{count} مورد`,"date.placeholder":`yyyy/mm/dd`,"date.openCalendar":`انتخاب {name} از تقویم`,"date.calendar":`تقویم {name}`,"date.previous":`قبلی`,"date.next":`بعدی`,"date.chooseMonth":`انتخاب ماه`,"date.chooseYear":`انتخاب سال`,"date.today":`امروز`,"date.clear":`پاک کردن`,"date.time":`ساعت {name}`,"auth.title":`ورود`,"auth.username":`نام کاربری`,"auth.password":`گذرواژه`,"auth.signIn":`ورود`,"auth.signingIn":`در حال ورود…`,"auth.required":`نام کاربری و گذرواژه را وارد کنید.`,"auth.failed":`ورود انجام نشد. دوباره تلاش کنید.`,"auth.userMenu":`منوی حساب {name}`,"auth.account":`حساب کاربری`,"auth.signOut":`خروج`,"auth.changePassword":`تغییر گذرواژه`,"auth.currentPassword":`گذرواژهی فعلی`,"auth.newPassword":`گذرواژهی جدید`,"auth.confirmPassword":`تکرار گذرواژهی جدید`,"auth.mismatch":`با گذرواژهی جدید یکسان نیست`,"auth.passwordChanged":`گذرواژه تغییر کرد. نشستهای دیگر شما بسته شدند.`,"auth.sessions":`دستگاههای واردشده`,"auth.signOutOthers":`خروج از همهی دستگاههای دیگر`,"auth.thisDevice":`همین دستگاه`,"auth.unknownDevice":`دستگاه ناشناخته`,"auth.lastSeen":`آخرین فعالیت {when}`,"auth.revoke":`خروج`,"auth.revokeSession":`خروج {name}`,"rbac.administration":`مدیریت`,"rbac.users":`کاربران`,"rbac.groups":`گروهها`,"rbac.roles":`نقشها`,"rbac.user":`کاربر`,"rbac.group":`گروه`,"rbac.role":`نقش`,"rbac.newUser":`کاربر جدید`,"rbac.newGroup":`گروه جدید`,"rbac.newRole":`نقش جدید`,"rbac.createUser":`ساختن کاربر`,"rbac.export":`خروجی`,"rbac.import":`ورود`,"rbac.importFile":`پروندهی نقشها برای ورود`,"rbac.imported":`{count} نقش وارد شد.`,"rbac.notJson":`این پرونده JSON نیست.`,"rbac.permissionCount":`{count} مجوز`,"rbac.system":`سیستمی`,"rbac.systemNote":`این نقش در کد تعریف شده است؛ آن را همانجا تغییر دهید.`,"rbac.name":`نام`,"rbac.labelIn":`عنوان ({language})`,"rbac.matrix":`مجوزها`,"rbac.resource":`بخش`,"rbac.op.view":`دیدن`,"rbac.op.create":`ساختن`,"rbac.op.update":`تغییر`,"rbac.op.delete":`حذف`,"rbac.op.purge":`حذف دائمی`,"rbac.grant":`{operation} {resource}`,"rbac.details":`فیلدها و ردیفهای {resource}`,"rbac.fields":`فیلدها`,"rbac.restricted":`محدود`,"rbac.fieldRule":`دسترسی به {field}`,"rbac.rule.default":`مطابق مجوزها`,"rbac.rule.defaultHidden":`پنهان (محدود)`,"rbac.rule.hidden":`پنهان`,"rbac.rule.readonly":`فقط خواندنی`,"rbac.rule.edit":`قابل ویرایش`,"rbac.scopes":`ردیفها`,"rbac.allRows":`همهی ردیفها`,"rbac.custom":`مجوزهای دیگر`,"rbac.global":`مجوزهای عمومی`,"rbac.actions":`عملیات`,"rbac.actionNote":`عملیات روی رکوردها به مجوز تغییر هم نیاز دارد.`,"rbac.pages":`صفحههای تنظیمات`,"rbac.page":`صفحه`,"rbac.viewImplied":`هر کس بتواند صفحهای را تغییر دهد، میتواند آن را ببیند.`,"rbac.noGroups":`هنوز گروهی نیست.`,"rbac.groupSummary":`{roles} نقش · {members} عضو`,"rbac.members":`اعضا`,"rbac.noMembers":`هنوز عضوی نیست.`,"rbac.addMember":`افزودن عضو`,"rbac.searchUsers":`جستوجوی کاربران`,"rbac.searchResults":`کاربران یافتهشده`,"rbac.usersFromMemberships":`سامانهی ورود شما نمیتواند کاربران را فهرست کند: اینها کاربرانی هستند که اینجا نقش یا گروه دارند.`,"rbac.superuser":`ابرکاربر`,"rbac.superuserNote":`فقط ابرکاربرها میتوانند ابرکاربر را تغییر دهند.`,"rbac.inactive":`غیرفعال`,"rbac.active":`فعال`,"rbac.displayName":`نام نمایشی`,"rbac.email":`ایمیل`,"rbac.saved":`ذخیره شد.`,"rbac.setPassword":`تعیین گذرواژه`,"rbac.setPasswordNote":`کاربر از همهجا خارج میشود.`,"rbac.passwordSet":`گذرواژه تعیین شد؛ کاربر از همهجا خارج شد.`,"auth.otpTitle":`تأیید دومرحلهای`,"auth.otp":`کد`,"auth.otpHelp":`کد ۶ رقمی برنامهٔ احراز هویت یا یکی از کدهای بازیابی را وارد کنید.`,"auth.verify":`تأیید`,"auth.otpRequired":`کد را وارد کنید.`,"auth.startOver":`ورود با حساب دیگر`,"twoFactor.title":`ورود دومرحلهای`,"twoFactor.on":`روشن`,"twoFactor.off":`خاموش`,"twoFactor.intro":`پس از گذرواژه، کدی از برنامهٔ احراز هویت خواسته شود.`,"twoFactor.setUp":`راهاندازی`,"twoFactor.scan":`کد را با برنامهٔ احراز هویت اسکن کنید یا کلید را در آن وارد کنید. سپس کدی را که برنامه نشان میدهد بنویسید.`,"twoFactor.qr":`کد QR برای برنامهٔ احراز هویت`,"twoFactor.key":`کلید`,"twoFactor.code":`کد برنامه`,"twoFactor.turnOn":`روشن کردن`,"twoFactor.recoveryTitle":`کدهای بازیابی`,"twoFactor.recoveryIntro":`این کدها را جای امنی نگه دارید. اگر دستگاهتان را گم کنید، هر کد یک بار شما را وارد میکند. دوباره نشان داده نمیشوند.`,"twoFactor.copy":`کپی کدها`,"twoFactor.copied":`کپی شد`,"twoFactor.done":`ذخیرهشان کردم`,"twoFactor.left":`{count} کد بازیابی استفادهنشده.`,"twoFactor.newCodes":`کدهای بازیابی تازه`,"twoFactor.turnOff":`خاموش کردن`,"twoFactor.password":`گذرواژهٔ شما`,"twoFactor.enabledNote":`ورود دومرحلهای روشن شد. نشستهای دیگر شما بسته شدند.`,"twoFactor.disabledNote":`ورود دومرحلهای خاموش است.`,"viewAs.start":`دیدن از نگاه این کاربر`,"viewAs.banner":`از نگاه {name}. فقط خواندنی.`,"viewAs.stop":`پایان`,"rbac.twoFactor":`ورود دومرحلهای`,"rbac.resetTwoFactor":`بازنشانی ورود دومرحلهای`,"rbac.resetTwoFactorNote":`عامل دوم کاربر را (مثلاً گوشی گمشده) خاموش میکند و او را از همهجا خارج میکند.`,"rbac.twoFactorReset":`ورود دومرحلهای این کاربر خاموش شد.`,"debugger.title":`اشکالیاب دسترسی`,"debugger.intro":`چرا کاربری چیزی را میبیند یا نمیبیند، تغییر میدهد یا نمیدهد.`,"debugger.user":`کاربر`,"debugger.resource":`منبع`,"debugger.record":`شناسهٔ رکورد (اختیاری)`,"debugger.explain":`توضیح بده`,"debugger.pick":`یک کاربر و یک منبع انتخاب کنید.`,"debugger.roles":`نقشها`,"debugger.noRoles":`بدون نقش: هیچ کاری مجاز نیست.`,"debugger.superuser":`ابرکاربر همهکاری میتواند بکند.`,"debugger.source.direct":`مستقیم داده شده`,"debugger.source.group":`از گروه {group}`,"debugger.source.resolveRoles":`از resolveRoles`,"debugger.source.adapter":`از سامانهٔ ورود`,"debugger.unknownRole":`نقشی با این نام نیست؛ چیزی نمیدهد`,"debugger.operations":`عملیات`,"debugger.allowed":`مجاز`,"debugger.denied":`غیرمجاز`,"debugger.noGrant":`هیچ نقشی آن را نمیدهد`,"debugger.viaUpdate":`{pattern} در {role} (تغییر، دیدن را هم میدهد)`,"debugger.grant":`{pattern} در {role}`,"debugger.fields":`فیلدها`,"debugger.field":`فیلد`,"debugger.result":`نتیجه`,"debugger.byRole":`به تفکیک نقش`,"debugger.forced":`همیشه دیده میشود: کلیدها و نسخه`,"debugger.scopes":`ردیفها`,"debugger.allRows":`همهٔ ردیفها`,"debugger.noRows":`هیچ ردیفی`,"debugger.someRows":`ردیفهای {scopes}`,"debugger.globalScopes":`محدود به {scopes} نیز`,"debugger.recordTitle":`رکورد {id}`,"debugger.reason.permission":`بدون مجوز`,"debugger.reason.scope":`بیرون از ردیفهایش`,"debugger.reason.rule":`قاعدهٔ این رکورد اجازه نمیدهد`,"debugger.reason.missing":`چنین رکوردی نیست`,"debugger.actions":`عملیات`,"debugger.needsUpdate":`عملیات روی رکوردها به مجوز تغییر هم نیاز دارد`,"debugger.noRecordActions":`هیچکدام روی این رکورد`,"debugger.pages":`صفحههای تنظیمات`,"audit.title":`گزارش تغییرات`,"audit.history":`تاریخچه`,"audit.details":`جزئیات`,"audit.recordTabs":`رکورد و تاریخچهی آن`,"audit.entries":`تغییرهای ثبتشده`,"audit.notAllowed":`اجازهی خواندن گزارش تغییرات را ندارید`,"audit.off":`گزارش تغییرات در این پنل فعال نیست`,"audit.empty":`هنوز چیزی ثبت نشده است.`,"audit.noMatches":`موردی پیدا نشد.`,"audit.noActor":`بدون ورود`,"audit.viewAsBy":`هنگامی که کاربر {id} از دید او نگاه میکرد`,"audit.filterByActor":`فقط کارهای {name} را نشان بده`,"audit.changedFields":`فیلدهای تغییرکرده`,"audit.before":`قبل`,"audit.after":`بعد`,"audit.becomes":`شد`,"audit.field.changed":`تغییر کرد`,"audit.field.hidden":`پنهان`,"audit.field.dropped":`بزرگتر از آن بود که نگه داشته شود`,"audit.field.truncated":`کوتاهشده`,"audit.showMore":`بیشتر`,"audit.showLess":`کمتر`,"audit.input":`ورودی`,"audit.inputTruncated":`ورودی بزرگتر از آن بود که نگه داشته شود.`,"audit.restrictedRecord":`رکوردی که نمیتوانید ببینید: جزئیات آن نشان داده نمیشود.`,"audit.restrictedChanges":`اجازهی دیدن تغییرها را ندارید.`,"audit.suppressedNote":`در همان دقیقه رخ دادند و تکتک ثبت نشدند.`,"audit.limitedNote":`ورودهای ناموفق بعدی در این دقیقه فقط شمرده میشوند.`,"audit.actionDeleted":`این عملیات رکورد را حذف کرد.`,"audit.filter.actor":`انجامدهنده (شناسهی کاربر)`,"audit.filter.event":`رویداد`,"audit.filter.eventHint":`order.updated یا auth.*`,"audit.filter.resource":`بخش`,"audit.filter.record":`شناسهی رکورد`,"audit.filter.recordHint":`نخست یک بخش انتخاب کنید`,"audit.event.unseen":`تغییری که نمیتوانید ببینید`,"audit.event.created":`ایجاد شد`,"audit.event.updated":`تغییر کرد`,"audit.event.deleted":`حذف شد`,"audit.event.trashed":`به سطل زباله رفت`,"audit.event.restored":`بازیابی شد`,"audit.event.purged":`برای همیشه حذف شد`,"audit.event.action":`«{action}» اجرا شد`,"audit.event.page":`{page} تغییر کرد`,"audit.event.login":`وارد شد`,"audit.event.logout":`خارج شد`,"audit.event.loginFailed":`ورود ناموفق`,"audit.event.loginFailedCode":`ورود ناموفق: کد دومرحلهای نادرست`,"audit.event.loginFailedLimited":`ورود ناموفق: تلاشهای بیش از حد`,"audit.event.loginFailedMore":`{count} ورود ناموفق دیگر`,"audit.event.viewAs":`پنل را از دید یک کاربر دید`,"audit.event.roleChanged":`نقش تغییر کرد`,"audit.event.groupChanged":`گروه تغییر کرد`,"audit.event.userRolesChanged":`نقشها و گروههای یک کاربر تغییر کرد`,"audit.event.userCreated":`کاربر ایجاد شد`,"audit.event.userChanged":`کاربر تغییر کرد`,"audit.event.passwordChanged":`رمز عبور تغییر کرد`,"audit.event.passwordReset":`مدیر رمز عبور را تعیین کرد`,"audit.event.twoFactorEnabled":`ورود دومرحلهای روشن شد`,"audit.event.twoFactorDisabled":`ورود دومرحلهای خاموش شد`,"audit.event.twoFactorReset":`ورود دومرحلهای بازنشانی شد`,"audit.event.recoveryCodes":`کدهای بازیابی تازه`,"audit.event.sessions":`نشستها بسته شدند`,"audit.event.sessionsOthers":`از همهی دستگاههای دیگر خارج شد`,"audit.event.sessionsOne":`از یک دستگاه خارج شد`,"display.title":`تنظیمات نمایش`,"display.calendar":`تقویم`,"display.gregorian":`میلادی`,"display.jalali":`شمسی`,"display.digits":`ارقام`,"display.accent":`رنگ اصلی`,"display.customAccent":`رنگ دیگر`,"display.defaultAccent":`پیشفرض`,"display.accentForEveryone":`برای همه`,"display.resetForEveryone":`بازگشت برای همه`,"display.logo":`لوگو`,"display.favicon":`آیکون زبانه`,"display.uploadPicture":`بارگذاری`,"display.removePicture":`حذف`,"display.latinDigits":`لاتین 123`,"display.persianDigits":`فارسی ۱۲۳`,"inline.row":`{name} ردیف {index}`,"inline.newRow":`{name} جدید {index}`,"inline.moveUp":`بردن {name} به بالا`,"inline.moveDown":`بردن {name} به پایین`,"inline.remove":`حذف {name}`,"inline.rowActions":`کارهای ردیف`,"inline.empty":`هنوز چیزی نیست.`,"inline.limitsMax":`{count} · حداکثر {max}`,"inline.limitsBetween":`{count} · از {min} تا {max}`,"inline.countMin":`دستکم {min} لازم است ({count} هست).`,"inline.countMax":`حداکثر {max} میتواند باشد ({count} هست).`,"inline.truncated":`{count} مورد دیگر اینجا نشان داده نمیشود، پس اینها در این فرم ویرایش نمیشوند.`,"inline.openList":`باز کردن فهرست`,"inline.duplicateNote":`تکثیر فقط همین رکورد را کپی میکند، نه {names} آن را.`,"form.new":`{name} جدید`,"form.back":`بازگشت`,"form.edit":`ویرایش`,"dashboard.title":`داشبورد`,"dashboard.subtitle":`وضعیت فروشگاه در بازه انتخابشده`,"dashboard.period":`بازه زمانی`,"dashboard.day":`امروز`,"dashboard.week":`هفته`,"dashboard.month":`ماه`,"dashboard.year":`سال`,"dashboard.range":`انتخاب بازه تاریخ`,"dashboard.apply":`نمایش`,"dashboard.failed":`این ویجت بارگذاری نشد.`,"dashboard.retry":`تلاش دوباره`,"dashboard.viewAll":`مشاهده همه`,"dashboard.thisPeriod":`این دوره`,"dashboard.previousPeriod":`دوره قبل`,"stepper.since":`از {time}`,"form.viewProfile":`مشاهده پروفایل`,"form.viewOnly":`میتوانید این رکورد را ببینید اما نمیتوانید آن را تغییر دهید.`,"form.save":`ذخیره`,"form.saving":`در حال ذخیره…`,"form.delete":`حذف`,"form.confirmDelete":`تأیید حذف`,"form.moveToTrash":`انتقال به سطل زباله`,"form.confirmMoveToTrash":`تأیید انتقال به سطل زباله`,"form.deleting":`در حال حذف…`,"form.keep":`نگهداشتن`,"form.related":`مرتبط`,"form.add":`افزودن {name}`,"form.remove":`حذف {name} {index}`,"form.conflictTitle":`در حین ویرایش شما، شخص دیگری این رکورد را ذخیره کرد.`,"form.conflictNone":`هیچیک از فیلدهای این فرم تغییر نکرده است.`,"form.keepMine":`تغییرات من بماند`,"form.loadTheirs":`نسخهی آنها را بارگذاری کن`,"form.saveAndNew":`ذخیره و مورد جدید`,"form.duplicate":`تکثیر`,"form.savedName":`«{name}» ذخیره شد.`,"form.leaveTitle":`بدون ذخیره خارج میشوید؟ تغییرات از دست میرود.`,"form.stay":`بمان`,"form.leave":`خروج`,"form.unsaved":`تغییرات ذخیره نشده`,"form.formatJson":`مرتبسازی`,"form.tabHasErrors":`(دارای خطا)`,"form.readOnly":`فقط خواندنی`,"form.externalLink":`{name} (در زبانهی جدید باز میشود)`,"form.colorCode":`کد رنگ {name}`,"upload.choose":`انتخاب فایل`,"upload.chooseMany":`انتخاب فایلها`,"upload.chooseImage":`انتخاب تصویر`,"upload.chooseImages":`انتخاب تصویرها`,"upload.replace":`جایگزینی`,"upload.drop":`یا آن را اینجا رها کنید`,"upload.dropMany":`یا آنها را اینجا رها کنید`,"upload.limit":`حداکثر {max}`,"upload.uploading":`در حال بارگذاری {name}`,"upload.cancel":`لغو بارگذاری {name}`,"upload.remove":`حذف {name}`,"upload.open":`باز کردن {name}`,"upload.more":`+{count}`,"upload.failed":`{name}: {message}`,"upload.busy":`تا پایان بارگذاریها صبر کنید، سپس ذخیره کنید.`,"upload.tooLarge":`فایل بیش از حد بزرگ است.`,"upload.tooLargeMax":`فایل بیش از حد بزرگ است (حداکثر {max}).`,"upload.typeRefused":`این نوع فایل اینجا پذیرفته نمیشود.`,"upload.empty":`فایل خالی است.`,"upload.network":`بارگذاری ناموفق بود. اتصال خود را بررسی کنید و دوباره تلاش کنید.`,"upload.bytes":`{value} بایت`,"upload.kilobytes":`{value} کیلوبایت`,"upload.megabytes":`{value} مگابایت`,"upload.gigabytes":`{value} گیگابایت`,"upload.terabytes":`{value} ترابایت`,"editor.loading":`در حال بارگذاری ویرایشگر…`,"editor.toolbar":`قالببندی {name}`,"editor.paragraph":`پاراگراف`,"editor.heading":`عنوان {level}`,"editor.bold":`پررنگ`,"editor.italic":`کج`,"editor.strike":`خطخورده`,"editor.bulletList":`فهرست نشانهدار`,"editor.orderedList":`فهرست شمارهدار`,"editor.blockquote":`نقلقول`,"editor.rule":`خط افقی`,"editor.link":`پیوند`,"editor.linkAddress":`نشانی پیوند`,"editor.linkApply":`اعمال`,"editor.unlink":`حذف پیوند`,"editor.image":`درج تصویر`,"editor.imageNoAddress":`سرور نشانیای برای نمایش تصویر نداد`,"editor.table":`درج جدول`,"editor.addRow":`افزودن سطر`,"editor.addColumn":`افزودن ستون`,"editor.deleteRow":`حذف سطر`,"editor.deleteColumn":`حذف ستون`,"editor.deleteTable":`حذف جدول`,"editor.undo":`واگرد`,"editor.redo":`ازنو`,"palette.open":`جستوجو و رفتن به`,"palette.placeholder":`رفتن به، ساختن، یا یافتن رکورد…`,"palette.results":`نتایج`,"palette.goTo":`رفتن به`,"palette.actions":`کارها`,"palette.toggleTheme":`تغییر تم`,"palette.records":`رکوردها`,"palette.new":`{name} جدید`,"palette.searching":`در حال جستوجو…`,"palette.noResults":`چیزی پیدا نشد`,"picker.typeToSearch":`برای جستوجو تایپ کنید…`,"picker.typeToAdd":`برای افزودن تایپ کنید…`,"picker.searching":`در حال جستوجو…`,"picker.noMatches":`موردی پیدا نشد`,"picker.remove":`حذف {name}`,"picker.clear":`پاک کردن {name}`,"picker.selected":`{name} انتخابشده`,"validation.required":`الزامی است`,"validation.number":`باید عدد باشد`,"validation.json":`باید JSON معتبر باشد`,"validation.date":`باید تاریخ معتبری باشد`,"validation.datetime":`باید تاریخ و زمان معتبر باشد`,"validation.minLength":`باید دستکم {min} نویسه باشد`,"validation.maxLength":`باید حداکثر {max} نویسه باشد`,"validation.pattern":`قالب آن درست نیست`,"validation.email":`باید نشانی ایمیل باشد`,"validation.url":`باید نشانی اینترنتی باشد`,"validation.uuid":`باید UUID باشد`,"validation.oneOf":`باید یکی از اینها باشد: {values}`,"validation.integer":`باید عدد صحیح باشد`,"validation.min":`باید دستکم {min} باشد`,"validation.max":`باید حداکثر {max} باشد`}},h_=new Set([`fa`,`ar`,`he`,`ur`]),g_=`nma.locale`,__=`en`,v_={calendar:`gregorian`,digits:`latn`};function y_(){return v_}function b_(e){v_=e}function x_(){return __}var S_={};function C_(e){S_=e??{}}function J(e,t={},n=__){return(S_[n]?.[e]??(m_[n]??p_)[e]??p_[e]).replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e)}function w_(e){return h_.has(e.split(`-`)[0])}var T_=e=>`-u-ca-${e.calendar===`persian`?`persian`:`gregory`}-nu-${e.digits}`;function E_(e,t=__){return new Intl.NumberFormat(`${t}-u-nu-${v_.digits}`).format(e)}function D_(e){return v_.digits===`arabext`?s_(e):e}function O_(e,t=__){return new Intl.DateTimeFormat(`${t}${T_(v_)}`,{dateStyle:`medium`,timeStyle:`short`}).format(e)}function k_(e,t=__){return new Intl.DateTimeFormat(`${t}${T_(v_)}`,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).format(e)}function A_(e,t=__){let n=Date.parse(`${e}T00:00:00Z`);return!/^\d{4}-\d{2}-\d{2}$/.test(e)||Number.isNaN(n)?e:new Intl.DateTimeFormat(`${t}${T_(v_)}`,{dateStyle:`medium`,timeZone:`UTC`}).format(n)}function j_(e,t=new Date,n=__){let r=Math.min(0,Math.round((e.getTime()-t.getTime())/1e3)),i=new Intl.RelativeTimeFormat(`${n}-u-nu-${v_.digits}`,{numeric:`auto`});for(let[e,t]of[[`year`,31536e3],[`month`,2592e3],[`day`,86400],[`hour`,3600],[`minute`,60]])if(Math.abs(r)>=t)return i.format(Math.trunc(r/t),e);return i.format(Math.abs(r)<10?0:r,`second`)}function M_(e){__=e,typeof document<`u`&&(document.documentElement.lang=e,document.documentElement.dir=w_(e)?`rtl`:`ltr`)}function N_(e,t){try{let t=localStorage.getItem(g_);if(t&&e.includes(t))return t}catch{}return t}var P_=(0,y.createContext)(void 0);function F_({locales:e,fallback:t,children:n}){let[r,i]=(0,y.useState)(()=>{let n=N_(e,t);return M_(n),n}),[a,o]=(0,y.useState)(()=>{let e=d_(r);return b_(e),e});return(0,b.jsx)(P_.Provider,{value:{locale:r,locales:e,setLocale:e=>{M_(e);try{localStorage.setItem(g_,e)}catch{}let t=d_(e);b_(t),o(t),i(e)},t:(e,t)=>J(e,t,r),calendar:a.calendar,digits:a.digits,setDisplay:e=>{f_(e);let t={...a,...e};b_(t),o(t)}},children:n})}function Y(){let e=(0,y.useContext)(P_);if(!e)throw Error(`useLocale() outside LocaleProvider`);return e}function X(){return Y().t}function I_(){let e=document.getElementById(`nma-config`)?.textContent;if(e)return JSON.parse(e);throw Error(`nest-my-admin: runtime config missing`)}var L_=I_(),R_={"Validation failed":`server.validationFailed`,"already exists":`server.alreadyExists`,"A record with this value already exists":`server.recordExists`,"is required":`validation.required`,"A required value is missing":`server.requiredMissing`,"does not exist":`server.doesNotExist`,"A related record does not exist":`server.relatedMissing`,"is not allowed":`server.notAllowed`,"A value is not allowed":`server.valueNotAllowed`,"is invalid":`server.invalid`,"A value is invalid for its column":`server.valueInvalid`,"is read-only":`server.readOnly`,"Some fields are read-only":`server.someReadOnly`,"The change conflicts with related records":`server.conflictsWithRelated`,"Other records still refer to this record":`server.stillReferred`,"is taken":`server.taken`,"is wrong":`server.wrong`,"must be text":`server.mustBeText`,"must be true or false":`server.mustBeBoolean`,"must be a list":`server.mustBeList`,"is not one of the choices":`server.notAChoice`,"is used twice":`server.usedTwice`,"is not an accepted file type":`server.fileType`,"is not a writable field":`server.readOnly`,"must be an uploaded file":`server.uploadedFile`,"Sign in first":`server.signIn`,"Missing or wrong X-CSRF-Token header; reload the page and try again":`server.reload`,"Viewing as another user is read-only":`server.viewAsReadOnly`,"Request body is too large":`server.tooLarge`,"two-factor sign-in is already on":`server.twoFactorOn`,"two-factor sign-in is off":`server.twoFactorOff`,"start the setup first":`server.setupFirst`},z_=String.raw`^(?:(?:each value in )?\S+ )?`,B_=[[RegExp(`${z_}must be longer than or equal to 1 characters$`),`validation.required`],[RegExp(`${z_}should not be empty$`),`validation.required`],[RegExp(`${z_}must be longer than or equal to (\\d+) characters$`),`server.minLength`],[RegExp(`${z_}must be shorter than or equal to (\\d+) characters$`),`server.maxLength`],[RegExp(`${z_}must be at most (\\d+) characters$`),`server.maxLength`],[RegExp(`${z_}must not be greater than (-?[\\d.]+)$`),`server.max`],[RegExp(`${z_}must not be less than (-?[\\d.]+)$`),`server.min`],[RegExp(`${z_}must be an integer number$`),`server.integer`],[RegExp(`${z_}must be a number conforming to the specified constraints$`),`server.number`],[RegExp(`${z_}must be a string$`),`server.mustBeText`],[RegExp(`${z_}must be a boolean value$`),`server.mustBeBoolean`],[RegExp(`${z_}must be one of the following values: .*$`),`server.notAChoice`],[RegExp(`${z_}must be an email$`),`server.email`],[RegExp(`${z_}must be a URL address$`),`server.url`],[RegExp(`${z_}must be a (?:Date instance|valid ISO 8601 date string)$`),`server.date`],[RegExp(`${z_}must be an array$`),`server.mustBeList`],[RegExp(`${z_}must be a positive number$`),`server.positive`],[RegExp(`${z_}must match .* regular expression$`),`server.format`],[/^may have at most (\d+) rows$/,`server.maxRows`],[/ was changed by someone else since you opened it$/,`server.changedByOther`],[/ records are read-only$/,`server.recordsReadOnly`],[/ is a system role(?:: .*)?$/,`server.systemRole`],[/^(?:You may not |Only superusers may )/,`server.forbidden`]],V_=e=>e.replace(/\d/g,e=>`۰۱۲۳۴۵۶۷۸۹`[Number(e)]),H_=e=>{let t=R_[e];if(t)return J(t);if(x_().startsWith(`en`))return e;for(let[t,n]of B_){let r=t.exec(e);if(r)return J(n,{n:V_(r[1]??``)})}return e},U_=class extends Error{status;body;constructor(e,t){super(t.code===`INTERNAL`&&t.correlationId?J(`common.reference`,{message:t.message,id:t.correlationId}):H_(t.message)),this.status=e,this.body=t,this.name=`ApiError`}get fields(){return Object.fromEntries(Object.entries(this.body.fields??{}).map(([e,t])=>[e,[...new Set(t.map(H_))]]))}};function W_(e){if(!(e instanceof U_))return e.message;let t=Object.entries(e.fields).map(([e,t])=>`${e}: ${t.join(`, `)}`);return[e.message,...t].join(` — `)}var G_,K_;function q_(e){G_=e}function J_(){return G_}function Y_(e){K_=e}function X_(){G_=void 0,K_?.()}function Z_(e,t){let n=t.replace(/\/+$/,``);return n===``||e!==n&&!e.startsWith(`${n}/`)?e:e.slice(n.length)||`/`}function Q_(e,t=``){if(!e||!e.startsWith(`/`)||e.startsWith(`//`)||e.startsWith(`/\\`))return`/`;let n=Z_(e,t);return n.startsWith(`/login`)?`/`:n}var $_=`nma-view-as`;function ev(){try{return sessionStorage.getItem($_)??void 0}catch{return}}function tv(e){try{e===void 0?sessionStorage.removeItem($_):sessionStorage.setItem($_,e)}catch{}}var nv=class extends Error{constructor(){super(`Upload aborted`),this.name=`UploadAbortedError`}},rv=`application/octet-stream`;function iv(e){return typeof e==`object`&&!!e&&`code`in e&&`message`in e}function av(e){return typeof e==`object`&&!!e&&typeof e.token==`string`}function ov(e,t,n,r){let i=n.createXhr?n.createXhr():new XMLHttpRequest,a=!1;return{promise:new Promise((o,s)=>{let c=e=>{a||(a=!0,e())};i.open(`POST`,`${n.apiBase}/uploads?${new URLSearchParams({resource:t.resource,field:t.field})}`),i.setRequestHeader(`Accept`,`application/json`),i.setRequestHeader(`Accept-Language`,n.locale),i.setRequestHeader(`Content-Type`,rv),i.setRequestHeader(`X-File-Name`,encodeURIComponent(e.name)),n.csrfToken&&i.setRequestHeader(`X-CSRF-Token`,n.csrfToken),n.viewAs&&i.setRequestHeader(`X-View-As`,n.viewAs),i.upload.onprogress=e=>{e.lengthComputable&&e.total>0&&r?.(e.loaded/e.total)},i.onload=()=>{let e;try{e=i.responseText?JSON.parse(i.responseText):void 0}catch{e=void 0}let t=i.status>=200&&i.status<300&&av(e);i.status===401&&n.onSignedOut?.(),c(()=>{t?(r?.(1),o(e)):iv(e)?s(new U_(i.status,e)):i.status===413?s(new U_(413,{code:`BAD_REQUEST`,message:J(`upload.tooLarge`,{},n.locale),correlationId:``})):s(new U_(i.status,{code:`INTERNAL`,message:J(`common.requestFailed`,{status:i.status},n.locale),correlationId:``}))})},i.onerror=()=>c(()=>s(Error(J(`upload.network`,{},n.locale)))),i.onabort=()=>c(()=>s(new nv)),i.send(e)}),abort:()=>{a||i.abort()}}}function sv(e){if(e instanceof U_){let t=Object.values(e.fields).flat();if(t.length>0)return t.join(` `)}return e instanceof Error?e.message:String(e)}function cv(e,t){if(t.length===0)return!0;let n=e.toLowerCase();return t.some(e=>{let t=e.trim().toLowerCase();return t===`*`||t===`*/*`?!0:t.endsWith(`/*`)?n.startsWith(t.slice(0,-1)):n===t})}function lv(e,t,n){if(e.size===0)return J(`upload.empty`,{},n);if(e.size>t.maxBytes)return J(`upload.tooLargeMax`,{max:dv(t.maxBytes,n)},n);if(e.type!==``&&!cv(e.type.split(`;`)[0].trim(),t.accept))return J(`upload.typeRefused`,{},n)}var uv=[`upload.bytes`,`upload.kilobytes`,`upload.megabytes`,`upload.gigabytes`,`upload.terabytes`];function dv(e,t){let n=e,r=0;for(;n>=1024&&r<uv.length-1;)n/=1024,r+=1;let i=new Intl.NumberFormat(t??`${x_()}-u-nu-${y_().digits}`,{maximumFractionDigits:r===0?0:1}).format(n);return J(uv[r],{value:i},t)}function fv(e,t,n){let r=[...e];if(t<0||t>=r.length||n<0||n>=r.length||t===n)return r;let[i]=r.splice(t,1);return r.splice(n,0,i),r}function pv(e){return{...e,creatable:!1,actions:[],prints:[],permissions:{create:!1,update:!1,delete:!1,purge:!1},list:{...e.list,editable:[]},form:{...e.form,create:[],update:[],requiredOnCreate:[],readonly:[...new Set([...e.form.readonly,...e.form.update,...e.form.create])]},...e.inlines?{inlines:Object.fromEntries(Object.entries(e.inlines).map(([e,t])=>[e,pv(t)]))}:{}}}function mv(e){return e.schema.readonly?e:{...e,schema:{...e.schema,readonly:!0}}}function hv(e){return e.viewAs?{...e,rbac:{...e.rbac,manage:!1}}:e}function gv(e){return typeof e==`object`&&!!e&&`code`in e&&`message`in e}async function Z(e,t={}){let n=t.method??`GET`,r=J_(),i=e===`/session`&&n===`POST`?void 0:ev(),a=await fetch(`${L_.apiBase}${e}`,{...t,credentials:`same-origin`,headers:{Accept:`application/json`,"Accept-Language":x_(),...t.body?{"Content-Type":`application/json`}:{},...n!==`GET`&&r?{"X-CSRF-Token":r}:{},...i?{"X-View-As":i}:{},...t.headers}});a.status===401&&!e.startsWith(`/session`)&&X_();let o=await a.text(),s;try{s=o?JSON.parse(o):void 0}catch{s=void 0}if(!a.ok)throw new U_(a.status,gv(s)?s:{code:`INTERNAL`,message:J(`common.requestFailed`,{status:a.status}),correlationId:``});return s}var _v=encodeURIComponent,vv=e=>typeof e==`number`||typeof e==`string`?{"If-Match":`"${e}"`}:{};function yv(e,t,n){let r=new URLSearchParams([...n.map(e=>[`id`,e]),[`lang`,x_()]]);return`${L_.apiBase}/resources/${encodeURIComponent(e)}/print/${encodeURIComponent(t)}?${r}`}async function bv(e,t){let n=new URLSearchParams(t);n.set(`offset`,String(-new Date().getTimezoneOffset()));let r=ev(),i=await fetch(`${L_.apiBase}/resources/${encodeURIComponent(e)}/export?${n}`,{credentials:`same-origin`,headers:{"Accept-Language":x_(),...r?{"X-View-As":r}:{}}});if(i.status===401&&X_(),!i.ok){let e=await i.json().catch(()=>void 0);throw new U_(i.status,gv(e)?e:{code:`INTERNAL`,message:J(`common.requestFailed`,{status:i.status}),correlationId:``})}let a=/filename="([^"]+)"/.exec(i.headers.get(`Content-Disposition`)??``)?.[1]??`${e}.xlsx`,o=i.headers.get(`X-Export-Truncated`);return{blob:await i.blob(),filename:a,...o?{truncated:Number(o)}:{}}}var Q={exportList:bv,session:async()=>hv(await Z(`/session`)),login:(e,t,n)=>Z(`/session`,{method:`POST`,body:JSON.stringify({username:e,password:t,...n?{otp:n}:{}})}),logout:()=>Z(`/session`,{method:`DELETE`}),sessions:()=>Z(`/account/sessions`),revokeSession:e=>Z(`/account/sessions/${_v(e)}`,{method:`DELETE`}),revokeOtherSessions:()=>Z(`/account/sessions`,{method:`DELETE`}),changePassword:(e,t)=>Z(`/account/password`,{method:`POST`,body:JSON.stringify({current:e,next:t})}),twoFactor:{status:()=>Z(`/account/2fa`),setup:()=>Z(`/account/2fa/setup`,{method:`POST`,body:`{}`}),confirm:e=>Z(`/account/2fa/confirm`,{method:`POST`,body:JSON.stringify({code:e})}),disable:e=>Z(`/account/2fa/disable`,{method:`POST`,body:JSON.stringify({password:e})}),recoveryCodes:e=>Z(`/account/2fa/recovery-codes`,{method:`POST`,body:JSON.stringify({password:e})})},meta:()=>Z(`/meta`),menuBadges:()=>Z(`/menu/badges`),dashboard:()=>Z(`/dashboard`),setPicture:(e,t)=>Z(`/appearance/${e}`,{method:`PUT`,body:t,headers:{"Content-Type":xv(t)}}),removePicture:e=>Z(`/appearance/${e}`,{method:`DELETE`}),setAppearance:e=>Z(`/appearance`,{method:`PUT`,body:JSON.stringify({accent:e})}),widget:(e,t)=>Z(`/dashboard/${encodeURIComponent(e)}?${new URLSearchParams({...t})}`),tabCounts:e=>Z(`/resources/${encodeURIComponent(e)}/tab-counts`),rbac:{catalog:()=>Z(`/rbac/catalog`),roles:()=>Z(`/rbac/roles`),role:e=>Z(`/rbac/roles/${_v(e)}`),createRole:e=>Z(`/rbac/roles`,{method:`POST`,body:JSON.stringify(e)}),updateRole:(e,t)=>Z(`/rbac/roles/${_v(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteRole:e=>Z(`/rbac/roles/${_v(e)}`,{method:`DELETE`}),exportRoles:()=>Z(`/rbac/roles/export`),importRoles:e=>Z(`/rbac/roles/import`,{method:`POST`,body:JSON.stringify(e)}),groups:()=>Z(`/rbac/groups`),group:e=>Z(`/rbac/groups/${e}`),saveGroup:(e,t)=>Z(t===void 0?`/rbac/groups`:`/rbac/groups/${t}`,{method:t===void 0?`POST`:`PATCH`,body:JSON.stringify(e)}),deleteGroup:e=>Z(`/rbac/groups/${e}`,{method:`DELETE`}),users:e=>Z(`/rbac/users?${new URLSearchParams(Object.entries(e).filter(([,e])=>e!==void 0&&e!==``).map(([e,t])=>[e,String(t)]))}`),user:e=>Z(`/rbac/users/${_v(e)}`),createUser:e=>Z(`/rbac/users`,{method:`POST`,body:JSON.stringify(e)}),updateUser:(e,t)=>Z(`/rbac/users/${_v(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),setPassword:(e,t)=>Z(`/rbac/users/${_v(e)}/password`,{method:`POST`,body:JSON.stringify({password:t})}),resetTwoFactor:e=>Z(`/rbac/users/${_v(e)}/2fa/reset`,{method:`POST`,body:`{}`}),explain:e=>Z(`/rbac/explain?${new URLSearchParams(Object.entries(e).filter(([,e])=>e!==void 0&&e!==``))}`)},upload:(e,t,n)=>ov(e,t,{apiBase:L_.apiBase,csrfToken:J_(),viewAs:ev(),locale:x_(),onSignedOut:X_},n),search:e=>Z(`/search?${new URLSearchParams({q:e})}`),schema:async e=>{let t=await Z(`/meta/resources/${_v(e)}`);return ev()?pv(t):t},list:(e,t)=>Z(`/resources/${_v(e)}?${t}`),remove:(e,t,n)=>Z(`/resources/${_v(e)}/${_v(t)}`,{method:`DELETE`,headers:vv(n)}),actionChoices:(e,t,n)=>Z(`/resources/${_v(e)}/actions/${_v(t)}/choices/${_v(n)}`),options:(e,t,n)=>{let r=new URLSearchParams;return n.ids?r.set(`ids`,n.ids.join(`,`)):n.search&&r.set(`search`,n.search),n.values&&r.set(`values`,n.values),n.parent&&n.values&&r.set(`parent`,n.parent),Z(`/resources/${_v(e)}/fields/${_v(t)}/options${r.size?`?${r}`:``}`)},bulkDelete:(e,t)=>Z(`/resources/${_v(e)}/bulk-delete`,{method:`POST`,body:JSON.stringify({ids:t})}),runAction:(e,t,n)=>Z(`/resources/${_v(e)}/actions/${_v(t)}`,{method:`POST`,body:JSON.stringify(n)}),page:async e=>{let t=await Z(`/pages/${_v(e)}`);return ev()?mv(t):t},savePage:(e,t)=>Z(`/pages/${_v(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),history:(e,t,n)=>Z(`/resources/${_v(e)}/${_v(t)}/history${n?`?${new URLSearchParams({before:n})}`:``}`),audit:(e,t)=>{let n=new URLSearchParams(e);return t&&n.set(`before`,t),Z(`/audit${n.size?`?${n}`:``}`)},restore:(e,t)=>Z(`/resources/${_v(e)}/${_v(t)}/restore`,{method:`POST`,body:`{}`}),get:(e,t)=>Z(`/resources/${_v(e)}/${_v(t)}`),create:(e,t)=>Z(`/resources/${_v(e)}`,{method:`POST`,body:JSON.stringify(t)}),update:(e,t,n,r)=>Z(`/resources/${_v(e)}/${_v(t)}`,{method:`PATCH`,body:JSON.stringify(n),headers:vv(r)})};function xv(e){return/\.ico$/i.test(e.name)?`image/x-icon`:e.type?e.type:/\.svg$/i.test(e.name)?`image/svg+xml`:`application/octet-stream`}var Sv=()=>ft({queryKey:[`session`],queryFn:async()=>{let e=await Q.session();return q_(e.csrfToken),e},retry:!1,staleTime:3e5}),Cv=()=>{let{locale:e}=Y();return ft({queryKey:[`meta`,e],queryFn:Q.meta})},wv=(e,t=!0)=>{let{locale:n}=Y();return ft({queryKey:[`schema`,e,n],queryFn:()=>Q.schema(e),enabled:t})},Tv=e=>ft({queryKey:[`menu-badges`],queryFn:Q.menuBadges,enabled:e,refetchInterval:6e4,refetchOnWindowFocus:!0}),Ev=e=>{let{locale:t}=Y();return ft({queryKey:[`page`,e,t],queryFn:()=>Q.page(e)})},Dv=(e,t,n=!0)=>ft({queryKey:[`list`,e,t],queryFn:()=>Q.list(e,new URLSearchParams(t)),placeholderData:ue,enabled:n}),Ov=(e,t)=>ft({queryKey:[`record`,e,t],queryFn:()=>Q.get(e,t),enabled:t!==void 0}),kv=(e,t,n,r,i,a)=>ft({queryKey:[`options`,e,t,n,i??``,a??``],queryFn:()=>Q.options(e,t,{search:n,values:i,parent:a}),enabled:r,placeholderData:ue}),Av=(e,t,n)=>ft({queryKey:[`action-choices`,e,t,n],queryFn:()=>Q.actionChoices(e,t,n),staleTime:0,gcTime:0,retry:1}),jv=(e,t,n)=>ft({queryKey:[`options`,e,t,`ids`,n],queryFn:()=>Q.options(e,t,{ids:n}),enabled:n.length>0}),Mv=function(e,t){let n=e,r=Pv[t],i=null,a=0,o=null,s=[],c={},l=function(e,t){a=n*4+17,i=function(e){let t=Array(e);for(let n=0;n<e;n+=1){t[n]=Array(e);for(let r=0;r<e;r+=1)t[n][r]=null}return t}(a),u(0,0),u(a-7,0),u(0,a-7),p(),f(),h(e,t),n>=7&&m(e),o??=v(n,r,s),g(o,t)},u=function(e,t){for(let n=-1;n<=7;n+=1)if(!(e+n<=-1||a<=e+n))for(let r=-1;r<=7;r+=1)t+r<=-1||a<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?i[e+n][t+r]=!0:i[e+n][t+r]=!1)},d=function(){let e=0,t=0;for(let n=0;n<8;n+=1){l(!0,n);let r=Iv.getLostPoint(c);(n==0||e>r)&&(e=r,t=n)}return t},f=function(){for(let e=8;e<a-8;e+=1)i[e][6]??(i[e][6]=e%2==0);for(let e=8;e<a-8;e+=1)i[6][e]??(i[6][e]=e%2==0)},p=function(){let e=Iv.getPatternPosition(n);for(let t=0;t<e.length;t+=1)for(let n=0;n<e.length;n+=1){let r=e[t],a=e[n];if(i[r][a]==null)for(let e=-2;e<=2;e+=1)for(let t=-2;t<=2;t+=1)e==-2||e==2||t==-2||t==2||e==0&&t==0?i[r+e][a+t]=!0:i[r+e][a+t]=!1}},m=function(e){let t=Iv.getBCHTypeNumber(n);for(let n=0;n<18;n+=1){let r=!e&&(t>>n&1)==1;i[Math.floor(n/3)][n%3+a-8-3]=r}for(let n=0;n<18;n+=1){let r=!e&&(t>>n&1)==1;i[n%3+a-8-3][Math.floor(n/3)]=r}},h=function(e,t){let n=r<<3|t,o=Iv.getBCHTypeInfo(n);for(let t=0;t<15;t+=1){let n=!e&&(o>>t&1)==1;t<6?i[t][8]=n:t<8?i[t+1][8]=n:i[a-15+t][8]=n}for(let t=0;t<15;t+=1){let n=!e&&(o>>t&1)==1;t<8?i[8][a-t-1]=n:t<9?i[8][15-t-1+1]=n:i[8][15-t-1]=n}i[a-8][8]=!e},g=function(e,t){let n=-1,r=a-1,o=7,s=0,c=Iv.getMaskFunction(t);for(let t=a-1;t>0;t-=2)for(t==6&&--t;;){for(let n=0;n<2;n+=1)if(i[r][t-n]==null){let a=!1;s<e.length&&(a=(e[s]>>>o&1)==1),c(r,t-n)&&(a=!a),i[r][t-n]=a,--o,o==-1&&(s+=1,o=7)}if(r+=n,r<0||a<=r){r-=n,n=-n;break}}},_=function(e,t){let n=0,r=0,i=0,a=Array(t.length),o=Array(t.length);for(let s=0;s<t.length;s+=1){let c=t[s].dataCount,l=t[s].totalCount-c;r=Math.max(r,c),i=Math.max(i,l),a[s]=Array(c);for(let t=0;t<a[s].length;t+=1)a[s][t]=255&e.getBuffer()[t+n];n+=c;let u=Iv.getErrorCorrectPolynomial(l),d=Rv(a[s],u.getLength()-1).mod(u);o[s]=Array(u.getLength()-1);for(let e=0;e<o[s].length;e+=1){let t=e+d.getLength()-o[s].length;o[s][e]=t>=0?d.getAt(t):0}}let s=0;for(let e=0;e<t.length;e+=1)s+=t[e].totalCount;let c=Array(s),l=0;for(let e=0;e<r;e+=1)for(let n=0;n<t.length;n+=1)e<a[n].length&&(c[l]=a[n][e],l+=1);for(let e=0;e<i;e+=1)for(let n=0;n<t.length;n+=1)e<o[n].length&&(c[l]=o[n][e],l+=1);return c},v=function(e,t,n){let r=zv.getRSBlocks(e,t),i=Bv();for(let t=0;t<n.length;t+=1){let r=n[t];i.put(r.getMode(),4),i.put(r.getLength(),Iv.getLengthInBits(r.getMode(),e)),r.write(i)}let a=0;for(let e=0;e<r.length;e+=1)a+=r[e].dataCount;if(i.getLengthInBits()>a*8)throw`code length overflow. (`+i.getLengthInBits()+`>`+a*8+`)`;for(i.getLengthInBits()+4<=a*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=a*8||(i.put(236,8),i.getLengthInBits()>=a*8));)i.put(17,8);return _(i,r)};c.addData=function(e,t){t||=`Byte`;let n=null;switch(t){case`Numeric`:n=Vv(e);break;case`Alphanumeric`:n=Hv(e);break;case`Byte`:n=Uv(e);break;case`Kanji`:n=Wv(e);break;default:throw`mode:`+t}s.push(n),o=null},c.isDark=function(e,t){if(e<0||a<=e||t<0||a<=t)throw e+`,`+t;return i[e][t]},c.getModuleCount=function(){return a},c.make=function(){if(n<1){let e=1;for(;e<40;e++){let t=zv.getRSBlocks(e,r),n=Bv();for(let t=0;t<s.length;t++){let r=s[t];n.put(r.getMode(),4),n.put(r.getLength(),Iv.getLengthInBits(r.getMode(),e)),r.write(n)}let i=0;for(let e=0;e<t.length;e++)i+=t[e].dataCount;if(n.getLengthInBits()<=i*8)break}n=e}l(!1,d())},c.createTableTag=function(e,t){e||=2,t=t===void 0?e*4:t;let n=``;n+=`<table style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: `+t+`px;`,n+=`">`,n+=`<tbody>`;for(let t=0;t<c.getModuleCount();t+=1){n+=`<tr>`;for(let r=0;r<c.getModuleCount();r+=1)n+=`<td style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: 0px;`,n+=` width: `+e+`px;`,n+=` height: `+e+`px;`,n+=` background-color: `,n+=c.isDark(t,r)?`#000000`:`#ffffff`,n+=`;`,n+=`"/>`;n+=`</tr>`}return n+=`</tbody>`,n+=`</table>`,n},c.createSvgTag=function(e,t,n,r){let i={};typeof arguments[0]==`object`&&(i=arguments[0],e=i.cellSize,t=i.margin,n=i.alt,r=i.title),e||=2,t=t===void 0?e*4:t,n=typeof n==`string`?{text:n}:n||{},n.text=n.text||null,n.id=n.text?n.id||`qrcode-description`:null,r=typeof r==`string`?{text:r}:r||{},r.text=r.text||null,r.id=r.text?r.id||`qrcode-title`:null;let a=c.getModuleCount()*e+t*2,o,s,l,u,d=``,f;for(f=`l`+e+`,0 0,`+e+` -`+e+`,0 0,-`+e+`z `,d+=`<svg version="1.1" xmlns="http://www.w3.org/2000/svg"`,d+=i.scalable?``:` width="`+a+`px" height="`+a+`px"`,d+=` viewBox="0 0 `+a+` `+a+`" `,d+=` preserveAspectRatio="xMinYMin meet"`,d+=r.text||n.text?` role="img" aria-labelledby="`+y([r.id,n.id].join(` `).trim())+`"`:``,d+=`>`,d+=r.text?`<title id="`+y(r.id)+`">`+y(r.text)+`</title>`:``,d+=n.text?`<description id="`+y(n.id)+`">`+y(n.text)+`</description>`:``,d+=`<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>`,d+=`<path d="`,l=0;l<c.getModuleCount();l+=1)for(u=l*e+t,o=0;o<c.getModuleCount();o+=1)c.isDark(l,o)&&(s=o*e+t,d+=`M`+s+`,`+u+f);return d+=`" stroke="transparent" fill="black"/>`,d+=`</svg>`,d},c.createDataURL=function(e,t){e||=2,t=t===void 0?e*4:t;let n=c.getModuleCount()*e+t*2,r=t,i=n-t;return Yv(n,n,function(t,n){if(r<=t&&t<i&&r<=n&&n<i){let i=Math.floor((t-r)/e),a=Math.floor((n-r)/e);return+!c.isDark(a,i)}return 1})},c.createImgTag=function(e,t,n){e||=2,t=t===void 0?e*4:t;let r=c.getModuleCount()*e+t*2,i=``;return i+=`<img`,i+=` src="`,i+=c.createDataURL(e,t),i+=`"`,i+=` width="`,i+=r,i+=`"`,i+=` height="`,i+=r,i+=`"`,n&&(i+=` alt="`,i+=y(n),i+=`"`),i+=`/>`,i};let y=function(e){let t=``;for(let n=0;n<e.length;n+=1){let r=e.charAt(n);switch(r){case`<`:t+=`<`;break;case`>`:t+=`>`;break;case`&`:t+=`&`;break;case`"`:t+=`"`;break;default:t+=r}}return t},b=function(e){e=e===void 0?2:e;let t=c.getModuleCount()*1+e*2,n=e,r=t-e,i,a,o,s,l,u={"██":`█`,"█ ":`▀`," █":`▄`," ":` `},d={"██":`▀`,"█ ":`▀`," █":` `," ":` `},f=``;for(i=0;i<t;i+=2){for(o=Math.floor((i-n)/1),s=Math.floor((i+1-n)/1),a=0;a<t;a+=1)l=`█`,n<=a&&a<r&&n<=i&&i<r&&c.isDark(o,Math.floor((a-n)/1))&&(l=` `),n<=a&&a<r&&n<=i+1&&i+1<r&&c.isDark(s,Math.floor((a-n)/1))?l+=` `:l+=`█`,f+=e<1&&i+1>=r?d[l]:u[l];f+=`
|
|
51
51
|
`}return t%2&&e>0?f.substring(0,f.length-t-1)+Array(t+1).join(`▀`):f.substring(0,f.length-1)};return c.createASCII=function(e,t){if(e||=1,e<2)return b(t);--e,t=t===void 0?e*2:t;let n=c.getModuleCount()*e+t*2,r=t,i=n-t,a,o,s,l,u=Array(e+1).join(`██`),d=Array(e+1).join(` `),f=``,p=``;for(a=0;a<n;a+=1){for(s=Math.floor((a-r)/e),p=``,o=0;o<n;o+=1)l=1,r<=o&&o<i&&r<=a&&a<i&&c.isDark(s,Math.floor((o-r)/e))&&(l=0),p+=l?u:d;for(s=0;s<e;s+=1)f+=p+`
|
|
52
|
-
`}return f.substring(0,f.length-1)},c.renderTo2dContext=function(e,t){t||=2;let n=c.getModuleCount();for(let r=0;r<n;r++)for(let i=0;i<n;i++)e.fillStyle=c.isDark(r,i)?`black`:`white`,e.fillRect(i*t,r*t,t,t)},c};Dv.stringToBytes=function(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);t.push(r&255)}return t},Dv.createStringToBytes=function(e,t){let n=function(){let n=Hv(e),r=function(){let e=n.read();if(e==-1)throw`eof`;return e},i=0,a={};for(;;){let e=n.read();if(e==-1)break;let t=r(),o=r(),s=r(),c=String.fromCharCode(e<<8|t);a[c]=o<<8|s,i+=1}if(i!=t)throw i+` != `+t;return a}();return function(e){let t=[];for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);if(i<128)t.push(i);else{let i=n[e.charAt(r)];typeof i==`number`?(i&255)==i?t.push(i):(t.push(i>>>8),t.push(i&255)):t.push(63)}}return t}};var Ov={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},kv={L:1,M:0,Q:3,H:2},Av={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},jv=function(){let e=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],t=1335,n=7973,r={},i=function(e){let t=0;for(;e!=0;)t+=1,e>>>=1;return t};return r.getBCHTypeInfo=function(e){let n=e<<10;for(;i(n)-i(t)>=0;)n^=t<<i(n)-i(t);return(e<<10|n)^21522},r.getBCHTypeNumber=function(e){let t=e<<12;for(;i(t)-i(n)>=0;)t^=n<<i(t)-i(n);return e<<12|t},r.getPatternPosition=function(t){return e[t-1]},r.getMaskFunction=function(e){switch(e){case Av.PATTERN000:return function(e,t){return(e+t)%2==0};case Av.PATTERN001:return function(e,t){return e%2==0};case Av.PATTERN010:return function(e,t){return t%3==0};case Av.PATTERN011:return function(e,t){return(e+t)%3==0};case Av.PATTERN100:return function(e,t){return(Math.floor(e/2)+Math.floor(t/3))%2==0};case Av.PATTERN101:return function(e,t){return e*t%2+e*t%3==0};case Av.PATTERN110:return function(e,t){return(e*t%2+e*t%3)%2==0};case Av.PATTERN111:return function(e,t){return(e*t%3+(e+t)%2)%2==0};default:throw`bad maskPattern:`+e}},r.getErrorCorrectPolynomial=function(e){let t=Nv([1],0);for(let n=0;n<e;n+=1)t=t.multiply(Nv([1,Mv.gexp(n)],0));return t},r.getLengthInBits=function(e,t){if(1<=t&&t<10)switch(e){case Ov.MODE_NUMBER:return 10;case Ov.MODE_ALPHA_NUM:return 9;case Ov.MODE_8BIT_BYTE:return 8;case Ov.MODE_KANJI:return 8;default:throw`mode:`+e}else if(t<27)switch(e){case Ov.MODE_NUMBER:return 12;case Ov.MODE_ALPHA_NUM:return 11;case Ov.MODE_8BIT_BYTE:return 16;case Ov.MODE_KANJI:return 10;default:throw`mode:`+e}else if(t<41)switch(e){case Ov.MODE_NUMBER:return 14;case Ov.MODE_ALPHA_NUM:return 13;case Ov.MODE_8BIT_BYTE:return 16;case Ov.MODE_KANJI:return 12;default:throw`mode:`+e}else throw`type:`+t},r.getLostPoint=function(e){let t=e.getModuleCount(),n=0;for(let r=0;r<t;r+=1)for(let i=0;i<t;i+=1){let a=0,o=e.isDark(r,i);for(let n=-1;n<=1;n+=1)if(!(r+n<0||t<=r+n))for(let s=-1;s<=1;s+=1)i+s<0||t<=i+s||(n!=0||s!=0)&&o==e.isDark(r+n,i+s)&&(a+=1);a>5&&(n+=3+a-5)}for(let r=0;r<t-1;r+=1)for(let i=0;i<t-1;i+=1){let t=0;e.isDark(r,i)&&(t+=1),e.isDark(r+1,i)&&(t+=1),e.isDark(r,i+1)&&(t+=1),e.isDark(r+1,i+1)&&(t+=1),(t==0||t==4)&&(n+=3)}for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(r,i)&&!e.isDark(r,i+1)&&e.isDark(r,i+2)&&e.isDark(r,i+3)&&e.isDark(r,i+4)&&!e.isDark(r,i+5)&&e.isDark(r,i+6)&&(n+=40);for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(i,r)&&!e.isDark(i+1,r)&&e.isDark(i+2,r)&&e.isDark(i+3,r)&&e.isDark(i+4,r)&&!e.isDark(i+5,r)&&e.isDark(i+6,r)&&(n+=40);let r=0;for(let n=0;n<t;n+=1)for(let i=0;i<t;i+=1)e.isDark(i,n)&&(r+=1);let i=Math.abs(100*r/t/t-50)/5;return n+=i*10,n},r}(),Mv=function(){let e=Array(256),t=Array(256);for(let t=0;t<8;t+=1)e[t]=1<<t;for(let t=8;t<256;t+=1)e[t]=e[t-4]^e[t-5]^e[t-6]^e[t-8];for(let n=0;n<255;n+=1)t[e[n]]=n;let n={};return n.glog=function(e){if(e<1)throw`glog(`+e+`)`;return t[e]},n.gexp=function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return e[t]},n}(),Nv=function(e,t){if(e.length===void 0)throw e.length+`/`+t;let n=function(){let n=0;for(;n<e.length&&e[n]==0;)n+=1;let r=Array(e.length-n+t);for(let t=0;t<e.length-n;t+=1)r[t]=e[t+n];return r}(),r={};return r.getAt=function(e){return n[e]},r.getLength=function(){return n.length},r.multiply=function(e){let t=Array(r.getLength()+e.getLength()-1);for(let n=0;n<r.getLength();n+=1)for(let i=0;i<e.getLength();i+=1)t[n+i]^=Mv.gexp(Mv.glog(r.getAt(n))+Mv.glog(e.getAt(i)));return Nv(t,0)},r.mod=function(e){if(r.getLength()-e.getLength()<0)return r;let t=Mv.glog(r.getAt(0))-Mv.glog(e.getAt(0)),n=Array(r.getLength());for(let e=0;e<r.getLength();e+=1)n[e]=r.getAt(e);for(let r=0;r<e.getLength();r+=1)n[r]^=Mv.gexp(Mv.glog(e.getAt(r))+t);return Nv(n,0).mod(e)},r},Pv=function(){let e=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t=function(e,t){let n={};return n.totalCount=e,n.dataCount=t,n},n={},r=function(t,n){switch(n){case kv.L:return e[(t-1)*4+0];case kv.M:return e[(t-1)*4+1];case kv.Q:return e[(t-1)*4+2];case kv.H:return e[(t-1)*4+3];default:return}};return n.getRSBlocks=function(e,n){let i=r(e,n);if(i===void 0)throw`bad rs block @ typeNumber:`+e+`/errorCorrectionLevel:`+n;let a=i.length/3,o=[];for(let e=0;e<a;e+=1){let n=i[e*3+0],r=i[e*3+1],a=i[e*3+2];for(let e=0;e<n;e+=1)o.push(t(r,a))}return o},n}(),Fv=function(){let e=[],t=0,n={};return n.getBuffer=function(){return e},n.getAt=function(t){let n=Math.floor(t/8);return(e[n]>>>7-t%8&1)==1},n.put=function(e,t){for(let r=0;r<t;r+=1)n.putBit((e>>>t-r-1&1)==1)},n.getLengthInBits=function(){return t},n.putBit=function(n){let r=Math.floor(t/8);e.length<=r&&e.push(0),n&&(e[r]|=128>>>t%8),t+=1},n},Iv=function(e){let t=Ov.MODE_NUMBER,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+2<t.length;)e.put(i(t.substring(r,r+3)),10),r+=3;r<t.length&&(t.length-r==1?e.put(i(t.substring(r,r+1)),4):t.length-r==2&&e.put(i(t.substring(r,r+2)),7))};let i=function(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*10+a(e.charAt(n));return t},a=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;throw`illegal char :`+e};return r},Lv=function(e){let t=Ov.MODE_ALPHA_NUM,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+1<t.length;)e.put(i(t.charAt(r))*45+i(t.charAt(r+1)),11),r+=2;r<t.length&&e.put(i(t.charAt(r)),6)};let i=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;if(`A`<=e&&e<=`Z`)return e.charCodeAt(0)-65+10;switch(e){case` `:return 36;case`$`:return 37;case`%`:return 38;case`*`:return 39;case`+`:return 40;case`-`:return 41;case`.`:return 42;case`/`:return 43;case`:`:return 44;default:throw`illegal char :`+e}};return r},Rv=function(e){let t=Ov.MODE_8BIT_BYTE,n=Dv.stringToBytes(e),r={};return r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){for(let t=0;t<n.length;t+=1)e.put(n[t],8)},r},zv=function(e){let t=Ov.MODE_KANJI,n=Dv.stringToBytes;(function(e,t){let r=n(e);if(r.length!=2||(r[0]<<8|r[1])!=t)throw`sjis not supported.`})(`友`,38726);let r=n(e),i={};return i.getMode=function(){return t},i.getLength=function(e){return~~(r.length/2)},i.write=function(e){let t=r,n=0;for(;n+1<t.length;){let r=(255&t[n])<<8|255&t[n+1];if(33088<=r&&r<=40956)r-=33088;else if(57408<=r&&r<=60351)r-=49472;else throw`illegal char at `+(n+1)+`/`+r;r=(r>>>8&255)*192+(r&255),e.put(r,13),n+=2}if(n<t.length)throw`illegal char at `+(n+1)},i},Bv=function(){let e=[],t={};return t.writeByte=function(t){e.push(t&255)},t.writeShort=function(e){t.writeByte(e),t.writeByte(e>>>8)},t.writeBytes=function(e,n,r){n||=0,r||=e.length;for(let i=0;i<r;i+=1)t.writeByte(e[i+n])},t.writeString=function(e){for(let n=0;n<e.length;n+=1)t.writeByte(e.charCodeAt(n))},t.toByteArray=function(){return e},t.toString=function(){let t=``;t+=`[`;for(let n=0;n<e.length;n+=1)n>0&&(t+=`,`),t+=e[n];return t+=`]`,t},t},Vv=function(){let e=0,t=0,n=0,r=``,i={},a=function(e){r+=String.fromCharCode(o(e&63))},o=function(e){if(e<0)throw`n:`+e;if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(e==62)return 43;if(e==63)return 47;throw`n:`+e};return i.writeByte=function(r){for(e=e<<8|r&255,t+=8,n+=1;t>=6;)a(e>>>t-6),t-=6},i.flush=function(){if(t>0&&(a(e<<6-t),e=0,t=0),n%3!=0){let e=3-n%3;for(let t=0;t<e;t+=1)r+=`=`}},i.toString=function(){return r},i},Hv=function(e){let t=e,n=0,r=0,i=0,a={};a.read=function(){for(;i<8;){if(n>=t.length){if(i==0)return-1;throw`unexpected end of file./`+i}let e=t.charAt(n);if(n+=1,e==`=`)return i=0,-1;e.match(/^\s$/)||(r=r<<6|o(e.charCodeAt(0)),i+=6)}let e=r>>>i-8&255;return i-=8,e};let o=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(e==43)return 62;if(e==47)return 63;throw`c:`+e};return a},Uv=function(e,t){let n=e,r=t,i=Array(e*t),a={};a.setPixel=function(e,t,r){i[t*n+e]=r},a.write=function(e){e.writeString(`GIF87a`),e.writeShort(n),e.writeShort(r),e.writeByte(128),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(255),e.writeByte(255),e.writeByte(255),e.writeString(`,`),e.writeShort(0),e.writeShort(0),e.writeShort(n),e.writeShort(r),e.writeByte(0);let t=s(2);e.writeByte(2);let i=0;for(;t.length-i>255;)e.writeByte(255),e.writeBytes(t,i,255),i+=255;e.writeByte(t.length-i),e.writeBytes(t,i,t.length-i),e.writeByte(0),e.writeString(`;`)};let o=function(e){let t=e,n=0,r=0,i={};return i.write=function(e,i){if(e>>>i)throw`length over`;for(;n+i>=8;)t.writeByte(255&(e<<n|r)),i-=8-n,e>>>=8-n,r=0,n=0;r=e<<n|r,n+=i},i.flush=function(){n>0&&t.writeByte(r)},i},s=function(e){let t=1<<e,n=(1<<e)+1,r=e+1,a=c();for(let e=0;e<t;e+=1)a.add(String.fromCharCode(e));a.add(String.fromCharCode(t)),a.add(String.fromCharCode(n));let s=Bv(),l=o(s);l.write(t,r);let u=0,d=String.fromCharCode(i[u]);for(u+=1;u<i.length;){let e=String.fromCharCode(i[u]);u+=1,a.contains(d+e)?d+=e:(l.write(a.indexOf(d),r),a.size()<4095&&(a.size()==1<<r&&(r+=1),a.add(d+e)),d=e)}return l.write(a.indexOf(d),r),l.write(n,r),l.flush(),s.toByteArray()},c=function(){let e={},t=0,n={};return n.add=function(r){if(n.contains(r))throw`dup key:`+r;e[r]=t,t+=1},n.size=function(){return t},n.indexOf=function(t){return e[t]},n.contains=function(t){return e[t]!==void 0},n};return a},Wv=function(e,t,n){let r=Uv(e,t);for(let i=0;i<t;i+=1)for(let t=0;t<e;t+=1)r.setPixel(t,i,n(t,i));let i=Bv();r.write(i);let a=Vv(),o=i.toByteArray();for(let e=0;e<o.length;e+=1)a.writeByte(o[e]);return a.flush(),`data:image/gif;base64,`+a};Dv.stringToBytes;function Gv({text:e,label:t}){let{size:n,path:r}=(0,y.useMemo)(()=>{let t=Dv(0,`M`);t.addData(e),t.make();let n=t.getModuleCount(),r=``;for(let e=0;e<n;e++)for(let i=0;i<n;i++)t.isDark(e,i)&&(r+=`M${i} ${e}h1v1h-1z`);return{size:n,path:r}},[e]);return(0,b.jsx)(`svg`,{viewBox:`-3 -3 ${n+6} ${n+6}`,role:`img`,"aria-label":t,className:`size-44 rounded-md bg-white`,shapeRendering:`crispEdges`,children:(0,b.jsx)(`path`,{d:r,fill:`#000`})})}function Kv(){let{t:e}=Y(),t=_v();if(t.isPending)return(0,b.jsx)(W,{children:e(`common.loading`)});if(!t.data)return null;if(t.data.viewAs)return(0,b.jsx)(Oa,{to:`/`,replace:!0});let{user:n,auth:r}=t.data;return(0,b.jsxs)(`div`,{className:`flex max-w-2xl flex-col gap-8`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:e(`auth.account`)}),(0,b.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[n.displayName,n.username?` · ${n.username}`:``]})]}),r.password&&(0,b.jsx)(qv,{}),r.twoFactor&&(0,b.jsx)(Jv,{}),r.sessions&&(0,b.jsx)(Xv,{revokeOthers:r.revokeOthers})]})}function qv(){let{t:e}=Y(),t=S(),[n,r]=(0,y.useState)(``),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)({}),[u,d]=(0,y.useState)(!1),f=pt({mutationFn:()=>Q.changePassword(n,i),onSuccess:async()=>{r(``),a(``),s(``),l({}),d(!0),await t.invalidateQueries({queryKey:[`account-sessions`]})},onError:e=>l(e instanceof R_&&Object.keys(e.fields).length>0?e.fields:{form:[z_(e)]})});function p(t){t.preventDefault(),d(!1);let r={};n||(r.current=[e(`validation.required`)]),i?i!==o&&(r.confirm=[e(`auth.mismatch`)]):r.next=[e(`validation.required`)],l(r),Object.keys(r).length===0&&f.mutate()}let m=(e,t,n,r,i)=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`password-${e}`,children:t}),(0,b.jsx)(e_,{id:`password-${e}`,type:`password`,autoComplete:i,value:n,onChange:e=>r(e.target.value),"aria-invalid":c[e]?!0:void 0,"aria-describedby":c[e]?`password-${e}-error`:void 0}),c[e]&&(0,b.jsx)(`p`,{id:`password-${e}-error`,className:`text-sm text-destructive`,children:c[e].join(` `)})]});return(0,b.jsxs)(`section`,{"aria-labelledby":`password-title`,className:`flex flex-col gap-4 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsx)(`h2`,{id:`password-title`,className:`font-medium`,children:e(`auth.changePassword`)}),(0,b.jsxs)(`form`,{onSubmit:p,noValidate:!0,className:`flex flex-col gap-4`,children:[c.form&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:c.form.join(` `)}),u&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:e(`auth.passwordChanged`)}),m(`current`,e(`auth.currentPassword`),n,r,`current-password`),m(`next`,e(`auth.newPassword`),i,a,`new-password`),m(`confirm`,e(`auth.confirmPassword`),o,s,`new-password`),(0,b.jsx)(`div`,{children:(0,b.jsx)(q,{type:`submit`,disabled:f.isPending,children:e(`auth.changePassword`)})})]})]})}function Jv(){let{t:e}=Y(),t=S(),n=ft({queryKey:[`account-2fa`],queryFn:Q.twoFactor.status}),[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(``),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(!1),[d,f]=(0,y.useState)(null),[p,m]=(0,y.useState)(null),h=e=>m(e instanceof R_&&Object.keys(e.fields).length>0?Object.values(e.fields).flat().join(` `):z_(e)),g=async()=>{await t.invalidateQueries({queryKey:[`account-2fa`]}),await t.invalidateQueries({queryKey:[`account-sessions`]})},_=pt({mutationFn:Q.twoFactor.setup,onMutate:()=>m(null),onError:h}),v=pt({mutationFn:()=>Q.twoFactor.confirm(r.trim()),onMutate:()=>m(null),onSuccess:async t=>{c(t.recoveryCodes),i(``),_.reset(),f(e(`twoFactor.enabledNote`)),await g()},onError:h}),x=pt({mutationFn:()=>Q.twoFactor.recoveryCodes(a),onMutate:()=>m(null),onSuccess:async e=>{c(e.recoveryCodes),o(``),await g()},onError:h}),C=pt({mutationFn:()=>Q.twoFactor.disable(a),onMutate:()=>m(null),onSuccess:async()=>{o(``),c(null),f(e(`twoFactor.disabledNote`)),await g()},onError:h}),w=n.data?.enabled===!0,T=_.data;return(0,b.jsxs)(`section`,{"aria-labelledby":`two-factor-title`,className:`flex flex-col gap-3 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`h2`,{id:`two-factor-title`,className:`font-medium`,children:e(`twoFactor.title`)}),n.data&&(0,b.jsx)(`span`,{className:w?`rounded-full bg-green-500/15 px-2 py-0.5 text-xs text-green-800 dark:text-green-300`:`rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground`,children:e(w?`twoFactor.on`:`twoFactor.off`)})]}),p&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:p}),d&&!p&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:d}),s&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border bg-muted/40 p-3`,children:[(0,b.jsx)(`h3`,{className:`text-sm font-medium`,children:e(`twoFactor.recoveryTitle`)}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.recoveryIntro`)}),(0,b.jsx)(`ul`,{"aria-label":e(`twoFactor.recoveryTitle`),dir:`ltr`,className:`grid grid-cols-2 gap-1 font-mono text-sm`,children:s.map(e=>(0,b.jsx)(`li`,{children:e},e))}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{navigator.clipboard?.writeText(s.join(`
|
|
53
|
-
`)).then(()=>u(!0),()=>void 0)},children:e(l?`twoFactor.copied`:`twoFactor.copy`)}),(0,b.jsx)(q,{type:`button`,size:`sm`,onClick:()=>{c(null),u(!1)},children:e(`twoFactor.done`)})]})]}),n.data&&!w&&!T&&(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.intro`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:_.isPending,onClick:()=>_.mutate(),children:e(`twoFactor.setUp`)})]}),!w&&T&&(0,b.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),r.trim()&&v.mutate()},children:[(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.scan`)}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,b.jsx)(Gv,{text:T.otpauthUrl,label:e(`twoFactor.qr`)}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 text-sm`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e(`twoFactor.key`)}),(0,b.jsx)(`code`,{dir:`ltr`,"data-testid":`two-factor-key`,className:`break-all font-mono`,children:T.secret.match(/.{1,4}/g).join(` `)})]})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`two-factor-code`,children:e(`twoFactor.code`)}),(0,b.jsx)(e_,{id:`two-factor-code`,autoComplete:`one-time-code`,inputMode:`numeric`,dir:`ltr`,maxLength:10,value:r,onChange:e=>i(e.target.value)})]}),(0,b.jsx)(q,{type:`submit`,disabled:v.isPending||!r.trim(),children:e(`twoFactor.turnOn`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>_.reset(),children:e(`common.cancel`)})]})]}),w&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.left`,{count:n.data.recoveryCodesLeft})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`two-factor-password`,children:e(`twoFactor.password`)}),(0,b.jsx)(e_,{id:`two-factor-password`,type:`password`,autoComplete:`current-password`,value:a,onChange:e=>o(e.target.value)})]}),(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:!a||x.isPending,onClick:()=>x.mutate(),children:e(`twoFactor.newCodes`)}),(0,b.jsx)(q,{type:`button`,variant:`destructive`,disabled:!a||C.isPending,onClick:()=>C.mutate(),children:e(`twoFactor.turnOff`)})]})]})]})}function Yv(e,t){return e?[/Edg\//.test(e)?`Edge`:/Firefox\//.test(e)?`Firefox`:/Chrome\//.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:void 0,/Android/.test(e)?`Android`:/iPhone|iPad/.test(e)?`iOS`:/Mac OS X/.test(e)?`macOS`:/Windows/.test(e)?`Windows`:/Linux/.test(e)?`Linux`:void 0].filter(Boolean).join(` · `)||e.slice(0,40):t}function Xv({revokeOthers:e}){let{t}=Y(),n=S(),r=ft({queryKey:[`account-sessions`],queryFn:Q.sessions}),i=()=>n.invalidateQueries({queryKey:[`account-sessions`]}),a=pt({mutationFn:e=>Q.revokeSession(e),onSuccess:i}),o=pt({mutationFn:()=>Q.revokeOtherSessions(),onSuccess:i}),s=r.data?.items??[],c=a.error??o.error??r.error;return(0,b.jsxs)(`section`,{"aria-labelledby":`sessions-title`,className:`flex flex-col gap-3 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`h2`,{id:`sessions-title`,className:`font-medium`,children:t(`auth.sessions`)}),e&&s.length>1&&(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(),children:t(`auth.signOutOthers`)})]}),c&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:z_(c)}),(0,b.jsx)(`ul`,{"aria-label":t(`auth.sessions`),className:`flex flex-col divide-y`,children:s.map(e=>(0,b.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 py-2 text-sm`,children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,title:e.userAgent,children:[Yv(e.userAgent,t(`auth.unknownDevice`)),e.current&&(0,b.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs text-primary`,children:t(`auth.thisDevice`)})]}),(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[t(`auth.lastSeen`,{when:O_(new Date(e.lastSeenAt))}),e.ip?` · ${e.ip}`:``]})]}),!e.current&&(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(e.id),"aria-label":t(`auth.revokeSession`,{name:Yv(e.userAgent,t(`auth.unknownDevice`))}),children:t(`auth.revoke`)})]},e.id))})]})}function Zv(e,t){return e==null?``:typeof e==`string`?e:e[t]??e[L_.locale]??Object.values(e)[0]??``}function Qv(e){let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e.trim()!==``).map(([e,t])=>[e,t.trim()])),n=Object.keys(t);if(n.length!==0)return L_.locales.length===1?t[n[0]]:t}function $v(e){let t=Object.fromEntries(L_.locales.map(e=>[e,``]));return typeof e==`string`?t[L_.locale]=e:e&&Object.assign(t,e),t}function ey({children:e,actions:t}){return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:e}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t})]})}function ty({children:e,tone:t=`error`}){return(0,b.jsx)(`p`,{role:t===`error`?`alert`:`status`,className:t===`error`?`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:e})}var ny=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function ry(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:ny(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var iy=e=>{let t=``,n=!1;for(let r of e){if(r===`-`||r===`_`||r<=` `){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t},ay=e=>{let t=iy(e);return t.charAt(0).toUpperCase()+t.slice(1)},oy=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),sy={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function cy(e){return e!=null}function ly(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??sy.width,a=e.size??e.height??sy.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?oy(...c):oy(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??sy[`stroke-width`])*Number(e.size??e.width??sy.width)/Number(t.size??t.width??sy.width):t.strokeWidth??sy[`stroke-width`];return[`svg`,{...Object.entries(sy).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&cy(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&cy(t.width)&&{[r(`width`)]:t.width},...`height`in t&&cy(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function uy(e,t={}){return ly(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var dy=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},fy=(0,y.createContext)({}),py=()=>(0,y.useContext)(fy),my=(0,y.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=py()??{},b=!!c||dy(d),[x,S,C=[]]=uy(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:oy(v,s),hasA11yProp:b,attributes:d});return(0,y.createElement)(x,{ref:f,...S},[...C.map(([e,t])=>(0,y.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function $(e,t=[],n=[]){let r=typeof e==`string`?ry(e,t,n):e,i=(0,y.forwardRef)(({className:e,...t},n)=>(0,y.createElement)(my,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=ay(r.name)),i}var hy={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};hy.node;var gy=$(hy),_y={name:`arrow-down-up`,size:24,node:[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`m21 8-4-4-4 4`,key:`1c9v7m`}],[`path`,{d:`M17 4v16`,key:`7dpous`}]]};_y.node;var vy=$(_y),yy={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};yy.node;var by=$(yy),xy={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};xy.node;var Sy=$(xy),Cy={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Cy.node;var wy=$(Cy),Ty={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};Ty.node;var Ey=$(Ty),Dy={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};Dy.node;var Oy=$(Dy),ky={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};ky.node;var Ay=$(ky),jy={name:`box`,size:24,node:[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]};jy.node;var My=$(jy),Ny={name:`boxes`,size:24,node:[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]};Ny.node;var Py=$(Ny),Fy={name:`briefcase`,size:24,node:[[`path`,{d:`M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16`,key:`jecpp`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]};Fy.node;var Iy=$(Fy),Ly={name:`building-complex`,size:24,node:[[`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`}]],aliases:[`building-2`]};Ly.node;var Ry=$(Ly),zy={name:`calendar-days`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 13h.01`,key:`1sbv64`}],[`path`,{d:`M12 13h.01`,key:`y0uutt`}],[`path`,{d:`M16 13h.01`,key:`wip0gl`}],[`path`,{d:`M8 17h.01`,key:`p3bg7i`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M16 17h.01`,key:`ql8jdd`}]]};zy.node;var By=$(zy),Vy={name:`calendar-range`,size:24,node:[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M17 13h-6`,key:`1qbiup`}],[`path`,{d:`M13 17H7`,key:`1x38vv`}],[`path`,{d:`M7 13h.01`,key:`1vezk1`}],[`path`,{d:`M17 17h.01`,key:`1sd3ek`}]]};Vy.node;var Hy=$(Vy),Uy={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Uy.node;var Wy=$(Uy),Gy={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};Gy.node;var Ky=$(Gy),qy={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};qy.node;var Jy=$(qy),Yy={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};Yy.node;var Xy=$(Yy),Zy={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};Zy.node;var Qy=$(Zy),$y={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};$y.node;var eb=$($y),tb={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};tb.node;var nb=$(tb),rb={name:`circle-plus`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]],aliases:[`plus-circle`]};rb.node;var ib=$(rb),ab={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};ab.node;var ob=$(ab),sb={name:`columns-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]],aliases:[`panels-left-right`]};sb.node;var cb=$(sb),lb={name:`copy`,size:24,node:[[`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`}]]};lb.node;var ub=$(lb),db={name:`credit-card`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}],[`path`,{d:`M6 14h2`,key:`mk7k0u`}]]};db.node;var fb=$(db),pb={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};pb.node;var mb=$(pb),hb={name:`dollar-sign`,size:24,node:[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]};hb.node;var gb=$(hb),_b={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};_b.node;var vb=$(_b),yb={name:`ellipsis-vertical`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]],aliases:[`more-vertical`]};yb.node;var bb=$(yb),xb={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};xb.node;var Sb=$(xb),Cb={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};Cb.node;var wb=$(Cb),Tb={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Tb.node;var Eb=$(Tb),Db={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};Db.node;var Ob=$(Db),kb={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};kb.node;var Ab=$(kb),jb={name:`file`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]};jb.node;var Mb=$(jb),Nb={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};Nb.node;var Pb=$(Nb),Fb={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};Fb.node;var Ib=$(Fb),Lb={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};Lb.node;var Rb=$(Lb),zb={name:`heart`,size:24,node:[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}]]};zb.node;var Bb=$(zb),Vb={name:`house`,size:24,node:[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]],aliases:[`home`]};Vb.node;var Hb=$(Vb),Ub={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};Ub.node;var Wb=$(Ub),Gb={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};Gb.node;var Kb=$(Gb),qb={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};qb.node;var Jb=$(qb),Yb={name:`key`,size:24,node:[[`path`,{d:`m2 21 9.6-9.6`,key:`9l79m3`}],[`path`,{d:`m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19`,key:`fw8biw`}],[`circle`,{cx:`15.5`,cy:`7.5`,r:`5.5`,key:`4wxmhb`}]]};Yb.node;var Xb=$(Yb),Zb={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};Zb.node;var Qb=$(Zb),$b={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};$b.node;var ex=$($b),tx={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};tx.node;var nx=$(tx),rx={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};rx.node;var ix=$(rx),ax={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};ax.node;var ox=$(ax),sx={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};sx.node;var cx=$(sx),lx={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};lx.node;var ux=$(lx),dx={name:`lock`,size:24,node:[[`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`}]]};dx.node;var fx=$(dx),px={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};px.node;var mx=$(px),hx={name:`mail`,size:24,node:[[`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`}]]};hx.node;var gx=$(hx),_x={name:`map-pin`,size:24,node:[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]};_x.node;var vx=$(_x),yx={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};yx.node;var bx=$(yx),xx={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};xx.node;var Sx=$(xx),Cx={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};Cx.node;var wx=$(Cx),Tx={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};Tx.node;var Ex=$(Tx),Dx={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};Dx.node;var Ox=$(Dx),kx={name:`package`,size:24,node:[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]};kx.node;var Ax=$(kx),jx={name:`panel-right`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]};jx.node;var Mx=$(jx),Nx={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};Nx.node;var Px=$(Nx),Fx={name:`phone`,size:24,node:[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]};Fx.node;var Ix=$(Fx),Lx={name:`pin-off`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]};Lx.node;var Rx=$(Lx),zx={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};zx.node;var Bx=$(zx),Vx={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Vx.node;var Hx=$(Vx),Ux={name:`printer`,size:24,node:[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]};Ux.node;var Wx=$(Ux),Gx={name:`receipt`,size:24,node:[[`path`,{d:`M12 17V7`,key:`pyj7ub`}],[`path`,{d:`M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8`,key:`1elt7d`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]};Gx.node;var Kx=$(Gx),qx={name:`refresh-cw`,size:24,node:[[`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`}]]};qx.node;var Jx=$(qx),Yx={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};Yx.node;var Xx=$(Yx),Zx={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};Zx.node;var Qx=$(Zx),$x={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};$x.node;var eS=$($x),tS={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};tS.node;var nS=$(tS),rS={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};rS.node;var iS=$(rS),aS={name:`settings`,size:24,node:[[`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`}]]};aS.node;var oS=$(aS),sS={name:`shield-check`,size:24,node:[[`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`}]]};sS.node;var cS=$(sS),lS={name:`shield`,size:24,node:[[`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`}]]};lS.node;var uS=$(lS),dS={name:`shopping-bag`,size:24,node:[[`path`,{d:`M16 10a4 4 0 0 1-8 0`,key:`1ltviw`}],[`path`,{d:`M3.103 6.034h17.794`,key:`awc11p`}],[`path`,{d:`M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z`,key:`o988cm`}]]};dS.node;var fS=$(dS),pS={name:`shopping-cart`,size:24,node:[[`path`,{d:`m2.05 2.05 1.099-.028a1 1 0 0 1 1.008.815l2.69 14.347A1 1 0 0 0 7.83 18H18`,key:`uebgi3`}],[`path`,{d:`M4.563 5h16.435a1 1 0 0 1 .981 1.204l-1.026 6.226A2 2 0 0 1 18.962 14H6.25`,key:`1j7c9p`}],[`circle`,{cx:`18`,cy:`20`,r:`2`,key:`t9985n`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]};pS.node;var mS=$(pS),hS={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};hS.node;var gS=$(hS),_S={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};_S.node;var vS=$(_S),yS={name:`store`,size:24,node:[[`path`,{d:`M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5`,key:`slp6dd`}],[`path`,{d:`M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244`,key:`o0xfot`}],[`path`,{d:`M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05`,key:`wn3emo`}]]};yS.node;var bS=$(yS),xS={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};xS.node;var SS=$(xS),CS={name:`tag`,size:24,node:[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]};CS.node;var wS=$(CS),TS={name:`tags`,size:24,node:[[`path`,{d:`M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z`,key:`16rjxf`}],[`path`,{d:`M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193`,key:`178nd4`}],[`circle`,{cx:`10.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`12ikhr`}]]};TS.node;var ES=$(TS),DS={name:`ticket`,size:24,node:[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]};DS.node;var OS=$(DS),kS={name:`trash`,size:24,node:[[`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`}]],aliases:[`trash-2`]};kS.node;var AS=$(kS),jS={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};jS.node;var MS=$(jS),NS={name:`truck`,size:24,node:[[`path`,{d:`M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2`,key:`wrbu53`}],[`path`,{d:`M15 18H9`,key:`1lyqi6`}],[`path`,{d:`M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14`,key:`lysw3i`}],[`circle`,{cx:`17`,cy:`18`,r:`2`,key:`332jqn`}],[`circle`,{cx:`7`,cy:`18`,r:`2`,key:`19iecd`}]]};NS.node;var PS=$(NS),FS={name:`upload`,size:24,node:[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]};FS.node;var IS=$(FS),LS={name:`user-round`,size:24,node:[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]],aliases:[`user-2`]};LS.node;var RS=$(LS),zS={name:`user`,size:24,node:[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]};zS.node;var BS=$(zS),VS={name:`users`,size:24,node:[[`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`}]]};VS.node;var HS=$(VS),US={name:`video`,size:24,node:[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]};US.node;var WS=$(US),GS={name:`wallet`,size:24,node:[[`path`,{d:`M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1`,key:`18etb6`}],[`path`,{d:`M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4`,key:`xoc0q4`}]]};GS.node;var KS=$(GS),qS={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};qS.node;var JS=$(qS),YS={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};YS.node;var XS=$(YS),ZS={name:`zap`,size:24,node:[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]};ZS.node;var QS=$(ZS),$S=/^(-?)(\d+)(?:\.(\d*))?$/,eC=/^-?\d{1,3}(,\d{3})+(\.\d*)?$/;function tC(e,t){let n=a_(e).trim(),r=$S.exec(eC.test(n)?n.replace(/,/g,``):n);if(!r)return e;let[,i,a,o]=r,s=a.replace(/^0+(?=\d)/,``).replace(/\B(?=(\d{3})+$)/g,`,`),c=t===void 0?o??``:(o??``).padEnd(t,`0`);return`${i}${s}${c?`.${c}`:``}`}var nC;function rC(e){nC=e}function iC(){if(!nC)return;let{unit:e,position:t}=nC,n=x_(),r=typeof e==`string`?e:e[n]??e[n.split(`-`)[0]]??Object.values(e)[0];return r?{unit:r,position:t}:void 0}function aC(e,t={}){let n=t.currency??iC(),r=e=>D_(tC(e,t.scale));return{main:r(e),...n?{unit:n.unit,position:n.position}:{},...t.previous===void 0?{}:{previous:r(t.previous)}}}function oC(e){return e.unit?e.position===`before`?`${e.unit} ${e.main}`:`${e.main} ${e.unit}`:e.main}function sC(e,t){if(e==null)return`—`;if(t.type===`relation`){let t=Array.isArray(e)?e:[e];return t.length===0?`—`:t.map(e=>String(e.title)).join(`, `)}if(t.file)return(Array.isArray(e)?e:[e]).map(e=>String(e).split(`/`).pop()).join(`, `)||`—`;if(t.widget===`richtext`)return lC(String(e))||`—`;if(t.type===`boolean`)return J(e?`common.yes`:`common.no`);if(t.type===`enum`)return t.enumLabels?.[String(e)]??String(e);if(t.widget===`money`)return oC(aC(String(e),{currency:t.currency,scale:t.scale}));if(t.type===`number`||t.type===`decimal`||t.type===`bigint`)return D_(String(e));if(t.type===`date`)return A_(String(e));if(t.type===`json`||t.type===`object`)return JSON.stringify(e);if(t.type===`datetime`){let t=new Date(String(e));return Number.isNaN(t.getTime())?String(e):O_(t)}return String(e)}var cC={amp:`&`,lt:`<`,gt:`>`,quot:`"`,"#39":`'`,nbsp:` `};function lC(e,t=120){let n=e.replace(/<[^>]*>/g,` `).replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(e,t)=>cC[t]).replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t).trimEnd()}…`:n}function uC(e,t){let n=e?.groups??[];return{resource:e=>t(e)?.label??n.flatMap(e=>e.resources).find(t=>t.name===e)?.label,page:e=>n.flatMap(e=>e.pages).find(t=>t.name===e)?.label,action:(e,n)=>t(e)?.actions?.find(e=>e.name===n)?.label,softDelete:e=>t(e)?.softDelete}}var dC={created:`audit.event.created`,updated:`audit.event.updated`,deleted:`audit.event.deleted`,restored:`audit.event.restored`,purged:`audit.event.purged`},fC={"auth.login":`audit.event.login`,"auth.logout":`audit.event.logout`,"auth.view_as":`audit.event.viewAs`,"auth.password_changed":`audit.event.passwordChanged`,"auth.two_factor_enabled":`audit.event.twoFactorEnabled`,"auth.two_factor_disabled":`audit.event.twoFactorDisabled`,"auth.recovery_codes_regenerated":`audit.event.recoveryCodes`,"rbac.role.changed":`audit.event.roleChanged`,"rbac.group.changed":`audit.event.groupChanged`,"rbac.user_roles.changed":`audit.event.userRolesChanged`,"rbac.user.created":`audit.event.userCreated`,"rbac.user.changed":`audit.event.userChanged`,"rbac.user.password_reset":`audit.event.passwordReset`,"rbac.user.two_factor_reset":`audit.event.twoFactorReset`},pC={WRONG_CODE:`audit.event.loginFailedCode`,RATE_LIMITED:`audit.event.loginFailedLimited`};function mC(e){return e.event.startsWith(`*.`)||e.event.startsWith(`page.*.`)}function hC(e){return e.resource!==void 0&&e.event.startsWith(`${e.resource}.`)?e.event.slice(e.resource.length+1):void 0}var gC=/^page\.(.+)\.updated$/;function _C(e,t={}){if(mC(e))return J(`audit.event.unseen`);let n=hC(e);if(n!==void 0){if(n.startsWith(`action.`)&&n.length>7){let r=n.slice(7);return J(`audit.event.action`,{action:t.action?.(e.resource,r)??r})}if(n===`deleted`&&t.softDelete?.(e.resource))return J(`audit.event.trashed`);let r=dC[n];return r?J(r):e.event}let r=gC.exec(e.event)?.[1];if(r!==void 0)return J(`audit.event.page`,{page:t.page?.(r)??r});if(e.event===`auth.login_failed`){let t=e.meta?.reason;return t===`SUPPRESSED`?J(`audit.event.loginFailedMore`,{count:e.meta?.suppressed??0}):J(t&&pC[t]||`audit.event.loginFailed`)}if(e.event===`auth.sessions_revoked`){let t=e.meta?.sessions;return J(t===`others`?`audit.event.sessionsOthers`:t===`one`?`audit.event.sessionsOne`:`audit.event.sessions`)}let i=fC[e.event];return i?J(i):e.event}function vC(e){if(e.event===`auth.login_failed`){if(e.meta?.reason===`SUPPRESSED`)return J(`audit.suppressedNote`);if(e.meta?.limited)return J(`audit.limitedNote`)}if(e.meta?.action!==void 0&&e.meta.deleted)return J(`audit.actionDeleted`)}function yC(e,t={}){if(!mC(e)){if(e.resource!==void 0){let n=t.resource?.(e.resource)??e.resource;return e.recordId===void 0?n:e.recordTitle!==void 0&&e.recordTitle!==``?`${n}: ${e.recordTitle}`:`${n} #${e.recordId}`}if(e.recordTitle!==void 0&&e.recordTitle!==``)return e.recordTitle;if(e.recordId!==void 0)return e.recordId;if(e.event===`auth.login_failed`&&e.meta?.username)return e.meta.username}}function bC(e){if(e.restricted&&!mC(e))return J(e.resource===void 0?`audit.restrictedChanges`:`audit.restrictedRecord`)}function xC(e,t,n){let r={field:e.field,label:t?.label??e.field};if(`hidden`in e&&e.hidden)return{...r,state:`hidden`,truncated:!1};if(`changed`in e&&e.changed)return{...r,state:`changed`,truncated:!1};let i=e,a=i.truncated===!0;return a&&!(`before`in i)&&!(`after`in i)?{...r,state:`dropped`,truncated:a}:{...r,state:`values`,before:`before`in i&&i.before!==void 0?TC(i.before,t,n):void 0,after:`after`in i&&i.after!==void 0?TC(i.after,t,n):void 0,truncated:a}}var SC=`—`,CC=1e5;function wC(e){return e==null||e===``?SC:typeof e==`boolean`?J(e?`common.yes`:`common.no`):typeof e==`string`?e:Array.isArray(e)?e.length===0?SC:e.every(e=>typeof e!=`object`||!e)?e.map(String).join(`, `):JSON.stringify(e):typeof e==`object`?JSON.stringify(e):String(e)}function TC(e,t,n){if(e==null||e===``)return SC;if(!t)return wC(e);if(t.type===`relation`){let t=Array.isArray(e)?e:[e],r=e=>typeof e==`object`&&e?e.id:e;if(t.some(e=>![`string`,`number`,`bigint`].includes(typeof r(e))))return wC(e);let i=t.map(e=>String(r(e)));return i.length===0?SC:i.map(e=>{let t=n?.(e);return t!==void 0&&t!==``&&t!==`#${e}`?`${t} (#${e})`:`#${e}`}).join(`, `)}return t.file?typeof e==`string`||Array.isArray(e)?sC(e,t):wC(e):t.type===`json`||t.type===`object`?typeof e==`string`?e:JSON.stringify(e):typeof e==`object`?wC(e):t.widget===`richtext`?lC(String(e),CC)||SC:sC(e,t)}var EC=[`actor`,`event`,`resource`,`record`,`from`,`to`],DC=/^(\d{4})-(\d{2})-(\d{2})$/;function OC(e,t){let n=DC.exec(e);if(!n)return e;let[r,i,a]=[Number(n[1]),Number(n[2]),Number(n[3])],o=t?new Date(r,i-1,a,23,59,59,999):new Date(r,i-1,a,0,0,0,0);return o.getFullYear()===r&&o.getMonth()===i-1&&o.getDate()===a?o.toISOString():e}function kC(e){let t=new URLSearchParams;for(let n of EC){let r=e.get(n);r!==null&&r!==``&&(n!==`record`||e.get(`resource`))&&t.set(n,n===`from`?OC(r,!1):n===`to`?OC(r,!0):r)}return t.sort(),t.toString()}function AC(e){return kC(e)!==``}function jC(e,t){let n=t.trim();return e===`resource`?{resource:n||null,record:null}:{[e]:n||null}}function MC(){return Object.fromEntries(EC.map(e=>[e,null]))}function NC({entries:e,now:t,names:n,schemaOf:r,pageFieldsOf:i,titleOf:a,onActor:o,showSubject:s=!1}){let{t:c}=Y();return(0,b.jsx)(`ol`,{"aria-label":c(`audit.entries`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card`,children:e.map(e=>(0,b.jsx)(FC,{entry:e,now:t,names:n,schema:e.resource===void 0?void 0:r(e.resource),pageFields:e.resource===void 0&&e.meta?.page!==void 0?i?.(e.meta.page):void 0,titleOf:a,onActor:o,showSubject:s},e.id))})}var PC=/\.(deleted|purged)$/;function FC({entry:e,now:t,names:n,schema:r,pageFields:i,titleOf:a,onActor:o,showSubject:s}){let c=r?.fields??i,{t:l}=Y(),u=new Date(e.at),d=!Number.isNaN(u.getTime()),f=s?yC(e,n):void 0,p=s&&e.resource!==void 0&&e.recordId!==void 0&&!PC.test(e.event)&&!e.meta?.deleted,m=bC(e),h=vC(e),g=e.actor?e.actor.name??`#${e.actor.id}`:l(`audit.noActor`),_=e.meta?.input?Object.entries(e.meta.input):[],v=e.meta?.action===void 0?void 0:r?.actions?.find(t=>t.name===IC(e))?.input?.fields,y=[e.meta?.ip,e.meta?.userAgent].filter(Boolean).join(` · `);return(0,b.jsxs)(`li`,{className:`flex flex-col gap-2 px-4 py-3 text-sm`,"data-event":e.event,"data-actor":e.actor?.id??``,"data-anonymous":mC(e)||void 0,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:_C(e,n)}),f!==void 0&&(p?(0,b.jsx)(xo,{to:`/${e.resource}/${encodeURIComponent(e.recordId)}`,className:`text-primary hover:underline`,children:f}):(0,b.jsx)(`span`,{children:f}))]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[e.actor&&o?(0,b.jsx)(`button`,{type:`button`,className:`font-medium text-foreground hover:underline`,"aria-label":l(`audit.filterByActor`,{name:g}),onClick:()=>o(e.actor.id),children:g}):(0,b.jsx)(`span`,{className:`font-medium text-foreground`,children:g}),e.viewAsBy!==void 0&&(0,b.jsx)(`span`,{children:l(`audit.viewAsBy`,{id:e.viewAsBy})}),d?(0,b.jsxs)(`time`,{dateTime:e.at,children:[j_(u,t),` · `,O_(u)]}):(0,b.jsx)(`span`,{children:e.at})]}),h!==void 0&&(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:h}),m!==void 0&&(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:m}),e.changes!==void 0&&e.changes.length>0&&(0,b.jsx)(`dl`,{"aria-label":l(`audit.changedFields`),className:`grid grid-cols-1 gap-x-4 gap-y-1.5 sm:grid-cols-[minmax(6rem,auto)_1fr]`,children:e.changes.map(e=>{let t=c?.find(t=>t.name===e.field);return(0,b.jsx)(LC,{row:xC(e,t,a?t=>a(e.field,t):void 0)},e.field)})}),_.length>0&&(0,b.jsx)(`dl`,{"aria-label":l(`audit.input`),className:`grid grid-cols-1 gap-x-4 gap-y-1.5 sm:grid-cols-[minmax(6rem,auto)_1fr]`,children:_.map(([e,t])=>{let n=v?.find(t=>t.name===e);return(0,b.jsxs)(`div`,{className:`contents`,"data-input":e,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:n?.label??e}),(0,b.jsx)(`dd`,{className:`min-w-0`,children:(0,b.jsx)(zC,{text:TC(t,n)})})]},e)})}),e.meta?.inputTruncated&&(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:l(`audit.inputTruncated`)}),y!==``&&(0,b.jsx)(`p`,{className:`text-xs break-all text-muted-foreground`,dir:`ltr`,"data-client":!0,children:y})]})}function IC(e){let t=`${e.resource}.action.`;return e.event.startsWith(t)?e.event.slice(t.length):void 0}function LC({row:e}){let{t}=Y();return(0,b.jsxs)(`div`,{className:`contents`,"data-change":e.field,"data-state":e.state,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:e.state===`values`?(0,b.jsxs)(b.Fragment,{children:[e.before!==void 0&&(0,b.jsxs)(`span`,{className:`min-w-0 text-muted-foreground line-through decoration-muted-foreground/50`,"data-before":!0,children:[(0,b.jsxs)(`span`,{className:`sr-only`,children:[t(`audit.before`),`: `]}),(0,b.jsx)(zC,{text:e.before})]}),e.before!==void 0&&e.after!==void 0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Sy,{className:`size-3.5 shrink-0 self-center text-muted-foreground rtl:-scale-x-100`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`sr-only`,children:t(`audit.becomes`)})]}),e.after!==void 0&&(0,b.jsxs)(`span`,{className:`min-w-0`,"data-after":!0,children:[e.before===void 0&&(0,b.jsxs)(`span`,{className:`sr-only`,children:[t(`audit.after`),`: `]}),(0,b.jsx)(zC,{text:e.after})]}),e.truncated&&(0,b.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t(`audit.field.truncated`),`)`]})]}):(0,b.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground`,children:t(`audit.field.${e.state}`)})})]})}var RC=160;function zC({text:e}){let{t}=Y(),[n,r]=(0,y.useState)(!1);return e.length<=RC?(0,b.jsx)(`span`,{dir:`auto`,className:`break-words whitespace-pre-wrap`,children:e}):(0,b.jsxs)(`span`,{dir:`auto`,className:`break-words whitespace-pre-wrap`,children:[n?e:`${e.slice(0,RC).trimEnd()}…`,` `,(0,b.jsx)(q,{type:`button`,variant:`link`,size:`sm`,className:`h-auto p-0 text-xs`,"aria-expanded":n,onClick:()=>r(e=>!e),children:t(n?`audit.showLess`:`audit.showMore`)})]})}var BC=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178],VC=(e,t)=>Math.trunc(e/t),HC=(e,t)=>e-Math.trunc(e/t)*t;function UC(e){let t=e+621,n=-14,r=BC[0];if(e<r||e>=BC[BC.length-1])throw RangeError(`Jalali year ${e} is out of range`);let i=0;for(let t=1;t<BC.length;t++){let a=BC[t];if(i=a-r,e<a)break;n+=VC(i,33)*8+VC(HC(i,33),4),r=a}let a=e-r;n+=VC(a,33)*8+VC(HC(a,33)+3,4),HC(i,33)===4&&i-a===4&&(n+=1);let o=VC(t,4)-VC((VC(t,100)+1)*3,4)-150,s=20+n-o;i-a<6&&(a=a-i+VC(i+4,33)*33);let c=HC(HC(a+1,33)-1,4);return c===-1&&(c=4),{leap:c,gy:t,march:s}}function WC(e,t,n){return VC((e+VC(t-8,6)+100100)*1461,4)+VC(153*HC(t+9,12)+2,5)+n-34840408-VC(VC(e+100100+VC(t-8,6),100)*3,4)+752}function GC(e){let t=4*e+139361631;t=t+VC(VC(4*e+183187720,146097)*3,4)*4-3908;let n=VC(HC(t,1461),4)*5+308,r=VC(HC(n,153),5)+1,i=HC(VC(n,153),12)+1;return{gy:VC(t,1461)-100100+VC(8-i,6),gm:i,gd:r}}function KC(e,t,n){let{gy:r,march:i}=UC(e);return WC(r,3,i)+(t-1)*31-VC(t,7)*(t-7)+n-1}function qC(e){let{gy:t}=GC(e),n=t-621,r=UC(n),i=e-WC(t,3,r.march);if(i>=0){if(i<=185)return{jy:n,jm:1+VC(i,31),jd:HC(i,31)+1};i-=186}else--n,i+=179,r.leap===1&&(i+=1);return{jy:n,jm:7+VC(i,30),jd:HC(i,30)+1}}var JC=(e,t=2)=>String(e).padStart(t,`0`),YC=/^(\d{4})-(\d{2})-(\d{2})$/;function XC(e){return UC(e).leap===0}function ZC(e,t){return t<=6?31:t<=11||XC(e)?30:29}function QC(e){let t=YC.exec(e);if(!t)throw RangeError(`not an ISO date: ${e}`);return qC(WC(Number(t[1]),Number(t[2]),Number(t[3])))}function $C(e,t,n){let{gy:r,gm:i,gd:a}=GC(KC(e,t,n));return`${JC(r,4)}-${JC(i)}-${JC(a)}`}function ew(e,t,n){return Number.isInteger(e)&&e>=1&&e<3178&&t>=1&&t<=12&&n>=1&&n<=ZC(e,t)}function tw(e){let{jy:t,jm:n,jd:r}=QC(e);return`${t}/${JC(n)}/${JC(r)}`}function nw(e){let t=/^(\d{4})[/\-.](\d{1,2})[/\-.](\d{1,2})$/.exec(i_(e.trim()));if(!t)return;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];return ew(n,r,i)?$C(n,r,i):void 0}function rw(e,t){let{jy:n,jm:r,jd:i}=QC(e),a=n*12+(r-1)+t,o=Math.floor(a/12),s=a%12+1;return $C(o,s,Math.min(i,ZC(o,s)))}function iw(e,t){return new Date(Date.parse(`${e}T00:00:00Z`)+t*864e5).toISOString().slice(0,10)}function aw(){let e=new Date;return`${JC(e.getFullYear(),4)}-${JC(e.getMonth()+1)}-${JC(e.getDate())}`}var ow=(e,t=2)=>String(e).padStart(t,`0`),sw=(e,t)=>new Date(Date.UTC(e,t,0)).getUTCDate(),cw={intl:`persian`,parts:e=>{let{jy:t,jm:n,jd:r}=QC(e);return{year:t,month:n,day:r}},fromParts:$C,monthLength:ZC,addMonths:rw,format:tw,parse:nw,weekStart:6},lw={intl:`gregory`,parts:e=>({year:Number(e.slice(0,4)),month:Number(e.slice(5,7)),day:Number(e.slice(8,10))}),fromParts:(e,t,n)=>`${ow(e,4)}-${ow(t)}-${ow(n)}`,monthLength:sw,addMonths:(e,t)=>{let{year:n,month:r,day:i}=lw.parts(e),a=n*12+(r-1)+t,o=Math.floor(a/12),s=a%12+1;return lw.fromParts(o,s,Math.min(i,sw(o,s)))},format:e=>e,parse:e=>{let t=/^(\d{4})[/\-.](\d{1,2})[/\-.](\d{1,2})$/.exec(i_(e.trim()));if(!t)return;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];return n>=1&&r>=1&&r<=12&&i>=1&&i<=sw(n,r)?lw.fromParts(n,r,i):void 0},weekStart:1},uw=e=>e===`persian`?cw:lw,dw=/^\d{4}-\d{2}-\d{2}$/;function fw(e){let{calendar:t}=Y();return(0,b.jsx)(pw,{...e,system:uw(t)})}function pw({id:e,value:t,onChange:n,label:r,live:i,className:a,system:o,...s}){let{t:c,digits:l}=Y(),u=e=>dw.test(e)?D_(o.format(e)):e,[d,f]=(0,y.useState)(()=>u(t)),[p,m]=(0,y.useState)(!1),h=(0,y.useRef)(t);(0,y.useEffect)(()=>{t!==h.current&&(h.current=t,f(u(t)))},[t,l,o]);function g(e){h.current=e,n(e)}function _(){let e=d.trim();if(e===``)return t!==``&&g(``);let n=o.parse(e);n?(f(u(n)),n!==t&&g(n)):i&&g(i_(e))}function v(e){f(u(e)),m(!1),g(e)}return(0,b.jsxs)(`div`,{className:U(`flex items-center gap-1`,a),children:[(0,b.jsx)(e_,{id:e,dir:`ltr`,inputMode:`numeric`,placeholder:c(`date.placeholder`),value:d,...s,onChange:e=>{if(f(e.target.value),!i)return;let t=e.target.value.trim();g((t===``?``:o.parse(t))??i_(t))},onBlur:()=>{_(),s.onBlur?.()},onKeyDown:e=>{e.key===`Enter`&&(_(),i||e.preventDefault()),s.onKeyDown?.(e)}}),(0,b.jsxs)(Kh,{open:p,onOpenChange:m,children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c(`date.openCalendar`,{name:r}),children:(0,b.jsx)(By,{})})}),(0,b.jsx)(Jh,{children:(0,b.jsx)(Yh,{align:`end`,sideOffset:4,className:`z-50 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md`,"aria-label":c(`date.calendar`,{name:r}),children:(0,b.jsx)(mw,{system:o,value:dw.test(t)?t:void 0,onPick:v,onClear:()=>v(``)})})})]})]})}function mw({system:e,value:t,onPick:n,onClear:r}){let{t:i,locale:a}=Y(),o=aw(),[s,c]=(0,y.useState)(t??o),[l,u]=(0,y.useState)(`days`),d=(0,y.useRef)(null),f=(0,y.useRef)(!1),{year:p,month:m}=e.parts(s),h=w_(a);(0,y.useEffect)(()=>{f.current&&(f.current=!1,d.current?.querySelector(`[data-iso="${s}"]`)?.focus())},[s]);let g=t=>new Intl.DateTimeFormat(`${a}-u-ca-${e.intl}`,{month:`long`,timeZone:`UTC`}).format(Date.parse(`${e.fromParts(p,t,1)}T00:00:00Z`)),_=e=>D_(String(e)),v=iw(`2024-01-07`,e.weekStart),x=Array.from({length:7},(e,t)=>new Intl.DateTimeFormat(a,{weekday:`narrow`,timeZone:`UTC`}).format(Date.parse(`${iw(v,t)}T00:00:00Z`))),S=e.fromParts(p,m,1),C=(new Date(`${S}T00:00:00Z`).getUTCDay()-e.weekStart+7)%7,w=e.monthLength(p,m),T=[...Array.from({length:C},()=>null),...Array.from({length:w},(e,t)=>iw(S,t))];function E(t){let n={ArrowRight:h?-1:1,ArrowLeft:h?1:-1,ArrowDown:7,ArrowUp:-7},r;t.key in n?r=iw(s,n[t.key]):t.key===`PageDown`?r=e.addMonths(s,t.shiftKey?12:1):t.key===`PageUp`&&(r=e.addMonths(s,t.shiftKey?-12:-1)),r&&(t.preventDefault(),f.current=!0,c(r))}let D=(e,t,n,r)=>(0,b.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":i(`date.previous`),onClick:()=>n(-1),children:(0,b.jsx)(Qy,{className:`rtl:rotate-180`})}),t?(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":r,onClick:t,children:e}):(0,b.jsx)(`span`,{className:`text-sm font-medium`,children:e}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":i(`date.next`),onClick:()=>n(1),children:(0,b.jsx)(eb,{className:`rtl:rotate-180`})})]}),O;if(l===`years`){let t=p-p%12;O=(0,b.jsxs)(b.Fragment,{children:[D(`${_(t)}–${_(t+11)}`,void 0,t=>c(e.addMonths(s,t*144)),``),(0,b.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:Array.from({length:12},(e,n)=>t+n).map(t=>(0,b.jsx)(q,{type:`button`,variant:t===p?`secondary`:`ghost`,size:`sm`,onClick:()=>{c(e.fromParts(t,m,Math.min(e.parts(s).day,e.monthLength(t,m)))),u(`months`)},children:_(t)},t))})]})}else O=l===`months`?(0,b.jsxs)(b.Fragment,{children:[D(_(p),()=>u(`years`),t=>c(e.addMonths(s,t*12)),i(`date.chooseYear`)),(0,b.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:Array.from({length:12},(e,t)=>t+1).map(t=>(0,b.jsx)(q,{type:`button`,variant:t===m?`secondary`:`ghost`,size:`sm`,onClick:()=>{c(e.fromParts(p,t,Math.min(e.parts(s).day,e.monthLength(p,t)))),u(`days`)},children:g(t)},t))})]}):(0,b.jsxs)(b.Fragment,{children:[D(`${g(m)} ${_(p)}`,()=>u(`months`),t=>c(e.addMonths(s,t)),i(`date.chooseMonth`)),(0,b.jsxs)(`div`,{ref:d,role:`grid`,"aria-label":`${g(m)} ${_(p)}`,onKeyDown:E,className:`grid grid-cols-7 gap-0.5 text-center`,children:[(0,b.jsx)(`div`,{role:`row`,className:`contents`,children:x.map((e,t)=>(0,b.jsx)(`div`,{role:`columnheader`,className:`py-1 text-xs text-muted-foreground`,children:e},t))}),Array.from({length:Math.ceil(T.length/7)},(r,i)=>(0,b.jsx)(`div`,{role:`row`,className:`contents`,children:T.slice(i*7,i*7+7).map((r,a)=>r?(0,b.jsx)(`div`,{role:`gridcell`,"aria-selected":r===t,children:(0,b.jsx)(`button`,{type:`button`,"data-iso":r,tabIndex:r===s?0:-1,"aria-label":A_(r),"aria-current":r===o?`date`:void 0,onClick:()=>n(r),className:U(`size-8 rounded-md text-sm hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,r===o&&`font-semibold text-primary`,r===t&&`bg-primary text-primary-foreground hover:bg-primary/90`),children:_(e.parts(r).day)})},r):(0,b.jsx)(`div`,{role:`gridcell`},`empty-${i}-${a}`))},i))]})]});return(0,b.jsxs)(`div`,{className:`flex w-64 flex-col`,children:[O,(0,b.jsxs)(`div`,{className:`mt-2 flex justify-between gap-2 border-t pt-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>n(o),children:i(`date.today`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:i(`date.clear`)})]})]})}function hw({id:e,value:t,onChange:n,label:r,...i}){let{t:a}=Y(),[o=``,s=``]=t.split(`T`),c=(e,t)=>n(e===``?``:`${e}T${t||`00:00`}`);return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(fw,{id:e,live:!0,value:o,label:r,onChange:e=>c(e,s),className:`min-w-44 flex-1`,...i}),(0,b.jsx)(e_,{type:`time`,dir:`ltr`,"aria-label":a(`date.time`,{name:r}),className:`w-28`,value:s,onChange:e=>c(o,e.target.value)})]})}var gw=new Set([`page`,`pageSize`,`sort`,`search`,`trashed`,`after`,`tab`]),_w=e=>gw.has(e)||e.startsWith(`filter[`);function vw(e){let t=new URLSearchParams;for(let[n,r]of e)r!==``&&_w(n)&&t.append(n,r);return t.sort(),t.toString()}function yw(e,t){return`filter[${e}][${t}]`}function bw(e){return[...e.keys()].some(e=>e===`search`||e.startsWith(`filter[`))}function xw(e){let t={};for(let n of e.keys())(n===`search`||n.startsWith(`filter[`))&&(t[n]=null);return t}function Sw(e,t){let n=new URLSearchParams(e);Object.keys(t).some(e=>e!==`page`&&e!==`after`)&&(n.delete(`page`),n.delete(`after`));for(let[e,r]of Object.entries(t))r===null?n.delete(e):n.set(e,r);return n}function Cw(e,t){if(!e)return{summary:``,label:J(`list.page`,{page:t}),hasNext:!1};if(e.total===null)return{summary:``,label:J(`list.page`,{page:t}),hasNext:e.hasMore===!0};let n=Math.max(1,Math.ceil(e.total/e.pageSize)),r=E_(e.total);return{summary:J(e.estimated?`list.about`:`list.total`,{count:r}),label:e.estimated?J(`list.page`,{page:t}):J(`list.pageOf`,{page:t,pages:n}),hasNext:t<n}}function ww(e,t,n){if(!e||e.total===null||e.total===0)return``;if(e.estimated)return J(`list.about`,{count:E_(e.total)});let r=(t-1)*e.pageSize+1;return J(`list.range`,{from:E_(r),to:E_(r+Math.max(n,1)-1),total:E_(e.total)})}function Tw(e){return[...new Set([10,20,50,100,e])].filter(e=>e<=100).sort((e,t)=>e-t)}function Ew(e){let t=new Set;for(let[n,r]of e){let e=/^filter\[([^\][]+)\]/.exec(n);e&&r!==``&&t.add(e[1])}return t.size}function Dw(e,t){let n=e=>e===`search`||e===`sort`||e.startsWith(`filter[`),r={};for(let i of new Set([...e.keys(),...t.keys()]))n(i)&&e.get(i)!==t.get(i)&&(r[i]=t.get(i));return Object.fromEntries(Object.entries(r).sort(([e],[t])=>e.localeCompare(t)))}function Ow(e){return new Map([...e].filter(([e,t])=>e.startsWith(`filter[`)&&t!==``))}function kw(e,t){let n=Ow(t),r=t.get(`tab`);return e?.find(e=>{if((e.where?e.key:null)!==r)return!1;let t=Object.entries(e.filter);return t.length===n.size&&t.every(([e,t])=>n.get(e)===t)})}function Aw(e,t){let n={};for(let e of Ow(t).keys())n[e]=null;return t.has(`tab`)&&(n.tab=null),Object.assign(n,e.filter),e.where?n.tab=e.key:t.has(`tab`)&&(n.tab=null),n}var jw=`\0nma-empty`,Mw=e=>e===``?jw:e,Nw=e=>e===jw?``:e;function Pw({id:e,value:t,onValueChange:n,options:r,placeholder:i,disabled:a,size:o=`md`,className:s,defaultOpen:c,onOpenChange:l,autoFocus:u,...d}){let{locale:f}=Y(),p=r.some(e=>e.value===t);return(0,b.jsxs)(pg,{value:p?Mw(t):``,onValueChange:e=>n(Nw(e)),disabled:a,defaultOpen:c,onOpenChange:l,dir:w_(f)?`rtl`:`ltr`,children:[(0,b.jsxs)(hg,{id:e,autoFocus:u,"data-slot":`select`,"data-value":p?t:void 0,className:U(`flex w-full min-w-0 items-center justify-between gap-2 rounded-control border border-input bg-card px-2.5 text-start text-[13px] text-foreground outline-none transition-colors`,`focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50`,`aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground`,o===`sm`?`h-7 text-xs`:`h-8`,s),"aria-label":d[`aria-label`],"aria-invalid":d[`aria-invalid`],"aria-describedby":d[`aria-describedby`],"aria-busy":d[`aria-busy`],children:[(0,b.jsx)(`span`,{className:`truncate`,children:(0,b.jsx)(_g,{placeholder:i??`—`})}),(0,b.jsx)(vg,{asChild:!0,children:(0,b.jsx)(Xy,{className:`size-3.5 shrink-0 opacity-60`,"aria-hidden":!0})})]}),(0,b.jsx)(xg,{children:(0,b.jsx)(Cg,{position:`popper`,sideOffset:4,className:`relative z-[60] max-h-[min(var(--radix-select-content-available-height),320px)] min-w-[var(--radix-select-trigger-width)] overflow-hidden rounded-control border border-border bg-card text-card-foreground shadow-[0_12px_32px_rgba(0,0,0,.14)] data-[state=open]:animate-in data-[state=open]:fade-in-0`,children:(0,b.jsx)(Fg,{className:`p-1`,children:r.map(e=>(0,b.jsxs)(Vg,{value:Mw(e.value),"data-value":e.value,lang:e.lang,className:`relative flex cursor-default select-none items-center gap-2 rounded-md py-1.5 ps-7 pe-2.5 text-[13px] outline-none data-[disabled]:opacity-50 data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground`,children:[(0,b.jsx)(`span`,{className:`absolute start-2 flex size-3.5 items-center justify-center`,children:(0,b.jsx)(Gg,{children:(0,b.jsx)(Jy,{className:`size-3.5`,"aria-hidden":!0})})}),(0,b.jsx)(Ug,{children:e.label})]},e.value))})})})]})}var Fw=[`auth.*`,`auth.login`,`auth.login_failed`,`auth.view_as`,`rbac.*`,`rbac.role.changed`,`rbac.user_roles.changed`,`page.*`],Iw=[`*`,`created`,`updated`,`deleted`,`restored`,`purged`,`action.*`];function Lw(){let{t:e,locale:t}=Y(),[n,r]=To(),i=vv(),a=_v(),o=a.data?.audit.view===!0,s=kC(n),c=mt({queryKey:[`audit`,s],initialPageParam:void 0,queryFn:({pageParam:e})=>Q.audit(s,e),getNextPageParam:e=>e.next,staleTime:0,enabled:o,retry:!1}),l=c.data?.pages.flatMap(e=>e.entries)??[],u=new Set((i.data?.groups??[]).flatMap(e=>e.resources.map(e=>e.name))),d=[...new Set(l.map(e=>e.resource).filter(e=>e!==void 0&&u.has(e)))].sort(),f=ut({queries:d.map(e=>({queryKey:[`schema`,e,t],queryFn:()=>Q.schema(e),retry:!1}))}),p=e=>f[d.indexOf(e)]?.data,m=new Set((i.data?.groups??[]).flatMap(e=>e.pages.map(e=>e.name))),h=[...new Set(l.map(e=>e.meta?.page).filter(e=>e!==void 0&&m.has(e)))].sort(),g=ut({queries:h.map(e=>({queryKey:[`page`,e,t],queryFn:()=>Q.page(e),retry:!1}))}),_=e=>g[h.indexOf(e)]?.data?.schema.fields,v=(e,t)=>r(n=>Sw(n,jC(e,t))),y=c.error instanceof R_&&(c.error.status===403||c.error.status===404);if(a.isPending)return(0,b.jsx)(W,{children:e(`common.loading`)});if(!o||y)return(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(ey,{children:e(`audit.title`)}),(0,b.jsx)(W,{tone:`error`,children:y?z_(c.error):e(a.data?.audit.enabled?`audit.notAllowed`:`audit.off`)})]});let x=(i.data?.groups??[]).flatMap(e=>e.resources),S=n.get(`resource`)??``;return(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(ey,{children:e(`audit.title`)}),(0,b.jsxs)(`fieldset`,{className:`grid gap-3 rounded-card border bg-card shadow-card p-3 sm:grid-cols-2 lg:grid-cols-3`,children:[(0,b.jsx)(`legend`,{className:`px-1 text-xs font-medium text-muted-foreground`,children:e(`filters.filters`)}),(0,b.jsx)(Rw,{label:e(`audit.filter.actor`),value:n.get(`actor`)??``,onCommit:e=>v(`actor`,e)}),(0,b.jsx)(Rw,{label:e(`audit.filter.event`),placeholder:e(`audit.filter.eventHint`),value:n.get(`event`)??``,onCommit:e=>v(`event`,e),hints:[...S?Iw.map(e=>`${S}.${e}`):[],...Fw]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`audit-resource`,children:e(`audit.filter.resource`)}),(0,b.jsx)(Pw,{id:`audit-resource`,value:S,onValueChange:e=>v(`resource`,e),options:[{value:``,label:e(`common.all`)},...S&&!x.some(e=>e.name===S)?[{value:S,label:S}]:[],...x.map(e=>({value:e.name,label:e.label}))]})]}),(0,b.jsx)(Rw,{label:e(`audit.filter.record`),placeholder:S?void 0:e(`audit.filter.recordHint`),value:S?n.get(`record`)??``:``,disabled:!S,onCommit:e=>v(`record`,e)}),[`from`,`to`].map(t=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`audit-${t}`,children:e(`filters.${t}`)}),(0,b.jsx)(fw,{id:`audit-${t}`,label:e(`filters.${t}`),value:n.get(t)??``,onChange:e=>v(t,e)})]},t)),AC(n)&&(0,b.jsx)(`div`,{className:`flex items-end sm:col-span-2 lg:col-span-3`,children:(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>r(e=>Sw(e,MC())),children:e(`filters.clear`)})})]}),c.isError&&(0,b.jsx)(ty,{children:z_(c.error)}),c.isPending?(0,b.jsx)(W,{children:e(`common.loading`)}):l.length===0?!c.isError&&(0,b.jsx)(W,{children:e(AC(n)?`audit.noMatches`:`audit.empty`)}):(0,b.jsx)(NC,{entries:l,now:new Date(c.dataUpdatedAt),names:uC(i.data,p),schemaOf:p,pageFieldsOf:_,onActor:e=>v(`actor`,e),showSubject:!0}),c.hasNextPage&&(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`self-center`,disabled:c.isFetchingNextPage,onClick:()=>void c.fetchNextPage(),children:e(c.isFetchingNextPage?`common.loading`:`list.loadMore`)})]})}function Rw({label:e,value:t,onCommit:n,placeholder:r,disabled:i,hints:a}){let o=(0,y.useId)(),[s,c]=(0,y.useState)(t);(0,y.useEffect)(()=>c(t),[t]);let l=()=>{s.trim()!==t&&n(s)};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:o,children:e}),(0,b.jsx)(e_,{id:o,type:`text`,dir:`auto`,value:s,placeholder:r,disabled:i,list:a?`${o}-hints`:void 0,autoComplete:`off`,spellCheck:!1,onChange:e=>c(e.target.value),onBlur:l,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),l())}}),a&&(0,b.jsx)(`datalist`,{id:`${o}-hints`,children:a.map(e=>(0,b.jsx)(`option`,{value:e},e))})]})}var zw={hidden:`rbac.rule.hidden`,view:`rbac.rule.readonly`,edit:`rbac.rule.edit`};function Bw(){let{t:e}=Y(),[t,n]=To(),r=t.get(`user`)??``,i=t.get(`resource`)??``,a=t.get(`record`)??``,o=ft({queryKey:[`rbac`,`catalog`],queryFn:Q.rbac.catalog}),s=ft({queryKey:[`rbac`,`user`,r],queryFn:()=>Q.rbac.user(r),enabled:r!==``}),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(i),[f,p]=(0,y.useState)(a),[m,h]=(0,y.useState)(r),g=ft({queryKey:[`rbac`,`users`,c,1],queryFn:()=>Q.rbac.users({search:c}),enabled:c.trim().length>0}),_=ft({queryKey:[`rbac`,`explain`,r,i,a],queryFn:()=>Q.rbac.explain({user:r,resource:i,record:a||void 0}),enabled:r!==``&&i!==``});function v(e){e.preventDefault();let t={};m&&(t.user=m),u&&(t.resource=u),f.trim()&&(t.record=f.trim()),n(t)}let x=m===r?s.data?.displayName:void 0;return(0,b.jsxs)(`div`,{className:`flex max-w-5xl flex-col gap-5`,children:[(0,b.jsx)(ey,{children:e(`debugger.title`)}),(0,b.jsx)(`p`,{className:`-mt-3 text-sm text-muted-foreground`,children:e(`debugger.intro`)}),(0,b.jsxs)(`form`,{onSubmit:v,className:`grid gap-4 rounded-card border bg-card shadow-card p-4 md:grid-cols-3`,"aria-label":e(`debugger.title`),children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`debug-user`,children:e(`debugger.user`)}),(0,b.jsx)(e_,{id:`debug-user`,placeholder:e(`rbac.searchUsers`),value:c,onChange:e=>l(e.target.value),autoComplete:`off`}),c.trim()&&(0,b.jsx)(`ul`,{"aria-label":e(`rbac.searchResults`),className:`flex flex-col rounded-md border text-sm`,children:(g.data?.items??[]).slice(0,6).map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`button`,{type:`button`,className:`w-full px-2 py-1.5 text-start hover:bg-accent`,onClick:()=>{h(e.id),l(``)},children:[e.displayName,e.username&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.username]})]})},e.id))}),m&&(0,b.jsx)(`p`,{className:`text-sm`,"data-testid":`debug-chosen-user`,children:x??m})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`debug-resource`,children:e(`debugger.resource`)}),(0,b.jsx)(Pw,{id:`debug-resource`,className:`h-9`,value:u,onValueChange:d,options:[{value:``,label:`—`},...(o.data?.resources??[]).map(e=>({value:e.name,label:e.label}))]})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`debug-record`,children:e(`debugger.record`)}),(0,b.jsx)(e_,{id:`debug-record`,dir:`ltr`,value:f,onChange:e=>p(e.target.value)})]}),(0,b.jsx)(`div`,{className:`md:col-span-3`,children:(0,b.jsx)(q,{type:`submit`,disabled:!m||!u,children:e(`debugger.explain`)})})]}),!r||!i?(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`debugger.pick`)}):_.isPending?(0,b.jsx)(W,{children:e(`common.loading`)}):_.isError?(0,b.jsx)(W,{tone:`error`,children:z_(_.error)}):(0,b.jsx)(Hw,{data:_.data})]})}function Vw({allowed:e}){let{t}=Y();return(0,b.jsx)(`span`,{className:U(`rounded-full px-2 py-0.5 text-xs font-medium`,e?`bg-green-500/15 text-green-800 dark:text-green-300`:`bg-destructive/10 text-destructive`),children:t(e?`debugger.allowed`:`debugger.denied`)})}function Hw({data:e}){let{t,locale:n}=Y(),r=e=>e.kind===`group`?t(`debugger.source.group`,{group:e.group??``}):t(`debugger.source.${e.kind}`),i=e=>e===`all`?t(`debugger.allRows`):e.length===0?t(`debugger.noRows`):t(`debugger.someRows`,{scopes:e.join(`, `)});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-5`,"data-testid":`explanation`,children:[(0,b.jsxs)(`section`,{"aria-labelledby":`debug-roles`,className:`flex flex-col gap-2`,children:[(0,b.jsxs)(`h2`,{id:`debug-roles`,className:`font-medium`,children:[t(`debugger.roles`),` · `,e.user.displayName]}),e.superuser?(0,b.jsx)(`p`,{className:`text-sm`,children:t(`debugger.superuser`)}):e.roles.length===0?(0,b.jsx)(`p`,{className:`text-sm`,children:t(`debugger.noRoles`)}):(0,b.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:e.roles.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`span`,{className:`font-medium`,children:Zv(e.label,n)||e.name}),` `,(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.sources.map(r).join(`, `),`)`]}),!e.known&&(0,b.jsx)(`span`,{className:`ms-2 text-destructive`,children:t(`debugger.unknownRole`)})]},e.name))})]}),(0,b.jsxs)(`section`,{"aria-labelledby":`debug-operations`,className:`flex flex-col gap-2`,children:[(0,b.jsxs)(`h2`,{id:`debug-operations`,className:`font-medium`,children:[t(`debugger.operations`),` · `,e.resource.label]}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsx)(`table`,{className:`w-full text-sm`,children:(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.operations.map(n=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{scope:`row`,className:`w-32 px-3 py-2 text-start font-medium`,children:t(`rbac.op.${n.operation}`)}),(0,b.jsx)(`td`,{className:`w-24 px-3 py-2`,children:(0,b.jsx)(Vw,{allowed:n.allowed})}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.superuser?``:n.grantedBy.length===0?t(`debugger.noGrant`):n.grantedBy.map(e=>t(e.via?`debugger.viaUpdate`:`debugger.grant`,{pattern:e.pattern,role:e.role})).join(` · `)})]},n.operation))})})})]}),e.actions.length>0&&(0,b.jsxs)(`section`,{"aria-labelledby":`debug-actions`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-actions`,className:`font-medium`,children:t(`debugger.actions`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsx)(`table`,{className:`w-full text-sm`,children:(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.actions.map(n=>(0,b.jsxs)(`tr`,{"data-action":n.name,children:[(0,b.jsx)(`th`,{scope:`row`,className:`w-32 px-3 py-2 text-start font-medium`,children:n.label}),(0,b.jsx)(`td`,{className:`w-24 px-3 py-2`,children:(0,b.jsx)(Vw,{allowed:n.allowed})}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.superuser?``:[n.grantedBy.length===0?t(`debugger.noGrant`):n.grantedBy.map(e=>t(`debugger.grant`,{pattern:e.pattern,role:e.role})).join(` · `),...n.needsUpdate?[t(`debugger.needsUpdate`)]:[]].join(` — `)})]},n.name))})})})]}),(0,b.jsxs)(`section`,{"aria-labelledby":`debug-fields`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-fields`,className:`font-medium`,children:t(`debugger.fields`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{className:`bg-muted/40 text-xs text-muted-foreground`,children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.field`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.result`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.byRole`)})]})}),(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.fields.map(e=>(0,b.jsxs)(`tr`,{"data-field":e.name,children:[(0,b.jsxs)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-medium`,children:[e.label,e.restricted&&(0,b.jsx)(`span`,{className:`ms-2 rounded-full border px-1.5 text-xs font-normal text-muted-foreground`,children:t(`rbac.restricted`)})]}),(0,b.jsxs)(`td`,{className:`px-3 py-2`,children:[t(zw[e.level]),e.forced&&(0,b.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:t(`debugger.forced`)})]}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.byRole.map(e=>`${e.role}: ${t(zw[e.level])}${e.rule?` (${e.rule})`:``}${e.code?` (${e.code})`:``}`).join(` · `)})]},e.name))})]})})]}),(0,b.jsxs)(`section`,{"aria-labelledby":`debug-scopes`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-scopes`,className:`font-medium`,children:t(`debugger.scopes`)}),(0,b.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:e.scopes.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`span`,{className:`font-medium`,children:[t(`rbac.op.${e.operation}`),`:`]}),` `,i(e.result),e.byRole.length>0&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[` (`,e.byRole.map(e=>`${e.role}: ${i(e.scopes)}`).join(` · `),`)`]}),e.global.length>0&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,t(`debugger.globalScopes`,{scopes:e.global.join(`, `)})]})]},e.operation))})]}),e.record&&(0,b.jsxs)(`section`,{"aria-labelledby":`debug-record-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-record-title`,className:`font-medium`,children:t(`debugger.recordTitle`,{id:e.record.id})}),(0,b.jsxs)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:[[`view`,`update`,`delete`].map(n=>(0,b.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,"data-operation":n,children:[(0,b.jsx)(`span`,{className:`w-24 font-medium`,children:t(`rbac.op.${n}`)}),(0,b.jsx)(Vw,{allowed:e.record[n]}),e.record.reasons[n]&&(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:t(`debugger.reason.${e.record.reasons[n]}`)})]},n)),e.record.actions&&(0,b.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,"data-operation":`actions`,children:[(0,b.jsx)(`span`,{className:`w-24 font-medium`,children:t(`debugger.actions`)}),(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e.record.actions.length===0?t(`debugger.noRecordActions`):e.record.actions.map(t=>e.actions.find(e=>e.name===t)?.label??t).join(`, `)})]})]})]}),e.pages.length>0&&(0,b.jsxs)(`section`,{"aria-labelledby":`debug-pages`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-pages`,className:`font-medium`,children:t(`debugger.pages`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{className:`bg-muted/40 text-xs text-muted-foreground`,children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`rbac.page`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`rbac.op.view`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`rbac.op.update`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.byRole`)})]})}),(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.pages.map(n=>(0,b.jsxs)(`tr`,{"data-page":n.name,children:[(0,b.jsx)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-medium`,children:n.label}),(0,b.jsx)(`td`,{className:`px-3 py-2`,"data-operation":`view`,children:(0,b.jsx)(Vw,{allowed:n.view})}),(0,b.jsx)(`td`,{className:`px-3 py-2`,"data-operation":`update`,children:(0,b.jsx)(Vw,{allowed:n.update})}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.superuser?``:n.grantedBy.length===0?t(`debugger.noGrant`):n.grantedBy.map(e=>`${t(`debugger.grant`,{pattern:e.pattern,role:e.role})} (${e.code})`).join(` · `)})]},n.name))})]})})]})]})}function Uw(){let{t:e,locale:t}=Y(),n=_v(),r=ft({queryKey:[`rbac`,`groups`],queryFn:Q.rbac.groups});return r.isPending?(0,b.jsx)(W,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(W,{tone:`error`,children:z_(r.error)}):(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(ey,{actions:n.data?.rbac.manage&&(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(xo,{to:`/-/groups/new`,children:[(0,b.jsx)(Hx,{}),e(`rbac.newGroup`)]})}),children:e(`rbac.groups`)}),r.data.items.length===0&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`rbac.noGroups`)}),(0,b.jsx)(`ul`,{"aria-label":e(`rbac.groups`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card empty:hidden`,children:r.data.items.map(n=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(xo,{to:`/-/groups/${n.id}`,className:`flex flex-wrap items-center justify-between gap-2 px-4 py-3 hover:bg-muted/50`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:Zv(n.label,t)||n.name}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`rbac.groupSummary`,{roles:n.roles.length,members:n.members.length})})]})},n.id))})]})}function Ww(){let{t:e}=Y(),{id:t}=$i(),n=t===void 0,r=ft({queryKey:[`rbac`,`roles`],queryFn:Q.rbac.roles}),i=ft({queryKey:[`rbac`,`group`,t],queryFn:()=>Q.rbac.group(Number(t)),enabled:!n});return r.isPending||!n&&i.isPending?(0,b.jsx)(W,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(W,{tone:`error`,children:z_(r.error)}):!n&&i.isError?(0,b.jsx)(W,{tone:`error`,children:z_(i.error)}):(0,b.jsx)(Gw,{roles:r.data.items,group:n?void 0:i.data},t??`new`)}function Gw({roles:e,group:t}){let{t:n,locale:r}=Y(),i=Yi(),a=S(),o=_v().data?.rbac.manage!==!0,[s,c]=(0,y.useState)(t?.name??``),[l,u]=(0,y.useState)($v(t?.label)),[d,f]=(0,y.useState)(t?.roles??[]),[p,m]=(0,y.useState)(t?.members??[]),[h,g]=(0,y.useState)(``),_=ft({queryKey:[`rbac`,`users`,h],queryFn:()=>Q.rbac.users({search:h}),enabled:h.trim().length>0}),v=ft({queryKey:[`rbac`,`users`,``,1],queryFn:()=>Q.rbac.users({})}),[x,C]=(0,y.useState)({}),w=e=>x[e]??v.data?.items.find(t=>t.id===e)?.displayName??e,[T,E]=(0,y.useState)(null),D=pt({mutationFn:()=>Q.rbac.saveGroup({name:s.trim(),label:Qv(l)??null,roles:d,members:p},t?.id),onSuccess:async e=>{await a.invalidateQueries({queryKey:[`rbac`]}),await a.invalidateQueries({queryKey:[`session`]}),i(`/-/groups/${e.id}`,{replace:!0}),E(null)},onError:e=>E(z_(e))}),O=pt({mutationFn:()=>Q.rbac.deleteGroup(t.id),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`rbac`]}),i(`/-/groups`)},onError:e=>E(z_(e))});function k(e){e.preventDefault(),o||D.mutate()}return(0,b.jsxs)(`form`,{onSubmit:k,className:`flex max-w-3xl flex-col gap-5`,"aria-label":n(`rbac.group`),children:[(0,b.jsx)(ey,{children:t?Zv(t.label,r)||t.name:n(`rbac.newGroup`)}),T&&(0,b.jsx)(ty,{children:T}),(0,b.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`group-name`,children:n(`rbac.name`)}),(0,b.jsx)(e_,{id:`group-name`,dir:`ltr`,value:s,disabled:o,onChange:e=>c(e.target.value)})]}),L_.locales.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`group-label-${e}`,children:n(`rbac.labelIn`,{language:e})}),(0,b.jsx)(e_,{id:`group-label-${e}`,value:l[e]??``,disabled:o,onChange:t=>u({...l,[e]:t.target.value})})]},e))]}),(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:n(`rbac.roles`)}),e.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:d.includes(e.name),disabled:o,onChange:t=>f(t.target.checked?[...d,e.name]:d.filter(t=>t!==e.name))}),Zv(e.label,r)||e.name]},e.name))]}),(0,b.jsxs)(`section`,{"aria-labelledby":`members-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`members-title`,className:`font-medium`,children:n(`rbac.members`)}),(0,b.jsxs)(`ul`,{"aria-label":n(`rbac.members`),className:`flex flex-wrap gap-2`,children:[p.map(e=>(0,b.jsxs)(`li`,{className:`flex items-center gap-1 rounded-full border px-2 py-0.5 text-sm`,children:[w(e),!o&&(0,b.jsx)(`button`,{type:`button`,"aria-label":n(`picker.remove`,{name:w(e)}),onClick:()=>m(p.filter(t=>t!==e)),children:(0,b.jsx)(XS,{className:`size-3.5`})})]},e)),p.length===0&&(0,b.jsx)(`li`,{className:`text-sm text-muted-foreground`,children:n(`rbac.noMembers`)})]}),!o&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`member-search`,children:n(`rbac.addMember`)}),(0,b.jsx)(e_,{id:`member-search`,value:h,placeholder:n(`rbac.searchUsers`),onChange:e=>g(e.target.value)}),(0,b.jsx)(`ul`,{"aria-label":n(`rbac.searchResults`),className:`flex flex-wrap gap-2`,children:(_.data?.items??[]).filter(e=>!p.includes(e.id)).map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{C({...x,[e.id]:e.displayName}),m([...p,e.id])},children:[(0,b.jsx)(Hx,{}),e.displayName,e.username?` (${e.username})`:``]})},e.id))})]})]}),!o&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`submit`,disabled:D.isPending||!s.trim(),children:n(D.isPending?`form.saving`:`form.save`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>i(`/-/groups`),children:n(`common.cancel`)}),t&&(0,b.jsx)(q,{type:`button`,variant:`outline`,className:`ms-auto`,disabled:O.isPending,onClick:()=>O.mutate(),children:n(`form.delete`)})]})]})}var Kw=[`view`,`create`,`update`,`delete`,`purge`,`field`,`action`];function qw(e,t){let n=e.split(`.`),r=t.split(`.`),i=r[0]===`page`&&!Kw.includes(r[1]??``)&&(r.length===2||r.length===3&&r[2]===`update`);if(n[0]===`*`&&n.length>1&&i)return!1;for(let e=0;e<n.length;e++){let t=n[e];if(t===`*`&&e===n.length-1)return r.length>e;if(e>=r.length||t!==`*`&&t!==r[e])return!1}return n.length===r.length}function Jw(e){let t=[...e.global];for(let n of e.resources){for(let r of e.operations)t.push(`${n.name}.${r}`);for(let e of n.custom)t.push(`${n.name}.${e}`);for(let e of n.actions)t.push(`${n.name}.action.${e.name}`)}for(let n of e.pages)t.push(`page.${n.name}`,`page.${n.name}.update`);return t}function Yw(e,t){return e.some(e=>qw(e,t))}function Xw(e,t,n,r){if(n)return Yw(e,t)?e:[...e,t];let i=[];for(let n of e)if(n!==t){if(n.includes(`*`)&&qw(n,t)){for(let e of r)e!==t&&qw(n,e)&&!i.includes(e)&&i.push(e);continue}i.push(n)}return i.filter(e=>e===t||!qw(e,t))}var Zw=[`view`,`update`,`delete`];function Qw(){let{t:e}=Y(),{name:t}=$i(),n=t===void 0,r=ft({queryKey:[`rbac`,`catalog`],queryFn:Q.rbac.catalog}),i=ft({queryKey:[`rbac`,`role`,t],queryFn:()=>Q.rbac.role(t),enabled:!n});return r.isPending||!n&&i.isPending?(0,b.jsx)(W,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(W,{tone:`error`,children:z_(r.error)}):!n&&i.isError?(0,b.jsx)(W,{tone:`error`,children:z_(i.error)}):(0,b.jsx)($w,{catalog:r.data,role:n?void 0:i.data},t??`new`)}function $w({catalog:e,role:t}){let{t:n,locale:r}=Y(),i=Yi(),a=S(),o=_v(),s=t?.system===!0||o.data?.rbac.manage!==!0,c=Jw(e),[l,u]=(0,y.useState)(t?.name??``),[d,f]=(0,y.useState)($v(t?.label)),[p,m]=(0,y.useState)(t?.permissions??[]),[h,g]=(0,y.useState)(t?.fields??{}),[_,v]=(0,y.useState)(t?.scopes??{}),[x,C]=(0,y.useState)(null),[w,T]=(0,y.useState)(null),E=pt({mutationFn:()=>{let e={label:Qv(d),permissions:p,fields:eT(h),scopes:eT(_)};return t?Q.rbac.updateRole(t.name,e):Q.rbac.createRole({name:l.trim(),...e})},onSuccess:async e=>{await a.invalidateQueries({queryKey:[`rbac`]}),await a.invalidateQueries({queryKey:[`session`]}),i(`/-/roles/${encodeURIComponent(e.name)}`,{replace:!0}),T(null)},onError:e=>T(e instanceof R_?[e.message,...Object.values(e.fields).flat()].join(` — `):z_(e))}),D=pt({mutationFn:()=>Q.rbac.deleteRole(t.name),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`rbac`]}),i(`/-/roles`)},onError:e=>T(z_(e))}),O=(e,t)=>m(n=>Xw(n,e,t,c)),k=(e,t,n)=>g(r=>{let i={...r,[e]:{...r[e]}};return n===``?delete i[e][t]:i[e][t]=n,i}),A=(e,t,n,r)=>v(i=>{let a=i[e]?.[t],o=new Set(Array.isArray(a)?a:a?[a]:[]);return r?o.add(n):o.delete(n),{...i,[e]:{...i[e],[t]:[...o]}}});function j(e){e.preventDefault(),s||E.mutate()}let M=[...new Set(e.resources.map(e=>e.group))];return(0,b.jsxs)(`form`,{onSubmit:j,className:`flex max-w-5xl flex-col gap-5`,"aria-label":n(`rbac.role`),children:[(0,b.jsx)(ey,{children:t?Zv(t.label,r)||t.name:n(`rbac.newRole`)}),t?.system&&(0,b.jsx)(ty,{tone:`success`,children:n(`rbac.systemNote`)}),w&&(0,b.jsx)(ty,{children:w}),(0,b.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`role-name`,children:n(`rbac.name`)}),(0,b.jsx)(e_,{id:`role-name`,dir:`ltr`,value:l,disabled:!!t,onChange:e=>u(e.target.value)})]}),L_.locales.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`role-label-${e}`,children:n(`rbac.labelIn`,{language:e})}),(0,b.jsx)(e_,{id:`role-label-${e}`,value:d[e]??``,disabled:s,onChange:t=>f({...d,[e]:t.target.value})})]},e))]}),(0,b.jsxs)(`section`,{"aria-labelledby":`matrix-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`matrix-title`,className:`font-medium`,children:n(`rbac.matrix`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b bg-muted/40`,children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:n(`rbac.resource`)}),e.operations.map(e=>(0,b.jsx)(`th`,{className:`px-2 py-2 text-center font-medium`,children:n(`rbac.op.${e}`)},e)),(0,b.jsx)(`th`,{className:`w-0`})]})}),(0,b.jsx)(`tbody`,{children:M.map(t=>(0,b.jsx)(y.Fragment,{children:e.resources.filter(e=>e.group===t).map(t=>{let r=x===t.name,i=`role-details-${t.name}`;return(0,b.jsxs)(y.Fragment,{children:[(0,b.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,b.jsx)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-normal`,children:t.label}),e.operations.map(e=>{let r=`${t.name}.${e}`;return(0,b.jsx)(`td`,{className:`px-2 py-2 text-center`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":n(`rbac.grant`,{operation:n(`rbac.op.${e}`),resource:t.label}),checked:Yw(p,r),disabled:s,onChange:e=>O(r,e.target.checked)})},e)}),(0,b.jsx)(`td`,{className:`px-2`,children:(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-expanded":r,"aria-controls":i,"aria-label":n(`rbac.details`,{resource:t.label}),onClick:()=>C(r?null:t.name),children:(0,b.jsx)(Xy,{className:U(`transition-transform`,r&&`rotate-180`)})})})]}),r&&(0,b.jsx)(`tr`,{id:i,className:`border-b bg-muted/20`,children:(0,b.jsx)(`td`,{colSpan:e.operations.length+2,className:`px-3 py-3`,children:(0,b.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.fields`)}),t.fields.map(e=>(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsxs)(`span`,{children:[e.label,e.restricted&&(0,b.jsx)(`span`,{className:`ms-2 rounded-full bg-amber-500/15 px-2 py-0.5 text-xs text-amber-800 dark:text-amber-300`,children:n(`rbac.restricted`)})]}),(0,b.jsx)(Pw,{className:`w-auto min-w-36`,value:h[t.name]?.[e.name]??``,disabled:s,"aria-label":n(`rbac.fieldRule`,{field:e.label}),onValueChange:n=>k(t.name,e.name,n),options:[{value:``,label:n(e.restricted?`rbac.rule.defaultHidden`:`rbac.rule.default`)},{value:`hidden`,label:n(`rbac.rule.hidden`)},{value:`readonly`,label:n(`rbac.rule.readonly`)},{value:`edit`,label:n(`rbac.rule.edit`)}]})]},e.name))]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t.scopes.length>0&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.scopes`)}),Zw.map(e=>{let r=_[t.name]?.[e],i=Array.isArray(r)?r:r?[r]:[];return(0,b.jsxs)(`fieldset`,{className:`flex flex-wrap items-center gap-3`,children:[(0,b.jsxs)(`legend`,{className:`me-2 text-sm`,children:[n(`rbac.op.${e}`),`:`]}),t.scopes.map(n=>(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:i.includes(n),disabled:s,onChange:r=>A(t.name,e,n,r.target.checked)}),n]},n)),i.length===0&&(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`rbac.allRows`)})]},e)})]}),t.actions.length>0&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,"data-actions":t.name,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.actions`)}),t.actions.map(e=>{let n=`${t.name}.action.${e.name}`;return(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:Yw(p,n),disabled:s,onChange:e=>O(n,e.target.checked)}),e.label,(0,b.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:n})]},e.name)}),t.actions.some(e=>e.target===`record`)&&(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`rbac.actionNote`)})]}),t.custom.length>0&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.custom`)}),t.custom.map(e=>{let n=`${t.name}.${e}`;return(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:Yw(p,n),disabled:s,onChange:e=>O(n,e.target.checked)}),(0,b.jsx)(`code`,{className:`text-xs`,children:n})]},e)})]})]})]})})})]},t.name)})},t))})]})})]}),e.pages.length>0&&(0,b.jsxs)(`section`,{"aria-labelledby":`pages-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`pages-title`,className:`font-medium`,children:n(`rbac.pages`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b bg-muted/40`,children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:n(`rbac.page`)}),(0,b.jsx)(`th`,{className:`px-2 py-2 text-center font-medium`,children:n(`rbac.op.view`)}),(0,b.jsx)(`th`,{className:`px-2 py-2 text-center font-medium`,children:n(`rbac.op.update`)})]})}),(0,b.jsx)(`tbody`,{children:e.pages.map(e=>{let t=`page.${e.name}`,r=`${t}.update`,i=Yw(p,r)&&!Yw(p,t);return(0,b.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,b.jsx)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-normal`,children:e.label}),(0,b.jsx)(`td`,{className:`px-2 py-2 text-center`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":n(`rbac.grant`,{operation:n(`rbac.op.view`),resource:e.label}),title:i?n(`rbac.viewImplied`):void 0,checked:i||Yw(p,t),disabled:s||i,onChange:e=>O(t,e.target.checked)})}),(0,b.jsx)(`td`,{className:`px-2 py-2 text-center`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":n(`rbac.grant`,{operation:n(`rbac.op.update`),resource:e.label}),checked:Yw(p,r),disabled:s,onChange:e=>O(r,e.target.checked)})})]},e.name)})})]})})]}),e.global.length>0&&(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:n(`rbac.global`)}),e.global.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:Yw(p,e),disabled:s,onChange:t=>O(e,t.target.checked)}),(0,b.jsx)(`code`,{className:`text-xs`,children:e})]},e))]}),!s&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`submit`,disabled:E.isPending||!t&&!l.trim(),children:n(E.isPending?`form.saving`:`form.save`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>i(`/-/roles`),children:n(`common.cancel`)}),t&&(0,b.jsx)(q,{type:`button`,variant:`outline`,className:`ms-auto`,disabled:D.isPending,onClick:()=>D.mutate(),children:n(`form.delete`)})]})]})}function eT(e){let t=Object.entries(e).map(([e,t])=>[e,Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0&&!(Array.isArray(e)&&e.length===0)))]).filter(([,e])=>Object.keys(e).length>0);return t.length>0?Object.fromEntries(t):void 0}function tT(){let{t:e,locale:t}=Y(),n=_v(),r=S(),i=ft({queryKey:[`rbac`,`roles`],queryFn:Q.rbac.roles}),a=(0,y.useRef)(null),[o,s]=(0,y.useState)(null),c=n.data?.rbac.manage===!0,l=pt({mutationFn:async e=>Q.rbac.importRoles(JSON.parse(await e.text())),onSuccess:async t=>{s(e(`rbac.imported`,{count:t.imported.length})),await r.invalidateQueries({queryKey:[`rbac`]})}});async function u(){let e=await Q.rbac.exportRoles(),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`roles.json`,n.click(),URL.revokeObjectURL(t)}return i.isPending?(0,b.jsx)(W,{children:e(`common.loading`)}):i.isError?(0,b.jsx)(W,{tone:`error`,children:z_(i.error)}):(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(ey,{actions:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(q,{variant:`outline`,onClick:()=>void u(),children:[(0,b.jsx)(vb,{}),e(`rbac.export`)]}),c&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`input`,{ref:a,type:`file`,accept:`application/json,.json`,className:`hidden`,"aria-label":e(`rbac.importFile`),onChange:e=>{let t=e.target.files?.[0];t&&l.mutate(t),e.target.value=``}}),(0,b.jsxs)(q,{variant:`outline`,onClick:()=>a.current?.click(),children:[(0,b.jsx)(IS,{}),e(`rbac.import`)]}),(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(xo,{to:`/-/roles/new`,children:[(0,b.jsx)(Hx,{}),e(`rbac.newRole`)]})})]})]}),children:e(`rbac.roles`)}),o&&(0,b.jsx)(ty,{tone:`success`,children:o}),l.isError&&(0,b.jsx)(ty,{children:l.error instanceof SyntaxError?e(`rbac.notJson`):z_(l.error)}),(0,b.jsx)(`ul`,{"aria-label":e(`rbac.roles`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card`,children:i.data.items.map(n=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(xo,{to:`/-/roles/${encodeURIComponent(n.name)}`,className:`flex flex-wrap items-center justify-between gap-2 px-4 py-3 hover:bg-muted/50`,children:[(0,b.jsxs)(`span`,{className:`flex flex-col`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:Zv(n.label,t)||n.name}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.name})]}),(0,b.jsxs)(`span`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e(`rbac.permissionCount`,{count:n.permissions.length}),n.system&&(0,b.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5`,children:e(`rbac.system`)})]})]})},n.name))})]})}function nT(){let{t:e}=Y(),t=_v(),[n,r]=To(),i=n.get(`search`)??``,a=Math.max(1,Number(n.get(`page`))||1),[o,s]=(0,y.useState)(i),c=ft({queryKey:[`rbac`,`users`,i,a],queryFn:()=>Q.rbac.users({search:i,page:a})});if(c.isPending)return(0,b.jsx)(W,{children:e(`common.loading`)});if(c.isError)return(0,b.jsx)(W,{tone:`error`,children:z_(c.error)});let{items:l,total:u,pageSize:d,capabilities:f}=c.data;return(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(ey,{actions:t.data?.rbac.manage&&f.create&&(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(xo,{to:`/-/users/new`,children:[(0,b.jsx)(Hx,{}),e(`rbac.newUser`)]})}),children:e(`rbac.users`)}),!f.list&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`rbac.usersFromMemberships`)}),(0,b.jsxs)(`form`,{role:`search`,className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),r(o.trim()?{search:o.trim()}:{})},children:[(0,b.jsx)(e_,{"aria-label":e(`rbac.searchUsers`),placeholder:e(`rbac.searchUsers`),value:o,onChange:e=>s(e.target.value)}),(0,b.jsx)(q,{type:`submit`,variant:`outline`,children:e(`filters.search`)})]}),(0,b.jsxs)(`ul`,{"aria-label":e(`rbac.users`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card`,children:[l.map(t=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(xo,{to:`/-/users/${encodeURIComponent(t.id)}`,className:`flex flex-wrap items-center justify-between gap-2 px-4 py-3 hover:bg-muted/50`,children:[(0,b.jsxs)(`span`,{className:`flex flex-col`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:t.displayName}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:[t.username,t.email].filter(Boolean).join(` · `)})]}),(0,b.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-xs`,children:[t.isSuperuser&&(0,b.jsx)(`span`,{className:`rounded-full bg-purple-500/15 px-2 py-0.5 text-purple-800 dark:text-purple-300`,children:e(`rbac.superuser`)}),t.isActive===!1&&(0,b.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-muted-foreground`,children:e(`rbac.inactive`)}),t.twoFactor&&(0,b.jsx)(`span`,{className:`rounded-full bg-green-500/15 px-2 py-0.5 text-green-800 dark:text-green-300`,children:e(`rbac.twoFactor`)}),t.roles.map(e=>(0,b.jsx)(`span`,{className:`rounded-full border px-2 py-0.5`,children:e},e))]})]})},t.id)),l.length===0&&(0,b.jsx)(`li`,{className:`px-4 py-3 text-sm text-muted-foreground`,children:e(`list.noMatches`)})]}),u>d&&(0,b.jsxs)(`div`,{className:`flex items-center justify-end gap-2 text-sm`,children:[(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:a<=1,onClick:()=>r({...i?{search:i}:{},page:String(a-1)}),children:e(`list.previousPage`)}),(0,b.jsx)(`span`,{children:e(`list.pageOf`,{page:a,pages:Math.ceil(u/d)})}),(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:a*d>=u,onClick:()=>r({...i?{search:i}:{},page:String(a+1)}),children:e(`list.nextPage`)})]})]})}function rT(){let{t:e}=Y(),{id:t}=$i(),n=t===void 0,r=ft({queryKey:[`rbac`,`roles`],queryFn:Q.rbac.roles}),i=ft({queryKey:[`rbac`,`groups`],queryFn:Q.rbac.groups}),a=ft({queryKey:[`rbac`,`user`,t],queryFn:()=>Q.rbac.user(t),enabled:!n}),o=ft({queryKey:[`rbac`,`users`,``,1],queryFn:()=>Q.rbac.users({})});if(r.isPending||i.isPending||o.isPending||!n&&a.isPending)return(0,b.jsx)(W,{children:e(`common.loading`)});let s=r.error??i.error??o.error??(n?null:a.error);return s?(0,b.jsx)(W,{tone:`error`,children:z_(s)}):(0,b.jsx)(iT,{user:n?void 0:a.data,roles:r.data.items,groups:i.data.items,capabilities:o.data.capabilities},t??`new`)}function iT({user:e,roles:t,groups:n,capabilities:r}){let{t:i,locale:a}=Y(),o=Yi(),s=S(),c=_v(),l=c.data?.rbac.manage===!0,u=c.data?.user.isSuperuser===!0,[d,f]=(0,y.useState)(``),[p,m]=(0,y.useState)(e?.displayName??``),[h,g]=(0,y.useState)(e?.email??``),[_,v]=(0,y.useState)(e?.isActive!==!1),[x,C]=(0,y.useState)(e?.isSuperuser===!0),[w,T]=(0,y.useState)(e?.roles??[]),[E,D]=(0,y.useState)(e?.groups??[]),[O,k]=(0,y.useState)(``),[A,j]=(0,y.useState)({}),[M,N]=(0,y.useState)(null),[ee,P]=(0,y.useState)(null),F=l&&(!e?.isSuperuser||u),te=e=>{e instanceof R_&&Object.keys(e.fields).length>0?(j(e.fields),N(e.message)):(j({}),N(z_(e)))},ne=pt({mutationFn:()=>{let t=r.update||!e?{displayName:p,email:h||null,isActive:_,...u?{isSuperuser:x}:{}}:{};return e?Q.rbac.updateUser(e.id,{...t,roles:w,groups:E}):Q.rbac.createUser({username:d,displayName:p,email:h||null,password:O,...u?{isSuperuser:x}:{},roles:w,groups:E})},onSuccess:async e=>{await s.invalidateQueries({queryKey:[`rbac`]}),j({}),N(null),P(i(`rbac.saved`)),o(`/-/users/${encodeURIComponent(e.id)}`,{replace:!0})},onError:te}),re=pt({mutationFn:()=>Q.rbac.resetTwoFactor(e.id),onSuccess:async()=>{await s.invalidateQueries({queryKey:[`rbac`]}),N(null),P(i(`rbac.twoFactorReset`))},onError:te}),ie=!!e&&u&&!c.data?.viewAs&&e.id!==c.data?.user.id&&e.isActive!==!1,ae=pt({mutationFn:()=>Q.rbac.setPassword(e.id,O),onSuccess:()=>{k(``),j({}),N(null),P(i(`rbac.passwordSet`))},onError:te});function oe(e){e.preventDefault(),P(null),F&&ne.mutate()}let se=(t,n,i,a,o={})=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:t,children:n}),(0,b.jsx)(e_,{id:t,value:i,disabled:!F||!!e&&!r.update,onChange:e=>a(e.target.value),"aria-invalid":A[t.replace(`user-`,``)]?!0:void 0,...o}),A[t.replace(`user-`,``)]&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:A[t.replace(`user-`,``)].join(` `)})]});return(0,b.jsxs)(`form`,{onSubmit:oe,className:`flex max-w-3xl flex-col gap-5`,"aria-label":i(`rbac.user`),children:[(0,b.jsx)(ey,{actions:ie&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,onClick:()=>{X_(e.id),s.clear(),o(`/`)},children:[(0,b.jsx)(Eb,{}),i(`viewAs.start`)]}),children:e?e.displayName:i(`rbac.newUser`)}),M&&(0,b.jsx)(ty,{children:M}),ee&&(0,b.jsx)(ty,{tone:`success`,children:ee}),e?.isSuperuser&&!u&&(0,b.jsx)(ty,{tone:`success`,children:i(`rbac.superuserNote`)}),(0,b.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[!e&&se(`user-username`,i(`auth.username`),d,f,{dir:`ltr`,autoComplete:`off`}),se(`user-displayName`,i(`rbac.displayName`),p,m),se(`user-email`,i(`rbac.email`),h,g,{type:`email`,dir:`ltr`}),!e&&se(`user-password`,i(`auth.password`),O,k,{type:`password`,autoComplete:`new-password`})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-6 text-sm`,children:[(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:_,disabled:!F||!!e&&!r.update,onChange:e=>v(e.target.checked)}),i(`rbac.active`)]}),u&&(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:x,disabled:!F,onChange:e=>C(e.target.checked)}),i(`rbac.superuser`)]})]}),(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:i(`rbac.roles`)}),t.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:w.includes(e.name),disabled:!F,onChange:t=>T(t.target.checked?[...w,e.name]:w.filter(t=>t!==e.name))}),Zv(e.label,a)||e.name]},e.name))]}),n.length>0&&(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:i(`rbac.groups`)}),n.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:E.includes(e.id),disabled:!F,onChange:t=>D(t.target.checked?[...E,e.id]:E.filter(t=>t!==e.id))}),Zv(e.label,a)||e.name]},e.id))]}),F&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`submit`,disabled:ne.isPending,children:i(ne.isPending?`form.saving`:e?`form.save`:`rbac.createUser`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>o(`/-/users`),children:i(`common.cancel`)})]}),e&&F&&r.password&&(0,b.jsxs)(`section`,{"aria-labelledby":`set-password`,className:`flex flex-col gap-2 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsx)(`h2`,{id:`set-password`,className:`font-medium`,children:i(`rbac.setPassword`)}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`user-new-password`,children:i(`auth.newPassword`)}),(0,b.jsx)(e_,{id:`user-new-password`,type:`password`,autoComplete:`new-password`,value:O,onChange:e=>k(e.target.value)})]}),(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:!O||ae.isPending,onClick:()=>ae.mutate(),children:i(`rbac.setPassword`)})]}),A.password&&e&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:A.password.join(` `)}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`rbac.setPasswordNote`)})]}),e?.twoFactor&&F&&r.resetTwoFactor&&(0,b.jsxs)(`section`,{"aria-labelledby":`reset-two-factor`,className:`flex flex-col gap-2 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsx)(`h2`,{id:`reset-two-factor`,className:`font-medium`,children:i(`rbac.resetTwoFactor`)}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`rbac.resetTwoFactorNote`)}),(0,b.jsx)(`div`,{children:(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:re.isPending,onClick:()=>re.mutate(),children:i(`rbac.resetTwoFactor`)})})]})]})}var aT=`fixed inset-0 z-40 bg-black/40 backdrop-blur-sm dark:bg-black/60 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150`;function oT(e){if(!e.menu)return e.groups.map(e=>({...e,items:[...e.resources.map(e=>({kind:`resource`,name:e.name,label:e.label,...e.icon?{icon:e.icon}:{}})),...e.pages.map(e=>({kind:`page`,name:e.name,label:e.label,...e.icon?{icon:e.icon}:{}}))]}));let{sections:t,advanced:n}=e.menu;return[...t,...n.items.length>0?[n]:[]].map(e=>{let t=[],r=[],i=e.items.map(n=>n.kind===`resource`?(t.push({name:n.resource,label:n.label,...n.icon?{icon:n.icon}:{},creatable:n.creatable,searchable:n.searchable}),{kind:`resource`,name:n.resource,label:n.label,...n.icon?{icon:n.icon}:{},...n.badge?{badge:`${e.key}.${n.resource}`}:{}}):n.kind===`page`?(r.push({name:n.page,label:n.label,...n.icon?{icon:n.icon}:{}}),{kind:`page`,name:n.page,label:n.label,...n.icon?{icon:n.icon}:{}}):n);return{key:e.key,label:e.label,...e.icon?{icon:e.icon}:{},resources:t,pages:r,items:i,...e===n?{advanced:!0}:{}}})}function sT(e,t){let n=e.flatMap(e=>e.kind===`resource`&&e.badge&&t?.[e.badge]?[t[e.badge]]:[]);if(n.length!==0)return{count:n.reduce((e,t)=>e+t.count,0),estimate:n.some(e=>e.estimate)}}function cT({menu:e,current:t}){return e&&!t}function lT(e){return i_(e).toLocaleLowerCase().replace(/[يى]/g,`ی`).replace(/ك/g,`ک`).replace(//g,` `)}function uT(e,t){let n=lT(e);return lT(t).split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function dT(e,t,n,r=[]){let i=[],a=[],o=oT(e),s=t.trim()!==``;for(let r of o){o.length>1&&uT(r.label,t)&&i.push({id:`group:${r.key}`,section:`go`,label:r.label,to:`/g/${r.key}`,...r.icon?{icon:r.icon}:{}});for(let o of r.resources){let c=o.icon??r.icon;uT(`${o.label} ${r.label}`,t)&&i.push({id:`go:${o.name}`,section:`go`,label:o.label,detail:r.label,to:`/${o.name}`,...c?{icon:c}:{}});let l=n(o.label),u=s||e.menu!==void 0&&!r.advanced&&a.length<3;o.creatable&&u&&uT(l,t)&&a.push({id:`new:${o.name}`,section:`actions`,label:l,to:`/${o.name}/new`})}for(let e of r.pages){let n=e.icon??r.icon;uT(`${e.label} ${r.label}`,t)&&i.push({id:`page:${e.name}`,section:`go`,label:e.label,detail:r.label,to:`/p/${e.name}`,...n?{icon:n}:{}})}}let c=r.filter(e=>uT(e.label,t)).map(e=>({id:e.id,section:`actions`,label:e.label}));return[...i,...a,...c]}var fT=`nma.theme`,pT=`oklch(0.145 0 0)`,mT=`oklch(0.985 0 0)`;function hT(){try{let e=localStorage.getItem(fT);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}function gT(e,t){return e===`system`?t?`dark`:`light`:e}var _T=()=>typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches;function vT(e){let t=gT(e,_T());document.documentElement.classList.toggle(`dark`,t===`dark`),document.documentElement.style.colorScheme=t}var yT=`nma-theme`;function bT(e){try{localStorage.setItem(fT,e)}catch{}vT(e),typeof window<`u`&&window.dispatchEvent(new Event(yT))}function xT(){bT(gT(hT(),_T())===`dark`?`light`:`dark`)}function ST(e){if(typeof matchMedia!=`function`)return()=>void 0;let t=matchMedia(`(prefers-color-scheme: dark)`),n=()=>{e()===`system`&&vT(`system`)};return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)}function CT(e){let t,n=/^#([0-9a-f]{3,8})$/i.exec(e.trim())?.[1];if(n){let e=n.length<=4?[...n.slice(0,3)].map(e=>e+e).join(``):n.slice(0,6);t=[0,2,4].map(t=>parseInt(e.slice(t,t+2),16))}else{let n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(e.trim());n&&(t=n.slice(1,4).map(Number))}if(!t)return;let[r,i,a]=t.map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*r+.7152*i+.0722*a}function wT(e){let t={};if(e.primaryColor){let n=CT(e.primaryColor),r=e.primaryForeground??(n!==void 0&&n>.45?pT:mT);Object.assign(t,{"--primary":e.primaryColor,"--primary-foreground":r,"--ring":e.primaryColor,"--sidebar-primary":e.primaryColor,"--sidebar-primary-foreground":r})}return e.radius&&Object.assign(t,{"--nma-radius-control":e.radius,"--nma-radius-card":`calc(${e.radius} * 1.5)`}),t}function TT(e){for(let[t,n]of Object.entries(wT(e)))document.documentElement.style.setProperty(t,n)}var ET=`nma.accent`,DT=`nma-accent`,OT=/^(#[0-9a-f]{3,8}|(rgb|rgba|hsl|hsla|oklch|oklab|lch|lab)\([0-9.,%\s/+-]+(deg|turn|rad)?[0-9.,%\s/+-]*\))$/i;function kT(e){return(e.personal&&OT.test(e.personal.trim())?e.personal:null)??e.admin??e.branding??void 0}function AT(){try{return localStorage.getItem(ET)}catch{return null}}function jT(e){try{e===null?localStorage.removeItem(ET):localStorage.setItem(ET,e)}catch{}}var MT=null,NT;function PT(e={}){`admin`in e&&(MT=e.admin??null),`branding`in e&&(NT=e.branding);let t=kT({personal:AT(),admin:MT,branding:NT}),n=[`--primary`,`--primary-foreground`,`--ring`,`--sidebar-primary`,`--sidebar-primary-foreground`];if(t)for(let[e,n]of Object.entries(wT({primaryColor:t})))document.documentElement.style.setProperty(e,n);else for(let e of n)document.documentElement.style.removeProperty(e);typeof window<`u`&&window.dispatchEvent(new Event(DT))}var FT={archive:gy,ban:Ey,bell:Oy,book:Ay,box:My,boxes:Py,briefcase:Iy,building:Ry,calendar:Wy,chart:Ky,check:Jy,clock:ob,"credit-card":fb,database:mb,dollar:gb,file:Mb,"file-text":Ab,folder:Pb,globe:Ib,heart:Bb,history:Xx,home:Hb,image:Kb,inbox:Jb,key:Xb,layers:ex,link:ix,list:ux,lock:fx,mail:gx,map:bx,"map-pin":vx,message:wx,package:Ax,phone:Ix,printer:Wx,receipt:Kx,refresh:Jx,send:nS,server:iS,settings:oS,shield:uS,"shopping-bag":fS,cart:mS,"shopping-cart":mS,star:vS,store:bS,tag:wS,tags:ES,ticket:OS,truck:PS,user:BS,users:HS,video:WS,wallet:KS,wrench:JS,x:XS,zap:QS};Object.keys(FT);function IT(e,t){return LT(e)??(t===`group`?Pb:t===`page`?oS:Ab)}function LT(e){return e&&Object.hasOwn(FT,e)?FT[e]:void 0}function RT(e,t){let[n,r]=(0,y.useState)(e);return(0,y.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function zT(){let{t:e}=Y(),t=Yi(),n=vv(),r=_v(),[i,a]=(0,y.useState)(!1),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)(0),u=(0,y.useId)(),d=(0,y.useRef)(null);(0,y.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`k`&&(e.preventDefault(),a(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let f=RT(o.trim(),250),p=f.length>=2&&(n.data?.groups.some(e=>e.resources.some(e=>e.searchable))??!1),m=ft({queryKey:[`search`,f],queryFn:()=>Q.search(f),enabled:i&&p,staleTime:1e4}),h=e=>{let t=n.data?oT(n.data).find(t=>t.resources.some(t=>t.name===e)):void 0;return t?.resources.find(t=>t.name===e)?.icon??t?.icon},g=n.data?dT(n.data,o,t=>e(`palette.new`,{name:t}),[{id:`theme`,label:e(`palette.toggleTheme`)}]):[],_=[...p&&o.trim()===f?(m.data?.groups??[]).flatMap(e=>e.items.map(t=>({id:`record:${e.resource}:${t._id}`,section:`records`,...h(e.resource)?{icon:h(e.resource)}:{},label:t._title,detail:e.label,to:`/${e.resource}/${encodeURIComponent(t._id)}`}))):[],...g.filter(e=>e.section===`actions`),...g.filter(e=>e.section===`go`),...r.data?.audit.view&&uT(e(`audit.title`),o)?[{id:`audit`,section:`go`,label:e(`audit.title`),to:`/-/audit`}]:[]],v=Math.min(c,Math.max(0,_.length-1));(0,y.useEffect)(()=>l(0),[o,m.data]),(0,y.useEffect)(()=>{d.current?.querySelector(`[data-index="${v}"]`)?.scrollIntoView({block:`nearest`})},[v]);function x(e){e&&(a(!1),e.to?t(e.to):e.id===`theme`&&xT())}function S(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),_.length===0)return;l((v+(e.key===`ArrowDown`?1:-1)+_.length)%_.length)}else e.key===`Enter`&&(e.preventDefault(),x(_[v]))}let C=[[`records`,e(`palette.records`)],[`actions`,e(`palette.actions`)],[`go`,e(`palette.goTo`)]],w=e=>`${u}-${e}`,T=p&&(m.isFetching||o.trim()!==f)?e(`palette.searching`):_.length===0?e(`palette.noResults`):``;return(0,b.jsxs)(Yd,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,b.jsx)(Zd,{asChild:!0,children:(0,b.jsxs)(q,{variant:`outline`,className:`w-9 justify-start px-0 font-normal text-muted-foreground max-sm:justify-center sm:w-[260px] sm:px-3.5`,"aria-keyshortcuts":`Control+K Meta+K`,"aria-label":e(`palette.open`),children:[(0,b.jsx)(eS,{}),(0,b.jsx)(`span`,{className:`hidden min-w-0 flex-1 truncate text-start sm:inline`,children:e(`palette.placeholder`)}),(0,b.jsx)(`kbd`,{className:`hidden shrink-0 rounded-[5px] border border-border bg-muted px-[5px] py-px font-mono text-[11px] text-muted-foreground sm:inline`,dir:`ltr`,children:`⌘K`})]})}),(0,b.jsxs)(tf,{children:[(0,b.jsx)(rf,{className:aT}),(0,b.jsxs)(cf,{"aria-describedby":void 0,className:`fixed inset-x-3 top-[12vh] z-50 mx-auto flex max-h-[70vh] max-w-[540px] flex-col overflow-hidden rounded-card border border-border bg-card text-card-foreground shadow-[0_24px_48px_rgba(0,0,0,.18)] outline-none`,children:[(0,b.jsx)(pf,{className:`sr-only`,children:e(`palette.open`)}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-border px-4`,children:[(0,b.jsx)(eS,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(`input`,{role:`combobox`,"aria-expanded":!0,"aria-controls":u,"aria-autocomplete":`list`,"aria-activedescendant":_.length>0?w(v):void 0,"aria-label":e(`palette.open`),placeholder:e(`palette.placeholder`),className:`h-[52px] flex-1 bg-transparent text-sm outline-none`,value:o,onChange:e=>s(e.target.value),onKeyDown:S}),(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] py-px font-mono text-[11px] text-muted-foreground`,dir:`ltr`,children:`Esc`})]}),(0,b.jsx)(`ul`,{ref:d,id:u,role:`listbox`,"aria-label":e(`palette.results`),className:`flex-1 overflow-y-auto p-1.5`,children:C.map(([e,t])=>{let n=_.map((e,t)=>({item:e,index:t})).filter(({item:t})=>t.section===e);return n.length===0?null:(0,b.jsxs)(`li`,{role:`presentation`,children:[(0,b.jsx)(`div`,{className:`px-2.5 pt-2.5 pb-1 text-xs font-medium text-muted-foreground`,"aria-hidden":!0,children:t}),(0,b.jsx)(`ul`,{role:`group`,"aria-label":t,children:n.map(({item:e,index:t})=>(0,b.jsxs)(`li`,{id:w(t),role:`option`,"aria-selected":t===v,"data-index":t,className:U(`flex h-10 cursor-pointer items-center gap-3 rounded-control px-2.5 text-[13.5px]`,t===v&&`bg-muted`),onMouseMove:()=>l(t),onClick:()=>x(e),children:[(0,b.jsx)(BT,{item:e}),(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e.section===`go`&&e.detail?`${e.detail} › ${e.label}`:e.label}),e.section===`records`&&e.detail&&(0,b.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.detail})]},e.id))})]},e)})}),(0,b.jsx)(`p`,{role:`status`,className:U(`px-4 text-sm text-muted-foreground`,T&&`border-t border-border py-2`),children:T}),(0,b.jsxs)(`div`,{className:`flex items-center gap-4 border-t border-border px-4 py-2.5 text-xs text-muted-foreground`,"aria-hidden":!0,children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] font-mono text-[11px]`,children:`↑↓`}),e(`palette.move`)]}),(0,b.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] font-mono text-[11px]`,children:`↵`}),e(`palette.openItem`)]}),(0,b.jsxs)(`span`,{className:`ms-auto flex items-center gap-1.5`,children:[(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] font-mono text-[11px]`,dir:`ltr`,children:`⌘K`}),e(`palette.close`)]})]})]})]})]})}function BT({item:e}){let t=e.id.startsWith(`new:`)?Hx:e.id===`theme`?Ox:IT(e.icon,e.section===`records`?`resource`:`group`);return(0,b.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})}var VT={success:5e3,error:1e4},HT=4;function UT(e=globalThis){let t=[],n=1,r=new Map,i=new Set,a=e=>{t=e;for(let e of i)e()},o=n=>{let i=r.get(n);i!==void 0&&e.clearTimeout(i),r.delete(n),t.some(e=>e.id===n)&&a(t.filter(e=>e.id!==n))};return{get:()=>t,subscribe(e){return i.add(e),()=>i.delete(e)},show(i,s=`success`){let c=n++,l=[...t,{id:c,message:i,tone:s}];for(let e of l.slice(0,Math.max(0,l.length-HT)))o(e.id);return a([...t,{id:c,message:i,tone:s}]),r.set(c,e.setTimeout(()=>o(c),VT[s])),c},dismiss:o}}var WT=UT(),GT=(e,t=`success`)=>WT.show(e,t);function KT(){return(0,y.useSyncExternalStore)(WT.subscribe,WT.get)}var qT={en:`English`,fa:`فارسی`};function JT(){let{t:e}=Y(),[t,n]=(0,y.useState)(hT),r=[[`light`,e(`shell.themeLight`),SS],[`dark`,e(`shell.themeDark`),Ox],[`system`,e(`shell.themeSystem`),Ex]];return(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":e(`shell.theme`),className:`flex items-center rounded-control border border-border p-0.5`,children:r.map(([e,r,i])=>(0,b.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":t===e,"aria-label":r,title:r,className:U(`rounded-md p-1.5 text-muted-foreground hover:text-foreground`,t===e&&`bg-muted text-foreground`),onClick:()=>{bT(e),n(e)},children:(0,b.jsx)(i,{className:`size-4`})},e))})}function YT(){let{t:e,locale:t,locales:n,setLocale:r}=Y();return n.length<2?null:(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[13px]`,children:[(0,b.jsx)(Qb,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(Pw,{"aria-label":e(`shell.language`),className:`flex-1`,value:t,onValueChange:r,options:n.map(e=>({value:e,label:qT[e]??e,lang:e}))})]})}function XT(){let{t:e,calendar:t,digits:n,setDisplay:r}=Y(),i=(e,t,n,r)=>(0,b.jsxs)(`div`,{role:`radiogroup`,"aria-label":e,className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,b.jsx)(`div`,{className:`flex rounded-control border border-border p-0.5`,children:n.map(([e,n])=>(0,b.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":t===e,className:U(`flex-1 cursor-pointer rounded-md px-2 py-1 text-[13px] text-muted-foreground hover:text-foreground`,t===e&&`bg-muted text-foreground`),onClick:()=>r(e),children:n},e))})]});return(0,b.jsxs)(b.Fragment,{children:[i(e(`display.calendar`),t,[[`gregorian`,e(`display.gregorian`)],[`persian`,e(`display.jalali`)]],e=>r({calendar:e})),i(e(`display.digits`),n,[[`latn`,e(`display.latinDigits`)],[`arabext`,e(`display.persianDigits`)]],e=>r({digits:e}))]})}function ZT(){let{t:e}=Y(),[t,n]=(0,y.useState)(hT);(0,y.useEffect)(()=>{let e=()=>n(hT());return window.addEventListener(yT,e),()=>window.removeEventListener(yT,e)},[]);let r=t===`dark`||t===`system`&&typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches;return(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":e(`shell.theme`),title:e(`shell.theme`),onClick:xT,children:r?(0,b.jsx)(SS,{}):(0,b.jsx)(Ox,{})})}var QT=[`#5B5BD6`,`#2563EB`,`#0E7490`,`#0F766E`,`#9333EA`,`#DB2777`,`#EA580C`];function $T(){let{t:e}=Y(),t=_v(),n=S(),[r,i]=(0,y.useState)(AT);(0,y.useEffect)(()=>{let e=()=>i(AT());return window.addEventListener(DT,e),()=>window.removeEventListener(DT,e)},[]);let a=t.data?.appearance,o=pt({mutationFn:e=>Q.setAppearance(e),onSuccess:async({accent:e})=>{jT(null),PT({admin:e}),await n.invalidateQueries({queryKey:[`session`]})}}),s=e=>{jT(e),PT()},c=r??a?.accent??null;return(0,b.jsxs)(`div`,{role:`group`,"aria-label":e(`display.accent`),className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e(`display.accent`)}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[QT.map(e=>(0,b.jsx)(`button`,{type:`button`,"aria-label":e,"aria-pressed":c?.toLowerCase()===e.toLowerCase(),className:U(`size-6 cursor-pointer rounded-full border-2 border-transparent outline-none focus-visible:ring-2 focus-visible:ring-ring`,c?.toLowerCase()===e.toLowerCase()&&`border-foreground`),style:{background:e},onClick:()=>s(e)},e)),(0,b.jsx)(`button`,{type:`button`,className:`size-6 cursor-pointer overflow-hidden rounded-full border border-border bg-[conic-gradient(red,yellow,lime,aqua,blue,magenta,red)]`,"aria-label":e(`display.customAccent`),title:e(`display.customAccent`),onClick:()=>oE(c)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs`,"aria-pressed":r===null,onClick:()=>s(null),children:e(`display.defaultAccent`)})]}),a?.manage&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 text-xs`,disabled:o.isPending||!r||r===a.accent,onClick:()=>o.mutate(r),children:e(`display.accentForEveryone`)}),a.accent&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-xs`,disabled:o.isPending,onClick:()=>o.mutate(null),children:e(`display.resetForEveryone`)})]}),o.isError&&(0,b.jsx)(`p`,{className:`text-xs text-destructive`,children:z_(o.error)}),a?.manage&&(0,b.jsx)(eE,{logo:a.logo,favicon:a.favicon})]})}function eE({logo:e,favicon:t}){let{t:n}=Y(),r=pt({mutationFn:e=>Q.removePicture(e),onSuccess:()=>window.location.reload(),onError:e=>GT(z_(e),`error`)}),i=(e,t)=>(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`span`,{className:`w-14 text-xs text-muted-foreground`,children:n(e===`logo`?`display.logo`:`display.favicon`)}),t&&(0,b.jsx)(`img`,{src:t,alt:``,className:`size-6 rounded object-contain`}),(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:()=>rE(e),children:n(`display.uploadPicture`)}),t&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-xs`,disabled:r.isPending,onClick:()=>r.mutate(e),children:n(`display.removePicture`)})]});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5 pt-1`,children:[i(`logo`,e),i(`favicon`,t)]})}var tE=null,nE=`logo`;function rE(e){tE&&(nE=e,tE.value=``,tE.click())}function iE(){return _v().data?.appearance?.manage===!0?(0,b.jsx)(`input`,{ref:e=>{tE=e},type:`file`,accept:`image/png,image/jpeg,image/gif,image/webp,image/svg+xml,image/x-icon,.ico`,tabIndex:-1,"aria-hidden":!0,"data-testid":`picture-input`,className:`pointer-events-none fixed bottom-0 start-0 size-px opacity-0`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&Q.setPicture(nE,t).then(()=>window.location.reload(),e=>GT(z_(e),`error`))}}):null}var aE=null;function oE(e){aE&&(e&&/^#[0-9a-f]{6}$/i.test(e)&&(aE.value=e),aE.click())}function sE(){return(0,b.jsx)(`input`,{ref:e=>{aE=e},type:`color`,tabIndex:-1,"aria-hidden":!0,className:`pointer-events-none fixed bottom-0 start-0 size-px opacity-0`,onInput:e=>{jT(e.currentTarget.value),PT()}})}var cE=`nma.nav`,lE={pinned:[],recent:[],collapsedGroups:[],expandedGroups:[],railCollapsed:!1};function uE(e){let t=lE;try{let n=e?.getItem(cE);n&&(t={...lE,...JSON.parse(n)})}catch{t=lE}let n=new Set,r=r=>{t=r;try{e?.setItem(cE,JSON.stringify(r))}catch{}for(let e of n)e()},i=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t];return{get:()=>t,subscribe(e){return n.add(e),()=>n.delete(e)},togglePin:e=>r({...t,pinned:i(t.pinned,e)}),visit:e=>{t.recent[0]!==e&&r({...t,recent:[e,...t.recent.filter(t=>t!==e)].slice(0,5)})},toggleGroup:(e,n=!1)=>{let i=hE(t,e,n),a=t=>t.filter(t=>t!==e);r({...t,collapsedGroups:i?a(t.collapsedGroups):[...a(t.collapsedGroups),e],expandedGroups:i?[...a(t.expandedGroups),e]:a(t.expandedGroups)})},toggleRail:()=>r({...t,railCollapsed:!t.railCollapsed})}}function dE(){try{return typeof localStorage>`u`?void 0:localStorage}catch{return}}var fE=uE(dE());function pE(){return(0,y.useSyncExternalStore)(fE.subscribe,fE.get)}function mE(e,t){return e.filter(e=>t.has(e))}function hE(e,t,n){return e.collapsedGroups.includes(t)?!0:!e.expandedGroups.includes(t)&&n}function gE(e){let{t}=Y(),[n,r,i]=qi().pathname.split(`/`).filter(Boolean).map(e=>decodeURIComponent(e)),a=n&&n!==`g`&&n!==`p`&&n!==`-`&&r&&r!==`new`?r:void 0,o=Cv(n??``,a),s=!!n&&![`g`,`p`,`-`,`account`].includes(n),c=yv(n??``,s&&e!==void 0&&!oT(e).some(e=>e.resources.some(e=>e.name===n))),l=[{label:t(e?.dashboard?`shell.dashboard`:`shell.home`),to:`/`}];if(n===`account`&&!r)return[...l,{label:t(`auth.account`)}];if(n===`-`&&(r===`users`||r===`groups`||r===`roles`||r===`debugger`||r===`audit`)){let e={users:t(`rbac.users`),groups:t(`rbac.groups`),roles:t(`rbac.roles`),debugger:t(`debugger.title`),audit:t(`audit.title`)}[r];return l.push({label:t(`rbac.administration`)},{label:e,to:`/-/${r}`}),i&&l.push({label:i===`new`?t(`list.new`):i}),l}if(!n||!e)return l;let u=oT(e);if(n===`g`){let e=u.find(e=>e.key===r);return e&&l.push({label:e.label}),l}if(n===`p`){let e=u.find(e=>e.pages.some(e=>e.name===r)),t=e?.pages.find(e=>e.name===r);return e&&t&&l.push({label:e.label,to:`/g/${e.key}`},{label:t.label}),l}let d=u.find(e=>e.resources.some(e=>e.name===n)),f=d?.resources.find(e=>e.name===n);return!d||!f?c.data?(l.push({label:c.data.label,to:`/${n}`}),a&&l.push({label:typeof o.data?._title==`string`?o.data._title:`#${a}`}),l):l:(l.push({label:d.label,to:`/g/${d.key}`},{label:f.label,to:`/${f.name}`}),r===`new`?l.push({label:t(`form.new`,{name:f.label})}):a&&l.push({label:typeof o.data?._title==`string`?o.data._title:`#${a}`}),l)}function _E({meta:e,onOpenMenu:t}){let{t:n}=Y(),r=pE(),i=gE(e),a=i.length-1;return(0,b.jsxs)(`header`,{className:`flex h-14 items-center gap-2 border-b border-border bg-card px-5`,children:[(0,b.jsx)(q,{variant:`ghost`,size:`icon`,className:`md:hidden`,"aria-label":n(`shell.menu`),onClick:t,"data-sidebar-toggle":``,children:(0,b.jsx)(Sx,{})}),(0,b.jsx)(q,{variant:`ghost`,size:`icon`,className:`hidden md:inline-flex`,"aria-label":n(r.railCollapsed?`shell.expandSidebar`:`shell.collapseSidebar`),"aria-pressed":r.railCollapsed,onClick:()=>fE.toggleRail(),"data-sidebar-toggle":``,children:(0,b.jsx)(Mx,{className:`ltr:-scale-x-100`})}),(0,b.jsx)(`div`,{className:`hidden h-5 w-px bg-border md:block`,"aria-hidden":!0}),(0,b.jsx)(`nav`,{"aria-label":n(`shell.breadcrumbs`),className:`min-w-0 flex-1 ps-1`,children:(0,b.jsx)(`ol`,{className:`flex min-w-0 items-center gap-1.5 text-sm text-muted-foreground`,children:i.map((e,t)=>(0,b.jsxs)(y.Fragment,{children:[t>0&&(0,b.jsx)(Qy,{className:`size-3.5 shrink-0 ltr:rotate-180`,"aria-hidden":!0}),(0,b.jsx)(`li`,{className:t===a?`truncate font-medium text-foreground`:`hidden truncate sm:block`,children:e.to&&t!==a?(0,b.jsx)(xo,{to:e.to,className:`hover:text-foreground`,children:e.label}):(0,b.jsx)(`span`,{"aria-current":t===a?`page`:void 0,children:e.label})})]},`${t}:${e.label}`))})}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(zT,{}),(0,b.jsx)(ZT,{})]})]})}function vE({rail:e=!1}){let{t}=Y(),n=_v(),r=Yi(),i=S(),a=n.data;if(!a)return null;let{user:o,auth:s}=a,c=o.displayName.split(/\s+/).filter(Boolean).slice(0,2).map(e=>[...e][0].toUpperCase()).join(``);async function l(){try{await Q.logout()}finally{H_(void 0),X_(void 0),i.clear(),r(`/login`,{replace:!0})}}return(0,b.jsxs)(Kh,{children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsxs)(`button`,{type:`button`,"aria-label":t(`auth.userMenu`,{name:o.displayName}),"data-user-block":``,className:U(`flex cursor-pointer items-center gap-2.5 rounded-control text-start hover:bg-muted`,e?`size-10 justify-center`:`px-2.5 py-2`),children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-[13px] font-semibold`,children:c||(0,b.jsx)(RS,{className:`size-4`})}),!e&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`span`,{className:`min-w-0 flex-1 leading-[1.35]`,children:[(0,b.jsx)(`span`,{className:`block truncate text-[13px] font-medium`,children:o.displayName}),(o.username||o.email)&&(0,b.jsx)(`span`,{className:`block truncate text-[11.5px] text-muted-foreground`,children:o.email??o.username})]}),(0,b.jsx)(bb,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})]})]})}),(0,b.jsx)(Jh,{children:(0,b.jsxs)(Yh,{side:`top`,align:`start`,sideOffset:6,className:`z-50 flex w-64 flex-col gap-1 rounded-[10px] border border-border bg-popover p-1.5 text-popover-foreground shadow-[0_12px_32px_rgba(0,0,0,.12)]`,children:[(s.password||s.sessions||s.twoFactor)&&!a.viewAs&&(0,b.jsx)(Xh,{asChild:!0,children:(0,b.jsxs)(xo,{to:`/account`,className:`flex h-[34px] items-center gap-2.5 rounded-md px-2 text-[13px] hover:bg-muted`,children:[(0,b.jsx)(RS,{className:`size-4`}),t(`auth.account`)]})}),a.audit.view&&(0,b.jsx)(Xh,{asChild:!0,children:(0,b.jsxs)(xo,{to:`/-/audit`,className:`flex h-[34px] items-center gap-2.5 rounded-md px-2 text-[13px] hover:bg-muted`,children:[(0,b.jsx)(Xx,{className:`size-4`}),t(`audit.title`)]})}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 border-y border-border px-2 py-2`,children:[(0,b.jsx)(YT,{}),(0,b.jsx)(XT,{}),(0,b.jsx)(JT,{}),(0,b.jsx)($T,{})]}),s.logout&&!a.open&&(0,b.jsxs)(`button`,{type:`button`,className:`flex h-[34px] items-center gap-2.5 rounded-md px-2 text-start text-[13px] hover:bg-muted`,onClick:()=>void l(),children:[(0,b.jsx)(mx,{className:`size-4 rtl:-scale-x-100`}),t(`auth.signOut`)]})]})})]})}var yE=`flex h-9 w-full cursor-pointer items-center gap-2.5 rounded-control px-2.5 text-start text-[13.5px] text-sidebar-foreground hover:bg-muted`,bE=({isActive:e})=>U(`flex h-8 items-center rounded-[7px] px-2.5 text-[13px] text-muted-foreground hover:bg-muted hover:text-foreground`,e&&`bg-primary-soft font-semibold text-primary-text hover:bg-primary-soft hover:text-primary-text`);function xE(e){return e.kind===`resource`?{key:e.name,to:`/${e.name}`,label:e.label,pin:e.name,...e.badge?{badge:e.badge}:{}}:e.kind===`page`?{key:`page:${e.name}`,to:`/p/${e.name}`,label:e.label}:{key:`link:${e.href}`,to:e.href,label:e.label,external:/^https?:\/\//i.test(e.href)}}var SE=(e,t)=>!t.external&&(e===t.to||e.startsWith(`${t.to}/`));function CE(e,t,n,r,i){let a=e.map(e=>{let r=e.items.map(xE);return{key:e.key,label:e.label,icon:IT(e.icon,`group`),entries:r,collapsedByDefault:cT({menu:t,current:r.some(e=>SE(n,e))}),asLink:t&&!e.advanced&&r.length===1}});return r.length>0?[{key:`~pinned`,label:i,icon:Bx,entries:r},...a]:a}function wE({title:e,logo:t,groups:n,menu:r,rail:i=!1,onClose:a}){let{t:o}=Y(),s=pE(),{pathname:c}=qi(),l=bv(r).data,u=new Map(n.flatMap(e=>e.items.flatMap(e=>e.kind===`resource`?[[e.name,xE(e)]]:[]))),d=CE(n,r,c,mE(s.pinned,new Set(u.keys())).map(e=>u.get(e)),o(`shell.pinned`)),f=d.find(e=>n.some(t=>t.advanced&&t.key===e.key)),p=d.filter(e=>e!==f),m=jE(),h=(e,t=!1)=>i?(0,b.jsx)(kE,{section:e,muted:t},e.key):(0,b.jsx)(OE,{section:e,collapsed:hE(s,e.key,e.collapsedByDefault??!1),badges:l,muted:t,large:!!a},e.key);return(0,b.jsxs)(`nav`,{"aria-label":o(`shell.resources`),className:`flex h-full flex-col`,children:[(0,b.jsx)(DE,{title:e,logo:t,rail:i,onClose:a}),(0,b.jsxs)(`div`,{className:U(`flex flex-1 flex-col gap-0.5 overflow-y-auto`,i?`items-center px-0 py-2.5`:`p-2.5`),children:[r&&(0,b.jsx)(TE,{to:`/`,label:o(`shell.dashboard`),icon:nx,rail:i,large:!!a,end:!0}),p.map(e=>h(e))]}),(0,b.jsxs)(`div`,{className:U(`flex flex-col gap-1 border-t border-sidebar-border`,i?`items-center px-0 py-2.5`:`p-2.5`),children:[f&&h(f,!0),m&&h(m,!0),(0,b.jsx)(vE,{rail:i})]})]})}function TE({to:e,label:t,icon:n,rail:r,large:i,end:a,external:o,count:s}){let c=({isActive:e})=>r?U(`flex size-10 items-center justify-center rounded-control hover:bg-muted`,e&&`bg-primary-soft text-primary-text hover:bg-primary-soft`):U(yE,i&&`h-11 text-[15px]`,e&&`bg-primary-soft font-semibold text-primary-text hover:bg-primary-soft`),l=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),!r&&(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:t}),!r&&s&&(0,b.jsx)(EE,{count:s})]});return o?(0,b.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,"aria-label":r?t:void 0,title:r?t:void 0,className:c({isActive:!1}),children:l}):(0,b.jsx)(So,{to:e,end:a,"aria-label":r?t:void 0,title:r?t:void 0,className:c,children:l})}function EE({count:e,strong:t}){return(0,b.jsxs)(`span`,{className:U(`inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full px-1.5 text-[11px]`,t?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:[e.estimate?`~`:``,E_(e.count)]})}function DE({title:e,logo:t,rail:n,onClose:r}){let{t:i}=Y(),a=t?(0,b.jsx)(`img`,{src:t,alt:``,className:`size-[30px] shrink-0 rounded-control object-contain`}):(0,b.jsx)(`img`,{src:`favicon.svg`,alt:``,className:`size-[30px] shrink-0 object-contain`});return(0,b.jsxs)(`div`,{className:U(`flex h-14 shrink-0 items-center gap-2.5 border-b border-sidebar-border`,n?`justify-center`:`px-4`),children:[a,!n&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1 leading-[1.3]`,children:[(0,b.jsx)(`div`,{className:U(`truncate font-semibold`,r?`text-[15px]`:`text-sm`),children:e}),!r&&(0,b.jsx)(`div`,{className:`text-[11.5px] text-muted-foreground`,children:i(`shell.adminPanel`)})]}),r?(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":i(`shell.closeMenu`),onClick:r,children:(0,b.jsx)(XS,{})}):(0,b.jsx)(nb,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})]})]})}function OE({section:e,collapsed:t,badges:n,muted:r,large:i}){let{t:a}=Y(),o=e.icon,s=`nav-group-${e.key}`,c=sT(e.entries.flatMap(e=>e.badge?[{kind:`resource`,name:e.key,label:e.label,badge:e.badge}]:[]),n);if(e.asLink){let[t]=e.entries;return(0,b.jsx)(TE,{to:t.to,label:e.label,icon:o,rail:!1,large:i,external:t.external,count:t.badge?n?.[t.badge]:void 0})}return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`button`,{type:`button`,className:U(yE,i&&`h-11 text-[15px]`,r&&`text-muted-foreground`),"aria-expanded":!t,"aria-controls":s,"aria-label":a(t?`shell.expandGroup`:`shell.collapseGroup`,{name:e.label}),onClick:()=>fE.toggleGroup(e.key,e.collapsedByDefault??!1),children:[(0,b.jsx)(o,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),t&&c&&(0,b.jsx)(EE,{count:c}),(0,b.jsx)(Xy,{className:U(`size-4 shrink-0 text-muted-foreground transition-transform`,t&&`rotate-90 rtl:rotate-90 ltr:-rotate-90`),"aria-hidden":!0})]}),!t&&(0,b.jsx)(`ul`,{id:s,"aria-label":e.label,className:`ms-[18px] mt-0.5 mb-1 flex flex-col gap-px border-s border-sidebar-border ps-2.5`,children:e.entries.map(e=>(0,b.jsxs)(`li`,{className:`group/item flex items-center`,children:[e.external?(0,b.jsx)(`a`,{href:e.to,target:`_blank`,rel:`noopener noreferrer`,className:U(bE({isActive:!1}),`min-w-0 flex-1`),children:(0,b.jsx)(`span`,{className:`truncate`,children:e.label})}):(0,b.jsxs)(So,{to:e.to,className:e=>U(bE(e),`min-w-0 flex-1 gap-2`),children:[(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.badge&&n?.[e.badge]&&(0,b.jsx)(EE,{count:n[e.badge]})]}),e.pin&&(0,b.jsx)(AE,{name:e.pin,label:e.label})]},e.key))})]})}function kE({section:e,muted:t}){let[n,r]=(0,y.useState)(!1),{pathname:i}=qi(),a=e.icon,o=e.entries.some(e=>SE(i,e));return(0,b.jsxs)(Kh,{open:n,onOpenChange:r,children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,"aria-label":e.label,title:e.label,onMouseEnter:()=>r(!0),"data-nav-section":``,className:U(`flex size-10 cursor-pointer items-center justify-center rounded-control hover:bg-muted`,t&&`text-muted-foreground`,o&&`bg-primary-soft text-primary-text hover:bg-primary-soft`),children:(0,b.jsx)(a,{className:`size-4`,"aria-hidden":!0})})}),(0,b.jsx)(Jh,{children:(0,b.jsxs)(Yh,{side:`right`,align:`start`,sideOffset:8,onMouseLeave:()=>r(!1),className:`z-50 flex flex-col items-start gap-1.5`,children:[(0,b.jsx)(`span`,{className:`rounded-control bg-foreground px-3 py-1.5 text-[13px] font-medium text-background`,children:e.label}),(0,b.jsx)(`div`,{className:`flex min-w-40 flex-col gap-px rounded-[10px] border border-border bg-card p-1.5 shadow-[0_12px_32px_rgba(0,0,0,.12)]`,children:e.entries.map(e=>e.external?(0,b.jsx)(`a`,{href:e.to,target:`_blank`,rel:`noopener noreferrer`,className:bE({isActive:!1}),onClick:()=>r(!1),children:e.label},e.key):(0,b.jsx)(So,{to:e.to,className:bE,onClick:()=>r(!1),children:e.label},e.key))})]})})]})}function AE({name:e,label:t}){let{t:n}=Y(),r=pE().pinned.includes(e);return(0,b.jsx)(`button`,{type:`button`,className:U(`cursor-pointer rounded-md p-1 text-muted-foreground opacity-0 hover:text-foreground focus-visible:opacity-100 group-hover/item:opacity-100`,r&&`opacity-100`),"aria-label":n(r?`shell.unpin`:`shell.pin`,{name:t}),"aria-pressed":r,onClick:()=>fE.togglePin(e),children:r?(0,b.jsx)(Rx,{className:`size-3.5`}):(0,b.jsx)(Bx,{className:`size-3.5`})})}function jE(){let{t:e}=Y();if(_v().data?.rbac.view)return{key:`~administration`,label:e(`rbac.administration`),icon:cS,entries:[{key:`users`,to:`/-/users`,label:e(`rbac.users`)},{key:`groups`,to:`/-/groups`,label:e(`rbac.groups`)},{key:`roles`,to:`/-/roles`,label:e(`rbac.roles`)},{key:`debugger`,to:`/-/debugger`,label:e(`debugger.title`)}]}}function ME(){let e=X(),t=KT();return(0,b.jsx)(`div`,{role:`region`,"aria-label":e(`toast.region`),className:`pointer-events-none fixed inset-x-4 bottom-4 z-[60] flex flex-col items-end gap-2 sm:start-auto sm:w-96`,children:t.map(t=>(0,b.jsxs)(`div`,{role:t.tone===`error`?`alert`:`status`,className:U(`pointer-events-auto flex w-full items-start gap-2 rounded-lg border bg-popover px-3 py-2 text-sm text-popover-foreground shadow-lg`,t.tone===`error`?`border-destructive/50`:`border-green-600/40`),children:[(0,b.jsx)(`span`,{className:U(`min-w-0 flex-1 break-words`,t.tone===`error`&&`text-destructive`),children:t.message}),(0,b.jsx)(`button`,{type:`button`,className:`rounded-md p-0.5 text-muted-foreground hover:text-foreground`,"aria-label":e(`toast.dismiss`),onClick:()=>WT.dismiss(t.id),children:(0,b.jsx)(XS,{className:`size-4`,"aria-hidden":!0})})]},t.id))})}function NE(e,t){return e===void 0||typeof e==`string`?e:e[t]??e[L_.locale]??Object.values(e)[0]}function PE(){let{t:e}=Y(),t=_v(),n=qi(),r=S(),i=t.isError&&Y_()!==void 0&&t.error instanceof R_&&(t.error.status===403||t.error.status===404);return(0,y.useEffect)(()=>{i&&(X_(void 0),r.clear())},[i,r]),t.isPending||i?(0,b.jsx)(W,{children:e(`common.loading`)}):t.isError?t.error instanceof R_&&t.error.status===401?(0,b.jsx)(Oa,{to:`/login?${new URLSearchParams({next:n.pathname+n.search})}`,replace:!0}):(0,b.jsxs)(W,{tone:`error`,children:[z_(t.error),` `,(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:e(`list.retry`)})]}):(0,b.jsx)(IE,{})}function FE(){let{t:e}=Y(),t=_v(),n=S(),r=Yi(),i=t.data;return i?.viewAs?(0,b.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center justify-center gap-3 bg-amber-400 px-4 py-2 text-sm font-medium text-amber-950`,children:[(0,b.jsx)(Eb,{className:`size-4`,"aria-hidden":!0}),(0,b.jsx)(`span`,{children:e(`viewAs.banner`,{name:i.user.displayName})}),(0,b.jsx)(q,{size:`sm`,variant:`outline`,className:`h-7 border-amber-950/30 bg-amber-50 text-amber-950 hover:bg-amber-100`,onClick:()=>{let e=i.user.id;X_(void 0),n.clear(),r(`/-/users/${encodeURIComponent(e)}`)},children:e(`viewAs.stop`)})]}):null}function IE(){let e=vv(),{t,locale:n}=Y(),r=pE(),i=qi(),[a,o]=(0,y.useState)(!1),s=(0,y.useRef)(null),c=_v().data?.appearance?.accent;(0,y.useEffect)(()=>{c!==void 0&&PT({admin:c})},[c]);let l=(0,y.useMemo)(()=>e.data?oT(e.data):[],[e.data]),u=e.data?.menu!==void 0,d=NE(L_.branding.name,n)??e.data?.title??L_.title,f=L_.branding.logo;return(0,y.useEffect)(()=>{o(!1);let e=decodeURIComponent(i.pathname.split(`/`).filter(Boolean)[0]??``);l.some(t=>t.resources.some(t=>t.name===e))&&fE.visit(e)},[i.pathname,l]),(0,y.useEffect)(()=>{e.data&&(document.title=e.data.title)},[e.data]),(0,y.useEffect)(()=>{if(!a)return;s.current?.querySelector(`a, button, input`)?.focus();let e=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),(0,b.jsxs)(`div`,{className:`flex min-h-svh bg-background text-foreground`,children:[(0,b.jsx)(sE,{}),(0,b.jsx)(iE,{}),(0,b.jsx)(`aside`,{className:U(`sticky top-0 hidden h-svh shrink-0 border-e border-sidebar-border bg-sidebar text-sidebar-foreground md:block`,r.railCollapsed?`w-16`:`w-64`),children:(0,b.jsx)(wE,{title:d,logo:f,groups:l,menu:u,rail:r.railCollapsed})}),a&&(0,b.jsxs)(`div`,{className:`fixed inset-0 z-40 md:hidden`,role:`dialog`,"aria-modal":`true`,"aria-label":t(`shell.menu`),ref:s,children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-black/40 backdrop-blur-sm dark:bg-black/60 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150`,"aria-hidden":!0,onClick:()=>o(!1)}),(0,b.jsx)(`aside`,{className:`absolute inset-y-0 start-0 flex w-[300px] max-w-[85vw] flex-col border-e border-sidebar-border bg-sidebar text-sidebar-foreground shadow-xl`,onClick:e=>{e.target.closest(`a`)&&o(!1)},children:(0,b.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,b.jsx)(wE,{title:d,logo:f,groups:l,menu:u,onClose:()=>o(!1)})})})]}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,inert:a||void 0,children:[(0,b.jsxs)(`div`,{className:`sticky top-0 z-30 bg-background`,children:[(0,b.jsx)(FE,{}),(0,b.jsx)(_E,{meta:e.data,onOpenMenu:()=>o(!0)})]}),(0,b.jsx)(`main`,{className:`flex-1 p-4 md:p-7`,children:(0,b.jsx)(`div`,{className:`mx-auto w-full max-w-[1400px]`,children:(0,b.jsx)(ka,{})})})]}),(0,b.jsx)(ME,{})]})}function LE(e){let t=L_.branding.name;return t===void 0?L_.title:typeof t==`string`?t:t[e]??t[L_.locale]??Object.values(t)[0]??L_.title}function RE(){let{t:e,locale:t}=Y(),n=Yi(),r=S(),[i]=To(),a=q_(i.get(`next`),L_.basePath),o=_v(),[s,c]=(0,y.useState)(``),[l,u]=(0,y.useState)(``),[d,f]=(0,y.useState)(`password`),[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(null),[_,v]=(0,y.useState)(!1);if(o.isSuccess)return(0,b.jsx)(Oa,{to:a,replace:!0});async function x(t){if(t.preventDefault(),!s.trim()||!l){g(e(`auth.required`));return}if(d===`otp`&&!p.trim()){g(e(`auth.otpRequired`));return}v(!0),g(null);try{let e=await Q.login(s.trim(),l,d===`otp`?p.trim():void 0);H_(e.csrfToken),X_(void 0),r.clear(),r.setQueryData([`session`],e),n(a,{replace:!0})}catch(t){if(t instanceof R_&&t.body.code===`TWO_FACTOR_REQUIRED`){g(d===`otp`?t.message:null),f(`otp`),m(``);return}f(`password`),m(``),u(``),g(t instanceof R_&&(t.status===401||t.status===429||t.status===404)?t.message:e(`auth.failed`))}finally{v(!1)}}let C=L_.branding.logo;return(0,b.jsxs)(`main`,{className:`flex min-h-dvh flex-col bg-muted/30`,children:[(0,b.jsxs)(`div`,{className:`flex justify-end gap-2 p-4`,children:[(0,b.jsx)(YT,{}),(0,b.jsx)(JT,{})]}),(0,b.jsx)(`div`,{className:`flex flex-1 items-start justify-center px-4 pt-[10vh]`,children:(0,b.jsxs)(`form`,{onSubmit:x,noValidate:!0,className:`flex w-full max-w-sm flex-col gap-4 rounded-xl border bg-background p-6 shadow-sm`,"aria-labelledby":`login-title`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,b.jsx)(`img`,{src:C??`favicon.svg`,alt:``,className:`size-10 rounded-md object-contain`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:LE(t)}),(0,b.jsx)(`h1`,{id:`login-title`,className:`text-[22px] font-bold`,children:e(d===`otp`?`auth.otpTitle`:`auth.title`)})]}),h&&(0,b.jsx)(`p`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:h}),d===`otp`?(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`login-otp`,children:e(`auth.otp`)}),(0,b.jsx)(e_,{id:`login-otp`,autoComplete:`one-time-code`,inputMode:`text`,autoCapitalize:`none`,spellCheck:!1,autoFocus:!0,dir:`ltr`,maxLength:40,value:p,onChange:e=>m(e.target.value),"aria-describedby":`login-otp-help`}),(0,b.jsx)(`p`,{id:`login-otp-help`,className:`text-sm text-muted-foreground`,children:e(`auth.otpHelp`)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`login-username`,children:e(`auth.username`)}),(0,b.jsx)(e_,{id:`login-username`,autoComplete:`username`,autoCapitalize:`none`,spellCheck:!1,autoFocus:!0,value:s,onChange:e=>c(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`login-password`,children:e(`auth.password`)}),(0,b.jsx)(e_,{id:`login-password`,type:`password`,autoComplete:`current-password`,value:l,onChange:e=>u(e.target.value)})]})]}),(0,b.jsx)(q,{type:`submit`,disabled:_,children:e(_?`auth.signingIn`:d===`otp`?`auth.verify`:`auth.signIn`)}),d===`otp`&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>{f(`password`),m(``),u(``),g(null)},children:e(`auth.startOver`)})]})})]})}var zE=3;function BE({field:e,files:t,detailed:n=!1,plain:r=!1}){let i=X();if(t.length===0)return(0,b.jsx)(b.Fragment,{children:`—`});let a=t=>e.widget===`image`&&t.contentType.startsWith(`image/`),o=n?t:t.slice(0,zE);return(0,b.jsxs)(`span`,{className:U(`inline-flex flex-wrap items-center`,n?`gap-2`:`gap-1 align-middle`),children:[o.map(e=>{let t=a(e)?(0,b.jsx)(`img`,{src:e.url,alt:e.name,loading:`lazy`,className:U(`rounded-md border bg-muted object-cover`,n?`size-24`:`size-8`)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Mb,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(`bdi`,{className:`max-w-48 truncate`,children:e.name}),n&&(0,b.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:ov(e.size)})]});return r?(0,b.jsx)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:t},e.key):(0,b.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":i(`upload.open`,{name:e.name}),title:e.name,className:`inline-flex min-w-0 items-center gap-1 hover:underline`,onClick:e=>e.stopPropagation(),children:t},e.key)}),t.length>o.length&&(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i(`upload.more`,{count:t.length-o.length})})]})}var VE=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{},HE=e=>Array.isArray(e)?e:[];function UE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`id`in e&&`title`in e}function WE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`name`in e&&`size`in e&&(`key`in e||`token`in e)}function GE(e){return(Array.isArray(e)?e:[e]).filter(WE)}function KE(e,t){let n=e?._files?.[t];return n==null?[]:Array.isArray(n)?n:[n]}var qE=e=>e.token===void 0?`key:${e.key}`:`token:${e.token}`,JE=e=>e.token===void 0?{key:e.key}:{token:e.token},YE=(e,t)=>{let n=new Set(e.map(e=>String(e.id)));return e.length===t.length&&t.every(e=>n.has(String(e.id)))},XE=/<img\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;function ZE(e){return e.replace(XE,``)}var QE=e=>String(e).padStart(2,`0`);function $E(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.getFullYear()}-${QE(t.getMonth()+1)}-${QE(t.getDate())}T${QE(t.getHours())}:${QE(t.getMinutes())}`}function eD(e,t){let n={};for(let r of e){let e=t?t[r.name]:r.default;if(r.file){let e=KE(t,r.name).map(({key:e,name:t,size:n,contentType:r,url:i})=>({key:e,name:t,size:n,contentType:r,url:i}));n[r.name]=r.file.many?e:e[0]??null}else if(r.type===`object`){let t=r.fields??[];n[r.name]=r.many?(Array.isArray(e)?e:[]).map(e=>eD(t,e)):eD(t,e??void 0)}else r.relation?.kind===`to-many`?n[r.name]=Array.isArray(e)?e.filter(UE):[]:r.type===`relation`?n[r.name]=UE(e)?e:null:r.type===`boolean`?n[r.name]=e===!0:e==null?n[r.name]=``:r.type===`json`?n[r.name]=JSON.stringify(e,null,2):r.type===`datetime`?n[r.name]=$E(String(e)):r.widget===`money`?n[r.name]=tC(String(e),r.scale):n[r.name]=String(e)}return n}function tD(e,t){let n=/^-?\d{1,3}(,\d{3})+(\.\d+)?$/.test(e)?e.replace(/,/g,``):e;if((t?/^-?\d+$/:/^-?\d+(\.\d+)?$/).test(n))return n}function nD(e,t,n,r=``){let i={},a={};for(let o of e){let e=t[o.name];if(n&&e===n[o.name])continue;let s=`${r}${o.name}`;if(o.type===`object`){let t=o.fields??[];if(o.many){let r=HE(e).map((e,n)=>nD(t,e,void 0,`${s}.${n}.`));for(let e of r)Object.assign(a,e.errors);let c=r.map(e=>e.payload),l=n?HE(n[o.name]).map(e=>nD(t,e).payload):void 0;(l?JSON.stringify(l)!==JSON.stringify(c):c.length>0)&&(i[o.name]=c);continue}let r=nD(t,VE(e),n?VE(n[o.name]):void 0,`${s}.`);Object.assign(a,r.errors),(Object.keys(r.payload).length>0||!n&&!o.nullable)&&(i[o.name]=r.payload);continue}if(o.file){let t=GE(e),r=n?GE(n[o.name]):void 0;if(r&&t.map(qE).join(`
|
|
54
|
-
`)===r.map(
|
|
55
|
-
`))continue;o.file.many?(r||t.length>0)&&(i[o.name]=t.map(JE)):t[0]?i[o.name]=JE(t[0]):(o.nullable||n)&&(i[o.name]=null);continue}if(o.relation?.kind===`to-many`){let t=Array.isArray(e)?e.filter(UE):[],r=n?.[o.name];(n?!YE(t,Array.isArray(r)?r.filter(UE):[]):t.length>0)&&(i[o.name]=t.map(e=>e.id));continue}if(o.type===`relation`){let t=UE(e)?e:null,r=n?.[o.name];if(n&&String(t?.id)===String(UE(r)?r.id:void 0))continue;t?i[o.name]=t.id:(o.nullable||n)&&(i[o.name]=null);continue}if(o.type===`boolean`){i[o.name]=e===!0;continue}let c=typeof e==`string`?e:``,l=c.trim();if(l===``){(o.nullable||n)&&(i[o.name]=null);continue}switch(o.type){case`number`:case`decimal`:case`bigint`:{let e=tD(a_(l),o.type===`bigint`);e===void 0?a[s]=[J(`validation.number`)]:i[o.name]=o.type===`number`?Number(e):e;break}case`json`:try{i[o.name]=JSON.parse(l)}catch{a[s]=[J(`validation.json`)]}break;case`date`:{let e=i_(l);!/^\d{4}-\d{2}-\d{2}$/.test(e)||Number.isNaN(Date.parse(`${e}T00:00:00Z`))||new Date(`${e}T00:00:00Z`).toISOString().slice(0,10)!==e?a[s]=[J(`validation.date`)]:i[o.name]=e;break}case`datetime`:{let e=new Date(i_(l));Number.isNaN(e.getTime())?a[s]=[J(`validation.datetime`)]:i[o.name]=e.toISOString();break}default:i[o.name]=c}}return{payload:i,errors:a}}function rD(e,t){let{payload:n}=nD(e,t),r=e=>Array.isArray(e)?e.every(e=>typeof e==`string`||typeof e==`number`):typeof e==`string`?e.length<=100:typeof e!=`object`||!e,i=Object.fromEntries(Object.entries(n).filter(([,e])=>r(e))),a=JSON.stringify(i);return a.length<=4e3?a:void 0}var iD={ok:`bg-ok-bg text-ok`,warn:`bg-warn-bg text-warn`,bad:`bg-bad-bg text-bad`,info:`bg-info-bg text-info`,neutral:`bg-muted text-muted-foreground`,primary:`bg-primary-soft text-primary-text`};function aD({tone:e=`neutral`,className:t,...n}){return(0,b.jsx)(`span`,{"data-slot":`badge`,"data-tone":e,className:U(`inline-flex h-[22px] items-center gap-1 rounded-full px-2 text-xs leading-none font-medium whitespace-nowrap`,iD[e],t),...n})}var oD={gray:`neutral`,red:`bad`,amber:`warn`,green:`ok`,blue:`info`,purple:`primary`,pink:`bad`};function sD(e){return oD[e]??`neutral`}function cD({value:e,field:t,className:n}){if(e==null)return(0,b.jsx)(b.Fragment,{children:sC(e,t)});let r=t.colors?.[String(e)]??`gray`;return(0,b.jsx)(aD,{"data-color":r,tone:sD(r),className:n,children:sC(e,t)})}function lD({value:e,field:t,record:n,detailed:r,plain:i}){return t.file&&n?(0,b.jsx)(BE,{field:t,files:KE(n,t.name),detailed:r,plain:i}):t.widget===`badge`?(0,b.jsx)(cD,{value:e,field:t}):(0,b.jsx)(b.Fragment,{children:sC(e,t)})}function uD({title:e,subtitle:t,icon:n,actions:r,footer:i,className:a,bodyClassName:o,children:s,...c}){let l=(0,y.useId)(),u=e!==void 0&&c[`aria-labelledby`]===void 0?{"aria-labelledby":l}:{};return(0,b.jsxs)(`section`,{"data-slot":`card`,className:U(`rounded-card border border-border bg-card text-card-foreground shadow-card`,a),...u,...c,children:[e!==void 0&&(0,b.jsxs)(`header`,{className:`flex min-h-14 items-center gap-2 border-b border-border px-5 py-3`,children:[n&&(0,b.jsx)(`span`,{className:`text-muted-foreground [&_svg]:size-4`,children:n}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`h2`,{id:l,className:`text-[15px] font-semibold`,children:e}),t&&(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t})]}),r&&(0,b.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:r})]}),(0,b.jsx)(`div`,{className:U(e!==void 0&&`p-5`,o),children:s}),i&&(0,b.jsx)(`footer`,{className:`border-t border-border px-5 py-3`,children:i})]})}function dD({card:e,values:t,schema:n}){let r=X(),i=yv(e.relation?.resource??``,e.relation!==void 0);if(!t)return null;let a=e.relation?i.data?.fields:n.fields;if(!a)return null;let o=LT(e.icon),s=e.fields.flatMap(e=>{let t=a.find(t=>t.name===e);return t?[t]:[]}),c=e.relation?.link&&typeof t._id==`string`?`/${e.relation.resource}/${encodeURIComponent(t._id)}`:void 0;return(0,b.jsx)(uD,{title:e.title,icon:o?(0,b.jsx)(o,{}):void 0,actions:c&&(0,b.jsx)(xo,{to:c,className:`text-[13px] font-medium text-primary hover:underline`,children:r(`form.viewProfile`)}),children:(0,b.jsxs)(`dl`,{className:`flex flex-col gap-2.5 text-[13px]`,children:[e.relation&&typeof t._title==`string`&&(0,b.jsx)(`dt`,{className:`text-[14px] font-semibold`,children:t._title}),s.map(e=>(0,b.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`min-w-0 text-end break-words`,children:(0,b.jsx)(lD,{value:t[e.name],field:e,record:t})})]},e.name))]})})}function fD(e,t,n){let r=e.steps?.values??e.enumValues??[],i=typeof t==`string`?r.indexOf(t):-1;return r.map((t,r)=>{let a=n?.[t],o=a?k_(new Date(a)):null,s=i===-1?`future`:r<i?`done`:r===i?`current`:`future`;return{key:t,label:e.enumLabels?.[t]??t,state:s,at:s===`future`?null:o,caption:s===`current`&&o?J(`stepper.since`,{time:o}):null}})}function pD({field:e,value:t,reached:n}){let r=fD(e,t,n);return(0,b.jsx)(uD,{"aria-label":e.label,bodyClassName:`overflow-x-auto px-5 py-4`,children:(0,b.jsx)(`ol`,{className:`flex min-w-max`,children:r.map((e,t)=>(0,b.jsxs)(`li`,{"aria-current":e.state===`current`?`step`:void 0,className:`relative flex min-w-28 flex-1 flex-col items-center gap-1.5 text-center`,children:[t<r.length-1&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:U(`absolute start-1/2 top-3.5 h-0.5 w-full`,e.state===`done`?`bg-primary`:`bg-border`)}),(0,b.jsx)(`span`,{className:U(`relative z-10 flex size-7 items-center justify-center rounded-full border-2 bg-card text-xs font-semibold`,e.state===`done`&&`border-primary bg-primary text-primary-foreground`,e.state===`current`&&`border-primary text-primary`,e.state===`future`&&`border-border text-muted-foreground`),children:e.state===`done`?(0,b.jsx)(Jy,{className:`size-3.5`,"aria-hidden":!0}):E_(t+1)}),(0,b.jsx)(`span`,{className:U(`text-[13px]`,e.state===`current`?`font-semibold text-primary`:e.state===`done`?`font-semibold`:`text-muted-foreground`),children:e.label}),(0,b.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:e.caption??e.at??`—`})]},e.key))})})}var mD=class{options;pending=[];problems=[];uploads=new Map;nextId=0;disposed=!1;constructor(e){this.options=e}get busy(){return this.pending.length>0}start(e,t){if(!(this.disposed||e.length===0)){this.problems=[];for(let n of e){let e=this.options.check(n);if(e){this.problems=[...this.problems,this.options.describe(n.name,e)];continue}let r=++this.nextId,i=this.options.preview?.(n),a=this.options.send(n,e=>{this.disposed||(this.pending=this.pending.map(t=>t.id===r?{...t,progress:e}:t),this.options.onChange())});this.uploads.set(r,a),this.pending=[...this.pending,{id:r,name:n.name,progress:0,preview:i}],a.promise.then(e=>{this.disposed||(this.finish(r),t(e,n,i))},e=>{this.disposed||(i&&this.options.revoke?.(i),e instanceof Z_||(this.problems=[...this.problems,this.options.describe(n.name,nv(e))]),this.finish(r))})}this.options.onChange()}}report(e,t){this.problems=[...this.problems,this.options.describe(e,t)],this.options.onChange()}cancel(e){this.uploads.get(e)?.abort()}cancelAll(){for(let e of[...this.uploads.values()])e.abort()}dispose(){this.disposed=!0;for(let e of this.pending)e.preview&&this.options.revoke?.(e.preview);this.cancelAll(),this.uploads.clear(),this.pending=[]}finish(e){this.uploads.delete(e),this.pending=this.pending.filter(t=>t.id!==e),this.options.onChange()}};function hD({resource:e,field:t,rules:n,onBusy:r}){let i=X(),[,a]=(0,y.useReducer)(e=>e+1,0),o=(0,y.useRef)({resource:e,field:t,rules:n,t:i});o.current={resource:e,field:t,rules:n,t:i};let s=(0,y.useRef)(null),c=()=>new mD({send:(e,t)=>Q.upload(e,{resource:o.current.resource,field:o.current.field.name},t),check:e=>iv(e,o.current.rules),describe:(e,t)=>o.current.t(`upload.failed`,{name:e,message:t}),preview:e=>e.type.startsWith(`image/`)?URL.createObjectURL(e):void 0,revoke:e=>URL.revokeObjectURL(e),onChange:a});s.current??=c();let l=s.current.busy;return(0,y.useEffect)(()=>{r?.(l)},[l]),(0,y.useEffect)(()=>(s.current||(s.current=c(),a()),()=>{s.current?.dispose(),s.current=null,r?.(!1)}),[]),s.current}function gD({resource:e,field:t,value:n,onChange:r,onBusy:i}){let a=t.file?.many===!0,o=GE(n),s=(0,y.useRef)(o);s.current=o;let c=hD({resource:e,field:t,rules:t.file??{accept:[],maxBytes:1/0},onBusy:i}),l=(0,y.useRef)(new Map);(0,y.useEffect)(()=>()=>{for(let e of l.current.values())URL.revokeObjectURL(e);l.current.clear()},[]);function u(e){let t=new Set(e.map(e=>e.token));for(let[e,n]of l.current)t.has(e)||(URL.revokeObjectURL(n),l.current.delete(e));s.current=e,r(a?e:e[0]??null)}function d(e){let t=a?e:e.slice(0,1);t.length!==0&&(a||c.cancelAll(),c.start(t,(e,t,n)=>{n&&l.current.set(e.token,n);let r={token:e.token,name:e.name,size:e.size,contentType:e.contentType,...e.url?{url:e.url}:{}};u(a?[...s.current,r]:[r])}))}return{many:a,files:o,pending:c.pending,problems:c.problems,add:d,remove:e=>u(o.filter((t,n)=>n!==e)),move:(e,t)=>u(sv(o,e,t)),cancel:e=>c.cancel(e),previewOf:e=>e.url??(e.token?l.current.get(e.token):void 0)}}function _D(e){let[t,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(null),a=()=>{n(null),i(null)};return{dragging:t,over:r,item:r=>({draggable:!0,onDragStart:e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,String(r)),n(r)},onDragOver:e=>{t!==null&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,i(r))},onDrop:n=>{t!==null&&(n.preventDefault(),e(t,r),a())},onDragEnd:a})}}function vD({id:e,field:t,label:n,compact:r,onFiles:i,aria:a}){let o=X(),s=(0,y.useRef)(null),[c,l]=(0,y.useState)(!1),u=t.file?.many===!0,d=t.file?.accept??[],f=d.length===0||d.some(e=>e===`*`||e===`*/*`),p=e=>e.dataTransfer.types.includes(`Files`);return(0,b.jsxs)(`div`,{"data-dropzone":t.name,onDragOver:e=>{p(e)&&(e.preventDefault(),l(!0))},onDragLeave:()=>l(!1),onDrop:e=>{p(e)&&(e.preventDefault(),l(!1),i([...e.dataTransfer.files]))},className:U(`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg text-sm has-[:focus-visible]:ring-3 has-[:focus-visible]:ring-ring/50`,!r&&`border border-dashed border-input px-3 py-3`,c&&`border-primary bg-muted/50`),children:[(0,b.jsx)(`input`,{ref:s,id:e,type:`file`,className:`sr-only`,multiple:u,accept:f?void 0:d.join(`,`),onChange:e=>{i([...e.target.files??[]]),e.target.value=``},...a}),(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,tabIndex:-1,"aria-hidden":!0,onClick:()=>s.current?.click(),children:[(0,b.jsx)(IS,{}),n]}),!r&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[o(u?`upload.dropMany`:`upload.drop`),t.file&&` · ${o(`upload.limit`,{max:ov(t.file.maxBytes)})}`]})]})}function yD({upload:e,onCancel:t,className:n}){let r=X(),i=Math.round(e.progress*100);return(0,b.jsxs)(`div`,{className:U(`flex items-center gap-2`,n),children:[(0,b.jsx)(`div`,{role:`progressbar`,"aria-label":r(`upload.uploading`,{name:e.name}),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i,className:`h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,b.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width]`,style:{width:`${i}%`}})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":r(`upload.cancel`,{name:e.name}),onClick:t,children:(0,b.jsx)(XS,{})})]})}function bD({problems:e}){return e.length===0?null:(0,b.jsx)(`ul`,{role:`alert`,className:`flex flex-col gap-0.5 text-sm text-destructive`,children:e.map((e,t)=>(0,b.jsx)(`li`,{children:e},t))})}function xD(e){let t=X(),{id:n,field:r,aria:i}=e,{many:a,files:o,pending:s,problems:c,add:l,remove:u,move:d,cancel:f}=gD(e),p=_D(d);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(o.length>0||s.length>0)&&(0,b.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[o.map((e,n)=>(0,b.jsxs)(`li`,{"data-file":e.name,...a&&o.length>1?p.item(n):{},className:U(`flex items-center gap-2 rounded-lg border px-2 py-1.5 text-sm`,p.dragging===n&&`opacity-50`,p.over===n&&p.dragging!==n&&`border-primary`),children:[a&&o.length>1?(0,b.jsx)(Rb,{className:`size-4 shrink-0 cursor-grab text-muted-foreground`,"aria-hidden":!0}):(0,b.jsx)(Mb,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),e.url?(0,b.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`min-w-0 truncate hover:underline`,"aria-label":t(`upload.open`,{name:e.name}),children:(0,b.jsx)(`bdi`,{children:e.name})}):(0,b.jsx)(`bdi`,{className:`min-w-0 truncate`,children:e.name}),(0,b.jsx)(`span`,{className:`ms-auto shrink-0 text-muted-foreground`,children:ov(e.size)}),a&&o.length>1&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,disabled:n===0,"aria-label":t(`list.moveUp`,{name:e.name}),onClick:()=>d(n,n-1),children:(0,b.jsx)(wy,{})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,disabled:n===o.length-1,"aria-label":t(`list.moveDown`,{name:e.name}),onClick:()=>d(n,n+1),children:(0,b.jsx)(by,{})})]}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":t(`upload.remove`,{name:e.name}),onClick:()=>u(n),children:(0,b.jsx)(XS,{})})]},e.token??e.key)),s.map(e=>(0,b.jsxs)(`li`,{className:`flex flex-col gap-1 rounded-lg border border-dashed px-2 py-1.5 text-sm`,children:[(0,b.jsx)(`bdi`,{className:`truncate text-muted-foreground`,children:e.name}),(0,b.jsx)(yD,{upload:e,onCancel:()=>f(e.id)})]},`pending-${e.id}`))]}),(0,b.jsx)(vD,{id:n,field:r,label:t(a?`upload.chooseMany`:o.length>0?`upload.replace`:`upload.choose`),compact:!a&&o.length>0,onFiles:l,aria:i}),(0,b.jsx)(bD,{problems:c})]})}function SD(e){let t=X(),{id:n,field:r,aria:i}=e,{many:a,files:o,pending:s,problems:c,add:l,remove:u,move:d,cancel:f,previewOf:p}=gD(e),m=_D(d),h=a&&o.length>1;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(o.length>0||s.length>0)&&(0,b.jsxs)(`ul`,{className:`flex flex-wrap gap-2`,children:[o.map((e,n)=>{let r=p(e);return(0,b.jsxs)(`li`,{"data-file":e.name,...h?m.item(n):{},className:U(`group relative size-28 overflow-hidden rounded-lg border bg-muted`,h&&`cursor-grab`,m.dragging===n&&`opacity-50`,m.over===n&&m.dragging!==n&&`border-primary ring-2 ring-primary/40`),children:[r?(0,b.jsx)(`img`,{src:r,alt:e.name,draggable:!1,className:`size-full object-cover`}):(0,b.jsxs)(`span`,{className:`flex size-full flex-col items-center justify-center gap-1 p-1 text-center text-xs text-muted-foreground`,children:[(0,b.jsx)(Wb,{className:`size-5`,"aria-hidden":!0}),(0,b.jsx)(`bdi`,{className:`w-full truncate`,children:e.name})]}),(0,b.jsx)(q,{type:`button`,variant:`secondary`,size:`icon-xs`,className:`absolute end-1 top-1 shadow`,"aria-label":t(`upload.remove`,{name:e.name}),onClick:()=>u(n),children:(0,b.jsx)(XS,{})}),h&&(0,b.jsxs)(`div`,{className:`absolute inset-x-1 bottom-1 flex justify-between`,children:[(0,b.jsx)(q,{type:`button`,variant:`secondary`,size:`icon-xs`,className:`shadow`,disabled:n===0,"aria-label":t(`list.moveUp`,{name:e.name}),onClick:()=>d(n,n-1),children:(0,b.jsx)(Qy,{className:`rtl:rotate-180`})}),(0,b.jsx)(q,{type:`button`,variant:`secondary`,size:`icon-xs`,className:`shadow`,disabled:n===o.length-1,"aria-label":t(`list.moveDown`,{name:e.name}),onClick:()=>d(n,n+1),children:(0,b.jsx)(eb,{className:`rtl:rotate-180`})})]})]},e.token??e.key)}),s.map(e=>(0,b.jsxs)(`li`,{className:`relative size-28 overflow-hidden rounded-lg border border-dashed bg-muted`,children:[e.preview&&(0,b.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover opacity-40`}),(0,b.jsx)(yD,{upload:e,onCancel:()=>f(e.id),className:`absolute inset-x-1 bottom-1 rounded-md bg-background/80 ps-1.5`})]},`pending-${e.id}`))]}),(0,b.jsx)(vD,{id:n,field:r,label:t(a?`upload.chooseImages`:o.length>0?`upload.replace`:`upload.chooseImage`),compact:!a&&o.length>0,onFiles:l,aria:i}),(0,b.jsx)(bD,{problems:c})]})}function CD(e,t){let[n,r]=(0,y.useState)(e);return(0,y.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var wD=(e,t)=>String(e.id)===String(t.id);function TD({id:e,resource:t,field:n,value:r,onChange:i,clearable:a,values:o,parent:s,invalid:c,describedBy:l}){let u=X(),d=n.relation?.kind===`to-many`,f=d&&Array.isArray(r)?r:[],p=!d&&r&&!Array.isArray(r)?r:null,[m,h]=(0,y.useState)(``),[g,_]=(0,y.useState)(!1),[v,x]=(0,y.useState)(0),S=CD(m.trim(),250),C=wv(t,n.optionsField??n.name,S,g,o,s),w=(C.data?.items??[]).filter(e=>!f.some(t=>wD(t,e))),T=`${e}-options`,E=t=>`${e}-option-${t}`;(0,y.useEffect)(()=>{x(0)},[S,C.data]);function D(e){h(``),_(!1),i(d?[...f,e]:e)}function O(e){e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),g?x(t=>Math.max(0,Math.min(w.length-1,t+(e.key===`ArrowDown`?1:-1)))):_(!0)):e.key===`Enter`&&g?(e.preventDefault(),w[v]&&D(w[v])):e.key===`Escape`&&g?(e.preventDefault(),_(!1),h(``)):e.key===`Backspace`&&d&&m===``&&f.length>0&&i(f.slice(0,-1))}return(0,b.jsxs)(`div`,{className:`relative flex flex-col gap-1.5`,children:[d&&f.length>0&&(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,"aria-label":u(`picker.selected`,{name:n.label}),children:f.map(e=>(0,b.jsxs)(`li`,{className:`inline-flex items-center gap-1 rounded-md bg-muted py-0.5 ps-2 pe-1 text-sm`,children:[e.title,(0,b.jsx)(`button`,{type:`button`,className:`rounded-sm p-0.5 text-muted-foreground hover:text-foreground`,"aria-label":u(`picker.remove`,{name:e.title}),onClick:()=>i(f.filter(t=>!wD(t,e))),children:(0,b.jsx)(XS,{className:`size-3.5`})})]},String(e.id)))}),(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(e_,{id:e,role:`combobox`,autoComplete:`off`,"aria-autocomplete":`list`,"aria-expanded":g,"aria-controls":T,"aria-activedescendant":g&&w[v]?E(v):void 0,"aria-invalid":c||void 0,"aria-describedby":l,className:U(p&&a&&`pe-8`),placeholder:p?p.title:u(d?`picker.typeToAdd`:`picker.typeToSearch`),value:g||m?m:p?.title??``,onChange:e=>{h(e.target.value),_(!0)},onFocus:()=>_(!0),onBlur:()=>{_(!1),h(``)},onKeyDown:O}),p&&a&&(0,b.jsx)(`button`,{type:`button`,className:`absolute inset-y-0 end-0 flex items-center px-2 text-muted-foreground hover:text-foreground`,"aria-label":u(`picker.clear`,{name:n.label}),onClick:()=>i(null),children:(0,b.jsx)(XS,{className:`size-4`})})]}),g&&(0,b.jsxs)(`div`,{className:`absolute inset-x-0 top-full z-20 mt-1 max-h-60 overflow-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:[(0,b.jsx)(`ul`,{id:T,role:`listbox`,"aria-label":n.label,children:w.map((e,t)=>(0,b.jsx)(`li`,{id:E(t),role:`option`,"aria-selected":t===v,className:U(`cursor-pointer rounded-md px-2 py-1.5 text-sm`,t===v&&`bg-accent text-accent-foreground`),onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>x(t),onClick:()=>D(e),children:e.title},String(e.id)))}),w.length===0&&(0,b.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,children:C.isError?z_(C.error):u(C.isFetching||C.isPending?`picker.searching`:`picker.noMatches`)})]})]})}function ED({className:e,...t}){return(0,b.jsx)(`textarea`,{"data-slot":`textarea`,className:U(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function DD(e,t){if(e.widget===`stepper`)return`select`;if(e.widget)return e.widget;switch(e.type){case`boolean`:return`checkbox`;case`enum`:return`select`;case`text`:return`textarea`;case`json`:case`object`:return`json`;case`number`:case`decimal`:case`bigint`:return`number`;case`date`:return`date`;case`datetime`:return`datetime`;default:return t?.format===`email`?`email`:t?.format===`url`?`url`:`text`}}function OD(e,t){return e.enumLabels?.[t]??t}function kD({id:e,field:t,value:n,onChange:r,aria:i}){let{unit:a,position:o}=aC(`0`,{currency:t.currency}),s=a&&(0,b.jsx)(`span`,{className:`shrink-0 text-[13px] text-muted-foreground`,children:a});return(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`before`&&s,(0,b.jsx)(e_,{id:e,type:`text`,inputMode:`decimal`,dir:`ltr`,className:`text-end`,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),onBlur:()=>r(tC(n,t.scale)),...i}),o!==`before`&&s]})}function AD({id:e,checked:t,onChange:n,aria:r}){return(0,b.jsx)(`button`,{id:e,type:`button`,role:`switch`,"aria-checked":t,onClick:()=>n(!t),className:U(`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,t?`bg-primary`:`bg-input`),...r,children:(0,b.jsx)(`span`,{className:U(`block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-4 rtl:-translate-x-4`:`translate-x-0`)})})}function jD({id:e,field:t,value:n,onChange:r,aria:i,label:a,required:o}){let s=X(),c=(t.enumValues??[]).map(e=>[e,OD(t,e)]);return t.nullable&&!o&&c.unshift([``,s(`common.empty`)]),(0,b.jsxs)(`fieldset`,{id:e,className:`flex flex-col gap-1.5`,...i,children:[(0,b.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:a}),(0,b.jsx)(`div`,{role:`radiogroup`,className:`flex flex-wrap gap-x-4 gap-y-1.5`,children:c.map(([t,i])=>(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,b.jsx)(`input`,{type:`radio`,name:e,value:t,checked:n===t,onChange:()=>r(t),className:`size-4 accent-primary`}),i]},t))})]})}var MD=/^#[0-9a-f]{6}$/i;function ND({id:e,field:t,value:n,onChange:r,aria:i}){let a=X();return(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`color`,"aria-hidden":!0,tabIndex:-1,className:`h-8 w-10 shrink-0 cursor-pointer rounded-md border border-input bg-transparent p-0.5`,value:MD.test(n)?n.toLowerCase():`#000000`,onChange:e=>r(e.target.value)}),(0,b.jsx)(e_,{id:e,dir:`ltr`,value:n,placeholder:t.placeholder??`#000000`,"aria-label":a(`form.colorCode`,{name:t.label}),onChange:e=>r(e.target.value),...i})]})}function PD({id:e,field:t,value:n,onChange:r,aria:i}){let a=X(),[o,s]=(0,y.useState)(null),c=`${e}-json`;function l(){if(n.trim()!==``)try{r(JSON.stringify(JSON.parse(n),null,2)),s(null)}catch(e){s(e instanceof Error?e.message:String(e))}}let u=[i[`aria-describedby`],o?c:void 0].filter(Boolean).join(` `)||void 0;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(ED,{id:e,dir:`ltr`,rows:6,className:`font-mono`,spellCheck:!1,value:n,placeholder:t.placeholder,onChange:e=>{s(null),r(e.target.value)},...i,"aria-invalid":i[`aria-invalid`]??(o?!0:void 0),"aria-describedby":u}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:l,children:a(`form.formatJson`)}),o&&(0,b.jsx)(`p`,{id:c,className:`text-sm text-destructive`,children:o})]})]})}function FD({id:e,field:t,value:n,onChange:r,aria:i}){return(0,b.jsx)(ED,{id:e,rows:4,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),...i})}function ID({id:e,field:t,value:n,onChange:r,aria:i,...a}){return(0,b.jsx)(e_,{id:e,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),...a,...i})}var LD=(0,y.lazy)(()=>Za(()=>import(`./rich-text-input-C7t6OWlx.js`),__vite__mapDeps([0,1]),import.meta.url));function RD(e){let t=X();return(0,b.jsx)(y.Suspense,{fallback:(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`editor.loading`)}),children:(0,b.jsx)(LD,{...e})})}function zD({resource:e,field:t,value:n,required:r,errors:i,constraints:a,formValues:o,onChange:s,onBusy:c,idPrefix:l=`field`,parent:u,hideLabel:d,action:f}){let p=`${l}-${t.name}`,m=`${p}-error`,h=`${p}-help`,g=(i?.length??0)>0,_=[t.help?h:void 0,g?m:void 0].filter(Boolean).join(` `)||void 0,v={"aria-invalid":g?!0:void 0,"aria-describedby":_},y=typeof n==`string`?n:``,x=t.type===`relation`?void 0:DD(t,a),S=(0,b.jsxs)(b.Fragment,{children:[t.label,r&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`text-destructive`,children:`*`})]}),C=(0,b.jsx)(t_,{htmlFor:p,className:d?`sr-only`:void 0,children:S}),w=t.help?(0,b.jsx)(`p`,{id:h,className:`text-sm text-muted-foreground`,children:t.help}):null,T={id:p,field:t,value:y,onChange:e=>s(e),aria:v};if(t.type===`boolean`){let e=n===!0;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[x===`switch`?(0,b.jsx)(AD,{id:p,checked:e,onChange:s,aria:v}):(0,b.jsx)(`input`,{id:p,type:`checkbox`,className:`size-4 accent-primary`,checked:e,onChange:e=>s(e.target.checked),...v}),C]}),w,(0,b.jsx)(VD,{id:m,errors:i})]})}if(t.type===`enum`&&x===`radio`)return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(jD,{...T,label:S,required:r}),w,(0,b.jsx)(VD,{id:m,errors:i})]});let E;if(t.choices&&f)E=(0,b.jsx)(HD,{id:p,resource:e,action:f,field:t,value:y,onChange:s,aria:v});else if(t.type===`relation`)E=(0,b.jsx)(TD,{id:p,resource:e,field:t,value:n??null,onChange:s,clearable:t.nullable,values:o,parent:u,invalid:g,describedBy:_});else if(t.type===`enum`)E=(0,b.jsx)(Pw,{id:p,value:y,onValueChange:e=>s(e),placeholder:t.placeholder??`—`,options:[{value:``,label:t.placeholder??`—`},...(t.enumValues??[]).map(e=>({value:e,label:OD(t,e)}))],...v});else switch(x){case`file`:E=(0,b.jsx)(xD,{id:p,resource:e,field:t,value:n,onChange:s,onBusy:c,aria:v});break;case`image`:E=(0,b.jsx)(SD,{id:p,resource:e,field:t,value:n,onChange:s,onBusy:c,aria:v});break;case`richtext`:E=(0,b.jsx)(RD,{id:p,resource:e,field:t,value:y,onChange:s,onBusy:c,invalid:g,describedBy:_});break;case`money`:E=(0,b.jsx)(kD,{...T});break;case`date`:E=(0,b.jsx)(fw,{id:p,live:!0,value:y,label:t.label,onChange:e=>s(e),...v});break;case`datetime`:E=(0,b.jsx)(hw,{id:p,value:y,label:t.label,onChange:e=>s(e),...v});break;case`json`:E=(0,b.jsx)(PD,{...T});break;case`textarea`:E=(0,b.jsx)(FD,{...T});break;case`color`:E=(0,b.jsx)(ND,{...T});break;case`password`:E=(0,b.jsx)(ID,{...T,type:`password`,autoComplete:`new-password`});break;case`slug`:E=(0,b.jsx)(ID,{...T,dir:`ltr`,autoCapitalize:`none`,spellCheck:!1});break;default:E=(0,b.jsx)(ID,{...T,...BD(t,x)})}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[C,E,w,(0,b.jsx)(VD,{id:m,errors:i})]})}function BD(e,t){if(t===`email`||t===`url`)return{type:t};switch(e.type){case`number`:case`decimal`:return{type:`text`,inputMode:`decimal`};case`bigint`:return{type:`text`,inputMode:`numeric`};case`date`:return{type:`date`};case`datetime`:return{type:`datetime-local`};default:return{type:`text`}}}function VD({id:e,errors:t}){return t?.length?(0,b.jsx)(`p`,{id:e,className:`text-sm text-destructive`,children:t.join(` `)}):null}function HD({id:e,resource:t,action:n,field:r,value:i,onChange:a,aria:o}){let s=X(),c=Tv(t,n,r.name),l=c.data?.items??[],u=i!==``&&!l.some(e=>e.value===i)?[{value:i,label:i},...l]:l;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,b.jsx)(Pw,{id:e,value:i,disabled:c.isPending,"aria-busy":c.isPending||void 0,onValueChange:e=>a(e),placeholder:c.isPending?s(`common.loading`):r.placeholder??`—`,options:[{value:``,label:r.placeholder??`—`},...u],...o}),c.isError&&(0,b.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[s(`action.choicesFailed`,{error:z_(c.error)}),` `,(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void c.refetch(),children:s(`action.choicesRetry`)})]})]})}var UD={1:``,2:`md:grid-cols-2`,3:`md:grid-cols-2 lg:grid-cols-3`};function WD({layout:e,names:t,render:n,errors:r,renderInline:i,renderSummary:a,plain:o}){let s=e&&(i?e:JD(e)),c=new Set((s??[]).flatMap(e=>`tab`in e?e.sections:[e]).flatMap(e=>KD(e)||qD(e)?[]:e.fields)),l=t.filter(e=>!c.has(e)),u=(s??[]).filter(e=>`tab`in e),d=(s??[]).findIndex(e=>`tab`in e),f=d===-1?(s??[]).filter(e=>!(`tab`in e)):(s??[]).slice(0,d).filter(e=>!(`tab`in e)),p=d===-1?[]:(s??[]).slice(d).filter(e=>!(`tab`in e)),m=(e,t)=>KD(e)?(0,b.jsx)(y.Fragment,{children:i?.(e)},t):qD(e)?(0,b.jsx)(y.Fragment,{children:a?.(e)},t):(0,b.jsx)(GD,{section:e,render:n,plain:o},t);return(0,b.jsxs)(b.Fragment,{children:[f.map((e,t)=>m(e,`b${t}`)),u.length>0&&(0,b.jsx)(YD,{tabs:u,render:n,errors:r,block:m}),p.map((e,t)=>m(e,`a${t}`)),l.length>0&&(0,b.jsx)(GD,{section:{fields:l,columns:1},render:n,plain:o})]})}function GD({section:e,render:t,plain:n}){let r=(0,y.useId)(),i=e.fields.map(e=>[e,t(e)]).filter(([,e])=>e!==null);if(i.length===0)return null;let a=(0,b.jsx)(`div`,{className:U(`grid gap-5`,UD[e.columns]),children:i.map(([e,t])=>(0,b.jsx)(`div`,{className:`min-w-0`,children:t},e))});return n?e.title?(0,b.jsxs)(`section`,{"aria-labelledby":r,className:`flex flex-col gap-3`,children:[(0,b.jsx)(`h3`,{id:r,className:`text-[13px] font-semibold text-muted-foreground`,children:e.title}),a]}):a:e.title?(0,b.jsx)(uD,{"aria-labelledby":r,title:(0,b.jsx)(`span`,{id:r,children:e.title}),children:a}):(0,b.jsx)(uD,{bodyClassName:`p-5`,children:a})}var KD=e=>`inline`in e,qD=e=>`summary`in e;function JD(e){return e.filter(e=>!KD(e)&&!qD(e)).map(e=>`tab`in e?{...e,sections:e.sections.filter(e=>!KD(e)&&!qD(e))}:e)}function YD({tabs:e,render:t,errors:n,block:r}){let i=X(),{locale:a}=Y(),o=(0,y.useId)(),[s,c]=(0,y.useState)(0),l=(0,y.useRef)([]),u=e=>e.sections.some(e=>(KD(e)?[`_inlines.${e.inline}`]:qD(e)?[]:e.fields).some(e=>Object.keys(n).some(t=>t===e||t.startsWith(`${e}.`))));(0,y.useEffect)(()=>{if(u(e[s]))return;let t=e.findIndex(u);t!==-1&&c(t)},[n]);function d(t){let n=w_(a)?`ArrowLeft`:`ArrowRight`,r=w_(a)?`ArrowRight`:`ArrowLeft`,i;t.key===n?i=(s+1)%e.length:t.key===r?i=(s-1+e.length)%e.length:t.key===`Home`?i=0:t.key===`End`&&(i=e.length-1),i!==void 0&&(t.preventDefault(),c(i),l.current[i]?.focus())}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`div`,{role:`tablist`,className:`flex gap-0.5 overflow-x-auto border-b`,onKeyDown:d,children:e.map((e,t)=>(0,b.jsxs)(`button`,{ref:e=>{l.current[t]=e},id:`${o}-tab-${t}`,type:`button`,role:`tab`,"aria-selected":t===s,"aria-controls":`${o}-panel-${t}`,tabIndex:t===s?0:-1,onClick:()=>c(t),className:U(`-mb-px flex h-[38px] items-center gap-1.5 border-b-2 px-3 text-[13px] whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,t===s?`border-foreground font-semibold`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e.tab,u(e)&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-destructive`}),(0,b.jsx)(`span`,{className:`sr-only`,children:i(`form.tabHasErrors`)})]})]},t))}),e.map((e,t)=>(0,b.jsx)(`div`,{id:`${o}-panel-${t}`,role:`tabpanel`,"aria-labelledby":`${o}-tab-${t}`,hidden:t!==s,className:U(`flex-col gap-5`,t===s?`flex`:`hidden`),children:e.sections.map((e,t)=>r(e,String(t)))},t))]})}var XD=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{};function ZD({resource:e,field:t,path:n,pattern:r,value:i,constraints:a,markRequired:o,errors:s,onChange:c,idPrefix:l}){let u=X(),d=s[n];if(t.many){let f=Array.isArray(i)?i:[];return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,b.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:t.label}),f.map((i,d)=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-md border border-dashed p-3`,children:[(0,b.jsx)(QD,{resource:e,field:t,path:`${n}.${d}`,pattern:`${r}.*`,value:i,constraints:a,markRequired:o,errors:s,idPrefix:l,onChange:e=>c(f.map((t,n)=>n===d?e:t))}),(0,b.jsx)(`div`,{children:(0,b.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>c(f.filter((e,t)=>t!==d)),children:[(0,b.jsx)(AS,{}),u(`form.remove`,{name:t.label,index:d+1})]})})]},d)),(0,b.jsx)(`div`,{children:(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>c([...f,eD(t.fields??[])]),children:[(0,b.jsx)(Hx,{}),u(`form.add`,{name:t.label})]})}),d&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:d.join(` `)})]})}return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,b.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:t.label}),(0,b.jsx)(QD,{resource:e,field:t,path:n,pattern:r,value:XD(i),constraints:a,markRequired:o,errors:s,idPrefix:l,onChange:c}),d&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:d.join(` `)})]})}function QD({resource:e,field:t,path:n,pattern:r,value:i,constraints:a,markRequired:o,errors:s,onChange:c,idPrefix:l}){return(0,b.jsx)(b.Fragment,{children:(t.fields??[]).filter(e=>!e.readonly).map(t=>{let u=`${n}.${t.name}`,d=`${r}.${t.name}`,f=e=>c({...i,[t.name]:e});return t.type===`object`?(0,b.jsx)(ZD,{resource:e,field:t,path:u,pattern:d,value:i[t.name],constraints:a,markRequired:o,errors:s,idPrefix:l,onChange:f},t.name):(0,b.jsx)(zD,{resource:e,field:{...t,name:u},value:i[t.name],required:o&&a[d]?.required===!0,errors:s[u],constraints:a[d],idPrefix:l,onChange:f},t.name)})})}function $D(e,t){let n=t?._perm?.actions;return e.actions.filter(e=>e.target===`record`&&(n===void 0||typeof n[e.name]==`string`)).map(e=>n?.[e.name]?{...e,label:n[e.name]}:e)}function eO(e,t){let n=$D(e,t),r=n.find(e=>e.primary),i=n.filter(e=>e!==r);return{...r?{primary:r}:{},buttons:i.slice(0,3),overflow:i.slice(3)}}function tO(e,t){let n=e.actions.filter(e=>e.target===`record`&&e.bulk);return t.length===0?n:n.filter(n=>t.some(t=>$D(e,t).some(e=>e.name===n.name)))}function nO(e){return e.actions.filter(e=>e.target===`resource`)}function rO(e,t=0){return e.confirm!==void 0||e.variant===`destructive`||t>1}function iO(e,t=0){return!e.input&&!rO(e,t)}function aO(e,t,n,r){if(rO(e,t))return typeof e.confirm==`string`?e.confirm:t>1?r(`action.confirmSelected`,{action:e.label,count:t}):n===void 0?r(`action.confirm`,{action:e.label}):r(`action.confirmRecord`,{action:e.label,name:n})}function oO(e){let t=e.message===void 0?{}:{message:e.message};return`record`in e?{kind:`record`,record:e.record,...t}:`ok`in e&&`failed`in e?{kind:`bulk`,result:{ok:e.ok,failed:e.failed},...t}:{kind:`resource`,...t}}function sO(e,t){return e.kind===`bulk`?e.result:{ok:t,failed:[]}}function cO(e,t){if(!(e instanceof R_))return{fields:{},form:e.message};let n=Object.entries(e.fields),r=e=>t.includes(e.split(`.`)[0]),i=Object.fromEntries(n.filter(([e])=>r(e))),a=n.filter(([e])=>!r(e)).map(([e,t])=>`${e}: ${t.join(`, `)}`);return{fields:i,form:Object.keys(i).length>0&&a.length===0?null:[e.message,...a].join(` — `)}}var lO=/\{([^{}]*)\}/g;function uO(e,t){let n=!1,r=e.replace(lO,(e,r)=>{let i=t[r],a=typeof i==`string`?i.trim():typeof i==`boolean`?String(i):``;return a===``&&(n=!0),a});return n?``:r}function dO(e,t){return new Set(e.filter(e=>e.fillFrom!==void 0&&t[e.name]!==``&&t[e.name]!==void 0).map(e=>e.name))}function fO(e,t,n){let r=e.filter(e=>e.fillFrom!==void 0&&!n.has(e.name));if(r.length===0)return t;let i=t;for(let e=0;e<=r.length;e++){let e=!1;for(let n of r){let r=uO(n.fillFrom,i);i[n.name]!==r&&(i===t&&(i={...t}),i[n.name]=r,e=!0)}if(!e)break}return i}function pO(e,t,n,r){e.some(e=>e.name===n&&e.fillFrom!==void 0)&&(r===``||r===null?t.delete(n):t.add(n))}function mO(e,t){let n=UE(e)?String(e.id):e;return t===null?n==null||n===``:typeof t==`boolean`?n===t||n===String(t):typeof n!=`string`||n.trim()===``?!1:typeof t==`number`?Number(a_(n).trim().replace(/,/g,``))===t:n===t}function hO(e,t){return!e.showIf||Object.entries(e.showIf).every(([e,n])=>(Array.isArray(n)?n:[n]).some(n=>mO(t[e],n)))}var gO=/^.+@[^\s@]+\.[^\s@]+$/,_O=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function vO(e){if(/\s/.test(e))return!1;try{let{hostname:t}=new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(e)?e:`http://${e}`);return t.includes(`.`)||t.startsWith(`[`)}catch{return!1}}function yO(e,t){try{return new RegExp(t.source,t.flags).test(e)}catch{return!0}}function bO(e){let t=e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)??[],n=e.match(/[^\uFE0F\uFE0E][\uFE0F\uFE0E]/g)??[];return e.length-t.length-n.length}function xO(e,t){let n=[];if(typeof e==`string`){let r=bO(e);t.minLength!==void 0&&r<t.minLength&&n.push(J(`validation.minLength`,{min:t.minLength})),t.maxLength!==void 0&&r>t.maxLength&&n.push(J(`validation.maxLength`,{max:t.maxLength})),t.pattern&&!yO(e,t.pattern)&&n.push(t.pattern.message??J(`validation.pattern`)),t.format===`email`&&!gO.test(e)&&n.push(J(`validation.email`)),t.format===`url`&&!vO(e)&&n.push(J(`validation.url`)),t.format===`uuid`&&!_O.test(e)&&n.push(J(`validation.uuid`)),t.oneOf&&!t.oneOf.includes(e)&&n.push(J(`validation.oneOf`,{values:t.oneOf.join(`, `)}))}return typeof e==`number`&&(t.integer&&!Number.isInteger(e)&&n.push(J(`validation.integer`)),t.min!==void 0&&e<t.min&&n.push(J(`validation.min`,{min:t.min})),t.max!==void 0&&e>t.max&&n.push(J(`validation.max`,{max:t.max}))),n}function SO(e,t,n){let r={};for(let[i,a]of Object.entries(t))for(let{path:t,value:o,sent:s,parentSent:c}of CO(e,i.split(`.`))){if(o==null||o===``){a.required&&c&&(n===`create`||s)&&(r[t]=[J(`validation.required`)]);continue}let e=xO(o,a);e.length>0&&(r[t]=e)}return r}function CO(e,t,n=``,r=!0){let[i,...a]=t,o=typeof e==`object`&&e?e:void 0;if(i===`*`)return(Array.isArray(e)?e:[]).flatMap((e,t)=>CO(e,a,`${n}${t}.`,!0));let s=o!==void 0&&Object.hasOwn(o,i),c=o?.[i],l=`${n}${i}`;return a.length===0?[{path:l,value:c,sent:s,parentSent:r}]:CO(c,a,`${l}.`,r&&s)}function wO({resource:e,action:t,count:n,subject:r,running:i,error:a,onRun:o,onClose:s}){let c=X(),l=t.input?.fields??[],u=(0,y.useRef)(new Set),[d,f]=(0,y.useState)(()=>fO(l,eD(l),u.current)),[p,m]=(0,y.useState)({}),[h,g]=(0,y.useState)(!1),_=l.filter(e=>hO(e,d)),v=a&&!h?cO(a,l.map(e=>e.name)):{fields:{},form:null},x={...v.fields,...p};function S(e){if(e.preventDefault(),e.stopPropagation(),!t.input)return o(void 0);let{payload:n,errors:r}=nD(_,d),i={...SO(n,Object.fromEntries(Object.entries(t.input.constraints).filter(([e])=>_.some(t=>t.name===e.split(`.`)[0]))),`create`),...r};m(i),g(Object.keys(i).length>0),Object.keys(i).length===0&&o(n)}let C=aO(t,n,r,c);function w(n){let r=_.find(e=>e.name===n);if(!r||!t.input)return null;let i=e=>{pO(l,u.current,n,e),f(t=>fO(l,{...t,[n]:e},u.current))};return r.type===`object`?(0,b.jsx)(ZD,{resource:e,field:r,path:n,pattern:n,value:d[n],constraints:t.input.constraints,markRequired:!0,errors:x,idPrefix:`action`,onChange:i}):(0,b.jsx)(zD,{resource:e,field:r,value:d[n],required:t.input.required.includes(n),errors:x[n],constraints:t.input.constraints[n],idPrefix:`action`,action:t.name,onChange:i})}return(0,b.jsx)(Yd,{open:!0,onOpenChange:e=>!e&&!i&&s(),children:(0,b.jsxs)(tf,{children:[(0,b.jsx)(rf,{className:aT}),(0,b.jsx)(cf,{"aria-describedby":C?`action-question`:void 0,className:`fixed inset-x-3 top-[12vh] z-50 mx-auto flex max-h-[76vh] max-w-lg flex-col overflow-hidden rounded-xl border bg-background shadow-xl outline-none`,children:(0,b.jsxs)(`form`,{onSubmit:S,noValidate:!0,className:`flex min-h-0 flex-col`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-4 overflow-y-auto p-4`,children:[(0,b.jsx)(pf,{className:`text-lg font-semibold`,children:t.label}),C&&(0,b.jsx)(`p`,{id:`action-question`,className:`text-sm`,children:C}),n>1&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(t.atomic?`action.atomicNote`:`action.eachNote`,{count:n})}),v.form&&(0,b.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:v.form}),t.input&&(0,b.jsx)(WD,{layout:void 0,names:l.map(e=>e.name),errors:x,render:w})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t p-4`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:i,onClick:s,children:c(`common.cancel`)}),(0,b.jsx)(q,{type:`submit`,variant:t.variant===`destructive`?`destructive`:`default`,disabled:i,children:i?c(`action.running`):t.label})]})]})})]})})}function TO({resource:e,action:t,ids:n,subject:r,size:i=`default`,className:a,primary:o=!1,menuItem:s=!1,blocked:c=!1,describedBy:l,onDone:u}){let d=X(),f=S(),[p,m]=(0,y.useState)(!1),h=iO(t,n?.length??0),g=pt({mutationFn:r=>Q.runAction(e,t.name,{...n?{ids:n}:{},...r?{input:r}:{}}),onSuccess:r=>{let i=oO(r);m(!1),i.kind===`bulk`?i.message&>(i.message):GT(i.message??d(i.kind===`record`&&i.record===null?`action.doneGone`:`action.done`,{action:t.label})),u(i,n??[]);for(let t of[`list`,`count`,`record`,`history`])f.invalidateQueries({queryKey:[t,e]})},onError:e=>{h&>(z_(e),`error`)}}),_=LT(t.icon);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(q,{type:`button`,size:i,variant:t.variant===`destructive`?`destructive`:o?`default`:s?`ghost`:`outline`,className:U(s&&`w-full justify-start font-normal`,a),disabled:c||g.isPending,"aria-describedby":l,"data-action":t.name,onClick:()=>{g.reset(),h?g.mutate(void 0):m(!0)},children:[_&&(0,b.jsx)(_,{"aria-hidden":!0}),t.label,o&&(0,b.jsx)(Qy,{className:`ltr:rotate-180`,"aria-hidden":!0})]}),p&&(0,b.jsx)(wO,{resource:e,action:t,count:n?.length??0,subject:r,running:g.isPending,error:g.error,onRun:e=>g.mutate(e),onClose:()=>m(!1)})]})}function EO({schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a}){let o=X(),s=S(),[c,l]=(0,y.useState)(!1),{primary:u,buttons:d,overflow:f}=eO(e,t);if(!u&&d.length===0)return null;let p=`record-actions-note`,m=(o,c={})=>(0,b.jsx)(TO,{resource:e.name,action:o,ids:[n],subject:typeof t._title==`string`?t._title:`#${n}`,blocked:r,describedBy:r?p:void 0,...c,onDone:t=>{l(!1);let r=t.kind===`record`?t.record:void 0;if(r===null){i(),s.removeQueries({queryKey:[`record`,e.name,n]});return}r&&s.setQueryData([`record`,e.name,n],r),a()}},o.name);return(0,b.jsxs)(`div`,{role:`group`,"aria-label":o(`list.actions`),className:`ms-auto flex flex-wrap items-center gap-2`,children:[r&&(0,b.jsx)(`span`,{id:p,className:`text-xs text-muted-foreground`,children:o(`action.saveFirst`)}),d.map(e=>m(e)),f.length>0&&(0,b.jsxs)(Kh,{open:c,onOpenChange:l,children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`icon`,"aria-label":o(`action.more`),children:(0,b.jsx)(Sb,{})})}),(0,b.jsx)(Jh,{forceMount:!0,children:(0,b.jsx)(Yh,{forceMount:!0,align:`end`,sideOffset:6,className:`z-50 flex min-w-48 flex-col gap-0.5 rounded-[10px] border bg-popover p-1.5 shadow-lg data-[state=closed]:hidden`,onClick:()=>l(!1),children:f.map(e=>m(e,{menuItem:!0}))})})]}),u&&m(u,{primary:!0})]})}function DO({schema:e,ids:t,bulkOnly:n=!1,size:r=`default`}){let i=X(),a=(e.prints??[]).filter(e=>!n||e.bulk);return t.length===0||a.length===0?null:(0,b.jsx)(b.Fragment,{children:a.map(n=>{let a=LT(n.icon)??Wx;return(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:r,"aria-label":i(`print.open`,{name:n.label}),onClick:()=>window.open(mv(e.name,n.name,t),`_blank`,`noopener`),children:[(0,b.jsx)(a,{}),n.label]},n.name)})})}function OO({schema:e,query:t,iconOnly:n=!1}){let r=X(),[i,a]=(0,y.useState)(!1);if(!e.list.export)return null;async function o(){a(!0);try{let{blob:n,filename:i,truncated:a}=await Q.exportList(e.name,t),o=URL.createObjectURL(n),s=document.createElement(`a`);s.href=o,s.download=i,s.click(),setTimeout(()=>URL.revokeObjectURL(o),1e4),GT(a?r(`list.exportTruncated`,{count:a}):r(`list.exportDone`,{file:i}),a?`error`:`success`)}catch(e){GT(z_(e),`error`)}finally{a(!1)}}return(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:n?`icon`:`default`,disabled:i,"aria-label":n?r(`list.export`):void 0,onClick:()=>void o(),children:[(0,b.jsx)(Ob,{}),!n&&r(i?`list.exporting`:`list.export`)]})}function kO(e,t,n){return e<=0?-1:t<0?n?e-1:0:(t+(n?-1:1)+e)%e}var AO=`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`,jO=[],MO=null;function NO(){let e=document.getElementById(`root`),t=document.documentElement,n={overflow:document.body.style.overflow,gutter:t.style.scrollbarGutter,inert:e?.hasAttribute(`inert`)??!1};document.body.style.overflow=`hidden`,t.style.scrollbarGutter=`stable`,e?.setAttribute(`inert`,``),MO=()=>{document.body.style.overflow=n.overflow,t.style.scrollbarGutter=n.gutter,n.inert||e?.removeAttribute(`inert`)}}function PO({labelledBy:e,describedBy:t,onDismiss:n,initialFocus:r,className:i,children:a}){let o=(0,y.useRef)(null),s=(0,y.useRef)(n);return s.current=n,(0,y.useEffect)(()=>{let e=Symbol(`alert`),t=document.activeElement instanceof HTMLElement?document.activeElement:null;jO.length===0&&NO(),jO.push(e),((r?o.current?.querySelector(r):null)??o.current?.querySelector(AO)??o.current)?.focus();let n=t=>{if(jO[jO.length-1]===e&&o.current){if(t.key===`Escape`&&s.current)t.preventDefault(),t.stopPropagation(),s.current();else if(t.key===`Tab`){t.preventDefault();let e=[...o.current.querySelectorAll(AO)];(e[kO(e.length,e.indexOf(document.activeElement),t.shiftKey)]??o.current).focus()}}};return document.addEventListener(`keydown`,n,!0),()=>{document.removeEventListener(`keydown`,n,!0),jO.splice(jO.indexOf(e),1),jO.length===0&&(MO?.(),MO=null),t?.isConnected&&jO.length===0&&t.focus()}},[r]),(0,Dc.createPortal)((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{"data-testid":`alert-backdrop`,"aria-hidden":!0,className:aT,onClick:()=>s.current?.()}),(0,b.jsx)(`div`,{ref:o,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":e,"aria-describedby":t,"data-state":`open`,tabIndex:-1,className:U(`fixed inset-x-3 top-[12vh] z-50 mx-auto max-h-[76vh] max-w-lg overflow-y-auto rounded-card border border-amber-500/50 bg-background p-4 shadow-xl outline-none motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-2 motion-safe:duration-150`,i),children:a})]}),document.body)}function FO(e){let t=(0,y.useRef)(!1),n=ga(({currentLocation:n,nextLocation:r})=>e&&!t.current&&(n.pathname!==r.pathname||n.search!==r.search));return(0,y.useEffect)(()=>{if(!e)return;let t=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,t),()=>window.removeEventListener(`beforeunload`,t)},[e]),{blocker:n,release:()=>{t.current=!0}}}function IO({blocker:e}){let t=X();return e.state===`blocked`?(0,b.jsxs)(PO,{labelledBy:`leave-title`,onDismiss:()=>e.reset(),className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`p`,{id:`leave-title`,className:`min-w-0 flex-1 basis-full text-sm font-medium sm:basis-0`,children:t(`form.leaveTitle`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>e.reset(),children:t(`form.stay`)}),(0,b.jsx)(q,{type:`button`,variant:`destructive`,onClick:()=>e.proceed(),children:t(`form.leave`)})]}):null}function LO(e,t){let n=(0,y.useRef)(t);n.current=t,(0,y.useEffect)(()=>{let t=t=>{if(!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()!==`s`)return;t.preventDefault();let r=document.querySelector(`[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]`);(!r||r.contains(e.current))&&(n.current?.(),e.current?.requestSubmit())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function RO(e){let[t,n]=(0,y.useState)([]),[r,i]=(0,y.useState)(!1),a=(0,y.useRef)(e);return a.current=e,(0,y.useEffect)(()=>{t.length>0||!r||(i(!1),a.current())},[t.length,r]),{busy:t.length>0,setBusy:(e,t)=>n(n=>t===n.includes(e)?n:t?[...n,e]:n.filter(t=>t!==e)),refuse:()=>i(!0)}}function zO({dirty:e,children:t}){let n=X();return(0,b.jsxs)(`div`,{className:`sticky bottom-3 z-10 flex flex-wrap items-center gap-2 rounded-card border bg-card px-4 py-2.5 shadow-[0_12px_32px_rgba(0,0,0,.12)]`,children:[e&&(0,b.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-[13px] font-semibold`,children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full bg-amber-500`}),n(`form.unsaved`)]}),(0,b.jsx)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:t})]})}function BO(){let e=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform);return(0,b.jsx)(`kbd`,{"aria-hidden":!0,className:`rounded border border-current/30 px-1 font-sans text-[10.5px] opacity-80`,children:e?`⌘S`:`Ctrl S`})}var VO=`—`,HO=e=>e==null||e===``;function UO(e,t){let n=t?.value;switch(e.kind){case`image`:return typeof n==`string`&&n!==``?{kind:`image`,src:n}:{kind:`image`};case`toggle`:return{kind:`toggle`,on:n===!0};case`money`:{if(HO(n))return{kind:`money`,text:VO};let e=aC(String(n),HO(t?.previous)?{}:{previous:String(t.previous)});return{kind:`money`,text:e.main,...e.unit?{unit:e.unit,unitPosition:e.position}:{},...e.previous===void 0?{}:{previous:e.previous}}}case`badge`:return{kind:`badge`,text:t?.label??(HO(n)?VO:String(n)),...t?.tone?{tone:t.tone}:{}};case`count`:return{kind:`count`,text:typeof n==`number`?E_(n):HO(n)?VO:D_(String(n))};case`title`:return{kind:`title`,text:HO(n)?VO:String(n),...HO(t?.subline)?{}:{subline:String(t.subline)}}}}function WO({schema:e,name:t,column:n,item:r,compact:i=!1}){let a=r._computed?.[t],o=UO(n,a);switch(o.kind){case`image`:return(0,b.jsx)(`span`,{className:U(`flex shrink-0 items-center justify-center overflow-hidden rounded-control border bg-muted text-muted-foreground`,i?`size-14`:`size-10`),children:o.src?(0,b.jsx)(`img`,{src:o.src,alt:``,className:`size-full object-cover`,loading:`lazy`}):(0,b.jsx)(Kb,{className:`size-[18px]`,"aria-hidden":!0})});case`title`:return(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-col leading-[1.45]`,children:[(0,b.jsx)(`span`,{className:U(`truncate font-semibold`,i?`text-[14.5px]`:`text-[13.5px]`),children:o.text}),o.subline&&(0,b.jsx)(`span`,{className:`truncate text-start font-mono text-[11.5px] text-muted-foreground`,children:(0,b.jsx)(`bdi`,{dir:`ltr`,children:o.subline})})]});case`money`:return(0,b.jsxs)(`span`,{className:`flex flex-col leading-[1.4]`,children:[(0,b.jsxs)(`span`,{className:`font-semibold whitespace-nowrap`,children:[o.unit&&o.unitPosition===`before`&&(0,b.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[o.unit,` `]}),o.text,o.unit&&o.unitPosition!==`before`&&(0,b.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[` `,o.unit]})]}),o.previous&&(0,b.jsx)(`s`,{className:`text-xs text-muted-foreground`,children:o.previous})]});case`badge`:return(0,b.jsx)(aD,{tone:o.tone,children:o.text});case`count`:return(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:o.text});case`toggle`:return(0,b.jsx)(GO,{schema:e,column:n,item:r,on:o.on===!0})}}function GO({schema:e,column:t,item:n,on:r}){let i=X(),a=S(),[o,s]=(0,y.useState)(r),c=t.toggle,l=c!==void 0&&n._perm?.update!==!1&&!(Array.isArray(n._readonly)&&n._readonly.includes(c.field)),u=pt({mutationFn:t=>Q.update(e.name,String(n._id),{[c.field]:t?c.on:c.off},e.version?n[e.version]:void 0),onSuccess:()=>a.invalidateQueries({queryKey:[`list`,e.name]}),onError:e=>{s(r),GT(z_(e),`error`)}}),d=typeof n._title==`string`?n._title:String(n._id);return(0,b.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":o,"aria-label":i(`list.toggleRow`,{column:t.label,name:d}),disabled:!l||u.isPending,onClick:e=>{e.preventDefault(),e.stopPropagation(),s(!o),u.mutate(!o)},className:U(`relative inline-block h-5 w-9 shrink-0 cursor-pointer rounded-full bg-input transition-colors disabled:cursor-default disabled:opacity-60`,o&&`bg-primary`,`after:absolute after:top-0.5 after:size-4 after:rounded-full after:bg-white after:shadow-sm after:transition-[inset-inline-start] after:content-[''] after:start-0.5`,o&&`after:start-[18px]`)})}function KO(e){let t=e.form.layout;return t?t.flatMap(e=>`tab`in e?e.sections:[e]).flatMap(e=>`fields`in e&&!(`inline`in e)?e.fields:[]):[...new Set([...e.form.update,...e.form.readonly])]}function qO(e){let t=(e.form.layout??[]).flatMap(e=>`tab`in e?e.sections:[e]).flatMap(e=>`summary`in e?e.summary.flatMap(e=>`field`in e.value?[e.value.field]:[]):[]),n=(e.form.aside??[]).flatMap(e=>e.relation?[e.relation.field]:e.fields),r=[...e.form.header?.badges??[],...(e.form.header?.subtitle??[]).flatMap(e=>`field`in e?[e.field]:[])],i=new Set(e.form.update);return new Set([...t,...n,...r].filter(e=>!i.has(e)))}function JO(e,t,n){let r=e.form.mode===`view`&&t!==void 0&&!n,i=new Set(KO(e)),a=r?[]:e.form.update.filter(t=>i.has(t)||!e.form.layout),o=e.form.header,s=t=>e.fields.find(e=>e.name===t),c=e=>e!==void 0&&t?.[e.name]!==void 0&&t?.[e.name]!==null,l=(o?.badges?o.badges.map(s):e.fields.filter(e=>e.widget===`badge`)).filter(c),u=o?.stepper?s(o.stepper):void 0;u&&c(u)&&u.steps?.exclude.includes(String(t[u.name]))&&!l.includes(u)&&l.push(u);let d=t?._computed??{};return{editable:a,header:{badges:l,subtitle:(o?.subtitle??[]).flatMap(n=>{if(`field`in n){let e=s(n.field);return e&&c(e)?[sC(t[e.name],e)]:[]}let r=e.list.computed?.[n.computed];if(!r||!d[n.computed])return[];let i=UO(r,d[n.computed]);return i.text?[r.kind===`count`?`${i.text} ${r.label}`:i.text]:[]}),...u?{stepper:u}:{}},aside:e.form.aside??[]}}function YO(e,t,n){return e.relation?n?._aside?.[String(t)]:n}function XO(e,t,n){let r=n?._computed??{};return e.summary.flatMap(e=>{if(`field`in e.value){let r=t.fields.find(t=>t.name===e.value.field),i=n?.[e.value.field];return r&&i!=null?[{label:e.label,text:sC(i,r)}]:[]}let i=t.list.computed?.[e.value.computed],a=r[e.value.computed];if(!i||!a)return[];let o=UO(i,a),s=o.unit?o.unitPosition===`before`?`${o.unit} ${o.text}`:`${o.text} ${o.unit}`:o.text;return s?[{label:e.label,text:s}]:[]})}function ZO(e,t){let n={};for(let r of e){if(!r.warnIf||!(r.name in t))continue;let e=t[r.name];(e==null||typeof e==`string`&&e.trim()===``)&&(n[r.name]=r.warnIf.message)}return n}function QO(e,t){return e.fields.filter(t=>t!==e.order).flatMap(e=>t.fields.filter(t=>t.name===e))}function $O(e,t,n){let r=n?._inlines?.[e.inline],i=QO(e,t);return(r?.rows??[]).map(e=>({key:String(e._id),id:String(e._id),record:e,values:eD(i,e)}))}function ek(e,t,n){return{key:n,values:eD(QO(e,t))}}function tk(e,t){if(!e.record)return new Set;let n=e.record._perm;if(t.permissions?.update===!1||n?.update===!1)return new Set(t.fields.map(e=>e.name));let r=Array.isArray(e.record._readonly)?e.record._readonly:[];return new Set([...t.form.readonly,...r])}function nk(e,t,n,r){let i=QO(e,t),a={},o=[],s=[],c=new Map(n.map(e=>[e.key,e]));for(let e of r){let n=c.get(e.key);if(n?.id!==void 0){let r=tk(e,t),{payload:o,errors:c}=nD(i.filter(e=>!r.has(e.name)),e.values,n.values),l={...SO(o,t.form.constraints.update,`update`),...c};if(Object.keys(l).length>0&&(a[e.key]=l),Object.keys(o).length===0)continue;let u=t.version?n.record?.[t.version]:void 0;s.push({_id:n.id,...o,...typeof u==`number`?{_version:u}:{}})}else{let{payload:n,errors:r}=nD(i,e.values),s={...SO(n,t.form.constraints.create,`create`),...r};Object.keys(s).length>0&&(a[e.key]=s),o.push({_key:e.key,...n})}}let l=new Set(r.map(e=>e.key)),u=n.filter(e=>e.id!==void 0&&!l.has(e.key)).map(e=>e.id),d=e.order!==void 0&&t.form.update.includes(e.order),f=r.map(e=>e.key),p=d&&f.join(`
|
|
52
|
+
`}return f.substring(0,f.length-1)},c.renderTo2dContext=function(e,t){t||=2;let n=c.getModuleCount();for(let r=0;r<n;r++)for(let i=0;i<n;i++)e.fillStyle=c.isDark(r,i)?`black`:`white`,e.fillRect(i*t,r*t,t,t)},c};Mv.stringToBytes=function(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);t.push(r&255)}return t},Mv.createStringToBytes=function(e,t){let n=function(){let n=qv(e),r=function(){let e=n.read();if(e==-1)throw`eof`;return e},i=0,a={};for(;;){let e=n.read();if(e==-1)break;let t=r(),o=r(),s=r(),c=String.fromCharCode(e<<8|t);a[c]=o<<8|s,i+=1}if(i!=t)throw i+` != `+t;return a}();return function(e){let t=[];for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);if(i<128)t.push(i);else{let i=n[e.charAt(r)];typeof i==`number`?(i&255)==i?t.push(i):(t.push(i>>>8),t.push(i&255)):t.push(63)}}return t}};var Nv={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Pv={L:1,M:0,Q:3,H:2},Fv={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Iv=function(){let e=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],t=1335,n=7973,r={},i=function(e){let t=0;for(;e!=0;)t+=1,e>>>=1;return t};return r.getBCHTypeInfo=function(e){let n=e<<10;for(;i(n)-i(t)>=0;)n^=t<<i(n)-i(t);return(e<<10|n)^21522},r.getBCHTypeNumber=function(e){let t=e<<12;for(;i(t)-i(n)>=0;)t^=n<<i(t)-i(n);return e<<12|t},r.getPatternPosition=function(t){return e[t-1]},r.getMaskFunction=function(e){switch(e){case Fv.PATTERN000:return function(e,t){return(e+t)%2==0};case Fv.PATTERN001:return function(e,t){return e%2==0};case Fv.PATTERN010:return function(e,t){return t%3==0};case Fv.PATTERN011:return function(e,t){return(e+t)%3==0};case Fv.PATTERN100:return function(e,t){return(Math.floor(e/2)+Math.floor(t/3))%2==0};case Fv.PATTERN101:return function(e,t){return e*t%2+e*t%3==0};case Fv.PATTERN110:return function(e,t){return(e*t%2+e*t%3)%2==0};case Fv.PATTERN111:return function(e,t){return(e*t%3+(e+t)%2)%2==0};default:throw`bad maskPattern:`+e}},r.getErrorCorrectPolynomial=function(e){let t=Rv([1],0);for(let n=0;n<e;n+=1)t=t.multiply(Rv([1,Lv.gexp(n)],0));return t},r.getLengthInBits=function(e,t){if(1<=t&&t<10)switch(e){case Nv.MODE_NUMBER:return 10;case Nv.MODE_ALPHA_NUM:return 9;case Nv.MODE_8BIT_BYTE:return 8;case Nv.MODE_KANJI:return 8;default:throw`mode:`+e}else if(t<27)switch(e){case Nv.MODE_NUMBER:return 12;case Nv.MODE_ALPHA_NUM:return 11;case Nv.MODE_8BIT_BYTE:return 16;case Nv.MODE_KANJI:return 10;default:throw`mode:`+e}else if(t<41)switch(e){case Nv.MODE_NUMBER:return 14;case Nv.MODE_ALPHA_NUM:return 13;case Nv.MODE_8BIT_BYTE:return 16;case Nv.MODE_KANJI:return 12;default:throw`mode:`+e}else throw`type:`+t},r.getLostPoint=function(e){let t=e.getModuleCount(),n=0;for(let r=0;r<t;r+=1)for(let i=0;i<t;i+=1){let a=0,o=e.isDark(r,i);for(let n=-1;n<=1;n+=1)if(!(r+n<0||t<=r+n))for(let s=-1;s<=1;s+=1)i+s<0||t<=i+s||(n!=0||s!=0)&&o==e.isDark(r+n,i+s)&&(a+=1);a>5&&(n+=3+a-5)}for(let r=0;r<t-1;r+=1)for(let i=0;i<t-1;i+=1){let t=0;e.isDark(r,i)&&(t+=1),e.isDark(r+1,i)&&(t+=1),e.isDark(r,i+1)&&(t+=1),e.isDark(r+1,i+1)&&(t+=1),(t==0||t==4)&&(n+=3)}for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(r,i)&&!e.isDark(r,i+1)&&e.isDark(r,i+2)&&e.isDark(r,i+3)&&e.isDark(r,i+4)&&!e.isDark(r,i+5)&&e.isDark(r,i+6)&&(n+=40);for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(i,r)&&!e.isDark(i+1,r)&&e.isDark(i+2,r)&&e.isDark(i+3,r)&&e.isDark(i+4,r)&&!e.isDark(i+5,r)&&e.isDark(i+6,r)&&(n+=40);let r=0;for(let n=0;n<t;n+=1)for(let i=0;i<t;i+=1)e.isDark(i,n)&&(r+=1);let i=Math.abs(100*r/t/t-50)/5;return n+=i*10,n},r}(),Lv=function(){let e=Array(256),t=Array(256);for(let t=0;t<8;t+=1)e[t]=1<<t;for(let t=8;t<256;t+=1)e[t]=e[t-4]^e[t-5]^e[t-6]^e[t-8];for(let n=0;n<255;n+=1)t[e[n]]=n;let n={};return n.glog=function(e){if(e<1)throw`glog(`+e+`)`;return t[e]},n.gexp=function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return e[t]},n}(),Rv=function(e,t){if(e.length===void 0)throw e.length+`/`+t;let n=function(){let n=0;for(;n<e.length&&e[n]==0;)n+=1;let r=Array(e.length-n+t);for(let t=0;t<e.length-n;t+=1)r[t]=e[t+n];return r}(),r={};return r.getAt=function(e){return n[e]},r.getLength=function(){return n.length},r.multiply=function(e){let t=Array(r.getLength()+e.getLength()-1);for(let n=0;n<r.getLength();n+=1)for(let i=0;i<e.getLength();i+=1)t[n+i]^=Lv.gexp(Lv.glog(r.getAt(n))+Lv.glog(e.getAt(i)));return Rv(t,0)},r.mod=function(e){if(r.getLength()-e.getLength()<0)return r;let t=Lv.glog(r.getAt(0))-Lv.glog(e.getAt(0)),n=Array(r.getLength());for(let e=0;e<r.getLength();e+=1)n[e]=r.getAt(e);for(let r=0;r<e.getLength();r+=1)n[r]^=Lv.gexp(Lv.glog(e.getAt(r))+t);return Rv(n,0).mod(e)},r},zv=function(){let e=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t=function(e,t){let n={};return n.totalCount=e,n.dataCount=t,n},n={},r=function(t,n){switch(n){case Pv.L:return e[(t-1)*4+0];case Pv.M:return e[(t-1)*4+1];case Pv.Q:return e[(t-1)*4+2];case Pv.H:return e[(t-1)*4+3];default:return}};return n.getRSBlocks=function(e,n){let i=r(e,n);if(i===void 0)throw`bad rs block @ typeNumber:`+e+`/errorCorrectionLevel:`+n;let a=i.length/3,o=[];for(let e=0;e<a;e+=1){let n=i[e*3+0],r=i[e*3+1],a=i[e*3+2];for(let e=0;e<n;e+=1)o.push(t(r,a))}return o},n}(),Bv=function(){let e=[],t=0,n={};return n.getBuffer=function(){return e},n.getAt=function(t){let n=Math.floor(t/8);return(e[n]>>>7-t%8&1)==1},n.put=function(e,t){for(let r=0;r<t;r+=1)n.putBit((e>>>t-r-1&1)==1)},n.getLengthInBits=function(){return t},n.putBit=function(n){let r=Math.floor(t/8);e.length<=r&&e.push(0),n&&(e[r]|=128>>>t%8),t+=1},n},Vv=function(e){let t=Nv.MODE_NUMBER,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+2<t.length;)e.put(i(t.substring(r,r+3)),10),r+=3;r<t.length&&(t.length-r==1?e.put(i(t.substring(r,r+1)),4):t.length-r==2&&e.put(i(t.substring(r,r+2)),7))};let i=function(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*10+a(e.charAt(n));return t},a=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;throw`illegal char :`+e};return r},Hv=function(e){let t=Nv.MODE_ALPHA_NUM,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+1<t.length;)e.put(i(t.charAt(r))*45+i(t.charAt(r+1)),11),r+=2;r<t.length&&e.put(i(t.charAt(r)),6)};let i=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;if(`A`<=e&&e<=`Z`)return e.charCodeAt(0)-65+10;switch(e){case` `:return 36;case`$`:return 37;case`%`:return 38;case`*`:return 39;case`+`:return 40;case`-`:return 41;case`.`:return 42;case`/`:return 43;case`:`:return 44;default:throw`illegal char :`+e}};return r},Uv=function(e){let t=Nv.MODE_8BIT_BYTE,n=Mv.stringToBytes(e),r={};return r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){for(let t=0;t<n.length;t+=1)e.put(n[t],8)},r},Wv=function(e){let t=Nv.MODE_KANJI,n=Mv.stringToBytes;(function(e,t){let r=n(e);if(r.length!=2||(r[0]<<8|r[1])!=t)throw`sjis not supported.`})(`友`,38726);let r=n(e),i={};return i.getMode=function(){return t},i.getLength=function(e){return~~(r.length/2)},i.write=function(e){let t=r,n=0;for(;n+1<t.length;){let r=(255&t[n])<<8|255&t[n+1];if(33088<=r&&r<=40956)r-=33088;else if(57408<=r&&r<=60351)r-=49472;else throw`illegal char at `+(n+1)+`/`+r;r=(r>>>8&255)*192+(r&255),e.put(r,13),n+=2}if(n<t.length)throw`illegal char at `+(n+1)},i},Gv=function(){let e=[],t={};return t.writeByte=function(t){e.push(t&255)},t.writeShort=function(e){t.writeByte(e),t.writeByte(e>>>8)},t.writeBytes=function(e,n,r){n||=0,r||=e.length;for(let i=0;i<r;i+=1)t.writeByte(e[i+n])},t.writeString=function(e){for(let n=0;n<e.length;n+=1)t.writeByte(e.charCodeAt(n))},t.toByteArray=function(){return e},t.toString=function(){let t=``;t+=`[`;for(let n=0;n<e.length;n+=1)n>0&&(t+=`,`),t+=e[n];return t+=`]`,t},t},Kv=function(){let e=0,t=0,n=0,r=``,i={},a=function(e){r+=String.fromCharCode(o(e&63))},o=function(e){if(e<0)throw`n:`+e;if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(e==62)return 43;if(e==63)return 47;throw`n:`+e};return i.writeByte=function(r){for(e=e<<8|r&255,t+=8,n+=1;t>=6;)a(e>>>t-6),t-=6},i.flush=function(){if(t>0&&(a(e<<6-t),e=0,t=0),n%3!=0){let e=3-n%3;for(let t=0;t<e;t+=1)r+=`=`}},i.toString=function(){return r},i},qv=function(e){let t=e,n=0,r=0,i=0,a={};a.read=function(){for(;i<8;){if(n>=t.length){if(i==0)return-1;throw`unexpected end of file./`+i}let e=t.charAt(n);if(n+=1,e==`=`)return i=0,-1;e.match(/^\s$/)||(r=r<<6|o(e.charCodeAt(0)),i+=6)}let e=r>>>i-8&255;return i-=8,e};let o=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(e==43)return 62;if(e==47)return 63;throw`c:`+e};return a},Jv=function(e,t){let n=e,r=t,i=Array(e*t),a={};a.setPixel=function(e,t,r){i[t*n+e]=r},a.write=function(e){e.writeString(`GIF87a`),e.writeShort(n),e.writeShort(r),e.writeByte(128),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(255),e.writeByte(255),e.writeByte(255),e.writeString(`,`),e.writeShort(0),e.writeShort(0),e.writeShort(n),e.writeShort(r),e.writeByte(0);let t=s(2);e.writeByte(2);let i=0;for(;t.length-i>255;)e.writeByte(255),e.writeBytes(t,i,255),i+=255;e.writeByte(t.length-i),e.writeBytes(t,i,t.length-i),e.writeByte(0),e.writeString(`;`)};let o=function(e){let t=e,n=0,r=0,i={};return i.write=function(e,i){if(e>>>i)throw`length over`;for(;n+i>=8;)t.writeByte(255&(e<<n|r)),i-=8-n,e>>>=8-n,r=0,n=0;r=e<<n|r,n+=i},i.flush=function(){n>0&&t.writeByte(r)},i},s=function(e){let t=1<<e,n=(1<<e)+1,r=e+1,a=c();for(let e=0;e<t;e+=1)a.add(String.fromCharCode(e));a.add(String.fromCharCode(t)),a.add(String.fromCharCode(n));let s=Gv(),l=o(s);l.write(t,r);let u=0,d=String.fromCharCode(i[u]);for(u+=1;u<i.length;){let e=String.fromCharCode(i[u]);u+=1,a.contains(d+e)?d+=e:(l.write(a.indexOf(d),r),a.size()<4095&&(a.size()==1<<r&&(r+=1),a.add(d+e)),d=e)}return l.write(a.indexOf(d),r),l.write(n,r),l.flush(),s.toByteArray()},c=function(){let e={},t=0,n={};return n.add=function(r){if(n.contains(r))throw`dup key:`+r;e[r]=t,t+=1},n.size=function(){return t},n.indexOf=function(t){return e[t]},n.contains=function(t){return e[t]!==void 0},n};return a},Yv=function(e,t,n){let r=Jv(e,t);for(let i=0;i<t;i+=1)for(let t=0;t<e;t+=1)r.setPixel(t,i,n(t,i));let i=Gv();r.write(i);let a=Kv(),o=i.toByteArray();for(let e=0;e<o.length;e+=1)a.writeByte(o[e]);return a.flush(),`data:image/gif;base64,`+a};Mv.stringToBytes;function Xv({text:e,label:t}){let{size:n,path:r}=(0,y.useMemo)(()=>{let t=Mv(0,`M`);t.addData(e),t.make();let n=t.getModuleCount(),r=``;for(let e=0;e<n;e++)for(let i=0;i<n;i++)t.isDark(e,i)&&(r+=`M${i} ${e}h1v1h-1z`);return{size:n,path:r}},[e]);return(0,b.jsx)(`svg`,{viewBox:`-3 -3 ${n+6} ${n+6}`,role:`img`,"aria-label":t,className:`size-44 rounded-md bg-white`,shapeRendering:`crispEdges`,children:(0,b.jsx)(`path`,{d:r,fill:`#000`})})}function Zv(){let{t:e}=Y(),t=Sv();if(t.isPending)return(0,b.jsx)(W,{children:e(`common.loading`)});if(!t.data)return null;if(t.data.viewAs)return(0,b.jsx)(Oa,{to:`/`,replace:!0});let{user:n,auth:r}=t.data;return(0,b.jsxs)(`div`,{className:`flex max-w-2xl flex-col gap-8`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:e(`auth.account`)}),(0,b.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[n.displayName,n.username?` · ${n.username}`:``]})]}),r.password&&(0,b.jsx)(Qv,{}),r.twoFactor&&(0,b.jsx)($v,{}),r.sessions&&(0,b.jsx)(ty,{revokeOthers:r.revokeOthers})]})}function Qv(){let{t:e}=Y(),t=S(),[n,r]=(0,y.useState)(``),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)({}),[u,d]=(0,y.useState)(!1),f=pt({mutationFn:()=>Q.changePassword(n,i),onSuccess:async()=>{r(``),a(``),s(``),l({}),d(!0),await t.invalidateQueries({queryKey:[`account-sessions`]})},onError:e=>l(e instanceof U_&&Object.keys(e.fields).length>0?e.fields:{form:[W_(e)]})});function p(t){t.preventDefault(),d(!1);let r={};n||(r.current=[e(`validation.required`)]),i?i!==o&&(r.confirm=[e(`auth.mismatch`)]):r.next=[e(`validation.required`)],l(r),Object.keys(r).length===0&&f.mutate()}let m=(e,t,n,r,i)=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`password-${e}`,children:t}),(0,b.jsx)(e_,{id:`password-${e}`,type:`password`,autoComplete:i,value:n,onChange:e=>r(e.target.value),"aria-invalid":c[e]?!0:void 0,"aria-describedby":c[e]?`password-${e}-error`:void 0}),c[e]&&(0,b.jsx)(`p`,{id:`password-${e}-error`,className:`text-sm text-destructive`,children:c[e].join(` `)})]});return(0,b.jsxs)(`section`,{"aria-labelledby":`password-title`,className:`flex flex-col gap-4 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsx)(`h2`,{id:`password-title`,className:`font-medium`,children:e(`auth.changePassword`)}),(0,b.jsxs)(`form`,{onSubmit:p,noValidate:!0,className:`flex flex-col gap-4`,children:[c.form&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:c.form.join(` `)}),u&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:e(`auth.passwordChanged`)}),m(`current`,e(`auth.currentPassword`),n,r,`current-password`),m(`next`,e(`auth.newPassword`),i,a,`new-password`),m(`confirm`,e(`auth.confirmPassword`),o,s,`new-password`),(0,b.jsx)(`div`,{children:(0,b.jsx)(q,{type:`submit`,disabled:f.isPending,children:e(`auth.changePassword`)})})]})]})}function $v(){let{t:e}=Y(),t=S(),n=ft({queryKey:[`account-2fa`],queryFn:Q.twoFactor.status}),[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(``),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(!1),[d,f]=(0,y.useState)(null),[p,m]=(0,y.useState)(null),h=e=>m(e instanceof U_&&Object.keys(e.fields).length>0?Object.values(e.fields).flat().join(` `):W_(e)),g=async()=>{await t.invalidateQueries({queryKey:[`account-2fa`]}),await t.invalidateQueries({queryKey:[`account-sessions`]})},_=pt({mutationFn:Q.twoFactor.setup,onMutate:()=>m(null),onError:h}),v=pt({mutationFn:()=>Q.twoFactor.confirm(r.trim()),onMutate:()=>m(null),onSuccess:async t=>{c(t.recoveryCodes),i(``),_.reset(),f(e(`twoFactor.enabledNote`)),await g()},onError:h}),x=pt({mutationFn:()=>Q.twoFactor.recoveryCodes(a),onMutate:()=>m(null),onSuccess:async e=>{c(e.recoveryCodes),o(``),await g()},onError:h}),C=pt({mutationFn:()=>Q.twoFactor.disable(a),onMutate:()=>m(null),onSuccess:async()=>{o(``),c(null),f(e(`twoFactor.disabledNote`)),await g()},onError:h}),w=n.data?.enabled===!0,T=_.data;return(0,b.jsxs)(`section`,{"aria-labelledby":`two-factor-title`,className:`flex flex-col gap-3 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`h2`,{id:`two-factor-title`,className:`font-medium`,children:e(`twoFactor.title`)}),n.data&&(0,b.jsx)(`span`,{className:w?`rounded-full bg-green-500/15 px-2 py-0.5 text-xs text-green-800 dark:text-green-300`:`rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground`,children:e(w?`twoFactor.on`:`twoFactor.off`)})]}),p&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:p}),d&&!p&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:d}),s&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border bg-muted/40 p-3`,children:[(0,b.jsx)(`h3`,{className:`text-sm font-medium`,children:e(`twoFactor.recoveryTitle`)}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.recoveryIntro`)}),(0,b.jsx)(`ul`,{"aria-label":e(`twoFactor.recoveryTitle`),dir:`ltr`,className:`grid grid-cols-2 gap-1 font-mono text-sm`,children:s.map(e=>(0,b.jsx)(`li`,{children:e},e))}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{navigator.clipboard?.writeText(s.join(`
|
|
53
|
+
`)).then(()=>u(!0),()=>void 0)},children:e(l?`twoFactor.copied`:`twoFactor.copy`)}),(0,b.jsx)(q,{type:`button`,size:`sm`,onClick:()=>{c(null),u(!1)},children:e(`twoFactor.done`)})]})]}),n.data&&!w&&!T&&(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.intro`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:_.isPending,onClick:()=>_.mutate(),children:e(`twoFactor.setUp`)})]}),!w&&T&&(0,b.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),r.trim()&&v.mutate()},children:[(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.scan`)}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,b.jsx)(Xv,{text:T.otpauthUrl,label:e(`twoFactor.qr`)}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 text-sm`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e(`twoFactor.key`)}),(0,b.jsx)(`code`,{dir:`ltr`,"data-testid":`two-factor-key`,className:`break-all font-mono`,children:T.secret.match(/.{1,4}/g).join(` `)})]})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`two-factor-code`,children:e(`twoFactor.code`)}),(0,b.jsx)(e_,{id:`two-factor-code`,autoComplete:`one-time-code`,inputMode:`numeric`,dir:`ltr`,maxLength:10,value:r,onChange:e=>i(e.target.value)})]}),(0,b.jsx)(q,{type:`submit`,disabled:v.isPending||!r.trim(),children:e(`twoFactor.turnOn`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>_.reset(),children:e(`common.cancel`)})]})]}),w&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`twoFactor.left`,{count:n.data.recoveryCodesLeft})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`two-factor-password`,children:e(`twoFactor.password`)}),(0,b.jsx)(e_,{id:`two-factor-password`,type:`password`,autoComplete:`current-password`,value:a,onChange:e=>o(e.target.value)})]}),(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:!a||x.isPending,onClick:()=>x.mutate(),children:e(`twoFactor.newCodes`)}),(0,b.jsx)(q,{type:`button`,variant:`destructive`,disabled:!a||C.isPending,onClick:()=>C.mutate(),children:e(`twoFactor.turnOff`)})]})]})]})}function ey(e,t){return e?[/Edg\//.test(e)?`Edge`:/Firefox\//.test(e)?`Firefox`:/Chrome\//.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:void 0,/Android/.test(e)?`Android`:/iPhone|iPad/.test(e)?`iOS`:/Mac OS X/.test(e)?`macOS`:/Windows/.test(e)?`Windows`:/Linux/.test(e)?`Linux`:void 0].filter(Boolean).join(` · `)||e.slice(0,40):t}function ty({revokeOthers:e}){let{t}=Y(),n=S(),r=ft({queryKey:[`account-sessions`],queryFn:Q.sessions}),i=()=>n.invalidateQueries({queryKey:[`account-sessions`]}),a=pt({mutationFn:e=>Q.revokeSession(e),onSuccess:i}),o=pt({mutationFn:()=>Q.revokeOtherSessions(),onSuccess:i}),s=r.data?.items??[],c=a.error??o.error??r.error;return(0,b.jsxs)(`section`,{"aria-labelledby":`sessions-title`,className:`flex flex-col gap-3 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`h2`,{id:`sessions-title`,className:`font-medium`,children:t(`auth.sessions`)}),e&&s.length>1&&(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(),children:t(`auth.signOutOthers`)})]}),c&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:W_(c)}),(0,b.jsx)(`ul`,{"aria-label":t(`auth.sessions`),className:`flex flex-col divide-y`,children:s.map(e=>(0,b.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 py-2 text-sm`,children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,title:e.userAgent,children:[ey(e.userAgent,t(`auth.unknownDevice`)),e.current&&(0,b.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs text-primary`,children:t(`auth.thisDevice`)})]}),(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[t(`auth.lastSeen`,{when:O_(new Date(e.lastSeenAt))}),e.ip?` · ${e.ip}`:``]})]}),!e.current&&(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(e.id),"aria-label":t(`auth.revokeSession`,{name:ey(e.userAgent,t(`auth.unknownDevice`))}),children:t(`auth.revoke`)})]},e.id))})]})}function ny(e,t){return e==null?``:typeof e==`string`?e:e[t]??e[L_.locale]??Object.values(e)[0]??``}function ry(e){let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e.trim()!==``).map(([e,t])=>[e,t.trim()])),n=Object.keys(t);if(n.length!==0)return L_.locales.length===1?t[n[0]]:t}function iy(e){let t=Object.fromEntries(L_.locales.map(e=>[e,``]));return typeof e==`string`?t[L_.locale]=e:e&&Object.assign(t,e),t}function ay({children:e,actions:t}){return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:e}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t})]})}function oy({children:e,tone:t=`error`}){return(0,b.jsx)(`p`,{role:t===`error`?`alert`:`status`,className:t===`error`?`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:e})}var sy=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function cy(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:sy(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var ly=e=>{let t=``,n=!1;for(let r of e){if(r===`-`||r===`_`||r<=` `){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t},uy=e=>{let t=ly(e);return t.charAt(0).toUpperCase()+t.slice(1)},dy=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),fy={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function py(e){return e!=null}function my(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??fy.width,a=e.size??e.height??fy.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?dy(...c):dy(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??fy[`stroke-width`])*Number(e.size??e.width??fy.width)/Number(t.size??t.width??fy.width):t.strokeWidth??fy[`stroke-width`];return[`svg`,{...Object.entries(fy).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&py(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&py(t.width)&&{[r(`width`)]:t.width},...`height`in t&&py(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function hy(e,t={}){return my(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var gy=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},_y=(0,y.createContext)({}),vy=()=>(0,y.useContext)(_y),yy=(0,y.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=vy()??{},b=!!c||gy(d),[x,S,C=[]]=hy(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:dy(v,s),hasA11yProp:b,attributes:d});return(0,y.createElement)(x,{ref:f,...S},[...C.map(([e,t])=>(0,y.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function $(e,t=[],n=[]){let r=typeof e==`string`?cy(e,t,n):e,i=(0,y.forwardRef)(({className:e,...t},n)=>(0,y.createElement)(yy,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=uy(r.name)),i}var by={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};by.node;var xy=$(by),Sy={name:`arrow-down-up`,size:24,node:[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`m21 8-4-4-4 4`,key:`1c9v7m`}],[`path`,{d:`M17 4v16`,key:`7dpous`}]]};Sy.node;var Cy=$(Sy),wy={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};wy.node;var Ty=$(wy),Ey={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};Ey.node;var Dy=$(Ey),Oy={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Oy.node;var ky=$(Oy),Ay={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};Ay.node;var jy=$(Ay),My={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};My.node;var Ny=$(My),Py={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};Py.node;var Fy=$(Py),Iy={name:`box`,size:24,node:[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]};Iy.node;var Ly=$(Iy),Ry={name:`boxes`,size:24,node:[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]};Ry.node;var zy=$(Ry),By={name:`briefcase`,size:24,node:[[`path`,{d:`M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16`,key:`jecpp`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]};By.node;var Vy=$(By),Hy={name:`building-complex`,size:24,node:[[`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`}]],aliases:[`building-2`]};Hy.node;var Uy=$(Hy),Wy={name:`calendar-days`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 13h.01`,key:`1sbv64`}],[`path`,{d:`M12 13h.01`,key:`y0uutt`}],[`path`,{d:`M16 13h.01`,key:`wip0gl`}],[`path`,{d:`M8 17h.01`,key:`p3bg7i`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M16 17h.01`,key:`ql8jdd`}]]};Wy.node;var Gy=$(Wy),Ky={name:`calendar-range`,size:24,node:[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M17 13h-6`,key:`1qbiup`}],[`path`,{d:`M13 17H7`,key:`1x38vv`}],[`path`,{d:`M7 13h.01`,key:`1vezk1`}],[`path`,{d:`M17 17h.01`,key:`1sd3ek`}]]};Ky.node;var qy=$(Ky),Jy={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Jy.node;var Yy=$(Jy),Xy={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};Xy.node;var Zy=$(Xy),Qy={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Qy.node;var $y=$(Qy),eb={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};eb.node;var tb=$(eb),nb={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};nb.node;var rb=$(nb),ib={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};ib.node;var ab=$(ib),ob={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};ob.node;var sb=$(ob),cb={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};cb.node;var lb=$(cb),ub={name:`columns-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]],aliases:[`panels-left-right`]};ub.node;var db=$(ub),fb={name:`copy`,size:24,node:[[`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`}]]};fb.node;var pb=$(fb),mb={name:`credit-card`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}],[`path`,{d:`M6 14h2`,key:`mk7k0u`}]]};mb.node;var hb=$(mb),gb={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};gb.node;var _b=$(gb),vb={name:`dollar-sign`,size:24,node:[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]};vb.node;var yb=$(vb),bb={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};bb.node;var xb=$(bb),Sb={name:`ellipsis-vertical`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]],aliases:[`more-vertical`]};Sb.node;var Cb=$(Sb),wb={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};wb.node;var Tb=$(wb),Eb={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};Eb.node;var Db=$(Eb),Ob={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Ob.node;var kb=$(Ob),Ab={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};Ab.node;var jb=$(Ab),Mb={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};Mb.node;var Nb=$(Mb),Pb={name:`file`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]};Pb.node;var Fb=$(Pb),Ib={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};Ib.node;var Lb=$(Ib),Rb={name:`funnel`,size:24,node:[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]],aliases:[`filter`]};Rb.node;var zb=$(Rb),Bb={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};Bb.node;var Vb=$(Bb),Hb={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};Hb.node;var Ub=$(Hb),Wb={name:`heart`,size:24,node:[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}]]};Wb.node;var Gb=$(Wb),Kb={name:`house`,size:24,node:[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]],aliases:[`home`]};Kb.node;var qb=$(Kb),Jb={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};Jb.node;var Yb=$(Jb),Xb={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};Xb.node;var Zb=$(Xb),Qb={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};Qb.node;var $b=$(Qb),ex={name:`key`,size:24,node:[[`path`,{d:`m2 21 9.6-9.6`,key:`9l79m3`}],[`path`,{d:`m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19`,key:`fw8biw`}],[`circle`,{cx:`15.5`,cy:`7.5`,r:`5.5`,key:`4wxmhb`}]]};ex.node;var tx=$(ex),nx={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};nx.node;var rx=$(nx),ix={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};ix.node;var ax=$(ix),ox={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};ox.node;var sx=$(ox),cx={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};cx.node;var lx=$(cx),ux={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};ux.node;var dx=$(ux),fx={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};fx.node;var px=$(fx),mx={name:`lock`,size:24,node:[[`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`}]]};mx.node;var hx=$(mx),gx={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};gx.node;var _x=$(gx),vx={name:`mail`,size:24,node:[[`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`}]]};vx.node;var yx=$(vx),bx={name:`map-pin`,size:24,node:[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]};bx.node;var xx=$(bx),Sx={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};Sx.node;var Cx=$(Sx),wx={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};wx.node;var Tx=$(wx),Ex={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};Ex.node;var Dx=$(Ex),Ox={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};Ox.node;var kx=$(Ox),Ax={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};Ax.node;var jx=$(Ax),Mx={name:`package`,size:24,node:[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]};Mx.node;var Nx=$(Mx),Px={name:`panel-right`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]};Px.node;var Fx=$(Px),Ix={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};Ix.node;var Lx=$(Ix),Rx={name:`phone`,size:24,node:[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]};Rx.node;var zx=$(Rx),Bx={name:`pin-off`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]};Bx.node;var Vx=$(Bx),Hx={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};Hx.node;var Ux=$(Hx),Wx={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Wx.node;var Gx=$(Wx),Kx={name:`printer`,size:24,node:[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]};Kx.node;var qx=$(Kx),Jx={name:`receipt`,size:24,node:[[`path`,{d:`M12 17V7`,key:`pyj7ub`}],[`path`,{d:`M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8`,key:`1elt7d`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]};Jx.node;var Yx=$(Jx),Xx={name:`refresh-cw`,size:24,node:[[`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`}]]};Xx.node;var Zx=$(Xx),Qx={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};Qx.node;var $x=$(Qx),eS={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};eS.node;var tS=$(eS),nS={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};nS.node;var rS=$(nS),iS={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};iS.node;var aS=$(iS),oS={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};oS.node;var sS=$(oS),cS={name:`settings`,size:24,node:[[`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`}]]};cS.node;var lS=$(cS),uS={name:`shield-check`,size:24,node:[[`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`}]]};uS.node;var dS=$(uS),fS={name:`shield`,size:24,node:[[`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`}]]};fS.node;var pS=$(fS),mS={name:`shopping-bag`,size:24,node:[[`path`,{d:`M16 10a4 4 0 0 1-8 0`,key:`1ltviw`}],[`path`,{d:`M3.103 6.034h17.794`,key:`awc11p`}],[`path`,{d:`M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z`,key:`o988cm`}]]};mS.node;var hS=$(mS),gS={name:`shopping-cart`,size:24,node:[[`path`,{d:`m2.05 2.05 1.099-.028a1 1 0 0 1 1.008.815l2.69 14.347A1 1 0 0 0 7.83 18H18`,key:`uebgi3`}],[`path`,{d:`M4.563 5h16.435a1 1 0 0 1 .981 1.204l-1.026 6.226A2 2 0 0 1 18.962 14H6.25`,key:`1j7c9p`}],[`circle`,{cx:`18`,cy:`20`,r:`2`,key:`t9985n`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]};gS.node;var _S=$(gS),vS={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};vS.node;var yS=$(vS),bS={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};bS.node;var xS=$(bS),SS={name:`store`,size:24,node:[[`path`,{d:`M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5`,key:`slp6dd`}],[`path`,{d:`M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244`,key:`o0xfot`}],[`path`,{d:`M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05`,key:`wn3emo`}]]};SS.node;var CS=$(SS),wS={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};wS.node;var TS=$(wS),ES={name:`tag`,size:24,node:[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]};ES.node;var DS=$(ES),OS={name:`tags`,size:24,node:[[`path`,{d:`M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z`,key:`16rjxf`}],[`path`,{d:`M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193`,key:`178nd4`}],[`circle`,{cx:`10.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`12ikhr`}]]};OS.node;var kS=$(OS),AS={name:`ticket`,size:24,node:[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]};AS.node;var jS=$(AS),MS={name:`trash`,size:24,node:[[`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`}]],aliases:[`trash-2`]};MS.node;var NS=$(MS),PS={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};PS.node;var FS=$(PS),IS={name:`truck`,size:24,node:[[`path`,{d:`M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2`,key:`wrbu53`}],[`path`,{d:`M15 18H9`,key:`1lyqi6`}],[`path`,{d:`M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14`,key:`lysw3i`}],[`circle`,{cx:`17`,cy:`18`,r:`2`,key:`332jqn`}],[`circle`,{cx:`7`,cy:`18`,r:`2`,key:`19iecd`}]]};IS.node;var LS=$(IS),RS={name:`upload`,size:24,node:[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]};RS.node;var zS=$(RS),BS={name:`user-round`,size:24,node:[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]],aliases:[`user-2`]};BS.node;var VS=$(BS),HS={name:`user`,size:24,node:[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]};HS.node;var US=$(HS),WS={name:`users`,size:24,node:[[`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`}]]};WS.node;var GS=$(WS),KS={name:`video`,size:24,node:[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]};KS.node;var qS=$(KS),JS={name:`wallet`,size:24,node:[[`path`,{d:`M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1`,key:`18etb6`}],[`path`,{d:`M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4`,key:`xoc0q4`}]]};JS.node;var YS=$(JS),XS={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};XS.node;var ZS=$(XS),QS={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};QS.node;var $S=$(QS),eC={name:`zap`,size:24,node:[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]};eC.node;var tC=$(eC),nC=/^(-?)(\d+)(?:\.(\d*))?$/,rC=/^-?\d{1,3}(,\d{3})+(\.\d*)?$/;function iC(e,t){let n=a_(e).trim(),r=nC.exec(rC.test(n)?n.replace(/,/g,``):n);if(!r)return e;let[,i,a,o]=r,s=a.replace(/^0+(?=\d)/,``).replace(/\B(?=(\d{3})+$)/g,`,`),c=t===void 0?o??``:(o??``).padEnd(t,`0`);return`${i}${s}${c?`.${c}`:``}`}function aC(e,t){let n=a_(e),r=n.replace(/,/g,``),i=/^(-?)(\d*)(\.\d*)?$/.exec(r);if(!i)return{text:e,caret:t};let[,a,o,s=``]=i,c=`${a}${o.replace(/\B(?=(\d{3})+$)/g,`,`)}${s}`,l=n.slice(0,t).replace(/,/g,``).length,u=0,d=0;for(;d<c.length&&u<l;)c[d]!==`,`&&u++,d++;return{text:c,caret:d}}function oC(e){let t=a_(e).trim();return rC.test(t)?t.replace(/,/g,``):t}var sC;function cC(e){sC=e}function lC(){if(!sC)return;let{unit:e,position:t}=sC,n=x_(),r=typeof e==`string`?e:e[n]??e[n.split(`-`)[0]]??Object.values(e)[0];return r?{unit:r,position:t}:void 0}function uC(e,t={}){let n=t.currency??lC(),r=e=>D_(iC(e,t.scale));return{main:r(e),...n?{unit:n.unit,position:n.position}:{},...t.previous===void 0?{}:{previous:r(t.previous)}}}function dC(e){return e.unit?e.position===`before`?`${e.unit} ${e.main}`:`${e.main} ${e.unit}`:e.main}function fC(e,t){if(e==null)return`—`;if(t.type===`relation`){let t=Array.isArray(e)?e:[e];return t.length===0?`—`:t.map(e=>String(e.title)).join(`, `)}if(t.file)return(Array.isArray(e)?e:[e]).map(e=>String(e).split(`/`).pop()).join(`, `)||`—`;if(t.widget===`richtext`)return mC(String(e))||`—`;if(t.type===`boolean`)return J(e?`common.yes`:`common.no`);if(t.type===`enum`)return t.enumLabels?.[String(e)]??String(e);if(t.widget===`money`)return dC(uC(String(e),{currency:t.currency,scale:t.scale}));if(t.type===`number`||t.type===`decimal`||t.type===`bigint`)return D_(String(e));if(t.type===`date`)return A_(String(e));if(t.type===`json`||t.type===`object`)return JSON.stringify(e);if(t.type===`datetime`){let t=new Date(String(e));return Number.isNaN(t.getTime())?String(e):O_(t)}return String(e)}var pC={amp:`&`,lt:`<`,gt:`>`,quot:`"`,"#39":`'`,nbsp:` `};function mC(e,t=120){let n=e.replace(/<[^>]*>/g,` `).replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(e,t)=>pC[t]).replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t).trimEnd()}…`:n}function hC(e,t){let n=e?.groups??[];return{resource:e=>t(e)?.label??n.flatMap(e=>e.resources).find(t=>t.name===e)?.label,page:e=>n.flatMap(e=>e.pages).find(t=>t.name===e)?.label,action:(e,n)=>t(e)?.actions?.find(e=>e.name===n)?.label,softDelete:e=>t(e)?.softDelete}}var gC={created:`audit.event.created`,updated:`audit.event.updated`,deleted:`audit.event.deleted`,restored:`audit.event.restored`,purged:`audit.event.purged`},_C={"auth.login":`audit.event.login`,"auth.logout":`audit.event.logout`,"auth.view_as":`audit.event.viewAs`,"auth.password_changed":`audit.event.passwordChanged`,"auth.two_factor_enabled":`audit.event.twoFactorEnabled`,"auth.two_factor_disabled":`audit.event.twoFactorDisabled`,"auth.recovery_codes_regenerated":`audit.event.recoveryCodes`,"rbac.role.changed":`audit.event.roleChanged`,"rbac.group.changed":`audit.event.groupChanged`,"rbac.user_roles.changed":`audit.event.userRolesChanged`,"rbac.user.created":`audit.event.userCreated`,"rbac.user.changed":`audit.event.userChanged`,"rbac.user.password_reset":`audit.event.passwordReset`,"rbac.user.two_factor_reset":`audit.event.twoFactorReset`},vC={WRONG_CODE:`audit.event.loginFailedCode`,RATE_LIMITED:`audit.event.loginFailedLimited`};function yC(e){return e.event.startsWith(`*.`)||e.event.startsWith(`page.*.`)}function bC(e){return e.resource!==void 0&&e.event.startsWith(`${e.resource}.`)?e.event.slice(e.resource.length+1):void 0}var xC=/^page\.(.+)\.updated$/;function SC(e,t={}){if(yC(e))return J(`audit.event.unseen`);let n=bC(e);if(n!==void 0){if(n.startsWith(`action.`)&&n.length>7){let r=n.slice(7);return J(`audit.event.action`,{action:t.action?.(e.resource,r)??r})}if(n===`deleted`&&t.softDelete?.(e.resource))return J(`audit.event.trashed`);let r=gC[n];return r?J(r):e.event}let r=xC.exec(e.event)?.[1];if(r!==void 0)return J(`audit.event.page`,{page:t.page?.(r)??r});if(e.event===`auth.login_failed`){let t=e.meta?.reason;return t===`SUPPRESSED`?J(`audit.event.loginFailedMore`,{count:e.meta?.suppressed??0}):J(t&&vC[t]||`audit.event.loginFailed`)}if(e.event===`auth.sessions_revoked`){let t=e.meta?.sessions;return J(t===`others`?`audit.event.sessionsOthers`:t===`one`?`audit.event.sessionsOne`:`audit.event.sessions`)}let i=_C[e.event];return i?J(i):e.event}function CC(e){if(e.event===`auth.login_failed`){if(e.meta?.reason===`SUPPRESSED`)return J(`audit.suppressedNote`);if(e.meta?.limited)return J(`audit.limitedNote`)}if(e.meta?.action!==void 0&&e.meta.deleted)return J(`audit.actionDeleted`)}function wC(e,t={}){if(!yC(e)){if(e.resource!==void 0){let n=t.resource?.(e.resource)??e.resource;return e.recordId===void 0?n:e.recordTitle!==void 0&&e.recordTitle!==``?`${n}: ${e.recordTitle}`:`${n} #${e.recordId}`}if(e.recordTitle!==void 0&&e.recordTitle!==``)return e.recordTitle;if(e.recordId!==void 0)return e.recordId;if(e.event===`auth.login_failed`&&e.meta?.username)return e.meta.username}}function TC(e){if(e.restricted&&!yC(e))return J(e.resource===void 0?`audit.restrictedChanges`:`audit.restrictedRecord`)}function EC(e,t,n){let r={field:e.field,label:t?.label??e.field};if(`hidden`in e&&e.hidden)return{...r,state:`hidden`,truncated:!1};if(`changed`in e&&e.changed)return{...r,state:`changed`,truncated:!1};let i=e,a=i.truncated===!0;return a&&!(`before`in i)&&!(`after`in i)?{...r,state:`dropped`,truncated:a}:{...r,state:`values`,before:`before`in i&&i.before!==void 0?AC(i.before,t,n):void 0,after:`after`in i&&i.after!==void 0?AC(i.after,t,n):void 0,truncated:a}}var DC=`—`,OC=1e5;function kC(e){return e==null||e===``?DC:typeof e==`boolean`?J(e?`common.yes`:`common.no`):typeof e==`string`?e:Array.isArray(e)?e.length===0?DC:e.every(e=>typeof e!=`object`||!e)?e.map(String).join(`, `):JSON.stringify(e):typeof e==`object`?JSON.stringify(e):String(e)}function AC(e,t,n){if(e==null||e===``)return DC;if(!t)return kC(e);if(t.type===`relation`){let t=Array.isArray(e)?e:[e],r=e=>typeof e==`object`&&e?e.id:e;if(t.some(e=>![`string`,`number`,`bigint`].includes(typeof r(e))))return kC(e);let i=t.map(e=>String(r(e)));return i.length===0?DC:i.map(e=>{let t=n?.(e);return t!==void 0&&t!==``&&t!==`#${e}`?`${t} (#${e})`:`#${e}`}).join(`, `)}return t.file?typeof e==`string`||Array.isArray(e)?fC(e,t):kC(e):t.type===`json`||t.type===`object`?typeof e==`string`?e:JSON.stringify(e):typeof e==`object`?kC(e):t.widget===`richtext`?mC(String(e),OC)||DC:fC(e,t)}var jC=[`actor`,`event`,`resource`,`record`,`from`,`to`],MC=/^(\d{4})-(\d{2})-(\d{2})$/;function NC(e,t){let n=MC.exec(e);if(!n)return e;let[r,i,a]=[Number(n[1]),Number(n[2]),Number(n[3])],o=t?new Date(r,i-1,a,23,59,59,999):new Date(r,i-1,a,0,0,0,0);return o.getFullYear()===r&&o.getMonth()===i-1&&o.getDate()===a?o.toISOString():e}function PC(e){let t=new URLSearchParams;for(let n of jC){let r=e.get(n);r!==null&&r!==``&&(n!==`record`||e.get(`resource`))&&t.set(n,n===`from`?NC(r,!1):n===`to`?NC(r,!0):r)}return t.sort(),t.toString()}function FC(e){return PC(e)!==``}function IC(e,t){let n=t.trim();return e===`resource`?{resource:n||null,record:null}:{[e]:n||null}}function LC(){return Object.fromEntries(jC.map(e=>[e,null]))}function RC({entries:e,now:t,names:n,schemaOf:r,pageFieldsOf:i,titleOf:a,onActor:o,showSubject:s=!1}){let{t:c}=Y();return(0,b.jsx)(`ol`,{"aria-label":c(`audit.entries`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card`,children:e.map(e=>(0,b.jsx)(BC,{entry:e,now:t,names:n,schema:e.resource===void 0?void 0:r(e.resource),pageFields:e.resource===void 0&&e.meta?.page!==void 0?i?.(e.meta.page):void 0,titleOf:a,onActor:o,showSubject:s},e.id))})}var zC=/\.(deleted|purged)$/;function BC({entry:e,now:t,names:n,schema:r,pageFields:i,titleOf:a,onActor:o,showSubject:s}){let c=r?.fields??i,{t:l}=Y(),u=new Date(e.at),d=!Number.isNaN(u.getTime()),f=s?wC(e,n):void 0,p=s&&e.resource!==void 0&&e.recordId!==void 0&&!zC.test(e.event)&&!e.meta?.deleted,m=TC(e),h=CC(e),g=e.actor?e.actor.name??`#${e.actor.id}`:l(`audit.noActor`),_=e.meta?.input?Object.entries(e.meta.input):[],v=e.meta?.action===void 0?void 0:r?.actions?.find(t=>t.name===VC(e))?.input?.fields,y=[e.meta?.ip,e.meta?.userAgent].filter(Boolean).join(` · `);return(0,b.jsxs)(`li`,{className:`flex flex-col gap-2 px-4 py-3 text-sm`,"data-event":e.event,"data-actor":e.actor?.id??``,"data-anonymous":yC(e)||void 0,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:SC(e,n)}),f!==void 0&&(p?(0,b.jsx)(xo,{to:`/${e.resource}/${encodeURIComponent(e.recordId)}`,className:`text-primary hover:underline`,children:f}):(0,b.jsx)(`span`,{children:f}))]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[e.actor&&o?(0,b.jsx)(`button`,{type:`button`,className:`font-medium text-foreground hover:underline`,"aria-label":l(`audit.filterByActor`,{name:g}),onClick:()=>o(e.actor.id),children:g}):(0,b.jsx)(`span`,{className:`font-medium text-foreground`,children:g}),e.viewAsBy!==void 0&&(0,b.jsx)(`span`,{children:l(`audit.viewAsBy`,{id:e.viewAsBy})}),d?(0,b.jsxs)(`time`,{dateTime:e.at,children:[j_(u,t),` · `,O_(u)]}):(0,b.jsx)(`span`,{children:e.at})]}),h!==void 0&&(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:h}),m!==void 0&&(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:m}),e.changes!==void 0&&e.changes.length>0&&(0,b.jsx)(`dl`,{"aria-label":l(`audit.changedFields`),className:`grid grid-cols-1 gap-x-4 gap-y-1.5 sm:grid-cols-[minmax(6rem,auto)_1fr]`,children:e.changes.map(e=>{let t=c?.find(t=>t.name===e.field);return(0,b.jsx)(HC,{row:EC(e,t,a?t=>a(e.field,t):void 0)},e.field)})}),_.length>0&&(0,b.jsx)(`dl`,{"aria-label":l(`audit.input`),className:`grid grid-cols-1 gap-x-4 gap-y-1.5 sm:grid-cols-[minmax(6rem,auto)_1fr]`,children:_.map(([e,t])=>{let n=v?.find(t=>t.name===e);return(0,b.jsxs)(`div`,{className:`contents`,"data-input":e,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:n?.label??e}),(0,b.jsx)(`dd`,{className:`min-w-0`,children:(0,b.jsx)(WC,{text:AC(t,n)})})]},e)})}),e.meta?.inputTruncated&&(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:l(`audit.inputTruncated`)}),y!==``&&(0,b.jsx)(`p`,{className:`text-xs break-all text-muted-foreground`,dir:`ltr`,"data-client":!0,children:y})]})}function VC(e){let t=`${e.resource}.action.`;return e.event.startsWith(t)?e.event.slice(t.length):void 0}function HC({row:e}){let{t}=Y();return(0,b.jsxs)(`div`,{className:`contents`,"data-change":e.field,"data-state":e.state,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:e.state===`values`?(0,b.jsxs)(b.Fragment,{children:[e.before!==void 0&&(0,b.jsxs)(`span`,{className:`min-w-0 text-muted-foreground line-through decoration-muted-foreground/50`,"data-before":!0,children:[(0,b.jsxs)(`span`,{className:`sr-only`,children:[t(`audit.before`),`: `]}),(0,b.jsx)(WC,{text:e.before})]}),e.before!==void 0&&e.after!==void 0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Dy,{className:`size-3.5 shrink-0 self-center text-muted-foreground rtl:-scale-x-100`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`sr-only`,children:t(`audit.becomes`)})]}),e.after!==void 0&&(0,b.jsxs)(`span`,{className:`min-w-0`,"data-after":!0,children:[e.before===void 0&&(0,b.jsxs)(`span`,{className:`sr-only`,children:[t(`audit.after`),`: `]}),(0,b.jsx)(WC,{text:e.after})]}),e.truncated&&(0,b.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t(`audit.field.truncated`),`)`]})]}):(0,b.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground`,children:t(`audit.field.${e.state}`)})})]})}var UC=160;function WC({text:e}){let{t}=Y(),[n,r]=(0,y.useState)(!1);return e.length<=UC?(0,b.jsx)(`span`,{dir:`auto`,className:`break-words whitespace-pre-wrap`,children:e}):(0,b.jsxs)(`span`,{dir:`auto`,className:`break-words whitespace-pre-wrap`,children:[n?e:`${e.slice(0,UC).trimEnd()}…`,` `,(0,b.jsx)(q,{type:`button`,variant:`link`,size:`sm`,className:`h-auto p-0 text-xs`,"aria-expanded":n,onClick:()=>r(e=>!e),children:t(n?`audit.showLess`:`audit.showMore`)})]})}var GC=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178],KC=(e,t)=>Math.trunc(e/t),qC=(e,t)=>e-Math.trunc(e/t)*t;function JC(e){let t=e+621,n=-14,r=GC[0];if(e<r||e>=GC[GC.length-1])throw RangeError(`Jalali year ${e} is out of range`);let i=0;for(let t=1;t<GC.length;t++){let a=GC[t];if(i=a-r,e<a)break;n+=KC(i,33)*8+KC(qC(i,33),4),r=a}let a=e-r;n+=KC(a,33)*8+KC(qC(a,33)+3,4),qC(i,33)===4&&i-a===4&&(n+=1);let o=KC(t,4)-KC((KC(t,100)+1)*3,4)-150,s=20+n-o;i-a<6&&(a=a-i+KC(i+4,33)*33);let c=qC(qC(a+1,33)-1,4);return c===-1&&(c=4),{leap:c,gy:t,march:s}}function YC(e,t,n){return KC((e+KC(t-8,6)+100100)*1461,4)+KC(153*qC(t+9,12)+2,5)+n-34840408-KC(KC(e+100100+KC(t-8,6),100)*3,4)+752}function XC(e){let t=4*e+139361631;t=t+KC(KC(4*e+183187720,146097)*3,4)*4-3908;let n=KC(qC(t,1461),4)*5+308,r=KC(qC(n,153),5)+1,i=qC(KC(n,153),12)+1;return{gy:KC(t,1461)-100100+KC(8-i,6),gm:i,gd:r}}function ZC(e,t,n){let{gy:r,march:i}=JC(e);return YC(r,3,i)+(t-1)*31-KC(t,7)*(t-7)+n-1}function QC(e){let{gy:t}=XC(e),n=t-621,r=JC(n),i=e-YC(t,3,r.march);if(i>=0){if(i<=185)return{jy:n,jm:1+KC(i,31),jd:qC(i,31)+1};i-=186}else--n,i+=179,r.leap===1&&(i+=1);return{jy:n,jm:7+KC(i,30),jd:qC(i,30)+1}}var $C=(e,t=2)=>String(e).padStart(t,`0`),ew=/^(\d{4})-(\d{2})-(\d{2})$/;function tw(e){return JC(e).leap===0}function nw(e,t){return t<=6?31:t<=11||tw(e)?30:29}function rw(e){let t=ew.exec(e);if(!t)throw RangeError(`not an ISO date: ${e}`);return QC(YC(Number(t[1]),Number(t[2]),Number(t[3])))}function iw(e,t,n){let{gy:r,gm:i,gd:a}=XC(ZC(e,t,n));return`${$C(r,4)}-${$C(i)}-${$C(a)}`}function aw(e,t,n){return Number.isInteger(e)&&e>=1&&e<3178&&t>=1&&t<=12&&n>=1&&n<=nw(e,t)}function ow(e){let{jy:t,jm:n,jd:r}=rw(e);return`${t}/${$C(n)}/${$C(r)}`}function sw(e){let t=/^(\d{4})[/\-.](\d{1,2})[/\-.](\d{1,2})$/.exec(i_(e.trim()));if(!t)return;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];return aw(n,r,i)?iw(n,r,i):void 0}function cw(e,t){let{jy:n,jm:r,jd:i}=rw(e),a=n*12+(r-1)+t,o=Math.floor(a/12),s=a%12+1;return iw(o,s,Math.min(i,nw(o,s)))}function lw(e,t){return new Date(Date.parse(`${e}T00:00:00Z`)+t*864e5).toISOString().slice(0,10)}function uw(){let e=new Date;return`${$C(e.getFullYear(),4)}-${$C(e.getMonth()+1)}-${$C(e.getDate())}`}var dw=(e,t=2)=>String(e).padStart(t,`0`),fw=(e,t)=>new Date(Date.UTC(e,t,0)).getUTCDate(),pw={intl:`persian`,parts:e=>{let{jy:t,jm:n,jd:r}=rw(e);return{year:t,month:n,day:r}},fromParts:iw,monthLength:nw,addMonths:cw,format:ow,parse:sw,weekStart:6},mw={intl:`gregory`,parts:e=>({year:Number(e.slice(0,4)),month:Number(e.slice(5,7)),day:Number(e.slice(8,10))}),fromParts:(e,t,n)=>`${dw(e,4)}-${dw(t)}-${dw(n)}`,monthLength:fw,addMonths:(e,t)=>{let{year:n,month:r,day:i}=mw.parts(e),a=n*12+(r-1)+t,o=Math.floor(a/12),s=a%12+1;return mw.fromParts(o,s,Math.min(i,fw(o,s)))},format:e=>e,parse:e=>{let t=/^(\d{4})[/\-.](\d{1,2})[/\-.](\d{1,2})$/.exec(i_(e.trim()));if(!t)return;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];return n>=1&&r>=1&&r<=12&&i>=1&&i<=fw(n,r)?mw.fromParts(n,r,i):void 0},weekStart:1},hw=e=>e===`persian`?pw:mw;function gw(e,t,n,r){let i=[...Array.from({length:e},()=>null),...Array.from({length:t},(e,t)=>r(n,t))];return[...i,...Array.from({length:42-i.length},()=>null)]}var _w=/^\d{4}-\d{2}-\d{2}$/;function vw(e){let{calendar:t}=Y();return(0,b.jsx)(yw,{...e,system:hw(t)})}function yw({id:e,value:t,onChange:n,label:r,live:i,className:a,system:o,...s}){let{t:c,digits:l}=Y(),u=e=>_w.test(e)?D_(o.format(e)):e,[d,f]=(0,y.useState)(()=>u(t)),[p,m]=(0,y.useState)(!1),h=(0,y.useRef)(t);(0,y.useEffect)(()=>{t!==h.current&&(h.current=t,f(u(t)))},[t,l,o]);function g(e){h.current=e,n(e)}function _(){let e=d.trim();if(e===``)return t!==``&&g(``);let n=o.parse(e);n?(f(u(n)),n!==t&&g(n)):i&&g(i_(e))}function v(e){f(u(e)),m(!1),g(e)}return(0,b.jsxs)(`div`,{className:U(`flex items-center gap-1`,a),children:[(0,b.jsx)(e_,{id:e,dir:`ltr`,inputMode:`numeric`,placeholder:c(`date.placeholder`),value:d,...s,onChange:e=>{if(f(e.target.value),!i)return;let t=e.target.value.trim();g((t===``?``:o.parse(t))??i_(t))},onBlur:()=>{_(),s.onBlur?.()},onKeyDown:e=>{e.key===`Enter`&&(_(),i||e.preventDefault()),s.onKeyDown?.(e)}}),(0,b.jsxs)(Kh,{open:p,onOpenChange:m,children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c(`date.openCalendar`,{name:r}),children:(0,b.jsx)(Gy,{})})}),(0,b.jsx)(Jh,{children:(0,b.jsx)(Yh,{align:`end`,sideOffset:4,className:`z-50 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md`,"aria-label":c(`date.calendar`,{name:r}),children:(0,b.jsx)(bw,{system:o,value:_w.test(t)?t:void 0,onPick:v,onClear:()=>v(``)})})})]})]})}function bw({system:e,value:t,onPick:n,onClear:r}){let{t:i,locale:a}=Y(),o=uw(),[s,c]=(0,y.useState)(t??o),[l,u]=(0,y.useState)(`days`),d=(0,y.useRef)(null),f=(0,y.useRef)(!1),{year:p,month:m}=e.parts(s),h=w_(a);(0,y.useEffect)(()=>{f.current&&(f.current=!1,d.current?.querySelector(`[data-iso="${s}"]`)?.focus())},[s]);let g=t=>new Intl.DateTimeFormat(`${a}-u-ca-${e.intl}`,{month:`long`,timeZone:`UTC`}).format(Date.parse(`${e.fromParts(p,t,1)}T00:00:00Z`)),_=e=>D_(String(e)),v=lw(`2024-01-07`,e.weekStart),x=Array.from({length:7},(e,t)=>new Intl.DateTimeFormat(a,{weekday:`narrow`,timeZone:`UTC`}).format(Date.parse(`${lw(v,t)}T00:00:00Z`))),S=e.fromParts(p,m,1),C=gw((new Date(`${S}T00:00:00Z`).getUTCDay()-e.weekStart+7)%7,e.monthLength(p,m),S,lw);function w(t){let n={ArrowRight:h?-1:1,ArrowLeft:h?1:-1,ArrowDown:7,ArrowUp:-7},r;t.key in n?r=lw(s,n[t.key]):t.key===`PageDown`?r=e.addMonths(s,t.shiftKey?12:1):t.key===`PageUp`&&(r=e.addMonths(s,t.shiftKey?-12:-1)),r&&(t.preventDefault(),f.current=!0,c(r))}let T=(e,t,n,r)=>(0,b.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":i(`date.previous`),onClick:()=>n(-1),children:(0,b.jsx)(rb,{className:`rtl:rotate-180`})}),t?(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":r,onClick:t,children:e}):(0,b.jsx)(`span`,{className:`text-sm font-medium`,children:e}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":i(`date.next`),onClick:()=>n(1),children:(0,b.jsx)(ab,{className:`rtl:rotate-180`})})]}),E;if(l===`years`){let t=p-p%12;E=(0,b.jsxs)(b.Fragment,{children:[T(`${_(t)}–${_(t+11)}`,void 0,t=>c(e.addMonths(s,t*144)),``),(0,b.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:Array.from({length:12},(e,n)=>t+n).map(t=>(0,b.jsx)(q,{type:`button`,variant:t===p?`secondary`:`ghost`,size:`sm`,onClick:()=>{c(e.fromParts(t,m,Math.min(e.parts(s).day,e.monthLength(t,m)))),u(`months`)},children:_(t)},t))})]})}else E=l===`months`?(0,b.jsxs)(b.Fragment,{children:[T(_(p),()=>u(`years`),t=>c(e.addMonths(s,t*12)),i(`date.chooseYear`)),(0,b.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:Array.from({length:12},(e,t)=>t+1).map(t=>(0,b.jsx)(q,{type:`button`,variant:t===m?`secondary`:`ghost`,size:`sm`,onClick:()=>{c(e.fromParts(p,t,Math.min(e.parts(s).day,e.monthLength(p,t)))),u(`days`)},children:g(t)},t))})]}):(0,b.jsxs)(b.Fragment,{children:[T(`${g(m)} ${_(p)}`,()=>u(`months`),t=>c(e.addMonths(s,t)),i(`date.chooseMonth`)),(0,b.jsxs)(`div`,{ref:d,role:`grid`,"aria-label":`${g(m)} ${_(p)}`,onKeyDown:w,className:`grid grid-cols-7 gap-0.5 text-center`,children:[(0,b.jsx)(`div`,{role:`row`,className:`contents`,children:x.map((e,t)=>(0,b.jsx)(`div`,{role:`columnheader`,className:`py-1 text-xs text-muted-foreground`,children:e},t))}),Array.from({length:Math.ceil(C.length/7)},(r,i)=>(0,b.jsx)(`div`,{role:`row`,className:`contents`,children:C.slice(i*7,i*7+7).map((r,a)=>r?(0,b.jsx)(`div`,{role:`gridcell`,"aria-selected":r===t,children:(0,b.jsx)(`button`,{type:`button`,"data-iso":r,tabIndex:r===s?0:-1,"aria-label":A_(r),"aria-current":r===o?`date`:void 0,onClick:()=>n(r),className:U(`size-8 rounded-md text-sm hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,r===o&&`font-semibold text-primary`,r===t&&`bg-primary text-primary-foreground hover:bg-primary/90`),children:_(e.parts(r).day)})},r):(0,b.jsx)(`div`,{role:`gridcell`,className:`h-8`},`empty-${i}-${a}`))},i))]})]});return(0,b.jsxs)(`div`,{className:`flex w-64 flex-col`,children:[E,(0,b.jsxs)(`div`,{className:`mt-2 flex justify-between gap-2 border-t pt-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>n(o),children:i(`date.today`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:i(`date.clear`)})]})]})}function xw({id:e,value:t,onChange:n,label:r,...i}){let{t:a}=Y(),[o=``,s=``]=t.split(`T`),c=(e,t)=>n(e===``?``:`${e}T${t||`00:00`}`);return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(vw,{id:e,live:!0,value:o,label:r,onChange:e=>c(e,s),className:`min-w-44 flex-1`,...i}),(0,b.jsx)(e_,{type:`time`,dir:`ltr`,"aria-label":a(`date.time`,{name:r}),className:`w-28`,value:s,onChange:e=>c(o,e.target.value)})]})}var Sw=new Set([`page`,`pageSize`,`sort`,`search`,`trashed`,`after`,`tab`]),Cw=e=>Sw.has(e)||e.startsWith(`filter[`);function ww(e){let t=new URLSearchParams;for(let[n,r]of e)r!==``&&Cw(n)&&t.append(n,r);return t.sort(),t.toString()}function Tw(e,t){return`filter[${e}][${t}]`}function Ew(e){return[...e.keys()].some(e=>e===`search`||e.startsWith(`filter[`))}function Dw(e){let t={};for(let n of e.keys())(n===`search`||n.startsWith(`filter[`))&&(t[n]=null);return t}function Ow(e,t){let n=new URLSearchParams(e);Object.keys(t).some(e=>e!==`page`&&e!==`after`)&&(n.delete(`page`),n.delete(`after`));for(let[e,r]of Object.entries(t))r===null?n.delete(e):n.set(e,r);return n}function kw(e,t){if(!e)return{summary:``,label:J(`list.page`,{page:t}),hasNext:!1};if(e.total===null)return{summary:``,label:J(`list.page`,{page:t}),hasNext:e.hasMore===!0};let n=Math.max(1,Math.ceil(e.total/e.pageSize)),r=E_(e.total);return{summary:J(e.estimated?`list.about`:`list.total`,{count:r}),label:e.estimated?J(`list.page`,{page:t}):J(`list.pageOf`,{page:t,pages:n}),hasNext:t<n}}function Aw(e,t,n){if(!e||e.total===null||e.total===0)return``;if(e.estimated)return J(`list.about`,{count:E_(e.total)});let r=(t-1)*e.pageSize+1;return J(`list.range`,{from:E_(r),to:E_(r+Math.max(n,1)-1),total:E_(e.total)})}function jw(e){return[...new Set([10,20,50,100,e])].filter(e=>e<=100).sort((e,t)=>e-t)}function Mw(e){let t=new Set;for(let[n,r]of e){let e=/^filter\[([^\][]+)\]/.exec(n);e&&r!==``&&t.add(e[1])}return t.size}function Nw(e,t){let n=e=>e===`search`||e===`sort`||e.startsWith(`filter[`),r={};for(let i of new Set([...e.keys(),...t.keys()]))n(i)&&e.get(i)!==t.get(i)&&(r[i]=t.get(i));return Object.fromEntries(Object.entries(r).sort(([e],[t])=>e.localeCompare(t)))}function Pw(e){return new Map([...e].filter(([e,t])=>e.startsWith(`filter[`)&&t!==``))}function Fw(e,t){let n=Pw(t),r=t.get(`tab`);return e?.find(e=>{if((e.where?e.key:null)!==r)return!1;let t=Object.entries(e.filter);return t.length===n.size&&t.every(([e,t])=>n.get(e)===t)})}function Iw(e,t){let n={};for(let e of Pw(t).keys())n[e]=null;return t.has(`tab`)&&(n.tab=null),Object.assign(n,e.filter),e.where?n.tab=e.key:t.has(`tab`)&&(n.tab=null),n}var Lw=`\0nma-empty`,Rw=e=>e===``?Lw:e,zw=e=>e===Lw?``:e;function Bw({id:e,value:t,onValueChange:n,options:r,placeholder:i,disabled:a,size:o=`md`,className:s,defaultOpen:c,onOpenChange:l,autoFocus:u,...d}){let{locale:f}=Y(),p=r.some(e=>e.value===t);return(0,b.jsxs)(pg,{value:p?Rw(t):``,onValueChange:e=>n(zw(e)),disabled:a,defaultOpen:c,onOpenChange:l,dir:w_(f)?`rtl`:`ltr`,children:[(0,b.jsxs)(hg,{id:e,autoFocus:u,"data-slot":`select`,"data-value":p?t:void 0,className:U(`flex w-full min-w-0 items-center justify-between gap-2 rounded-control border border-input bg-card px-2.5 text-start text-[13px] text-foreground outline-none transition-colors`,`focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50`,`aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground`,o===`sm`?`h-7 text-xs`:`h-8`,s),"aria-label":d[`aria-label`],"aria-invalid":d[`aria-invalid`],"aria-describedby":d[`aria-describedby`],"aria-busy":d[`aria-busy`],children:[(0,b.jsx)(`span`,{className:`truncate`,children:(0,b.jsx)(_g,{placeholder:i??`—`})}),(0,b.jsx)(vg,{asChild:!0,children:(0,b.jsx)(tb,{className:`size-3.5 shrink-0 opacity-60`,"aria-hidden":!0})})]}),(0,b.jsx)(xg,{children:(0,b.jsx)(Cg,{position:`popper`,sideOffset:4,className:`relative z-[60] max-h-[min(var(--radix-select-content-available-height),320px)] min-w-[var(--radix-select-trigger-width)] overflow-hidden rounded-control border border-border bg-card text-card-foreground shadow-[0_12px_32px_rgba(0,0,0,.14)] data-[state=open]:animate-in data-[state=open]:fade-in-0`,children:(0,b.jsx)(Fg,{className:`p-1`,children:r.map(e=>(0,b.jsxs)(Vg,{value:Rw(e.value),"data-value":e.value,lang:e.lang,className:`relative flex cursor-default select-none items-center gap-2 rounded-md py-1.5 ps-7 pe-2.5 text-[13px] outline-none data-[disabled]:opacity-50 data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground`,children:[(0,b.jsx)(`span`,{className:`absolute start-2 flex size-3.5 items-center justify-center`,children:(0,b.jsx)(Gg,{children:(0,b.jsx)($y,{className:`size-3.5`,"aria-hidden":!0})})}),(0,b.jsx)(Ug,{children:e.label})]},e.value))})})})]})}var Vw=[`auth.*`,`auth.login`,`auth.login_failed`,`auth.view_as`,`rbac.*`,`rbac.role.changed`,`rbac.user_roles.changed`,`page.*`],Hw=[`*`,`created`,`updated`,`deleted`,`restored`,`purged`,`action.*`];function Uw(){let{t:e,locale:t}=Y(),[n,r]=To(),i=Cv(),a=Sv(),o=a.data?.audit.view===!0,s=PC(n),c=mt({queryKey:[`audit`,s],initialPageParam:void 0,queryFn:({pageParam:e})=>Q.audit(s,e),getNextPageParam:e=>e.next,staleTime:0,enabled:o,retry:!1}),l=c.data?.pages.flatMap(e=>e.entries)??[],u=new Set((i.data?.groups??[]).flatMap(e=>e.resources.map(e=>e.name))),d=[...new Set(l.map(e=>e.resource).filter(e=>e!==void 0&&u.has(e)))].sort(),f=ut({queries:d.map(e=>({queryKey:[`schema`,e,t],queryFn:()=>Q.schema(e),retry:!1}))}),p=e=>f[d.indexOf(e)]?.data,m=new Set((i.data?.groups??[]).flatMap(e=>e.pages.map(e=>e.name))),h=[...new Set(l.map(e=>e.meta?.page).filter(e=>e!==void 0&&m.has(e)))].sort(),g=ut({queries:h.map(e=>({queryKey:[`page`,e,t],queryFn:()=>Q.page(e),retry:!1}))}),_=e=>g[h.indexOf(e)]?.data?.schema.fields,v=(e,t)=>r(n=>Ow(n,IC(e,t))),y=c.error instanceof U_&&(c.error.status===403||c.error.status===404);if(a.isPending)return(0,b.jsx)(W,{children:e(`common.loading`)});if(!o||y)return(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(ay,{children:e(`audit.title`)}),(0,b.jsx)(W,{tone:`error`,children:y?W_(c.error):e(a.data?.audit.enabled?`audit.notAllowed`:`audit.off`)})]});let x=(i.data?.groups??[]).flatMap(e=>e.resources),S=n.get(`resource`)??``;return(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(ay,{children:e(`audit.title`)}),(0,b.jsxs)(`fieldset`,{className:`grid gap-3 rounded-card border bg-card shadow-card p-3 sm:grid-cols-2 lg:grid-cols-3`,children:[(0,b.jsx)(`legend`,{className:`px-1 text-xs font-medium text-muted-foreground`,children:e(`filters.filters`)}),(0,b.jsx)(Ww,{label:e(`audit.filter.actor`),value:n.get(`actor`)??``,onCommit:e=>v(`actor`,e)}),(0,b.jsx)(Ww,{label:e(`audit.filter.event`),placeholder:e(`audit.filter.eventHint`),value:n.get(`event`)??``,onCommit:e=>v(`event`,e),hints:[...S?Hw.map(e=>`${S}.${e}`):[],...Vw]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`audit-resource`,children:e(`audit.filter.resource`)}),(0,b.jsx)(Bw,{id:`audit-resource`,value:S,onValueChange:e=>v(`resource`,e),options:[{value:``,label:e(`common.all`)},...S&&!x.some(e=>e.name===S)?[{value:S,label:S}]:[],...x.map(e=>({value:e.name,label:e.label}))]})]}),(0,b.jsx)(Ww,{label:e(`audit.filter.record`),placeholder:S?void 0:e(`audit.filter.recordHint`),value:S?n.get(`record`)??``:``,disabled:!S,onCommit:e=>v(`record`,e)}),[`from`,`to`].map(t=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`audit-${t}`,children:e(`filters.${t}`)}),(0,b.jsx)(vw,{id:`audit-${t}`,label:e(`filters.${t}`),value:n.get(t)??``,onChange:e=>v(t,e)})]},t)),FC(n)&&(0,b.jsx)(`div`,{className:`flex items-end sm:col-span-2 lg:col-span-3`,children:(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>r(e=>Ow(e,LC())),children:e(`filters.clear`)})})]}),c.isError&&(0,b.jsx)(oy,{children:W_(c.error)}),c.isPending?(0,b.jsx)(W,{children:e(`common.loading`)}):l.length===0?!c.isError&&(0,b.jsx)(W,{children:e(FC(n)?`audit.noMatches`:`audit.empty`)}):(0,b.jsx)(RC,{entries:l,now:new Date(c.dataUpdatedAt),names:hC(i.data,p),schemaOf:p,pageFieldsOf:_,onActor:e=>v(`actor`,e),showSubject:!0}),c.hasNextPage&&(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`self-center`,disabled:c.isFetchingNextPage,onClick:()=>void c.fetchNextPage(),children:e(c.isFetchingNextPage?`common.loading`:`list.loadMore`)})]})}function Ww({label:e,value:t,onCommit:n,placeholder:r,disabled:i,hints:a}){let o=(0,y.useId)(),[s,c]=(0,y.useState)(t);(0,y.useEffect)(()=>c(t),[t]);let l=()=>{s.trim()!==t&&n(s)};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:o,children:e}),(0,b.jsx)(e_,{id:o,type:`text`,dir:`auto`,value:s,placeholder:r,disabled:i,list:a?`${o}-hints`:void 0,autoComplete:`off`,spellCheck:!1,onChange:e=>c(e.target.value),onBlur:l,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),l())}}),a&&(0,b.jsx)(`datalist`,{id:`${o}-hints`,children:a.map(e=>(0,b.jsx)(`option`,{value:e},e))})]})}var Gw={hidden:`rbac.rule.hidden`,view:`rbac.rule.readonly`,edit:`rbac.rule.edit`};function Kw(){let{t:e}=Y(),[t,n]=To(),r=t.get(`user`)??``,i=t.get(`resource`)??``,a=t.get(`record`)??``,o=ft({queryKey:[`rbac`,`catalog`],queryFn:Q.rbac.catalog}),s=ft({queryKey:[`rbac`,`user`,r],queryFn:()=>Q.rbac.user(r),enabled:r!==``}),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(i),[f,p]=(0,y.useState)(a),[m,h]=(0,y.useState)(r),g=ft({queryKey:[`rbac`,`users`,c,1],queryFn:()=>Q.rbac.users({search:c}),enabled:c.trim().length>0}),_=ft({queryKey:[`rbac`,`explain`,r,i,a],queryFn:()=>Q.rbac.explain({user:r,resource:i,record:a||void 0}),enabled:r!==``&&i!==``});function v(e){e.preventDefault();let t={};m&&(t.user=m),u&&(t.resource=u),f.trim()&&(t.record=f.trim()),n(t)}let x=m===r?s.data?.displayName:void 0;return(0,b.jsxs)(`div`,{className:`flex max-w-5xl flex-col gap-5`,children:[(0,b.jsx)(ay,{children:e(`debugger.title`)}),(0,b.jsx)(`p`,{className:`-mt-3 text-sm text-muted-foreground`,children:e(`debugger.intro`)}),(0,b.jsxs)(`form`,{onSubmit:v,className:`grid gap-4 rounded-card border bg-card shadow-card p-4 md:grid-cols-3`,"aria-label":e(`debugger.title`),children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`debug-user`,children:e(`debugger.user`)}),(0,b.jsx)(e_,{id:`debug-user`,placeholder:e(`rbac.searchUsers`),value:c,onChange:e=>l(e.target.value),autoComplete:`off`}),c.trim()&&(0,b.jsx)(`ul`,{"aria-label":e(`rbac.searchResults`),className:`flex flex-col rounded-md border text-sm`,children:(g.data?.items??[]).slice(0,6).map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`button`,{type:`button`,className:`w-full px-2 py-1.5 text-start hover:bg-accent`,onClick:()=>{h(e.id),l(``)},children:[e.displayName,e.username&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.username]})]})},e.id))}),m&&(0,b.jsx)(`p`,{className:`text-sm`,"data-testid":`debug-chosen-user`,children:x??m})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`debug-resource`,children:e(`debugger.resource`)}),(0,b.jsx)(Bw,{id:`debug-resource`,className:`h-9`,value:u,onValueChange:d,options:[{value:``,label:`—`},...(o.data?.resources??[]).map(e=>({value:e.name,label:e.label}))]})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`debug-record`,children:e(`debugger.record`)}),(0,b.jsx)(e_,{id:`debug-record`,dir:`ltr`,value:f,onChange:e=>p(e.target.value)})]}),(0,b.jsx)(`div`,{className:`md:col-span-3`,children:(0,b.jsx)(q,{type:`submit`,disabled:!m||!u,children:e(`debugger.explain`)})})]}),!r||!i?(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`debugger.pick`)}):_.isPending?(0,b.jsx)(W,{children:e(`common.loading`)}):_.isError?(0,b.jsx)(W,{tone:`error`,children:W_(_.error)}):(0,b.jsx)(Jw,{data:_.data})]})}function qw({allowed:e}){let{t}=Y();return(0,b.jsx)(`span`,{className:U(`rounded-full px-2 py-0.5 text-xs font-medium`,e?`bg-green-500/15 text-green-800 dark:text-green-300`:`bg-destructive/10 text-destructive`),children:t(e?`debugger.allowed`:`debugger.denied`)})}function Jw({data:e}){let{t,locale:n}=Y(),r=e=>e.kind===`group`?t(`debugger.source.group`,{group:e.group??``}):t(`debugger.source.${e.kind}`),i=e=>e===`all`?t(`debugger.allRows`):e.length===0?t(`debugger.noRows`):t(`debugger.someRows`,{scopes:e.join(`, `)});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-5`,"data-testid":`explanation`,children:[(0,b.jsxs)(`section`,{"aria-labelledby":`debug-roles`,className:`flex flex-col gap-2`,children:[(0,b.jsxs)(`h2`,{id:`debug-roles`,className:`font-medium`,children:[t(`debugger.roles`),` · `,e.user.displayName]}),e.superuser?(0,b.jsx)(`p`,{className:`text-sm`,children:t(`debugger.superuser`)}):e.roles.length===0?(0,b.jsx)(`p`,{className:`text-sm`,children:t(`debugger.noRoles`)}):(0,b.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:e.roles.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`span`,{className:`font-medium`,children:ny(e.label,n)||e.name}),` `,(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.sources.map(r).join(`, `),`)`]}),!e.known&&(0,b.jsx)(`span`,{className:`ms-2 text-destructive`,children:t(`debugger.unknownRole`)})]},e.name))})]}),(0,b.jsxs)(`section`,{"aria-labelledby":`debug-operations`,className:`flex flex-col gap-2`,children:[(0,b.jsxs)(`h2`,{id:`debug-operations`,className:`font-medium`,children:[t(`debugger.operations`),` · `,e.resource.label]}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsx)(`table`,{className:`w-full text-sm`,children:(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.operations.map(n=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{scope:`row`,className:`w-32 px-3 py-2 text-start font-medium`,children:t(`rbac.op.${n.operation}`)}),(0,b.jsx)(`td`,{className:`w-24 px-3 py-2`,children:(0,b.jsx)(qw,{allowed:n.allowed})}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.superuser?``:n.grantedBy.length===0?t(`debugger.noGrant`):n.grantedBy.map(e=>t(e.via?`debugger.viaUpdate`:`debugger.grant`,{pattern:e.pattern,role:e.role})).join(` · `)})]},n.operation))})})})]}),e.actions.length>0&&(0,b.jsxs)(`section`,{"aria-labelledby":`debug-actions`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-actions`,className:`font-medium`,children:t(`debugger.actions`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsx)(`table`,{className:`w-full text-sm`,children:(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.actions.map(n=>(0,b.jsxs)(`tr`,{"data-action":n.name,children:[(0,b.jsx)(`th`,{scope:`row`,className:`w-32 px-3 py-2 text-start font-medium`,children:n.label}),(0,b.jsx)(`td`,{className:`w-24 px-3 py-2`,children:(0,b.jsx)(qw,{allowed:n.allowed})}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.superuser?``:[n.grantedBy.length===0?t(`debugger.noGrant`):n.grantedBy.map(e=>t(`debugger.grant`,{pattern:e.pattern,role:e.role})).join(` · `),...n.needsUpdate?[t(`debugger.needsUpdate`)]:[]].join(` — `)})]},n.name))})})})]}),(0,b.jsxs)(`section`,{"aria-labelledby":`debug-fields`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-fields`,className:`font-medium`,children:t(`debugger.fields`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{className:`bg-muted/40 text-xs text-muted-foreground`,children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.field`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.result`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.byRole`)})]})}),(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.fields.map(e=>(0,b.jsxs)(`tr`,{"data-field":e.name,children:[(0,b.jsxs)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-medium`,children:[e.label,e.restricted&&(0,b.jsx)(`span`,{className:`ms-2 rounded-full border px-1.5 text-xs font-normal text-muted-foreground`,children:t(`rbac.restricted`)})]}),(0,b.jsxs)(`td`,{className:`px-3 py-2`,children:[t(Gw[e.level]),e.forced&&(0,b.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:t(`debugger.forced`)})]}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.byRole.map(e=>`${e.role}: ${t(Gw[e.level])}${e.rule?` (${e.rule})`:``}${e.code?` (${e.code})`:``}`).join(` · `)})]},e.name))})]})})]}),(0,b.jsxs)(`section`,{"aria-labelledby":`debug-scopes`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-scopes`,className:`font-medium`,children:t(`debugger.scopes`)}),(0,b.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:e.scopes.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`span`,{className:`font-medium`,children:[t(`rbac.op.${e.operation}`),`:`]}),` `,i(e.result),e.byRole.length>0&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[` (`,e.byRole.map(e=>`${e.role}: ${i(e.scopes)}`).join(` · `),`)`]}),e.global.length>0&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,t(`debugger.globalScopes`,{scopes:e.global.join(`, `)})]})]},e.operation))})]}),e.record&&(0,b.jsxs)(`section`,{"aria-labelledby":`debug-record-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-record-title`,className:`font-medium`,children:t(`debugger.recordTitle`,{id:e.record.id})}),(0,b.jsxs)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:[[`view`,`update`,`delete`].map(n=>(0,b.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,"data-operation":n,children:[(0,b.jsx)(`span`,{className:`w-24 font-medium`,children:t(`rbac.op.${n}`)}),(0,b.jsx)(qw,{allowed:e.record[n]}),e.record.reasons[n]&&(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:t(`debugger.reason.${e.record.reasons[n]}`)})]},n)),e.record.actions&&(0,b.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,"data-operation":`actions`,children:[(0,b.jsx)(`span`,{className:`w-24 font-medium`,children:t(`debugger.actions`)}),(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e.record.actions.length===0?t(`debugger.noRecordActions`):e.record.actions.map(t=>e.actions.find(e=>e.name===t)?.label??t).join(`, `)})]})]})]}),e.pages.length>0&&(0,b.jsxs)(`section`,{"aria-labelledby":`debug-pages`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`debug-pages`,className:`font-medium`,children:t(`debugger.pages`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{className:`bg-muted/40 text-xs text-muted-foreground`,children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`rbac.page`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`rbac.op.view`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`rbac.op.update`)}),(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:t(`debugger.byRole`)})]})}),(0,b.jsx)(`tbody`,{className:`divide-y`,children:e.pages.map(n=>(0,b.jsxs)(`tr`,{"data-page":n.name,children:[(0,b.jsx)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-medium`,children:n.label}),(0,b.jsx)(`td`,{className:`px-3 py-2`,"data-operation":`view`,children:(0,b.jsx)(qw,{allowed:n.view})}),(0,b.jsx)(`td`,{className:`px-3 py-2`,"data-operation":`update`,children:(0,b.jsx)(qw,{allowed:n.update})}),(0,b.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:e.superuser?``:n.grantedBy.length===0?t(`debugger.noGrant`):n.grantedBy.map(e=>`${t(`debugger.grant`,{pattern:e.pattern,role:e.role})} (${e.code})`).join(` · `)})]},n.name))})]})})]})]})}function Yw(){let{t:e,locale:t}=Y(),n=Sv(),r=ft({queryKey:[`rbac`,`groups`],queryFn:Q.rbac.groups});return r.isPending?(0,b.jsx)(W,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(W,{tone:`error`,children:W_(r.error)}):(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(ay,{actions:n.data?.rbac.manage&&(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(xo,{to:`/-/groups/new`,children:[(0,b.jsx)(Gx,{}),e(`rbac.newGroup`)]})}),children:e(`rbac.groups`)}),r.data.items.length===0&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`rbac.noGroups`)}),(0,b.jsx)(`ul`,{"aria-label":e(`rbac.groups`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card empty:hidden`,children:r.data.items.map(n=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(xo,{to:`/-/groups/${n.id}`,className:`flex flex-wrap items-center justify-between gap-2 px-4 py-3 hover:bg-muted/50`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:ny(n.label,t)||n.name}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`rbac.groupSummary`,{roles:n.roles.length,members:n.members.length})})]})},n.id))})]})}function Xw(){let{t:e}=Y(),{id:t}=$i(),n=t===void 0,r=ft({queryKey:[`rbac`,`roles`],queryFn:Q.rbac.roles}),i=ft({queryKey:[`rbac`,`group`,t],queryFn:()=>Q.rbac.group(Number(t)),enabled:!n});return r.isPending||!n&&i.isPending?(0,b.jsx)(W,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(W,{tone:`error`,children:W_(r.error)}):!n&&i.isError?(0,b.jsx)(W,{tone:`error`,children:W_(i.error)}):(0,b.jsx)(Zw,{roles:r.data.items,group:n?void 0:i.data},t??`new`)}function Zw({roles:e,group:t}){let{t:n,locale:r}=Y(),i=Yi(),a=S(),o=Sv().data?.rbac.manage!==!0,[s,c]=(0,y.useState)(t?.name??``),[l,u]=(0,y.useState)(iy(t?.label)),[d,f]=(0,y.useState)(t?.roles??[]),[p,m]=(0,y.useState)(t?.members??[]),[h,g]=(0,y.useState)(``),_=ft({queryKey:[`rbac`,`users`,h],queryFn:()=>Q.rbac.users({search:h}),enabled:h.trim().length>0}),v=ft({queryKey:[`rbac`,`users`,``,1],queryFn:()=>Q.rbac.users({})}),[x,C]=(0,y.useState)({}),w=e=>x[e]??v.data?.items.find(t=>t.id===e)?.displayName??e,[T,E]=(0,y.useState)(null),D=pt({mutationFn:()=>Q.rbac.saveGroup({name:s.trim(),label:ry(l)??null,roles:d,members:p},t?.id),onSuccess:async e=>{await a.invalidateQueries({queryKey:[`rbac`]}),await a.invalidateQueries({queryKey:[`session`]}),i(`/-/groups/${e.id}`,{replace:!0}),E(null)},onError:e=>E(W_(e))}),O=pt({mutationFn:()=>Q.rbac.deleteGroup(t.id),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`rbac`]}),i(`/-/groups`)},onError:e=>E(W_(e))});function k(e){e.preventDefault(),o||D.mutate()}return(0,b.jsxs)(`form`,{onSubmit:k,className:`flex max-w-3xl flex-col gap-5`,"aria-label":n(`rbac.group`),children:[(0,b.jsx)(ay,{children:t?ny(t.label,r)||t.name:n(`rbac.newGroup`)}),T&&(0,b.jsx)(oy,{children:T}),(0,b.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`group-name`,children:n(`rbac.name`)}),(0,b.jsx)(e_,{id:`group-name`,dir:`ltr`,value:s,disabled:o,onChange:e=>c(e.target.value)})]}),L_.locales.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`group-label-${e}`,children:n(`rbac.labelIn`,{language:e})}),(0,b.jsx)(e_,{id:`group-label-${e}`,value:l[e]??``,disabled:o,onChange:t=>u({...l,[e]:t.target.value})})]},e))]}),(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:n(`rbac.roles`)}),e.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:d.includes(e.name),disabled:o,onChange:t=>f(t.target.checked?[...d,e.name]:d.filter(t=>t!==e.name))}),ny(e.label,r)||e.name]},e.name))]}),(0,b.jsxs)(`section`,{"aria-labelledby":`members-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`members-title`,className:`font-medium`,children:n(`rbac.members`)}),(0,b.jsxs)(`ul`,{"aria-label":n(`rbac.members`),className:`flex flex-wrap gap-2`,children:[p.map(e=>(0,b.jsxs)(`li`,{className:`flex items-center gap-1 rounded-full border px-2 py-0.5 text-sm`,children:[w(e),!o&&(0,b.jsx)(`button`,{type:`button`,"aria-label":n(`picker.remove`,{name:w(e)}),onClick:()=>m(p.filter(t=>t!==e)),children:(0,b.jsx)($S,{className:`size-3.5`})})]},e)),p.length===0&&(0,b.jsx)(`li`,{className:`text-sm text-muted-foreground`,children:n(`rbac.noMembers`)})]}),!o&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`member-search`,children:n(`rbac.addMember`)}),(0,b.jsx)(e_,{id:`member-search`,value:h,placeholder:n(`rbac.searchUsers`),onChange:e=>g(e.target.value)}),(0,b.jsx)(`ul`,{"aria-label":n(`rbac.searchResults`),className:`flex flex-wrap gap-2`,children:(_.data?.items??[]).filter(e=>!p.includes(e.id)).map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{C({...x,[e.id]:e.displayName}),m([...p,e.id])},children:[(0,b.jsx)(Gx,{}),e.displayName,e.username?` (${e.username})`:``]})},e.id))})]})]}),!o&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`submit`,disabled:D.isPending||!s.trim(),children:n(D.isPending?`form.saving`:`form.save`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>i(`/-/groups`),children:n(`common.cancel`)}),t&&(0,b.jsx)(q,{type:`button`,variant:`outline`,className:`ms-auto`,disabled:O.isPending,onClick:()=>O.mutate(),children:n(`form.delete`)})]})]})}var Qw=[`view`,`create`,`update`,`delete`,`purge`,`field`,`action`];function $w(e,t){let n=e.split(`.`),r=t.split(`.`),i=r[0]===`page`&&!Qw.includes(r[1]??``)&&(r.length===2||r.length===3&&r[2]===`update`);if(n[0]===`*`&&n.length>1&&i)return!1;for(let e=0;e<n.length;e++){let t=n[e];if(t===`*`&&e===n.length-1)return r.length>e;if(e>=r.length||t!==`*`&&t!==r[e])return!1}return n.length===r.length}function eT(e){let t=[...e.global];for(let n of e.resources){for(let r of e.operations)t.push(`${n.name}.${r}`);for(let e of n.custom)t.push(`${n.name}.${e}`);for(let e of n.actions)t.push(`${n.name}.action.${e.name}`)}for(let n of e.pages)t.push(`page.${n.name}`,`page.${n.name}.update`);return t}function tT(e,t){return e.some(e=>$w(e,t))}function nT(e,t,n,r){if(n)return tT(e,t)?e:[...e,t];let i=[];for(let n of e)if(n!==t){if(n.includes(`*`)&&$w(n,t)){for(let e of r)e!==t&&$w(n,e)&&!i.includes(e)&&i.push(e);continue}i.push(n)}return i.filter(e=>e===t||!$w(e,t))}var rT=[`view`,`update`,`delete`];function iT(){let{t:e}=Y(),{name:t}=$i(),n=t===void 0,r=ft({queryKey:[`rbac`,`catalog`],queryFn:Q.rbac.catalog}),i=ft({queryKey:[`rbac`,`role`,t],queryFn:()=>Q.rbac.role(t),enabled:!n});return r.isPending||!n&&i.isPending?(0,b.jsx)(W,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(W,{tone:`error`,children:W_(r.error)}):!n&&i.isError?(0,b.jsx)(W,{tone:`error`,children:W_(i.error)}):(0,b.jsx)(aT,{catalog:r.data,role:n?void 0:i.data},t??`new`)}function aT({catalog:e,role:t}){let{t:n,locale:r}=Y(),i=Yi(),a=S(),o=Sv(),s=t?.system===!0||o.data?.rbac.manage!==!0,c=eT(e),[l,u]=(0,y.useState)(t?.name??``),[d,f]=(0,y.useState)(iy(t?.label)),[p,m]=(0,y.useState)(t?.permissions??[]),[h,g]=(0,y.useState)(t?.fields??{}),[_,v]=(0,y.useState)(t?.scopes??{}),[x,C]=(0,y.useState)(null),[w,T]=(0,y.useState)(null),E=pt({mutationFn:()=>{let e={label:ry(d),permissions:p,fields:oT(h),scopes:oT(_)};return t?Q.rbac.updateRole(t.name,e):Q.rbac.createRole({name:l.trim(),...e})},onSuccess:async e=>{await a.invalidateQueries({queryKey:[`rbac`]}),await a.invalidateQueries({queryKey:[`session`]}),i(`/-/roles/${encodeURIComponent(e.name)}`,{replace:!0}),T(null)},onError:e=>T(e instanceof U_?[e.message,...Object.values(e.fields).flat()].join(` — `):W_(e))}),D=pt({mutationFn:()=>Q.rbac.deleteRole(t.name),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`rbac`]}),i(`/-/roles`)},onError:e=>T(W_(e))}),O=(e,t)=>m(n=>nT(n,e,t,c)),k=(e,t,n)=>g(r=>{let i={...r,[e]:{...r[e]}};return n===``?delete i[e][t]:i[e][t]=n,i}),A=(e,t,n,r)=>v(i=>{let a=i[e]?.[t],o=new Set(Array.isArray(a)?a:a?[a]:[]);return r?o.add(n):o.delete(n),{...i,[e]:{...i[e],[t]:[...o]}}});function j(e){e.preventDefault(),s||E.mutate()}let M=[...new Set(e.resources.map(e=>e.group))];return(0,b.jsxs)(`form`,{onSubmit:j,className:`flex max-w-5xl flex-col gap-5`,"aria-label":n(`rbac.role`),children:[(0,b.jsx)(ay,{children:t?ny(t.label,r)||t.name:n(`rbac.newRole`)}),t?.system&&(0,b.jsx)(oy,{tone:`success`,children:n(`rbac.systemNote`)}),w&&(0,b.jsx)(oy,{children:w}),(0,b.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`role-name`,children:n(`rbac.name`)}),(0,b.jsx)(e_,{id:`role-name`,dir:`ltr`,value:l,disabled:!!t,onChange:e=>u(e.target.value)})]}),L_.locales.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`role-label-${e}`,children:n(`rbac.labelIn`,{language:e})}),(0,b.jsx)(e_,{id:`role-label-${e}`,value:d[e]??``,disabled:s,onChange:t=>f({...d,[e]:t.target.value})})]},e))]}),(0,b.jsxs)(`section`,{"aria-labelledby":`matrix-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`matrix-title`,className:`font-medium`,children:n(`rbac.matrix`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b bg-muted/40`,children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:n(`rbac.resource`)}),e.operations.map(e=>(0,b.jsx)(`th`,{className:`px-2 py-2 text-center font-medium`,children:n(`rbac.op.${e}`)},e)),(0,b.jsx)(`th`,{className:`w-0`})]})}),(0,b.jsx)(`tbody`,{children:M.map(t=>(0,b.jsx)(y.Fragment,{children:e.resources.filter(e=>e.group===t).map(t=>{let r=x===t.name,i=`role-details-${t.name}`;return(0,b.jsxs)(y.Fragment,{children:[(0,b.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,b.jsx)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-normal`,children:t.label}),e.operations.map(e=>{let r=`${t.name}.${e}`;return(0,b.jsx)(`td`,{className:`px-2 py-2 text-center`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":n(`rbac.grant`,{operation:n(`rbac.op.${e}`),resource:t.label}),checked:tT(p,r),disabled:s,onChange:e=>O(r,e.target.checked)})},e)}),(0,b.jsx)(`td`,{className:`px-2`,children:(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-expanded":r,"aria-controls":i,"aria-label":n(`rbac.details`,{resource:t.label}),onClick:()=>C(r?null:t.name),children:(0,b.jsx)(tb,{className:U(`transition-transform`,r&&`rotate-180`)})})})]}),r&&(0,b.jsx)(`tr`,{id:i,className:`border-b bg-muted/20`,children:(0,b.jsx)(`td`,{colSpan:e.operations.length+2,className:`px-3 py-3`,children:(0,b.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.fields`)}),t.fields.map(e=>(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsxs)(`span`,{children:[e.label,e.restricted&&(0,b.jsx)(`span`,{className:`ms-2 rounded-full bg-amber-500/15 px-2 py-0.5 text-xs text-amber-800 dark:text-amber-300`,children:n(`rbac.restricted`)})]}),(0,b.jsx)(Bw,{className:`w-auto min-w-36`,value:h[t.name]?.[e.name]??``,disabled:s,"aria-label":n(`rbac.fieldRule`,{field:e.label}),onValueChange:n=>k(t.name,e.name,n),options:[{value:``,label:n(e.restricted?`rbac.rule.defaultHidden`:`rbac.rule.default`)},{value:`hidden`,label:n(`rbac.rule.hidden`)},{value:`readonly`,label:n(`rbac.rule.readonly`)},{value:`edit`,label:n(`rbac.rule.edit`)}]})]},e.name))]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t.scopes.length>0&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.scopes`)}),rT.map(e=>{let r=_[t.name]?.[e],i=Array.isArray(r)?r:r?[r]:[];return(0,b.jsxs)(`fieldset`,{className:`flex flex-wrap items-center gap-3`,children:[(0,b.jsxs)(`legend`,{className:`me-2 text-sm`,children:[n(`rbac.op.${e}`),`:`]}),t.scopes.map(n=>(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:i.includes(n),disabled:s,onChange:r=>A(t.name,e,n,r.target.checked)}),n]},n)),i.length===0&&(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`rbac.allRows`)})]},e)})]}),t.actions.length>0&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,"data-actions":t.name,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.actions`)}),t.actions.map(e=>{let n=`${t.name}.action.${e.name}`;return(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:tT(p,n),disabled:s,onChange:e=>O(n,e.target.checked)}),e.label,(0,b.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:n})]},e.name)}),t.actions.some(e=>e.target===`record`)&&(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`rbac.actionNote`)})]}),t.custom.length>0&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n(`rbac.custom`)}),t.custom.map(e=>{let n=`${t.name}.${e}`;return(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:tT(p,n),disabled:s,onChange:e=>O(n,e.target.checked)}),(0,b.jsx)(`code`,{className:`text-xs`,children:n})]},e)})]})]})]})})})]},t.name)})},t))})]})})]}),e.pages.length>0&&(0,b.jsxs)(`section`,{"aria-labelledby":`pages-title`,className:`flex flex-col gap-2`,children:[(0,b.jsx)(`h2`,{id:`pages-title`,className:`font-medium`,children:n(`rbac.pages`)}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-card border bg-card shadow-card`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b bg-muted/40`,children:[(0,b.jsx)(`th`,{className:`px-3 py-2 text-start font-medium`,children:n(`rbac.page`)}),(0,b.jsx)(`th`,{className:`px-2 py-2 text-center font-medium`,children:n(`rbac.op.view`)}),(0,b.jsx)(`th`,{className:`px-2 py-2 text-center font-medium`,children:n(`rbac.op.update`)})]})}),(0,b.jsx)(`tbody`,{children:e.pages.map(e=>{let t=`page.${e.name}`,r=`${t}.update`,i=tT(p,r)&&!tT(p,t);return(0,b.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,b.jsx)(`th`,{scope:`row`,className:`px-3 py-2 text-start font-normal`,children:e.label}),(0,b.jsx)(`td`,{className:`px-2 py-2 text-center`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":n(`rbac.grant`,{operation:n(`rbac.op.view`),resource:e.label}),title:i?n(`rbac.viewImplied`):void 0,checked:i||tT(p,t),disabled:s||i,onChange:e=>O(t,e.target.checked)})}),(0,b.jsx)(`td`,{className:`px-2 py-2 text-center`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":n(`rbac.grant`,{operation:n(`rbac.op.update`),resource:e.label}),checked:tT(p,r),disabled:s,onChange:e=>O(r,e.target.checked)})})]},e.name)})})]})})]}),e.global.length>0&&(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:n(`rbac.global`)}),e.global.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:tT(p,e),disabled:s,onChange:t=>O(e,t.target.checked)}),(0,b.jsx)(`code`,{className:`text-xs`,children:e})]},e))]}),!s&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`submit`,disabled:E.isPending||!t&&!l.trim(),children:n(E.isPending?`form.saving`:`form.save`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>i(`/-/roles`),children:n(`common.cancel`)}),t&&(0,b.jsx)(q,{type:`button`,variant:`outline`,className:`ms-auto`,disabled:D.isPending,onClick:()=>D.mutate(),children:n(`form.delete`)})]})]})}function oT(e){let t=Object.entries(e).map(([e,t])=>[e,Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0&&!(Array.isArray(e)&&e.length===0)))]).filter(([,e])=>Object.keys(e).length>0);return t.length>0?Object.fromEntries(t):void 0}function sT(){let{t:e,locale:t}=Y(),n=Sv(),r=S(),i=ft({queryKey:[`rbac`,`roles`],queryFn:Q.rbac.roles}),a=(0,y.useRef)(null),[o,s]=(0,y.useState)(null),c=n.data?.rbac.manage===!0,l=pt({mutationFn:async e=>Q.rbac.importRoles(JSON.parse(await e.text())),onSuccess:async t=>{s(e(`rbac.imported`,{count:t.imported.length})),await r.invalidateQueries({queryKey:[`rbac`]})}});async function u(){let e=await Q.rbac.exportRoles(),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`roles.json`,n.click(),URL.revokeObjectURL(t)}return i.isPending?(0,b.jsx)(W,{children:e(`common.loading`)}):i.isError?(0,b.jsx)(W,{tone:`error`,children:W_(i.error)}):(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(ay,{actions:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(q,{variant:`outline`,onClick:()=>void u(),children:[(0,b.jsx)(xb,{}),e(`rbac.export`)]}),c&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`input`,{ref:a,type:`file`,accept:`application/json,.json`,className:`hidden`,"aria-label":e(`rbac.importFile`),onChange:e=>{let t=e.target.files?.[0];t&&l.mutate(t),e.target.value=``}}),(0,b.jsxs)(q,{variant:`outline`,onClick:()=>a.current?.click(),children:[(0,b.jsx)(zS,{}),e(`rbac.import`)]}),(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(xo,{to:`/-/roles/new`,children:[(0,b.jsx)(Gx,{}),e(`rbac.newRole`)]})})]})]}),children:e(`rbac.roles`)}),o&&(0,b.jsx)(oy,{tone:`success`,children:o}),l.isError&&(0,b.jsx)(oy,{children:l.error instanceof SyntaxError?e(`rbac.notJson`):W_(l.error)}),(0,b.jsx)(`ul`,{"aria-label":e(`rbac.roles`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card`,children:i.data.items.map(n=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(xo,{to:`/-/roles/${encodeURIComponent(n.name)}`,className:`flex flex-wrap items-center justify-between gap-2 px-4 py-3 hover:bg-muted/50`,children:[(0,b.jsxs)(`span`,{className:`flex flex-col`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:ny(n.label,t)||n.name}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.name})]}),(0,b.jsxs)(`span`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e(`rbac.permissionCount`,{count:n.permissions.length}),n.system&&(0,b.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5`,children:e(`rbac.system`)})]})]})},n.name))})]})}function cT(){let{t:e}=Y(),t=Sv(),[n,r]=To(),i=n.get(`search`)??``,a=Math.max(1,Number(n.get(`page`))||1),[o,s]=(0,y.useState)(i),c=ft({queryKey:[`rbac`,`users`,i,a],queryFn:()=>Q.rbac.users({search:i,page:a})});if(c.isPending)return(0,b.jsx)(W,{children:e(`common.loading`)});if(c.isError)return(0,b.jsx)(W,{tone:`error`,children:W_(c.error)});let{items:l,total:u,pageSize:d,capabilities:f}=c.data;return(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(ay,{actions:t.data?.rbac.manage&&f.create&&(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(xo,{to:`/-/users/new`,children:[(0,b.jsx)(Gx,{}),e(`rbac.newUser`)]})}),children:e(`rbac.users`)}),!f.list&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`rbac.usersFromMemberships`)}),(0,b.jsxs)(`form`,{role:`search`,className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),r(o.trim()?{search:o.trim()}:{})},children:[(0,b.jsx)(e_,{"aria-label":e(`rbac.searchUsers`),placeholder:e(`rbac.searchUsers`),value:o,onChange:e=>s(e.target.value)}),(0,b.jsx)(q,{type:`submit`,variant:`outline`,children:e(`filters.search`)})]}),(0,b.jsxs)(`ul`,{"aria-label":e(`rbac.users`),className:`flex flex-col divide-y rounded-card border bg-card shadow-card`,children:[l.map(t=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(xo,{to:`/-/users/${encodeURIComponent(t.id)}`,className:`flex flex-wrap items-center justify-between gap-2 px-4 py-3 hover:bg-muted/50`,children:[(0,b.jsxs)(`span`,{className:`flex flex-col`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:t.displayName}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:[t.username,t.email].filter(Boolean).join(` · `)})]}),(0,b.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-xs`,children:[t.isSuperuser&&(0,b.jsx)(`span`,{className:`rounded-full bg-purple-500/15 px-2 py-0.5 text-purple-800 dark:text-purple-300`,children:e(`rbac.superuser`)}),t.isActive===!1&&(0,b.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-muted-foreground`,children:e(`rbac.inactive`)}),t.twoFactor&&(0,b.jsx)(`span`,{className:`rounded-full bg-green-500/15 px-2 py-0.5 text-green-800 dark:text-green-300`,children:e(`rbac.twoFactor`)}),t.roles.map(e=>(0,b.jsx)(`span`,{className:`rounded-full border px-2 py-0.5`,children:e},e))]})]})},t.id)),l.length===0&&(0,b.jsx)(`li`,{className:`px-4 py-3 text-sm text-muted-foreground`,children:e(`list.noMatches`)})]}),u>d&&(0,b.jsxs)(`div`,{className:`flex items-center justify-end gap-2 text-sm`,children:[(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:a<=1,onClick:()=>r({...i?{search:i}:{},page:String(a-1)}),children:e(`list.previousPage`)}),(0,b.jsx)(`span`,{children:e(`list.pageOf`,{page:a,pages:Math.ceil(u/d)})}),(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:a*d>=u,onClick:()=>r({...i?{search:i}:{},page:String(a+1)}),children:e(`list.nextPage`)})]})]})}function lT(){let{t:e}=Y(),{id:t}=$i(),n=t===void 0,r=ft({queryKey:[`rbac`,`roles`],queryFn:Q.rbac.roles}),i=ft({queryKey:[`rbac`,`groups`],queryFn:Q.rbac.groups}),a=ft({queryKey:[`rbac`,`user`,t],queryFn:()=>Q.rbac.user(t),enabled:!n}),o=ft({queryKey:[`rbac`,`users`,``,1],queryFn:()=>Q.rbac.users({})});if(r.isPending||i.isPending||o.isPending||!n&&a.isPending)return(0,b.jsx)(W,{children:e(`common.loading`)});let s=r.error??i.error??o.error??(n?null:a.error);return s?(0,b.jsx)(W,{tone:`error`,children:W_(s)}):(0,b.jsx)(uT,{user:n?void 0:a.data,roles:r.data.items,groups:i.data.items,capabilities:o.data.capabilities},t??`new`)}function uT({user:e,roles:t,groups:n,capabilities:r}){let{t:i,locale:a}=Y(),o=Yi(),s=S(),c=Sv(),l=c.data?.rbac.manage===!0,u=c.data?.user.isSuperuser===!0,[d,f]=(0,y.useState)(``),[p,m]=(0,y.useState)(e?.displayName??``),[h,g]=(0,y.useState)(e?.email??``),[_,v]=(0,y.useState)(e?.isActive!==!1),[x,C]=(0,y.useState)(e?.isSuperuser===!0),[w,T]=(0,y.useState)(e?.roles??[]),[E,D]=(0,y.useState)(e?.groups??[]),[O,k]=(0,y.useState)(``),[A,j]=(0,y.useState)({}),[M,N]=(0,y.useState)(null),[ee,P]=(0,y.useState)(null),F=l&&(!e?.isSuperuser||u),te=e=>{e instanceof U_&&Object.keys(e.fields).length>0?(j(e.fields),N(e.message)):(j({}),N(W_(e)))},ne=pt({mutationFn:()=>{let t=r.update||!e?{displayName:p,email:h||null,isActive:_,...u?{isSuperuser:x}:{}}:{};return e?Q.rbac.updateUser(e.id,{...t,roles:w,groups:E}):Q.rbac.createUser({username:d,displayName:p,email:h||null,password:O,...u?{isSuperuser:x}:{},roles:w,groups:E})},onSuccess:async e=>{await s.invalidateQueries({queryKey:[`rbac`]}),j({}),N(null),P(i(`rbac.saved`)),o(`/-/users/${encodeURIComponent(e.id)}`,{replace:!0})},onError:te}),re=pt({mutationFn:()=>Q.rbac.resetTwoFactor(e.id),onSuccess:async()=>{await s.invalidateQueries({queryKey:[`rbac`]}),N(null),P(i(`rbac.twoFactorReset`))},onError:te}),ie=!!e&&u&&!c.data?.viewAs&&e.id!==c.data?.user.id&&e.isActive!==!1,ae=pt({mutationFn:()=>Q.rbac.setPassword(e.id,O),onSuccess:()=>{k(``),j({}),N(null),P(i(`rbac.passwordSet`))},onError:te});function oe(e){e.preventDefault(),P(null),F&&ne.mutate()}let se=(t,n,i,a,o={})=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:t,children:n}),(0,b.jsx)(e_,{id:t,value:i,disabled:!F||!!e&&!r.update,onChange:e=>a(e.target.value),"aria-invalid":A[t.replace(`user-`,``)]?!0:void 0,...o}),A[t.replace(`user-`,``)]&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:A[t.replace(`user-`,``)].join(` `)})]});return(0,b.jsxs)(`form`,{onSubmit:oe,className:`flex max-w-3xl flex-col gap-5`,"aria-label":i(`rbac.user`),children:[(0,b.jsx)(ay,{actions:ie&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,onClick:()=>{tv(e.id),s.clear(),o(`/`)},children:[(0,b.jsx)(kb,{}),i(`viewAs.start`)]}),children:e?e.displayName:i(`rbac.newUser`)}),M&&(0,b.jsx)(oy,{children:M}),ee&&(0,b.jsx)(oy,{tone:`success`,children:ee}),e?.isSuperuser&&!u&&(0,b.jsx)(oy,{tone:`success`,children:i(`rbac.superuserNote`)}),(0,b.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[!e&&se(`user-username`,i(`auth.username`),d,f,{dir:`ltr`,autoComplete:`off`}),se(`user-displayName`,i(`rbac.displayName`),p,m),se(`user-email`,i(`rbac.email`),h,g,{type:`email`,dir:`ltr`}),!e&&se(`user-password`,i(`auth.password`),O,k,{type:`password`,autoComplete:`new-password`})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-6 text-sm`,children:[(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:_,disabled:!F||!!e&&!r.update,onChange:e=>v(e.target.checked)}),i(`rbac.active`)]}),u&&(0,b.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:x,disabled:!F,onChange:e=>C(e.target.checked)}),i(`rbac.superuser`)]})]}),(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:i(`rbac.roles`)}),t.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:w.includes(e.name),disabled:!F,onChange:t=>T(t.target.checked?[...w,e.name]:w.filter(t=>t!==e.name))}),ny(e.label,a)||e.name]},e.name))]}),n.length>0&&(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(`legend`,{className:`mb-1 font-medium`,children:i(`rbac.groups`)}),n.map(e=>(0,b.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,checked:E.includes(e.id),disabled:!F,onChange:t=>D(t.target.checked?[...E,e.id]:E.filter(t=>t!==e.id))}),ny(e.label,a)||e.name]},e.id))]}),F&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`submit`,disabled:ne.isPending,children:i(ne.isPending?`form.saving`:e?`form.save`:`rbac.createUser`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>o(`/-/users`),children:i(`common.cancel`)})]}),e&&F&&r.password&&(0,b.jsxs)(`section`,{"aria-labelledby":`set-password`,className:`flex flex-col gap-2 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsx)(`h2`,{id:`set-password`,className:`font-medium`,children:i(`rbac.setPassword`)}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`user-new-password`,children:i(`auth.newPassword`)}),(0,b.jsx)(e_,{id:`user-new-password`,type:`password`,autoComplete:`new-password`,value:O,onChange:e=>k(e.target.value)})]}),(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:!O||ae.isPending,onClick:()=>ae.mutate(),children:i(`rbac.setPassword`)})]}),A.password&&e&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:A.password.join(` `)}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`rbac.setPasswordNote`)})]}),e?.twoFactor&&F&&r.resetTwoFactor&&(0,b.jsxs)(`section`,{"aria-labelledby":`reset-two-factor`,className:`flex flex-col gap-2 rounded-card border bg-card shadow-card p-4`,children:[(0,b.jsx)(`h2`,{id:`reset-two-factor`,className:`font-medium`,children:i(`rbac.resetTwoFactor`)}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`rbac.resetTwoFactorNote`)}),(0,b.jsx)(`div`,{children:(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:re.isPending,onClick:()=>re.mutate(),children:i(`rbac.resetTwoFactor`)})})]})]})}var dT=`fixed inset-0 z-40 bg-black/40 backdrop-blur-sm dark:bg-black/60 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150`;function fT(e){if(!e.menu)return e.groups.map(e=>({...e,items:[...e.resources.map(e=>({kind:`resource`,name:e.name,label:e.label,...e.icon?{icon:e.icon}:{}})),...e.pages.map(e=>({kind:`page`,name:e.name,label:e.label,...e.icon?{icon:e.icon}:{}}))]}));let{sections:t,advanced:n}=e.menu;return[...t,...n.items.length>0?[n]:[]].map(e=>{let t=[],r=[],i=e.items.map(n=>n.kind===`resource`?(t.push({name:n.resource,label:n.label,...n.icon?{icon:n.icon}:{},creatable:n.creatable,searchable:n.searchable}),{kind:`resource`,name:n.resource,label:n.label,...n.icon?{icon:n.icon}:{},...n.badge?{badge:`${e.key}.${n.resource}`}:{}}):n.kind===`page`?(r.push({name:n.page,label:n.label,...n.icon?{icon:n.icon}:{}}),{kind:`page`,name:n.page,label:n.label,...n.icon?{icon:n.icon}:{}}):n);return{key:e.key,label:e.label,...e.icon?{icon:e.icon}:{},resources:t,pages:r,items:i,...e===n?{advanced:!0}:{}}})}function pT(e,t){let n=e.flatMap(e=>e.kind===`resource`&&e.badge&&t?.[e.badge]?[t[e.badge]]:[]);if(n.length!==0)return{count:n.reduce((e,t)=>e+t.count,0),estimate:n.some(e=>e.estimate)}}function mT({menu:e,current:t}){return e&&!t}function hT(e){return i_(e).toLocaleLowerCase().replace(/[يى]/g,`ی`).replace(/ك/g,`ک`).replace(//g,` `)}function gT(e,t){let n=hT(e);return hT(t).split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function _T(e,t,n,r=[]){let i=[],a=[],o=fT(e),s=t.trim()!==``;for(let r of o){o.length>1&&gT(r.label,t)&&i.push({id:`group:${r.key}`,section:`go`,label:r.label,to:`/g/${r.key}`,...r.icon?{icon:r.icon}:{}});for(let o of r.resources){let c=o.icon??r.icon;gT(`${o.label} ${r.label}`,t)&&i.push({id:`go:${o.name}`,section:`go`,label:o.label,detail:r.label,to:`/${o.name}`,...c?{icon:c}:{}});let l=n(o.label),u=s||e.menu!==void 0&&!r.advanced&&a.length<3;o.creatable&&u&&gT(l,t)&&a.push({id:`new:${o.name}`,section:`actions`,label:l,to:`/${o.name}/new`})}for(let e of r.pages){let n=e.icon??r.icon;gT(`${e.label} ${r.label}`,t)&&i.push({id:`page:${e.name}`,section:`go`,label:e.label,detail:r.label,to:`/p/${e.name}`,...n?{icon:n}:{}})}}let c=r.filter(e=>gT(e.label,t)).map(e=>({id:e.id,section:`actions`,label:e.label}));return[...i,...a,...c]}var vT=`nma.theme`,yT=`oklch(0.145 0 0)`,bT=`oklch(0.985 0 0)`;function xT(){try{let e=localStorage.getItem(vT);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}function ST(e,t){return e===`system`?t?`dark`:`light`:e}var CT=()=>typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches;function wT(e){let t=ST(e,CT());document.documentElement.classList.toggle(`dark`,t===`dark`),document.documentElement.style.colorScheme=t}var TT=`nma-theme`;function ET(e){try{localStorage.setItem(vT,e)}catch{}wT(e),typeof window<`u`&&window.dispatchEvent(new Event(TT))}function DT(){ET(ST(xT(),CT())===`dark`?`light`:`dark`)}function OT(e){if(typeof matchMedia!=`function`)return()=>void 0;let t=matchMedia(`(prefers-color-scheme: dark)`),n=()=>{e()===`system`&&wT(`system`)};return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)}function kT(e){let t,n=/^#([0-9a-f]{3,8})$/i.exec(e.trim())?.[1];if(n){let e=n.length<=4?[...n.slice(0,3)].map(e=>e+e).join(``):n.slice(0,6);t=[0,2,4].map(t=>parseInt(e.slice(t,t+2),16))}else{let n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(e.trim());n&&(t=n.slice(1,4).map(Number))}if(!t)return;let[r,i,a]=t.map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*r+.7152*i+.0722*a}function AT(e){let t={};if(e.primaryColor){let n=kT(e.primaryColor),r=e.primaryForeground??(n!==void 0&&n>.45?yT:bT);Object.assign(t,{"--primary":e.primaryColor,"--primary-foreground":r,"--ring":e.primaryColor,"--sidebar-primary":e.primaryColor,"--sidebar-primary-foreground":r})}return e.radius&&Object.assign(t,{"--nma-radius-control":e.radius,"--nma-radius-card":`calc(${e.radius} * 1.5)`}),t}function jT(e){for(let[t,n]of Object.entries(AT(e)))document.documentElement.style.setProperty(t,n)}var MT=`nma.accent`,NT=`nma-accent`,PT=/^(#[0-9a-f]{3,8}|(rgb|rgba|hsl|hsla|oklch|oklab|lch|lab)\([0-9.,%\s/+-]+(deg|turn|rad)?[0-9.,%\s/+-]*\))$/i;function FT(e){return(e.personal&&PT.test(e.personal.trim())?e.personal:null)??e.admin??e.branding??void 0}function IT(){try{return localStorage.getItem(MT)}catch{return null}}function LT(e){try{e===null?localStorage.removeItem(MT):localStorage.setItem(MT,e)}catch{}}var RT=null,zT;function BT(e={}){`admin`in e&&(RT=e.admin??null),`branding`in e&&(zT=e.branding);let t=FT({personal:IT(),admin:RT,branding:zT}),n=[`--primary`,`--primary-foreground`,`--ring`,`--sidebar-primary`,`--sidebar-primary-foreground`];if(t)for(let[e,n]of Object.entries(AT({primaryColor:t})))document.documentElement.style.setProperty(e,n);else for(let e of n)document.documentElement.style.removeProperty(e);typeof window<`u`&&window.dispatchEvent(new Event(NT))}var VT={archive:xy,ban:jy,bell:Ny,book:Fy,box:Ly,boxes:zy,briefcase:Vy,building:Uy,calendar:Yy,chart:Zy,check:$y,clock:lb,"credit-card":hb,database:_b,dollar:yb,file:Fb,"file-text":Nb,folder:Lb,globe:Vb,heart:Gb,history:$x,home:qb,image:Zb,inbox:$b,key:tx,layers:ax,link:lx,list:px,lock:hx,mail:yx,map:Cx,"map-pin":xx,message:Dx,package:Nx,phone:zx,printer:qx,receipt:Yx,refresh:Zx,send:aS,server:sS,settings:lS,shield:pS,"shopping-bag":hS,cart:_S,"shopping-cart":_S,star:xS,store:CS,tag:DS,tags:kS,ticket:jS,truck:LS,user:US,users:GS,video:qS,wallet:YS,wrench:ZS,x:$S,zap:tC};Object.keys(VT);function HT(e,t){return UT(e)??(t===`group`?Lb:t===`page`?lS:Nb)}function UT(e){return e&&Object.hasOwn(VT,e)?VT[e]:void 0}function WT(e,t){let[n,r]=(0,y.useState)(e);return(0,y.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function GT(){let{t:e}=Y(),t=Yi(),n=Cv(),r=Sv(),[i,a]=(0,y.useState)(!1),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)(0),u=(0,y.useId)(),d=(0,y.useRef)(null);(0,y.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`k`&&(e.preventDefault(),a(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let f=WT(o.trim(),250),p=f.length>=2&&(n.data?.groups.some(e=>e.resources.some(e=>e.searchable))??!1),m=ft({queryKey:[`search`,f],queryFn:()=>Q.search(f),enabled:i&&p,staleTime:1e4}),h=e=>{let t=n.data?fT(n.data).find(t=>t.resources.some(t=>t.name===e)):void 0;return t?.resources.find(t=>t.name===e)?.icon??t?.icon},g=n.data?_T(n.data,o,t=>e(`palette.new`,{name:t}),[{id:`theme`,label:e(`palette.toggleTheme`)}]):[],_=[...p&&o.trim()===f?(m.data?.groups??[]).flatMap(e=>e.items.map(t=>({id:`record:${e.resource}:${t._id}`,section:`records`,...h(e.resource)?{icon:h(e.resource)}:{},label:t._title,detail:e.label,to:`/${e.resource}/${encodeURIComponent(t._id)}`}))):[],...g.filter(e=>e.section===`actions`),...g.filter(e=>e.section===`go`),...r.data?.audit.view&&gT(e(`audit.title`),o)?[{id:`audit`,section:`go`,label:e(`audit.title`),to:`/-/audit`}]:[]],v=Math.min(c,Math.max(0,_.length-1));(0,y.useEffect)(()=>l(0),[o,m.data]),(0,y.useEffect)(()=>{d.current?.querySelector(`[data-index="${v}"]`)?.scrollIntoView({block:`nearest`})},[v]);function x(e){e&&(a(!1),e.to?t(e.to):e.id===`theme`&&DT())}function S(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),_.length===0)return;l((v+(e.key===`ArrowDown`?1:-1)+_.length)%_.length)}else e.key===`Enter`&&(e.preventDefault(),x(_[v]))}let C=[[`records`,e(`palette.records`)],[`actions`,e(`palette.actions`)],[`go`,e(`palette.goTo`)]],w=e=>`${u}-${e}`,T=p&&(m.isFetching||o.trim()!==f)?e(`palette.searching`):_.length===0?e(`palette.noResults`):``;return(0,b.jsxs)(Yd,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,b.jsx)(Zd,{asChild:!0,children:(0,b.jsxs)(q,{variant:`outline`,className:`w-9 justify-start px-0 font-normal text-muted-foreground max-sm:justify-center sm:w-[260px] sm:px-3.5`,"aria-keyshortcuts":`Control+K Meta+K`,"aria-label":e(`palette.open`),children:[(0,b.jsx)(rS,{}),(0,b.jsx)(`span`,{className:`hidden min-w-0 flex-1 truncate text-start sm:inline`,children:e(`palette.placeholder`)}),(0,b.jsx)(`kbd`,{className:`hidden shrink-0 rounded-[5px] border border-border bg-muted px-[5px] py-px font-mono text-[11px] text-muted-foreground sm:inline`,dir:`ltr`,children:`⌘K`})]})}),(0,b.jsxs)(tf,{children:[(0,b.jsx)(rf,{className:dT}),(0,b.jsxs)(cf,{"aria-describedby":void 0,className:`fixed inset-x-3 top-[12vh] z-50 mx-auto flex max-h-[70vh] max-w-[540px] flex-col overflow-hidden rounded-card border border-border bg-card text-card-foreground shadow-[0_24px_48px_rgba(0,0,0,.18)] outline-none`,children:[(0,b.jsx)(pf,{className:`sr-only`,children:e(`palette.open`)}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-border px-4`,children:[(0,b.jsx)(rS,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(`input`,{role:`combobox`,"aria-expanded":!0,"aria-controls":u,"aria-autocomplete":`list`,"aria-activedescendant":_.length>0?w(v):void 0,"aria-label":e(`palette.open`),placeholder:e(`palette.placeholder`),className:`h-[52px] flex-1 bg-transparent text-sm outline-none`,value:o,onChange:e=>s(e.target.value),onKeyDown:S}),(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] py-px font-mono text-[11px] text-muted-foreground`,dir:`ltr`,children:`Esc`})]}),(0,b.jsx)(`ul`,{ref:d,id:u,role:`listbox`,"aria-label":e(`palette.results`),className:`flex-1 overflow-y-auto p-1.5`,children:C.map(([e,t])=>{let n=_.map((e,t)=>({item:e,index:t})).filter(({item:t})=>t.section===e);return n.length===0?null:(0,b.jsxs)(`li`,{role:`presentation`,children:[(0,b.jsx)(`div`,{className:`px-2.5 pt-2.5 pb-1 text-xs font-medium text-muted-foreground`,"aria-hidden":!0,children:t}),(0,b.jsx)(`ul`,{role:`group`,"aria-label":t,children:n.map(({item:e,index:t})=>(0,b.jsxs)(`li`,{id:w(t),role:`option`,"aria-selected":t===v,"data-index":t,className:U(`flex h-10 cursor-pointer items-center gap-3 rounded-control px-2.5 text-[13.5px]`,t===v&&`bg-muted`),onMouseMove:()=>l(t),onClick:()=>x(e),children:[(0,b.jsx)(KT,{item:e}),(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e.section===`go`&&e.detail?`${e.detail} › ${e.label}`:e.label}),e.section===`records`&&e.detail&&(0,b.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.detail})]},e.id))})]},e)})}),(0,b.jsx)(`p`,{role:`status`,className:U(`px-4 text-sm text-muted-foreground`,T&&`border-t border-border py-2`),children:T}),(0,b.jsxs)(`div`,{className:`flex items-center gap-4 border-t border-border px-4 py-2.5 text-xs text-muted-foreground`,"aria-hidden":!0,children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] font-mono text-[11px]`,children:`↑↓`}),e(`palette.move`)]}),(0,b.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] font-mono text-[11px]`,children:`↵`}),e(`palette.openItem`)]}),(0,b.jsxs)(`span`,{className:`ms-auto flex items-center gap-1.5`,children:[(0,b.jsx)(`kbd`,{className:`rounded-[5px] border border-border bg-muted px-[5px] font-mono text-[11px]`,dir:`ltr`,children:`⌘K`}),e(`palette.close`)]})]})]})]})]})}function KT({item:e}){let t=e.id.startsWith(`new:`)?Gx:e.id===`theme`?jx:HT(e.icon,e.section===`records`?`resource`:`group`);return(0,b.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})}var qT={success:5e3,error:1e4},JT=4;function YT(e=globalThis){let t=[],n=1,r=new Map,i=new Set,a=e=>{t=e;for(let e of i)e()},o=n=>{let i=r.get(n);i!==void 0&&e.clearTimeout(i),r.delete(n),t.some(e=>e.id===n)&&a(t.filter(e=>e.id!==n))};return{get:()=>t,subscribe(e){return i.add(e),()=>i.delete(e)},show(i,s=`success`){let c=n++,l=[...t,{id:c,message:i,tone:s}];for(let e of l.slice(0,Math.max(0,l.length-JT)))o(e.id);return a([...t,{id:c,message:i,tone:s}]),r.set(c,e.setTimeout(()=>o(c),qT[s])),c},dismiss:o}}var XT=YT(),ZT=(e,t=`success`)=>XT.show(e,t);function QT(){return(0,y.useSyncExternalStore)(XT.subscribe,XT.get)}var $T={en:`English`,fa:`فارسی`};function eE(){let{t:e}=Y(),[t,n]=(0,y.useState)(xT),r=[[`light`,e(`shell.themeLight`),TS],[`dark`,e(`shell.themeDark`),jx],[`system`,e(`shell.themeSystem`),kx]];return(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":e(`shell.theme`),className:`flex items-center rounded-control border border-border p-0.5`,children:r.map(([e,r,i])=>(0,b.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":t===e,"aria-label":r,title:r,className:U(`rounded-md p-1.5 text-muted-foreground hover:text-foreground`,t===e&&`bg-muted text-foreground`),onClick:()=>{ET(e),n(e)},children:(0,b.jsx)(i,{className:`size-4`})},e))})}function tE(){let{t:e,locale:t,locales:n,setLocale:r}=Y();return n.length<2?null:(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[13px]`,children:[(0,b.jsx)(rx,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(Bw,{"aria-label":e(`shell.language`),className:`flex-1`,value:t,onValueChange:r,options:n.map(e=>({value:e,label:$T[e]??e,lang:e}))})]})}function nE(){let{t:e,calendar:t,digits:n,setDisplay:r}=Y(),i=(e,t,n,r)=>(0,b.jsxs)(`div`,{role:`radiogroup`,"aria-label":e,className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,b.jsx)(`div`,{className:`flex rounded-control border border-border p-0.5`,children:n.map(([e,n])=>(0,b.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":t===e,className:U(`flex-1 cursor-pointer rounded-md px-2 py-1 text-[13px] text-muted-foreground hover:text-foreground`,t===e&&`bg-muted text-foreground`),onClick:()=>r(e),children:n},e))})]});return(0,b.jsxs)(b.Fragment,{children:[i(e(`display.calendar`),t,[[`gregorian`,e(`display.gregorian`)],[`persian`,e(`display.jalali`)]],e=>r({calendar:e})),i(e(`display.digits`),n,[[`latn`,e(`display.latinDigits`)],[`arabext`,e(`display.persianDigits`)]],e=>r({digits:e}))]})}function rE(){let{t:e}=Y(),[t,n]=(0,y.useState)(xT);(0,y.useEffect)(()=>{let e=()=>n(xT());return window.addEventListener(TT,e),()=>window.removeEventListener(TT,e)},[]);let r=t===`dark`||t===`system`&&typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches;return(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":e(`shell.theme`),title:e(`shell.theme`),onClick:DT,children:r?(0,b.jsx)(TS,{}):(0,b.jsx)(jx,{})})}var iE=[`#5B5BD6`,`#2563EB`,`#0E7490`,`#0F766E`,`#9333EA`,`#DB2777`,`#EA580C`];function aE(){let{t:e}=Y(),t=Sv(),n=S(),[r,i]=(0,y.useState)(IT);(0,y.useEffect)(()=>{let e=()=>i(IT());return window.addEventListener(NT,e),()=>window.removeEventListener(NT,e)},[]);let a=t.data?.appearance,o=pt({mutationFn:e=>Q.setAppearance(e),onSuccess:async({accent:e})=>{LT(null),BT({admin:e}),await n.invalidateQueries({queryKey:[`session`]})}}),s=e=>{LT(e),BT()},c=r??a?.accent??null;return(0,b.jsxs)(`div`,{role:`group`,"aria-label":e(`display.accent`),className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e(`display.accent`)}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[iE.map(e=>(0,b.jsx)(`button`,{type:`button`,"aria-label":e,"aria-pressed":c?.toLowerCase()===e.toLowerCase(),className:U(`size-6 cursor-pointer rounded-full border-2 border-transparent outline-none focus-visible:ring-2 focus-visible:ring-ring`,c?.toLowerCase()===e.toLowerCase()&&`border-foreground`),style:{background:e},onClick:()=>s(e)},e)),(0,b.jsx)(`button`,{type:`button`,className:`size-6 cursor-pointer overflow-hidden rounded-full border border-border bg-[conic-gradient(red,yellow,lime,aqua,blue,magenta,red)]`,"aria-label":e(`display.customAccent`),title:e(`display.customAccent`),onClick:()=>fE(c)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 px-1.5 text-xs`,"aria-pressed":r===null,onClick:()=>s(null),children:e(`display.defaultAccent`)})]}),a?.manage&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 text-xs`,disabled:o.isPending||!r||r===a.accent,onClick:()=>o.mutate(r),children:e(`display.accentForEveryone`)}),a.accent&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-xs`,disabled:o.isPending,onClick:()=>o.mutate(null),children:e(`display.resetForEveryone`)})]}),o.isError&&(0,b.jsx)(`p`,{className:`text-xs text-destructive`,children:W_(o.error)}),a?.manage&&(0,b.jsx)(oE,{logo:a.logo,favicon:a.favicon})]})}function oE({logo:e,favicon:t}){let{t:n}=Y(),r=pt({mutationFn:e=>Q.removePicture(e),onSuccess:()=>window.location.reload(),onError:e=>ZT(W_(e),`error`)}),i=(e,t)=>(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`span`,{className:`w-14 text-xs text-muted-foreground`,children:n(e===`logo`?`display.logo`:`display.favicon`)}),t&&(0,b.jsx)(`img`,{src:t,alt:``,className:`size-6 rounded object-contain`}),(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:()=>lE(e),children:n(`display.uploadPicture`)}),t&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-xs`,disabled:r.isPending,onClick:()=>r.mutate(e),children:n(`display.removePicture`)})]});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5 pt-1`,children:[i(`logo`,e),i(`favicon`,t)]})}var sE=null,cE=`logo`;function lE(e){sE&&(cE=e,sE.value=``,sE.click())}function uE(){return Sv().data?.appearance?.manage===!0?(0,b.jsx)(`input`,{ref:e=>{sE=e},type:`file`,accept:`image/png,image/jpeg,image/gif,image/webp,image/svg+xml,image/x-icon,.ico`,tabIndex:-1,"aria-hidden":!0,"data-testid":`picture-input`,className:`pointer-events-none fixed bottom-0 start-0 size-px opacity-0`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&Q.setPicture(cE,t).then(()=>window.location.reload(),e=>ZT(W_(e),`error`))}}):null}var dE=null;function fE(e){dE&&(e&&/^#[0-9a-f]{6}$/i.test(e)&&(dE.value=e),dE.click())}function pE(){return(0,b.jsx)(`input`,{ref:e=>{dE=e},type:`color`,tabIndex:-1,"aria-hidden":!0,className:`pointer-events-none fixed bottom-0 start-0 size-px opacity-0`,onInput:e=>{LT(e.currentTarget.value),BT()}})}var mE=`nma.nav`,hE={pinned:[],recent:[],collapsedGroups:[],expandedGroups:[],railCollapsed:!1};function gE(e){let t=hE;try{let n=e?.getItem(mE);n&&(t={...hE,...JSON.parse(n)})}catch{t=hE}let n=new Set,r=r=>{t=r;try{e?.setItem(mE,JSON.stringify(r))}catch{}for(let e of n)e()},i=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t];return{get:()=>t,subscribe(e){return n.add(e),()=>n.delete(e)},togglePin:e=>r({...t,pinned:i(t.pinned,e)}),visit:e=>{t.recent[0]!==e&&r({...t,recent:[e,...t.recent.filter(t=>t!==e)].slice(0,5)})},toggleGroup:(e,n=!1)=>{let i=xE(t,e,n),a=t=>t.filter(t=>t!==e);r({...t,collapsedGroups:i?a(t.collapsedGroups):[...a(t.collapsedGroups),e],expandedGroups:i?[...a(t.expandedGroups),e]:a(t.expandedGroups)})},toggleRail:()=>r({...t,railCollapsed:!t.railCollapsed})}}function _E(){try{return typeof localStorage>`u`?void 0:localStorage}catch{return}}var vE=gE(_E());function yE(){return(0,y.useSyncExternalStore)(vE.subscribe,vE.get)}function bE(e,t){return e.filter(e=>t.has(e))}function xE(e,t,n){return e.collapsedGroups.includes(t)?!0:!e.expandedGroups.includes(t)&&n}function SE(e){let{t}=Y(),[n,r,i]=qi().pathname.split(`/`).filter(Boolean).map(e=>decodeURIComponent(e)),a=n&&n!==`g`&&n!==`p`&&n!==`-`&&r&&r!==`new`?r:void 0,o=Ov(n??``,a),s=!!n&&![`g`,`p`,`-`,`account`].includes(n),c=wv(n??``,s&&e!==void 0&&!fT(e).some(e=>e.resources.some(e=>e.name===n))),l=[{label:t(e?.dashboard?`shell.dashboard`:`shell.home`),to:`/`}];if(n===`account`&&!r)return[...l,{label:t(`auth.account`)}];if(n===`-`&&(r===`users`||r===`groups`||r===`roles`||r===`debugger`||r===`audit`)){let e={users:t(`rbac.users`),groups:t(`rbac.groups`),roles:t(`rbac.roles`),debugger:t(`debugger.title`),audit:t(`audit.title`)}[r];return l.push({label:t(`rbac.administration`)},{label:e,to:`/-/${r}`}),i&&l.push({label:i===`new`?t(`list.new`):i}),l}if(!n||!e)return l;let u=fT(e);if(n===`g`){let e=u.find(e=>e.key===r);return e&&l.push({label:e.label}),l}if(n===`p`){let e=u.find(e=>e.pages.some(e=>e.name===r)),t=e?.pages.find(e=>e.name===r);return e&&t&&l.push({label:e.label,to:`/g/${e.key}`},{label:t.label}),l}let d=u.find(e=>e.resources.some(e=>e.name===n)),f=d?.resources.find(e=>e.name===n);return!d||!f?c.data?(l.push({label:c.data.label,to:`/${n}`}),a&&l.push({label:typeof o.data?._title==`string`?o.data._title:`#${a}`}),l):l:(l.push({label:d.label,to:`/g/${d.key}`},{label:f.label,to:`/${f.name}`}),r===`new`?l.push({label:t(`form.new`,{name:f.label})}):a&&l.push({label:typeof o.data?._title==`string`?o.data._title:`#${a}`}),l)}function CE({meta:e,onOpenMenu:t}){let{t:n}=Y(),r=yE(),i=SE(e),a=i.length-1;return(0,b.jsxs)(`header`,{className:`flex h-14 items-center gap-2 border-b border-border bg-card px-5`,children:[(0,b.jsx)(q,{variant:`ghost`,size:`icon`,className:`md:hidden`,"aria-label":n(`shell.menu`),onClick:t,"data-sidebar-toggle":``,children:(0,b.jsx)(Tx,{})}),(0,b.jsx)(q,{variant:`ghost`,size:`icon`,className:`hidden md:inline-flex`,"aria-label":n(r.railCollapsed?`shell.expandSidebar`:`shell.collapseSidebar`),"aria-pressed":r.railCollapsed,onClick:()=>vE.toggleRail(),"data-sidebar-toggle":``,children:(0,b.jsx)(Fx,{className:`ltr:-scale-x-100`})}),(0,b.jsx)(`div`,{className:`hidden h-5 w-px bg-border md:block`,"aria-hidden":!0}),(0,b.jsx)(`nav`,{"aria-label":n(`shell.breadcrumbs`),className:`min-w-0 flex-1 ps-1`,children:(0,b.jsx)(`ol`,{className:`flex min-w-0 items-center gap-1.5 text-sm text-muted-foreground`,children:i.map((e,t)=>(0,b.jsxs)(y.Fragment,{children:[t>0&&(0,b.jsx)(rb,{className:`hidden size-3.5 shrink-0 ltr:rotate-180 sm:block`,"aria-hidden":!0}),(0,b.jsx)(`li`,{className:t===a?`truncate font-medium text-foreground`:`hidden truncate sm:block`,children:e.to&&t!==a?(0,b.jsx)(xo,{to:e.to,className:`hover:text-foreground`,children:e.label}):(0,b.jsx)(`span`,{"aria-current":t===a?`page`:void 0,children:e.label})})]},`${t}:${e.label}`))})}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(GT,{}),(0,b.jsx)(rE,{})]})]})}function wE({rail:e=!1}){let{t}=Y(),n=Sv(),r=Yi(),i=S(),a=n.data;if(!a)return null;let{user:o,auth:s}=a,c=o.displayName.split(/\s+/).filter(Boolean).slice(0,2).map(e=>[...e][0].toUpperCase()).join(``);async function l(){try{await Q.logout()}finally{q_(void 0),tv(void 0),i.clear(),r(`/login`,{replace:!0})}}return(0,b.jsxs)(Kh,{children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsxs)(`button`,{type:`button`,"aria-label":t(`auth.userMenu`,{name:o.displayName}),"data-user-block":``,className:U(`flex cursor-pointer items-center gap-2.5 rounded-control text-start hover:bg-muted`,e?`size-10 justify-center`:`px-2.5 py-2`),children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-[13px] font-semibold`,children:c||(0,b.jsx)(VS,{className:`size-4`})}),!e&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`span`,{className:`min-w-0 flex-1 leading-[1.35]`,children:[(0,b.jsx)(`span`,{className:`block truncate text-[13px] font-medium`,children:o.displayName}),(o.username||o.email)&&(0,b.jsx)(`span`,{className:`block truncate text-[11.5px] text-muted-foreground`,children:o.email??o.username})]}),(0,b.jsx)(Cb,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})]})]})}),(0,b.jsx)(Jh,{children:(0,b.jsxs)(Yh,{side:`top`,align:`start`,sideOffset:6,className:`z-50 flex w-64 flex-col gap-1 rounded-[10px] border border-border bg-popover p-1.5 text-popover-foreground shadow-[0_12px_32px_rgba(0,0,0,.12)]`,children:[(s.password||s.sessions||s.twoFactor)&&!a.viewAs&&(0,b.jsx)(Xh,{asChild:!0,children:(0,b.jsxs)(xo,{to:`/account`,className:`flex h-[34px] items-center gap-2.5 rounded-md px-2 text-[13px] hover:bg-muted`,children:[(0,b.jsx)(VS,{className:`size-4`}),t(`auth.account`)]})}),a.audit.view&&(0,b.jsx)(Xh,{asChild:!0,children:(0,b.jsxs)(xo,{to:`/-/audit`,className:`flex h-[34px] items-center gap-2.5 rounded-md px-2 text-[13px] hover:bg-muted`,children:[(0,b.jsx)($x,{className:`size-4`}),t(`audit.title`)]})}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 border-y border-border px-2 py-2`,children:[(0,b.jsx)(tE,{}),(0,b.jsx)(nE,{}),(0,b.jsx)(eE,{}),(0,b.jsx)(aE,{})]}),s.logout&&!a.open&&(0,b.jsxs)(`button`,{type:`button`,className:`flex h-[34px] items-center gap-2.5 rounded-md px-2 text-start text-[13px] hover:bg-muted`,onClick:()=>void l(),children:[(0,b.jsx)(_x,{className:`size-4 rtl:-scale-x-100`}),t(`auth.signOut`)]})]})})]})}var TE=`flex h-9 w-full cursor-pointer items-center gap-2.5 rounded-control px-2.5 text-start text-[13.5px] text-sidebar-foreground hover:bg-muted`,EE=({isActive:e})=>U(`flex h-8 items-center rounded-[7px] px-2.5 text-[13px] text-muted-foreground hover:bg-muted hover:text-foreground`,e&&`bg-primary-soft font-semibold text-primary-text hover:bg-primary-soft hover:text-primary-text`);function DE(e){return e.kind===`resource`?{key:e.name,to:`/${e.name}`,label:e.label,pin:e.name,...e.badge?{badge:e.badge}:{}}:e.kind===`page`?{key:`page:${e.name}`,to:`/p/${e.name}`,label:e.label}:{key:`link:${e.href}`,to:e.href,label:e.label,external:/^https?:\/\//i.test(e.href)}}var OE=(e,t)=>!t.external&&(e===t.to||e.startsWith(`${t.to}/`));function kE(e,t,n,r,i){let a=e.map(e=>{let r=e.items.map(DE);return{key:e.key,label:e.label,icon:HT(e.icon,`group`),entries:r,collapsedByDefault:mT({menu:t,current:r.some(e=>OE(n,e))}),asLink:t&&!e.advanced&&r.length===1}});return r.length>0?[{key:`~pinned`,label:i,icon:Ux,entries:r},...a]:a}function AE({title:e,logo:t,groups:n,menu:r,rail:i=!1,onClose:a}){let{t:o}=Y(),s=yE(),{pathname:c}=qi(),l=Tv(r).data,u=new Map(n.flatMap(e=>e.items.flatMap(e=>e.kind===`resource`?[[e.name,DE(e)]]:[]))),d=kE(n,r,c,bE(s.pinned,new Set(u.keys())).map(e=>u.get(e)),o(`shell.pinned`)),f=d.find(e=>n.some(t=>t.advanced&&t.key===e.key)),p=d.filter(e=>e!==f),m=LE(),h=(e,t=!1)=>i?(0,b.jsx)(FE,{section:e,muted:t},e.key):(0,b.jsx)(PE,{section:e,collapsed:xE(s,e.key,e.collapsedByDefault??!1),badges:l,muted:t,large:!!a},e.key);return(0,b.jsxs)(`nav`,{"aria-label":o(`shell.resources`),className:`flex h-full flex-col`,children:[(0,b.jsx)(NE,{title:e,logo:t,rail:i,onClose:a}),(0,b.jsxs)(`div`,{className:U(`flex flex-1 flex-col gap-0.5 overflow-y-auto`,i?`items-center px-0 py-2.5`:`p-2.5`),children:[r&&(0,b.jsx)(jE,{to:`/`,label:o(`shell.dashboard`),icon:sx,rail:i,large:!!a,end:!0}),p.map(e=>h(e))]}),(0,b.jsxs)(`div`,{className:U(`flex flex-col gap-1 border-t border-sidebar-border`,i?`items-center px-0 py-2.5`:`p-2.5`),children:[f&&h(f,!0),m&&h(m,!0),(0,b.jsx)(wE,{rail:i})]})]})}function jE({to:e,label:t,icon:n,rail:r,large:i,end:a,external:o,count:s}){let c=({isActive:e})=>r?U(`flex size-10 items-center justify-center rounded-control hover:bg-muted`,e&&`bg-primary-soft text-primary-text hover:bg-primary-soft`):U(TE,i&&`h-11 text-[15px]`,e&&`bg-primary-soft font-semibold text-primary-text hover:bg-primary-soft`),l=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),!r&&(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:t}),!r&&s&&(0,b.jsx)(ME,{count:s})]});return o?(0,b.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,"aria-label":r?t:void 0,title:r?t:void 0,className:c({isActive:!1}),children:l}):(0,b.jsx)(So,{to:e,end:a,"aria-label":r?t:void 0,title:r?t:void 0,className:c,children:l})}function ME({count:e,strong:t}){return(0,b.jsxs)(`span`,{className:U(`inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full px-1.5 text-[11px]`,t?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:[e.estimate?`~`:``,E_(e.count)]})}function NE({title:e,logo:t,rail:n,onClose:r}){let{t:i}=Y(),a=t?(0,b.jsx)(`img`,{src:t,alt:``,className:`size-[30px] shrink-0 rounded-control object-contain`}):(0,b.jsx)(`img`,{src:`favicon.svg`,alt:``,className:`size-[30px] shrink-0 object-contain`});return(0,b.jsxs)(`div`,{className:U(`flex h-14 shrink-0 items-center gap-2.5 border-b border-sidebar-border`,n?`justify-center`:`px-4`),children:[a,!n&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1 leading-[1.3]`,children:[(0,b.jsx)(`div`,{className:U(`truncate font-semibold`,r?`text-[15px]`:`text-sm`),children:e}),!r&&(0,b.jsx)(`div`,{className:`text-[11.5px] text-muted-foreground`,children:i(`shell.adminPanel`)})]}),r?(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":i(`shell.closeMenu`),onClick:r,children:(0,b.jsx)($S,{})}):(0,b.jsx)(sb,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})]})]})}function PE({section:e,collapsed:t,badges:n,muted:r,large:i}){let{t:a}=Y(),o=e.icon,s=`nav-group-${e.key}`,c=pT(e.entries.flatMap(e=>e.badge?[{kind:`resource`,name:e.key,label:e.label,badge:e.badge}]:[]),n);if(e.asLink){let[t]=e.entries;return(0,b.jsx)(jE,{to:t.to,label:e.label,icon:o,rail:!1,large:i,external:t.external,count:t.badge?n?.[t.badge]:void 0})}return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`button`,{type:`button`,className:U(TE,i&&`h-11 text-[15px]`,r&&`text-muted-foreground`),"aria-expanded":!t,"aria-controls":s,"aria-label":a(t?`shell.expandGroup`:`shell.collapseGroup`,{name:e.label}),onClick:()=>vE.toggleGroup(e.key,e.collapsedByDefault??!1),children:[(0,b.jsx)(o,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),t&&c&&(0,b.jsx)(ME,{count:c}),(0,b.jsx)(tb,{className:U(`size-4 shrink-0 text-muted-foreground transition-transform`,t&&`rotate-90 rtl:rotate-90 ltr:-rotate-90`),"aria-hidden":!0})]}),!t&&(0,b.jsx)(`ul`,{id:s,"aria-label":e.label,className:`ms-[18px] mt-0.5 mb-1 flex flex-col gap-px border-s border-sidebar-border ps-2.5`,children:e.entries.map(e=>(0,b.jsxs)(`li`,{className:`group/item flex items-center`,children:[e.external?(0,b.jsx)(`a`,{href:e.to,target:`_blank`,rel:`noopener noreferrer`,className:U(EE({isActive:!1}),`min-w-0 flex-1`),children:(0,b.jsx)(`span`,{className:`truncate`,children:e.label})}):(0,b.jsxs)(So,{to:e.to,className:e=>U(EE(e),`min-w-0 flex-1 gap-2`),children:[(0,b.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.badge&&n?.[e.badge]&&(0,b.jsx)(ME,{count:n[e.badge]})]}),e.pin&&(0,b.jsx)(IE,{name:e.pin,label:e.label})]},e.key))})]})}function FE({section:e,muted:t}){let[n,r]=(0,y.useState)(!1),{pathname:i}=qi(),a=e.icon,o=e.entries.some(e=>OE(i,e));return(0,b.jsxs)(Kh,{open:n,onOpenChange:r,children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,"aria-label":e.label,title:e.label,onMouseEnter:()=>r(!0),"data-nav-section":``,className:U(`flex size-10 cursor-pointer items-center justify-center rounded-control hover:bg-muted`,t&&`text-muted-foreground`,o&&`bg-primary-soft text-primary-text hover:bg-primary-soft`),children:(0,b.jsx)(a,{className:`size-4`,"aria-hidden":!0})})}),(0,b.jsx)(Jh,{children:(0,b.jsxs)(Yh,{side:`right`,align:`start`,sideOffset:8,onMouseLeave:()=>r(!1),className:`z-50 flex flex-col items-start gap-1.5`,children:[(0,b.jsx)(`span`,{className:`rounded-control bg-foreground px-3 py-1.5 text-[13px] font-medium text-background`,children:e.label}),(0,b.jsx)(`div`,{className:`flex min-w-40 flex-col gap-px rounded-[10px] border border-border bg-card p-1.5 shadow-[0_12px_32px_rgba(0,0,0,.12)]`,children:e.entries.map(e=>e.external?(0,b.jsx)(`a`,{href:e.to,target:`_blank`,rel:`noopener noreferrer`,className:EE({isActive:!1}),onClick:()=>r(!1),children:e.label},e.key):(0,b.jsx)(So,{to:e.to,className:EE,onClick:()=>r(!1),children:e.label},e.key))})]})})]})}function IE({name:e,label:t}){let{t:n}=Y(),r=yE().pinned.includes(e);return(0,b.jsx)(`button`,{type:`button`,className:U(`cursor-pointer rounded-md p-1 text-muted-foreground opacity-0 hover:text-foreground focus-visible:opacity-100 group-hover/item:opacity-100`,r&&`opacity-100`),"aria-label":n(r?`shell.unpin`:`shell.pin`,{name:t}),"aria-pressed":r,onClick:()=>vE.togglePin(e),children:r?(0,b.jsx)(Vx,{className:`size-3.5`}):(0,b.jsx)(Ux,{className:`size-3.5`})})}function LE(){let{t:e}=Y();if(Sv().data?.rbac.view)return{key:`~administration`,label:e(`rbac.administration`),icon:dS,entries:[{key:`users`,to:`/-/users`,label:e(`rbac.users`)},{key:`groups`,to:`/-/groups`,label:e(`rbac.groups`)},{key:`roles`,to:`/-/roles`,label:e(`rbac.roles`)},{key:`debugger`,to:`/-/debugger`,label:e(`debugger.title`)}]}}function RE(){let e=X(),t=QT();return(0,b.jsx)(`div`,{role:`region`,"aria-label":e(`toast.region`),className:`pointer-events-none fixed inset-x-4 bottom-4 z-[60] flex flex-col items-end gap-2 sm:start-auto sm:w-96`,children:t.map(t=>(0,b.jsxs)(`div`,{role:t.tone===`error`?`alert`:`status`,className:U(`pointer-events-auto flex w-full items-start gap-2 rounded-lg border bg-popover px-3 py-2 text-sm text-popover-foreground shadow-lg`,t.tone===`error`?`border-destructive/50`:`border-green-600/40`),children:[(0,b.jsx)(`span`,{className:U(`min-w-0 flex-1 break-words`,t.tone===`error`&&`text-destructive`),children:t.message}),(0,b.jsx)(`button`,{type:`button`,className:`rounded-md p-0.5 text-muted-foreground hover:text-foreground`,"aria-label":e(`toast.dismiss`),onClick:()=>XT.dismiss(t.id),children:(0,b.jsx)($S,{className:`size-4`,"aria-hidden":!0})})]},t.id))})}function zE(e,t){return e===void 0||typeof e==`string`?e:e[t]??e[L_.locale]??Object.values(e)[0]}function BE(){let{t:e}=Y(),t=Sv(),n=qi(),r=S(),i=t.isError&&ev()!==void 0&&t.error instanceof U_&&(t.error.status===403||t.error.status===404);return(0,y.useEffect)(()=>{i&&(tv(void 0),r.clear())},[i,r]),t.isPending||i?(0,b.jsx)(W,{children:e(`common.loading`)}):t.isError?t.error instanceof U_&&t.error.status===401?(0,b.jsx)(Oa,{to:`/login?${new URLSearchParams({next:n.pathname+n.search})}`,replace:!0}):(0,b.jsxs)(W,{tone:`error`,children:[W_(t.error),` `,(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:e(`list.retry`)})]}):(0,b.jsx)(HE,{})}function VE(){let{t:e}=Y(),t=Sv(),n=S(),r=Yi(),i=t.data;return i?.viewAs?(0,b.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center justify-center gap-3 bg-amber-400 px-4 py-2 text-sm font-medium text-amber-950`,children:[(0,b.jsx)(kb,{className:`size-4`,"aria-hidden":!0}),(0,b.jsx)(`span`,{children:e(`viewAs.banner`,{name:i.user.displayName})}),(0,b.jsx)(q,{size:`sm`,variant:`outline`,className:`h-7 border-amber-950/30 bg-amber-50 text-amber-950 hover:bg-amber-100`,onClick:()=>{let e=i.user.id;tv(void 0),n.clear(),r(`/-/users/${encodeURIComponent(e)}`)},children:e(`viewAs.stop`)})]}):null}function HE(){let e=Cv(),{t,locale:n}=Y(),r=yE(),i=qi(),[a,o]=(0,y.useState)(!1),s=(0,y.useRef)(null),c=Sv().data?.appearance?.accent;(0,y.useEffect)(()=>{c!==void 0&&BT({admin:c})},[c]);let l=(0,y.useMemo)(()=>e.data?fT(e.data):[],[e.data]),u=e.data?.menu!==void 0,d=zE(L_.branding.name,n)??e.data?.title??L_.title,f=L_.branding.logo;return(0,y.useEffect)(()=>{o(!1);let e=decodeURIComponent(i.pathname.split(`/`).filter(Boolean)[0]??``);l.some(t=>t.resources.some(t=>t.name===e))&&vE.visit(e)},[i.pathname,l]),(0,y.useEffect)(()=>{e.data&&(document.title=e.data.title)},[e.data]),(0,y.useEffect)(()=>{if(!a)return;s.current?.querySelector(`a, button, input`)?.focus();let e=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),(0,b.jsxs)(`div`,{className:`flex min-h-svh bg-background text-foreground`,children:[(0,b.jsx)(pE,{}),(0,b.jsx)(uE,{}),(0,b.jsx)(`aside`,{className:U(`sticky top-0 hidden h-svh shrink-0 border-e border-sidebar-border bg-sidebar text-sidebar-foreground md:block`,r.railCollapsed?`w-16`:`w-64`),children:(0,b.jsx)(AE,{title:d,logo:f,groups:l,menu:u,rail:r.railCollapsed})}),a&&(0,b.jsxs)(`div`,{className:`fixed inset-0 z-40 md:hidden`,role:`dialog`,"aria-modal":`true`,"aria-label":t(`shell.menu`),ref:s,children:[(0,b.jsx)(`div`,{className:`absolute inset-0 bg-black/40 backdrop-blur-sm dark:bg-black/60 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150`,"aria-hidden":!0,onClick:()=>o(!1)}),(0,b.jsx)(`aside`,{className:`absolute inset-y-0 start-0 flex w-[300px] max-w-[85vw] flex-col border-e border-sidebar-border bg-sidebar text-sidebar-foreground shadow-xl`,onClick:e=>{e.target.closest(`a`)&&o(!1)},children:(0,b.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,b.jsx)(AE,{title:d,logo:f,groups:l,menu:u,onClose:()=>o(!1)})})})]}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,inert:a||void 0,children:[(0,b.jsxs)(`div`,{className:`sticky top-0 z-30 bg-background`,children:[(0,b.jsx)(VE,{}),(0,b.jsx)(CE,{meta:e.data,onOpenMenu:()=>o(!0)})]}),(0,b.jsx)(`main`,{className:`flex-1 p-4 md:p-7`,children:(0,b.jsx)(`div`,{className:`mx-auto w-full max-w-[1400px]`,children:(0,b.jsx)(ka,{})})})]}),(0,b.jsx)(RE,{})]})}function UE(e){let t=L_.branding.name;return t===void 0?L_.title:typeof t==`string`?t:t[e]??t[L_.locale]??Object.values(t)[0]??L_.title}function WE(){let{t:e,locale:t}=Y(),n=Yi(),r=S(),[i]=To(),a=Q_(i.get(`next`),L_.basePath),o=Sv(),[s,c]=(0,y.useState)(``),[l,u]=(0,y.useState)(``),[d,f]=(0,y.useState)(`password`),[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(null),[_,v]=(0,y.useState)(!1);if(o.isSuccess)return(0,b.jsx)(Oa,{to:a,replace:!0});async function x(t){if(t.preventDefault(),!s.trim()||!l){g(e(`auth.required`));return}if(d===`otp`&&!p.trim()){g(e(`auth.otpRequired`));return}v(!0),g(null);try{let e=await Q.login(s.trim(),l,d===`otp`?p.trim():void 0);q_(e.csrfToken),tv(void 0),r.clear(),r.setQueryData([`session`],e),n(a,{replace:!0})}catch(t){if(t instanceof U_&&t.body.code===`TWO_FACTOR_REQUIRED`){g(d===`otp`?t.message:null),f(`otp`),m(``);return}f(`password`),m(``),u(``),g(t instanceof U_&&(t.status===401||t.status===429||t.status===404)?t.message:e(`auth.failed`))}finally{v(!1)}}let C=L_.branding.logo;return(0,b.jsxs)(`main`,{className:`flex min-h-dvh flex-col bg-muted/30`,children:[(0,b.jsxs)(`div`,{className:`flex justify-end gap-2 p-4`,children:[(0,b.jsx)(tE,{}),(0,b.jsx)(eE,{})]}),(0,b.jsx)(`div`,{className:`flex flex-1 items-start justify-center px-4 pt-[10vh]`,children:(0,b.jsxs)(`form`,{onSubmit:x,noValidate:!0,className:`flex w-full max-w-sm flex-col gap-4 rounded-xl border bg-background p-6 shadow-sm`,"aria-labelledby":`login-title`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,b.jsx)(`img`,{src:C??`favicon.svg`,alt:``,className:`size-10 rounded-md object-contain`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:UE(t)}),(0,b.jsx)(`h1`,{id:`login-title`,className:`text-[22px] font-bold`,children:e(d===`otp`?`auth.otpTitle`:`auth.title`)})]}),h&&(0,b.jsx)(`p`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:h}),d===`otp`?(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`login-otp`,children:e(`auth.otp`)}),(0,b.jsx)(e_,{id:`login-otp`,autoComplete:`one-time-code`,inputMode:`text`,autoCapitalize:`none`,spellCheck:!1,autoFocus:!0,dir:`ltr`,maxLength:40,value:p,onChange:e=>m(e.target.value),"aria-describedby":`login-otp-help`}),(0,b.jsx)(`p`,{id:`login-otp-help`,className:`text-sm text-muted-foreground`,children:e(`auth.otpHelp`)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`login-username`,children:e(`auth.username`)}),(0,b.jsx)(e_,{id:`login-username`,autoComplete:`username`,autoCapitalize:`none`,spellCheck:!1,autoFocus:!0,value:s,onChange:e=>c(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`login-password`,children:e(`auth.password`)}),(0,b.jsx)(e_,{id:`login-password`,type:`password`,autoComplete:`current-password`,value:l,onChange:e=>u(e.target.value)})]})]}),(0,b.jsx)(q,{type:`submit`,disabled:_,children:e(_?`auth.signingIn`:d===`otp`?`auth.verify`:`auth.signIn`)}),d===`otp`&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>{f(`password`),m(``),u(``),g(null)},children:e(`auth.startOver`)})]})})]})}var GE=3;function KE({field:e,files:t,detailed:n=!1,plain:r=!1}){let i=X();if(t.length===0)return(0,b.jsx)(b.Fragment,{children:`—`});let a=t=>e.widget===`image`&&t.contentType.startsWith(`image/`),o=n?t:t.slice(0,GE);return(0,b.jsxs)(`span`,{className:U(`inline-flex flex-wrap items-center`,n?`gap-2`:`gap-1 align-middle`),children:[o.map(e=>{let t=a(e)?(0,b.jsx)(`img`,{src:e.url,alt:e.name,loading:`lazy`,className:U(`rounded-md border bg-muted object-cover`,n?`size-24`:`size-8`)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Fb,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(`bdi`,{className:`max-w-48 truncate`,children:e.name}),n&&(0,b.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:dv(e.size)})]});return r?(0,b.jsx)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:t},e.key):(0,b.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":i(`upload.open`,{name:e.name}),title:e.name,className:`inline-flex min-w-0 items-center gap-1 hover:underline`,onClick:e=>e.stopPropagation(),children:t},e.key)}),t.length>o.length&&(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i(`upload.more`,{count:t.length-o.length})})]})}var qE=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{},JE=e=>Array.isArray(e)?e:[];function YE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`id`in e&&`title`in e}function XE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`name`in e&&`size`in e&&(`key`in e||`token`in e)}function ZE(e){return(Array.isArray(e)?e:[e]).filter(XE)}function QE(e,t){let n=e?._files?.[t];return n==null?[]:Array.isArray(n)?n:[n]}var $E=e=>e.token===void 0?`key:${e.key}`:`token:${e.token}`,eD=e=>e.token===void 0?{key:e.key}:{token:e.token},tD=(e,t)=>{let n=new Set(e.map(e=>String(e.id)));return e.length===t.length&&t.every(e=>n.has(String(e.id)))},nD=/<img\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;function rD(e){return e.replace(nD,``)}var iD=e=>String(e).padStart(2,`0`);function aD(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.getFullYear()}-${iD(t.getMonth()+1)}-${iD(t.getDate())}T${iD(t.getHours())}:${iD(t.getMinutes())}`}function oD(e,t){let n={};for(let r of e){let e=t?t[r.name]:r.default;if(r.file){let e=QE(t,r.name).map(({key:e,name:t,size:n,contentType:r,url:i})=>({key:e,name:t,size:n,contentType:r,url:i}));n[r.name]=r.file.many?e:e[0]??null}else if(r.type===`object`){let t=r.fields??[];n[r.name]=r.many?(Array.isArray(e)?e:[]).map(e=>oD(t,e)):oD(t,e??void 0)}else r.relation?.kind===`to-many`?n[r.name]=Array.isArray(e)?e.filter(YE):[]:r.type===`relation`?n[r.name]=YE(e)?e:null:r.type===`boolean`?n[r.name]=e===!0:e==null?n[r.name]=``:r.type===`json`?n[r.name]=JSON.stringify(e,null,2):r.type===`datetime`?n[r.name]=aD(String(e)):r.widget===`money`?n[r.name]=iC(String(e),r.scale):n[r.name]=String(e)}return n}function sD(e,t){let n=/^-?\d{1,3}(,\d{3})+(\.\d+)?$/.test(e)?e.replace(/,/g,``):e;if((t?/^-?\d+$/:/^-?\d+(\.\d+)?$/).test(n))return n}function cD(e,t,n,r=``){let i={},a={};for(let o of e){let e=t[o.name];if(n&&e===n[o.name])continue;let s=`${r}${o.name}`;if(o.type===`object`){let t=o.fields??[];if(o.many){let r=JE(e).map((e,n)=>cD(t,e,void 0,`${s}.${n}.`));for(let e of r)Object.assign(a,e.errors);let c=r.map(e=>e.payload),l=n?JE(n[o.name]).map(e=>cD(t,e).payload):void 0;(l?JSON.stringify(l)!==JSON.stringify(c):c.length>0)&&(i[o.name]=c);continue}let r=cD(t,qE(e),n?qE(n[o.name]):void 0,`${s}.`);Object.assign(a,r.errors),(Object.keys(r.payload).length>0||!n&&!o.nullable)&&(i[o.name]=r.payload);continue}if(o.file){let t=ZE(e),r=n?ZE(n[o.name]):void 0;if(r&&t.map($E).join(`
|
|
54
|
+
`)===r.map($E).join(`
|
|
55
|
+
`))continue;o.file.many?(r||t.length>0)&&(i[o.name]=t.map(eD)):t[0]?i[o.name]=eD(t[0]):(o.nullable||n)&&(i[o.name]=null);continue}if(o.relation?.kind===`to-many`){let t=Array.isArray(e)?e.filter(YE):[],r=n?.[o.name];(n?!tD(t,Array.isArray(r)?r.filter(YE):[]):t.length>0)&&(i[o.name]=t.map(e=>e.id));continue}if(o.type===`relation`){let t=YE(e)?e:null,r=n?.[o.name];if(n&&String(t?.id)===String(YE(r)?r.id:void 0))continue;t?i[o.name]=t.id:(o.nullable||n)&&(i[o.name]=null);continue}if(o.type===`boolean`){i[o.name]=e===!0;continue}let c=typeof e==`string`?e:``,l=c.trim();if(l===``){(o.nullable||n)&&(i[o.name]=null);continue}if(o.widget===`money`&&o.type===`string`){i[o.name]=oC(l);continue}switch(o.type){case`number`:case`decimal`:case`bigint`:{let e=sD(a_(l),o.type===`bigint`);e===void 0?a[s]=[J(`validation.number`)]:i[o.name]=o.type===`number`?Number(e):e;break}case`json`:try{i[o.name]=JSON.parse(l)}catch{a[s]=[J(`validation.json`)]}break;case`date`:{let e=i_(l);!/^\d{4}-\d{2}-\d{2}$/.test(e)||Number.isNaN(Date.parse(`${e}T00:00:00Z`))||new Date(`${e}T00:00:00Z`).toISOString().slice(0,10)!==e?a[s]=[J(`validation.date`)]:i[o.name]=e;break}case`datetime`:{let e=new Date(i_(l));Number.isNaN(e.getTime())?a[s]=[J(`validation.datetime`)]:i[o.name]=e.toISOString();break}default:i[o.name]=c}}return{payload:i,errors:a}}function lD(e,t){let{payload:n}=cD(e,t),r=e=>Array.isArray(e)?e.every(e=>typeof e==`string`||typeof e==`number`):typeof e==`string`?e.length<=100:typeof e!=`object`||!e,i=Object.fromEntries(Object.entries(n).filter(([,e])=>r(e))),a=JSON.stringify(i);return a.length<=4e3?a:void 0}var uD={ok:`bg-ok-bg text-ok`,warn:`bg-warn-bg text-warn`,bad:`bg-bad-bg text-bad`,info:`bg-info-bg text-info`,neutral:`bg-muted text-muted-foreground`,primary:`bg-primary-soft text-primary-text`};function dD({tone:e=`neutral`,className:t,...n}){return(0,b.jsx)(`span`,{"data-slot":`badge`,"data-tone":e,className:U(`inline-flex h-[22px] items-center gap-1 rounded-full px-2 text-xs leading-none font-medium whitespace-nowrap`,uD[e],t),...n})}var fD={gray:`neutral`,red:`bad`,amber:`warn`,green:`ok`,blue:`info`,purple:`primary`,pink:`bad`};function pD(e){return fD[e]??`neutral`}function mD({value:e,field:t,className:n}){if(e==null)return(0,b.jsx)(b.Fragment,{children:fC(e,t)});let r=t.colors?.[String(e)]??`gray`;return(0,b.jsx)(dD,{"data-color":r,tone:pD(r),className:n,children:fC(e,t)})}function hD({value:e,field:t,record:n,detailed:r,plain:i}){return t.file&&n?(0,b.jsx)(KE,{field:t,files:QE(n,t.name),detailed:r,plain:i}):t.widget===`badge`?(0,b.jsx)(mD,{value:e,field:t}):(0,b.jsx)(b.Fragment,{children:fC(e,t)})}function gD({title:e,subtitle:t,icon:n,actions:r,footer:i,className:a,bodyClassName:o,children:s,...c}){let l=(0,y.useId)(),u=e!==void 0&&c[`aria-labelledby`]===void 0?{"aria-labelledby":l}:{};return(0,b.jsxs)(`section`,{"data-slot":`card`,className:U(`rounded-card border border-border bg-card text-card-foreground shadow-card`,a),...u,...c,children:[e!==void 0&&(0,b.jsxs)(`header`,{className:`flex min-h-14 items-center gap-2 border-b border-border px-5 py-3`,children:[n&&(0,b.jsx)(`span`,{className:`text-muted-foreground [&_svg]:size-4`,children:n}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`h2`,{id:l,className:`text-[15px] font-semibold`,children:e}),t&&(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t})]}),r&&(0,b.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:r})]}),(0,b.jsx)(`div`,{className:U(e!==void 0&&`p-5`,o),children:s}),i&&(0,b.jsx)(`footer`,{className:`border-t border-border px-5 py-3`,children:i})]})}function _D({card:e,values:t,schema:n}){let r=X(),i=wv(e.relation?.resource??``,e.relation!==void 0);if(!t)return null;let a=e.relation?i.data?.fields:n.fields;if(!a)return null;let o=UT(e.icon),s=e.fields.flatMap(e=>{let t=a.find(t=>t.name===e);return t?[t]:[]}),c=e.relation?.link&&typeof t._id==`string`?`/${e.relation.resource}/${encodeURIComponent(t._id)}`:void 0;return(0,b.jsx)(gD,{title:e.title,icon:o?(0,b.jsx)(o,{}):void 0,actions:c&&(0,b.jsx)(xo,{to:c,className:`text-[13px] font-medium text-primary hover:underline`,children:r(`form.viewProfile`)}),children:(0,b.jsxs)(`dl`,{className:`flex flex-col gap-2.5 text-[13px]`,children:[e.relation&&typeof t._title==`string`&&(0,b.jsx)(`dt`,{className:`text-[14px] font-semibold`,children:t._title}),s.map(e=>(0,b.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`min-w-0 text-end break-words`,children:(0,b.jsx)(hD,{value:t[e.name],field:e,record:t})})]},e.name))]})})}function vD(e,t,n){let r=e.steps?.values??e.enumValues??[],i=typeof t==`string`?r.indexOf(t):-1;return r.map((t,r)=>{let a=n?.[t],o=a?k_(new Date(a)):null,s=i===-1?`future`:r<i?`done`:r===i?`current`:`future`;return{key:t,label:e.enumLabels?.[t]??t,state:s,at:s===`future`?null:o,caption:s===`current`&&o?J(`stepper.since`,{time:o}):null}})}function yD({field:e,value:t,reached:n}){let r=vD(e,t,n);return(0,b.jsx)(gD,{"aria-label":e.label,bodyClassName:`overflow-x-auto px-5 py-4`,children:(0,b.jsx)(`ol`,{className:`flex min-w-max`,children:r.map((e,t)=>(0,b.jsxs)(`li`,{"aria-current":e.state===`current`?`step`:void 0,className:`relative flex min-w-28 flex-1 flex-col items-center gap-1.5 text-center`,children:[t<r.length-1&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:U(`absolute start-1/2 top-3.5 h-0.5 w-full`,e.state===`done`?`bg-primary`:`bg-border`)}),(0,b.jsx)(`span`,{className:U(`relative z-10 flex size-7 items-center justify-center rounded-full border-2 bg-card text-xs font-semibold`,e.state===`done`&&`border-primary bg-primary text-primary-foreground`,e.state===`current`&&`border-primary text-primary`,e.state===`future`&&`border-border text-muted-foreground`),children:e.state===`done`?(0,b.jsx)($y,{className:`size-3.5`,"aria-hidden":!0}):E_(t+1)}),(0,b.jsx)(`span`,{className:U(`text-[13px]`,e.state===`current`?`font-semibold text-primary`:e.state===`done`?`font-semibold`:`text-muted-foreground`),children:e.label}),(0,b.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:e.caption??e.at??`—`})]},e.key))})})}var bD=class{options;pending=[];problems=[];uploads=new Map;nextId=0;disposed=!1;constructor(e){this.options=e}get busy(){return this.pending.length>0}start(e,t){if(!(this.disposed||e.length===0)){this.problems=[];for(let n of e){let e=this.options.check(n);if(e){this.problems=[...this.problems,this.options.describe(n.name,e)];continue}let r=++this.nextId,i=this.options.preview?.(n),a=this.options.send(n,e=>{this.disposed||(this.pending=this.pending.map(t=>t.id===r?{...t,progress:e}:t),this.options.onChange())});this.uploads.set(r,a),this.pending=[...this.pending,{id:r,name:n.name,progress:0,preview:i}],a.promise.then(e=>{this.disposed||(this.finish(r),t(e,n,i))},e=>{this.disposed||(i&&this.options.revoke?.(i),e instanceof nv||(this.problems=[...this.problems,this.options.describe(n.name,sv(e))]),this.finish(r))})}this.options.onChange()}}report(e,t){this.problems=[...this.problems,this.options.describe(e,t)],this.options.onChange()}cancel(e){this.uploads.get(e)?.abort()}cancelAll(){for(let e of[...this.uploads.values()])e.abort()}dispose(){this.disposed=!0;for(let e of this.pending)e.preview&&this.options.revoke?.(e.preview);this.cancelAll(),this.uploads.clear(),this.pending=[]}finish(e){this.uploads.delete(e),this.pending=this.pending.filter(t=>t.id!==e),this.options.onChange()}};function xD({resource:e,field:t,rules:n,onBusy:r}){let i=X(),[,a]=(0,y.useReducer)(e=>e+1,0),o=(0,y.useRef)({resource:e,field:t,rules:n,t:i});o.current={resource:e,field:t,rules:n,t:i};let s=(0,y.useRef)(null),c=()=>new bD({send:(e,t)=>Q.upload(e,{resource:o.current.resource,field:o.current.field.name},t),check:e=>lv(e,o.current.rules),describe:(e,t)=>o.current.t(`upload.failed`,{name:e,message:t}),preview:e=>e.type.startsWith(`image/`)?URL.createObjectURL(e):void 0,revoke:e=>URL.revokeObjectURL(e),onChange:a});s.current??=c();let l=s.current.busy;return(0,y.useEffect)(()=>{r?.(l)},[l]),(0,y.useEffect)(()=>(s.current||(s.current=c(),a()),()=>{s.current?.dispose(),s.current=null,r?.(!1)}),[]),s.current}function SD({resource:e,field:t,value:n,onChange:r,onBusy:i}){let a=t.file?.many===!0,o=ZE(n),s=(0,y.useRef)(o);s.current=o;let c=xD({resource:e,field:t,rules:t.file??{accept:[],maxBytes:1/0},onBusy:i}),l=(0,y.useRef)(new Map);(0,y.useEffect)(()=>()=>{for(let e of l.current.values())URL.revokeObjectURL(e);l.current.clear()},[]);function u(e){let t=new Set(e.map(e=>e.token));for(let[e,n]of l.current)t.has(e)||(URL.revokeObjectURL(n),l.current.delete(e));s.current=e,r(a?e:e[0]??null)}function d(e){let t=a?e:e.slice(0,1);t.length!==0&&(a||c.cancelAll(),c.start(t,(e,t,n)=>{n&&l.current.set(e.token,n);let r={token:e.token,name:e.name,size:e.size,contentType:e.contentType,...e.url?{url:e.url}:{}};u(a?[...s.current,r]:[r])}))}return{many:a,files:o,pending:c.pending,problems:c.problems,add:d,remove:e=>u(o.filter((t,n)=>n!==e)),move:(e,t)=>u(fv(o,e,t)),cancel:e=>c.cancel(e),previewOf:e=>e.url??(e.token?l.current.get(e.token):void 0)}}function CD(e){let[t,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(null),a=()=>{n(null),i(null)};return{dragging:t,over:r,item:r=>({draggable:!0,onDragStart:e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,String(r)),n(r)},onDragOver:e=>{t!==null&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,i(r))},onDrop:n=>{t!==null&&(n.preventDefault(),e(t,r),a())},onDragEnd:a})}}function wD({id:e,field:t,label:n,compact:r,onFiles:i,aria:a}){let o=X(),s=(0,y.useRef)(null),[c,l]=(0,y.useState)(!1),u=t.file?.many===!0,d=t.file?.accept??[],f=d.length===0||d.some(e=>e===`*`||e===`*/*`),p=e=>e.dataTransfer.types.includes(`Files`);return(0,b.jsxs)(`div`,{"data-dropzone":t.name,onDragOver:e=>{p(e)&&(e.preventDefault(),l(!0))},onDragLeave:()=>l(!1),onDrop:e=>{p(e)&&(e.preventDefault(),l(!1),i([...e.dataTransfer.files]))},className:U(`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg text-sm has-[:focus-visible]:ring-3 has-[:focus-visible]:ring-ring/50`,!r&&`border border-dashed border-input px-3 py-3`,c&&`border-primary bg-muted/50`),children:[(0,b.jsx)(`input`,{ref:s,id:e,type:`file`,className:`sr-only`,multiple:u,accept:f?void 0:d.join(`,`),onChange:e=>{i([...e.target.files??[]]),e.target.value=``},...a}),(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,tabIndex:-1,"aria-hidden":!0,onClick:()=>s.current?.click(),children:[(0,b.jsx)(zS,{}),n]}),!r&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[o(u?`upload.dropMany`:`upload.drop`),t.file&&` · ${o(`upload.limit`,{max:dv(t.file.maxBytes)})}`]})]})}function TD({upload:e,onCancel:t,className:n}){let r=X(),i=Math.round(e.progress*100);return(0,b.jsxs)(`div`,{className:U(`flex items-center gap-2`,n),children:[(0,b.jsx)(`div`,{role:`progressbar`,"aria-label":r(`upload.uploading`,{name:e.name}),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i,className:`h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,b.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width]`,style:{width:`${i}%`}})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":r(`upload.cancel`,{name:e.name}),onClick:t,children:(0,b.jsx)($S,{})})]})}function ED({problems:e}){return e.length===0?null:(0,b.jsx)(`ul`,{role:`alert`,className:`flex flex-col gap-0.5 text-sm text-destructive`,children:e.map((e,t)=>(0,b.jsx)(`li`,{children:e},t))})}function DD(e){let t=X(),{id:n,field:r,aria:i}=e,{many:a,files:o,pending:s,problems:c,add:l,remove:u,move:d,cancel:f}=SD(e),p=CD(d);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(o.length>0||s.length>0)&&(0,b.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[o.map((e,n)=>(0,b.jsxs)(`li`,{"data-file":e.name,...a&&o.length>1?p.item(n):{},className:U(`flex items-center gap-2 rounded-lg border px-2 py-1.5 text-sm`,p.dragging===n&&`opacity-50`,p.over===n&&p.dragging!==n&&`border-primary`),children:[a&&o.length>1?(0,b.jsx)(Ub,{className:`size-4 shrink-0 cursor-grab text-muted-foreground`,"aria-hidden":!0}):(0,b.jsx)(Fb,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),e.url?(0,b.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`min-w-0 truncate hover:underline`,"aria-label":t(`upload.open`,{name:e.name}),children:(0,b.jsx)(`bdi`,{children:e.name})}):(0,b.jsx)(`bdi`,{className:`min-w-0 truncate`,children:e.name}),(0,b.jsx)(`span`,{className:`ms-auto shrink-0 text-muted-foreground`,children:dv(e.size)}),a&&o.length>1&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,disabled:n===0,"aria-label":t(`list.moveUp`,{name:e.name}),onClick:()=>d(n,n-1),children:(0,b.jsx)(ky,{})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,disabled:n===o.length-1,"aria-label":t(`list.moveDown`,{name:e.name}),onClick:()=>d(n,n+1),children:(0,b.jsx)(Ty,{})})]}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":t(`upload.remove`,{name:e.name}),onClick:()=>u(n),children:(0,b.jsx)($S,{})})]},e.token??e.key)),s.map(e=>(0,b.jsxs)(`li`,{className:`flex flex-col gap-1 rounded-lg border border-dashed px-2 py-1.5 text-sm`,children:[(0,b.jsx)(`bdi`,{className:`truncate text-muted-foreground`,children:e.name}),(0,b.jsx)(TD,{upload:e,onCancel:()=>f(e.id)})]},`pending-${e.id}`))]}),(0,b.jsx)(wD,{id:n,field:r,label:t(a?`upload.chooseMany`:o.length>0?`upload.replace`:`upload.choose`),compact:!a&&o.length>0,onFiles:l,aria:i}),(0,b.jsx)(ED,{problems:c})]})}function OD(e){let t=X(),{id:n,field:r,aria:i}=e,{many:a,files:o,pending:s,problems:c,add:l,remove:u,move:d,cancel:f,previewOf:p}=SD(e),m=CD(d),h=a&&o.length>1;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(o.length>0||s.length>0)&&(0,b.jsxs)(`ul`,{className:`flex flex-wrap gap-2`,children:[o.map((e,n)=>{let r=p(e);return(0,b.jsxs)(`li`,{"data-file":e.name,...h?m.item(n):{},className:U(`group relative size-28 overflow-hidden rounded-lg border bg-muted`,h&&`cursor-grab`,m.dragging===n&&`opacity-50`,m.over===n&&m.dragging!==n&&`border-primary ring-2 ring-primary/40`),children:[r?(0,b.jsx)(`img`,{src:r,alt:e.name,draggable:!1,className:`size-full object-cover`}):(0,b.jsxs)(`span`,{className:`flex size-full flex-col items-center justify-center gap-1 p-1 text-center text-xs text-muted-foreground`,children:[(0,b.jsx)(Yb,{className:`size-5`,"aria-hidden":!0}),(0,b.jsx)(`bdi`,{className:`w-full truncate`,children:e.name})]}),(0,b.jsx)(q,{type:`button`,variant:`secondary`,size:`icon-xs`,className:`absolute end-1 top-1 shadow`,"aria-label":t(`upload.remove`,{name:e.name}),onClick:()=>u(n),children:(0,b.jsx)($S,{})}),h&&(0,b.jsxs)(`div`,{className:`absolute inset-x-1 bottom-1 flex justify-between`,children:[(0,b.jsx)(q,{type:`button`,variant:`secondary`,size:`icon-xs`,className:`shadow`,disabled:n===0,"aria-label":t(`list.moveUp`,{name:e.name}),onClick:()=>d(n,n-1),children:(0,b.jsx)(rb,{className:`rtl:rotate-180`})}),(0,b.jsx)(q,{type:`button`,variant:`secondary`,size:`icon-xs`,className:`shadow`,disabled:n===o.length-1,"aria-label":t(`list.moveDown`,{name:e.name}),onClick:()=>d(n,n+1),children:(0,b.jsx)(ab,{className:`rtl:rotate-180`})})]})]},e.token??e.key)}),s.map(e=>(0,b.jsxs)(`li`,{className:`relative size-28 overflow-hidden rounded-lg border border-dashed bg-muted`,children:[e.preview&&(0,b.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover opacity-40`}),(0,b.jsx)(TD,{upload:e,onCancel:()=>f(e.id),className:`absolute inset-x-1 bottom-1 rounded-md bg-background/80 ps-1.5`})]},`pending-${e.id}`))]}),(0,b.jsx)(wD,{id:n,field:r,label:t(a?`upload.chooseImages`:o.length>0?`upload.replace`:`upload.chooseImage`),compact:!a&&o.length>0,onFiles:l,aria:i}),(0,b.jsx)(ED,{problems:c})]})}function kD(e,t){let[n,r]=(0,y.useState)(e);return(0,y.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var AD=(e,t)=>String(e.id)===String(t.id);function jD({id:e,resource:t,field:n,value:r,onChange:i,clearable:a,values:o,parent:s,invalid:c,describedBy:l}){let u=X(),d=n.relation?.kind===`to-many`,f=d&&Array.isArray(r)?r:[],p=!d&&r&&!Array.isArray(r)?r:null,[m,h]=(0,y.useState)(``),[g,_]=(0,y.useState)(!1),[v,x]=(0,y.useState)(0),S=kD(m.trim(),250),C=kv(t,n.optionsField??n.name,S,g,o,s),w=(C.data?.items??[]).filter(e=>!f.some(t=>AD(t,e))),T=`${e}-options`,E=t=>`${e}-option-${t}`;(0,y.useEffect)(()=>{x(0)},[S,C.data]);function D(e){h(``),_(!1),i(d?[...f,e]:e)}function O(e){e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),g?x(t=>Math.max(0,Math.min(w.length-1,t+(e.key===`ArrowDown`?1:-1)))):_(!0)):e.key===`Enter`&&g?(e.preventDefault(),w[v]&&D(w[v])):e.key===`Escape`&&g?(e.preventDefault(),_(!1),h(``)):e.key===`Backspace`&&d&&m===``&&f.length>0&&i(f.slice(0,-1))}return(0,b.jsxs)(`div`,{className:`relative flex flex-col gap-1.5`,children:[d&&f.length>0&&(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,"aria-label":u(`picker.selected`,{name:n.label}),children:f.map(e=>(0,b.jsxs)(`li`,{className:`inline-flex items-center gap-1 rounded-md bg-muted py-0.5 ps-2 pe-1 text-sm`,children:[e.title,(0,b.jsx)(`button`,{type:`button`,className:`rounded-sm p-0.5 text-muted-foreground hover:text-foreground`,"aria-label":u(`picker.remove`,{name:e.title}),onClick:()=>i(f.filter(t=>!AD(t,e))),children:(0,b.jsx)($S,{className:`size-3.5`})})]},String(e.id)))}),(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(e_,{id:e,role:`combobox`,autoComplete:`off`,"aria-autocomplete":`list`,"aria-expanded":g,"aria-controls":T,"aria-activedescendant":g&&w[v]?E(v):void 0,"aria-invalid":c||void 0,"aria-describedby":l,className:U(p&&a&&`pe-8`),placeholder:p?p.title:u(d?`picker.typeToAdd`:`picker.typeToSearch`),value:g||m?m:p?.title??``,onChange:e=>{h(e.target.value),_(!0)},onFocus:()=>_(!0),onBlur:()=>{_(!1),h(``)},onKeyDown:O}),p&&a&&(0,b.jsx)(`button`,{type:`button`,className:`absolute inset-y-0 end-0 flex items-center px-2 text-muted-foreground hover:text-foreground`,"aria-label":u(`picker.clear`,{name:n.label}),onClick:()=>i(null),children:(0,b.jsx)($S,{className:`size-4`})})]}),g&&(0,b.jsxs)(`div`,{className:`absolute inset-x-0 top-full z-20 mt-1 max-h-60 overflow-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:[(0,b.jsx)(`ul`,{id:T,role:`listbox`,"aria-label":n.label,children:w.map((e,t)=>(0,b.jsx)(`li`,{id:E(t),role:`option`,"aria-selected":t===v,className:U(`cursor-pointer rounded-md px-2 py-1.5 text-sm`,t===v&&`bg-accent text-accent-foreground`),onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>x(t),onClick:()=>D(e),children:e.title},String(e.id)))}),w.length===0&&(0,b.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,children:C.isError?W_(C.error):u(C.isFetching||C.isPending?`picker.searching`:`picker.noMatches`)})]})]})}function MD({className:e,...t}){return(0,b.jsx)(`textarea`,{"data-slot":`textarea`,className:U(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function ND(e,t){if(e.widget===`stepper`)return`select`;if(e.widget)return e.widget;switch(e.type){case`boolean`:return`checkbox`;case`enum`:return`select`;case`text`:return`textarea`;case`json`:case`object`:return`json`;case`number`:case`decimal`:case`bigint`:return`number`;case`date`:return`date`;case`datetime`:return`datetime`;default:return t?.format===`email`?`email`:t?.format===`url`?`url`:`text`}}function PD(e,t){return e.enumLabels?.[t]??t}function FD({id:e,field:t,value:n,onChange:r,aria:i}){let{unit:a,position:o}=uC(`0`,{currency:t.currency}),s=a&&(0,b.jsx)(`span`,{className:`shrink-0 text-[13px] text-muted-foreground`,children:a}),c=(0,y.useRef)(null),l=(0,y.useRef)(null);return(0,y.useLayoutEffect)(()=>{l.current!==null&&(c.current?.setSelectionRange(l.current,l.current),l.current=null)}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`before`&&s,(0,b.jsx)(e_,{ref:c,id:e,type:`text`,inputMode:`decimal`,dir:`ltr`,className:`text-end`,value:n,placeholder:t.placeholder,onChange:e=>{let t=aC(e.target.value,e.target.selectionStart??e.target.value.length);l.current=t.caret,r(t.text)},onBlur:()=>r(iC(n,t.scale)),...i}),o!==`before`&&s]})}function ID({id:e,checked:t,onChange:n,aria:r}){return(0,b.jsx)(`button`,{id:e,type:`button`,role:`switch`,"aria-checked":t,onClick:()=>n(!t),className:U(`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,t?`bg-primary`:`bg-input`),...r,children:(0,b.jsx)(`span`,{className:U(`block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-4 rtl:-translate-x-4`:`translate-x-0`)})})}function LD({id:e,field:t,value:n,onChange:r,aria:i,label:a,required:o}){let s=X(),c=(t.enumValues??[]).map(e=>[e,PD(t,e)]);return t.nullable&&!o&&c.unshift([``,s(`common.empty`)]),(0,b.jsxs)(`fieldset`,{id:e,className:`flex flex-col gap-1.5`,...i,children:[(0,b.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:a}),(0,b.jsx)(`div`,{role:`radiogroup`,className:`flex flex-wrap gap-x-4 gap-y-1.5`,children:c.map(([t,i])=>(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,b.jsx)(`input`,{type:`radio`,name:e,value:t,checked:n===t,onChange:()=>r(t),className:`size-4 accent-primary`}),i]},t))})]})}var RD=/^#[0-9a-f]{6}$/i;function zD({id:e,field:t,value:n,onChange:r,aria:i}){let a=X();return(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{type:`color`,"aria-hidden":!0,tabIndex:-1,className:`h-8 w-10 shrink-0 cursor-pointer rounded-md border border-input bg-transparent p-0.5`,value:RD.test(n)?n.toLowerCase():`#000000`,onChange:e=>r(e.target.value)}),(0,b.jsx)(e_,{id:e,dir:`ltr`,value:n,placeholder:t.placeholder??`#000000`,"aria-label":a(`form.colorCode`,{name:t.label}),onChange:e=>r(e.target.value),...i})]})}function BD({id:e,field:t,value:n,onChange:r,aria:i}){let a=X(),[o,s]=(0,y.useState)(null),c=`${e}-json`;function l(){if(n.trim()!==``)try{r(JSON.stringify(JSON.parse(n),null,2)),s(null)}catch(e){s(e instanceof Error?e.message:String(e))}}let u=[i[`aria-describedby`],o?c:void 0].filter(Boolean).join(` `)||void 0;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(MD,{id:e,dir:`ltr`,rows:6,className:`font-mono`,spellCheck:!1,value:n,placeholder:t.placeholder,onChange:e=>{s(null),r(e.target.value)},...i,"aria-invalid":i[`aria-invalid`]??(o?!0:void 0),"aria-describedby":u}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:l,children:a(`form.formatJson`)}),o&&(0,b.jsx)(`p`,{id:c,className:`text-sm text-destructive`,children:o})]})]})}function VD({id:e,field:t,value:n,onChange:r,aria:i}){return(0,b.jsx)(MD,{id:e,rows:4,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),...i})}function HD({id:e,field:t,value:n,onChange:r,aria:i,...a}){return(0,b.jsx)(e_,{id:e,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),...a,...i})}var UD=(0,y.lazy)(()=>Za(()=>import(`./rich-text-input-CIWHT51G.js`),__vite__mapDeps([0,1]),import.meta.url));function WD(e){let t=X();return(0,b.jsx)(y.Suspense,{fallback:(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`editor.loading`)}),children:(0,b.jsx)(UD,{...e})})}function GD({resource:e,field:t,value:n,required:r,errors:i,constraints:a,formValues:o,onChange:s,onBusy:c,idPrefix:l=`field`,parent:u,hideLabel:d,action:f}){let p=`${l}-${t.name}`,m=`${p}-error`,h=`${p}-help`,g=(i?.length??0)>0,_=[t.help?h:void 0,g?m:void 0].filter(Boolean).join(` `)||void 0,v={"aria-invalid":g?!0:void 0,"aria-describedby":_},y=typeof n==`string`?n:``,x=t.type===`relation`?void 0:ND(t,a),S=(0,b.jsxs)(b.Fragment,{children:[t.label,r&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`text-destructive`,children:`*`})]}),C=(0,b.jsx)(t_,{htmlFor:p,className:d?`sr-only`:void 0,children:S}),w=t.help?(0,b.jsx)(`p`,{id:h,className:`text-sm text-muted-foreground`,children:t.help}):null,T={id:p,field:t,value:y,onChange:e=>s(e),aria:v};if(t.type===`boolean`){let e=n===!0;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[x===`switch`?(0,b.jsx)(ID,{id:p,checked:e,onChange:s,aria:v}):(0,b.jsx)(`input`,{id:p,type:`checkbox`,className:`size-4 accent-primary`,checked:e,onChange:e=>s(e.target.checked),...v}),C]}),w,(0,b.jsx)(qD,{id:m,errors:i})]})}if(t.type===`enum`&&x===`radio`)return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(LD,{...T,label:S,required:r}),w,(0,b.jsx)(qD,{id:m,errors:i})]});let E;if(t.choices&&f)E=(0,b.jsx)(JD,{id:p,resource:e,action:f,field:t,value:y,onChange:s,aria:v});else if(t.type===`relation`)E=(0,b.jsx)(jD,{id:p,resource:e,field:t,value:n??null,onChange:s,clearable:t.nullable,values:o,parent:u,invalid:g,describedBy:_});else if(t.type===`enum`)E=(0,b.jsx)(Bw,{id:p,value:y,onValueChange:e=>s(e),placeholder:t.placeholder??`—`,options:[{value:``,label:t.placeholder??`—`},...(t.enumValues??[]).map(e=>({value:e,label:PD(t,e)}))],...v});else switch(x){case`file`:E=(0,b.jsx)(DD,{id:p,resource:e,field:t,value:n,onChange:s,onBusy:c,aria:v});break;case`image`:E=(0,b.jsx)(OD,{id:p,resource:e,field:t,value:n,onChange:s,onBusy:c,aria:v});break;case`richtext`:E=(0,b.jsx)(WD,{id:p,resource:e,field:t,value:y,onChange:s,onBusy:c,invalid:g,describedBy:_});break;case`money`:E=(0,b.jsx)(FD,{...T});break;case`date`:E=(0,b.jsx)(vw,{id:p,live:!0,value:y,label:t.label,onChange:e=>s(e),...v});break;case`datetime`:E=(0,b.jsx)(xw,{id:p,value:y,label:t.label,onChange:e=>s(e),...v});break;case`json`:E=(0,b.jsx)(BD,{...T});break;case`textarea`:E=(0,b.jsx)(VD,{...T});break;case`color`:E=(0,b.jsx)(zD,{...T});break;case`password`:E=(0,b.jsx)(HD,{...T,type:`password`,autoComplete:`new-password`});break;case`slug`:E=(0,b.jsx)(HD,{...T,dir:`ltr`,autoCapitalize:`none`,spellCheck:!1});break;default:E=(0,b.jsx)(HD,{...T,...KD(t,x)})}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[C,E,w,(0,b.jsx)(qD,{id:m,errors:i})]})}function KD(e,t){if(t===`email`||t===`url`)return{type:t};switch(e.type){case`number`:case`decimal`:return{type:`text`,inputMode:`decimal`};case`bigint`:return{type:`text`,inputMode:`numeric`};case`date`:return{type:`date`};case`datetime`:return{type:`datetime-local`};default:return{type:`text`}}}function qD({id:e,errors:t}){return t?.length?(0,b.jsx)(`p`,{id:e,className:`text-sm text-destructive`,children:t.join(` `)}):null}function JD({id:e,resource:t,action:n,field:r,value:i,onChange:a,aria:o}){let s=X(),c=Av(t,n,r.name),l=c.data?.items??[],u=i!==``&&!l.some(e=>e.value===i)?[{value:i,label:i},...l]:l;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,b.jsx)(Bw,{id:e,value:i,disabled:c.isPending,"aria-busy":c.isPending||void 0,onValueChange:e=>a(e),placeholder:c.isPending?s(`common.loading`):r.placeholder??`—`,options:[{value:``,label:r.placeholder??`—`},...u],...o}),c.isError&&(0,b.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[s(`action.choicesFailed`,{error:W_(c.error)}),` `,(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void c.refetch(),children:s(`action.choicesRetry`)})]})]})}var YD={1:``,2:`md:grid-cols-2`,3:`md:grid-cols-2 lg:grid-cols-3`};function XD({layout:e,names:t,render:n,errors:r,renderInline:i,renderSummary:a,plain:o}){let s=e&&(i?e:eO(e)),c=new Set((s??[]).flatMap(e=>`tab`in e?e.sections:[e]).flatMap(e=>QD(e)||$D(e)?[]:e.fields)),l=t.filter(e=>!c.has(e)),u=(s??[]).filter(e=>`tab`in e),d=(s??[]).findIndex(e=>`tab`in e),f=d===-1?(s??[]).filter(e=>!(`tab`in e)):(s??[]).slice(0,d).filter(e=>!(`tab`in e)),p=d===-1?[]:(s??[]).slice(d).filter(e=>!(`tab`in e)),m=(e,t)=>QD(e)?(0,b.jsx)(y.Fragment,{children:i?.(e)},t):$D(e)?(0,b.jsx)(y.Fragment,{children:a?.(e)},t):(0,b.jsx)(ZD,{section:e,render:n,plain:o},t);return(0,b.jsxs)(b.Fragment,{children:[f.map((e,t)=>m(e,`b${t}`)),u.length>0&&(0,b.jsx)(tO,{tabs:u,render:n,errors:r,block:m}),p.map((e,t)=>m(e,`a${t}`)),l.length>0&&(0,b.jsx)(ZD,{section:{fields:l,columns:1},render:n,plain:o})]})}function ZD({section:e,render:t,plain:n}){let r=(0,y.useId)(),i=e.fields.map(e=>[e,t(e)]).filter(([,e])=>e!==null);if(i.length===0)return null;let a=(0,b.jsx)(`div`,{className:U(`grid gap-5`,YD[e.columns]),children:i.map(([e,t])=>(0,b.jsx)(`div`,{className:`min-w-0`,children:t},e))});return n?e.title?(0,b.jsxs)(`section`,{"aria-labelledby":r,className:`flex flex-col gap-3`,children:[(0,b.jsx)(`h3`,{id:r,className:`text-[13px] font-semibold text-muted-foreground`,children:e.title}),a]}):a:e.title?(0,b.jsx)(gD,{"aria-labelledby":r,title:(0,b.jsx)(`span`,{id:r,children:e.title}),children:a}):(0,b.jsx)(gD,{bodyClassName:`p-5`,children:a})}var QD=e=>`inline`in e,$D=e=>`summary`in e;function eO(e){return e.filter(e=>!QD(e)&&!$D(e)).map(e=>`tab`in e?{...e,sections:e.sections.filter(e=>!QD(e)&&!$D(e))}:e)}function tO({tabs:e,render:t,errors:n,block:r}){let i=X(),{locale:a}=Y(),o=(0,y.useId)(),[s,c]=(0,y.useState)(0),l=(0,y.useRef)([]),u=e=>e.sections.some(e=>(QD(e)?[`_inlines.${e.inline}`]:$D(e)?[]:e.fields).some(e=>Object.keys(n).some(t=>t===e||t.startsWith(`${e}.`))));(0,y.useEffect)(()=>{if(u(e[s]))return;let t=e.findIndex(u);t!==-1&&c(t)},[n]);function d(t){let n=w_(a)?`ArrowLeft`:`ArrowRight`,r=w_(a)?`ArrowRight`:`ArrowLeft`,i;t.key===n?i=(s+1)%e.length:t.key===r?i=(s-1+e.length)%e.length:t.key===`Home`?i=0:t.key===`End`&&(i=e.length-1),i!==void 0&&(t.preventDefault(),c(i),l.current[i]?.focus())}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`div`,{role:`tablist`,className:`flex gap-0.5 overflow-x-auto border-b`,onKeyDown:d,children:e.map((e,t)=>(0,b.jsxs)(`button`,{ref:e=>{l.current[t]=e},id:`${o}-tab-${t}`,type:`button`,role:`tab`,"aria-selected":t===s,"aria-controls":`${o}-panel-${t}`,tabIndex:t===s?0:-1,onClick:()=>c(t),className:U(`-mb-px flex h-[38px] items-center gap-1.5 border-b-2 px-3 text-[13px] whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,t===s?`border-foreground font-semibold`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e.tab,u(e)&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-destructive`}),(0,b.jsx)(`span`,{className:`sr-only`,children:i(`form.tabHasErrors`)})]})]},t))}),e.map((e,t)=>(0,b.jsx)(`div`,{id:`${o}-panel-${t}`,role:`tabpanel`,"aria-labelledby":`${o}-tab-${t}`,hidden:t!==s,className:U(`flex-col gap-5`,t===s?`flex`:`hidden`),children:e.sections.map((e,t)=>r(e,String(t)))},t))]})}var nO=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{};function rO({resource:e,field:t,path:n,pattern:r,value:i,constraints:a,markRequired:o,errors:s,onChange:c,idPrefix:l}){let u=X(),d=s[n];if(t.many){let f=Array.isArray(i)?i:[];return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,b.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:t.label}),f.map((i,d)=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-md border border-dashed p-3`,children:[(0,b.jsx)(iO,{resource:e,field:t,path:`${n}.${d}`,pattern:`${r}.*`,value:i,constraints:a,markRequired:o,errors:s,idPrefix:l,onChange:e=>c(f.map((t,n)=>n===d?e:t))}),(0,b.jsx)(`div`,{children:(0,b.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>c(f.filter((e,t)=>t!==d)),children:[(0,b.jsx)(NS,{}),u(`form.remove`,{name:t.label,index:d+1})]})})]},d)),(0,b.jsx)(`div`,{children:(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>c([...f,oD(t.fields??[])]),children:[(0,b.jsx)(Gx,{}),u(`form.add`,{name:t.label})]})}),d&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:d.join(` `)})]})}return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,b.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:t.label}),(0,b.jsx)(iO,{resource:e,field:t,path:n,pattern:r,value:nO(i),constraints:a,markRequired:o,errors:s,idPrefix:l,onChange:c}),d&&(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:d.join(` `)})]})}function iO({resource:e,field:t,path:n,pattern:r,value:i,constraints:a,markRequired:o,errors:s,onChange:c,idPrefix:l}){return(0,b.jsx)(b.Fragment,{children:(t.fields??[]).filter(e=>!e.readonly).map(t=>{let u=`${n}.${t.name}`,d=`${r}.${t.name}`,f=e=>c({...i,[t.name]:e});return t.type===`object`?(0,b.jsx)(rO,{resource:e,field:t,path:u,pattern:d,value:i[t.name],constraints:a,markRequired:o,errors:s,idPrefix:l,onChange:f},t.name):(0,b.jsx)(GD,{resource:e,field:{...t,name:u},value:i[t.name],required:o&&a[d]?.required===!0,errors:s[u],constraints:a[d],idPrefix:l,onChange:f},t.name)})})}function aO(e,t){let n=t?._perm?.actions;return e.actions.filter(e=>e.target===`record`&&(n===void 0||typeof n[e.name]==`string`)).map(e=>n?.[e.name]?{...e,label:n[e.name]}:e)}function oO(e,t){let n=aO(e,t),r=n.find(e=>e.primary),i=n.filter(e=>e!==r);return{...r?{primary:r}:{},buttons:i.slice(0,3),overflow:i.slice(3)}}function sO(e,t){let n=e.actions.filter(e=>e.target===`record`&&e.bulk);return t.length===0?n:n.filter(n=>t.some(t=>aO(e,t).some(e=>e.name===n.name)))}function cO(e){return e.actions.filter(e=>e.target===`resource`)}function lO(e,t=0){return e.confirm!==void 0||e.variant===`destructive`||t>1}function uO(e,t=0){return!e.input&&!lO(e,t)}function dO(e,t,n,r){if(lO(e,t))return typeof e.confirm==`string`?e.confirm:t>1?r(`action.confirmSelected`,{action:e.label,count:t}):n===void 0?r(`action.confirm`,{action:e.label}):r(`action.confirmRecord`,{action:e.label,name:n})}function fO(e){let t=e.message===void 0?{}:{message:e.message};return`record`in e?{kind:`record`,record:e.record,...t}:`ok`in e&&`failed`in e?{kind:`bulk`,result:{ok:e.ok,failed:e.failed},...t}:{kind:`resource`,...t}}function pO(e,t){return e.kind===`bulk`?e.result:{ok:t,failed:[]}}function mO(e,t){if(!(e instanceof U_))return{fields:{},form:e.message};let n=Object.entries(e.fields),r=e=>t.includes(e.split(`.`)[0]),i=Object.fromEntries(n.filter(([e])=>r(e))),a=n.filter(([e])=>!r(e)).flatMap(([,e])=>e);return{fields:i,form:Object.keys(i).length>0&&a.length===0?null:[e.message,...a].join(` — `)}}var hO=/\{([^{}]*)\}/g;function gO(e,t){let n=!1,r=e.replace(hO,(e,r)=>{let i=t[r],a=typeof i==`string`?i.trim():typeof i==`boolean`?String(i):``;return a===``&&(n=!0),a});return n?``:r}function _O(e,t){return new Set(e.filter(e=>e.fillFrom!==void 0&&t[e.name]!==``&&t[e.name]!==void 0).map(e=>e.name))}function vO(e,t,n){let r=e.filter(e=>e.fillFrom!==void 0&&!n.has(e.name));if(r.length===0)return t;let i=t;for(let e=0;e<=r.length;e++){let e=!1;for(let n of r){let r=gO(n.fillFrom,i);i[n.name]!==r&&(i===t&&(i={...t}),i[n.name]=r,e=!0)}if(!e)break}return i}function yO(e,t,n,r){e.some(e=>e.name===n&&e.fillFrom!==void 0)&&(r===``||r===null?t.delete(n):t.add(n))}function bO(e,t){let n=YE(e)?String(e.id):e;return t===null?n==null||n===``:typeof t==`boolean`?n===t||n===String(t):typeof n!=`string`||n.trim()===``?!1:typeof t==`number`?Number(a_(n).trim().replace(/,/g,``))===t:n===t}function xO(e,t){return!e.showIf||Object.entries(e.showIf).every(([e,n])=>(Array.isArray(n)?n:[n]).some(n=>bO(t[e],n)))}var SO=/^.+@[^\s@]+\.[^\s@]+$/,CO=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function wO(e){if(/\s/.test(e))return!1;try{let{hostname:t}=new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(e)?e:`http://${e}`);return t.includes(`.`)||t.startsWith(`[`)}catch{return!1}}function TO(e,t){try{return new RegExp(t.source,t.flags).test(e)}catch{return!0}}function EO(e){let t=e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)??[],n=e.match(/[^\uFE0F\uFE0E][\uFE0F\uFE0E]/g)??[];return e.length-t.length-n.length}function DO(e,t){let n=[];if(typeof e==`string`){let r=EO(e);t.minLength!==void 0&&r<t.minLength&&n.push(J(`validation.minLength`,{min:t.minLength})),t.maxLength!==void 0&&r>t.maxLength&&n.push(J(`validation.maxLength`,{max:t.maxLength})),t.pattern&&!TO(e,t.pattern)&&n.push(t.pattern.message??J(`validation.pattern`)),t.format===`email`&&!SO.test(e)&&n.push(J(`validation.email`)),t.format===`url`&&!wO(e)&&n.push(J(`validation.url`)),t.format===`uuid`&&!CO.test(e)&&n.push(J(`validation.uuid`)),t.oneOf&&!t.oneOf.includes(e)&&n.push(J(`validation.oneOf`,{values:t.oneOf.join(`, `)}))}return typeof e==`number`&&(t.integer&&!Number.isInteger(e)&&n.push(J(`validation.integer`)),t.min!==void 0&&e<t.min&&n.push(J(`validation.min`,{min:t.min})),t.max!==void 0&&e>t.max&&n.push(J(`validation.max`,{max:t.max}))),n}function OO(e,t,n){let r={};for(let[i,a]of Object.entries(t))for(let{path:t,value:o,sent:s,parentSent:c}of kO(e,i.split(`.`))){if(o==null||o===``){a.required&&c&&(n===`create`||s)&&(r[t]=[J(`validation.required`)]);continue}let e=DO(o,a);e.length>0&&(r[t]=e)}return r}function kO(e,t,n=``,r=!0){let[i,...a]=t,o=typeof e==`object`&&e?e:void 0;if(i===`*`)return(Array.isArray(e)?e:[]).flatMap((e,t)=>kO(e,a,`${n}${t}.`,!0));let s=o!==void 0&&Object.hasOwn(o,i),c=o?.[i],l=`${n}${i}`;return a.length===0?[{path:l,value:c,sent:s,parentSent:r}]:kO(c,a,`${l}.`,r&&s)}function AO({resource:e,action:t,count:n,subject:r,running:i,error:a,onRun:o,onClose:s}){let c=X(),l=t.input?.fields??[],u=(0,y.useRef)(new Set),[d,f]=(0,y.useState)(()=>vO(l,oD(l),u.current)),[p,m]=(0,y.useState)({}),[h,g]=(0,y.useState)(!1),_=l.filter(e=>xO(e,d)),v=a&&!h?mO(a,l.map(e=>e.name)):{fields:{},form:null},x={...v.fields,...p};function S(e){if(e.preventDefault(),e.stopPropagation(),!t.input)return o(void 0);let{payload:n,errors:r}=cD(_,d),i={...OO(n,Object.fromEntries(Object.entries(t.input.constraints).filter(([e])=>_.some(t=>t.name===e.split(`.`)[0]))),`create`),...r};m(i),g(Object.keys(i).length>0),Object.keys(i).length===0&&o(n)}let C=dO(t,n,r,c);function w(n){let r=_.find(e=>e.name===n);if(!r||!t.input)return null;let i=e=>{yO(l,u.current,n,e),f(t=>vO(l,{...t,[n]:e},u.current))};return r.type===`object`?(0,b.jsx)(rO,{resource:e,field:r,path:n,pattern:n,value:d[n],constraints:t.input.constraints,markRequired:!0,errors:x,idPrefix:`action`,onChange:i}):(0,b.jsx)(GD,{resource:e,field:r,value:d[n],required:t.input.required.includes(n),errors:x[n],constraints:t.input.constraints[n],idPrefix:`action`,action:t.name,onChange:i})}return(0,b.jsx)(Yd,{open:!0,onOpenChange:e=>!e&&!i&&s(),children:(0,b.jsxs)(tf,{children:[(0,b.jsx)(rf,{className:dT}),(0,b.jsx)(cf,{"aria-describedby":C?`action-question`:void 0,className:`fixed inset-x-3 top-[12vh] z-50 mx-auto flex max-h-[76vh] max-w-lg flex-col overflow-hidden rounded-xl border bg-background shadow-xl outline-none`,children:(0,b.jsxs)(`form`,{onSubmit:S,noValidate:!0,className:`flex min-h-0 flex-col`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-4 overflow-y-auto p-4`,children:[(0,b.jsx)(pf,{className:`text-lg font-semibold`,children:t.label}),C&&(0,b.jsx)(`p`,{id:`action-question`,className:`text-sm`,children:C}),n>1&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(t.atomic?`action.atomicNote`:`action.eachNote`,{count:n})}),v.form&&(0,b.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:v.form}),t.input&&(0,b.jsx)(XD,{layout:void 0,names:l.map(e=>e.name),errors:x,render:w})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t p-4`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:i,onClick:s,children:c(`common.cancel`)}),(0,b.jsx)(q,{type:`submit`,variant:t.variant===`destructive`?`destructive`:`default`,disabled:i,children:i?c(`action.running`):t.label})]})]})})]})})}function jO({resource:e,action:t,ids:n,subject:r,size:i=`default`,className:a,primary:o=!1,menuItem:s=!1,blocked:c=!1,describedBy:l,onDone:u}){let d=X(),f=S(),[p,m]=(0,y.useState)(!1),h=uO(t,n?.length??0),g=pt({mutationFn:r=>Q.runAction(e,t.name,{...n?{ids:n}:{},...r?{input:r}:{}}),onSuccess:r=>{let i=fO(r);m(!1),i.kind===`bulk`?i.message&&ZT(i.message):ZT(i.message??d(i.kind===`record`&&i.record===null?`action.doneGone`:`action.done`,{action:t.label})),u(i,n??[]);for(let t of[`list`,`count`,`record`,`history`])f.invalidateQueries({queryKey:[t,e]})},onError:e=>{h&&ZT(W_(e),`error`)}}),_=UT(t.icon);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(q,{type:`button`,size:i,variant:t.variant===`destructive`?`destructive`:o?`default`:s?`ghost`:`outline`,className:U(s&&`w-full justify-start font-normal`,a),disabled:c||g.isPending,"aria-describedby":l,"data-action":t.name,onClick:()=>{g.reset(),h?g.mutate(void 0):m(!0)},children:[_&&(0,b.jsx)(_,{"aria-hidden":!0}),t.label,o&&(0,b.jsx)(rb,{className:`ltr:rotate-180`,"aria-hidden":!0})]}),p&&(0,b.jsx)(AO,{resource:e,action:t,count:n?.length??0,subject:r,running:g.isPending,error:g.error,onRun:e=>g.mutate(e),onClose:()=>m(!1)})]})}function MO({schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a}){let o=X(),s=S(),[c,l]=(0,y.useState)(!1),{primary:u,buttons:d,overflow:f}=oO(e,t);if(!u&&d.length===0)return null;let p=`record-actions-note`,m=(o,c={})=>(0,b.jsx)(jO,{resource:e.name,action:o,ids:[n],subject:typeof t._title==`string`?t._title:`#${n}`,blocked:r,describedBy:r?p:void 0,...c,onDone:t=>{l(!1);let r=t.kind===`record`?t.record:void 0;if(r===null){i(),s.removeQueries({queryKey:[`record`,e.name,n]});return}r&&s.setQueryData([`record`,e.name,n],r),a()}},o.name);return(0,b.jsxs)(`div`,{role:`group`,"aria-label":o(`list.actions`),className:`ms-auto flex flex-wrap items-center gap-2`,children:[r&&(0,b.jsx)(`span`,{id:p,className:`text-xs text-muted-foreground`,children:o(`action.saveFirst`)}),d.map(e=>m(e)),f.length>0&&(0,b.jsxs)(Kh,{open:c,onOpenChange:l,children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`icon`,"aria-label":o(`action.more`),children:(0,b.jsx)(Tb,{})})}),(0,b.jsx)(Jh,{forceMount:!0,children:(0,b.jsx)(Yh,{forceMount:!0,align:`end`,sideOffset:6,className:`z-50 flex min-w-48 flex-col gap-0.5 rounded-[10px] border bg-popover p-1.5 shadow-lg data-[state=closed]:hidden`,onClick:()=>l(!1),children:f.map(e=>m(e,{menuItem:!0}))})})]}),u&&m(u,{primary:!0})]})}function NO({schema:e,ids:t,bulkOnly:n=!1,size:r=`default`}){let i=X(),a=(e.prints??[]).filter(e=>!n||e.bulk);return t.length===0||a.length===0?null:(0,b.jsx)(b.Fragment,{children:a.map(n=>{let a=UT(n.icon)??qx;return(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:r,"aria-label":i(`print.open`,{name:n.label}),onClick:()=>window.open(yv(e.name,n.name,t),`_blank`,`noopener`),children:[(0,b.jsx)(a,{}),n.label]},n.name)})})}function PO({schema:e,query:t,iconOnly:n=!1}){let r=X(),[i,a]=(0,y.useState)(!1);if(!e.list.export)return null;async function o(){a(!0);try{let{blob:n,filename:i,truncated:a}=await Q.exportList(e.name,t),o=URL.createObjectURL(n),s=document.createElement(`a`);s.href=o,s.download=i,s.click(),setTimeout(()=>URL.revokeObjectURL(o),1e4),ZT(a?r(`list.exportTruncated`,{count:a}):r(`list.exportDone`,{file:i}),a?`error`:`success`)}catch(e){ZT(W_(e),`error`)}finally{a(!1)}}return(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:n?`icon`:`default`,disabled:i,"aria-label":n?r(`list.export`):void 0,onClick:()=>void o(),children:[(0,b.jsx)(jb,{}),!n&&r(i?`list.exporting`:`list.export`)]})}function FO(e,t,n){return e<=0?-1:t<0?n?e-1:0:(t+(n?-1:1)+e)%e}var IO=`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`,LO=[],RO=null;function zO(){let e=document.getElementById(`root`),t=document.documentElement,n={overflow:document.body.style.overflow,gutter:t.style.scrollbarGutter,inert:e?.hasAttribute(`inert`)??!1};document.body.style.overflow=`hidden`,t.style.scrollbarGutter=`stable`,e?.setAttribute(`inert`,``),RO=()=>{document.body.style.overflow=n.overflow,t.style.scrollbarGutter=n.gutter,n.inert||e?.removeAttribute(`inert`)}}function BO({labelledBy:e,describedBy:t,onDismiss:n,initialFocus:r,className:i,children:a}){let o=(0,y.useRef)(null),s=(0,y.useRef)(n);return s.current=n,(0,y.useEffect)(()=>{let e=Symbol(`alert`),t=document.activeElement instanceof HTMLElement?document.activeElement:null;LO.length===0&&zO(),LO.push(e),((r?o.current?.querySelector(r):null)??o.current?.querySelector(IO)??o.current)?.focus();let n=t=>{if(LO[LO.length-1]===e&&o.current){if(t.key===`Escape`&&s.current)t.preventDefault(),t.stopPropagation(),s.current();else if(t.key===`Tab`){t.preventDefault();let e=[...o.current.querySelectorAll(IO)];(e[FO(e.length,e.indexOf(document.activeElement),t.shiftKey)]??o.current).focus()}}};return document.addEventListener(`keydown`,n,!0),()=>{document.removeEventListener(`keydown`,n,!0),LO.splice(LO.indexOf(e),1),LO.length===0&&(RO?.(),RO=null),t?.isConnected&&LO.length===0&&t.focus()}},[r]),(0,Dc.createPortal)((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{"data-testid":`alert-backdrop`,"aria-hidden":!0,className:dT,onClick:()=>s.current?.()}),(0,b.jsx)(`div`,{ref:o,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":e,"aria-describedby":t,"data-state":`open`,tabIndex:-1,className:U(`fixed inset-x-3 top-[12vh] z-50 mx-auto max-h-[76vh] max-w-lg overflow-y-auto rounded-card border border-amber-500/50 bg-background p-4 shadow-xl outline-none motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-2 motion-safe:duration-150`,i),children:a})]}),document.body)}function VO(e){let t=(0,y.useRef)(!1),n=ga(({currentLocation:n,nextLocation:r})=>e&&!t.current&&(n.pathname!==r.pathname||n.search!==r.search));return(0,y.useEffect)(()=>{if(!e)return;let t=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,t),()=>window.removeEventListener(`beforeunload`,t)},[e]),{blocker:n,release:()=>{t.current=!0}}}function HO({blocker:e}){let t=X();return e.state===`blocked`?(0,b.jsxs)(BO,{labelledBy:`leave-title`,onDismiss:()=>e.reset(),className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`p`,{id:`leave-title`,className:`min-w-0 flex-1 basis-full text-sm font-medium sm:basis-0`,children:t(`form.leaveTitle`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>e.reset(),children:t(`form.stay`)}),(0,b.jsx)(q,{type:`button`,variant:`destructive`,onClick:()=>e.proceed(),children:t(`form.leave`)})]}):null}function UO(e,t){let n=(0,y.useRef)(t);n.current=t,(0,y.useEffect)(()=>{let t=t=>{if(!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()!==`s`)return;t.preventDefault();let r=document.querySelector(`[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]`);(!r||r.contains(e.current))&&(n.current?.(),e.current?.requestSubmit())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function WO(e){let[t,n]=(0,y.useState)([]),[r,i]=(0,y.useState)(!1),a=(0,y.useRef)(e);return a.current=e,(0,y.useEffect)(()=>{t.length>0||!r||(i(!1),a.current())},[t.length,r]),{busy:t.length>0,setBusy:(e,t)=>n(n=>t===n.includes(e)?n:t?[...n,e]:n.filter(t=>t!==e)),refuse:()=>i(!0)}}function GO({dirty:e,children:t}){let n=X();return(0,b.jsxs)(`div`,{className:`sticky bottom-3 z-10 flex flex-wrap items-center gap-2 rounded-card border bg-card px-4 py-2.5 shadow-[0_12px_32px_rgba(0,0,0,.12)]`,children:[e&&(0,b.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-[13px] font-semibold`,children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full bg-amber-500`}),n(`form.unsaved`)]}),(0,b.jsx)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:t})]})}function KO(){let e=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform);return(0,b.jsx)(`kbd`,{"aria-hidden":!0,className:`rounded border border-current/30 px-1 font-sans text-[10.5px] opacity-80`,children:e?`⌘S`:`Ctrl S`})}var qO=`—`,JO=e=>e==null||e===``;function YO(e,t){let n=t?.value;switch(e.kind){case`image`:return typeof n==`string`&&n!==``?{kind:`image`,src:n}:{kind:`image`};case`toggle`:return{kind:`toggle`,on:n===!0};case`money`:{if(JO(n))return{kind:`money`,text:qO};let e=uC(String(n),JO(t?.previous)?{}:{previous:String(t.previous)});return{kind:`money`,text:e.main,...e.unit?{unit:e.unit,unitPosition:e.position}:{},...e.previous===void 0?{}:{previous:e.previous}}}case`badge`:return{kind:`badge`,text:t?.label??(JO(n)?qO:String(n)),...t?.tone?{tone:t.tone}:{}};case`count`:return{kind:`count`,text:typeof n==`number`?E_(n):JO(n)?qO:D_(String(n))};case`title`:return{kind:`title`,text:JO(n)?qO:String(n),...JO(t?.subline)?{}:{subline:String(t.subline)}}}}function XO({schema:e,name:t,column:n,item:r,compact:i=!1}){let a=r._computed?.[t],o=YO(n,a);switch(o.kind){case`image`:return(0,b.jsx)(`span`,{className:U(`flex shrink-0 items-center justify-center overflow-hidden rounded-control border bg-muted text-muted-foreground`,i?`size-14`:`size-10`),children:o.src?(0,b.jsx)(`img`,{src:o.src,alt:``,className:`size-full object-cover`,loading:`lazy`}):(0,b.jsx)(Zb,{className:`size-[18px]`,"aria-hidden":!0})});case`title`:return(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-col leading-[1.45]`,children:[(0,b.jsx)(`span`,{className:U(`truncate font-semibold`,i?`text-[14.5px]`:`text-[13.5px]`),children:o.text}),o.subline&&(0,b.jsx)(`span`,{className:`truncate text-start font-mono text-[11.5px] text-muted-foreground`,children:(0,b.jsx)(`bdi`,{dir:`ltr`,children:o.subline})})]});case`money`:return(0,b.jsxs)(`span`,{className:`flex flex-col leading-[1.4]`,children:[(0,b.jsxs)(`span`,{className:`font-semibold whitespace-nowrap`,children:[o.unit&&o.unitPosition===`before`&&(0,b.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[o.unit,` `]}),o.text,o.unit&&o.unitPosition!==`before`&&(0,b.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[` `,o.unit]})]}),o.previous&&(0,b.jsx)(`s`,{className:`text-xs text-muted-foreground`,children:o.previous})]});case`badge`:return(0,b.jsx)(dD,{tone:o.tone,children:o.text});case`count`:return(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:o.text});case`toggle`:return(0,b.jsx)(ZO,{schema:e,column:n,item:r,on:o.on===!0})}}function ZO({schema:e,column:t,item:n,on:r}){let i=X(),a=S(),[o,s]=(0,y.useState)(r),c=t.toggle,l=c!==void 0&&n._perm?.update!==!1&&!(Array.isArray(n._readonly)&&n._readonly.includes(c.field)),u=pt({mutationFn:t=>Q.update(e.name,String(n._id),{[c.field]:t?c.on:c.off},e.version?n[e.version]:void 0),onSuccess:()=>a.invalidateQueries({queryKey:[`list`,e.name]}),onError:e=>{s(r),ZT(W_(e),`error`)}}),d=typeof n._title==`string`?n._title:String(n._id);return(0,b.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":o,"aria-label":i(`list.toggleRow`,{column:t.label,name:d}),disabled:!l||u.isPending,onClick:e=>{e.preventDefault(),e.stopPropagation(),s(!o),u.mutate(!o)},className:U(`relative inline-block h-5 w-9 shrink-0 cursor-pointer rounded-full bg-input transition-colors disabled:cursor-default disabled:opacity-60`,o&&`bg-primary`,`after:absolute after:top-0.5 after:size-4 after:rounded-full after:bg-white after:shadow-sm after:transition-[inset-inline-start] after:content-[''] after:start-0.5`,o&&`after:start-[18px]`)})}function QO(e){let t=e.form.layout;return t?t.flatMap(e=>`tab`in e?e.sections:[e]).flatMap(e=>`fields`in e&&!(`inline`in e)?e.fields:[]):[...new Set([...e.form.update,...e.form.readonly])]}function $O(e){let t=(e.form.layout??[]).flatMap(e=>`tab`in e?e.sections:[e]).flatMap(e=>`summary`in e?e.summary.flatMap(e=>`field`in e.value?[e.value.field]:[]):[]),n=(e.form.aside??[]).flatMap(e=>e.relation?[e.relation.field]:e.fields),r=[...e.form.header?.badges??[],...(e.form.header?.subtitle??[]).flatMap(e=>`field`in e?[e.field]:[])],i=new Set(e.form.update);return new Set([...t,...n,...r].filter(e=>!i.has(e)))}function ek(e,t,n){let r=e.form.mode===`view`&&t!==void 0&&!n,i=new Set(QO(e)),a=r?[]:e.form.update.filter(t=>i.has(t)||!e.form.layout),o=e.form.header,s=t=>e.fields.find(e=>e.name===t),c=e=>e!==void 0&&t?.[e.name]!==void 0&&t?.[e.name]!==null,l=(o?.badges?o.badges.map(s):e.fields.filter(e=>e.widget===`badge`)).filter(c),u=o?.stepper?s(o.stepper):void 0;u&&c(u)&&u.steps?.exclude.includes(String(t[u.name]))&&!l.includes(u)&&l.push(u);let d=t?._computed??{};return{editable:a,header:{badges:l,subtitle:(o?.subtitle??[]).flatMap(n=>{if(`field`in n){let e=s(n.field);return e&&c(e)?[fC(t[e.name],e)]:[]}let r=e.list.computed?.[n.computed];if(!r||!d[n.computed])return[];let i=YO(r,d[n.computed]);return i.text?[r.kind===`count`?`${i.text} ${r.label}`:i.text]:[]}),...u?{stepper:u}:{}},aside:e.form.aside??[]}}function tk(e,t,n){return e.relation?n?._aside?.[String(t)]:n}function nk(e,t,n){let r=n?._computed??{};return e.summary.flatMap(e=>{if(`field`in e.value){let r=t.fields.find(t=>t.name===e.value.field),i=n?.[e.value.field];return r&&i!=null?[{label:e.label,text:fC(i,r)}]:[]}let i=t.list.computed?.[e.value.computed],a=r[e.value.computed];if(!i||!a)return[];let o=YO(i,a),s=o.unit?o.unitPosition===`before`?`${o.unit} ${o.text}`:`${o.text} ${o.unit}`:o.text;return s?[{label:e.label,text:s}]:[]})}function rk(e,t){let n={};for(let r of e){if(!r.warnIf||!(r.name in t))continue;let e=t[r.name];(e==null||typeof e==`string`&&e.trim()===``)&&(n[r.name]=r.warnIf.message)}return n}function ik(e,t){return e.fields.filter(t=>t!==e.order).flatMap(e=>t.fields.filter(t=>t.name===e))}function ak(e,t,n){let r=n?._inlines?.[e.inline],i=ik(e,t);return(r?.rows??[]).map(e=>({key:String(e._id),id:String(e._id),record:e,values:oD(i,e)}))}function ok(e,t,n){return{key:n,values:oD(ik(e,t))}}function sk(e,t){if(!e.record)return new Set;let n=e.record._perm;if(t.permissions?.update===!1||n?.update===!1)return new Set(t.fields.map(e=>e.name));let r=Array.isArray(e.record._readonly)?e.record._readonly:[];return new Set([...t.form.readonly,...r])}function ck(e,t,n,r){let i=ik(e,t),a={},o=[],s=[],c=new Map(n.map(e=>[e.key,e]));for(let e of r){let n=c.get(e.key);if(n?.id!==void 0){let r=sk(e,t),{payload:o,errors:c}=cD(i.filter(e=>!r.has(e.name)),e.values,n.values),l={...OO(o,t.form.constraints.update,`update`),...c};if(Object.keys(l).length>0&&(a[e.key]=l),Object.keys(o).length===0)continue;let u=t.version?n.record?.[t.version]:void 0;s.push({_id:n.id,...o,...typeof u==`number`?{_version:u}:{}})}else{let{payload:n,errors:r}=cD(i,e.values),s={...OO(n,t.form.constraints.create,`create`),...r};Object.keys(s).length>0&&(a[e.key]=s),o.push({_key:e.key,...n})}}let l=new Set(r.map(e=>e.key)),u=n.filter(e=>e.id!==void 0&&!l.has(e.key)).map(e=>e.id),d=e.order!==void 0&&t.form.update.includes(e.order),f=r.map(e=>e.key),p=d&&f.join(`
|
|
56
56
|
`)!==n.map(e=>e.key).join(`
|
|
57
|
-
`)?f:void 0,m={...o.length?{create:o}:{},...s.length?{update:s}:{},...u.length?{delete:u}:{},...p?{order:p}:{}};return{changes:Object.keys(m).length?m:void 0,errors:a}}function rk(e,t,n,r,i){let a={},o={};for(let s of e){let e=t[s.inline];if(!e||s.readonly)continue;let c=r[s.inline]??[],l=nk(s,e,n[s.inline]??[],c),u=l.changes?i(s,c.length):null;(Object.keys(l.errors).length>0||u)&&(o[s.inline]={rows:l.errors,inline:u?[u]:[]}),l.changes&&(a[s.inline]=l.changes)}return{changes:Object.keys(a).length?a:void 0,errors:o}}function ik(e,t){let n={},r={};for(let[i,a]of Object.entries(e)){if(i!==`_inlines`&&!i.startsWith(`_inlines.`)){r[i]=a;continue}let[,e=``,o,s,...c]=i.split(`.`),l=n[e]??={rows:{},inline:[]},u=o===`create`?t?.[e]?.create?.[Number(s)]?._key:o===`update`||o===`delete`?s:void 0,d=c.join(`.`);u===void 0||o===`create`&&!/^\d+$/.test(s??``)||d===``?l.inline.push(...a):((l.rows[u]??={})[d]??=[]).push(...a)}return{inlines:n,parent:r}}var ak=e=>Object.values(e).some(e=>e.inline.length>0||Object.keys(e.rows).length>0);function ok({inline:e,child:t,rows:n,onChange:r,readOnly:i,errors:a,parent:o,parentValues:s,onBusy:c,truncated:l,canAdd:u=!0}){let d=X(),f=(0,y.useId)(),p=QO(e,t),m=(0,y.useRef)(0),[h,g]=(0,y.useState)(null),_=!i&&u&&t.permissions?.create!==!1&&t.form.create.length>0&&n.length<e.max,v=!i&&e.order!==void 0&&t.form.update.includes(e.order)&&n.length>1,x=e=>!i&&(e.id===void 0||t.permissions?.delete!==!1&&e.record?._perm?.delete!==!1),S=e=>s===void 0?void 0:JSON.stringify({...JSON.parse(rD(p,e.values)??`{}`),_parent:JSON.parse(s)});function C(){let i;do i=`n${++m.current}`;while(n.some(e=>e.key===i));r([...n,ek(e,t,i)])}let w=(e,t,i)=>r(n.map(n=>n.key===e?{...n,values:{...n.values,[t]:i}}:n)),T=e=>r(n.filter(t=>t.key!==e));function E(e,t){if(t<0||t>=n.length||e===t)return;let i=[...n];i.splice(t,0,i.splice(e,1)[0]),r(i)}function D(n,r,s){let l=`inline-${t.name}-${n.key}`,u=a?.rows[n.key]??{},d=n.id===void 0;if(i||!(d?t.form.create:t.form.update).includes(r.name)||tk(n,t).has(r.name))return d?null:e.readonly&&s?(0,b.jsx)(lD,{value:n.record?.[r.name],field:r,record:n.record}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-readonly":r.name,children:[!s&&(0,b.jsx)(`span`,{className:`text-sm font-medium`,children:r.label}),(0,b.jsx)(`div`,{className:`min-h-8 rounded-lg bg-muted/50 px-2.5 py-1.5 text-sm break-words`,children:(0,b.jsx)(lD,{value:n.record?.[r.name],field:r,record:n.record})})]});let f=d?`create`:`update`;if(r.type===`object`)return(0,b.jsx)(ZD,{resource:t.name,field:r,path:r.name,pattern:r.name,value:n.values[r.name],constraints:t.form.constraints[f],markRequired:d,errors:u,idPrefix:l,onChange:e=>w(n.key,r.name,e)});let p=ZO([r],n.values)[r.name],m=(0,b.jsx)(zD,{resource:t.name,field:r,value:n.values[r.name],required:d&&t.form.requiredOnCreate.includes(r.name),errors:u[r.name],constraints:t.form.constraints[f][r.name],formValues:r.type===`relation`?S(n):void 0,parent:o,idPrefix:l,hideLabel:s,onChange:e=>w(n.key,r.name,e),onBusy:e=>c(`${t.name}:${n.key}:${r.name}`,e)});return p?(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[m,(0,b.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-warn`,children:[(0,b.jsx)(MS,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),p]})]}):m}function O(t,r){let i=d(`inline.row`,{name:e.label,index:r+1});return(0,b.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`cursor-grab text-muted-foreground`,draggable:!0,"aria-hidden":!0,onDragStart:e=>{e.dataTransfer.effectAllowed=`move`,g(r)},onDragEnd:()=>g(null),children:(0,b.jsx)(Rb,{className:`size-4`})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:r===0,"aria-label":d(`inline.moveUp`,{name:i}),onClick:()=>E(r,r-1),children:(0,b.jsx)(wy,{})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:r===n.length-1,"aria-label":d(`inline.moveDown`,{name:i}),onClick:()=>E(r,r+1),children:(0,b.jsx)(by,{})})]}),x(t)&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":d(`inline.remove`,{name:i}),onClick:()=>T(t.key),children:(0,b.jsx)(AS,{})})]})}let k=e=>v?{onDragOver:e=>{h!==null&&e.preventDefault()},onDrop:t=>{t.preventDefault(),h!==null&&E(h,e),g(null)}}:{},A=e=>{let t=Object.entries(a?.rows[e.key]??{}).filter(([e])=>!p.some(t=>t.name===e.split(`.`)[0]));return t.length>0?(0,b.jsx)(`p`,{className:`text-sm text-destructive`,children:t.map(([e,t])=>`${e}: ${t.join(`, `)}`).join(` — `)}):null},j=v||n.some(x);return(0,b.jsxs)(`section`,{"aria-labelledby":f,className:`flex min-w-0 flex-col rounded-card border bg-card shadow-card`,"data-inline":t.name,children:[(0,b.jsxs)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 border-b px-5 py-3`,children:[(0,b.jsx)(`h2`,{id:f,className:`text-[15px] font-semibold`,children:e.label}),(0,b.jsx)(`span`,{className:`inline-flex h-5 items-center rounded-full bg-muted px-2 text-[11px] text-muted-foreground`,children:ck(d,e,n.length)}),_&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,className:`ms-auto`,onClick:C,children:[(0,b.jsx)(Hx,{}),d(`form.add`,{name:e.label})]})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 p-5 empty:hidden`,children:[l&&(0,b.jsxs)(`p`,{role:`note`,className:`text-sm text-muted-foreground`,children:[d(`inline.truncated`,{count:l.total-n.length}),` `,(0,b.jsx)(xo,{to:l.href,className:`text-primary hover:underline`,children:d(`inline.openList`)})]}),n.length===0&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d(`inline.empty`)}),n.length>0&&e.display===`table`&&(0,b.jsx)(`div`,{className:`relative -mx-5 overflow-x-auto border-y first:-mt-5 first:border-t-0 last:-mb-5 last:border-b-0`,children:(0,b.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,b.jsx)(`thead`,{className:`bg-[color-mix(in_oklab,var(--muted)_50%,transparent)] text-[12.5px] text-muted-foreground`,children:(0,b.jsxs)(`tr`,{children:[(e.computed??[]).map(e=>(0,b.jsx)(`th`,{scope:`col`,className:`px-3.5 py-2.5 text-start font-medium whitespace-nowrap`,children:t.list.computed?.[e]?.label},`~${e}`)),p.map(e=>(0,b.jsxs)(`th`,{scope:`col`,className:`px-3.5 py-2.5 text-start font-medium whitespace-nowrap`,children:[e.label,t.form.requiredOnCreate.includes(e.name)&&n.some(e=>e.id===void 0)&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`text-destructive`,children:`*`})]},e.name)),j&&(0,b.jsx)(`th`,{scope:`col`,className:`px-3.5 py-2.5`,children:(0,b.jsx)(`span`,{className:`sr-only`,children:d(`inline.rowActions`)})})]})}),(0,b.jsx)(`tbody`,{children:n.map((n,r)=>(0,b.jsxs)(`tr`,{"data-row":n.key,className:U(`border-t align-top`,h===r&&`opacity-50`),...k(r),children:[(e.computed??[]).map(e=>(0,b.jsx)(`td`,{className:`px-3.5 py-2`,children:n.record&&t.list.computed?.[e]&&(0,b.jsx)(WO,{schema:t,name:e,column:t.list.computed[e],item:n.record})},`~${e}`)),p.map(e=>(0,b.jsx)(`td`,{className:`min-w-32 px-3.5 py-2`,children:D(n,e,!0)},e.name)),j&&(0,b.jsx)(`td`,{className:`px-3.5 py-2`,children:O(n,r)})]},n.key))})]})}),e.display===`table`&&n.map(e=>(0,b.jsx)(y.Fragment,{children:A(e)},e.key)),e.display===`cards`&&n.map((n,r)=>(0,b.jsxs)(`div`,{"data-row":n.key,className:U(`flex flex-col gap-4 rounded-card border bg-background/40 p-4`,h===r&&`opacity-50`),...k(r),children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium`,children:[sk(n)??d(`inline.newRow`,{name:e.label,index:r+1}),r===0&&e.markFirst&&(0,b.jsx)(aD,{tone:`primary`,children:e.markFirst})]}),O(n,r)]}),(0,b.jsx)(WD,{plain:!0,layout:t.form.layout,names:p.map(e=>e.name),errors:a?.rows[n.key]??{},render:e=>{let t=p.find(t=>t.name===e);return t?D(n,t,!1):null}}),A(n)]},n.key)),a&&a.inline.length>0&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a.inline.join(` — `)})]})]})}var sk=e=>typeof e.record?._title==`string`?e.record._title:void 0;function ck(e,t,n){return t.min?e(`inline.limitsBetween`,{min:t.min,max:t.max,count:n}):e(`inline.limitsMax`,{max:t.max,count:n})}var lk=(e,t)=>t===void 0?[`history`,e]:[`history`,e,t];function uk({schema:e,id:t,record:n}){let r=X(),i=vv(),a=mt({queryKey:lk(e.name,t),initialPageParam:void 0,queryFn:({pageParam:n})=>Q.history(e.name,t,n),getNextPageParam:e=>e.next,staleTime:0});if(a.isPending)return(0,b.jsx)(W,{children:r(`common.loading`)});if(a.isError&&!a.data)return(0,b.jsx)(W,{tone:`error`,children:z_(a.error)});let o=a.data.pages.flatMap(e=>e.entries);if(o.length===0)return(0,b.jsx)(W,{children:r(`audit.empty`)});let s=t=>t===e.name?e:void 0;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,b.jsx)(NC,{entries:o,now:new Date(a.dataUpdatedAt),names:uC(i.data,s),schemaOf:s,titleOf:(e,t)=>dk(n,e,t)}),a.isError&&(0,b.jsx)(W,{tone:`error`,children:z_(a.error)}),a.hasNextPage&&(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`self-center`,disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:r(a.isFetchingNextPage?`common.loading`:`list.loadMore`)})]})}function dk(e,t,n){let r=e?.[t],i=(Array.isArray(r)?r:[r]).find(e=>typeof e==`object`&&!!e&&String(e.id)===n);return typeof i?.title==`string`?i.title:void 0}function fk(e){return e.normalize(`NFKD`).replace(/\p{M}/gu,``).normalize(`NFC`).toLowerCase().replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-+|-+$/g,``)}function pk(e,t,n){let r=typeof t?._title==`string`?t._title:`#${n}`;return r.startsWith(`#`)?`${e} ${r}`:`${e}: ${r}`}function mk({mode:e}){let t=X(),{resource:n=``,id:r}=$i(),i=qi(),[a]=To(),o=e===`create`?a.get(`from`)??void 0:void 0,s=e===`edit`?r:o,c=yv(n),l=Cv(n,s),[u,d]=(0,y.useState)(0),f=`${n}:${r}`,[p,m]=(0,y.useState)({of:f,tab:`details`}),h=p.of===f?p.tab:`details`;if(c.isPending||s!==void 0&&l.isPending)return(0,b.jsx)(W,{children:t(`common.loading`)});if(c.isError)return(0,b.jsx)(W,{tone:`error`,children:c.error.message});if(s!==void 0&&l.isError)return(0,b.jsx)(W,{tone:`error`,children:l.error.message});let g=i.state?.saved;return(0,b.jsx)(gk,{schema:c.data,mode:e,id:r,record:e===`edit`?l.data:void 0,source:o?l.data:void 0,saved:u===0?g:void 0,onChanged:()=>d(e=>e+1),tab:h,onTab:e=>m({of:f,tab:e})},e===`edit`?`${n}:${r}:${u}`:`${n}:new:${i.key}`)}function hk(e,t){let n=new Set(e.fields.filter(e=>e.primary||e.unique||e.readonly||e.file).map(e=>e.name)),r=new Set(e.fields.filter(e=>e.widget===`richtext`).map(e=>e.name));return Object.fromEntries(Object.entries(t).filter(([e])=>!n.has(e)&&!e.startsWith(`_`)).map(([e,t])=>[e,r.has(e)&&typeof t==`string`?ZE(t):t]))}function gk({schema:e,mode:t,id:n,record:r,source:i,saved:a,onChanged:o,tab:s,onTab:c}){let l=X(),{locale:u}=Y(),d=Yi(),f=S(),p=r?._perm,m=t===`create`||e.permissions?.update!==!1&&p?.update!==!1,h=e.permissions?.delete!==!1&&p?.delete!==!1,[g,_]=(0,y.useState)(!1),v=JO(e,t===`edit`?r:void 0,g),x=t===`edit`&&e.form.mode===`view`&&!g,C=new Set(t===`edit`?m&&!x?[...e.form.readonly,...bk(r)]:[...e.form.update,...e.form.readonly]:[]),w=t===`create`?e.form.create:[...e.form.update,...e.form.readonly],T=e.fields.filter(e=>w.includes(e.name)),E=qO(e),D=T.filter(e=>!C.has(e.name)),O=D.map(e=>e.name),[k,A]=(0,y.useState)(r),[j,M]=(0,y.useState)(()=>{let t=eD(D,r??(i?hk(e,i):void 0));return fO(D,t,dO(D,t))}),[N,ee]=(0,y.useState)(j),P=(0,y.useRef)(dO(D,j));(0,y.useEffect)(()=>{if(!g||!r)return;let e=eD(D,r);P.current=dO(D,e),M(e),ee(e)},[g]);let F=_k(e),te=t=>Object.fromEntries(F.map(n=>[n.inline,$O(n,e.inlines[n.inline],t)])),[ne,re]=(0,y.useState)(()=>te(r)),[ie,ae]=(0,y.useState)(ne),[oe,se]=(0,y.useState)({}),ce=(0,y.useRef)(void 0),le=e.version?k?.[e.version]:void 0,[ue,de]=(0,y.useState)(null),fe=rD(D,N),[pe,me]=(0,y.useState)({}),[I,L]=(0,y.useState)(null),he=_v(),ge=t===`edit`&&n!==void 0&&he.data?.audit.enabled===!0&&!e.source,_e=ge?s:`details`,ve=(0,y.useRef)(new Set(D.filter(e=>e.widget===`slug`&&j[e.name]!==``).map(e=>e.name)));function ye(e,t){pO(D,P.current,e,t),ee(n=>{let r={...n,[e]:t};if(typeof t==`string`)for(let n of D)n.slugFrom===e&&!ve.current.has(n.name)&&(r[n.name]=fk(t));return fO(D,r,P.current)}),D.some(t=>t.name===e&&t.widget===`slug`)&&ve.current.add(e)}let[be,xe]=(0,y.useState)(a?l(`form.savedName`,{name:a}):null),Se=RO(()=>L(null)),Ce=JSON.stringify(N)!==JSON.stringify(j)||JSON.stringify(ie)!==JSON.stringify(ne),{blocker:we,release:Te}=FO(Ce),Ee=(0,y.useRef)(null),De=(0,y.useRef)(`list`);LO(Ee,()=>{De.current=`stay`});let Oe=pt({mutationFn:({payload:r,version:i})=>t===`create`?Q.create(e.name,r):Q.update(e.name,n,r,i),onSuccess:async(r,{then:i})=>{f.invalidateQueries({queryKey:lk(e.name)}),await f.invalidateQueries({queryKey:[`list`,e.name]});let a=typeof r._title==`string`?r._title:`#${String(r._id)}`;if(i===`stay`&&t===`edit`){let t=eD(D,r);P.current=dO(D,t);let i=te(r);A(r),M(t),ee(t),re(i),ae(i),se({}),xe(l(`form.savedName`,{name:a})),await f.invalidateQueries({queryKey:[`record`,e.name,n]});return}Te(),f.removeQueries({queryKey:[`record`,e.name]}),i===`new`?d(`/${e.name}/new`,{state:{saved:a}}):i===`stay`?d(`/${e.name}/${encodeURIComponent(String(r._id))}`,{replace:!0,state:{saved:a}}):d(`/${e.name}`)},onError:e=>{if(c(`details`),!(e instanceof R_)){L(e.message);return}if(e.status===409&&e.body.current){de(e.body.current);return}let t=cO(e,[...O,`_inlines`]),n=ik(t.fields,ce.current);me(n.parent),se(n.inlines),L(t.form)}}),[ke,Ae]=(0,y.useState)(!1),je=pt({mutationFn:()=>Q.remove(e.name,n,le),onSuccess:async()=>{Te(),await f.invalidateQueries({queryKey:[`list`,e.name]}),d(`/${e.name}`),f.removeQueries({queryKey:[`record`,e.name,n]})},onError:e=>{Ae(!1),L(z_(e))}}),Me=D.filter(e=>hO(e,N));function Ne(){let n=nD(Me,N,t===`edit`?j:void 0),r=rk(F,e.inlines??{},ne,ie,(e,t)=>e.min!==void 0&&t<e.min?l(`inline.countMin`,{min:e.min,count:t}):t>e.max?l(`inline.countMax`,{max:e.max,count:t}):null);return ce.current=r.changes,{payload:r.changes?{...n.payload,_inlines:r.changes}:n.payload,errors:n.errors,inlineErrors:r.errors}}function Pe(n){if(n.preventDefault(),!m)return;let r=n.nativeEvent.submitter,i=r?.value===`new`?`new`:r?`list`:De.current;if(De.current=`list`,xe(null),Se.busy){L(l(`upload.busy`)),Se.refuse();return}let{payload:a,errors:o,inlineErrors:s}=Ne(),u=t===`create`?`create`:`update`,d={...SO(a,Object.fromEntries(Object.entries(e.form.constraints[u]).filter(([e])=>Me.some(t=>t.name===e.split(`.`)[0]))),u),...o};me(d),se(s),L(null),Object.keys(d).length===0&&!ak(s)?Oe.mutate({payload:a,version:le,then:i}):c(`details`)}function Fe(t){de(null),Oe.mutate({payload:Ne().payload,version:e.version?t[e.version]:void 0,then:Oe.variables?.then??`list`})}function Ie(e){let t=eD(D,e);P.current=dO(D,t),de(null),A(e),M(t),ee(t),me({})}function Le(t){let i=e.inlines?.[t.inline];if(!i)return null;let a=r?._inlines?.[t.inline],o=a?.truncated&&n!==void 0?{total:a.total,href:`/${i.name}?${new URLSearchParams({[`filter[${t.link}]`]:String(r?.[e.primaryKeys[0]]??n)})}`}:void 0;return(0,b.jsx)(ok,{inline:t,child:i,rows:ie[t.inline]??[],onChange:e=>ae(n=>({...n,[t.inline]:e})),readOnly:!m||x||t.readonly===!0||o!==void 0,errors:oe[t.inline],parent:e.name,parentValues:fe,onBusy:Se.setBusy,truncated:o,canAdd:(r?._perm)?.inlines?.[t.inline]?.create!==!1})}function Re(t){let n=XO(t,e,r);return n.length===0?null:(0,b.jsx)(uD,{title:t.title,bodyClassName:t.title?void 0:`p-5`,children:(0,b.jsx)(`dl`,{className:`flex flex-col gap-2 text-[13px]`,children:n.map((e,t)=>(0,b.jsxs)(`div`,{className:U(`flex items-baseline justify-between gap-3`,t===n.length-1&&n.length>1&&`border-t pt-2.5 text-sm font-bold`),children:[(0,b.jsx)(`dt`,{className:U(t===n.length-1&&n.length>1?``:`text-muted-foreground`),children:e.label}),(0,b.jsx)(`dd`,{children:e.text})]},e.label))})})}let ze=ZO(D,N);function Be(e){let t=Ve(e);return t&&ze[e]?(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[t,(0,b.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-warn`,children:[(0,b.jsx)(MS,{className:`size-3.5`,"aria-hidden":!0}),ze[e]]})]}):t}function Ve(n){let i=T.find(e=>e.name===n);if(!i||!hO(i,N))return null;if(C.has(n))return(0,b.jsx)(xk,{resource:e.name,field:i,record:r,plain:x});let a=t===`create`?`create`:`update`;return i.type===`object`?(0,b.jsx)(ZD,{resource:e.name,field:i,path:i.name,pattern:i.name,value:N[i.name],constraints:e.form.constraints[a],markRequired:t===`create`,errors:pe,onChange:e=>ye(i.name,e)}):(0,b.jsx)(zD,{resource:e.name,field:i,value:N[i.name],required:t===`create`&&e.form.requiredOnCreate.includes(i.name),errors:pe[i.name],formValues:i.type===`relation`?fe:void 0,constraints:e.form.constraints[a][i.name],onChange:e=>ye(i.name,e),onBusy:e=>Se.setBusy(i.name,e)})}return(0,b.jsxs)(`form`,{ref:Ee,onSubmit:Pe,noValidate:!0,className:U(`flex flex-col gap-5`,v.aside.length>0?`max-w-[1400px]`:e.form.layout?.length?`max-w-4xl`:`max-w-2xl`),children:[t===`create`?(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(Sk,{to:`/${e.name}`}),(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:l(`form.new`,{name:e.label})})]}):(0,b.jsx)(Ck,{schema:e,record:r,id:n,dirty:Ce,onGone:()=>{Te(),d(`/${e.name}`)},onChanged:o,badges:v.header.badges,subtitle:v.header.subtitle,extra:(0,b.jsxs)(b.Fragment,{children:[x&&m&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,onClick:()=>_(!0),children:[(0,b.jsx)(Px,{}),l(`form.edit`)]}),e.creatable&&(0,b.jsx)(q,{asChild:!0,variant:`outline`,children:(0,b.jsxs)(xo,{to:`/${e.name}/new?${new URLSearchParams({from:n})}`,children:[(0,b.jsx)(ub,{}),l(`form.duplicate`)]})}),h&&(ke?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q,{type:`button`,variant:`destructive`,disabled:je.isPending,onClick:()=>je.mutate(),children:l(je.isPending?`form.deleting`:e.softDelete?`form.confirmMoveToTrash`:`form.confirmDelete`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>Ae(!1),children:l(`form.keep`)})]}):(0,b.jsxs)(q,{type:`button`,variant:`outline`,className:`text-destructive`,onClick:()=>Ae(!0),children:[(0,b.jsx)(AS,{}),l(e.softDelete?`form.moveToTrash`:`form.delete`)]}))]})}),i&&F.length>0&&(0,b.jsx)(`p`,{role:`note`,className:`rounded-md border bg-muted/40 px-3 py-2 text-sm text-muted-foreground`,children:l(`inline.duplicateNote`,{names:new Intl.ListFormat(u).format(F.map(e=>e.label))})}),!m&&e.form.mode!==`view`&&(0,b.jsx)(`p`,{role:`note`,className:`rounded-md border bg-muted/40 px-3 py-2 text-sm text-muted-foreground`,children:l(`form.viewOnly`)}),be&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:be}),(0,b.jsx)(IO,{blocker:we}),ge&&(0,b.jsx)(yk,{active:_e,onChange:c}),ue&&(0,b.jsx)(wk,{fields:D,before:k,current:ue,busy:Oe.isPending,onKeepMine:()=>Fe(ue),onLoadTheirs:()=>Ie(ue)}),I&&(0,b.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:I}),ge&&_e===`history`&&(0,b.jsx)(`div`,{role:`tabpanel`,id:`record-panel-history`,"aria-labelledby":`record-tab-history`,children:(0,b.jsx)(uk,{schema:e,id:n,record:r})}),(0,b.jsxs)(`div`,{className:_e===`details`?`contents`:`hidden`,...ge?{role:`tabpanel`,id:`record-panel-details`,"aria-labelledby":`record-tab-details`}:{},children:[t===`edit`&&r&&v.header.stepper&&(0,b.jsx)(pD,{field:v.header.stepper,value:r[v.header.stepper.name],reached:r._steps}),(0,b.jsxs)(`div`,{className:U(v.aside.length>0?`grid items-start gap-5 lg:grid-cols-[minmax(0,1fr)_340px]`:`contents`),children:[(0,b.jsxs)(`div`,{className:U(v.aside.length>0?`flex min-w-0 flex-col gap-5`:`contents`),children:[(0,b.jsx)(WD,{layout:e.form.layout,names:T.map(e=>e.name).filter(e=>!E.has(e)),errors:{...pe,...Object.fromEntries(Object.entries(oe).filter(([,e])=>ak({found:e})).map(([e])=>[`_inlines.${e}`,[``]]))},render:Be,renderInline:Le,renderSummary:Re}),!x&&(0,b.jsxs)(zO,{dirty:Ce,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>d(`/${e.name}`),children:l(m?`common.cancel`:`form.back`)}),m&&e.creatable&&(0,b.jsx)(q,{type:`submit`,value:`new`,variant:`outline`,disabled:Oe.isPending||Se.busy,children:l(`form.saveAndNew`)}),m&&(0,b.jsxs)(q,{type:`submit`,value:`list`,disabled:Oe.isPending||Se.busy,"aria-keyshortcuts":`Control+S Meta+S`,children:[l(Oe.isPending?`form.saving`:`form.save`),(0,b.jsx)(BO,{})]})]}),t===`edit`&&r&&e.related.length>0&&(0,b.jsxs)(`nav`,{"aria-label":l(`form.related`),className:`flex flex-col gap-2 border-t pt-4`,children:[(0,b.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground`,children:l(`form.related`)}),(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-2`,children:e.related.map(t=>(0,b.jsx)(`li`,{children:(0,b.jsx)(q,{asChild:!0,variant:`outline`,size:`sm`,children:(0,b.jsx)(xo,{to:`/${t.resource}?${new URLSearchParams({[`filter[${t.field}][${t.operator}]`]:String(r[e.primaryKeys[0]])})}`,children:t.label})})},`${t.resource}:${t.field}`))})]})]}),v.aside.length>0&&(0,b.jsx)(`aside`,{className:`flex flex-col gap-5`,children:v.aside.map((t,n)=>(0,b.jsx)(dD,{card:t,values:YO(t,n,r),schema:e},n))})]})]})]})}function _k(e){return(e.form.layout??[]).flatMap(e=>`tab`in e?e.sections:[e]).filter(t=>`inline`in t&&e.inlines?.[t.inline]!==void 0)}var vk=[`details`,`history`];function yk({active:e,onChange:t}){let n=X(),r=(0,y.useRef)({});return(0,b.jsx)(`div`,{role:`tablist`,"aria-label":n(`audit.recordTabs`),className:`flex gap-0.5 overflow-x-auto border-b`,onKeyDown:n=>{if(n.key!==`ArrowLeft`&&n.key!==`ArrowRight`&&n.key!==`Home`&&n.key!==`End`)return;n.preventDefault();let i=n.key===`Home`?`details`:n.key===`End`||e===`details`?`history`:`details`;t(i),r.current[i]?.focus()},children:vk.map(i=>(0,b.jsx)(`button`,{ref:e=>{r.current[i]=e},id:`record-tab-${i}`,type:`button`,role:`tab`,"aria-selected":i===e,"aria-controls":i===`details`||e===`history`?`record-panel-${i}`:void 0,tabIndex:i===e?0:-1,onClick:()=>t(i),className:U(`-mb-px flex h-[38px] items-center border-b-2 px-3 text-[13px] whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,i===e?`border-foreground font-semibold`:`border-transparent text-muted-foreground hover:text-foreground`),children:n(i===`details`?`audit.details`:`audit.history`)},i))})}var bk=e=>Array.isArray(e?._readonly)?e._readonly:[];function xk({resource:e,field:t,record:n,plain:r=!1}){let i=X(),a=n?.[t.name];return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-readonly":t.name,children:[(0,b.jsxs)(`span`,{className:U(`flex items-center gap-1.5 font-medium`,r?`text-[12.5px] text-muted-foreground`:`text-sm`),children:[t.label,!r&&(0,b.jsx)(fx,{className:`size-3.5 text-muted-foreground`,"aria-label":i(`form.readOnly`),role:`img`})]}),(0,b.jsx)(`div`,{className:U(`text-sm break-words`,!r&&`min-h-8 rounded-lg bg-muted/50 px-2.5 py-1.5`),children:t.widget===`richtext`&&typeof a==`string`&&a!==``?(0,b.jsx)(RD,{id:`field-${t.name}`,resource:e,field:t,value:a,readOnly:!0}):(0,b.jsx)(lD,{value:a,field:t,record:n,detailed:!0})}),t.help&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.help})]})}function Sk({to:e}){let t=X();return(0,b.jsx)(q,{asChild:!0,variant:`outline`,size:`icon`,className:`shrink-0`,children:(0,b.jsx)(xo,{to:e,"aria-label":t(`form.back`),children:(0,b.jsx)(eb,{className:`ltr:rotate-180`})})})}function Ck({schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a,extra:o,badges:s,subtitle:c}){let l=X(),u=Array.isArray(t?._links)?t._links:[];return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,b.jsx)(Sk,{to:`/${e.name}`}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:pk(e.label,t,n)}),s.map(e=>(0,b.jsx)(cD,{value:t[e.name],field:e},e.name))]}),c.length>0&&(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:c.join(` · `)}),u.length>0&&(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-[13px]`,children:u.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-primary hover:underline`,"aria-label":l(`form.externalLink`,{name:e.label}),children:[e.label,(0,b.jsx)(wb,{className:`size-3.5 rtl:-scale-x-100`,"aria-hidden":!0})]})},`${e.label}:${e.href}`))})]}),(0,b.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[t&&n!==void 0&&(0,b.jsx)(DO,{schema:e,ids:[n]}),t&&n!==void 0&&(0,b.jsx)(EO,{schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a}),o]})]})}function wk({fields:e,before:t,current:n,busy:r,onKeepMine:i,onLoadTheirs:a}){let o=X(),s=e.filter(e=>JSON.stringify(t?.[e.name]??null)!==JSON.stringify(n[e.name]??null));return(0,b.jsxs)(PO,{labelledBy:`conflict-title`,describedBy:`conflict-body`,initialFocus:`[data-autofocus]`,className:`flex flex-col gap-3 text-sm`,children:[(0,b.jsx)(`p`,{id:`conflict-title`,className:`font-medium`,children:o(`form.conflictTitle`)}),(0,b.jsx)(`div`,{id:`conflict-body`,children:s.length>0?(0,b.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:s.map(e=>(0,b.jsxs)(y.Fragment,{children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsxs)(`dd`,{children:[(0,b.jsx)(`span`,{className:`line-through opacity-60`,children:sC(t?.[e.name],e)}),` → `,sC(n[e.name],e)]})]},e.name))}):(0,b.jsx)(`p`,{children:o(`form.conflictNone`)})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`button`,disabled:r,onClick:i,children:o(`form.keepMine`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,"data-autofocus":!0,onClick:a,children:o(`form.loadTheirs`)})]})]})}function Tk(){let{t:e}=Y(),{group:t}=$i(),n=vv();if(n.isPending)return(0,b.jsx)(W,{children:e(`common.loading`)});if(n.isError)return(0,b.jsx)(W,{tone:`error`,children:n.error.message});let r=oT(n.data).find(e=>e.key===t);return r?(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:r.label}),(0,b.jsx)(Dk,{group:r})]}):(0,b.jsx)(W,{children:e(`common.pageNotFound`)})}function Ek({groups:e}){return(0,b.jsx)(`div`,{className:`flex flex-col gap-8`,children:e.map(e=>(0,b.jsxs)(`section`,{"aria-labelledby":`group-${e.key}`,className:`flex flex-col gap-3`,children:[(0,b.jsx)(`h2`,{id:`group-${e.key}`,className:`text-lg font-semibold`,children:(0,b.jsx)(xo,{to:`/g/${e.key}`,className:`hover:underline`,children:e.label})}),(0,b.jsx)(Dk,{group:e})]},e.key))})}function Dk({group:e}){return(0,b.jsxs)(b.Fragment,{children:[e.resources.length>0&&(0,b.jsx)(Ak,{resources:e.resources}),e.pages.length>0&&(0,b.jsx)(kk,{pages:e.pages})]})}var Ok=`flex items-center gap-3 rounded-card border bg-card shadow-card p-4 hover:bg-muted/50`;function kk({pages:e}){return(0,b.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>{let t=IT(e.icon,`page`);return(0,b.jsx)(`li`,{children:(0,b.jsxs)(xo,{to:`/p/${e.name}`,className:Ok,children:[(0,b.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-md bg-muted`,children:(0,b.jsx)(t,{className:`size-5 text-muted-foreground`,"aria-hidden":!0})}),(0,b.jsx)(`span`,{className:`truncate font-medium`,children:e.label})]})},e.name)})})}function Ak({resources:e}){let{t,locale:n}=Y(),r=ut({queries:e.map(e=>({queryKey:[`count`,e.name],queryFn:()=>Q.list(e.name,new URLSearchParams({pageSize:`1`})),staleTime:6e4}))});return(0,b.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.map((e,i)=>{let a=IT(e.icon,`resource`),o=r[i]?.data,s=o&&o.total!==null?t(o.estimated?`shell.aboutRecords`:`shell.records`,{count:E_(o.total,n)}):void 0;return(0,b.jsx)(`li`,{children:(0,b.jsxs)(xo,{to:`/${e.name}`,className:Ok,children:[(0,b.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-md bg-muted`,children:(0,b.jsx)(a,{className:`size-5 text-muted-foreground`,"aria-hidden":!0})}),(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,b.jsx)(`span`,{className:`truncate font-medium`,children:e.label}),s&&(0,b.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:s})]})]})},e.name)})})}var jk=(e,t=2)=>String(e).padStart(t,`0`),Mk=e=>`${jk(e.getFullYear(),4)}-${jk(e.getMonth()+1)}-${jk(e.getDate())}`,Nk=e=>new Date(`${e}T00:00:00`).toISOString(),Pk=(e,t)=>{let[n,r]=e.split(`-`).map(Number),i=n*12+(r-1)+t;return`${jk(Math.floor(i/12),4)}-${jk(i%12+1)}-01`};function Fk(e,t,n,r,i){let a=Mk(t),o=(t,n,r,i)=>({period:e,from:Nk(t),to:Nk(n),previousFrom:Nk(r),previousTo:Nk(i)}),s=(e,t)=>Math.round((Date.parse(`${t}T00:00:00Z`)-Date.parse(`${e}T00:00:00Z`))/864e5);switch(e){case`day`:return o(a,iw(a,1),iw(a,-1),a);case`week`:return o(iw(a,-6),iw(a,1),iw(a,-13),iw(a,-6));case`month`:{if(n===`persian`){let{jy:e,jm:t}=QC(a),n=$C(e,t,1);return o(n,rw(n,1),rw(n,-1),n)}let e=`${a.slice(0,7)}-01`;return o(e,Pk(e,1),Pk(e,-1),e)}case`year`:{if(n===`persian`){let{jy:e}=QC(a);return o($C(e,1,1),$C(e+1,1,1),$C(e-1,1,1),$C(e,1,1))}let e=Number(a.slice(0,4));return o(`${jk(e,4)}-01-01`,`${jk(e+1,4)}-01-01`,`${jk(e-1,4)}-01-01`,`${jk(e,4)}-01-01`)}case`range`:{let e=r??a,t=iw(i??a,1);return o(e,t,iw(e,-s(e,t)),e)}}}function Ik(e){if(e===void 0)return;let t=`${Math.abs(e)}%`;return e>0?{tone:`ok`,arrow:`up`,text:t}:e<0?{tone:`bad`,arrow:`down`,text:t}:{tone:`neutral`,arrow:null,text:t}}function Lk(e,t,n){let r=Math.max(1,...e.series.flatMap(e=>e.values)),i=Math.max(1,e.labels.length),a=t/i,o=e=>n-e/r*n;return{max:r,gridlines:[.25,.5,.75,1].map(e=>({y:n-e*n,value:r*e})),series:e.series.map(e=>{let r=e.values.map((e,n)=>[i===1?t/2:n*t/(i-1),o(e)]);return{label:e.label,dashed:e.dashed===!0,path:r.map(([e,t],n)=>`${n===0?`M`:`L`}${Rk(e)} ${Rk(t)}`).join(` `),bars:e.values.map((e,t)=>{let r=a*.6;return{x:t*a+a/2-r/2,y:o(e),width:r,height:n-o(e)}})}})}}var Rk=e=>Math.round(e*10)/10,zk=600,Bk=200;function Vk({title:e,data:t}){let n=X(),r=Lk(t,zk,Bk),i=Math.max(1,Math.ceil(t.labels.length/6));return(0,b.jsxs)(`div`,{className:`flex flex-col gap-3.5 p-5`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,b.jsx)(`h2`,{className:`text-[15px] font-semibold`,children:e}),t.subtitle&&(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t.subtitle})]}),(0,b.jsx)(`div`,{className:`ms-auto flex gap-4 text-xs text-muted-foreground`,children:t.series.map(e=>(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:e.dashed?`h-0 w-3.5 border-t-2 border-dashed border-muted-foreground`:`h-[3px] w-3.5 rounded-sm bg-primary`}),e.label]},e.label))})]}),(0,b.jsxs)(`svg`,{viewBox:`0 0 ${zk} ${Bk}`,preserveAspectRatio:`none`,role:`img`,"aria-label":e,className:`h-[230px] w-full overflow-visible rtl:-scale-x-100`,children:[(0,b.jsx)(`g`,{className:`stroke-border`,children:r.gridlines.map(e=>(0,b.jsx)(`path`,{d:`M0 ${e.y}H${zk}`,vectorEffect:`non-scaling-stroke`},e.y))}),r.series.map((e,n)=>t.kind===`bar`&&!e.dashed?(0,b.jsx)(`g`,{className:`fill-primary`,children:e.bars.map((e,t)=>(0,b.jsx)(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:3},t))},e.label):(0,b.jsxs)(`g`,{children:[!e.dashed&&n===0&&(0,b.jsx)(`path`,{d:`${e.path} L${zk} ${Bk} L0 ${Bk} Z`,className:`fill-primary/10`}),(0,b.jsx)(`path`,{d:e.path,fill:`none`,vectorEffect:`non-scaling-stroke`,strokeWidth:e.dashed?2:2.5,strokeDasharray:e.dashed?`5 5`:void 0,className:e.dashed||n>0?`stroke-muted-foreground`:`stroke-primary`})]},e.label))]}),(0,b.jsx)(`div`,{"aria-hidden":!0,className:`flex justify-between text-[11.5px] text-muted-foreground`,children:t.labels.filter((e,t)=>t%i===0).map(e=>(0,b.jsx)(`span`,{children:e},e))}),(0,b.jsxs)(`span`,{className:`sr-only`,children:[t.series.map(e=>`${e.label}: ${e.values.map(e=>E_(e)).join(`, `)}`).join(`; `),` `,n(`dashboard.period`)]})]})}var Hk={ok:`bg-ok`,warn:`bg-warn`,bad:`bg-bad`,info:`bg-info`,neutral:`bg-muted-foreground`,primary:`bg-primary`};function Uk({title:e,data:t}){return(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 p-5`,children:[(0,b.jsx)(`h2`,{className:`text-[15px] font-semibold`,children:e}),(0,b.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:t.items.map((e,t)=>{let n=IT(e.icon,`resource`),r=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-control bg-muted text-muted-foreground`,children:(0,b.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),(0,b.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:e.text}),e.status&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:U(`size-2 shrink-0 rounded-full`,Hk[e.status])})]});return(0,b.jsx)(`li`,{children:e.link?(0,b.jsx)(xo,{to:e.link,className:`flex items-center gap-3 rounded-control hover:bg-muted`,children:r}):(0,b.jsx)(`div`,{className:`flex items-center gap-3`,children:r})},t)})})]})}function Wk({items:e,value:t,onChange:n,className:r}){return(0,b.jsx)(`div`,{role:`tablist`,className:U(`flex w-full gap-0.5 border-b border-border`,r),children:e.map(e=>{let r=e.key===t;return(0,b.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.key),className:U(`-mb-px inline-flex h-[38px] cursor-pointer items-center gap-1.5 border-b-2 border-transparent px-3 text-[13px] text-muted-foreground`,r&&`border-foreground font-semibold text-foreground`),children:[e.label,e.count!==void 0&&(0,b.jsxs)(`span`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-muted px-1.5 text-[11px] text-muted-foreground`,children:[e.estimate?`~`:``,e.count]})]},e.key)})})}function Gk({period:e,from:t,to:n,onChange:r}){let i=X(),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(t??``),[l,u]=(0,y.useState)(n??``);return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(Wk,{className:`w-auto`,items:[`day`,`week`,`month`,`year`].map(e=>({key:e,label:i(`dashboard.${e}`)})),value:e===`range`?``:e,onChange:e=>r(e)}),(0,b.jsxs)(Kh,{open:a,onOpenChange:o,children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsx)(q,{variant:e===`range`?`secondary`:`outline`,size:`icon`,"aria-label":i(`dashboard.range`),"aria-pressed":e===`range`,children:(0,b.jsx)(Hy,{})})}),(0,b.jsx)(Jh,{children:(0,b.jsxs)(Yh,{align:`end`,sideOffset:6,className:`z-50 flex w-72 flex-col gap-3 rounded-[10px] border bg-popover p-3 shadow-lg`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,b.jsx)(t_,{htmlFor:`dashboard-from`,children:i(`filters.from`)}),(0,b.jsx)(fw,{id:`dashboard-from`,label:i(`filters.from`),value:s,onChange:c,live:!0})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,b.jsx)(t_,{htmlFor:`dashboard-to`,children:i(`filters.to`)}),(0,b.jsx)(fw,{id:`dashboard-to`,label:i(`filters.to`),value:l,onChange:u,live:!0})]}),(0,b.jsx)(q,{disabled:!/^\d{4}-\d{2}-\d{2}$/.test(s)||!/^\d{4}-\d{2}-\d{2}$/.test(l)||s>l,onClick:()=>{o(!1),r(`range`,s,l)},children:i(`dashboard.apply`)})]})})]})]})}var Kk=42,qk=2*Math.PI*Kk;function Jk({title:e,data:t}){let n=Math.max(0,Math.min(100,t.percent));return(0,b.jsxs)(`div`,{className:`flex items-center gap-5 p-5`,children:[(0,b.jsxs)(`svg`,{viewBox:`0 0 100 100`,role:`img`,"aria-label":D_(t.value),className:`size-[104px] shrink-0 -rotate-90`,children:[(0,b.jsx)(`circle`,{cx:`50`,cy:`50`,r:Kk,fill:`none`,strokeWidth:10,className:`stroke-muted`}),(0,b.jsx)(`circle`,{cx:`50`,cy:`50`,r:Kk,fill:`none`,strokeWidth:10,strokeLinecap:`round`,strokeDasharray:`${n/100*qk} ${qk}`,className:`stroke-primary`})]}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,b.jsx)(`div`,{className:`text-2xl leading-tight font-bold`,children:D_(t.value)}),(0,b.jsx)(`h2`,{className:`text-sm font-semibold`,children:e}),(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t.caption})]})]})}function Yk({title:e,data:t}){let n=Ik(t.change);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 px-5 py-[18px]`,children:[(0,b.jsx)(`div`,{className:`text-[13px] font-medium text-muted-foreground`,children:e}),(0,b.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,b.jsx)(`span`,{className:`text-[26px] leading-[1.3] font-bold`,children:D_(t.value)}),t.unit&&(0,b.jsx)(`span`,{className:`text-[13px] text-muted-foreground`,children:t.unit})]}),(n||t.previousLabel)&&(0,b.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[n&&(0,b.jsxs)(`span`,{className:U(`inline-flex items-center gap-0.5 rounded-full px-1.5 py-0.5 font-medium`,n.tone===`ok`?`bg-ok-bg text-ok`:n.tone===`bad`?`bg-bad-bg text-bad`:`bg-muted text-muted-foreground`),children:[n.arrow===`up`&&(0,b.jsx)(wy,{className:`size-3`,"aria-hidden":!0}),n.arrow===`down`&&(0,b.jsx)(by,{className:`size-3`,"aria-hidden":!0}),D_(n.text)]}),t.previousLabel&&(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:t.previousLabel})]})]})}function Xk({title:e,data:t}){let n=X(),r=t.link?`/${t.link.resource}${t.link.filter?`?${new URLSearchParams(t.link.filter)}`:``}`:void 0;return(0,b.jsxs)(`div`,{className:`flex flex-col`,children:[(0,b.jsxs)(`div`,{className:`flex min-h-14 items-center gap-2 border-b px-5 py-3`,children:[(0,b.jsx)(`h2`,{className:`flex-1 text-[15px] font-semibold`,children:e}),r&&(0,b.jsxs)(xo,{to:r,className:`inline-flex items-center gap-1 text-[13px] font-medium text-primary hover:underline`,children:[n(`dashboard.viewAll`),(0,b.jsx)(Qy,{className:`size-3.5 ltr:rotate-180`,"aria-hidden":!0})]})]}),(0,b.jsx)(`div`,{className:`overflow-x-auto`,children:(0,b.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,b.jsx)(`thead`,{className:`bg-[color-mix(in_oklab,var(--muted)_50%,transparent)] text-[12.5px] text-muted-foreground`,children:(0,b.jsx)(`tr`,{children:t.columns.map(e=>(0,b.jsx)(`th`,{className:`px-3.5 py-2.5 text-start font-medium whitespace-nowrap`,children:e.label},e.key))})}),(0,b.jsx)(`tbody`,{children:t.rows.map((e,n)=>(0,b.jsx)(`tr`,{className:`border-t`,children:t.columns.map(t=>{let n=e[t.key];return(0,b.jsx)(`td`,{className:`px-3.5 py-2.5 whitespace-nowrap`,children:typeof n==`object`&&n?(0,b.jsx)(aD,{tone:n.tone,children:n.label}):typeof n==`number`?E_(n):D_(String(n??``))},t.key)})},n))})]})})]})}var Zk=[`day`,`week`,`month`,`year`,`range`],Qk={1:`lg:col-span-4`,2:`lg:col-span-6`,3:`lg:col-span-8`,4:`lg:col-span-12`};function $k(){let{t:e,calendar:t}=Y(),[n,r]=To(),i=n.get(`period`),a=i&&Zk.includes(i)?i:`week`,o=n.get(`from`)??void 0,s=n.get(`to`)??void 0,c=Fk(a,new Date,t===`persian`?`persian`:`gregory`,o,s),l=ft({queryKey:[`dashboard`],queryFn:Q.dashboard});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:e(`dashboard.title`)}),(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:e(`dashboard.subtitle`)})]}),(0,b.jsx)(`div`,{className:`ms-auto`,children:(0,b.jsx)(Gk,{period:a,from:o,to:s,onChange:(e,t,n)=>r(e===`range`?{period:e,from:t,to:n}:e===`week`?{}:{period:e})})})]}),l.isPending&&(0,b.jsx)(W,{children:e(`common.loading`)}),l.isError&&(0,b.jsx)(W,{tone:`error`,children:z_(l.error)}),l.data&&(0,b.jsx)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-12`,children:l.data.widgets.map(e=>(0,b.jsx)(eA,{widget:e,params:c},e.name))})]})}function eA({widget:e,params:t}){let{t:n}=Y(),r=ft({queryKey:[`dashboard`,e.name,t],queryFn:()=>Q.widget(e.name,t),retry:!1}),i=e.type===`stat`?`lg:col-span-3`:Qk[e.size];return(0,b.jsxs)(`section`,{"aria-label":e.title,"data-widget":e.name,className:U(`min-w-0 overflow-hidden rounded-card border bg-card shadow-card`,i),children:[r.isPending&&(0,b.jsxs)(`div`,{"aria-hidden":!0,className:`flex flex-col gap-3 p-5`,children:[(0,b.jsx)(`div`,{className:`h-4 w-1/3 animate-pulse rounded bg-muted`}),(0,b.jsx)(`div`,{className:`h-8 w-2/3 animate-pulse rounded bg-muted`})]}),r.isError&&(0,b.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-5 text-[13px]`,children:[(0,b.jsx)(`span`,{className:`font-semibold`,children:e.title}),(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:n(`dashboard.failed`)}),(0,b.jsx)(q,{size:`sm`,variant:`outline`,onClick:()=>void r.refetch(),children:n(`dashboard.retry`)})]}),r.data&&(0,b.jsx)(tA,{type:e.type,title:e.title,data:r.data})]})}function tA({type:e,title:t,data:n}){switch(e){case`stat`:return(0,b.jsx)(Yk,{title:t,data:n});case`chart`:return(0,b.jsx)(Vk,{title:t,data:n});case`table`:return(0,b.jsx)(Xk,{title:t,data:n});case`progress`:return(0,b.jsx)(Jk,{title:t,data:n});case`list`:return(0,b.jsx)(Uk,{title:t,data:n})}}function nA(){let e=X(),t=vv();if(t.isPending)return(0,b.jsx)(W,{children:e(`common.loading`)});if(t.isError)return(0,b.jsx)(W,{tone:`error`,children:t.error.message});if(t.data.dashboard)return(0,b.jsx)($k,{});let n=oT(t.data);return n.length===0?(0,b.jsx)(W,{children:e(`shell.noResources`)}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:t.data.title}),(0,b.jsx)(Ek,{groups:n})]})}var rA={order:[],hidden:[],widths:{},density:`comfortable`},iA=e=>`nma.columns.${e}`;function aA(e,t){return oA(e,t).filter(e=>!t.hidden.includes(e))}function oA(e,t){let n=t.order.filter(t=>e.includes(t));return[...n,...e.filter(e=>!n.includes(e))]}function sA(e){let t=new Map,n=new Set,r=n=>{let r=t.get(n);if(!r){r=rA;try{let t=e?.getItem(iA(n));t&&(r={...rA,...JSON.parse(t)})}catch{r=rA}t.set(n,r)}return r},i=(r,i)=>{t.set(r,i);try{e?.setItem(iA(r),JSON.stringify(i))}catch{}for(let e of n)e()};return{get:r,subscribe(e){return n.add(e),()=>n.delete(e)},toggle(e,t){let n=r(e),a=n.hidden.includes(t)?n.hidden.filter(e=>e!==t):[...n.hidden,t];i(e,{...n,hidden:a})},move(e,t,n,a){let o=r(e),s=oA(t,o),c=s.indexOf(n),l=c+a;c<0||l<0||l>=s.length||([s[c],s[l]]=[s[l],s[c]],i(e,{...o,order:s}))},setWidth(e,t,n){let a=r(e),o=Math.round(Math.min(600,Math.max(60,n)));i(e,{...a,widths:{...a.widths,[t]:o}})},setDensity(e,t){i(e,{...r(e),density:t})},reset(r){try{e?.removeItem(iA(r))}catch{}t.set(r,rA);for(let e of n)e()}}}function cA(){try{return typeof localStorage>`u`?void 0:localStorage}catch{return}}var lA=sA(cA());function uA(e){return(0,y.useSyncExternalStore)(lA.subscribe,()=>lA.get(e))}function dA({schema:e,prefs:t}){let n=X(),r=oA(e.list.columns,t),i=t=>e.list.computed?.[t]?.label??e.fields.find(e=>e.name===t)?.label??t,a=r.filter(e=>!t.hidden.includes(e));return(0,b.jsxs)(Kh,{children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsxs)(q,{variant:`outline`,size:`sm`,className:`hidden md:inline-flex`,children:[(0,b.jsx)(cb,{}),n(`list.columns`),(0,b.jsx)(Xy,{className:`text-muted-foreground`})]})}),(0,b.jsx)(Jh,{children:(0,b.jsxs)(Yh,{align:`end`,sideOffset:4,className:`z-50 flex w-72 flex-col gap-3 rounded-[10px] border bg-popover p-3 text-popover-foreground shadow-lg`,children:[(0,b.jsx)(`ul`,{"aria-label":n(`list.columns`),className:`flex flex-col gap-0.5`,children:r.map((o,s)=>{let c=!t.hidden.includes(o);return(0,b.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md px-1 py-0.5 hover:bg-accent`,children:[(0,b.jsxs)(`label`,{className:`flex flex-1 cursor-pointer items-center gap-2 text-sm`,children:[(0,b.jsx)(Af,{checked:c,disabled:c&&a.length===1,onCheckedChange:()=>lA.toggle(e.name,o),className:`flex size-4 items-center justify-center rounded border border-input disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,children:(0,b.jsx)(Mf,{children:(0,b.jsx)(Jy,{className:`size-3`})})}),i(o)]}),(0,b.jsx)(q,{variant:`ghost`,size:`icon-sm`,"aria-label":n(`list.moveUp`,{name:i(o)}),disabled:s===0,onClick:()=>lA.move(e.name,e.list.columns,o,-1),children:(0,b.jsx)(wy,{})}),(0,b.jsx)(q,{variant:`ghost`,size:`icon-sm`,"aria-label":n(`list.moveDown`,{name:i(o)}),disabled:s===r.length-1,onClick:()=>lA.move(e.name,e.list.columns,o,1),children:(0,b.jsx)(by,{})})]},o)})}),(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":n(`list.density`),className:`flex gap-1`,children:[`comfortable`,`compact`].map(r=>(0,b.jsx)(q,{role:`radio`,"aria-checked":t.density===r,variant:t.density===r?`secondary`:`ghost`,size:`sm`,onClick:()=>lA.setDensity(e.name,r),children:n(r===`compact`?`list.compact`:`list.comfortable`)},r))}),(0,b.jsx)(q,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>lA.reset(e.name),children:n(`list.resetColumns`)})]})})]})}function fA({resource:e,column:t,label:n,width:r}){let i=X(),a=(0,y.useRef)(null);return(0,b.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":i(`list.resize`,{name:n}),"aria-valuenow":r,tabIndex:0,className:U(`absolute inset-y-1 end-0 w-1.5 cursor-col-resize touch-none rounded bg-transparent hover:bg-border focus-visible:bg-ring`),onPointerDown:e=>{let t=e.currentTarget.parentElement;a.current={x:e.clientX,width:t.getBoundingClientRect().width,rtl:getComputedStyle(t).direction===`rtl`},e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:n=>{if(!a.current)return;let r=(n.clientX-a.current.x)*(a.current.rtl?-1:1);lA.setWidth(e,t,a.current.width+r)},onPointerUp:()=>a.current=null,onKeyDown:n=>{if(n.key!==`ArrowLeft`&&n.key!==`ArrowRight`)return;n.preventDefault();let i=r??n.currentTarget.parentElement.getBoundingClientRect().width,a=getComputedStyle(n.currentTarget).direction===`rtl`,o=n.key===`ArrowRight`!==a;lA.setWidth(e,t,i+(o?10:-10))},onClick:e=>e.stopPropagation()})}var pA=`h-7 w-full min-w-20 rounded-md border border-input bg-background px-2 text-sm outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 aria-invalid:border-destructive`;function mA({schema:e,item:t,field:n}){let r=X(),i=S(),[a,o]=(0,y.useState)(!1),s=eD([n],t)[n.name],[c,l]=(0,y.useState)(s),[u,d]=(0,y.useState)(null),f=(0,y.useRef)(!1),p=pt({mutationFn:n=>Q.update(e.name,String(t._id),n,e.version?t[e.version]:void 0),onSuccess:n=>{i.setQueriesData({queryKey:[`list`,e.name]},e=>e&&{...e,items:e.items.map(e=>e._id===n._id?{...e,...n}:e)}),i.removeQueries({queryKey:[`record`,e.name,String(t._id)]}),o(!1),d(null)},onError:e=>{d(e instanceof R_?e.fields[n.name]?.join(` `)??e.message:e.message),l(s),o(!1)}});function m(t=c){if(t===s){o(!1);return}let{payload:r,errors:i}=nD([n],{[n.name]:t},{[n.name]:s}),a=SO(r,{[n.name]:e.form.constraints.update[n.name]??{}},`update`),l=i[n.name]??a[n.name];if(l){d(l.join(` `));return}p.mutate(r)}let h=e=>{e.key===`Enter`?(e.preventDefault(),m()):e.key===`Escape`&&(e.preventDefault(),l(s),d(null),o(!1))},g=`cell-${e.name}-${String(t._id)}-${n.name}-error`,_={"aria-label":n.label,"aria-invalid":u?!0:void 0,"aria-describedby":u?g:void 0,autoFocus:!0,disabled:p.isPending,className:pA,onKeyDown:h},v;if(!a)v=(0,b.jsx)(`button`,{type:`button`,className:U(`-mx-1 rounded px-1 text-start hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,u&&`text-destructive`),"aria-label":r(`list.editCell`,{name:n.label,value:sC(t[n.name],n)}),onClick:()=>{l(s),o(!0)},children:(0,b.jsx)(lD,{value:t[n.name],field:n})});else if(n.type===`enum`||n.type===`boolean`){let e=n.type===`boolean`?[[`true`,r(`common.yes`)],[`false`,r(`common.no`)]]:(n.enumValues??[]).map(e=>[e,OD(n,e)]);v=(0,b.jsx)(Pw,{"aria-label":n.label,"aria-invalid":u?!0:void 0,"aria-describedby":u?g:void 0,autoFocus:!0,defaultOpen:!0,disabled:p.isPending,size:`sm`,className:`min-w-20`,value:String(c),onValueChange:e=>{f.current=!0;let t=n.type===`boolean`?e===`true`:e;l(t),m(t)},onOpenChange:e=>{e?f.current=!1:f.current||o(!1)},options:[...n.nullable&&n.type===`enum`?[{value:``,label:r(`common.empty`)}]:[],...e.map(([e,t])=>({value:e,label:t}))]})}else if(n.type===`date`)v=(0,b.jsx)(fw,{id:`cell-${e.name}-${String(t._id)}-${n.name}`,label:n.label,value:String(c),onChange:e=>{l(e),m(e)},autoFocus:!0,"aria-invalid":u?!0:void 0,"aria-describedby":u?g:void 0,className:`min-w-44`,onKeyDown:h});else{let e=n.type===`number`||n.type===`decimal`||n.type===`bigint`;v=(0,b.jsx)(`input`,{..._,type:`text`,inputMode:e?n.type===`bigint`?`numeric`:`decimal`:void 0,value:String(c),onChange:e=>l(e.target.value),onBlur:()=>m()})}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-0.5`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[v,u&&(0,b.jsx)(`p`,{id:g,role:`alert`,className:`text-xs text-destructive`,children:u})]})}var hA=/^filter\[([^\][]+)\]\[([^\][]+)\]$/;function gA(e,t){if(e.type===`boolean`)return J(t===`true`?`common.yes`:`common.no`);if(e.type===`enum`)return e.enumLabels?.[t]??t;if(e.type===`date`)return A_(t);if(e.type===`number`||e.type===`decimal`||e.type===`bigint`)return D_(t);if(e.type===`datetime`){let e=new Date(t);return Number.isNaN(e.getTime())?t:O_(e)}return t}function _A(e,t){let n=[],r=t.get(`search`);r&&n.push({key:`search`,label:J(`filters.search`),value:`“${r}”`,remove:[`search`]});let i=vA(e,t),a=new Map;for(let[e,n]of t){if(i[e]===n)continue;let t=hA.exec(e);if(!t||n===``)continue;let[,r,o]=t;a.set(r,[...a.get(r)??[],{operator:o,raw:n,key:e}])}for(let[t,r]of a){let i=e.fields.find(e=>e.name===t);if(!i)continue;let a=[],o,s=r.find(e=>e.operator===`gte`||e.operator===`gt`),c=r.find(e=>e.operator===`lte`||e.operator===`lt`);s&&c&&a.push(`${gA(i,s.raw)} – ${gA(i,c.raw)}`);for(let{operator:e,raw:n}of r){if((e===`gte`||e===`gt`||e===`lte`||e===`lt`)&&s&&c)continue;let r=n.split(`,`).map(e=>gA(i,e));if(i.type===`relation`&&[`eq`,`ne`,`in`,`nin`].includes(e)){let r=e===`ne`||e===`nin`?J(`filters.not`):``;o={field:t,ids:n.split(`,`),prefix:r},a.push(`${r}${n.split(`,`).map(e=>`#${e}`).join(`, `)}`);continue}switch(e){case`isNull`:a.push(J(n===`true`?`filters.empty`:`filters.notEmpty`));break;case`ne`:case`nin`:a.push(`${J(`filters.not`)}${r.join(`, `)}`);break;case`gte`:case`gt`:a.push(`≥ ${r[0]}`);break;case`lte`:case`lt`:a.push(`≤ ${r[0]}`);break;case`between`:a.push(r.join(` – `));break;case`contains`:a.push(`“${n}”`);break;case`startsWith`:a.push(`${n}…`);break;default:a.push(r.join(`, `))}}n.push({key:`filter:${t}`,label:i.label,value:a.join(`; `),...o?{ref:o}:{},remove:r.map(e=>e.key)})}return n}function vA(e,t){return kw(e.list?.tabs,t)?.filter??{}}var yA=`(max-width: 767px)`;function bA(e){let t=window.matchMedia(yA);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function xA(){return(0,y.useSyncExternalStore)(bA,()=>window.matchMedia(yA).matches,()=>!1)}var SA=new Set([`number`,`decimal`,`bigint`,`date`,`datetime`]);function CA({schema:e,params:t,onChange:n,trailing:r}){let i=X(),a=xA(),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(),u=t.get(`search`)??``,[d,f]=(0,y.useState)(u);(0,y.useEffect)(()=>{f(u)},[u]);let p=e.list.filters.map(t=>({operators:t.operators,field:e.fields.find(e=>e.name===t.field)})).filter(e=>e.field!==void 0),m=e.list.search.length>0,h=a&&(p.length>0||e.list.sortable.length>0);if(p.length===0&&!m&&!h&&!r)return null;let g=e.list.search.map(t=>e.fields.find(e=>e.name===t)?.label??t);if(!a){let a=new Map(_A(e,t).map(e=>[e.key,e]));return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[m&&(0,b.jsx)(FA,{label:i(`filters.search`),placeholder:i(`filters.searchIn`,{fields:g.join(`, `)}),value:d,onChange:f,onSubmit:()=>n({search:d.trim()||null})}),p.length>0&&(0,b.jsx)(`ul`,{"aria-label":i(`filters.filters`),className:`contents`,children:p.map(({field:r,operators:i})=>(0,b.jsx)(`li`,{className:`contents`,children:(0,b.jsx)(IA,{resource:e.name,field:r,operators:i,params:t,onChange:n,chip:a.get(`filter:${r.name}`)})},r.name))}),bw(t)&&(0,b.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>n(xw(t)),children:[i(`filters.clear`),(0,b.jsx)(XS,{className:`size-3.5`})]}),r&&(0,b.jsx)(`div`,{className:`ms-auto flex items-center gap-2`,children:r})]})}let _=Ew(t),v=_A(e,t).length>0,x=wA(e,t,i),S=()=>{l(new URLSearchParams(t)),s(!0)};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[m&&(0,b.jsx)(FA,{className:`flex-1`,label:i(`filters.search`),placeholder:i(`filters.searchIn`,{fields:g.join(`, `)}),value:d,onChange:f,onSubmit:()=>n({search:d.trim()||null})}),h&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,"aria-haspopup":`dialog`,onClick:S,children:[(0,b.jsx)(gS,{}),i(`filters.filters`),_>0&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1.5 text-xs text-primary-foreground`,children:E_(_)})]})]}),(v||h&&x)&&(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v&&(0,b.jsx)(jA,{schema:e,params:t,onChange:n}),h&&x&&(0,b.jsxs)(`button`,{type:`button`,className:`inline-flex h-9 items-center gap-1.5 rounded-full border border-input bg-card px-3 text-[13px]`,"aria-haspopup":`dialog`,onClick:S,children:[(0,b.jsx)(vy,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),x]})]}),h&&(0,b.jsx)(Yd,{open:o,onOpenChange:s,children:(0,b.jsxs)(tf,{children:[(0,b.jsx)(rf,{className:aT}),(0,b.jsxs)(cf,{"aria-describedby":void 0,className:`fixed inset-x-0 bottom-0 z-50 flex max-h-[85dvh] flex-col rounded-t-[18px] bg-card shadow-xl outline-none`,children:[(0,b.jsx)(`div`,{className:`flex justify-center pt-2`,"aria-hidden":!0,children:(0,b.jsx)(`span`,{className:`h-1.5 w-10 rounded-full bg-input`})}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 ps-4 pe-2 pt-1.5 pb-2`,children:[(0,b.jsx)(pf,{className:`flex-1 text-[17px] font-bold`,children:i(`filters.filtersAndSort`)}),bw(t)&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,className:`text-primary`,onClick:()=>n(xw(t)),children:i(`filters.clear`)})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-5 overflow-y-auto px-4 py-1`,children:[p.map(({field:r,operators:i})=>(0,b.jsx)(EA,{resource:e.name,field:r,operators:i,params:t,onChange:n,touch:!0},r.name)),e.list.sortable.length>0&&(0,b.jsx)(TA,{schema:e,params:t,onChange:n})]}),(0,b.jsxs)(`div`,{className:`flex gap-2.5 border-t px-4 pt-3 pb-5`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>{c&&n(Dw(t,c)),s(!1)},children:i(`common.cancel`)}),(0,b.jsx)(hf,{asChild:!0,children:(0,b.jsx)(q,{className:`flex-1`,children:i(`filters.showResults`)})})]})]})]})})]})}function wA(e,t,n){if(e.list.sortable.length===0)return``;let{field:r,direction:i}=e.list.defaultSort,a=t.get(`sort`)??(i===`desc`?`-${r}`:r),o=a.replace(/^-/,``),s=e.fields.find(e=>e.name===o)?.label??o;return n(a.startsWith(`-`)?`filters.descending`:`filters.ascending`,{name:s})}function TA({schema:e,params:t,onChange:n}){let r=X(),{field:i,direction:a}=e.list.defaultSort,o=t.get(`sort`)??(a===`desc`?`-${i}`:i),s=t=>e.fields.find(e=>e.name===t)?.label??t;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`list-sort`,children:r(`filters.sortBy`)}),(0,b.jsx)(Pw,{id:`list-sort`,value:o,onValueChange:e=>n({sort:e,page:null,after:null}),options:e.list.sortable.flatMap(e=>[{value:e,label:r(`filters.ascending`,{name:s(e)})},{value:`-${e}`,label:r(`filters.descending`,{name:s(e)})}])})]})}function EA(e){let t=(0,b.jsx)(AA,{...e}),{field:n,operators:r,params:i,onChange:a}=e;return!n.nullable||!r.includes(`isNull`)||n.type===`relation`?t:(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[t,(0,b.jsx)(DA,{field:n,params:i,onChange:a})]})}function DA({field:e,params:t,onChange:n}){let r=X(),i=yw(e.name,`isNull`);return(0,b.jsx)(Pw,{"aria-label":r(`filters.emptyValues`,{field:e.label}),size:`sm`,className:`text-muted-foreground`,value:t.get(i)??``,onValueChange:e=>n({[i]:e||null}),options:[{value:``,label:r(`filters.any`)},{value:`true`,label:r(`filters.onlyEmpty`)},{value:`false`,label:r(`filters.hideEmpty`)}]})}function OA({id:e,inline:t,field:n,params:r,onChange:i}){let a=X(),o=yw(n.name,`in`),s=(r.get(o)??``).split(`,`).filter(Boolean),c=e=>{let t=s.includes(e)?s.filter(t=>t!==e):[...s,e];i({[o]:t.length>0?t.join(`,`):null})};return t?(0,b.jsx)(kA,{field:n,selected:s,onToggle:c}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:e,children:n.label}),(0,b.jsxs)(Kh,{children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsxs)(q,{id:e,type:`button`,variant:`outline`,className:`justify-between font-normal`,children:[(0,b.jsx)(`span`,{className:`truncate`,children:s.length===0?a(`common.all`):s.length<=2?s.map(e=>OD(n,e)).join(`, `):a(`filters.selected`,{count:s.length})}),(0,b.jsx)(Xy,{className:`size-4 opacity-60`,"aria-hidden":!0})]})}),(0,b.jsx)(Jh,{children:(0,b.jsx)(Yh,{align:`start`,sideOffset:4,className:`z-50 min-w-48 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:(0,b.jsx)(kA,{field:n,selected:s,onToggle:c})})})]})]})}function kA({field:e,selected:t,onToggle:n}){return(0,b.jsx)(`ul`,{"aria-label":e.label,children:(e.enumValues??[]).map(r=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent`,children:[(0,b.jsx)(Af,{checked:t.includes(r),onCheckedChange:()=>n(r),className:`flex size-4 items-center justify-center rounded border border-input data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,children:(0,b.jsx)(Mf,{children:(0,b.jsx)(Jy,{className:`size-3`})})}),OD(e,r)]})},r))})}function AA({inline:e,touch:t,resource:n,field:r,operators:i,params:a,onChange:o}){let{t:s,calendar:c}=Y(),l=`filter-${r.name}`;if(t&&r.type===`enum`&&i.includes(`in`))return(0,b.jsx)(RA,{field:r,params:a,onChange:o});if(r.type===`enum`&&i.includes(`in`))return(0,b.jsx)(OA,{id:l,inline:e,field:r,params:a,onChange:o});if(r.type===`relation`){let e=r.relation?.kind===`to-many`?`in`:`eq`;return i.includes(e)?(0,b.jsx)(NA,{id:l,resource:n,field:r,operator:e,params:a,onChange:o}):null}if((r.type===`enum`||r.type===`boolean`)&&i.includes(`eq`)){let e=yw(r.name,`eq`),n=r.type===`boolean`?[[`true`,s(`common.yes`)],[`false`,s(`common.no`)]]:(r.enumValues??[]).map(e=>[e,OD(r,e)]);return t&&n.length<=3?(0,b.jsx)(zA,{label:r.label,options:[[``,s(`common.all`)],...n],value:a.get(e)??``,onChange:t=>o({[e]:t||null})}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:l,children:r.label}),(0,b.jsx)(Pw,{id:l,value:a.get(e)??``,onValueChange:t=>o({[e]:t||null}),options:[{value:``,label:s(`common.all`)},...n.map(([e,t])=>({value:e,label:t}))]})]})}if((r.type===`date`||r.type===`datetime`)&&i.includes(`gte`)&&i.includes(`lte`)){let e=(e,t)=>r.type===`date`||!t?t:new Date(`${t}T${e===`gte`?`00:00:00.000`:`23:59:59.999`}`).toISOString(),t=e=>e&&r.type===`datetime`?$E(e).slice(0,10):e??``;return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:r.label}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`gte`,`lte`].map(n=>{let i=yw(r.name,n),c=`${l}-${n}`,u=s(n===`gte`?`filters.from`:`filters.to`);return(0,b.jsxs)(`div`,{className:`flex min-w-36 flex-1 flex-col gap-1`,children:[(0,b.jsx)(t_,{htmlFor:c,className:`text-xs text-muted-foreground`,children:u}),(0,b.jsx)(fw,{id:c,label:`${r.label} ${u}`,value:t(a.get(i)),onChange:t=>o({[i]:e(n,t)||null})})]},n)})})]})}if(SA.has(r.type)&&i.includes(`gte`)&&i.includes(`lte`)){let e=r.type===`date`?`date`:r.type===`datetime`?`datetime-local`:`text`,t=e=>r.type===`datetime`&&e?new Date(e).toISOString():a_(e.trim()).replace(/,/g,``),n=e=>e&&r.type===`datetime`?$E(e):e??``;return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:r.label}),(0,b.jsx)(`div`,{className:`flex gap-2`,children:[`gte`,`lte`].map(i=>{let c=yw(r.name,i),u=`${l}-${i}`;return(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1`,children:[(0,b.jsx)(t_,{htmlFor:u,className:`text-xs text-muted-foreground`,children:s(i===`gte`?`filters.from`:`filters.to`)}),(0,b.jsx)(PA,{id:u,type:e,inputMode:e===`text`?`decimal`:void 0,value:n(a.get(c)),onCommit:e=>o({[c]:t(e)||null})})]},i)})})]})}let u=i.includes(`contains`)?`contains`:i.includes(`eq`)?`eq`:void 0;if(!u)return null;let d=yw(r.name,u);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:l,children:u===`contains`?s(`filters.contains`,{field:r.label}):r.label}),(0,b.jsx)(PA,{id:l,value:a.get(d)??``,onCommit:e=>o({[d]:e.trim()||null})})]})}function jA({schema:e,params:t,onChange:n}){let r=X(),i=_A(e,t);return(0,b.jsx)(`ul`,{"aria-label":r(`filters.active`),className:`flex flex-wrap gap-2`,children:i.map(t=>(0,b.jsxs)(`li`,{className:`inline-flex h-9 items-center gap-1 rounded-full border border-primary bg-primary-soft ps-3 pe-1.5 text-[13px] font-semibold text-primary`,children:[(0,b.jsxs)(`span`,{className:`font-medium`,children:[t.label,`:`]}),t.ref?(0,b.jsx)(MA,{resource:e.name,chip:t}):(0,b.jsx)(`span`,{children:t.value}),(0,b.jsx)(`button`,{type:`button`,className:`rounded-full p-1 hover:bg-primary-soft`,"aria-label":r(`filters.removeChip`,{label:t.label}),onClick:()=>n(Object.fromEntries(t.remove.map(e=>[e,null]))),children:(0,b.jsx)(XS,{className:`size-3.5`})})]},t.key))})}function MA({resource:e,chip:t}){let n=Ev(e,t.ref.field,t.ref.ids);if(!n.data)return(0,b.jsx)(`span`,{children:t.value});let r=new Map(n.data.items.map(e=>[String(e.id),e.title]));return(0,b.jsx)(`span`,{children:t.ref.prefix+t.ref.ids.map(e=>r.get(e)??`#${e}`).join(`, `)})}function NA({id:e,resource:t,field:n,operator:r,params:i,onChange:a}){let o=yw(n.name,r),s=(i.get(o)??``).split(`,`).filter(Boolean),c=Ev(t,n.name,s),l=new Map((c.data?.items??[]).map(e=>[String(e.id),e])),u=s.map(e=>l.get(e)??{id:e,title:`#${e}`});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:e,children:n.label}),(0,b.jsx)(TD,{id:e,resource:t,field:n,clearable:!0,value:r===`in`?u:u[0]??null,onChange:e=>{let t=Array.isArray(e)?e:e?[e]:[];a({[o]:t.length>0?t.map(e=>e.id).join(`,`):null})}})]})}function PA({id:e,value:t,type:n=`text`,inputMode:r,onCommit:i}){let[a,o]=(0,y.useState)(t);(0,y.useEffect)(()=>{o(t)},[t]);let s=()=>{a!==t&&i(a)};return(0,b.jsx)(e_,{id:e,type:n,inputMode:r,value:a,onChange:e=>o(e.target.value),onBlur:s,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),s())}})}function FA({label:e,placeholder:t,value:n,className:r,onChange:i,onSubmit:a}){return(0,b.jsxs)(`form`,{role:`search`,className:U(`relative w-[300px] max-w-full`,r),onSubmit:e=>{e.preventDefault(),a()},children:[(0,b.jsx)(eS,{className:`pointer-events-none absolute start-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(e_,{"aria-label":e,placeholder:t,value:n,className:`ps-8`,onChange:e=>i(e.target.value)})]})}function IA({chip:e,...t}){let n=X(),{field:r,onChange:i}=t,a=e&&(()=>i(Object.fromEntries(e.remove.map(e=>[e,null]))));return(0,b.jsxs)(Kh,{children:[(0,b.jsxs)(`span`,{className:U(`inline-flex h-8 items-center rounded-lg border border-dashed border-input`,e&&`border-solid bg-card`),children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsxs)(`button`,{type:`button`,className:`inline-flex h-full items-center gap-1.5 rounded-lg px-2.5 text-[12.5px] font-medium outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50`,children:[e?(0,b.jsx)(cx,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}):(0,b.jsx)(ib,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),r.label,e&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`sr-only`,children:`:`}),(0,b.jsx)(`span`,{className:`h-4 w-px bg-border`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`max-w-48 truncate rounded-[5px] bg-muted px-1.5 text-xs font-medium`,children:e.ref?(0,b.jsx)(MA,{resource:t.resource,chip:e}):e.value})]})]})}),a&&(0,b.jsx)(`button`,{type:`button`,className:`-ms-1 me-1 rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":n(`filters.removeChip`,{label:r.label}),onClick:a,children:(0,b.jsx)(XS,{className:`size-3.5`})})]}),(0,b.jsx)(Jh,{children:(0,b.jsx)(Yh,{align:`start`,sideOffset:6,onOpenAutoFocus:r.type===`relation`?e=>e.preventDefault():void 0,className:`z-50 flex w-72 flex-col gap-3 rounded-[10px] border bg-popover p-3 text-popover-foreground shadow-lg outline-none`,children:(0,b.jsx)(EA,{...t,inline:!0})})})]})}var LA=`inline-flex h-9 items-center gap-1.5 rounded-full border border-input bg-card px-3 text-[13px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50 data-[state=checked]:border-primary data-[state=checked]:bg-primary-soft data-[state=checked]:font-semibold data-[state=checked]:text-primary`;function RA({field:e,params:t,onChange:n}){let r=yw(e.name,`in`),i=(t.get(r)??``).split(`,`).filter(Boolean),a=e=>{let t=i.includes(e)?i.filter(t=>t!==e):[...i,e];n({[r]:t.length>0?t.join(`,`):null})};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,b.jsx)(`span`,{className:`text-sm font-medium`,"aria-hidden":!0,children:e.label}),(0,b.jsx)(`ul`,{"aria-label":e.label,className:`flex flex-wrap gap-2`,children:(e.enumValues??[]).map(t=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(Af,{checked:i.includes(t),onCheckedChange:()=>a(t),className:LA,children:[(0,b.jsx)(Mf,{children:(0,b.jsx)(Jy,{className:`size-3.5`})}),OD(e,t)]})},t))})]})}function zA({label:e,options:t,value:n,onChange:r}){return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,b.jsx)(`span`,{className:`text-sm font-medium`,"aria-hidden":!0,children:e}),(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":e,className:`grid auto-cols-fr grid-flow-col gap-0.5 rounded-[10px] bg-muted p-[3px]`,children:t.map(([e,t])=>(0,b.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n===e,className:U(`h-9 rounded-lg text-[13px] text-muted-foreground`,n===e&&`bg-card font-semibold text-foreground shadow-sm`),onClick:()=>r(e),children:t},e))})]})}var BA=e=>e.total===null?e.hasMore===!0:e.page*e.pageSize<e.total;function VA({schema:e,query:t,columns:n,trash:r,selectMode:i,selected:a,onSelect:o,restore:s,empty:c}){let l=X(),u=e.list.pagination===`keyset`,d=mt({queryKey:[`list`,e.name,`cards`,t],initialPageParam:void 0,queryFn:({pageParam:n})=>{let r=new URLSearchParams(t);return n&&r.set(u?`after`:`page`,n),Q.list(e.name,r)},getNextPageParam:e=>u?e.nextCursor??void 0:BA(e)?String(e.page+1):void 0}),f=new Set,p=(d.data?.pages??[]).flatMap(e=>e.items).filter(e=>{let t=String(e._id);return!f.has(t)&&(f.add(t),!0)}),m=d.data?.pages[0]?.total??null,h=(0,y.useRef)(null),{hasNextPage:g,isFetchingNextPage:_,fetchNextPage:v}=d;(0,y.useEffect)(()=>{let e=h.current;if(!e||!g||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&!_&&v()},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[g,_,v]);let x=e=>{let t=new Set(a);t.has(e)?t.delete(e):t.add(e),o(t)};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsxs)(`ul`,{"aria-label":e.label,"aria-busy":d.isFetching,className:`flex flex-col gap-2.5`,children:[d.isPending&&Array.from({length:4},(e,t)=>(0,b.jsx)(`li`,{"aria-hidden":!0,className:`h-20 animate-pulse rounded-card border bg-muted/40`},`skeleton-${t}`)),p.map(t=>{let o=String(t._id),c=(0,b.jsx)(HA,{schema:e,item:t,columns:n});return(0,b.jsx)(`li`,{children:r?(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-2 rounded-card border bg-card p-3 shadow-card`,children:[c,s(t)]}):i?(0,b.jsxs)(`label`,{className:U(`flex cursor-pointer items-start gap-3 rounded-card border bg-card p-3 shadow-card`,a.has(o)&&`border-primary bg-primary-soft`),children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 accent-primary`,checked:a.has(o),onChange:()=>x(o),"aria-label":l(`list.selectRow`,{name:String(t._title??o)})}),c]}):(0,b.jsx)(xo,{to:`/${e.name}/${encodeURIComponent(o)}`,className:`block rounded-card border bg-card p-3 shadow-card active:bg-muted`,children:c})},o)}),d.isSuccess&&p.length===0&&(0,b.jsx)(`li`,{className:`flex flex-col items-center gap-2 py-6 text-center text-sm text-muted-foreground`,children:c})]}),d.isError&&(0,b.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[(0,b.jsx)(`span`,{children:l(`list.loadFailed`)}),(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void d.refetch(),children:l(`list.retry`)})]}),(0,b.jsxs)(`div`,{ref:h,className:`flex flex-col items-center gap-2 py-2 text-sm text-muted-foreground`,children:[p.length>0&&(0,b.jsx)(`span`,{children:m===null?l(`list.showing`,{shown:E_(p.length)}):l(`list.showingOf`,{shown:E_(p.length),total:E_(m)})}),g&&(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:_,onClick:()=>void v(),children:l(_?`common.loading`:`list.loadMore`)})]})]})}function HA({schema:e,item:t,columns:n}){let r=Object.entries(e.list.computed??{}).filter(([t])=>e.list.columns.includes(t));if(r.length>0)return(0,b.jsx)(UA,{schema:e,item:t,computed:r});let i=e.list.mobile,a=typeof t._title==`string`?t._title:String(t._id);if(!i)return(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`div`,{className:`text-[14.5px] font-semibold`,children:a}),(0,b.jsx)(`dl`,{className:`mt-1 grid grid-cols-2 gap-x-3 gap-y-0.5 text-sm`,children:n.filter(e=>sC(t[e.name],e)!==t._title).map(e=>(0,b.jsxs)(y.Fragment,{children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`truncate`,children:(0,b.jsx)(lD,{value:t[e.name],field:e,record:t,plain:!0})})]},e.name))})]});let o=t=>t?e.fields.find(e=>e.name===t):void 0,s=o(i.title),c=o(i.subtitle),l=o(i.badge),u=i.meta.map(o).filter(e=>e!==void 0);return(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,b.jsx)(`span`,{className:`min-w-0 truncate text-[14.5px] font-semibold`,children:s?sC(t[s.name],s):a}),l&&t[l.name]!==null&&t[l.name]!==void 0&&(0,b.jsx)(cD,{value:t[l.name],field:l,className:`shrink-0`})]}),c&&(0,b.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:sC(t[c.name],c)}),u.length>0&&(0,b.jsx)(`dl`,{className:`mt-1 flex flex-wrap gap-x-4 gap-y-0.5 text-sm`,children:u.map(e=>(0,b.jsxs)(`div`,{className:`flex gap-1`,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(lD,{value:t[e.name],field:e,record:t,plain:!0})})]},e.name))})]})}function UA({schema:e,item:t,computed:n}){let r=e=>n.filter(([,t])=>t.kind===e),i=([n,r],i=!0)=>(0,b.jsx)(WO,{schema:e,name:n,column:r,item:t,compact:i},n),[a]=r(`image`),[o]=r(`title`);return(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-3`,children:[a&&i(a),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,b.jsx)(`div`,{className:`min-w-0 flex-1`,children:o?i(o):(0,b.jsx)(`span`,{className:`text-[14.5px] font-semibold`,children:typeof t._title==`string`?t._title:String(t._id)})}),r(`toggle`).map(e=>i(e))]}),r(`money`).map(e=>i(e)),(r(`badge`).length>0||r(`count`).length>0)&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[r(`badge`).map(e=>i(e)),r(`count`).map(([e,n])=>(0,b.jsxs)(aD,{tone:`neutral`,children:[UO(n,t._computed?.[e]).text,` `,n.label]},e))]})]})]})}function WA({schema:e,item:t,onClose:n}){let r=X(),i=(0,y.useRef)(null);t&&!i.current&&(i.current=document.activeElement);let a=t?String(t._id):void 0,o=Cv(e.name,a).data??t,s=typeof o?._title==`string`?o._title:`#${a}`,c=e.fields.filter(e=>e.persisted&&!e.name.includes(`.`)&&o!==void 0&&Object.hasOwn(o,e.name));return(0,b.jsx)(Yd,{open:t!==void 0,onOpenChange:e=>!e&&n(),children:(0,b.jsxs)(tf,{children:[(0,b.jsx)(rf,{className:aT}),(0,b.jsxs)(cf,{className:`fixed inset-y-0 end-0 z-50 flex w-full max-w-md flex-col border-s bg-background shadow-xl outline-none`,"aria-describedby":void 0,onCloseAutoFocus:e=>{e.preventDefault(),i.current?.focus(),i.current=null},children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 border-b p-4`,children:[(0,b.jsx)(pf,{className:`min-w-0 flex-1 truncate text-lg font-semibold`,children:r(`list.quickView`,{name:s})}),(0,b.jsx)(hf,{asChild:!0,children:(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":r(`list.close`),children:(0,b.jsx)(XS,{})})})]}),(0,b.jsx)(`dl`,{className:`grid flex-1 grid-cols-[minmax(6rem,auto)_1fr] content-start gap-x-4 gap-y-2 overflow-y-auto p-4 text-sm`,children:c.map(e=>(0,b.jsxs)(`div`,{className:`contents`,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`break-words`,children:(0,b.jsx)(lD,{value:o[e.name],field:e,record:o,detailed:!0})})]},e.name))}),(0,b.jsxs)(`div`,{className:`flex gap-2 border-t p-4`,children:[(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(xo,{to:`/${e.name}/${encodeURIComponent(a??``)}`,children:[(0,b.jsx)(Px,{}),r(`list.edit`)]})}),(0,b.jsx)(hf,{asChild:!0,children:(0,b.jsx)(q,{variant:`outline`,children:r(`list.close`)})})]})]})]})})}function GA({className:e,...t}){return(0,b.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full`,children:(0,b.jsx)(`table`,{"data-slot":`table`,className:U(`w-full caption-bottom text-[13px]`,e),...t})})}function KA({className:e,...t}){return(0,b.jsx)(`thead`,{"data-slot":`table-header`,className:U(`[&_tr]:border-b`,e),...t})}function qA({className:e,...t}){return(0,b.jsx)(`tbody`,{"data-slot":`table-body`,className:U(`[&_tr:last-child]:border-0`,e),...t})}function JA({className:e,...t}){return(0,b.jsx)(`tr`,{"data-slot":`table-row`,className:U(`border-b border-border transition-colors hover:bg-[color-mix(in_oklab,var(--muted)_60%,transparent)] has-aria-expanded:bg-muted/50 data-[state=selected]:bg-primary-soft`,e),...t})}function YA({className:e,...t}){return(0,b.jsx)(`th`,{"data-slot":`table-head`,className:U(`px-3.5 py-2.5 text-start align-middle text-[12.5px] font-medium whitespace-nowrap text-muted-foreground bg-[color-mix(in_oklab,var(--muted)_50%,transparent)] [&:has([role=checkbox])]:pe-0`,e),...t})}function XA({className:e,...t}){return(0,b.jsx)(`td`,{"data-slot":`table-cell`,className:U(`px-3.5 py-2.5 align-middle whitespace-nowrap [&:has([role=checkbox])]:pe-0`,e),...t})}function ZA(e){let t=e.map(e=>String(e).replace(/~/g,`~0`).replace(/,/g,`~1`)).join(`,`);return t===`new`?`~new`:t}function QA(){let{resource:e=``}=$i(),[t,n]=To(),r=Math.max(1,Number(t.get(`page`))||1),i=t.get(`sort`)??void 0,a=yv(e),o=xA(),s=Sv(e,vw(t),!o),[c,l]=(0,y.useState)(!1),u=S(),d=X(),f=pt({mutationFn:t=>Q.restore(e,t),onSuccess:()=>u.invalidateQueries({queryKey:[`list`,e]})}),p=t.get(`trashed`)===`only`,m=uA(e),h=vw(t),g=(()=>{let e=new URLSearchParams(h);return e.delete(`page`),e.delete(`after`),e.toString()})(),[_,v]=(0,y.useState)(new Set);(0,y.useEffect)(()=>v(new Set),[h,e]);let[x,C]=(0,y.useState)(),[w,T]=(0,y.useState)(!1),[E,D]=(0,y.useState)();(0,y.useEffect)(()=>D(void 0),[e]);let O=pt({mutationFn:t=>Q.bulkDelete(e,t),onSuccess:async t=>{v(new Set),T(!1),D({title:d(`list.bulkDeleted`,{count:t.ok.length}),result:t}),await u.invalidateQueries({queryKey:[`list`,e]})},onError:()=>T(!1)}),[k,A]=(0,y.useState)([]),j=t.has(`after`);if((0,y.useEffect)(()=>{j||A([])},[j]),a.isPending)return(0,b.jsx)(W,{children:d(`common.loading`)});if(a.isError)return(0,b.jsx)(W,{tone:`error`,children:a.error.message});let M=a.data,N=aA(M.list.columns,m).flatMap(e=>{let t=M.list.computed?.[e];if(t)return[{name:e,label:t.label,computed:t}];let n=M.fields.find(t=>t.name===e);return n?[{name:e,label:n.label,field:n}]:[]}),ee=N.flatMap(e=>e.field&&!M.primaryKeys.includes(e.name)?[e.field]:[]);for(let e=N.length-2;e>=0;e--)N[e].computed?.kind===`image`&&N[e+1].computed?.kind===`title`&&(N[e+1]={...N[e+1],image:N[e]},N.splice(e,1));let P=N.findIndex(e=>e.computed?.kind!==`image`&&e.computed?.kind!==`toggle`),F=i?{field:i.replace(/^-/,``),direction:i.startsWith(`-`)?`desc`:`asc`}:M.list.defaultSort,te=s.data?.items??[],ne=M.list.pagination===`keyset`,re=t.get(`after`),ie=ne?{summary:Cw(s.data,1).summary,label:d(`list.page`,{page:k.length+1}),hasNext:!!s.data?.nextCursor}:Cw(s.data,r),ae=ne?k.length>0:r>1;function oe(){if(!ne)return fe({page:String(r+1)});A([...k,re??``]),fe({after:s.data?.nextCursor??null})}function se(){if(!ne)return fe({page:String(r-1)});let e=k[k.length-1];A(k.slice(0,-1)),fe({after:e||null})}let ce=M.permissions??{create:!0,update:!0,delete:!0,purge:!0},le=!p&&(ce.delete||tO(M,[]).length>0||(M.prints??[]).some(e=>e.bulk)),ue=tO(M,te.filter(e=>_.has(String(e._id)))),de=e=>`/${M.name}/${encodeURIComponent(String(e._id))}`;function fe(e){n(t=>Sw(t,e))}function pe(e){fe({sort:F.field===e&&F.direction===`asc`?`-${e}`:e})}let me=`border-transparent bg-transparent text-inherit hover:bg-background/15`,I=le&&_.size>0&&(0,b.jsxs)(`div`,{role:`region`,"aria-label":d(`list.selected`,{count:_.size}),className:U(`flex flex-wrap items-center gap-2 text-sm`,o?`fixed inset-x-3 bottom-4 z-30 rounded-[14px] bg-foreground py-1.5 ps-2 pe-1.5 text-background shadow-[0_12px_32px_rgba(0,0,0,.25)]`:`border-b bg-primary-soft px-3.5 py-2`),children:[(0,b.jsx)(`span`,{className:U(`font-semibold`,o?`flex-1 text-sm`:`pe-1.5 text-primary`),children:d(`list.selected`,{count:_.size})}),(0,b.jsx)(DO,{schema:M,ids:[..._],bulkOnly:!0,size:`sm`}),ue.map(e=>(0,b.jsx)(TO,{resource:M.name,action:e,ids:[..._],size:`sm`,className:o?me:void 0,onDone:(t,n)=>{let r=sO(t,n);v(new Set),O.reset(),D({title:d(`action.bulkDone`,{action:e.label,count:r.ok.length}),result:r})}},e.name)),ce.delete?w?(0,b.jsx)(q,{variant:`destructive`,size:`sm`,disabled:O.isPending,onClick:()=>O.mutate([..._]),children:d(`list.confirmDeleteSelected`,{count:_.size})}):(0,b.jsxs)(q,{variant:`outline`,size:o?`icon-sm`:`sm`,className:o?me:`text-destructive`,"aria-label":o?d(`list.deleteSelected`):void 0,onClick:()=>T(!0),children:[(0,b.jsx)(AS,{}),!o&&d(`list.deleteSelected`)]}):null,(0,b.jsx)(q,{variant:`ghost`,size:o?`icon-sm`:`sm`,className:o?U(me,`-order-1`):`ms-auto`,"aria-label":o?d(`list.clearSelection`):void 0,onClick:()=>v(new Set),children:o?(0,b.jsx)(XS,{}):d(`list.clearSelection`)})]});return(0,b.jsxs)(`div`,{className:U(`flex flex-col gap-4`,o&&_.size>0&&`pb-16`),children:[(0,b.jsxs)(`div`,{className:U(`flex flex-wrap gap-3`,o?`items-center gap-2`:`items-end`),children:[(0,b.jsxs)(`div`,{className:U(`flex gap-0.5`,o?`items-baseline gap-1.5`:`flex-col`),children:[(0,b.jsx)(`h1`,{className:o?`text-base font-semibold`:`text-[22px] font-bold`,children:M.label}),s.data&&s.data.total!==null&&(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:Cw(s.data,r).summary})]}),(0,b.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[M.softDelete&&ce.delete&&(0,b.jsxs)(q,{variant:p?`secondary`:`outline`,size:o?`icon`:`default`,"aria-pressed":p,"aria-label":o?d(`list.trash`):void 0,onClick:()=>fe({trashed:p?null:`only`}),children:[(0,b.jsx)(AS,{}),!o&&d(`list.trash`)]}),o&&le&&(0,b.jsx)(q,{variant:c?`secondary`:`outline`,size:`icon`,"aria-pressed":c,"aria-label":d(c?`list.done`:`list.select`),onClick:()=>{l(!c),v(new Set)},children:(0,b.jsx)(ox,{})}),!p&&nO(M).map(e=>(0,b.jsx)(TO,{resource:M.name,action:e,onDone:()=>void 0},e.name)),!p&&(0,b.jsx)(OO,{schema:M,query:rj(t),iconOnly:o}),M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:o?`icon`:`default`,className:U(o&&`size-10`),children:(0,b.jsxs)(xo,{to:`/${M.name}/new`,"aria-label":o?d(`list.new`):void 0,children:[(0,b.jsx)(Hx,{}),!o&&d(`list.new`)]})})]})]}),M.list.tabs&&M.list.tabs.length>0&&!p&&(0,b.jsx)($A,{schema:M,params:t,onChange:fe}),(0,b.jsx)(CA,{schema:M,params:t,onChange:fe,trailing:(0,b.jsx)(dA,{schema:M,prefs:m})}),s.isError&&(0,b.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[(0,b.jsxs)(`span`,{children:[d(`list.loadFailed`),` `,z_(s.error)]}),(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void s.refetch(),children:d(`list.retry`)})]}),f.isError&&(0,b.jsx)(W,{tone:`error`,children:z_(f.error)}),p&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d(`list.trashNote`)}),o&&I,E&&(0,b.jsx)(nj,{title:E.title,result:E.result,items:te}),O.isError&&(0,b.jsx)(W,{tone:`error`,children:z_(O.error)}),o?(0,b.jsx)(VA,{schema:M,query:g,columns:ee,trash:p,selectMode:c,selected:_,onSelect:v,restore:e=>(0,b.jsx)(tj,{item:e,pending:f.isPending,onRestore:e=>f.mutate(e)}),empty:(0,b.jsxs)(b.Fragment,{children:[d(bw(t)?`list.noMatches`:`list.noRecords`),!bw(t)&&M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,children:(0,b.jsxs)(xo,{to:`/${M.name}/new`,children:[(0,b.jsx)(Hx,{}),d(`list.new`)]})})]})}):(0,b.jsx)(b.Fragment,{children:(0,b.jsxs)(`section`,{className:`overflow-hidden rounded-card border bg-card shadow-card`,children:[I,(0,b.jsx)(`div`,{className:`overflow-x-auto`,children:(0,b.jsxs)(GA,{className:U(m.density===`compact`&&`[&_td]:py-1 [&_th]:h-8`),children:[(0,b.jsx)(KA,{children:(0,b.jsxs)(JA,{children:[le&&(0,b.jsx)(YA,{className:`w-0`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":d(`list.selectPage`),checked:te.length>0&&te.every(e=>_.has(String(e._id))),onChange:e=>v(e.target.checked?new Set(te.map(e=>String(e._id))):new Set)})}),N.map(e=>(0,b.jsxs)(YA,{className:`relative`,style:m.widths[e.name]?{width:m.widths[e.name],minWidth:m.widths[e.name]}:void 0,"aria-sort":F.field===e.name?F.direction===`asc`?`ascending`:`descending`:void 0,children:[M.list.sortable.includes(e.name)?(0,b.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1`,onClick:()=>pe(e.name),children:[e.label,F.field===e.name&&(F.direction===`asc`?(0,b.jsx)(wy,{className:`size-3.5`}):(0,b.jsx)(by,{className:`size-3.5`}))]}):e.label,(0,b.jsx)(fA,{resource:M.name,column:e.name,label:e.label,width:m.widths[e.name]})]},e.name)),p&&(0,b.jsx)(YA,{className:`w-0`,children:(0,b.jsx)(`span`,{className:`sr-only`,children:d(`list.actions`)})})]})}),(0,b.jsxs)(qA,{children:[s.isPending&&Array.from({length:5},(e,t)=>(0,b.jsxs)(JA,{"aria-hidden":!0,children:[le&&(0,b.jsx)(XA,{}),N.map(e=>(0,b.jsx)(XA,{children:(0,b.jsx)(`div`,{className:`h-4 w-3/4 animate-pulse rounded bg-muted`})},e.name))]},`skeleton-${t}`)),te.map(e=>(0,b.jsxs)(JA,{"data-state":_.has(String(e._id))?`selected`:void 0,className:p?void 0:`cursor-pointer focus-visible:bg-muted/50 focus-visible:outline-none`,tabIndex:p?void 0:0,onClick:p?void 0:()=>C(e),onKeyDown:p?void 0:t=>{t.key===`Enter`&&t.target===t.currentTarget&&(t.preventDefault(),C(e))},children:[le&&(0,b.jsx)(XA,{onClick:e=>e.stopPropagation(),children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":d(`list.selectRow`,{name:String(e._title??e._id)}),checked:_.has(String(e._id)),onChange:t=>{let n=new Set(_);t.target.checked?n.add(String(e._id)):n.delete(String(e._id)),v(n)}})}),N.map((t,n)=>(0,b.jsx)(XA,{children:t.computed?(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[t.image&&(0,b.jsx)(WO,{schema:M,name:t.image.name,column:t.image.computed,item:e}),n===P&&!p?(0,b.jsx)(xo,{to:de(e),className:`min-w-0 hover:underline`,onClick:e=>e.stopPropagation(),children:(0,b.jsx)(WO,{schema:M,name:t.name,column:t.computed,item:e})}):(0,b.jsx)(WO,{schema:M,name:t.name,column:t.computed,item:e})]}):n===P&&!p?(0,b.jsx)(xo,{to:de(e),className:`font-semibold hover:underline`,onClick:e=>e.stopPropagation(),children:sC(e[t.name],t.field)}):!p&&M.list.editable.includes(t.name)&&!(Array.isArray(e._readonly)&&e._readonly.includes(t.name))&&e._perm?.update!==!1?(0,b.jsx)(mA,{schema:M,item:e,field:t.field}):(0,b.jsx)(ej,{value:e[t.name],field:t.field,record:e})},t.name)),p&&(0,b.jsx)(XA,{children:(0,b.jsx)(tj,{item:e,pending:f.isPending,onRestore:e=>f.mutate(e)})})]},String(e._id))),s.isSuccess&&te.length===0&&(0,b.jsx)(JA,{children:(0,b.jsx)(XA,{colSpan:N.length+(p||le?1:0),className:`text-center text-muted-foreground`,children:(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6`,children:[d(bw(t)?`list.noMatches`:`list.noRecords`),!bw(t)&&M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,children:(0,b.jsxs)(xo,{to:`/${M.name}/new`,children:[(0,b.jsx)(Hx,{}),d(`list.new`)]})})]})})})]})]})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-t px-3.5 py-2.5 text-[13px] text-muted-foreground`,children:[(0,b.jsx)(`span`,{children:ww(s.data,ne?1:r,te.length)||ie.summary}),(0,b.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[!ne&&(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{id:`list-page-size-label`,children:d(`list.rowsPerPage`)}),(0,b.jsx)(Pw,{"aria-label":d(`list.rowsPerPage`),className:`w-auto min-w-16`,value:String(s.data?.pageSize??M.list.pageSize),onValueChange:e=>fe({pageSize:Number(e)===M.list.pageSize?null:e}),options:Tw(M.list.pageSize).map(e=>({value:String(e),label:E_(e)}))})]}),(0,b.jsx)(`span`,{children:ie.label}),(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,"aria-label":d(`list.previousPage`),disabled:!ae,onClick:se,children:(0,b.jsx)(Qy,{className:`rtl:rotate-180`})}),(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,"aria-label":d(`list.nextPage`),disabled:!ie.hasNext,onClick:oe,children:(0,b.jsx)(eb,{className:`rtl:rotate-180`})})]})]})]})}),(0,b.jsx)(WA,{schema:M,item:x,onClose:()=>C(void 0)})]})}function $A({schema:e,params:t,onChange:n}){let r=ft({queryKey:[`list`,e.name,`tab-counts`],queryFn:()=>Q.tabCounts(e.name)}),i=e.list.tabs,a=kw(i,t);return(0,b.jsx)(`div`,{className:`overflow-x-auto`,children:(0,b.jsx)(Wk,{items:i.map(e=>{let t=r.data?.[e.key];return{key:e.key,label:e.label,...t?{count:E_(t.count),estimate:t.estimate}:{}}}),value:a?.key??``,onChange:e=>n(Aw(i.find(t=>t.key===e),t))})})}function ej({value:e,field:t,record:n}){let r=t.relation?.resource;if(!r||e==null)return(0,b.jsx)(lD,{value:e,field:t,record:n});let i=(Array.isArray(e)?e:[e]).filter(UE);return i.length===0?(0,b.jsx)(b.Fragment,{children:sC(e,t)}):(0,b.jsx)(b.Fragment,{children:i.map((e,t)=>(0,b.jsxs)(y.Fragment,{children:[t>0&&`, `,(0,b.jsx)(xo,{to:`/${r}/${encodeURIComponent(ZA([e.id]))}`,className:`hover:underline`,onClick:e=>e.stopPropagation(),children:e.title})]},String(e.id)))})}function tj({item:e,pending:t,onRestore:n}){let r=X();return(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:t,"aria-label":r(`list.restoreRecord`,{name:String(e._title??e._id)}),onClick:()=>n(String(e._id)),children:[(0,b.jsx)(Qx,{}),r(`list.restore`)]})}function nj({title:e,result:t,items:n}){let r=X(),i=e=>{let t=n.find(t=>String(t._id)===e);return typeof t?._title==`string`?t._title:`#${e}`};return(0,b.jsxs)(`div`,{role:`status`,className:`rounded-lg border px-3 py-2 text-sm`,children:[(0,b.jsxs)(`p`,{children:[e,t.failed.length>0&&` · ${r(`list.bulkFailed`,{count:t.failed.length})}`]}),t.failed.length>0&&(0,b.jsx)(`ul`,{className:`mt-1 list-disc ps-5 text-destructive`,children:t.failed.map(e=>(0,b.jsxs)(`li`,{children:[i(e.id),`: `,e.message]},e.id))})]})}function rj(e){let t=new URLSearchParams(e);for(let e of[`page`,`pageSize`,`after`])t.delete(e);return t}function ij(){let e=X();return(0,b.jsx)(W,{children:e(`common.pageNotFound`)})}function aj(e){let t=eD(e.schema.fields.filter(e=>!e.secret),{...e.values,_files:e.files});for(let n of e.schema.fields)n.secret&&(t[n.name]=``);return t}function oj(e,t,n){let r=e.filter(e=>hO(e,t)),i=r.filter(e=>!e.secret),{payload:a,errors:o}=nD(i,t,n),s=nD(i.filter(e=>e.type===`object`&&!e.many&&Object.hasOwn(a,e.name)),t);Object.assign(a,s.payload),Object.assign(o,s.errors);for(let e of r){if(!e.secret)continue;let n=t[e.name];n===null?a[e.name]=null:typeof n==`string`&&n.trim()!==``&&(a[e.name]=n)}return{payload:a,errors:o}}function sj(e,t){let n=new Set(t.fields.filter(e=>e.secret).map(e=>e.name)),r=Object.entries(t.constraints).filter(([t])=>Object.hasOwn(e,t.split(`.`)[0])),i=r.filter(([e])=>!e.includes(`.`)).map(([e,t])=>[e,n.has(e)?{...t,required:!1}:t]),a=r.filter(([e])=>e.includes(`.`));return{...SO(e,Object.fromEntries(a),`create`),...SO(e,Object.fromEntries(i),`update`)}}function cj(){let e=X(),{page:t=``}=$i(),n=xv(t);return n.isPending?(0,b.jsx)(W,{children:e(`common.loading`)}):n.isError?(0,b.jsx)(W,{tone:`error`,children:z_(n.error)}):(0,b.jsx)(lj,{page:n.data},t)}function lj({page:e}){let t=X(),{locale:n}=Y(),r=S(),{schema:i}=e,a=i.fields.map(e=>e.name),[o,s]=(0,y.useState)(()=>aj(e)),[c,l]=(0,y.useState)(o),[u,d]=(0,y.useState)([]),[f,p]=(0,y.useState)({}),[m,h]=(0,y.useState)(null),[g,_]=(0,y.useState)(null),v=RO(()=>h(null)),x=JSON.stringify(c)!==JSON.stringify(o),{blocker:C}=FO(x),w=(0,y.useRef)(null);LO(w);let T=(e,t)=>l(n=>({...n,[e]:t})),E=pt({mutationFn:e=>Q.savePage(i.name,e),gcTime:0,onSuccess:e=>{E.reset();let a=aj(e);r.setQueryData([`page`,i.name,n],e),s(a),l(a),d([]),p({}),_(t(`form.savedName`,{name:e.schema.label}))},onError:e=>{let t=cO(e,a);p(t.fields),h(t.form)}});function D(e){if(e.preventDefault(),i.readonly)return;if(_(null),v.busy){h(t(`upload.busy`)),v.refuse();return}let{payload:n,errors:r}=oj(i.fields,c,o),a={...sj(n,i),...r};if(p(a),h(null),!(Object.keys(a).length>0)){if(Object.keys(n).length===0){l(o),d([]);return}E.mutate(n)}}let O={...e.values,_files:e.files};function k(t){let n=i.fields.find(e=>e.name===t);if(!n||!hO(n,c))return null;let r=i.required.includes(t);return n.secret?(0,b.jsx)(uj,{field:n,stored:e.secrets[t]===!0,value:c[t],replacing:u.includes(t),readOnly:i.readonly,required:r,errors:f[t],onChange:e=>T(t,e),onReplacing:e=>d(n=>e?[...n,t]:n.filter(e=>e!==t))}):i.readonly?(0,b.jsx)(xk,{resource:`page:${i.name}`,field:n,record:O}):n.type===`object`?(0,b.jsx)(ZD,{resource:`page:${i.name}`,field:n,path:t,pattern:t,value:c[t],constraints:i.constraints,markRequired:!0,errors:f,onChange:e=>T(t,e)}):(0,b.jsx)(zD,{resource:`page:${i.name}`,field:n,value:c[t],required:r,errors:f[t],constraints:i.constraints[t],onChange:e=>T(t,e),onBusy:e=>v.setBusy(t,e)})}return(0,b.jsxs)(`form`,{ref:w,onSubmit:D,noValidate:!0,className:U(`flex flex-col gap-5`,i.layout?.length?`max-w-4xl`:`max-w-2xl`),children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:i.label}),i.readonly&&(0,b.jsx)(`p`,{role:`note`,className:`rounded-md border bg-muted/40 px-3 py-2 text-sm text-muted-foreground`,children:t(`settings.viewOnly`)}),g&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:g}),(0,b.jsx)(IO,{blocker:C}),m&&(0,b.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:m}),(0,b.jsx)(WD,{layout:i.layout,names:a,errors:f,render:k}),!i.readonly&&(0,b.jsxs)(zO,{dirty:x,children:[x&&(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:E.isPending,onClick:()=>{l(o),d([]),p({}),h(null)},children:t(`settings.discard`)}),(0,b.jsxs)(q,{type:`submit`,disabled:E.isPending||v.busy,"aria-keyshortcuts":`Control+S Meta+S`,children:[t(E.isPending?`form.saving`:`form.save`),(0,b.jsx)(BO,{})]})]})]})}function uj({field:e,stored:t,value:n,replacing:r,readOnly:i,required:a,errors:o,onChange:s,onReplacing:c}){let l=X(),u=`field-${e.name}`,d=`${u}-label`,f=`${u}-help`,p=`${u}-error`,m=(o?.length??0)>0,h=[e.help?f:void 0,m?p:void 0].filter(Boolean).join(` `)||void 0,g=n===null,_=!i&&!g&&(!t||r);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-secret":e.name,children:[(0,b.jsxs)(`label`,{id:d,htmlFor:_?u:void 0,className:`text-sm font-medium`,children:[e.label,a&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`text-destructive`,children:`*`})]}),_?(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(e_,{id:u,type:`password`,autoComplete:`new-password`,dir:`ltr`,className:`min-w-0 flex-1`,value:typeof n==`string`?n:``,autoFocus:r,"aria-invalid":m?!0:void 0,"aria-describedby":h,onChange:e=>s(e.target.value)}),t&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{s(``),c(!1)},children:l(`secret.keep`)})]}):(0,b.jsx)(`div`,{role:`group`,"aria-labelledby":d,"aria-describedby":h,className:`flex min-h-8 flex-wrap items-center gap-2 text-sm`,children:g?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`text-amber-800 dark:text-amber-300`,children:l(`secret.willClear`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>s(``),children:l(`secret.undo`)})]}):t?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-medium text-green-800 dark:text-green-300`,children:[l(`secret.set`),(0,b.jsx)(Jy,{className:`size-4`,"aria-hidden":!0})]}),!i&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"aria-label":l(`secret.replaceName`,{name:e.label}),onClick:()=>c(!0),children:l(`secret.replace`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":l(`secret.clearName`,{name:e.label}),onClick:()=>s(null),children:l(`secret.clear`)})]})]}):(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:l(`secret.notSet`)})}),e.help&&(0,b.jsx)(`p`,{id:f,className:`text-sm text-muted-foreground`,children:e.help}),m&&(0,b.jsx)(`p`,{id:p,className:`text-sm text-destructive`,children:o.join(` `)})]})}document.title=L_.title,vT(hT()),TT(L_.branding),PT({branding:L_.branding.primaryColor}),rC(L_.currency),C_(L_.messages),ST(hT);var dj=new Qe({defaultOptions:{queries:{retry:1,staleTime:3e4}}}),fj=vo([{path:`login`,element:(0,b.jsx)(RE,{})},{element:(0,b.jsx)(PE,{}),children:[{index:!0,element:(0,b.jsx)(nA,{})},{path:`account`,element:(0,b.jsx)(Kv,{})},{path:`-/users`,element:(0,b.jsx)(nT,{})},{path:`-/users/new`,element:(0,b.jsx)(rT,{})},{path:`-/users/:id`,element:(0,b.jsx)(rT,{})},{path:`-/groups`,element:(0,b.jsx)(Uw,{})},{path:`-/groups/new`,element:(0,b.jsx)(Ww,{})},{path:`-/groups/:id`,element:(0,b.jsx)(Ww,{})},{path:`-/roles`,element:(0,b.jsx)(tT,{})},{path:`-/roles/new`,element:(0,b.jsx)(Qw,{})},{path:`-/roles/:name`,element:(0,b.jsx)(Qw,{})},{path:`-/debugger`,element:(0,b.jsx)(Bw,{})},{path:`-/audit`,element:(0,b.jsx)(Lw,{})},{path:`g/:group`,element:(0,b.jsx)(Tk,{})},{path:`p/:page`,element:(0,b.jsx)(cj,{})},{path:`:resource`,element:(0,b.jsx)(QA,{})},{path:`:resource/new`,element:(0,b.jsx)(mk,{mode:`create`})},{path:`:resource/:id`,element:(0,b.jsx)(mk,{mode:`edit`})},{path:`*`,element:(0,b.jsx)(ij,{})}]}],{basename:L_.basePath});W_(()=>{let e=K_(fj.state.location.pathname,L_.basePath),{search:t}=fj.state.location;e!==`/login`&&(dj.clear(),fj.navigate(`/login?${new URLSearchParams({next:e+t})}`,{replace:!0}))}),(0,qa.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(y.StrictMode,{children:(0,b.jsx)(F_,{locales:L_.locales,fallback:L_.locale,children:(0,b.jsx)(C,{client:dj,children:(0,b.jsx)(wa,{router:fj})})})}));export{o as _,AS as a,cb as c,e_ as d,q as f,u as g,m as h,Pw as i,$ as l,v as m,yD as n,ux as o,U as p,hD as r,ix as s,bD as t,X as u,c as v};
|
|
57
|
+
`)?f:void 0,m={...o.length?{create:o}:{},...s.length?{update:s}:{},...u.length?{delete:u}:{},...p?{order:p}:{}};return{changes:Object.keys(m).length?m:void 0,errors:a}}function lk(e,t,n,r,i){let a={},o={};for(let s of e){let e=t[s.inline];if(!e||s.readonly)continue;let c=r[s.inline]??[],l=ck(s,e,n[s.inline]??[],c),u=l.changes?i(s,c.length):null;(Object.keys(l.errors).length>0||u)&&(o[s.inline]={rows:l.errors,inline:u?[u]:[]}),l.changes&&(a[s.inline]=l.changes)}return{changes:Object.keys(a).length?a:void 0,errors:o}}function uk(e,t){let n={},r={};for(let[i,a]of Object.entries(e)){if(i!==`_inlines`&&!i.startsWith(`_inlines.`)){r[i]=a;continue}let[,e=``,o,s,...c]=i.split(`.`),l=n[e]??={rows:{},inline:[]},u=o===`create`?t?.[e]?.create?.[Number(s)]?._key:o===`update`||o===`delete`?s:void 0,d=c.join(`.`);u===void 0||o===`create`&&!/^\d+$/.test(s??``)||d===``?l.inline.push(...a):((l.rows[u]??={})[d]??=[]).push(...a)}return{inlines:n,parent:r}}var dk=e=>Object.values(e).some(e=>e.inline.length>0||Object.keys(e.rows).length>0);function fk({inline:e,child:t,rows:n,onChange:r,readOnly:i,errors:a,parent:o,parentValues:s,onBusy:c,truncated:l,canAdd:u=!0}){let d=X(),f=(0,y.useId)(),p=ik(e,t),m=(0,y.useRef)(0),[h,g]=(0,y.useState)(null),_=!i&&u&&t.permissions?.create!==!1&&t.form.create.length>0&&n.length<e.max,v=!i&&e.order!==void 0&&t.form.update.includes(e.order)&&n.length>1,x=e=>!i&&(e.id===void 0||t.permissions?.delete!==!1&&e.record?._perm?.delete!==!1),S=e=>s===void 0?void 0:JSON.stringify({...JSON.parse(lD(p,e.values)??`{}`),_parent:JSON.parse(s)});function C(){let i;do i=`n${++m.current}`;while(n.some(e=>e.key===i));r([...n,ok(e,t,i)])}let w=(e,t,i)=>r(n.map(n=>n.key===e?{...n,values:{...n.values,[t]:i}}:n)),T=e=>r(n.filter(t=>t.key!==e));function E(e,t){if(t<0||t>=n.length||e===t)return;let i=[...n];i.splice(t,0,i.splice(e,1)[0]),r(i)}function D(n,r,s){let l=`inline-${t.name}-${n.key}`,u=a?.rows[n.key]??{},d=n.id===void 0;if(i||!(d?t.form.create:t.form.update).includes(r.name)||sk(n,t).has(r.name))return d?null:e.readonly&&s?(0,b.jsx)(hD,{value:n.record?.[r.name],field:r,record:n.record}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-readonly":r.name,children:[!s&&(0,b.jsx)(`span`,{className:`text-sm font-medium`,children:r.label}),(0,b.jsx)(`div`,{className:`min-h-8 rounded-lg bg-muted/50 px-2.5 py-1.5 text-sm break-words`,children:(0,b.jsx)(hD,{value:n.record?.[r.name],field:r,record:n.record})})]});let f=d?`create`:`update`;if(r.type===`object`)return(0,b.jsx)(rO,{resource:t.name,field:r,path:r.name,pattern:r.name,value:n.values[r.name],constraints:t.form.constraints[f],markRequired:d,errors:u,idPrefix:l,onChange:e=>w(n.key,r.name,e)});let p=rk([r],n.values)[r.name],m=(0,b.jsx)(GD,{resource:t.name,field:r,value:n.values[r.name],required:d&&t.form.requiredOnCreate.includes(r.name),errors:u[r.name],constraints:t.form.constraints[f][r.name],formValues:r.type===`relation`?S(n):void 0,parent:o,idPrefix:l,hideLabel:s,onChange:e=>w(n.key,r.name,e),onBusy:e=>c(`${t.name}:${n.key}:${r.name}`,e)});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[m,p&&(0,b.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-warn`,children:[(0,b.jsx)(FS,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),p]})]})}function O(t,r){let i=d(`inline.row`,{name:e.label,index:r+1});return(0,b.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`cursor-grab text-muted-foreground`,draggable:!0,"aria-hidden":!0,onDragStart:e=>{e.dataTransfer.effectAllowed=`move`,g(r)},onDragEnd:()=>g(null),children:(0,b.jsx)(Ub,{className:`size-4`})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:r===0,"aria-label":d(`inline.moveUp`,{name:i}),onClick:()=>E(r,r-1),children:(0,b.jsx)(ky,{})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:r===n.length-1,"aria-label":d(`inline.moveDown`,{name:i}),onClick:()=>E(r,r+1),children:(0,b.jsx)(Ty,{})})]}),x(t)&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":d(`inline.remove`,{name:i}),onClick:()=>T(t.key),children:(0,b.jsx)(NS,{})})]})}let k=e=>v?{onDragOver:e=>{h!==null&&e.preventDefault()},onDrop:t=>{t.preventDefault(),h!==null&&E(h,e),g(null)}}:{},A=e=>{let t=Object.entries(a?.rows[e.key]??{}).filter(([e])=>!p.some(t=>t.name===e.split(`.`)[0]));return t.length>0?(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:t.flatMap(([,e])=>e).join(` — `)}):null},j=v||n.some(x);return(0,b.jsxs)(`section`,{"aria-labelledby":f,className:`flex min-w-0 flex-col rounded-card border bg-card shadow-card`,"data-inline":t.name,children:[(0,b.jsxs)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 border-b px-5 py-3`,children:[(0,b.jsx)(`h2`,{id:f,className:`text-[15px] font-semibold`,children:e.label}),(0,b.jsx)(`span`,{className:`inline-flex h-5 items-center rounded-full bg-muted px-2 text-[11px] text-muted-foreground`,children:mk(d,e,n.length)}),_&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,className:`ms-auto`,onClick:C,children:[(0,b.jsx)(Gx,{}),d(`form.add`,{name:e.label})]})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 p-5 empty:hidden`,children:[l&&(0,b.jsxs)(`p`,{role:`note`,className:`text-sm text-muted-foreground`,children:[d(`inline.truncated`,{count:l.total-n.length}),` `,(0,b.jsx)(xo,{to:l.href,className:`text-primary hover:underline`,children:d(`inline.openList`)})]}),n.length===0&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d(`inline.empty`)}),n.length>0&&e.display===`table`&&(0,b.jsx)(`div`,{className:`relative -mx-5 overflow-x-auto border-y first:-mt-5 first:border-t-0 last:-mb-5 last:border-b-0`,children:(0,b.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,b.jsx)(`thead`,{className:`bg-[color-mix(in_oklab,var(--muted)_50%,transparent)] text-[12.5px] text-muted-foreground`,children:(0,b.jsxs)(`tr`,{children:[(e.computed??[]).map(e=>(0,b.jsx)(`th`,{scope:`col`,className:`px-3.5 py-2.5 text-start font-medium whitespace-nowrap`,children:t.list.computed?.[e]?.label},`~${e}`)),p.map(e=>(0,b.jsxs)(`th`,{scope:`col`,className:`px-3.5 py-2.5 text-start font-medium whitespace-nowrap`,children:[e.label,t.form.requiredOnCreate.includes(e.name)&&n.some(e=>e.id===void 0)&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`text-destructive`,children:`*`})]},e.name)),j&&(0,b.jsx)(`th`,{scope:`col`,className:`px-3.5 py-2.5`,children:(0,b.jsx)(`span`,{className:`sr-only`,children:d(`inline.rowActions`)})})]})}),(0,b.jsx)(`tbody`,{children:n.map((n,r)=>(0,b.jsxs)(`tr`,{"data-row":n.key,className:U(`border-t align-top`,h===r&&`opacity-50`),...k(r),children:[(e.computed??[]).map(e=>(0,b.jsx)(`td`,{className:`px-3.5 py-2`,children:n.record&&t.list.computed?.[e]&&(0,b.jsx)(XO,{schema:t,name:e,column:t.list.computed[e],item:n.record})},`~${e}`)),p.map(e=>(0,b.jsx)(`td`,{className:U(`px-3.5 py-2`,e.widget===`money`?`min-w-56`:e.type===`relation`?`min-w-52`:`min-w-36`),children:D(n,e,!0)},e.name)),j&&(0,b.jsx)(`td`,{className:`px-3.5 py-2`,children:O(n,r)})]},n.key))})]})}),e.display===`table`&&n.map(e=>(0,b.jsx)(y.Fragment,{children:A(e)},e.key)),e.display===`cards`&&n.map((n,r)=>(0,b.jsxs)(`div`,{"data-row":n.key,className:U(`flex flex-col gap-4 rounded-card border bg-background/40 p-4`,h===r&&`opacity-50`),...k(r),children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium`,children:[pk(n)??d(`inline.newRow`,{name:e.label,index:r+1}),r===0&&e.markFirst&&(0,b.jsx)(dD,{tone:`primary`,children:e.markFirst})]}),O(n,r)]}),(0,b.jsx)(XD,{plain:!0,layout:t.form.layout,names:p.map(e=>e.name),errors:a?.rows[n.key]??{},render:e=>{let t=p.find(t=>t.name===e);return t?D(n,t,!1):null}}),A(n)]},n.key)),a&&a.inline.length>0&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a.inline.join(` — `)})]})]})}var pk=e=>typeof e.record?._title==`string`?e.record._title:void 0;function mk(e,t,n){return t.min?e(`inline.limitsBetween`,{min:t.min,max:t.max,count:n}):e(`inline.limitsMax`,{max:t.max,count:n})}var hk=(e,t)=>t===void 0?[`history`,e]:[`history`,e,t];function gk({schema:e,id:t,record:n}){let r=X(),i=Cv(),a=mt({queryKey:hk(e.name,t),initialPageParam:void 0,queryFn:({pageParam:n})=>Q.history(e.name,t,n),getNextPageParam:e=>e.next,staleTime:0});if(a.isPending)return(0,b.jsx)(W,{children:r(`common.loading`)});if(a.isError&&!a.data)return(0,b.jsx)(W,{tone:`error`,children:W_(a.error)});let o=a.data.pages.flatMap(e=>e.entries);if(o.length===0)return(0,b.jsx)(W,{children:r(`audit.empty`)});let s=t=>t===e.name?e:void 0;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,b.jsx)(RC,{entries:o,now:new Date(a.dataUpdatedAt),names:hC(i.data,s),schemaOf:s,titleOf:(e,t)=>_k(n,e,t)}),a.isError&&(0,b.jsx)(W,{tone:`error`,children:W_(a.error)}),a.hasNextPage&&(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`self-center`,disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:r(a.isFetchingNextPage?`common.loading`:`list.loadMore`)})]})}function _k(e,t,n){let r=e?.[t],i=(Array.isArray(r)?r:[r]).find(e=>typeof e==`object`&&!!e&&String(e.id)===n);return typeof i?.title==`string`?i.title:void 0}function vk(e){return e.normalize(`NFKD`).replace(/\p{M}/gu,``).normalize(`NFC`).toLowerCase().replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-+|-+$/g,``)}function yk(e,t,n){let r=typeof t?._title==`string`?t._title:`#${n}`;return r.startsWith(`#`)?`${e} ${r}`:`${e}: ${r}`}function bk({mode:e}){let t=X(),{resource:n=``,id:r}=$i(),i=qi(),[a]=To(),o=e===`create`?a.get(`from`)??void 0:void 0,s=e===`edit`?r:o,c=wv(n),l=Ov(n,s),[u,d]=(0,y.useState)(0),f=`${n}:${r}`,[p,m]=(0,y.useState)({of:f,tab:`details`}),h=p.of===f?p.tab:`details`;if(c.isPending||s!==void 0&&l.isPending)return(0,b.jsx)(W,{children:t(`common.loading`)});if(c.isError)return(0,b.jsx)(W,{tone:`error`,children:c.error.message});if(s!==void 0&&l.isError)return(0,b.jsx)(W,{tone:`error`,children:l.error.message});let g=i.state?.saved;return(0,b.jsx)(Sk,{schema:c.data,mode:e,id:r,record:e===`edit`?l.data:void 0,source:o?l.data:void 0,saved:u===0?g:void 0,onChanged:()=>d(e=>e+1),tab:h,onTab:e=>m({of:f,tab:e})},e===`edit`?`${n}:${r}:${u}`:`${n}:new:${i.key}`)}function xk(e,t){let n=new Set(e.fields.filter(e=>e.primary||e.unique||e.readonly||e.file).map(e=>e.name)),r=new Set(e.fields.filter(e=>e.widget===`richtext`).map(e=>e.name));return Object.fromEntries(Object.entries(t).filter(([e])=>!n.has(e)&&!e.startsWith(`_`)).map(([e,t])=>[e,r.has(e)&&typeof t==`string`?rD(t):t]))}function Sk({schema:e,mode:t,id:n,record:r,source:i,saved:a,onChanged:o,tab:s,onTab:c}){let l=X(),{locale:u}=Y(),d=Yi(),f=S(),p=r?._perm,m=t===`create`||e.permissions?.update!==!1&&p?.update!==!1,h=e.permissions?.delete!==!1&&p?.delete!==!1,[g,_]=(0,y.useState)(!1),v=ek(e,t===`edit`?r:void 0,g),x=t===`edit`&&e.form.mode===`view`&&!g,C=new Set(t===`edit`?m&&!x?[...e.form.readonly,...Ek(r)]:[...e.form.update,...e.form.readonly]:[]),w=t===`create`?e.form.create:[...e.form.update,...e.form.readonly],T=e.fields.filter(e=>w.includes(e.name)),E=$O(e),D=T.filter(e=>!C.has(e.name)),O=D.map(e=>e.name),[k,A]=(0,y.useState)(r),[j,M]=(0,y.useState)(()=>{let t=oD(D,r??(i?xk(e,i):void 0));return vO(D,t,_O(D,t))}),[N,ee]=(0,y.useState)(j),P=(0,y.useRef)(_O(D,j));(0,y.useEffect)(()=>{if(!g||!r)return;let e=oD(D,r);P.current=_O(D,e),M(e),ee(e)},[g]);let F=Ck(e),te=t=>Object.fromEntries(F.map(n=>[n.inline,ak(n,e.inlines[n.inline],t)])),[ne,re]=(0,y.useState)(()=>te(r)),[ie,ae]=(0,y.useState)(ne),[oe,se]=(0,y.useState)({}),ce=(0,y.useRef)(void 0),le=e.version?k?.[e.version]:void 0,[ue,de]=(0,y.useState)(null),fe=lD(D,N),[pe,me]=(0,y.useState)({}),[I,L]=(0,y.useState)(null),he=Sv(),ge=t===`edit`&&n!==void 0&&he.data?.audit.enabled===!0&&!e.source,_e=ge?s:`details`,ve=(0,y.useRef)(new Set(D.filter(e=>e.widget===`slug`&&j[e.name]!==``).map(e=>e.name)));function ye(e,t){yO(D,P.current,e,t),ee(n=>{let r={...n,[e]:t};if(typeof t==`string`)for(let n of D)n.slugFrom===e&&!ve.current.has(n.name)&&(r[n.name]=vk(t));return vO(D,r,P.current)}),D.some(t=>t.name===e&&t.widget===`slug`)&&ve.current.add(e)}let[be,xe]=(0,y.useState)(a?l(`form.savedName`,{name:a}):null),Se=WO(()=>L(null)),Ce=JSON.stringify(N)!==JSON.stringify(j)||JSON.stringify(ie)!==JSON.stringify(ne),{blocker:we,release:Te}=VO(Ce),Ee=(0,y.useRef)(null),De=(0,y.useRef)(`list`);UO(Ee,()=>{De.current=`stay`});let Oe=pt({mutationFn:({payload:r,version:i})=>t===`create`?Q.create(e.name,r):Q.update(e.name,n,r,i),onSuccess:async(r,{then:i})=>{f.invalidateQueries({queryKey:hk(e.name)}),await f.invalidateQueries({queryKey:[`list`,e.name]});let a=typeof r._title==`string`?r._title:`#${String(r._id)}`;if(i===`stay`&&t===`edit`){let t=oD(D,r);P.current=_O(D,t);let i=te(r);A(r),M(t),ee(t),re(i),ae(i),se({}),xe(l(`form.savedName`,{name:a})),await f.invalidateQueries({queryKey:[`record`,e.name,n]});return}Te(),f.removeQueries({queryKey:[`record`,e.name]}),i===`new`?d(`/${e.name}/new`,{state:{saved:a}}):i===`stay`||t===`create`&&e.form.afterCreate===`edit`?d(`/${e.name}/${encodeURIComponent(String(r._id))}`,{replace:!0,state:{saved:a}}):d(`/${e.name}`)},onError:e=>{if(c(`details`),!(e instanceof U_)){L(e.message);return}if(e.status===409&&e.body.current){de(e.body.current);return}let t=mO(e,[...O,`_inlines`]),n=uk(t.fields,ce.current);me(n.parent),se(n.inlines),L(t.form)}}),[ke,Ae]=(0,y.useState)(!1),je=pt({mutationFn:()=>Q.remove(e.name,n,le),onSuccess:async()=>{Te(),await f.invalidateQueries({queryKey:[`list`,e.name]}),d(`/${e.name}`),f.removeQueries({queryKey:[`record`,e.name,n]})},onError:e=>{Ae(!1),L(W_(e))}}),Me=D.filter(e=>xO(e,N));function Ne(){let n=cD(Me,N,t===`edit`?j:void 0),r=lk(F,e.inlines??{},ne,ie,(e,t)=>e.min!==void 0&&t<e.min?l(`inline.countMin`,{min:e.min,count:t}):t>e.max?l(`inline.countMax`,{max:e.max,count:t}):null);return ce.current=r.changes,{payload:r.changes?{...n.payload,_inlines:r.changes}:n.payload,errors:n.errors,inlineErrors:r.errors}}function Pe(n){if(n.preventDefault(),!m)return;let r=n.nativeEvent.submitter,i=r?.value===`new`?`new`:r?`list`:De.current;if(De.current=`list`,xe(null),Se.busy){L(l(`upload.busy`)),Se.refuse();return}let{payload:a,errors:o,inlineErrors:s}=Ne(),u=t===`create`?`create`:`update`,d={...OO(a,Object.fromEntries(Object.entries(e.form.constraints[u]).filter(([e])=>Me.some(t=>t.name===e.split(`.`)[0]))),u),...o};me(d),se(s),L(null),Object.keys(d).length===0&&!dk(s)?Oe.mutate({payload:a,version:le,then:i}):c(`details`)}function Fe(t){de(null),Oe.mutate({payload:Ne().payload,version:e.version?t[e.version]:void 0,then:Oe.variables?.then??`list`})}function Ie(e){let t=oD(D,e);P.current=_O(D,t),de(null),A(e),M(t),ee(t),me({})}function Le(i){let a=e.inlines?.[i.inline];if(!a||t===`create`&&i.existingOnly)return null;let o=r?._inlines?.[i.inline],s=o?.truncated&&n!==void 0?{total:o.total,href:`/${a.name}?${new URLSearchParams({[`filter[${i.link}]`]:String(r?.[e.primaryKeys[0]]??n)})}`}:void 0;return(0,b.jsx)(fk,{inline:i,child:a,rows:ie[i.inline]??[],onChange:e=>ae(t=>({...t,[i.inline]:e})),readOnly:!m||x||i.readonly===!0||s!==void 0,errors:oe[i.inline],parent:e.name,parentValues:fe,onBusy:Se.setBusy,truncated:s,canAdd:(r?._perm)?.inlines?.[i.inline]?.create!==!1})}function Re(t){let n=nk(t,e,r);return n.length===0?null:(0,b.jsx)(gD,{title:t.title,bodyClassName:t.title?void 0:`p-5`,children:(0,b.jsx)(`dl`,{className:`flex flex-col gap-2 text-[13px]`,children:n.map((e,t)=>(0,b.jsxs)(`div`,{className:U(`flex items-baseline justify-between gap-3`,t===n.length-1&&n.length>1&&`border-t pt-2.5 text-sm font-bold`),children:[(0,b.jsx)(`dt`,{className:U(t===n.length-1&&n.length>1?``:`text-muted-foreground`),children:e.label}),(0,b.jsx)(`dd`,{children:e.text})]},e.label))})})}let ze=rk(D,N);function Be(e){let t=Ve(e);return t?(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[t,ze[e]&&(0,b.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-warn`,children:[(0,b.jsx)(FS,{className:`size-3.5`,"aria-hidden":!0}),ze[e]]})]}):null}function Ve(n){let i=T.find(e=>e.name===n);if(!i||!xO(i,N))return null;if(C.has(n))return(0,b.jsx)(Dk,{resource:e.name,field:i,record:r,plain:x});let a=t===`create`?`create`:`update`;return i.type===`object`?(0,b.jsx)(rO,{resource:e.name,field:i,path:i.name,pattern:i.name,value:N[i.name],constraints:e.form.constraints[a],markRequired:t===`create`,errors:pe,onChange:e=>ye(i.name,e)}):(0,b.jsx)(GD,{resource:e.name,field:i,value:N[i.name],required:t===`create`&&e.form.requiredOnCreate.includes(i.name),errors:pe[i.name],formValues:i.type===`relation`?fe:void 0,constraints:e.form.constraints[a][i.name],onChange:e=>ye(i.name,e),onBusy:e=>Se.setBusy(i.name,e)})}return(0,b.jsxs)(`form`,{ref:Ee,onSubmit:Pe,noValidate:!0,className:U(`flex flex-col gap-5`,v.aside.length>0?`max-w-[1400px]`:e.form.layout?.length?`max-w-4xl`:`max-w-2xl`),children:[t===`create`?(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(Ok,{to:`/${e.name}`}),(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:l(`form.new`,{name:e.label})})]}):(0,b.jsx)(kk,{schema:e,record:r,id:n,dirty:Ce,onGone:()=>{Te(),d(`/${e.name}`)},onChanged:o,badges:v.header.badges,subtitle:v.header.subtitle,extra:(0,b.jsxs)(b.Fragment,{children:[x&&m&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,onClick:()=>_(!0),children:[(0,b.jsx)(Lx,{}),l(`form.edit`)]}),e.creatable&&(0,b.jsx)(q,{asChild:!0,variant:`outline`,children:(0,b.jsxs)(xo,{to:`/${e.name}/new?${new URLSearchParams({from:n})}`,children:[(0,b.jsx)(pb,{}),l(`form.duplicate`)]})}),h&&(ke?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q,{type:`button`,variant:`destructive`,disabled:je.isPending,onClick:()=>je.mutate(),children:l(je.isPending?`form.deleting`:e.softDelete?`form.confirmMoveToTrash`:`form.confirmDelete`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>Ae(!1),children:l(`form.keep`)})]}):(0,b.jsxs)(q,{type:`button`,variant:`outline`,className:`text-destructive`,onClick:()=>Ae(!0),children:[(0,b.jsx)(NS,{}),l(e.softDelete?`form.moveToTrash`:`form.delete`)]}))]})}),i&&F.length>0&&(0,b.jsx)(`p`,{role:`note`,className:`rounded-md border bg-muted/40 px-3 py-2 text-sm text-muted-foreground`,children:l(`inline.duplicateNote`,{names:new Intl.ListFormat(u).format(F.map(e=>e.label))})}),!m&&e.form.mode!==`view`&&(0,b.jsx)(`p`,{role:`note`,className:`rounded-md border bg-muted/40 px-3 py-2 text-sm text-muted-foreground`,children:l(`form.viewOnly`)}),be&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:be}),(0,b.jsx)(HO,{blocker:we}),ge&&(0,b.jsx)(Tk,{active:_e,onChange:c}),ue&&(0,b.jsx)(Ak,{fields:D,before:k,current:ue,busy:Oe.isPending,onKeepMine:()=>Fe(ue),onLoadTheirs:()=>Ie(ue)}),I&&(0,b.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:I}),ge&&_e===`history`&&(0,b.jsx)(`div`,{role:`tabpanel`,id:`record-panel-history`,"aria-labelledby":`record-tab-history`,children:(0,b.jsx)(gk,{schema:e,id:n,record:r})}),(0,b.jsxs)(`div`,{className:_e===`details`?`contents`:`hidden`,...ge?{role:`tabpanel`,id:`record-panel-details`,"aria-labelledby":`record-tab-details`}:{},children:[t===`edit`&&r&&v.header.stepper&&(0,b.jsx)(yD,{field:v.header.stepper,value:r[v.header.stepper.name],reached:r._steps}),(0,b.jsxs)(`div`,{className:U(v.aside.length>0?`grid items-start gap-5 lg:grid-cols-[minmax(0,1fr)_340px]`:`contents`),children:[(0,b.jsxs)(`div`,{className:U(v.aside.length>0?`flex min-w-0 flex-col gap-5`:`contents`),children:[(0,b.jsx)(XD,{layout:e.form.layout,names:T.map(e=>e.name).filter(e=>!E.has(e)),errors:{...pe,...Object.fromEntries(Object.entries(oe).filter(([,e])=>dk({found:e})).map(([e])=>[`_inlines.${e}`,[``]]))},render:Be,renderInline:Le,renderSummary:Re}),!x&&(0,b.jsxs)(GO,{dirty:Ce,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>d(`/${e.name}`),children:l(m?`common.cancel`:`form.back`)}),m&&e.creatable&&(0,b.jsx)(q,{type:`submit`,value:`new`,variant:`outline`,disabled:Oe.isPending||Se.busy,children:l(`form.saveAndNew`)}),m&&(0,b.jsxs)(q,{type:`submit`,value:`list`,disabled:Oe.isPending||Se.busy,"aria-keyshortcuts":`Control+S Meta+S`,children:[l(Oe.isPending?`form.saving`:`form.save`),(0,b.jsx)(KO,{})]})]}),t===`edit`&&r&&e.related.length>0&&(0,b.jsxs)(`nav`,{"aria-label":l(`form.related`),className:`flex flex-col gap-2 border-t pt-4`,children:[(0,b.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground`,children:l(`form.related`)}),(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-2`,children:e.related.map(t=>(0,b.jsx)(`li`,{children:(0,b.jsx)(q,{asChild:!0,variant:`outline`,size:`sm`,children:(0,b.jsx)(xo,{to:`/${t.resource}?${new URLSearchParams({[`filter[${t.field}][${t.operator}]`]:String(r[e.primaryKeys[0]])})}`,children:t.label})})},`${t.resource}:${t.field}`))})]})]}),v.aside.length>0&&(0,b.jsx)(`aside`,{className:`flex flex-col gap-5`,children:v.aside.map((t,n)=>(0,b.jsx)(_D,{card:t,values:tk(t,n,r),schema:e},n))})]})]})]})}function Ck(e){return(e.form.layout??[]).flatMap(e=>`tab`in e?e.sections:[e]).filter(t=>`inline`in t&&e.inlines?.[t.inline]!==void 0)}var wk=[`details`,`history`];function Tk({active:e,onChange:t}){let n=X(),r=(0,y.useRef)({});return(0,b.jsx)(`div`,{role:`tablist`,"aria-label":n(`audit.recordTabs`),className:`flex gap-0.5 overflow-x-auto border-b`,onKeyDown:n=>{if(n.key!==`ArrowLeft`&&n.key!==`ArrowRight`&&n.key!==`Home`&&n.key!==`End`)return;n.preventDefault();let i=n.key===`Home`?`details`:n.key===`End`||e===`details`?`history`:`details`;t(i),r.current[i]?.focus()},children:wk.map(i=>(0,b.jsx)(`button`,{ref:e=>{r.current[i]=e},id:`record-tab-${i}`,type:`button`,role:`tab`,"aria-selected":i===e,"aria-controls":i===`details`||e===`history`?`record-panel-${i}`:void 0,tabIndex:i===e?0:-1,onClick:()=>t(i),className:U(`-mb-px flex h-[38px] items-center border-b-2 px-3 text-[13px] whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,i===e?`border-foreground font-semibold`:`border-transparent text-muted-foreground hover:text-foreground`),children:n(i===`details`?`audit.details`:`audit.history`)},i))})}var Ek=e=>Array.isArray(e?._readonly)?e._readonly:[];function Dk({resource:e,field:t,record:n,plain:r=!1}){let i=X(),a=n?.[t.name];return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-readonly":t.name,children:[(0,b.jsxs)(`span`,{className:U(`flex items-center gap-1.5 font-medium`,r?`text-[12.5px] text-muted-foreground`:`text-sm`),children:[t.label,!r&&(0,b.jsx)(hx,{className:`size-3.5 text-muted-foreground`,"aria-label":i(`form.readOnly`),role:`img`})]}),(0,b.jsx)(`div`,{className:U(`text-sm break-words`,!r&&`min-h-8 rounded-lg bg-muted/50 px-2.5 py-1.5`),children:t.widget===`richtext`&&typeof a==`string`&&a!==``?(0,b.jsx)(WD,{id:`field-${t.name}`,resource:e,field:t,value:a,readOnly:!0}):(0,b.jsx)(hD,{value:a,field:t,record:n,detailed:!0})}),t.help&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.help})]})}function Ok({to:e}){let t=X();return(0,b.jsx)(q,{asChild:!0,variant:`outline`,size:`icon`,className:`shrink-0`,children:(0,b.jsx)(xo,{to:e,"aria-label":t(`form.back`),children:(0,b.jsx)(ab,{className:`ltr:rotate-180`})})})}function kk({schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a,extra:o,badges:s,subtitle:c}){let l=X(),u=Array.isArray(t?._links)?t._links:[];return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,b.jsx)(Ok,{to:`/${e.name}`}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:yk(e.label,t,n)}),s.map(e=>(0,b.jsx)(mD,{value:t[e.name],field:e},e.name))]}),c.length>0&&(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:c.join(` · `)}),u.length>0&&(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-[13px]`,children:u.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-primary hover:underline`,"aria-label":l(`form.externalLink`,{name:e.label}),children:[e.label,(0,b.jsx)(Db,{className:`size-3.5 rtl:-scale-x-100`,"aria-hidden":!0})]})},`${e.label}:${e.href}`))})]}),(0,b.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[t&&n!==void 0&&(0,b.jsx)(NO,{schema:e,ids:[n]}),t&&n!==void 0&&(0,b.jsx)(MO,{schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a}),o]})]})}function Ak({fields:e,before:t,current:n,busy:r,onKeepMine:i,onLoadTheirs:a}){let o=X(),s=e.filter(e=>JSON.stringify(t?.[e.name]??null)!==JSON.stringify(n[e.name]??null));return(0,b.jsxs)(BO,{labelledBy:`conflict-title`,describedBy:`conflict-body`,initialFocus:`[data-autofocus]`,className:`flex flex-col gap-3 text-sm`,children:[(0,b.jsx)(`p`,{id:`conflict-title`,className:`font-medium`,children:o(`form.conflictTitle`)}),(0,b.jsx)(`div`,{id:`conflict-body`,children:s.length>0?(0,b.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:s.map(e=>(0,b.jsxs)(y.Fragment,{children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsxs)(`dd`,{children:[(0,b.jsx)(`span`,{className:`line-through opacity-60`,children:fC(t?.[e.name],e)}),` → `,fC(n[e.name],e)]})]},e.name))}):(0,b.jsx)(`p`,{children:o(`form.conflictNone`)})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsx)(q,{type:`button`,disabled:r,onClick:i,children:o(`form.keepMine`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,"data-autofocus":!0,onClick:a,children:o(`form.loadTheirs`)})]})]})}function jk(){let{t:e}=Y(),{group:t}=$i(),n=Cv();if(n.isPending)return(0,b.jsx)(W,{children:e(`common.loading`)});if(n.isError)return(0,b.jsx)(W,{tone:`error`,children:n.error.message});let r=fT(n.data).find(e=>e.key===t);return r?(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:r.label}),(0,b.jsx)(Nk,{group:r})]}):(0,b.jsx)(W,{children:e(`common.pageNotFound`)})}function Mk({groups:e}){return(0,b.jsx)(`div`,{className:`flex flex-col gap-8`,children:e.map(e=>(0,b.jsxs)(`section`,{"aria-labelledby":`group-${e.key}`,className:`flex flex-col gap-3`,children:[(0,b.jsx)(`h2`,{id:`group-${e.key}`,className:`text-lg font-semibold`,children:(0,b.jsx)(xo,{to:`/g/${e.key}`,className:`hover:underline`,children:e.label})}),(0,b.jsx)(Nk,{group:e})]},e.key))})}function Nk({group:e}){return(0,b.jsxs)(b.Fragment,{children:[e.resources.length>0&&(0,b.jsx)(Ik,{resources:e.resources}),e.pages.length>0&&(0,b.jsx)(Fk,{pages:e.pages})]})}var Pk=`flex items-center gap-3 rounded-card border bg-card shadow-card p-4 hover:bg-muted/50`;function Fk({pages:e}){return(0,b.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>{let t=HT(e.icon,`page`);return(0,b.jsx)(`li`,{children:(0,b.jsxs)(xo,{to:`/p/${e.name}`,className:Pk,children:[(0,b.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-md bg-muted`,children:(0,b.jsx)(t,{className:`size-5 text-muted-foreground`,"aria-hidden":!0})}),(0,b.jsx)(`span`,{className:`truncate font-medium`,children:e.label})]})},e.name)})})}function Ik({resources:e}){let{t,locale:n}=Y(),r=ut({queries:e.map(e=>({queryKey:[`count`,e.name],queryFn:()=>Q.list(e.name,new URLSearchParams({pageSize:`1`})),staleTime:6e4}))});return(0,b.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.map((e,i)=>{let a=HT(e.icon,`resource`),o=r[i]?.data,s=o&&o.total!==null?t(o.estimated?`shell.aboutRecords`:`shell.records`,{count:E_(o.total,n)}):void 0;return(0,b.jsx)(`li`,{children:(0,b.jsxs)(xo,{to:`/${e.name}`,className:Pk,children:[(0,b.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-md bg-muted`,children:(0,b.jsx)(a,{className:`size-5 text-muted-foreground`,"aria-hidden":!0})}),(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,b.jsx)(`span`,{className:`truncate font-medium`,children:e.label}),s&&(0,b.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:s})]})]})},e.name)})})}var Lk=(e,t=2)=>String(e).padStart(t,`0`),Rk=e=>`${Lk(e.getFullYear(),4)}-${Lk(e.getMonth()+1)}-${Lk(e.getDate())}`,zk=e=>new Date(`${e}T00:00:00`).toISOString(),Bk=(e,t)=>{let[n,r]=e.split(`-`).map(Number),i=n*12+(r-1)+t;return`${Lk(Math.floor(i/12),4)}-${Lk(i%12+1)}-01`};function Vk(e,t,n,r,i){let a=Rk(t),o=(t,n,r,i)=>({period:e,from:zk(t),to:zk(n),previousFrom:zk(r),previousTo:zk(i)}),s=(e,t)=>Math.round((Date.parse(`${t}T00:00:00Z`)-Date.parse(`${e}T00:00:00Z`))/864e5);switch(e){case`day`:return o(a,lw(a,1),lw(a,-1),a);case`week`:return o(lw(a,-6),lw(a,1),lw(a,-13),lw(a,-6));case`month`:{if(n===`persian`){let{jy:e,jm:t}=rw(a),n=iw(e,t,1);return o(n,cw(n,1),cw(n,-1),n)}let e=`${a.slice(0,7)}-01`;return o(e,Bk(e,1),Bk(e,-1),e)}case`year`:{if(n===`persian`){let{jy:e}=rw(a);return o(iw(e,1,1),iw(e+1,1,1),iw(e-1,1,1),iw(e,1,1))}let e=Number(a.slice(0,4));return o(`${Lk(e,4)}-01-01`,`${Lk(e+1,4)}-01-01`,`${Lk(e-1,4)}-01-01`,`${Lk(e,4)}-01-01`)}case`range`:{let e=r??a,t=lw(i??a,1);return o(e,t,lw(e,-s(e,t)),e)}}}function Hk(e){if(e===void 0)return;let t=`${Math.abs(e)}%`;return e>0?{tone:`ok`,arrow:`up`,text:t}:e<0?{tone:`bad`,arrow:`down`,text:t}:{tone:`neutral`,arrow:null,text:t}}function Uk(e,t,n){let r=Math.max(1,...e.series.flatMap(e=>e.values)),i=Math.max(1,e.labels.length),a=t/i,o=e=>n-e/r*n;return{max:r,gridlines:[.25,.5,.75,1].map(e=>({y:n-e*n,value:r*e})),series:e.series.map(e=>{let r=e.values.map((e,n)=>[i===1?t/2:n*t/(i-1),o(e)]);return{label:e.label,dashed:e.dashed===!0,path:r.map(([e,t],n)=>`${n===0?`M`:`L`}${Wk(e)} ${Wk(t)}`).join(` `),bars:e.values.map((e,t)=>{let r=a*.6;return{x:t*a+a/2-r/2,y:o(e),width:r,height:n-o(e)}})}})}}var Wk=e=>Math.round(e*10)/10,Gk=600,Kk=200;function qk({title:e,data:t}){let n=X(),r=Uk(t,Gk,Kk),i=Math.max(1,Math.ceil(t.labels.length/6));return(0,b.jsxs)(`div`,{className:`flex flex-col gap-3.5 p-5`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,b.jsx)(`h2`,{className:`text-[15px] font-semibold`,children:e}),t.subtitle&&(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t.subtitle})]}),(0,b.jsx)(`div`,{className:`ms-auto flex gap-4 text-xs text-muted-foreground`,children:t.series.map(e=>(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:e.dashed?`h-0 w-3.5 border-t-2 border-dashed border-muted-foreground`:`h-[3px] w-3.5 rounded-sm bg-primary`}),e.label]},e.label))})]}),(0,b.jsxs)(`svg`,{viewBox:`0 0 ${Gk} ${Kk}`,preserveAspectRatio:`none`,role:`img`,"aria-label":e,className:`h-[230px] w-full overflow-visible rtl:-scale-x-100`,children:[(0,b.jsx)(`g`,{className:`stroke-border`,children:r.gridlines.map(e=>(0,b.jsx)(`path`,{d:`M0 ${e.y}H${Gk}`,vectorEffect:`non-scaling-stroke`},e.y))}),r.series.map((e,n)=>t.kind===`bar`&&!e.dashed?(0,b.jsx)(`g`,{className:`fill-primary`,children:e.bars.map((e,t)=>(0,b.jsx)(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:3},t))},e.label):(0,b.jsxs)(`g`,{children:[!e.dashed&&n===0&&(0,b.jsx)(`path`,{d:`${e.path} L${Gk} ${Kk} L0 ${Kk} Z`,className:`fill-primary/10`}),(0,b.jsx)(`path`,{d:e.path,fill:`none`,vectorEffect:`non-scaling-stroke`,strokeWidth:e.dashed?2:2.5,strokeDasharray:e.dashed?`5 5`:void 0,className:e.dashed||n>0?`stroke-muted-foreground`:`stroke-primary`})]},e.label))]}),(0,b.jsx)(`div`,{"aria-hidden":!0,className:`flex justify-between text-[11.5px] text-muted-foreground`,children:t.labels.filter((e,t)=>t%i===0).map(e=>(0,b.jsx)(`span`,{children:e},e))}),(0,b.jsxs)(`span`,{className:`sr-only`,children:[t.series.map(e=>`${e.label}: ${e.values.map(e=>E_(e)).join(`, `)}`).join(`; `),` `,n(`dashboard.period`)]})]})}var Jk={ok:`bg-ok`,warn:`bg-warn`,bad:`bg-bad`,info:`bg-info`,neutral:`bg-muted-foreground`,primary:`bg-primary`};function Yk({title:e,data:t}){return(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 p-5`,children:[(0,b.jsx)(`h2`,{className:`text-[15px] font-semibold`,children:e}),(0,b.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:t.items.map((e,t)=>{let n=HT(e.icon,`resource`),r=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-control bg-muted text-muted-foreground`,children:(0,b.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),(0,b.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:e.text}),e.status&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:U(`size-2 shrink-0 rounded-full`,Jk[e.status])})]});return(0,b.jsx)(`li`,{children:e.link?(0,b.jsx)(xo,{to:e.link,className:`flex items-center gap-3 rounded-control hover:bg-muted`,children:r}):(0,b.jsx)(`div`,{className:`flex items-center gap-3`,children:r})},t)})})]})}function Xk({items:e,value:t,onChange:n,className:r}){return(0,b.jsx)(`div`,{role:`tablist`,className:U(`flex w-full gap-0.5 border-b border-border`,r),children:e.map(e=>{let r=e.key===t;return(0,b.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.key),className:U(`-mb-px inline-flex h-[38px] cursor-pointer items-center gap-1.5 border-b-2 border-transparent px-3 text-[13px] text-muted-foreground`,r&&`border-foreground font-semibold text-foreground`),children:[e.label,e.count!==void 0&&(0,b.jsxs)(`span`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-muted px-1.5 text-[11px] text-muted-foreground`,children:[e.estimate?`~`:``,e.count]})]},e.key)})})}function Zk({period:e,from:t,to:n,onChange:r}){let i=X(),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(t??``),[l,u]=(0,y.useState)(n??``);return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(Xk,{className:`w-auto`,items:[`day`,`week`,`month`,`year`].map(e=>({key:e,label:i(`dashboard.${e}`)})),value:e===`range`?``:e,onChange:e=>r(e)}),(0,b.jsxs)(Kh,{open:a,onOpenChange:o,children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsx)(q,{variant:e===`range`?`secondary`:`outline`,size:`icon`,"aria-label":i(`dashboard.range`),"aria-pressed":e===`range`,children:(0,b.jsx)(qy,{})})}),(0,b.jsx)(Jh,{children:(0,b.jsxs)(Yh,{align:`end`,sideOffset:6,className:`z-50 flex w-72 flex-col gap-3 rounded-[10px] border bg-popover p-3 shadow-lg`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,b.jsx)(t_,{htmlFor:`dashboard-from`,children:i(`filters.from`)}),(0,b.jsx)(vw,{id:`dashboard-from`,label:i(`filters.from`),value:s,onChange:c,live:!0})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,b.jsx)(t_,{htmlFor:`dashboard-to`,children:i(`filters.to`)}),(0,b.jsx)(vw,{id:`dashboard-to`,label:i(`filters.to`),value:l,onChange:u,live:!0})]}),(0,b.jsx)(q,{disabled:!/^\d{4}-\d{2}-\d{2}$/.test(s)||!/^\d{4}-\d{2}-\d{2}$/.test(l)||s>l,onClick:()=>{o(!1),r(`range`,s,l)},children:i(`dashboard.apply`)})]})})]})]})}var Qk=42,$k=2*Math.PI*Qk;function eA({title:e,data:t}){let n=Math.max(0,Math.min(100,t.percent));return(0,b.jsxs)(`div`,{className:`flex items-center gap-5 p-5`,children:[(0,b.jsxs)(`svg`,{viewBox:`0 0 100 100`,role:`img`,"aria-label":D_(t.value),className:`size-[104px] shrink-0 -rotate-90`,children:[(0,b.jsx)(`circle`,{cx:`50`,cy:`50`,r:Qk,fill:`none`,strokeWidth:10,className:`stroke-muted`}),(0,b.jsx)(`circle`,{cx:`50`,cy:`50`,r:Qk,fill:`none`,strokeWidth:10,strokeLinecap:`round`,strokeDasharray:`${n/100*$k} ${$k}`,className:`stroke-primary`})]}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,b.jsx)(`div`,{className:`text-2xl leading-tight font-bold`,children:D_(t.value)}),(0,b.jsx)(`h2`,{className:`text-sm font-semibold`,children:e}),(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t.caption})]})]})}function tA({title:e,data:t}){let n=Hk(t.change);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 px-5 py-[18px]`,children:[(0,b.jsx)(`div`,{className:`text-[13px] font-medium text-muted-foreground`,children:e}),(0,b.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,b.jsx)(`span`,{className:`text-[26px] leading-[1.3] font-bold`,children:D_(t.value)}),t.unit&&(0,b.jsx)(`span`,{className:`text-[13px] text-muted-foreground`,children:t.unit})]}),(n||t.previousLabel)&&(0,b.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[n&&(0,b.jsxs)(`span`,{className:U(`inline-flex items-center gap-0.5 rounded-full px-1.5 py-0.5 font-medium`,n.tone===`ok`?`bg-ok-bg text-ok`:n.tone===`bad`?`bg-bad-bg text-bad`:`bg-muted text-muted-foreground`),children:[n.arrow===`up`&&(0,b.jsx)(ky,{className:`size-3`,"aria-hidden":!0}),n.arrow===`down`&&(0,b.jsx)(Ty,{className:`size-3`,"aria-hidden":!0}),D_(n.text)]}),t.previousLabel&&(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:t.previousLabel})]})]})}function nA({title:e,data:t}){let n=X(),r=t.link?`/${t.link.resource}${t.link.filter?`?${new URLSearchParams(t.link.filter)}`:``}`:void 0;return(0,b.jsxs)(`div`,{className:`flex flex-col`,children:[(0,b.jsxs)(`div`,{className:`flex min-h-14 items-center gap-2 border-b px-5 py-3`,children:[(0,b.jsx)(`h2`,{className:`flex-1 text-[15px] font-semibold`,children:e}),r&&(0,b.jsxs)(xo,{to:r,className:`inline-flex items-center gap-1 text-[13px] font-medium text-primary hover:underline`,children:[n(`dashboard.viewAll`),(0,b.jsx)(rb,{className:`size-3.5 ltr:rotate-180`,"aria-hidden":!0})]})]}),(0,b.jsx)(`div`,{className:`overflow-x-auto`,children:(0,b.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,b.jsx)(`thead`,{className:`bg-[color-mix(in_oklab,var(--muted)_50%,transparent)] text-[12.5px] text-muted-foreground`,children:(0,b.jsx)(`tr`,{children:t.columns.map(e=>(0,b.jsx)(`th`,{className:`px-3.5 py-2.5 text-start font-medium whitespace-nowrap`,children:e.label},e.key))})}),(0,b.jsx)(`tbody`,{children:t.rows.map((e,n)=>(0,b.jsx)(`tr`,{className:`border-t`,children:t.columns.map(t=>{let n=e[t.key];return(0,b.jsx)(`td`,{className:`px-3.5 py-2.5 whitespace-nowrap`,children:typeof n==`object`&&n?(0,b.jsx)(dD,{tone:n.tone,children:n.label}):typeof n==`number`?E_(n):D_(String(n??``))},t.key)})},n))})]})})]})}var rA=[`day`,`week`,`month`,`year`,`range`],iA={1:`lg:col-span-4`,2:`lg:col-span-6`,3:`lg:col-span-8`,4:`lg:col-span-12`};function aA(){let{t:e,calendar:t}=Y(),[n,r]=To(),i=n.get(`period`),a=i&&rA.includes(i)?i:`week`,o=n.get(`from`)??void 0,s=n.get(`to`)??void 0,c=Vk(a,new Date,t===`persian`?`persian`:`gregory`,o,s),l=ft({queryKey:[`dashboard`],queryFn:Q.dashboard});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:e(`dashboard.title`)}),(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:e(`dashboard.subtitle`)})]}),(0,b.jsx)(`div`,{className:`ms-auto`,children:(0,b.jsx)(Zk,{period:a,from:o,to:s,onChange:(e,t,n)=>r(e===`range`?{period:e,from:t,to:n}:e===`week`?{}:{period:e})})})]}),l.isPending&&(0,b.jsx)(W,{children:e(`common.loading`)}),l.isError&&(0,b.jsx)(W,{tone:`error`,children:W_(l.error)}),l.data&&(0,b.jsx)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-12`,children:l.data.widgets.map(e=>(0,b.jsx)(oA,{widget:e,params:c},e.name))})]})}function oA({widget:e,params:t}){let{t:n}=Y(),r=ft({queryKey:[`dashboard`,e.name,t],queryFn:()=>Q.widget(e.name,t),retry:!1}),i=e.type===`stat`?`lg:col-span-3`:iA[e.size];return(0,b.jsxs)(`section`,{"aria-label":e.title,"data-widget":e.name,className:U(`min-w-0 overflow-hidden rounded-card border bg-card shadow-card`,i),children:[r.isPending&&(0,b.jsxs)(`div`,{"aria-hidden":!0,className:`flex flex-col gap-3 p-5`,children:[(0,b.jsx)(`div`,{className:`h-4 w-1/3 animate-pulse rounded bg-muted`}),(0,b.jsx)(`div`,{className:`h-8 w-2/3 animate-pulse rounded bg-muted`})]}),r.isError&&(0,b.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-5 text-[13px]`,children:[(0,b.jsx)(`span`,{className:`font-semibold`,children:e.title}),(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:n(`dashboard.failed`)}),(0,b.jsx)(q,{size:`sm`,variant:`outline`,onClick:()=>void r.refetch(),children:n(`dashboard.retry`)})]}),r.data&&(0,b.jsx)(sA,{type:e.type,title:e.title,data:r.data})]})}function sA({type:e,title:t,data:n}){switch(e){case`stat`:return(0,b.jsx)(tA,{title:t,data:n});case`chart`:return(0,b.jsx)(qk,{title:t,data:n});case`table`:return(0,b.jsx)(nA,{title:t,data:n});case`progress`:return(0,b.jsx)(eA,{title:t,data:n});case`list`:return(0,b.jsx)(Yk,{title:t,data:n})}}function cA(){let e=X(),t=Cv();if(t.isPending)return(0,b.jsx)(W,{children:e(`common.loading`)});if(t.isError)return(0,b.jsx)(W,{tone:`error`,children:t.error.message});if(t.data.dashboard)return(0,b.jsx)(aA,{});let n=fT(t.data);return n.length===0?(0,b.jsx)(W,{children:e(`shell.noResources`)}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:t.data.title}),(0,b.jsx)(Mk,{groups:n})]})}var lA={order:[],hidden:[],widths:{},density:`comfortable`},uA=e=>`nma.columns.${e}`;function dA(e,t){return fA(e,t).filter(e=>!t.hidden.includes(e))}function fA(e,t){let n=t.order.filter(t=>e.includes(t));return[...n,...e.filter(e=>!n.includes(e))]}function pA(e){let t=new Map,n=new Set,r=n=>{let r=t.get(n);if(!r){r=lA;try{let t=e?.getItem(uA(n));t&&(r={...lA,...JSON.parse(t)})}catch{r=lA}t.set(n,r)}return r},i=(r,i)=>{t.set(r,i);try{e?.setItem(uA(r),JSON.stringify(i))}catch{}for(let e of n)e()};return{get:r,subscribe(e){return n.add(e),()=>n.delete(e)},toggle(e,t){let n=r(e),a=n.hidden.includes(t)?n.hidden.filter(e=>e!==t):[...n.hidden,t];i(e,{...n,hidden:a})},move(e,t,n,a){let o=r(e),s=fA(t,o),c=s.indexOf(n),l=c+a;c<0||l<0||l>=s.length||([s[c],s[l]]=[s[l],s[c]],i(e,{...o,order:s}))},setWidth(e,t,n){let a=r(e),o=Math.round(Math.min(600,Math.max(60,n)));i(e,{...a,widths:{...a.widths,[t]:o}})},setDensity(e,t){i(e,{...r(e),density:t})},reset(r){try{e?.removeItem(uA(r))}catch{}t.set(r,lA);for(let e of n)e()}}}function mA(){try{return typeof localStorage>`u`?void 0:localStorage}catch{return}}var hA=pA(mA());function gA(e){return(0,y.useSyncExternalStore)(hA.subscribe,()=>hA.get(e))}function _A({schema:e,prefs:t}){let n=X(),r=fA(e.list.columns,t),i=t=>e.list.computed?.[t]?.label??e.fields.find(e=>e.name===t)?.label??t,a=r.filter(e=>!t.hidden.includes(e));return(0,b.jsxs)(Kh,{children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsxs)(q,{variant:`outline`,size:`sm`,className:`hidden md:inline-flex`,children:[(0,b.jsx)(db,{}),n(`list.columns`),(0,b.jsx)(tb,{className:`text-muted-foreground`})]})}),(0,b.jsx)(Jh,{children:(0,b.jsxs)(Yh,{align:`end`,sideOffset:4,collisionPadding:8,className:`z-50 flex max-h-[var(--radix-popover-content-available-height)] w-72 flex-col gap-3 rounded-[10px] border bg-popover p-3 text-popover-foreground shadow-lg`,children:[(0,b.jsx)(`ul`,{"aria-label":n(`list.columns`),className:`flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto`,children:r.map((o,s)=>{let c=!t.hidden.includes(o);return(0,b.jsxs)(`li`,{className:`flex items-center gap-2 rounded-md px-1 py-0.5 hover:bg-accent`,children:[(0,b.jsxs)(`label`,{className:`flex flex-1 cursor-pointer items-center gap-2 text-sm`,children:[(0,b.jsx)(Af,{checked:c,disabled:c&&a.length===1,onCheckedChange:()=>hA.toggle(e.name,o),className:`flex size-4 items-center justify-center rounded border border-input disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,children:(0,b.jsx)(Mf,{children:(0,b.jsx)($y,{className:`size-3`})})}),i(o)]}),(0,b.jsx)(q,{variant:`ghost`,size:`icon-sm`,"aria-label":n(`list.moveUp`,{name:i(o)}),disabled:s===0,onClick:()=>hA.move(e.name,e.list.columns,o,-1),children:(0,b.jsx)(ky,{})}),(0,b.jsx)(q,{variant:`ghost`,size:`icon-sm`,"aria-label":n(`list.moveDown`,{name:i(o)}),disabled:s===r.length-1,onClick:()=>hA.move(e.name,e.list.columns,o,1),children:(0,b.jsx)(Ty,{})})]},o)})}),(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":n(`list.density`),className:`flex gap-1`,children:[`comfortable`,`compact`].map(r=>(0,b.jsx)(q,{role:`radio`,"aria-checked":t.density===r,variant:t.density===r?`secondary`:`ghost`,size:`sm`,onClick:()=>hA.setDensity(e.name,r),children:n(r===`compact`?`list.compact`:`list.comfortable`)},r))}),(0,b.jsx)(q,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>hA.reset(e.name),children:n(`list.resetColumns`)})]})})]})}function vA({resource:e,column:t,label:n,width:r}){let i=X(),a=(0,y.useRef)(null);return(0,b.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":i(`list.resize`,{name:n}),"aria-valuenow":r,tabIndex:0,className:U(`absolute inset-y-1 end-0 w-1.5 cursor-col-resize touch-none rounded bg-transparent hover:bg-border focus-visible:bg-ring`),onPointerDown:e=>{let t=e.currentTarget.parentElement;a.current={x:e.clientX,width:t.getBoundingClientRect().width,rtl:getComputedStyle(t).direction===`rtl`},e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:n=>{if(!a.current)return;let r=(n.clientX-a.current.x)*(a.current.rtl?-1:1);hA.setWidth(e,t,a.current.width+r)},onPointerUp:()=>a.current=null,onKeyDown:n=>{if(n.key!==`ArrowLeft`&&n.key!==`ArrowRight`)return;n.preventDefault();let i=r??n.currentTarget.parentElement.getBoundingClientRect().width,a=getComputedStyle(n.currentTarget).direction===`rtl`,o=n.key===`ArrowRight`!==a;hA.setWidth(e,t,i+(o?10:-10))},onClick:e=>e.stopPropagation()})}var yA=`h-7 w-full min-w-20 rounded-md border border-input bg-background px-2 text-sm outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 aria-invalid:border-destructive`;function bA({schema:e,item:t,field:n}){let r=X(),i=S(),[a,o]=(0,y.useState)(!1),s=oD([n],t)[n.name],[c,l]=(0,y.useState)(s),[u,d]=(0,y.useState)(null),f=(0,y.useRef)(!1),p=pt({mutationFn:n=>Q.update(e.name,String(t._id),n,e.version?t[e.version]:void 0),onSuccess:n=>{i.setQueriesData({queryKey:[`list`,e.name]},e=>e&&{...e,items:e.items.map(e=>e._id===n._id?{...e,...n}:e)}),i.removeQueries({queryKey:[`record`,e.name,String(t._id)]}),o(!1),d(null)},onError:e=>{d(e instanceof U_?e.fields[n.name]?.join(` `)??e.message:e.message),l(s),o(!1)}});function m(t=c){if(t===s){o(!1);return}let{payload:r,errors:i}=cD([n],{[n.name]:t},{[n.name]:s}),a=OO(r,{[n.name]:e.form.constraints.update[n.name]??{}},`update`),l=i[n.name]??a[n.name];if(l){d(l.join(` `));return}p.mutate(r)}let h=e=>{e.key===`Enter`?(e.preventDefault(),m()):e.key===`Escape`&&(e.preventDefault(),l(s),d(null),o(!1))},g=`cell-${e.name}-${String(t._id)}-${n.name}-error`,_={"aria-label":n.label,"aria-invalid":u?!0:void 0,"aria-describedby":u?g:void 0,autoFocus:!0,disabled:p.isPending,className:yA,onKeyDown:h},v;if(n.type===`boolean`)v=(0,b.jsx)(ID,{id:`cell-${e.name}-${String(t._id)}-${n.name}`,checked:t[n.name]===!0,onChange:e=>m(e),aria:{"aria-label":n.label,"aria-invalid":u?!0:void 0,"aria-describedby":u?g:void 0}});else if(!a)v=(0,b.jsx)(`button`,{type:`button`,className:U(`-mx-1 rounded px-1 text-start hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,u&&`text-destructive`),"aria-label":r(`list.editCell`,{name:n.label,value:fC(t[n.name],n)}),onClick:()=>{l(s),o(!0)},children:(0,b.jsx)(hD,{value:t[n.name],field:n})});else if(n.type===`enum`){let e=(n.enumValues??[]).map(e=>[e,PD(n,e)]);v=(0,b.jsx)(Bw,{"aria-label":n.label,"aria-invalid":u?!0:void 0,"aria-describedby":u?g:void 0,autoFocus:!0,defaultOpen:!0,disabled:p.isPending,size:`sm`,className:`min-w-20`,value:String(c),onValueChange:e=>{f.current=!0;let t=n.type===`boolean`?e===`true`:e;l(t),m(t)},onOpenChange:e=>{e?f.current=!1:f.current||o(!1)},options:[...n.nullable&&n.type===`enum`?[{value:``,label:r(`common.empty`)}]:[],...e.map(([e,t])=>({value:e,label:t}))]})}else if(n.type===`date`)v=(0,b.jsx)(vw,{id:`cell-${e.name}-${String(t._id)}-${n.name}`,label:n.label,value:String(c),onChange:e=>{l(e),m(e)},autoFocus:!0,"aria-invalid":u?!0:void 0,"aria-describedby":u?g:void 0,className:`min-w-44`,onKeyDown:h});else{let e=n.type===`number`||n.type===`decimal`||n.type===`bigint`;v=(0,b.jsx)(`input`,{..._,type:`text`,inputMode:e?n.type===`bigint`?`numeric`:`decimal`:void 0,value:String(c),onChange:e=>l(e.target.value),onBlur:()=>m()})}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-0.5`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[v,u&&(0,b.jsx)(`p`,{id:g,role:`alert`,className:`text-xs text-destructive`,children:u})]})}var xA=/^filter\[([^\][]+)\]\[([^\][]+)\]$/;function SA(e,t){if(e.type===`boolean`)return J(t===`true`?`common.yes`:`common.no`);if(e.type===`enum`)return e.enumLabels?.[t]??t;if(e.type===`date`)return A_(t);if(e.type===`number`||e.type===`decimal`||e.type===`bigint`)return D_(t);if(e.type===`datetime`){let e=new Date(t);return Number.isNaN(e.getTime())?t:O_(e)}return t}function CA(e,t){let n=[],r=t.get(`search`);r&&n.push({key:`search`,label:J(`filters.search`),value:`“${r}”`,remove:[`search`]});let i=wA(e,t),a=new Map;for(let[e,n]of t){if(i[e]===n)continue;let t=xA.exec(e);if(!t||n===``)continue;let[,r,o]=t;a.set(r,[...a.get(r)??[],{operator:o,raw:n,key:e}])}for(let[t,r]of a){let i=e.fields.find(e=>e.name===t);if(!i)continue;let a=[],o,s=r.find(e=>e.operator===`gte`||e.operator===`gt`),c=r.find(e=>e.operator===`lte`||e.operator===`lt`);s&&c&&a.push(`${SA(i,s.raw)} – ${SA(i,c.raw)}`);for(let{operator:e,raw:n}of r){if((e===`gte`||e===`gt`||e===`lte`||e===`lt`)&&s&&c)continue;let r=n.split(`,`).map(e=>SA(i,e));if(i.type===`relation`&&[`eq`,`ne`,`in`,`nin`].includes(e)){let r=e===`ne`||e===`nin`?J(`filters.not`):``;o={field:t,ids:n.split(`,`),prefix:r},a.push(`${r}${n.split(`,`).map(e=>`#${e}`).join(`, `)}`);continue}switch(e){case`isNull`:a.push(J(n===`true`?`filters.empty`:`filters.notEmpty`));break;case`ne`:case`nin`:a.push(`${J(`filters.not`)}${r.join(`, `)}`);break;case`gte`:case`gt`:a.push(`≥ ${r[0]}`);break;case`lte`:case`lt`:a.push(`≤ ${r[0]}`);break;case`between`:a.push(r.join(` – `));break;case`contains`:a.push(`“${n}”`);break;case`startsWith`:a.push(`${n}…`);break;default:a.push(r.join(`, `))}}n.push({key:`filter:${t}`,label:i.label,value:a.join(`; `),...o?{ref:o}:{},remove:r.map(e=>e.key)})}return n}function wA(e,t){return Fw(e.list?.tabs,t)?.filter??{}}var TA=`(max-width: 767px)`;function EA(e){let t=window.matchMedia(TA);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function DA(){return(0,y.useSyncExternalStore)(EA,()=>window.matchMedia(TA).matches,()=>!1)}var OA=new Set([`number`,`decimal`,`bigint`,`date`,`datetime`]),kA=300;function AA({schema:e,params:t,onChange:n,trailing:r}){let i=X(),a=DA(),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(),u=t.get(`search`)??``,[d,f]=(0,y.useState)(u),p=(0,y.useRef)(u);(0,y.useEffect)(()=>{u!==p.current&&(p.current=u,f(u))},[u]);let m=(0,y.useRef)(n);m.current=n;function h(e){let t=e.trim();t!==p.current&&(p.current=t,m.current({search:t||null}))}(0,y.useEffect)(()=>{if(d.trim()===p.current)return;let e=setTimeout(()=>h(d),kA);return()=>clearTimeout(e)},[d]);let g=e.list.filters.map(t=>({operators:t.operators,field:e.fields.find(e=>e.name===t.field)})).filter(e=>e.field!==void 0),_=e.list.search.length>0,v=a&&(g.length>0||e.list.sortable.length>0);if(g.length===0&&!_&&!v&&!r)return null;let x=e.list.search.map(t=>e.fields.find(e=>e.name===t)?.label??t);if(!a){let a=new Map(CA(e,t).map(e=>[e.key,e]));return(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[_&&(0,b.jsx)(HA,{label:i(`filters.search`),placeholder:i(`filters.searchIn`,{fields:x.join(`, `)}),value:d,onChange:f,onSubmit:()=>h(d)}),g.length>0&&(0,b.jsx)(`ul`,{"aria-label":i(`filters.filters`),className:`contents`,children:g.map(({field:r,operators:i})=>(0,b.jsx)(`li`,{className:`contents`,children:(0,b.jsx)(UA,{resource:e.name,field:r,operators:i,params:t,onChange:n,chip:a.get(`filter:${r.name}`)})},r.name))}),Ew(t)&&(0,b.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>n(Dw(t)),children:[i(`filters.clear`),(0,b.jsx)($S,{className:`size-3.5`})]}),r&&(0,b.jsx)(`div`,{className:`ms-auto flex items-center gap-2`,children:r})]})}let S=Mw(t),C=CA(e,t).length>0,w=jA(e,t,i),T=()=>{l(new URLSearchParams(t)),s(!0)};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[_&&(0,b.jsx)(HA,{className:`flex-1`,label:i(`filters.search`),placeholder:i(`filters.searchIn`,{fields:x.join(`, `)}),value:d,onChange:f,onSubmit:()=>h(d)}),v&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,"aria-haspopup":`dialog`,onClick:T,children:[(0,b.jsx)(yS,{}),i(`filters.filters`),S>0&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1.5 text-xs text-primary-foreground`,children:E_(S)})]})]}),(C||v&&w)&&(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[C&&(0,b.jsx)(RA,{schema:e,params:t,onChange:n}),v&&w&&(0,b.jsxs)(`button`,{type:`button`,className:`inline-flex h-9 items-center gap-1.5 rounded-full border border-input bg-card px-3 text-[13px]`,"aria-haspopup":`dialog`,onClick:T,children:[(0,b.jsx)(Cy,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),w]})]}),v&&(0,b.jsx)(Yd,{open:o,onOpenChange:s,children:(0,b.jsxs)(tf,{children:[(0,b.jsx)(rf,{className:dT}),(0,b.jsxs)(cf,{"aria-describedby":void 0,className:`fixed inset-x-0 bottom-0 z-50 flex max-h-[85dvh] flex-col rounded-t-[18px] bg-card shadow-xl outline-none`,children:[(0,b.jsx)(`div`,{className:`flex justify-center pt-2`,"aria-hidden":!0,children:(0,b.jsx)(`span`,{className:`h-1.5 w-10 rounded-full bg-input`})}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 ps-4 pe-2 pt-1.5 pb-2`,children:[(0,b.jsx)(pf,{className:`flex-1 text-[17px] font-bold`,children:i(`filters.filtersAndSort`)}),Ew(t)&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,className:`text-primary`,onClick:()=>n(Dw(t)),children:i(`filters.clear`)})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-5 overflow-y-auto px-4 py-1`,children:[g.map(({field:r,operators:i})=>(0,b.jsx)(NA,{resource:e.name,field:r,operators:i,params:t,onChange:n,touch:!0},r.name)),e.list.sortable.length>0&&(0,b.jsx)(MA,{schema:e,params:t,onChange:n})]}),(0,b.jsxs)(`div`,{className:`flex gap-2.5 border-t px-4 pt-3 pb-5`,children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>{c&&n(Nw(t,c)),s(!1)},children:i(`common.cancel`)}),(0,b.jsx)(hf,{asChild:!0,children:(0,b.jsx)(q,{className:`flex-1`,children:i(`filters.showResults`)})})]})]})]})})]})}function jA(e,t,n){if(e.list.sortable.length===0)return``;let{field:r,direction:i}=e.list.defaultSort,a=t.get(`sort`)??(i===`desc`?`-${r}`:r),o=a.replace(/^-/,``),s=e.fields.find(e=>e.name===o)?.label??o;return n(a.startsWith(`-`)?`filters.descending`:`filters.ascending`,{name:s})}function MA({schema:e,params:t,onChange:n}){let r=X(),{field:i,direction:a}=e.list.defaultSort,o=t.get(`sort`)??(a===`desc`?`-${i}`:i),s=t=>e.fields.find(e=>e.name===t)?.label??t;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:`list-sort`,children:r(`filters.sortBy`)}),(0,b.jsx)(Bw,{id:`list-sort`,value:o,onValueChange:e=>n({sort:e,page:null,after:null}),options:e.list.sortable.flatMap(e=>[{value:e,label:r(`filters.ascending`,{name:s(e)})},{value:`-${e}`,label:r(`filters.descending`,{name:s(e)})}])})]})}function NA(e){let t=(0,b.jsx)(LA,{...e}),{field:n,operators:r,params:i,onChange:a}=e;return!n.nullable||!r.includes(`isNull`)||n.type===`relation`?t:(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[t,(0,b.jsx)(PA,{field:n,params:i,onChange:a})]})}function PA({field:e,params:t,onChange:n}){let r=X(),i=Tw(e.name,`isNull`);return(0,b.jsx)(Bw,{"aria-label":r(`filters.emptyValues`,{field:e.label}),size:`sm`,className:`text-muted-foreground`,value:t.get(i)??``,onValueChange:e=>n({[i]:e||null}),options:[{value:``,label:r(`filters.any`)},{value:`true`,label:r(`filters.onlyEmpty`)},{value:`false`,label:r(`filters.hideEmpty`)}]})}function FA({id:e,inline:t,field:n,params:r,onChange:i}){let a=X(),o=Tw(n.name,`in`),s=(r.get(o)??``).split(`,`).filter(Boolean),c=e=>{let t=s.includes(e)?s.filter(t=>t!==e):[...s,e];i({[o]:t.length>0?t.join(`,`):null})};return t?(0,b.jsx)(IA,{field:n,selected:s,onToggle:c}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:e,children:n.label}),(0,b.jsxs)(Kh,{children:[(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsxs)(q,{id:e,type:`button`,variant:`outline`,className:`justify-between font-normal`,children:[(0,b.jsx)(`span`,{className:`truncate`,children:s.length===0?a(`common.all`):s.length<=2?s.map(e=>PD(n,e)).join(`, `):a(`filters.selected`,{count:s.length})}),(0,b.jsx)(tb,{className:`size-4 opacity-60`,"aria-hidden":!0})]})}),(0,b.jsx)(Jh,{children:(0,b.jsx)(Yh,{align:`start`,sideOffset:4,className:`z-50 min-w-48 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:(0,b.jsx)(IA,{field:n,selected:s,onToggle:c})})})]})]})}function IA({field:e,selected:t,onToggle:n}){return(0,b.jsx)(`ul`,{"aria-label":e.label,children:(e.enumValues??[]).map(r=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent`,children:[(0,b.jsx)(Af,{checked:t.includes(r),onCheckedChange:()=>n(r),className:`flex size-4 items-center justify-center rounded border border-input data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,children:(0,b.jsx)(Mf,{children:(0,b.jsx)($y,{className:`size-3`})})}),PD(e,r)]})},r))})}function LA({inline:e,touch:t,resource:n,field:r,operators:i,params:a,onChange:o}){let{t:s,calendar:c}=Y(),l=`filter-${r.name}`;if(t&&r.type===`enum`&&i.includes(`in`))return(0,b.jsx)(GA,{field:r,params:a,onChange:o});if(r.type===`enum`&&i.includes(`in`))return(0,b.jsx)(FA,{id:l,inline:e,field:r,params:a,onChange:o});if(r.type===`relation`){let e=r.relation?.kind===`to-many`?`in`:`eq`;return i.includes(e)?(0,b.jsx)(BA,{id:l,resource:n,field:r,operator:e,params:a,onChange:o}):null}if((r.type===`enum`||r.type===`boolean`)&&i.includes(`eq`)){let e=Tw(r.name,`eq`),n=r.type===`boolean`?[[`true`,s(`common.yes`)],[`false`,s(`common.no`)]]:(r.enumValues??[]).map(e=>[e,PD(r,e)]);return t&&n.length<=3?(0,b.jsx)(KA,{label:r.label,options:[[``,s(`common.all`)],...n],value:a.get(e)??``,onChange:t=>o({[e]:t||null})}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:l,children:r.label}),(0,b.jsx)(Bw,{id:l,value:a.get(e)??``,onValueChange:t=>o({[e]:t||null}),options:[{value:``,label:s(`common.all`)},...n.map(([e,t])=>({value:e,label:t}))]})]})}if((r.type===`date`||r.type===`datetime`)&&i.includes(`gte`)&&i.includes(`lte`)){let e=(e,t)=>r.type===`date`||!t?t:new Date(`${t}T${e===`gte`?`00:00:00.000`:`23:59:59.999`}`).toISOString(),t=e=>e&&r.type===`datetime`?aD(e).slice(0,10):e??``;return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:r.label}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`gte`,`lte`].map(n=>{let i=Tw(r.name,n),c=`${l}-${n}`,u=s(n===`gte`?`filters.from`:`filters.to`);return(0,b.jsxs)(`div`,{className:`flex min-w-36 flex-1 flex-col gap-1`,children:[(0,b.jsx)(t_,{htmlFor:c,className:`text-xs text-muted-foreground`,children:u}),(0,b.jsx)(vw,{id:c,label:`${r.label} ${u}`,value:t(a.get(i)),onChange:t=>o({[i]:e(n,t)||null})})]},n)})})]})}if(OA.has(r.type)&&i.includes(`gte`)&&i.includes(`lte`)){let e=r.type===`date`?`date`:r.type===`datetime`?`datetime-local`:`text`,t=e=>r.type===`datetime`&&e?new Date(e).toISOString():a_(e.trim()).replace(/,/g,``),n=e=>e&&r.type===`datetime`?aD(e):e??``;return(0,b.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(`legend`,{className:`mb-1.5 text-sm font-medium`,children:r.label}),(0,b.jsx)(`div`,{className:`flex gap-2`,children:[`gte`,`lte`].map(i=>{let c=Tw(r.name,i),u=`${l}-${i}`;return(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1`,children:[(0,b.jsx)(t_,{htmlFor:u,className:`text-xs text-muted-foreground`,children:s(i===`gte`?`filters.from`:`filters.to`)}),(0,b.jsx)(VA,{id:u,type:e,inputMode:e===`text`?`decimal`:void 0,value:n(a.get(c)),onCommit:e=>o({[c]:t(e)||null})})]},i)})})]})}let u=i.includes(`contains`)?`contains`:i.includes(`eq`)?`eq`:void 0;if(!u)return null;let d=Tw(r.name,u);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:l,children:u===`contains`?s(`filters.contains`,{field:r.label}):r.label}),(0,b.jsx)(VA,{id:l,value:a.get(d)??``,onCommit:e=>o({[d]:e.trim()||null})})]})}function RA({schema:e,params:t,onChange:n}){let r=X(),i=CA(e,t);return(0,b.jsx)(`ul`,{"aria-label":r(`filters.active`),className:`flex flex-wrap gap-2`,children:i.map(t=>(0,b.jsxs)(`li`,{className:`inline-flex h-9 items-center gap-1 rounded-full border border-primary bg-primary-soft ps-3 pe-1.5 text-[13px] font-semibold text-primary`,children:[(0,b.jsxs)(`span`,{className:`font-medium`,children:[t.label,`:`]}),t.ref?(0,b.jsx)(zA,{resource:e.name,chip:t}):(0,b.jsx)(`span`,{children:t.value}),(0,b.jsx)(`button`,{type:`button`,className:`rounded-full p-1 hover:bg-primary-soft`,"aria-label":r(`filters.removeChip`,{label:t.label}),onClick:()=>n(Object.fromEntries(t.remove.map(e=>[e,null]))),children:(0,b.jsx)($S,{className:`size-3.5`})})]},t.key))})}function zA({resource:e,chip:t}){let n=jv(e,t.ref.field,t.ref.ids);if(!n.data)return(0,b.jsx)(`span`,{children:t.value});let r=new Map(n.data.items.map(e=>[String(e.id),e.title]));return(0,b.jsx)(`span`,{children:t.ref.prefix+t.ref.ids.map(e=>r.get(e)??`#${e}`).join(`, `)})}function BA({id:e,resource:t,field:n,operator:r,params:i,onChange:a}){let o=Tw(n.name,r),s=(i.get(o)??``).split(`,`).filter(Boolean),c=jv(t,n.name,s),l=new Map((c.data?.items??[]).map(e=>[String(e.id),e])),u=s.map(e=>l.get(e)??{id:e,title:`#${e}`});return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(t_,{htmlFor:e,children:n.label}),(0,b.jsx)(jD,{id:e,resource:t,field:n,clearable:!0,value:r===`in`?u:u[0]??null,onChange:e=>{let t=Array.isArray(e)?e:e?[e]:[];a({[o]:t.length>0?t.map(e=>e.id).join(`,`):null})}})]})}function VA({id:e,value:t,type:n=`text`,inputMode:r,onCommit:i}){let[a,o]=(0,y.useState)(t);(0,y.useEffect)(()=>{o(t)},[t]);let s=()=>{a!==t&&i(a)};return(0,b.jsx)(e_,{id:e,type:n,inputMode:r,value:a,onChange:e=>o(e.target.value),onBlur:s,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),s())}})}function HA({label:e,placeholder:t,value:n,className:r,onChange:i,onSubmit:a}){return(0,b.jsxs)(`form`,{role:`search`,className:U(`relative w-[300px] max-w-full`,r),onSubmit:e=>{e.preventDefault(),a()},children:[(0,b.jsx)(rS,{className:`pointer-events-none absolute start-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(e_,{"aria-label":e,placeholder:t,value:n,className:`ps-8`,onChange:e=>i(e.target.value)})]})}function UA({chip:e,...t}){let n=X(),{field:r,operators:i,params:a,onChange:o}=t,s=e&&(()=>o(Object.fromEntries(e.remove.map(e=>[e,null])))),c=r.type===`boolean`&&i.includes(`eq`),l=Tw(r.name,`eq`),u=c&&a.get(l)===`true`,d=s&&!u;return(0,b.jsxs)(Kh,{children:[(0,b.jsxs)(`span`,{className:U(`inline-flex h-8 items-center rounded-lg border border-input`,e&&`bg-card`),"data-filter":r.name,children:[c?(0,b.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":u,"aria-label":n(`filters.onlyThese`,{field:r.label}),onClick:()=>o({[l]:u?null:`true`}),className:`inline-flex h-full items-center gap-1.5 rounded-lg ps-2.5 pe-1.5 text-[12.5px] font-medium outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50`,children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:U(`relative inline-flex h-3.5 w-6 shrink-0 items-center rounded-full transition-colors`,u?`bg-primary`:`bg-input`),children:(0,b.jsx)(`span`,{className:U(`block size-2.5 rounded-full bg-background shadow transition-transform`,u?`translate-x-3 rtl:-translate-x-3`:`translate-x-0.5 rtl:-translate-x-0.5`)})}),r.label,e&&!u&&(0,b.jsx)(`span`,{className:`max-w-48 truncate rounded-[5px] bg-muted px-1.5 text-xs font-medium`,children:e.value})]}):(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsxs)(`button`,{type:`button`,className:`inline-flex h-full items-center gap-1.5 rounded-lg px-2.5 text-[12.5px] font-medium outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50`,children:[(0,b.jsx)(zb,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),r.label,e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`sr-only`,children:`:`}),(0,b.jsx)(`span`,{className:`h-4 w-px bg-border`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`max-w-48 truncate rounded-[5px] bg-muted px-1.5 text-xs font-medium`,children:e.ref?(0,b.jsx)(zA,{resource:t.resource,chip:e}):e.value})]}):(0,b.jsx)(tb,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0})]})}),c&&(0,b.jsx)(qh,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,className:`me-0.5 rounded p-0.5 text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50`,"aria-label":n(`filters.moreChoices`,{field:r.label}),children:(0,b.jsx)(tb,{className:`size-3.5`,"aria-hidden":!0})})}),d&&(0,b.jsx)(`button`,{type:`button`,className:U(`me-1 rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground`,!c&&`-ms-1`),"aria-label":n(`filters.removeChip`,{label:r.label}),onClick:s,children:(0,b.jsx)($S,{className:`size-3.5`})})]}),(0,b.jsx)(Jh,{children:(0,b.jsxs)(Yh,{align:`start`,sideOffset:6,collisionPadding:8,onOpenAutoFocus:r.type===`relation`?e=>e.preventDefault():void 0,className:U(`z-50 flex w-72 flex-col gap-3 rounded-[10px] border bg-popover p-3 text-popover-foreground shadow-lg outline-none`,r.type!==`relation`&&`max-h-[var(--radix-popover-content-available-height)] overflow-y-auto`),children:[(0,b.jsx)(`p`,{className:`text-[12.5px] font-semibold`,children:n(`filters.filterBy`,{field:r.label})}),r.type===`relation`&&(0,b.jsx)(`p`,{className:`-mt-2 text-xs text-muted-foreground`,children:n(`filters.relationHint`,{field:r.label})}),(0,b.jsx)(NA,{...t,inline:!0})]})})]})}var WA=`inline-flex h-9 items-center gap-1.5 rounded-full border border-input bg-card px-3 text-[13px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50 data-[state=checked]:border-primary data-[state=checked]:bg-primary-soft data-[state=checked]:font-semibold data-[state=checked]:text-primary`;function GA({field:e,params:t,onChange:n}){let r=Tw(e.name,`in`),i=(t.get(r)??``).split(`,`).filter(Boolean),a=e=>{let t=i.includes(e)?i.filter(t=>t!==e):[...i,e];n({[r]:t.length>0?t.join(`,`):null})};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,b.jsx)(`span`,{className:`text-sm font-medium`,"aria-hidden":!0,children:e.label}),(0,b.jsx)(`ul`,{"aria-label":e.label,className:`flex flex-wrap gap-2`,children:(e.enumValues??[]).map(t=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(Af,{checked:i.includes(t),onCheckedChange:()=>a(t),className:WA,children:[(0,b.jsx)(Mf,{children:(0,b.jsx)($y,{className:`size-3.5`})}),PD(e,t)]})},t))})]})}function KA({label:e,options:t,value:n,onChange:r}){return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,b.jsx)(`span`,{className:`text-sm font-medium`,"aria-hidden":!0,children:e}),(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":e,className:`grid auto-cols-fr grid-flow-col gap-0.5 rounded-[10px] bg-muted p-[3px]`,children:t.map(([e,t])=>(0,b.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n===e,className:U(`h-9 rounded-lg text-[13px] text-muted-foreground`,n===e&&`bg-card font-semibold text-foreground shadow-sm`),onClick:()=>r(e),children:t},e))})]})}var qA=e=>e.total===null?e.hasMore===!0:e.page*e.pageSize<e.total;function JA({schema:e,query:t,columns:n,trash:r,selectMode:i,selected:a,onSelect:o,restore:s,empty:c}){let l=X(),u=e.list.pagination===`keyset`,d=mt({queryKey:[`list`,e.name,`cards`,t],initialPageParam:void 0,queryFn:({pageParam:n})=>{let r=new URLSearchParams(t);return n&&r.set(u?`after`:`page`,n),Q.list(e.name,r)},getNextPageParam:e=>u?e.nextCursor??void 0:qA(e)?String(e.page+1):void 0}),f=new Set,p=(d.data?.pages??[]).flatMap(e=>e.items).filter(e=>{let t=String(e._id);return!f.has(t)&&(f.add(t),!0)}),m=d.data?.pages[0]?.total??null,h=(0,y.useRef)(null),{hasNextPage:g,isFetchingNextPage:_,fetchNextPage:v}=d;(0,y.useEffect)(()=>{let e=h.current;if(!e||!g||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&!_&&v()},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[g,_,v]);let x=e=>{let t=new Set(a);t.has(e)?t.delete(e):t.add(e),o(t)};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsxs)(`ul`,{"aria-label":e.label,"aria-busy":d.isFetching,className:`flex flex-col gap-2.5`,children:[d.isPending&&Array.from({length:4},(e,t)=>(0,b.jsx)(`li`,{"aria-hidden":!0,className:`h-20 animate-pulse rounded-card border bg-muted/40`},`skeleton-${t}`)),p.map(t=>{let o=String(t._id),c=(0,b.jsx)(YA,{schema:e,item:t,columns:n});return(0,b.jsx)(`li`,{children:r?(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-2 rounded-card border bg-card p-3 shadow-card`,children:[c,s(t)]}):i?(0,b.jsxs)(`label`,{className:U(`flex cursor-pointer items-start gap-3 rounded-card border bg-card p-3 shadow-card`,a.has(o)&&`border-primary bg-primary-soft`),children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 accent-primary`,checked:a.has(o),onChange:()=>x(o),"aria-label":l(`list.selectRow`,{name:String(t._title??o)})}),c]}):(0,b.jsx)(xo,{to:`/${e.name}/${encodeURIComponent(o)}`,className:`block rounded-card border bg-card p-3 shadow-card active:bg-muted`,children:c})},o)}),d.isSuccess&&p.length===0&&(0,b.jsx)(`li`,{className:`flex flex-col items-center gap-2 py-6 text-center text-sm text-muted-foreground`,children:c})]}),d.isError&&(0,b.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[(0,b.jsx)(`span`,{children:l(`list.loadFailed`)}),(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void d.refetch(),children:l(`list.retry`)})]}),(0,b.jsxs)(`div`,{ref:h,className:`flex flex-col items-center gap-2 py-2 text-sm text-muted-foreground`,children:[p.length>0&&(0,b.jsx)(`span`,{children:m===null?l(`list.showing`,{shown:E_(p.length)}):l(`list.showingOf`,{shown:E_(p.length),total:E_(m)})}),g&&(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:_,onClick:()=>void v(),children:l(_?`common.loading`:`list.loadMore`)})]})]})}function YA({schema:e,item:t,columns:n}){let r=Object.entries(e.list.computed??{}).filter(([t])=>e.list.columns.includes(t));if(r.length>0)return(0,b.jsx)(XA,{schema:e,item:t,computed:r});let i=e.list.mobile,a=typeof t._title==`string`?t._title:String(t._id);if(!i)return(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`div`,{className:`text-[14.5px] font-semibold`,children:a}),(0,b.jsx)(`dl`,{className:`mt-1 grid grid-cols-2 gap-x-3 gap-y-0.5 text-sm`,children:n.filter(e=>fC(t[e.name],e)!==t._title).map(e=>(0,b.jsxs)(y.Fragment,{children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`truncate`,children:(0,b.jsx)(hD,{value:t[e.name],field:e,record:t,plain:!0})})]},e.name))})]});let o=t=>t?e.fields.find(e=>e.name===t):void 0,s=o(i.title),c=o(i.subtitle),l=o(i.badge),u=i.meta.map(o).filter(e=>e!==void 0);return(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,b.jsx)(`span`,{className:`min-w-0 truncate text-[14.5px] font-semibold`,children:s?fC(t[s.name],s):a}),l&&t[l.name]!==null&&t[l.name]!==void 0&&(0,b.jsx)(mD,{value:t[l.name],field:l,className:`shrink-0`})]}),c&&(0,b.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:fC(t[c.name],c)}),u.length>0&&(0,b.jsx)(`dl`,{className:`mt-1 flex flex-wrap gap-x-4 gap-y-0.5 text-sm`,children:u.map(e=>(0,b.jsxs)(`div`,{className:`flex gap-1`,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{children:(0,b.jsx)(hD,{value:t[e.name],field:e,record:t,plain:!0})})]},e.name))})]})}function XA({schema:e,item:t,computed:n}){let r=e=>n.filter(([,t])=>t.kind===e),i=([n,r],i=!0)=>(0,b.jsx)(XO,{schema:e,name:n,column:r,item:t,compact:i},n),[a]=r(`image`),[o]=r(`title`);return(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-3`,children:[a&&i(a),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,b.jsx)(`div`,{className:`min-w-0 flex-1`,children:o?i(o):(0,b.jsx)(`span`,{className:`text-[14.5px] font-semibold`,children:typeof t._title==`string`?t._title:String(t._id)})}),r(`toggle`).map(e=>i(e))]}),r(`money`).map(e=>i(e)),(r(`badge`).length>0||r(`count`).length>0)&&(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[r(`badge`).map(e=>i(e)),r(`count`).map(([e,n])=>(0,b.jsxs)(dD,{tone:`neutral`,children:[YO(n,t._computed?.[e]).text,` `,n.label]},e))]})]})]})}function ZA({schema:e,item:t,onClose:n}){let r=X(),i=(0,y.useRef)(null);t&&!i.current&&(i.current=document.activeElement);let a=t?String(t._id):void 0,o=Ov(e.name,a).data??t,s=typeof o?._title==`string`?o._title:`#${a}`,c=e.fields.filter(e=>e.persisted&&!e.name.includes(`.`)&&o!==void 0&&Object.hasOwn(o,e.name));return(0,b.jsx)(Yd,{open:t!==void 0,onOpenChange:e=>!e&&n(),children:(0,b.jsxs)(tf,{children:[(0,b.jsx)(rf,{className:dT}),(0,b.jsxs)(cf,{className:`fixed inset-y-0 end-0 z-50 flex w-full max-w-md flex-col border-s bg-background shadow-xl outline-none`,"aria-describedby":void 0,onCloseAutoFocus:e=>{e.preventDefault(),i.current?.focus(),i.current=null},children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 border-b p-4`,children:[(0,b.jsx)(pf,{className:`min-w-0 flex-1 truncate text-lg font-semibold`,children:r(`list.quickView`,{name:s})}),(0,b.jsx)(hf,{asChild:!0,children:(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":r(`list.close`),children:(0,b.jsx)($S,{})})})]}),(0,b.jsx)(`dl`,{className:`grid flex-1 grid-cols-[minmax(6rem,auto)_1fr] content-start gap-x-4 gap-y-2 overflow-y-auto p-4 text-sm`,children:c.map(e=>(0,b.jsxs)(`div`,{className:`contents`,children:[(0,b.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,b.jsx)(`dd`,{className:`break-words`,children:(0,b.jsx)(hD,{value:o[e.name],field:e,record:o,detailed:!0})})]},e.name))}),(0,b.jsxs)(`div`,{className:`flex gap-2 border-t p-4`,children:[(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(xo,{to:`/${e.name}/${encodeURIComponent(a??``)}`,children:[(0,b.jsx)(Lx,{}),r(`list.edit`)]})}),(0,b.jsx)(hf,{asChild:!0,children:(0,b.jsx)(q,{variant:`outline`,children:r(`list.close`)})})]})]})]})})}function QA({className:e,...t}){return(0,b.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full`,children:(0,b.jsx)(`table`,{"data-slot":`table`,className:U(`w-full caption-bottom text-[13px]`,e),...t})})}function $A({className:e,...t}){return(0,b.jsx)(`thead`,{"data-slot":`table-header`,className:U(`[&_tr]:border-b`,e),...t})}function ej({className:e,...t}){return(0,b.jsx)(`tbody`,{"data-slot":`table-body`,className:U(`[&_tr:last-child]:border-0`,e),...t})}function tj({className:e,...t}){return(0,b.jsx)(`tr`,{"data-slot":`table-row`,className:U(`border-b border-border transition-colors hover:bg-[color-mix(in_oklab,var(--muted)_60%,transparent)] has-aria-expanded:bg-muted/50 data-[state=selected]:bg-primary-soft`,e),...t})}function nj({className:e,...t}){return(0,b.jsx)(`th`,{"data-slot":`table-head`,className:U(`px-3.5 py-2.5 text-start align-middle text-[12.5px] font-medium whitespace-nowrap text-muted-foreground bg-[color-mix(in_oklab,var(--muted)_50%,transparent)] [&:has([role=checkbox])]:pe-0`,e),...t})}function rj({className:e,...t}){return(0,b.jsx)(`td`,{"data-slot":`table-cell`,className:U(`px-3.5 py-2.5 align-middle whitespace-nowrap [&:has([role=checkbox])]:pe-0`,e),...t})}function ij(e){let t=e.map(e=>String(e).replace(/~/g,`~0`).replace(/,/g,`~1`)).join(`,`);return t===`new`?`~new`:t}function aj(){let{resource:e=``}=$i(),[t,n]=To(),r=Math.max(1,Number(t.get(`page`))||1),i=t.get(`sort`)??void 0,a=wv(e),o=DA(),s=Dv(e,ww(t),!o),[c,l]=(0,y.useState)(!1),u=S(),d=X(),f=pt({mutationFn:t=>Q.restore(e,t),onSuccess:()=>u.invalidateQueries({queryKey:[`list`,e]})}),p=t.get(`trashed`)===`only`,m=gA(e),h=ww(t),g=(()=>{let e=new URLSearchParams(h);return e.delete(`page`),e.delete(`after`),e.toString()})(),[_,v]=(0,y.useState)(new Set);(0,y.useEffect)(()=>v(new Set),[h,e]);let[x,C]=(0,y.useState)(),[w,T]=(0,y.useState)(!1),[E,D]=(0,y.useState)();(0,y.useEffect)(()=>D(void 0),[e]);let O=pt({mutationFn:t=>Q.bulkDelete(e,t),onSuccess:async t=>{v(new Set),T(!1),D({title:d(`list.bulkDeleted`,{count:t.ok.length}),result:t}),await u.invalidateQueries({queryKey:[`list`,e]})},onError:()=>T(!1)}),[k,A]=(0,y.useState)([]),j=t.has(`after`);if((0,y.useEffect)(()=>{j||A([])},[j]),a.isPending)return(0,b.jsx)(W,{children:d(`common.loading`)});if(a.isError)return(0,b.jsx)(W,{tone:`error`,children:a.error.message});let M=a.data,N=dA(M.list.columns,m).flatMap(e=>{let t=M.list.computed?.[e];if(t)return[{name:e,label:t.label,computed:t}];let n=M.fields.find(t=>t.name===e);return n?[{name:e,label:n.label,field:n}]:[]}),ee=N.flatMap(e=>e.field&&!M.primaryKeys.includes(e.name)?[e.field]:[]);for(let e=N.length-2;e>=0;e--)N[e].computed?.kind===`image`&&N[e+1].computed?.kind===`title`&&(N[e+1]={...N[e+1],image:N[e]},N.splice(e,1));let P=N.findIndex(e=>e.computed?.kind!==`image`&&e.computed?.kind!==`toggle`),F=i?{field:i.replace(/^-/,``),direction:i.startsWith(`-`)?`desc`:`asc`}:M.list.defaultSort,te=s.data?.items??[],ne=M.list.pagination===`keyset`,re=t.get(`after`),ie=ne?{summary:kw(s.data,1).summary,label:d(`list.page`,{page:k.length+1}),hasNext:!!s.data?.nextCursor}:kw(s.data,r),ae=ne?k.length>0:r>1;function oe(){if(!ne)return fe({page:String(r+1)});A([...k,re??``]),fe({after:s.data?.nextCursor??null})}function se(){if(!ne)return fe({page:String(r-1)});let e=k[k.length-1];A(k.slice(0,-1)),fe({after:e||null})}let ce=M.permissions??{create:!0,update:!0,delete:!0,purge:!0},le=!p&&(ce.delete||sO(M,[]).length>0||(M.prints??[]).some(e=>e.bulk)),ue=sO(M,te.filter(e=>_.has(String(e._id)))),de=e=>`/${M.name}/${encodeURIComponent(String(e._id))}`;function fe(e){n(t=>Ow(t,e))}function pe(e){fe({sort:F.field===e&&F.direction===`asc`?`-${e}`:e})}let me=`border-transparent bg-transparent text-inherit hover:bg-background/15`,I=le&&_.size>0&&(0,b.jsxs)(`div`,{role:`region`,"aria-label":d(`list.selected`,{count:_.size}),className:U(`flex flex-wrap items-center gap-2 text-sm`,o?`fixed inset-x-3 bottom-4 z-30 rounded-[14px] bg-foreground py-1.5 ps-2 pe-1.5 text-background shadow-[0_12px_32px_rgba(0,0,0,.25)]`:`border-b bg-primary-soft px-3.5 py-2`),children:[(0,b.jsx)(`span`,{className:U(`font-semibold`,o?`flex-1 text-sm`:`pe-1.5 text-primary`),children:d(`list.selected`,{count:_.size})}),(0,b.jsx)(NO,{schema:M,ids:[..._],bulkOnly:!0,size:`sm`}),ue.map(e=>(0,b.jsx)(jO,{resource:M.name,action:e,ids:[..._],size:`sm`,className:o?me:void 0,onDone:(t,n)=>{let r=pO(t,n);v(new Set),O.reset(),D({title:d(`action.bulkDone`,{action:e.label,count:r.ok.length}),result:r})}},e.name)),ce.delete?w?(0,b.jsx)(q,{variant:`destructive`,size:`sm`,disabled:O.isPending,onClick:()=>O.mutate([..._]),children:d(`list.confirmDeleteSelected`,{count:_.size})}):(0,b.jsxs)(q,{variant:`outline`,size:o?`icon-sm`:`sm`,className:o?me:`text-destructive`,"aria-label":o?d(`list.deleteSelected`):void 0,onClick:()=>T(!0),children:[(0,b.jsx)(NS,{}),!o&&d(`list.deleteSelected`)]}):null,(0,b.jsx)(q,{variant:`ghost`,size:o?`icon-sm`:`sm`,className:o?U(me,`-order-1`):`ms-auto`,"aria-label":o?d(`list.clearSelection`):void 0,onClick:()=>v(new Set),children:o?(0,b.jsx)($S,{}):d(`list.clearSelection`)})]});return(0,b.jsxs)(`div`,{className:U(`flex flex-col gap-4`,o&&_.size>0&&`pb-16`),children:[(0,b.jsxs)(`div`,{className:U(`flex flex-wrap gap-3`,o?`items-center gap-2`:`items-end`),children:[(0,b.jsxs)(`div`,{className:U(`flex gap-0.5`,o?`items-baseline gap-1.5`:`flex-col`),children:[(0,b.jsx)(`h1`,{className:o?`text-base font-semibold`:`text-[22px] font-bold`,children:M.label}),s.data&&s.data.total!==null&&(0,b.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:kw(s.data,r).summary})]}),(0,b.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[M.softDelete&&ce.delete&&(0,b.jsxs)(q,{variant:p?`secondary`:`outline`,size:o?`icon`:`default`,"aria-pressed":p,"aria-label":o?d(`list.trash`):void 0,onClick:()=>fe({trashed:p?null:`only`}),children:[(0,b.jsx)(NS,{}),!o&&d(`list.trash`)]}),o&&le&&(0,b.jsx)(q,{variant:c?`secondary`:`outline`,size:`icon`,"aria-pressed":c,"aria-label":d(c?`list.done`:`list.select`),onClick:()=>{l(!c),v(new Set)},children:(0,b.jsx)(dx,{})}),!p&&cO(M).map(e=>(0,b.jsx)(jO,{resource:M.name,action:e,onDone:()=>void 0},e.name)),!p&&(0,b.jsx)(PO,{schema:M,query:uj(t),iconOnly:o}),M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:o?`icon`:`default`,className:U(o&&`size-10`),children:(0,b.jsxs)(xo,{to:`/${M.name}/new`,"aria-label":o?d(`list.new`):void 0,children:[(0,b.jsx)(Gx,{}),!o&&d(`list.new`)]})})]})]}),M.list.tabs&&M.list.tabs.length>0&&!p&&(0,b.jsx)(oj,{schema:M,params:t,onChange:fe}),(0,b.jsx)(AA,{schema:M,params:t,onChange:fe,trailing:(0,b.jsx)(_A,{schema:M,prefs:m})}),s.isError&&(0,b.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:[(0,b.jsxs)(`span`,{children:[d(`list.loadFailed`),` `,W_(s.error)]}),(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void s.refetch(),children:d(`list.retry`)})]}),f.isError&&(0,b.jsx)(W,{tone:`error`,children:W_(f.error)}),p&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d(`list.trashNote`)}),o&&I,E&&(0,b.jsx)(lj,{title:E.title,result:E.result,items:te}),O.isError&&(0,b.jsx)(W,{tone:`error`,children:W_(O.error)}),o?(0,b.jsx)(JA,{schema:M,query:g,columns:ee,trash:p,selectMode:c,selected:_,onSelect:v,restore:e=>(0,b.jsx)(cj,{item:e,pending:f.isPending,onRestore:e=>f.mutate(e)}),empty:(0,b.jsxs)(b.Fragment,{children:[d(Ew(t)?`list.noMatches`:`list.noRecords`),!Ew(t)&&M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,children:(0,b.jsxs)(xo,{to:`/${M.name}/new`,children:[(0,b.jsx)(Gx,{}),d(`list.new`)]})})]})}):(0,b.jsx)(b.Fragment,{children:(0,b.jsxs)(`section`,{className:`overflow-hidden rounded-card border bg-card shadow-card`,children:[I,(0,b.jsx)(`div`,{className:`overflow-x-auto`,children:(0,b.jsxs)(QA,{className:U(m.density===`compact`&&`[&_td]:py-1 [&_th]:h-8`),children:[(0,b.jsx)($A,{children:(0,b.jsxs)(tj,{children:[le&&(0,b.jsx)(nj,{className:`w-0`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":d(`list.selectPage`),checked:te.length>0&&te.every(e=>_.has(String(e._id))),onChange:e=>v(e.target.checked?new Set(te.map(e=>String(e._id))):new Set)})}),N.map(e=>(0,b.jsxs)(nj,{className:`relative`,style:m.widths[e.name]?{width:m.widths[e.name],minWidth:m.widths[e.name]}:void 0,"aria-sort":F.field===e.name?F.direction===`asc`?`ascending`:`descending`:void 0,children:[M.list.sortable.includes(e.name)?(0,b.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1`,onClick:()=>pe(e.name),children:[e.label,F.field===e.name&&(F.direction===`asc`?(0,b.jsx)(ky,{className:`size-3.5`}):(0,b.jsx)(Ty,{className:`size-3.5`}))]}):e.label,(0,b.jsx)(vA,{resource:M.name,column:e.name,label:e.label,width:m.widths[e.name]})]},e.name)),p&&(0,b.jsx)(nj,{className:`w-0`,children:(0,b.jsx)(`span`,{className:`sr-only`,children:d(`list.actions`)})})]})}),(0,b.jsxs)(ej,{children:[s.isPending&&Array.from({length:5},(e,t)=>(0,b.jsxs)(tj,{"aria-hidden":!0,children:[le&&(0,b.jsx)(rj,{}),N.map(e=>(0,b.jsx)(rj,{children:(0,b.jsx)(`div`,{className:`h-4 w-3/4 animate-pulse rounded bg-muted`})},e.name))]},`skeleton-${t}`)),te.map(e=>(0,b.jsxs)(tj,{"data-state":_.has(String(e._id))?`selected`:void 0,className:p?void 0:`cursor-pointer focus-visible:bg-muted/50 focus-visible:outline-none`,tabIndex:p?void 0:0,onClick:p?void 0:()=>C(e),onKeyDown:p?void 0:t=>{t.key===`Enter`&&t.target===t.currentTarget&&(t.preventDefault(),C(e))},children:[le&&(0,b.jsx)(rj,{onClick:e=>e.stopPropagation(),children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":d(`list.selectRow`,{name:String(e._title??e._id)}),checked:_.has(String(e._id)),onChange:t=>{let n=new Set(_);t.target.checked?n.add(String(e._id)):n.delete(String(e._id)),v(n)}})}),N.map((t,n)=>(0,b.jsx)(rj,{children:t.computed?(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[t.image&&(0,b.jsx)(XO,{schema:M,name:t.image.name,column:t.image.computed,item:e}),n===P&&!p?(0,b.jsx)(xo,{to:de(e),className:`min-w-0 hover:underline`,onClick:e=>e.stopPropagation(),children:(0,b.jsx)(XO,{schema:M,name:t.name,column:t.computed,item:e})}):(0,b.jsx)(XO,{schema:M,name:t.name,column:t.computed,item:e})]}):n===P&&!p?(0,b.jsx)(xo,{to:de(e),className:`font-semibold hover:underline`,onClick:e=>e.stopPropagation(),children:fC(e[t.name],t.field)}):!p&&M.list.editable.includes(t.name)&&!(Array.isArray(e._readonly)&&e._readonly.includes(t.name))&&e._perm?.update!==!1?(0,b.jsx)(bA,{schema:M,item:e,field:t.field}):(0,b.jsx)(sj,{value:e[t.name],field:t.field,record:e})},t.name)),p&&(0,b.jsx)(rj,{children:(0,b.jsx)(cj,{item:e,pending:f.isPending,onRestore:e=>f.mutate(e)})})]},String(e._id))),s.isSuccess&&te.length===0&&(0,b.jsx)(tj,{children:(0,b.jsx)(rj,{colSpan:N.length+(p||le?1:0),className:`text-center text-muted-foreground`,children:(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6`,children:[d(Ew(t)?`list.noMatches`:`list.noRecords`),!Ew(t)&&M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,children:(0,b.jsxs)(xo,{to:`/${M.name}/new`,children:[(0,b.jsx)(Gx,{}),d(`list.new`)]})})]})})})]})]})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-t px-3.5 py-2.5 text-[13px] text-muted-foreground`,children:[(0,b.jsx)(`span`,{children:Aw(s.data,ne?1:r,te.length)||ie.summary}),(0,b.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[!ne&&(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{id:`list-page-size-label`,children:d(`list.rowsPerPage`)}),(0,b.jsx)(Bw,{"aria-label":d(`list.rowsPerPage`),className:`w-auto min-w-16`,value:String(s.data?.pageSize??M.list.pageSize),onValueChange:e=>fe({pageSize:Number(e)===M.list.pageSize?null:e}),options:jw(M.list.pageSize).map(e=>({value:String(e),label:E_(e)}))})]}),(0,b.jsx)(`span`,{children:ie.label}),(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,"aria-label":d(`list.previousPage`),disabled:!ae,onClick:se,children:(0,b.jsx)(rb,{className:`rtl:rotate-180`})}),(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,"aria-label":d(`list.nextPage`),disabled:!ie.hasNext,onClick:oe,children:(0,b.jsx)(ab,{className:`rtl:rotate-180`})})]})]})]})}),(0,b.jsx)(ZA,{schema:M,item:x,onClose:()=>C(void 0)})]})}function oj({schema:e,params:t,onChange:n}){let r=ft({queryKey:[`list`,e.name,`tab-counts`],queryFn:()=>Q.tabCounts(e.name)}),i=e.list.tabs,a=Fw(i,t);return(0,b.jsx)(`div`,{className:`overflow-x-auto`,children:(0,b.jsx)(Xk,{items:i.map(e=>{let t=r.data?.[e.key];return{key:e.key,label:e.label,...t?{count:E_(t.count),estimate:t.estimate}:{}}}),value:a?.key??``,onChange:e=>n(Iw(i.find(t=>t.key===e),t))})})}function sj({value:e,field:t,record:n}){let r=t.relation?.resource;if(!r||e==null)return(0,b.jsx)(hD,{value:e,field:t,record:n});let i=(Array.isArray(e)?e:[e]).filter(YE);return i.length===0?(0,b.jsx)(b.Fragment,{children:fC(e,t)}):(0,b.jsx)(b.Fragment,{children:i.map((e,t)=>(0,b.jsxs)(y.Fragment,{children:[t>0&&`, `,(0,b.jsx)(xo,{to:`/${r}/${encodeURIComponent(ij([e.id]))}`,className:`hover:underline`,onClick:e=>e.stopPropagation(),children:e.title})]},String(e.id)))})}function cj({item:e,pending:t,onRestore:n}){let r=X();return(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:t,"aria-label":r(`list.restoreRecord`,{name:String(e._title??e._id)}),onClick:()=>n(String(e._id)),children:[(0,b.jsx)(tS,{}),r(`list.restore`)]})}function lj({title:e,result:t,items:n}){let r=X(),i=e=>{let t=n.find(t=>String(t._id)===e);return typeof t?._title==`string`?t._title:`#${e}`};return(0,b.jsxs)(`div`,{role:`status`,className:`rounded-lg border px-3 py-2 text-sm`,children:[(0,b.jsxs)(`p`,{children:[e,t.failed.length>0&&` · ${r(`list.bulkFailed`,{count:t.failed.length})}`]}),t.failed.length>0&&(0,b.jsx)(`ul`,{className:`mt-1 list-disc ps-5 text-destructive`,children:t.failed.map(e=>(0,b.jsxs)(`li`,{children:[i(e.id),`: `,e.message]},e.id))})]})}function uj(e){let t=new URLSearchParams(e);for(let e of[`page`,`pageSize`,`after`])t.delete(e);return t}function dj(){let e=X();return(0,b.jsx)(W,{children:e(`common.pageNotFound`)})}function fj(e){let t=oD(e.schema.fields.filter(e=>!e.secret),{...e.values,_files:e.files});for(let n of e.schema.fields)n.secret&&(t[n.name]=``);return t}function pj(e,t,n){let r=e.filter(e=>xO(e,t)),i=r.filter(e=>!e.secret),{payload:a,errors:o}=cD(i,t,n),s=cD(i.filter(e=>e.type===`object`&&!e.many&&Object.hasOwn(a,e.name)),t);Object.assign(a,s.payload),Object.assign(o,s.errors);for(let e of r){if(!e.secret)continue;let n=t[e.name];n===null?a[e.name]=null:typeof n==`string`&&n.trim()!==``&&(a[e.name]=n)}return{payload:a,errors:o}}function mj(e,t){let n=new Set(t.fields.filter(e=>e.secret).map(e=>e.name)),r=Object.entries(t.constraints).filter(([t])=>Object.hasOwn(e,t.split(`.`)[0])),i=r.filter(([e])=>!e.includes(`.`)).map(([e,t])=>[e,n.has(e)?{...t,required:!1}:t]),a=r.filter(([e])=>e.includes(`.`));return{...OO(e,Object.fromEntries(a),`create`),...OO(e,Object.fromEntries(i),`update`)}}function hj(){let e=X(),{page:t=``}=$i(),n=Ev(t);return n.isPending?(0,b.jsx)(W,{children:e(`common.loading`)}):n.isError?(0,b.jsx)(W,{tone:`error`,children:W_(n.error)}):(0,b.jsx)(gj,{page:n.data},t)}function gj({page:e}){let t=X(),{locale:n}=Y(),r=S(),{schema:i}=e,a=i.fields.map(e=>e.name),[o,s]=(0,y.useState)(()=>fj(e)),[c,l]=(0,y.useState)(o),[u,d]=(0,y.useState)([]),[f,p]=(0,y.useState)({}),[m,h]=(0,y.useState)(null),[g,_]=(0,y.useState)(null),v=WO(()=>h(null)),x=JSON.stringify(c)!==JSON.stringify(o),{blocker:C}=VO(x),w=(0,y.useRef)(null);UO(w);let T=(e,t)=>l(n=>({...n,[e]:t})),E=pt({mutationFn:e=>Q.savePage(i.name,e),gcTime:0,onSuccess:e=>{E.reset();let a=fj(e);r.setQueryData([`page`,i.name,n],e),s(a),l(a),d([]),p({}),_(t(`form.savedName`,{name:e.schema.label}))},onError:e=>{let t=mO(e,a);p(t.fields),h(t.form)}});function D(e){if(e.preventDefault(),i.readonly)return;if(_(null),v.busy){h(t(`upload.busy`)),v.refuse();return}let{payload:n,errors:r}=pj(i.fields,c,o),a={...mj(n,i),...r};if(p(a),h(null),!(Object.keys(a).length>0)){if(Object.keys(n).length===0){l(o),d([]);return}E.mutate(n)}}let O={...e.values,_files:e.files};function k(t){let n=i.fields.find(e=>e.name===t);if(!n||!xO(n,c))return null;let r=i.required.includes(t);return n.secret?(0,b.jsx)(_j,{field:n,stored:e.secrets[t]===!0,value:c[t],replacing:u.includes(t),readOnly:i.readonly,required:r,errors:f[t],onChange:e=>T(t,e),onReplacing:e=>d(n=>e?[...n,t]:n.filter(e=>e!==t))}):i.readonly?(0,b.jsx)(Dk,{resource:`page:${i.name}`,field:n,record:O}):n.type===`object`?(0,b.jsx)(rO,{resource:`page:${i.name}`,field:n,path:t,pattern:t,value:c[t],constraints:i.constraints,markRequired:!0,errors:f,onChange:e=>T(t,e)}):(0,b.jsx)(GD,{resource:`page:${i.name}`,field:n,value:c[t],required:r,errors:f[t],constraints:i.constraints[t],onChange:e=>T(t,e),onBusy:e=>v.setBusy(t,e)})}return(0,b.jsxs)(`form`,{ref:w,onSubmit:D,noValidate:!0,className:U(`flex flex-col gap-5`,i.layout?.length?`max-w-4xl`:`max-w-2xl`),children:[(0,b.jsx)(`h1`,{className:`text-[22px] font-bold`,children:i.label}),i.readonly&&(0,b.jsx)(`p`,{role:`note`,className:`rounded-md border bg-muted/40 px-3 py-2 text-sm text-muted-foreground`,children:t(`settings.viewOnly`)}),g&&(0,b.jsx)(`p`,{role:`status`,className:`rounded-md border border-green-600/30 bg-green-500/10 px-3 py-2 text-sm`,children:g}),(0,b.jsx)(HO,{blocker:C}),m&&(0,b.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:m}),(0,b.jsx)(XD,{layout:i.layout,names:a,errors:f,render:k}),!i.readonly&&(0,b.jsxs)(GO,{dirty:x,children:[x&&(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:E.isPending,onClick:()=>{l(o),d([]),p({}),h(null)},children:t(`settings.discard`)}),(0,b.jsxs)(q,{type:`submit`,disabled:E.isPending||v.busy,"aria-keyshortcuts":`Control+S Meta+S`,children:[t(E.isPending?`form.saving`:`form.save`),(0,b.jsx)(KO,{})]})]})]})}function _j({field:e,stored:t,value:n,replacing:r,readOnly:i,required:a,errors:o,onChange:s,onReplacing:c}){let l=X(),u=`field-${e.name}`,d=`${u}-label`,f=`${u}-help`,p=`${u}-error`,m=(o?.length??0)>0,h=[e.help?f:void 0,m?p:void 0].filter(Boolean).join(` `)||void 0,g=n===null,_=!i&&!g&&(!t||r);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-secret":e.name,children:[(0,b.jsxs)(`label`,{id:d,htmlFor:_?u:void 0,className:`text-sm font-medium`,children:[e.label,a&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`text-destructive`,children:`*`})]}),_?(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(e_,{id:u,type:`password`,autoComplete:`new-password`,dir:`ltr`,className:`min-w-0 flex-1`,value:typeof n==`string`?n:``,autoFocus:r,"aria-invalid":m?!0:void 0,"aria-describedby":h,onChange:e=>s(e.target.value)}),t&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{s(``),c(!1)},children:l(`secret.keep`)})]}):(0,b.jsx)(`div`,{role:`group`,"aria-labelledby":d,"aria-describedby":h,className:`flex min-h-8 flex-wrap items-center gap-2 text-sm`,children:g?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`text-amber-800 dark:text-amber-300`,children:l(`secret.willClear`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>s(``),children:l(`secret.undo`)})]}):t?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-medium text-green-800 dark:text-green-300`,children:[l(`secret.set`),(0,b.jsx)($y,{className:`size-4`,"aria-hidden":!0})]}),!i&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"aria-label":l(`secret.replaceName`,{name:e.label}),onClick:()=>c(!0),children:l(`secret.replace`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":l(`secret.clearName`,{name:e.label}),onClick:()=>s(null),children:l(`secret.clear`)})]})]}):(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:l(`secret.notSet`)})}),e.help&&(0,b.jsx)(`p`,{id:f,className:`text-sm text-muted-foreground`,children:e.help}),m&&(0,b.jsx)(`p`,{id:p,className:`text-sm text-destructive`,children:o.join(` `)})]})}document.title=L_.title,wT(xT()),jT(L_.branding),BT({branding:L_.branding.primaryColor}),cC(L_.currency),C_(L_.messages),OT(xT);var vj=new Qe({defaultOptions:{queries:{retry:1,staleTime:3e4}}}),yj=vo([{path:`login`,element:(0,b.jsx)(WE,{})},{element:(0,b.jsx)(BE,{}),children:[{index:!0,element:(0,b.jsx)(cA,{})},{path:`account`,element:(0,b.jsx)(Zv,{})},{path:`-/users`,element:(0,b.jsx)(cT,{})},{path:`-/users/new`,element:(0,b.jsx)(lT,{})},{path:`-/users/:id`,element:(0,b.jsx)(lT,{})},{path:`-/groups`,element:(0,b.jsx)(Yw,{})},{path:`-/groups/new`,element:(0,b.jsx)(Xw,{})},{path:`-/groups/:id`,element:(0,b.jsx)(Xw,{})},{path:`-/roles`,element:(0,b.jsx)(sT,{})},{path:`-/roles/new`,element:(0,b.jsx)(iT,{})},{path:`-/roles/:name`,element:(0,b.jsx)(iT,{})},{path:`-/debugger`,element:(0,b.jsx)(Kw,{})},{path:`-/audit`,element:(0,b.jsx)(Uw,{})},{path:`g/:group`,element:(0,b.jsx)(jk,{})},{path:`p/:page`,element:(0,b.jsx)(hj,{})},{path:`:resource`,element:(0,b.jsx)(aj,{})},{path:`:resource/new`,element:(0,b.jsx)(bk,{mode:`create`})},{path:`:resource/:id`,element:(0,b.jsx)(bk,{mode:`edit`})},{path:`*`,element:(0,b.jsx)(dj,{})}]}],{basename:L_.basePath});Y_(()=>{let e=Z_(yj.state.location.pathname,L_.basePath),{search:t}=yj.state.location;e!==`/login`&&(vj.clear(),yj.navigate(`/login?${new URLSearchParams({next:e+t})}`,{replace:!0}))}),(0,qa.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(y.StrictMode,{children:(0,b.jsx)(F_,{locales:L_.locales,fallback:L_.locale,children:(0,b.jsx)(C,{client:vj,children:(0,b.jsx)(wa,{router:yj})})})}));export{o as _,NS as a,db as c,e_ as d,q as f,u as g,m as h,Bw as i,$ as l,v as m,TD as n,px as o,U as p,xD as r,lx as s,ED as t,X as u,c as v};
|