@nest-my-admin/ui 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -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-5aNBuPwS.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,9 +47,11 @@ Error generating stack: `+e.message+`
|
|
|
47
47
|
`},Vu=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Hu=function(){y.useEffect(function(){return document.body.setAttribute(zu,(Vu()+1).toString()),function(){var e=Vu()-1;e<=0?document.body.removeAttribute(zu):document.body.setAttribute(zu,e.toString())}},[])},Uu=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Hu();var a=y.useMemo(function(){return Lu(i)},[i]);return y.createElement(Ru,{styles:Bu(a,!t,i,n?``:`!important`)})},Wu=!1;if(typeof window<`u`)try{var Gu=Object.defineProperty({},"passive",{get:function(){return Wu=!0,!0}});window.addEventListener(`test`,Gu,Gu),window.removeEventListener(`test`,Gu,Gu)}catch{Wu=!1}var Ku=Wu?{passive:!1}:!1,qu=function(e){return e.tagName===`TEXTAREA`},Ju=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!qu(e)&&n[t]===`visible`)},Yu=function(e){return Ju(e,`overflowY`)},Xu=function(e){return Ju(e,`overflowX`)},Zu=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),ed(e,r)){var i=td(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Qu=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},$u=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},ed=function(e,t){return e===`v`?Yu(t):Xu(t)},td=function(e,t){return e===`v`?Qu(t):$u(t)},nd=function(e,t){return e===`h`&&t===`rtl`?-1:1},rd=function(e,t,n,r,i){var a=nd(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=td(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&ed(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},id=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ad=function(e){return[e.deltaX,e.deltaY]},od=function(e){return e&&`current`in e?e.current:e},sd=function(e,t){return e[0]===t[0]&&e[1]===t[1]},cd=function(e){return`
|
|
48
48
|
.block-interactivity-${e} {pointer-events: none;}
|
|
49
49
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
50
|
-
`},ld=0,ud=[];function dd(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),i=y.useState(ld++)[0],a=y.useState(Nu)[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=lu([e.lockRef.current],(e.shards||[]).map(od),!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=id(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=Zu(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Zu(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 rd(h,t,e,h===`h`?s:c,!0)},[]),c=y.useCallback(function(e){var n=e;if(ud.length&&ud[ud.length-1]===a){var r=`deltaY`in n?ad(n):id(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&sd(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(od).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:fd(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=id(e),r.current=void 0},[]),d=y.useCallback(function(t){l(t.type,ad(t),t.target,s(t,e.lockRef.current))},[]),f=y.useCallback(function(t){l(t.type,id(t),t.target,s(t,e.lockRef.current))},[]);y.useEffect(function(){return ud.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Ku),document.addEventListener(`touchmove`,c,Ku),document.addEventListener(`touchstart`,u,Ku),function(){ud=ud.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Ku),document.removeEventListener(`touchmove`,c,Ku),document.removeEventListener(`touchstart`,u,Ku)}},[]);var p=e.removeScrollBar,m=e.inert;return y.createElement(y.Fragment,null,m?y.createElement(a,{styles:cd(i)}):null,p?y.createElement(Uu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function fd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var pd=Cu(wu,dd),md=y.forwardRef(function(e,t){return y.createElement(Eu,su({},e,{ref:t,sideCar:pd}))});md.classNames=Eu.classNames;var hd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},gd=new WeakMap,_d=new WeakMap,vd={},yd=0,bd=function(e){return e&&(e.host||bd(e.parentNode))},xd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=bd(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})},Sd=function(e,t,n,r){var i=xd(t,Array.isArray(e)?e:[e]);vd[n]||(vd[n]=new WeakMap);var a=vd[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=(gd.get(e)||0)+1,l=(a.get(e)||0)+1;gd.set(e,c),a.set(e,l),o.push(e),c===1&&i&&_d.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(),yd++,function(){o.forEach(function(e){var t=gd.get(e)-1,i=a.get(e)-1;gd.set(e,t),a.set(e,i),t||(_d.has(e)||e.removeAttribute(r),_d.delete(e)),i||e.removeAttribute(n)}),yd--,yd||(gd=new WeakMap,gd=new WeakMap,_d=new WeakMap,vd={})}},Cd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||hd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Sd(r,i,n,`aria-hidden`)):function(){return null}},wd=Object.defineProperty,Td=(e,t)=>wd(e,`name`,{value:t,configurable:!0}),Ed=`Dialog`,[Dd,Od]=Pc(Ed),[kd,Ad]=Dd(Ed),jd=Td(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]=$c({prop:r,defaultProp:i??!1,onChange:a,caller:Ed}),[d,f]=y.useState(0),[p,m]=y.useState(0);return(0,b.jsx)(kd,{scope:t,triggerRef:s,contentRef:c,contentId:_l(),titleId:_l(),descriptionId:_l(),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`),Md=`DialogTrigger`,Nd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(Md,n),a=lc(t,i.triggerRef);return(0,b.jsx)(kc.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Zd(i.open),...r,ref:a,onClick:zc(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),Pd=`DialogPortal`,[Fd,Id]=Dd(Pd,{forceMount:void 0}),Ld=Td(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Ad(Pd,t);return(0,b.jsx)(Fd,{scope:t,forceMount:n,children:y.Children.map(r,e=>(0,b.jsx)(sl,{present:n||a.open,children:(0,b.jsx)($l,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Rd=`DialogOverlay`,zd=y.forwardRef(Td(function(e,t){let n=Id(Rd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ad(Rd,e.__scopeDialog);return a.modal?(0,b.jsx)(sl,{present:r||a.open,children:(0,b.jsx)(Vd,{...i,ref:t})}):null},`DialogOverlay`)),Bd=fc(`DialogOverlay.RemoveScroll`),Vd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(Rd,n),a=lc(t,kl());return(0,b.jsx)(md,{as:Bd,allowPinchZoom:!0,shards:[i.contentRef],children:(0,b.jsx)(kc.div,{"data-state":Zd(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Hd=`DialogContent`,Ud=y.forwardRef(Td(function(e,t){let n=Id(Hd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ad(Hd,e.__scopeDialog);return(0,b.jsx)(sl,{present:r||a.open,children:a.modal?(0,b.jsx)(Wd,{...i,ref:t}):(0,b.jsx)(Gd,{...i,ref:t})})},`DialogContent`)),Wd=y.forwardRef(Td(function(e,t){let n=Ad(Hd,e.__scopeDialog),r=y.useRef(null),i=lc(t,n.contentRef,r);return y.useEffect(()=>{let e=r.current;if(e)return Cd(e)},[]),(0,b.jsx)(Kd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:zc(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:zc(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:zc(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Gd=y.forwardRef(Td(function(e,t){let n=Ad(Hd,e.__scopeDialog),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(Kd,{...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`)),Kd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Ad(Hd,n);return au(),(0,b.jsx)(b.Fragment,{children:(0,b.jsx)(Bl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,b.jsx)(Ol,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Zd(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),qd=`DialogTitle`,Jd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(qd,n),{setTitleCount:a}=i;return Wc(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,b.jsx)(kc.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Yd=`DialogClose`,Xd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(Yd,n);return(0,b.jsx)(kc.button,{type:`button`,...r,ref:t,onClick:zc(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Zd(e){return e?`open`:`closed`}Td(Zd,`getState`);var Qd=Object.defineProperty,$d=(e,t)=>Qd(e,`name`,{value:t,configurable:!0});function ef(e){let[t,n]=y.useState(void 0);return Wc(()=>{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}$d(ef,`useSize`);var tf=Object.defineProperty,nf=(e,t)=>tf(e,`name`,{value:t,configurable:!0}),rf=`Checkbox`,[af,of]=Pc(rf),[sf,cf]=af(rf);function lf(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]=$c({prop:n,defaultProp:i??!1,onChange:c,caller:rf}),[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:!vf(i)&&i,isFormControl:C,bubbleInput:g,setBubbleInput:_};return(0,b.jsx)(sf,{scope:t,...w,children:_f(d)?d(w):r})}nf(lf,`CheckboxProvider`);var uf=`CheckboxTrigger`,df=y.forwardRef(nf(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}=cf(uf,e),g=lc(i,u),_=y.useRef(c);return y.useEffect(()=>{let e=a?.form;if(e){let t=nf(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,b.jsx)(kc.button,{type:`button`,role:`checkbox`,"aria-checked":vf(c)?`mixed`:c,"aria-required":l,"data-state":yf(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:zc(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:zc(n,e=>{p(),d(e=>vf(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),ff=y.forwardRef(nf(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)(lf,{__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)(df,{...d,ref:t,__scopeCheckbox:n}),e&&(0,b.jsx)(gf,{__scopeCheckbox:n})]})})},`Checkbox`)),pf=`CheckboxIndicator`,mf=y.forwardRef(nf(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=cf(pf,n);return(0,b.jsx)(sl,{present:r||vf(a.checked)||a.checked===!0,children:(0,b.jsx)(kc.span,{"data-state":yf(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),hf=`CheckboxBubbleInput`,gf=y.forwardRef(nf(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}=cf(hf,e),g=lc(r,h),_=ef(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=vf(s),n.call(e,!vf(s)&&s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let C=y.useRef(!vf(s)&&s);return(0,b.jsx)(kc.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:zc(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function _f(e){return typeof e==`function`}nf(_f,`isFunction`);function vf(e){return e===`indeterminate`}nf(vf,`isIndeterminate`);function yf(e){return vf(e)?`indeterminate`:e?`checked`:`unchecked`}nf(yf,`getState`);var bf=[`top`,`right`,`bottom`,`left`],xf=Math.min,Sf=Math.max,Cf=Math.round,wf=Math.floor,Tf=e=>({x:e,y:e}),Ef={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Df(e,t,n){return Sf(e,xf(t,n))}function Of(e,t){return typeof e==`function`?e(t):e}function kf(e){return e.split(`-`)[0]}function Af(e){return e.split(`-`)[1]}function jf(e){return e===`x`?`y`:`x`}function Mf(e){return e===`y`?`height`:`width`}function Nf(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Pf(e){return jf(Nf(e))}function Ff(e,t,n){n===void 0&&(n=!1);let r=Af(e),i=Pf(e),a=Mf(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Wf(o)),[o,Wf(o)]}function If(e){let t=Wf(e);return[Lf(e),t,Lf(t)]}function Lf(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Rf=[`left`,`right`],zf=[`right`,`left`],Bf=[`top`,`bottom`],Vf=[`bottom`,`top`];function Hf(e,t,n){switch(e){case`top`:case`bottom`:return n?t?zf:Rf:t?Rf:zf;case`left`:case`right`:return t?Bf:Vf;default:return[]}}function Uf(e,t,n,r){let i=Af(e),a=Hf(kf(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Lf)))),a}function Wf(e){let t=kf(e);return Ef[t]+e.slice(t.length)}function Gf(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Kf(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Gf(e)}function qf(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 K(e,t,n){let{reference:r,floating:i}=e,a=Nf(t),o=Pf(t),s=Mf(o),c=kf(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=Af(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Jf(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}=Of(t,e),p=Kf(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=qf(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=qf(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 Yf=50,Xf=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Jf},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=K(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<Yf&&(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}=K(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Zf=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}=Of(e,t)||{};if(l==null)return{};let d=Kf(u),f={x:n,y:r},p=Pf(i),m=Mf(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=xf(d[_],T),D=xf(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=Df(E,k,O),j=!c.arrow&&Af(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}}}),Qf=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}=Of(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=kf(r),_=Nf(o),v=kf(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Wf(o)]:If(o)),x=p!==`none`;!d&&x&&b.push(...Uf(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=Ff(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`||_===Nf(t)||T.every(e=>Nf(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=Nf(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 $f(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ep(e){return bf.some(t=>e[t]>=0)}var tp=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Of(e,t);switch(i){case`referenceHidden`:{let e=$f(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ep(e)}}}case`escaped`:{let e=$f(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ep(e)}}}default:return{}}}}},np=new Set([`left`,`top`]);async function rp(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=kf(n),s=Af(n),c=Nf(n)===`y`,l=np.has(o)?-1:1,u=a&&c?-1:1,d=Of(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 ip=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 rp(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}}}}},ap=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}=Of(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Nf(i),p=jf(f),m=u[p],h=u[f],g=(e,t)=>Df(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}}}}}},op=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}=Of(e,t),u={x:n,y:r},d=Nf(i),f=jf(d),p=u[f],m=u[d],h=Of(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=np.has(kf(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}}}},sp=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}=Of(e,t),c=await i.detectOverflow(t,s),l=kf(n),u=Af(n),d=Nf(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=xf(p-c[m],g),y=xf(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*Sf(c.left,c.right):S=p-2*Sf(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 cp(){return typeof window<`u`}function lp(e){return fp(e)?(e.nodeName||``).toLowerCase():`#document`}function up(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dp(e){return((fp(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function fp(e){return cp()?e instanceof Node||e instanceof up(e).Node:!1}function pp(e){return cp()?e instanceof Element||e instanceof up(e).Element:!1}function mp(e){return cp()?e instanceof HTMLElement||e instanceof up(e).HTMLElement:!1}function hp(e){return!cp()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof up(e).ShadowRoot}function gp(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Dp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function _p(e){return/^(table|td|th)$/.test(lp(e))}function vp(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var yp=/transform|translate|scale|rotate|perspective|filter/,bp=/paint|layout|strict|content/,xp=e=>!!e&&e!==`none`,Sp;function Cp(e){let t=pp(e)?Dp(e):e;return xp(t.transform)||xp(t.translate)||xp(t.scale)||xp(t.rotate)||xp(t.perspective)||!Tp()&&(xp(t.backdropFilter)||xp(t.filter))||yp.test(t.willChange||``)||bp.test(t.contain||``)}function wp(e){let t=kp(e);for(;mp(t)&&!Ep(t);){if(Cp(t))return t;if(vp(t))return null;t=kp(t)}return null}function Tp(){return Sp??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Sp}function Ep(e){return/^(html|body|#document)$/.test(lp(e))}function Dp(e){return up(e).getComputedStyle(e)}function Op(e){return pp(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function kp(e){if(lp(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||hp(e)&&e.host||dp(e);return hp(t)?t.host:t}function Ap(e){let t=kp(e);return Ep(t)?(e.ownerDocument||e).body:mp(t)&&gp(t)?t:Ap(t)}function jp(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ap(e),i=r===e.ownerDocument?.body,a=up(r);if(i){let e=Mp(a);return t.concat(a,a.visualViewport||[],gp(r)?r:[],e&&n?jp(e):[])}return t.concat(r,jp(r,[],n))}function Mp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Np(e){let t=Dp(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=Cf(n)!==a||Cf(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Pp(e){return pp(e)?e:e.contextElement}function Fp(e){let t=Pp(e);if(!mp(t))return Tf(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Np(t),o=(a?Cf(n.width):n.width)/r,s=(a?Cf(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ip=Tf(0);function Lp(e){let t=up(e);return!Tp()||!t.visualViewport?Ip:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Rp(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===up(e)}function zp(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Pp(e),o=Tf(1);t&&(r?pp(r)&&(o=Fp(r)):o=Fp(e));let s=Rp(a,n,r)?Lp(a):Tf(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=up(a),t=pp(r)?up(r):r,n=e,i=Mp(n);for(;i&&t!==n;){let e=Fp(i),t=i.getBoundingClientRect(),r=Dp(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=up(i),i=Mp(n)}}return qf({width:u,height:d,x:c,y:l})}function Bp(e,t){let n=Op(e).scrollLeft;return t?t.left+n:zp(dp(e)).left+n}function Vp(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Bp(e,n),y:n.top+t.scrollTop}}function Hp(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=dp(r),s=t?vp(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Tf(1),u=Tf(0),d=mp(r);if((d||!a)&&((lp(r)!==`body`||gp(o))&&(c=Op(r)),d)){let e=zp(r);l=Fp(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Vp(o,c):Tf(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 Up(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Wp(e){let t=Op(e),n=e.ownerDocument.body,r=Sf(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Sf(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Bp(e),o=-t.scrollTop;return Dp(n).direction===`rtl`&&(a+=Sf(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Gp=25;function Kp(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=up(e),a=dp(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Tp()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Bp(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<=Gp&&(s-=o)}return{width:s,height:c,x:l,y:u}}function qp(e,t){let n=zp(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Fp(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Jp(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Kp(e,n,t);else if(t===`document`)r=Wp(dp(e));else if(pp(t))r=qp(t,n);else{let n=Lp(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return qf(r)}function Yp(e,t){let n=t.get(e);if(n)return n;let r=jp(e,[],!1).filter(e=>pp(e)&&lp(e)!==`body`),i=null,a=Dp(e).position===`fixed`,o=a?kp(e):e;for(;pp(o)&&!Ep(o);){let e=Dp(o),t=Cp(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=kp(o)}return t.set(e,r),r}function Xp(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?vp(t)?[]:Yp(t,this._c):[].concat(n),r],o=Jp(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=Jp(t,a[e],i);s=Sf(n.top,s),c=xf(n.right,c),l=xf(n.bottom,l),u=Sf(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Zp(e){let{width:t,height:n}=Np(e);return{width:t,height:n}}function Qp(e,t,n){let r=mp(t),i=dp(t),a=n===`fixed`,o=zp(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Tf(0);if((r||!a)&&((lp(t)!==`body`||gp(i))&&(s=Op(t)),r)){let e=zp(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Bp(i));let l=i&&!r&&!a?Vp(i,s):Tf(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 $p(e){return Dp(e).position===`static`}function em(e,t){if(!mp(e)||Dp(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return dp(e)===n&&(n=n.ownerDocument.body),n}function tm(e,t){let n=up(e);if(vp(e))return n;if(!mp(e)){let t=kp(e);for(;t&&!Ep(t);){if(pp(t)&&!$p(t))return t;t=kp(t)}return n}let r=em(e,t);for(;r&&_p(r)&&$p(r);)r=em(r,t);return r&&Ep(r)&&$p(r)&&!Cp(r)?n:r||wp(e)||n}var nm=async function(e){let t=this.getOffsetParent||tm,n=this.getDimensions,r=await n(e.floating);return{reference:Qp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function rm(e){return Dp(e).direction===`rtl`}var im={convertOffsetParentRelativeRectToViewportRelativeRect:Hp,getDocumentElement:dp,getClippingRect:Xp,getOffsetParent:tm,getElementRects:nm,getClientRects:Up,getDimensions:Zp,getScale:Fp,isElement:pp,isRTL:rm};function am(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function om(e,t,n){let r=null,i,a=dp(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=wf(d),h=wf(a.clientWidth-(u+f)),g=wf(a.clientHeight-(d+p)),_=wf(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Sf(0,xf(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!am(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=up(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function sm(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=Pp(e),u=i||a?[...l?jp(l):[],...t?jp(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?om(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?zp(e):null;c&&g();function g(){let t=zp(e);h&&!am(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 cm=ip,lm=ap,um=Qf,dm=sp,fm=tp,pm=Zf,mm=op,hm=(e,t,n)=>{let r=new Map,i=n??{},a={...im,...i.platform,_c:r};return Xf(e,t,{...i,platform:a})},gm=typeof document<`u`?y.useLayoutEffect:function(){};function _m(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(!_m(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)&&!_m(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function vm(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ym(e,t){let n=vm(e);return Math.round(t*n)/n}function bm(e){let t=y.useRef(e);return gm(()=>{t.current=e}),t}function xm(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);_m(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=bm(c),O=bm(i),k=bm(l),A=y.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),hm(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!_m(T.current,t)&&(T.current=t,Ec.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);gm(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=y.useRef(!1);gm(()=>(j.current=!0,()=>{j.current=!1}),[]),gm(()=>{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=ym(N.floating,u.x),r=ym(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...vm(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 Sm=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?{}:pm({element:r.current,padding:i}).fn(n):r?pm({element:r,padding:i}).fn(n):{}}}},Cm=(e,t)=>{let n=cm(e);return{name:n.name,fn:n.fn,options:[e,t]}},wm=(e,t)=>{let n=lm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tm=(e,t)=>({fn:mm(e).fn,options:[e,t]}),Em=(e,t)=>{let n=um(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dm=(e,t)=>{let n=dm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Om=(e,t)=>{let n=fm(e);return{name:n.name,fn:n.fn,options:[e,t]}},km=(e,t)=>{let n=Sm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Am=Object.defineProperty,jm=(e,t)=>Am(e,`name`,{value:t,configurable:!0}),Mm=`Popper`,[Nm,Pm]=Pc(Mm),[Fm,Im]=Nm(Mm),Lm=jm(e=>{let{__scopePopper:t,children:n}=e,[r,i]=y.useState(null),[a,o]=y.useState(void 0);return(0,b.jsx)(Fm,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Rm=`PopperAnchor`,zm=y.forwardRef(jm(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Im(Rm,n),o=y.useRef(null),s=a.onAnchorChange,c=lc(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&&Km(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,b.jsx)(kc.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Bm=`PopperContent`,[Vm,Hm]=Nm(Bm),Um=y.forwardRef(jm(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=Im(Bm,n),[_,v]=y.useState(null),x=lc(t,v),[S,C]=y.useState(null),w=ef(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(Wm),altBoundary:A},{refs:M,floatingStyles:N,placement:ee,isPositioned:P,middlewareData:F}=xm({strategy:`fixed`,placement:D,whileElementsMounted:jm((...e)=>sm(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Cm({mainAxis:i+E,alignmentAxis:o}),c&&wm({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Tm():void 0,...j}),c&&Em({...j}),Dm({...j,apply:jm(({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&&km({element:S,padding:s}),Gm({arrowWidth:T,arrowHeight:E}),f&&Om({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),te=g.setPlacementState;Wc(()=>(te(ee),()=>{te(void 0)}),[ee,te]);let[ne,re]=Km(ee),ie=bl(m);Wc(()=>{P&&ie?.()},[P,ie]);let ae=F.arrow?.x,oe=F.arrow?.y,se=F.arrow?.centerOffset!==0,[ce,le]=y.useState();return Wc(()=>{_&&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)(Vm,{scope:n,placedSide:ne,placedAlign:re,onArrowChange:C,arrowX:ae,arrowY:oe,shouldHideArrow:se,children:(0,b.jsx)(kc.div,{"data-side":ne,"data-align":re,...h,ref:x,style:{...h.style,animation:P?h.style?.animation:`none`}})})})},`PopperContent`));function Wm(e){return e!==null}jm(Wm,`isNotNull`);var Gm=jm(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]=Km(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 Km(e){let[t,n=`center`]=e.split(`-`);return[t,n]}jm(Km,`getSideAndAlignFromPlacement`);var qm=Lm,Jm=zm,Ym=Um,Xm=Object.defineProperty,Zm=y.forwardRef(((e,t)=>Xm(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,b.jsx)(kc.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),Qm=Object.defineProperty,$m=(e,t)=>Qm(e,`name`,{value:t,configurable:!0}),eh=`Popover`,[th,nh]=Pc(eh,[Pm]),rh=Pm(),[ih,ah]=th(eh),oh=$m(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=rh(t),c=y.useRef(null),[l,u]=y.useState(!1),[d,f]=$c({prop:r,defaultProp:i??!1,onChange:a,caller:eh});return(0,b.jsx)(qm,{...s,children:(0,b.jsx)(ih,{scope:t,contentId:_l(),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`),sh=`PopoverTrigger`,ch=y.forwardRef($m(function(e,t){let{__scopePopover:n,...r}=e,i=ah(sh,n),a=rh(n),o=lc(t,i.triggerRef),s=(0,b.jsx)(kc.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":xh(i.open),...r,ref:o,onClick:zc(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,b.jsx)(Jm,{asChild:!0,...a,children:s})},`PopoverTrigger`)),lh=`PopoverPortal`,[uh,dh]=th(lh,{forceMount:void 0}),fh=$m(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=ah(lh,t);return(0,b.jsx)(uh,{scope:t,forceMount:n,children:(0,b.jsx)(sl,{present:n||a.open,children:(0,b.jsx)($l,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),ph=`PopoverContent`,mh=y.forwardRef($m(function(e,t){let n=dh(ph,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=ah(ph,e.__scopePopover);return(0,b.jsx)(sl,{present:r||a.open,children:a.modal?(0,b.jsx)(gh,{...i,ref:t}):(0,b.jsx)(_h,{...i,ref:t})})},`PopoverContent`)),hh=fc(`PopoverContent.RemoveScroll`),gh=y.forwardRef($m(function(e,t){let n=ah(ph,e.__scopePopover),r=y.useRef(null),i=lc(t,r),a=y.useRef(!1);return y.useEffect(()=>{let e=r.current;if(e)return Cd(e)},[]),(0,b.jsx)(md,{as:hh,allowPinchZoom:!0,children:(0,b.jsx)(vh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:zc(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:zc(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:zc(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),_h=y.forwardRef($m(function(e,t){let n=ah(ph,e.__scopePopover),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(vh,{...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`)),vh=y.forwardRef($m(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=ah(ph,n),p=rh(n);return au(),(0,b.jsx)(Bl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,b.jsx)(Ol,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,b.jsx)(Ym,{"data-state":xh(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`)),yh=`PopoverClose`,bh=y.forwardRef($m(function(e,t){let{__scopePopover:n,...r}=e,i=ah(yh,n);return(0,b.jsx)(kc.button,{type:`button`,...r,ref:t,onClick:zc(e.onClick,()=>i.onOpenChange(!1))})},`PopoverClose`));function xh(e){return e?`open`:`closed`}$m(xh,`getState`);var Sh=oh,Ch=ch,wh=fh,Th=mh,Eh=bh,Dh=ic(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm 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:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,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:`bg-destructive/10 text-destructive hover:bg-destructive/20 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-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,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]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"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-7 rounded-[min(var(--radius-md),12px)] 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?pc:`button`;return(0,b.jsx)(a,{"data-slot":`button`,"data-variant":t,"data-size":n,className:W(Dh({variant:t,size:n,className:e})),...i})}function Oh({className:e,type:t,...n}){return(0,b.jsx)(`input`,{type:t,"data-slot":`input`,className:W(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base 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 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),...n})}function kh({className:e,...t}){return(0,b.jsx)(Zm,{"data-slot":`label`,className:W(`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 Ah=`۰۱۲۳۴۵۶۷۸۹`,jh=`٠١٢٣٤٥٦٧٨٩`;function Mh(e){return e.replace(/[۰-۹٠-٩]/g,e=>String(Math.max(Ah.indexOf(e),jh.indexOf(e))))}function Nh(e){return Mh(e).replace(/٫/g,`.`).replace(/٬/g,`,`)}function Ph(e){return e.replace(/[0-9]/g,e=>Ah[Number(e)])}function Fh(e){return Ph(e).replace(/\./g,`٫`).replace(/,/g,`٬`)}var Ih=`nma.calendar`,Lh=`nma.digits`;function Rh(e){try{return localStorage.getItem(e)}catch{return null}}function zh(e){let t=Rh(Ih),n=Rh(Lh);return{calendar:t===`gregorian`||t===`persian`?t:e.split(`-`)[0]===`fa`?`persian`:`gregorian`,digits:n===`latn`||n===`arabext`?n:`latn`}}function Bh(e){try{e.calendar&&localStorage.setItem(Ih,e.calendar),e.digits&&localStorage.setItem(Lh,e.digits)}catch{}}var Vh={"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.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.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.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}`,"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.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.`,"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.latinDigits":`Latin 123`,"display.persianDigits":`Persian ۱۲۳`,"form.new":`New {name}`,"form.back":`Back`,"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.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.create":`Create`,"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}`},Hh={en:Vh,fa:{"common.loading":`در حال بارگذاری…`,"common.yes":`بله`,"common.no":`خیر`,"common.empty":`—`,"common.all":`همه`,"common.cancel":`انصراف`,"common.pageNotFound":`صفحه پیدا نشد.`,"common.requestFailed":`درخواست ناموفق بود ({status})`,"common.reference":`{message} (کد پیگیری: {id})`,"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.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.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}`,"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.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":`ابتدا تغییرات را ذخیره یا لغو کنید.`,"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.latinDigits":`لاتین 123`,"display.persianDigits":`فارسی ۱۲۳`,"form.new":`{name} جدید`,"form.back":`بازگشت`,"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.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.create":`ساختن`,"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} باشد`}},Uh=new Set([`fa`,`ar`,`he`,`ur`]),Wh=`nma.locale`,Gh=`en`,Kh={calendar:`gregorian`,digits:`latn`};function qh(){return Kh}function Jh(e){Kh=e}function Yh(){return Gh}function J(e,t={},n=Gh){return((Hh[n]??Vh)[e]??Vh[e]).replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e)}function Xh(e){return Uh.has(e.split(`-`)[0])}var Zh=e=>`-u-ca-${e.calendar===`persian`?`persian`:`gregory`}-nu-${e.digits}`;function Qh(e,t=Gh){return new Intl.NumberFormat(`${t}-u-nu-${Kh.digits}`).format(e)}function $h(e){return Kh.digits===`arabext`?Fh(e):e}function eg(e,t=Gh){return new Intl.DateTimeFormat(`${t}${Zh(Kh)}`,{dateStyle:`medium`,timeStyle:`short`}).format(e)}function tg(e,t=Gh){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}${Zh(Kh)}`,{dateStyle:`medium`,timeZone:`UTC`}).format(n)}function ng(e,t=new Date,n=Gh){let r=Math.min(0,Math.round((e.getTime()-t.getTime())/1e3)),i=new Intl.RelativeTimeFormat(`${n}-u-nu-${Kh.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 rg(e){Gh=e,document.documentElement.lang=e,document.documentElement.dir=Xh(e)?`rtl`:`ltr`}function ig(e,t){try{let t=localStorage.getItem(Wh);if(t&&e.includes(t))return t}catch{}return t}var ag=(0,y.createContext)(void 0);function og({locales:e,fallback:t,children:n}){let[r,i]=(0,y.useState)(()=>{let n=ig(e,t);return rg(n),n}),[a,o]=(0,y.useState)(()=>{let e=zh(r);return Jh(e),e});return(0,b.jsx)(ag.Provider,{value:{locale:r,locales:e,setLocale:e=>{rg(e);try{localStorage.setItem(Wh,e)}catch{}let t=zh(e);Jh(t),o(t),i(e)},t:(e,t)=>J(e,t,r),calendar:a.calendar,digits:a.digits,setDisplay:e=>{Bh(e);let t={...a,...e};Jh(t),o(t)}},children:n})}function Y(){let e=(0,y.useContext)(ag);if(!e)throw Error(`useLocale() outside LocaleProvider`);return e}function X(){return Y().t}function sg(){let e=document.getElementById(`nma-config`)?.textContent;if(e)return JSON.parse(e);throw Error(`nest-my-admin: runtime config missing`)}var cg=sg(),lg=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 ug(e){if(!(e instanceof lg))return e.message;let t=Object.entries(e.fields).map(([e,t])=>`${e}: ${t.join(`, `)}`);return[e.message,...t].join(` — `)}var dg,fg;function pg(e){dg=e}function mg(){return dg}function hg(e){fg=e}function gg(){dg=void 0,fg?.()}function _g(e){return!e||!e.startsWith(`/`)||e.startsWith(`//`)||e.startsWith(`/\\`)||e.startsWith(`/login`)?`/`:e}var vg=`nma-view-as`;function yg(){try{return sessionStorage.getItem(vg)??void 0}catch{return}}function bg(e){try{e===void 0?sessionStorage.removeItem(vg):sessionStorage.setItem(vg,e)}catch{}}var xg=class extends Error{constructor(){super(`Upload aborted`),this.name=`UploadAbortedError`}},Sg=`application/octet-stream`;function Cg(e){return typeof e==`object`&&!!e&&`code`in e&&`message`in e}function wg(e){return typeof e==`object`&&!!e&&typeof e.token==`string`}function Tg(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`,Sg),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&&wg(e);i.status===401&&n.onSignedOut?.(),c(()=>{t?(r?.(1),o(e)):Cg(e)?s(new lg(i.status,e)):i.status===413?s(new lg(413,{code:`BAD_REQUEST`,message:J(`upload.tooLarge`,{},n.locale),correlationId:``})):s(new lg(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 xg)),i.send(e)}),abort:()=>{a||i.abort()}}}function Eg(e){if(e instanceof lg){let t=Object.values(e.fields).flat();if(t.length>0)return t.join(` `)}return e instanceof Error?e.message:String(e)}function Dg(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 Og(e,t,n){if(e.size===0)return J(`upload.empty`,{},n);if(e.size>t.maxBytes)return J(`upload.tooLargeMax`,{max:Ag(t.maxBytes,n)},n);if(e.type!==``&&!Dg(e.type.split(`;`)[0].trim(),t.accept))return J(`upload.typeRefused`,{},n)}var kg=[`upload.bytes`,`upload.kilobytes`,`upload.megabytes`,`upload.gigabytes`,`upload.terabytes`];function Ag(e,t){let n=e,r=0;for(;n>=1024&&r<kg.length-1;)n/=1024,r+=1;let i=new Intl.NumberFormat(t??`${Yh()}-u-nu-${qh().digits}`,{maximumFractionDigits:r===0?0:1}).format(n);return J(kg[r],{value:i},t)}function jg(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 Mg(e){return{...e,creatable:!1,actions:[],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])]}}}function Ng(e){return e.schema.readonly?e:{...e,schema:{...e.schema,readonly:!0}}}function Pg(e){return e.viewAs?{...e,rbac:{...e.rbac,manage:!1}}:e}function Fg(e){return typeof e==`object`&&!!e&&`code`in e&&`message`in e}async function Z(e,t={}){let n=t.method??`GET`,r=mg(),i=e===`/session`&&n===`POST`?void 0:yg(),a=await fetch(`${cg.apiBase}${e}`,{...t,credentials:`same-origin`,headers:{Accept:`application/json`,"Accept-Language":Yh(),...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`)&&gg();let o=await a.text(),s;try{s=o?JSON.parse(o):void 0}catch{s=void 0}if(!a.ok)throw new lg(a.status,Fg(s)?s:{code:`INTERNAL`,message:J(`common.requestFailed`,{status:a.status}),correlationId:``});return s}var Ig=encodeURIComponent,Lg=e=>typeof e==`number`||typeof e==`string`?{"If-Match":`"${e}"`}:{},Q={session:async()=>Pg(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/${Ig(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`),rbac:{catalog:()=>Z(`/rbac/catalog`),roles:()=>Z(`/rbac/roles`),role:e=>Z(`/rbac/roles/${Ig(e)}`),createRole:e=>Z(`/rbac/roles`,{method:`POST`,body:JSON.stringify(e)}),updateRole:(e,t)=>Z(`/rbac/roles/${Ig(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteRole:e=>Z(`/rbac/roles/${Ig(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/${Ig(e)}`),createUser:e=>Z(`/rbac/users`,{method:`POST`,body:JSON.stringify(e)}),updateUser:(e,t)=>Z(`/rbac/users/${Ig(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),setPassword:(e,t)=>Z(`/rbac/users/${Ig(e)}/password`,{method:`POST`,body:JSON.stringify({password:t})}),resetTwoFactor:e=>Z(`/rbac/users/${Ig(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)=>Tg(e,t,{apiBase:cg.apiBase,csrfToken:mg(),viewAs:yg(),locale:Yh(),onSignedOut:gg},n),search:e=>Z(`/search?${new URLSearchParams({q:e})}`),schema:async e=>{let t=await Z(`/meta/resources/${Ig(e)}`);return yg()?Mg(t):t},list:(e,t)=>Z(`/resources/${Ig(e)}?${t}`),remove:(e,t,n)=>Z(`/resources/${Ig(e)}/${Ig(t)}`,{method:`DELETE`,headers:Lg(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),Z(`/resources/${Ig(e)}/fields/${Ig(t)}/options${r.size?`?${r}`:``}`)},bulkDelete:(e,t)=>Z(`/resources/${Ig(e)}/bulk-delete`,{method:`POST`,body:JSON.stringify({ids:t})}),runAction:(e,t,n)=>Z(`/resources/${Ig(e)}/actions/${Ig(t)}`,{method:`POST`,body:JSON.stringify(n)}),page:async e=>{let t=await Z(`/pages/${Ig(e)}`);return yg()?Ng(t):t},savePage:(e,t)=>Z(`/pages/${Ig(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),history:(e,t,n)=>Z(`/resources/${Ig(e)}/${Ig(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/${Ig(e)}/${Ig(t)}/restore`,{method:`POST`,body:`{}`}),get:(e,t)=>Z(`/resources/${Ig(e)}/${Ig(t)}`),create:(e,t)=>Z(`/resources/${Ig(e)}`,{method:`POST`,body:JSON.stringify(t)}),update:(e,t,n,r)=>Z(`/resources/${Ig(e)}/${Ig(t)}`,{method:`PATCH`,body:JSON.stringify(n),headers:Lg(r)})},Rg=()=>ft({queryKey:[`session`],queryFn:async()=>{let e=await Q.session();return pg(e.csrfToken),e},retry:!1,staleTime:3e5}),zg=()=>{let{locale:e}=Y();return ft({queryKey:[`meta`,e],queryFn:Q.meta})},Bg=e=>{let{locale:t}=Y();return ft({queryKey:[`schema`,e,t],queryFn:()=>Q.schema(e)})},Vg=e=>{let{locale:t}=Y();return ft({queryKey:[`page`,e,t],queryFn:()=>Q.page(e)})},Hg=(e,t,n=!0)=>ft({queryKey:[`list`,e,t],queryFn:()=>Q.list(e,new URLSearchParams(t)),placeholderData:ue,enabled:n}),Ug=(e,t)=>ft({queryKey:[`record`,e,t],queryFn:()=>Q.get(e,t),enabled:t!==void 0}),Wg=(e,t,n,r,i)=>ft({queryKey:[`options`,e,t,n,i??``],queryFn:()=>Q.options(e,t,{search:n,values:i}),enabled:r,placeholderData:ue}),Gg=(e,t,n)=>ft({queryKey:[`options`,e,t,`ids`,n],queryFn:()=>Q.options(e,t,{ids:n}),enabled:n.length>0}),Kg=function(e,t){let n=e,r=Jg[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=Xg.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=Xg.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=Xg.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=Xg.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=Xg.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=Xg.getErrorCorrectPolynomial(l),d=Qg(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=$g.getRSBlocks(e,t),i=e_();for(let t=0;t<n.length;t+=1){let r=n[t];i.put(r.getMode(),4),i.put(r.getLength(),Xg.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=t_(e);break;case`Alphanumeric`:n=n_(e);break;case`Byte`:n=r_(e);break;case`Kanji`:n=i_(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=$g.getRSBlocks(e,r),n=e_();for(let t=0;t<s.length;t++){let r=s[t];n.put(r.getMode(),4),n.put(r.getLength(),Xg.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 l_(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
|
+
`},ld=0,ud=[];function dd(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),i=y.useState(ld++)[0],a=y.useState(Nu)[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=lu([e.lockRef.current],(e.shards||[]).map(od),!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=id(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=Zu(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Zu(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 rd(h,t,e,h===`h`?s:c,!0)},[]),c=y.useCallback(function(e){var n=e;if(ud.length&&ud[ud.length-1]===a){var r=`deltaY`in n?ad(n):id(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&sd(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(od).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:fd(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=id(e),r.current=void 0},[]),d=y.useCallback(function(t){l(t.type,ad(t),t.target,s(t,e.lockRef.current))},[]),f=y.useCallback(function(t){l(t.type,id(t),t.target,s(t,e.lockRef.current))},[]);y.useEffect(function(){return ud.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Ku),document.addEventListener(`touchmove`,c,Ku),document.addEventListener(`touchstart`,u,Ku),function(){ud=ud.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Ku),document.removeEventListener(`touchmove`,c,Ku),document.removeEventListener(`touchstart`,u,Ku)}},[]);var p=e.removeScrollBar,m=e.inert;return y.createElement(y.Fragment,null,m?y.createElement(a,{styles:cd(i)}):null,p?y.createElement(Uu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function fd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var pd=Cu(wu,dd),md=y.forwardRef(function(e,t){return y.createElement(Eu,su({},e,{ref:t,sideCar:pd}))});md.classNames=Eu.classNames;var hd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},gd=new WeakMap,_d=new WeakMap,vd={},yd=0,bd=function(e){return e&&(e.host||bd(e.parentNode))},xd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=bd(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})},Sd=function(e,t,n,r){var i=xd(t,Array.isArray(e)?e:[e]);vd[n]||(vd[n]=new WeakMap);var a=vd[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=(gd.get(e)||0)+1,l=(a.get(e)||0)+1;gd.set(e,c),a.set(e,l),o.push(e),c===1&&i&&_d.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(),yd++,function(){o.forEach(function(e){var t=gd.get(e)-1,i=a.get(e)-1;gd.set(e,t),a.set(e,i),t||(_d.has(e)||e.removeAttribute(r),_d.delete(e)),i||e.removeAttribute(n)}),yd--,yd||(gd=new WeakMap,gd=new WeakMap,_d=new WeakMap,vd={})}},Cd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||hd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Sd(r,i,n,`aria-hidden`)):function(){return null}},wd=Object.defineProperty,Td=(e,t)=>wd(e,`name`,{value:t,configurable:!0}),Ed=`Dialog`,[Dd,Od]=Pc(Ed),[kd,Ad]=Dd(Ed),jd=Td(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]=$c({prop:r,defaultProp:i??!1,onChange:a,caller:Ed}),[d,f]=y.useState(0),[p,m]=y.useState(0);return(0,b.jsx)(kd,{scope:t,triggerRef:s,contentRef:c,contentId:_l(),titleId:_l(),descriptionId:_l(),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`),Md=`DialogTrigger`,Nd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(Md,n),a=lc(t,i.triggerRef);return(0,b.jsx)(kc.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Zd(i.open),...r,ref:a,onClick:zc(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),Pd=`DialogPortal`,[Fd,Id]=Dd(Pd,{forceMount:void 0}),Ld=Td(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Ad(Pd,t);return(0,b.jsx)(Fd,{scope:t,forceMount:n,children:y.Children.map(r,e=>(0,b.jsx)(sl,{present:n||a.open,children:(0,b.jsx)($l,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Rd=`DialogOverlay`,zd=y.forwardRef(Td(function(e,t){let n=Id(Rd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ad(Rd,e.__scopeDialog);return a.modal?(0,b.jsx)(sl,{present:r||a.open,children:(0,b.jsx)(Vd,{...i,ref:t})}):null},`DialogOverlay`)),Bd=fc(`DialogOverlay.RemoveScroll`),Vd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(Rd,n),a=lc(t,kl());return(0,b.jsx)(md,{as:Bd,allowPinchZoom:!0,shards:[i.contentRef],children:(0,b.jsx)(kc.div,{"data-state":Zd(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Hd=`DialogContent`,Ud=y.forwardRef(Td(function(e,t){let n=Id(Hd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ad(Hd,e.__scopeDialog);return(0,b.jsx)(sl,{present:r||a.open,children:a.modal?(0,b.jsx)(Wd,{...i,ref:t}):(0,b.jsx)(Gd,{...i,ref:t})})},`DialogContent`)),Wd=y.forwardRef(Td(function(e,t){let n=Ad(Hd,e.__scopeDialog),r=y.useRef(null),i=lc(t,n.contentRef,r);return y.useEffect(()=>{let e=r.current;if(e)return Cd(e)},[]),(0,b.jsx)(Kd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:zc(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:zc(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:zc(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Gd=y.forwardRef(Td(function(e,t){let n=Ad(Hd,e.__scopeDialog),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(Kd,{...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`)),Kd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Ad(Hd,n);return au(),(0,b.jsx)(b.Fragment,{children:(0,b.jsx)(Bl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,b.jsx)(Ol,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Zd(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),qd=`DialogTitle`,Jd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(qd,n),{setTitleCount:a}=i;return Wc(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,b.jsx)(kc.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Yd=`DialogClose`,Xd=y.forwardRef(Td(function(e,t){let{__scopeDialog:n,...r}=e,i=Ad(Yd,n);return(0,b.jsx)(kc.button,{type:`button`,...r,ref:t,onClick:zc(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Zd(e){return e?`open`:`closed`}Td(Zd,`getState`);var Qd=Object.defineProperty,$d=(e,t)=>Qd(e,`name`,{value:t,configurable:!0});function ef(e){let[t,n]=y.useState(void 0);return Wc(()=>{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}$d(ef,`useSize`);var tf=Object.defineProperty,nf=(e,t)=>tf(e,`name`,{value:t,configurable:!0}),rf=`Checkbox`,[af,of]=Pc(rf),[sf,cf]=af(rf);function lf(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]=$c({prop:n,defaultProp:i??!1,onChange:c,caller:rf}),[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:!vf(i)&&i,isFormControl:C,bubbleInput:g,setBubbleInput:_};return(0,b.jsx)(sf,{scope:t,...w,children:_f(d)?d(w):r})}nf(lf,`CheckboxProvider`);var uf=`CheckboxTrigger`,df=y.forwardRef(nf(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}=cf(uf,e),g=lc(i,u),_=y.useRef(c);return y.useEffect(()=>{let e=a?.form;if(e){let t=nf(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,b.jsx)(kc.button,{type:`button`,role:`checkbox`,"aria-checked":vf(c)?`mixed`:c,"aria-required":l,"data-state":yf(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:zc(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:zc(n,e=>{p(),d(e=>vf(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),ff=y.forwardRef(nf(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)(lf,{__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)(df,{...d,ref:t,__scopeCheckbox:n}),e&&(0,b.jsx)(gf,{__scopeCheckbox:n})]})})},`Checkbox`)),pf=`CheckboxIndicator`,mf=y.forwardRef(nf(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=cf(pf,n);return(0,b.jsx)(sl,{present:r||vf(a.checked)||a.checked===!0,children:(0,b.jsx)(kc.span,{"data-state":yf(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),hf=`CheckboxBubbleInput`,gf=y.forwardRef(nf(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}=cf(hf,e),g=lc(r,h),_=ef(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=vf(s),n.call(e,!vf(s)&&s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let C=y.useRef(!vf(s)&&s);return(0,b.jsx)(kc.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:zc(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function _f(e){return typeof e==`function`}nf(_f,`isFunction`);function vf(e){return e===`indeterminate`}nf(vf,`isIndeterminate`);function yf(e){return vf(e)?`indeterminate`:e?`checked`:`unchecked`}nf(yf,`getState`);var bf=[`top`,`right`,`bottom`,`left`],xf=Math.min,Sf=Math.max,Cf=Math.round,wf=Math.floor,Tf=e=>({x:e,y:e}),Ef={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Df(e,t,n){return Sf(e,xf(t,n))}function Of(e,t){return typeof e==`function`?e(t):e}function kf(e){return e.split(`-`)[0]}function Af(e){return e.split(`-`)[1]}function jf(e){return e===`x`?`y`:`x`}function Mf(e){return e===`y`?`height`:`width`}function Nf(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Pf(e){return jf(Nf(e))}function Ff(e,t,n){n===void 0&&(n=!1);let r=Af(e),i=Pf(e),a=Mf(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Wf(o)),[o,Wf(o)]}function If(e){let t=Wf(e);return[Lf(e),t,Lf(t)]}function Lf(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Rf=[`left`,`right`],zf=[`right`,`left`],Bf=[`top`,`bottom`],Vf=[`bottom`,`top`];function Hf(e,t,n){switch(e){case`top`:case`bottom`:return n?t?zf:Rf:t?Rf:zf;case`left`:case`right`:return t?Bf:Vf;default:return[]}}function Uf(e,t,n,r){let i=Af(e),a=Hf(kf(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Lf)))),a}function Wf(e){let t=kf(e);return Ef[t]+e.slice(t.length)}function Gf(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Kf(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Gf(e)}function qf(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 K(e,t,n){let{reference:r,floating:i}=e,a=Nf(t),o=Pf(t),s=Mf(o),c=kf(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=Af(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Jf(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}=Of(t,e),p=Kf(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=qf(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=qf(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 Yf=50,Xf=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Jf},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=K(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<Yf&&(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}=K(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Zf=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}=Of(e,t)||{};if(l==null)return{};let d=Kf(u),f={x:n,y:r},p=Pf(i),m=Mf(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=xf(d[_],T),D=xf(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=Df(E,k,O),j=!c.arrow&&Af(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}}}),Qf=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}=Of(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=kf(r),_=Nf(o),v=kf(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Wf(o)]:If(o)),x=p!==`none`;!d&&x&&b.push(...Uf(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=Ff(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`||_===Nf(t)||T.every(e=>Nf(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=Nf(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 $f(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ep(e){return bf.some(t=>e[t]>=0)}var tp=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Of(e,t);switch(i){case`referenceHidden`:{let e=$f(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ep(e)}}}case`escaped`:{let e=$f(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ep(e)}}}default:return{}}}}},np=new Set([`left`,`top`]);async function rp(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=kf(n),s=Af(n),c=Nf(n)===`y`,l=np.has(o)?-1:1,u=a&&c?-1:1,d=Of(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 ip=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 rp(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}}}}},ap=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}=Of(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Nf(i),p=jf(f),m=u[p],h=u[f],g=(e,t)=>Df(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}}}}}},op=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}=Of(e,t),u={x:n,y:r},d=Nf(i),f=jf(d),p=u[f],m=u[d],h=Of(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=np.has(kf(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}}}},sp=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}=Of(e,t),c=await i.detectOverflow(t,s),l=kf(n),u=Af(n),d=Nf(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=xf(p-c[m],g),y=xf(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*Sf(c.left,c.right):S=p-2*Sf(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 cp(){return typeof window<`u`}function lp(e){return fp(e)?(e.nodeName||``).toLowerCase():`#document`}function up(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dp(e){return((fp(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function fp(e){return cp()?e instanceof Node||e instanceof up(e).Node:!1}function pp(e){return cp()?e instanceof Element||e instanceof up(e).Element:!1}function mp(e){return cp()?e instanceof HTMLElement||e instanceof up(e).HTMLElement:!1}function hp(e){return!cp()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof up(e).ShadowRoot}function gp(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Dp(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function _p(e){return/^(table|td|th)$/.test(lp(e))}function vp(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var yp=/transform|translate|scale|rotate|perspective|filter/,bp=/paint|layout|strict|content/,xp=e=>!!e&&e!==`none`,Sp;function Cp(e){let t=pp(e)?Dp(e):e;return xp(t.transform)||xp(t.translate)||xp(t.scale)||xp(t.rotate)||xp(t.perspective)||!Tp()&&(xp(t.backdropFilter)||xp(t.filter))||yp.test(t.willChange||``)||bp.test(t.contain||``)}function wp(e){let t=kp(e);for(;mp(t)&&!Ep(t);){if(Cp(t))return t;if(vp(t))return null;t=kp(t)}return null}function Tp(){return Sp??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Sp}function Ep(e){return/^(html|body|#document)$/.test(lp(e))}function Dp(e){return up(e).getComputedStyle(e)}function Op(e){return pp(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function kp(e){if(lp(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||hp(e)&&e.host||dp(e);return hp(t)?t.host:t}function Ap(e){let t=kp(e);return Ep(t)?(e.ownerDocument||e).body:mp(t)&&gp(t)?t:Ap(t)}function jp(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ap(e),i=r===e.ownerDocument?.body,a=up(r);if(i){let e=Mp(a);return t.concat(a,a.visualViewport||[],gp(r)?r:[],e&&n?jp(e):[])}return t.concat(r,jp(r,[],n))}function Mp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Np(e){let t=Dp(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=Cf(n)!==a||Cf(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Pp(e){return pp(e)?e:e.contextElement}function Fp(e){let t=Pp(e);if(!mp(t))return Tf(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Np(t),o=(a?Cf(n.width):n.width)/r,s=(a?Cf(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ip=Tf(0);function Lp(e){let t=up(e);return!Tp()||!t.visualViewport?Ip:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Rp(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===up(e)}function zp(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Pp(e),o=Tf(1);t&&(r?pp(r)&&(o=Fp(r)):o=Fp(e));let s=Rp(a,n,r)?Lp(a):Tf(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=up(a),t=pp(r)?up(r):r,n=e,i=Mp(n);for(;i&&t!==n;){let e=Fp(i),t=i.getBoundingClientRect(),r=Dp(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=up(i),i=Mp(n)}}return qf({width:u,height:d,x:c,y:l})}function Bp(e,t){let n=Op(e).scrollLeft;return t?t.left+n:zp(dp(e)).left+n}function Vp(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Bp(e,n),y:n.top+t.scrollTop}}function Hp(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=dp(r),s=t?vp(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Tf(1),u=Tf(0),d=mp(r);if((d||!a)&&((lp(r)!==`body`||gp(o))&&(c=Op(r)),d)){let e=zp(r);l=Fp(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Vp(o,c):Tf(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 Up(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Wp(e){let t=Op(e),n=e.ownerDocument.body,r=Sf(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Sf(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Bp(e),o=-t.scrollTop;return Dp(n).direction===`rtl`&&(a+=Sf(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Gp=25;function Kp(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=up(e),a=dp(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Tp()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Bp(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<=Gp&&(s-=o)}return{width:s,height:c,x:l,y:u}}function qp(e,t){let n=zp(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Fp(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Jp(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Kp(e,n,t);else if(t===`document`)r=Wp(dp(e));else if(pp(t))r=qp(t,n);else{let n=Lp(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return qf(r)}function Yp(e,t){let n=t.get(e);if(n)return n;let r=jp(e,[],!1).filter(e=>pp(e)&&lp(e)!==`body`),i=null,a=Dp(e).position===`fixed`,o=a?kp(e):e;for(;pp(o)&&!Ep(o);){let e=Dp(o),t=Cp(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=kp(o)}return t.set(e,r),r}function Xp(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?vp(t)?[]:Yp(t,this._c):[].concat(n),r],o=Jp(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=Jp(t,a[e],i);s=Sf(n.top,s),c=xf(n.right,c),l=xf(n.bottom,l),u=Sf(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Zp(e){let{width:t,height:n}=Np(e);return{width:t,height:n}}function Qp(e,t,n){let r=mp(t),i=dp(t),a=n===`fixed`,o=zp(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Tf(0);if((r||!a)&&((lp(t)!==`body`||gp(i))&&(s=Op(t)),r)){let e=zp(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Bp(i));let l=i&&!r&&!a?Vp(i,s):Tf(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 $p(e){return Dp(e).position===`static`}function em(e,t){if(!mp(e)||Dp(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return dp(e)===n&&(n=n.ownerDocument.body),n}function tm(e,t){let n=up(e);if(vp(e))return n;if(!mp(e)){let t=kp(e);for(;t&&!Ep(t);){if(pp(t)&&!$p(t))return t;t=kp(t)}return n}let r=em(e,t);for(;r&&_p(r)&&$p(r);)r=em(r,t);return r&&Ep(r)&&$p(r)&&!Cp(r)?n:r||wp(e)||n}var nm=async function(e){let t=this.getOffsetParent||tm,n=this.getDimensions,r=await n(e.floating);return{reference:Qp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function rm(e){return Dp(e).direction===`rtl`}var im={convertOffsetParentRelativeRectToViewportRelativeRect:Hp,getDocumentElement:dp,getClippingRect:Xp,getOffsetParent:tm,getElementRects:nm,getClientRects:Up,getDimensions:Zp,getScale:Fp,isElement:pp,isRTL:rm};function am(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function om(e,t,n){let r=null,i,a=dp(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=wf(d),h=wf(a.clientWidth-(u+f)),g=wf(a.clientHeight-(d+p)),_=wf(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Sf(0,xf(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!am(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=up(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function sm(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=Pp(e),u=i||a?[...l?jp(l):[],...t?jp(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?om(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?zp(e):null;c&&g();function g(){let t=zp(e);h&&!am(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 cm=ip,lm=ap,um=Qf,dm=sp,fm=tp,pm=Zf,mm=op,hm=(e,t,n)=>{let r=new Map,i=n??{},a={...im,...i.platform,_c:r};return Xf(e,t,{...i,platform:a})},gm=typeof document<`u`?y.useLayoutEffect:function(){};function _m(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(!_m(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)&&!_m(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function vm(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ym(e,t){let n=vm(e);return Math.round(t*n)/n}function bm(e){let t=y.useRef(e);return gm(()=>{t.current=e}),t}function xm(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);_m(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=bm(c),O=bm(i),k=bm(l),A=y.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),hm(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!_m(T.current,t)&&(T.current=t,Ec.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);gm(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=y.useRef(!1);gm(()=>(j.current=!0,()=>{j.current=!1}),[]),gm(()=>{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=ym(N.floating,u.x),r=ym(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...vm(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 Sm=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?{}:pm({element:r.current,padding:i}).fn(n):r?pm({element:r,padding:i}).fn(n):{}}}},Cm=(e,t)=>{let n=cm(e);return{name:n.name,fn:n.fn,options:[e,t]}},wm=(e,t)=>{let n=lm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tm=(e,t)=>({fn:mm(e).fn,options:[e,t]}),Em=(e,t)=>{let n=um(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dm=(e,t)=>{let n=dm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Om=(e,t)=>{let n=fm(e);return{name:n.name,fn:n.fn,options:[e,t]}},km=(e,t)=>{let n=Sm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Am=Object.defineProperty,jm=(e,t)=>Am(e,`name`,{value:t,configurable:!0}),Mm=`Popper`,[Nm,Pm]=Pc(Mm),[Fm,Im]=Nm(Mm),Lm=jm(e=>{let{__scopePopper:t,children:n}=e,[r,i]=y.useState(null),[a,o]=y.useState(void 0);return(0,b.jsx)(Fm,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Rm=`PopperAnchor`,zm=y.forwardRef(jm(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Im(Rm,n),o=y.useRef(null),s=a.onAnchorChange,c=lc(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&&Km(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,b.jsx)(kc.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Bm=`PopperContent`,[Vm,Hm]=Nm(Bm),Um=y.forwardRef(jm(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=Im(Bm,n),[_,v]=y.useState(null),x=lc(t,v),[S,C]=y.useState(null),w=ef(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(Wm),altBoundary:A},{refs:M,floatingStyles:N,placement:ee,isPositioned:P,middlewareData:F}=xm({strategy:`fixed`,placement:D,whileElementsMounted:jm((...e)=>sm(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Cm({mainAxis:i+E,alignmentAxis:o}),c&&wm({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Tm():void 0,...j}),c&&Em({...j}),Dm({...j,apply:jm(({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&&km({element:S,padding:s}),Gm({arrowWidth:T,arrowHeight:E}),f&&Om({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),te=g.setPlacementState;Wc(()=>(te(ee),()=>{te(void 0)}),[ee,te]);let[ne,re]=Km(ee),ie=bl(m);Wc(()=>{P&&ie?.()},[P,ie]);let ae=F.arrow?.x,oe=F.arrow?.y,se=F.arrow?.centerOffset!==0,[ce,le]=y.useState();return Wc(()=>{_&&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)(Vm,{scope:n,placedSide:ne,placedAlign:re,onArrowChange:C,arrowX:ae,arrowY:oe,shouldHideArrow:se,children:(0,b.jsx)(kc.div,{"data-side":ne,"data-align":re,...h,ref:x,style:{...h.style,animation:P?h.style?.animation:`none`}})})})},`PopperContent`));function Wm(e){return e!==null}jm(Wm,`isNotNull`);var Gm=jm(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]=Km(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 Km(e){let[t,n=`center`]=e.split(`-`);return[t,n]}jm(Km,`getSideAndAlignFromPlacement`);var qm=Lm,Jm=zm,Ym=Um,Xm=Object.defineProperty,Zm=y.forwardRef(((e,t)=>Xm(e,`name`,{value:t,configurable:!0}))(function(e,t){return(0,b.jsx)(kc.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})},`Label`)),Qm=Object.defineProperty,$m=(e,t)=>Qm(e,`name`,{value:t,configurable:!0}),eh=`Popover`,[th,nh]=Pc(eh,[Pm]),rh=Pm(),[ih,ah]=th(eh),oh=$m(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=rh(t),c=y.useRef(null),[l,u]=y.useState(!1),[d,f]=$c({prop:r,defaultProp:i??!1,onChange:a,caller:eh});return(0,b.jsx)(qm,{...s,children:(0,b.jsx)(ih,{scope:t,contentId:_l(),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`),sh=`PopoverTrigger`,ch=y.forwardRef($m(function(e,t){let{__scopePopover:n,...r}=e,i=ah(sh,n),a=rh(n),o=lc(t,i.triggerRef),s=(0,b.jsx)(kc.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":xh(i.open),...r,ref:o,onClick:zc(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,b.jsx)(Jm,{asChild:!0,...a,children:s})},`PopoverTrigger`)),lh=`PopoverPortal`,[uh,dh]=th(lh,{forceMount:void 0}),fh=$m(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=ah(lh,t);return(0,b.jsx)(uh,{scope:t,forceMount:n,children:(0,b.jsx)(sl,{present:n||a.open,children:(0,b.jsx)($l,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),ph=`PopoverContent`,mh=y.forwardRef($m(function(e,t){let n=dh(ph,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=ah(ph,e.__scopePopover);return(0,b.jsx)(sl,{present:r||a.open,children:a.modal?(0,b.jsx)(gh,{...i,ref:t}):(0,b.jsx)(_h,{...i,ref:t})})},`PopoverContent`)),hh=fc(`PopoverContent.RemoveScroll`),gh=y.forwardRef($m(function(e,t){let n=ah(ph,e.__scopePopover),r=y.useRef(null),i=lc(t,r),a=y.useRef(!1);return y.useEffect(()=>{let e=r.current;if(e)return Cd(e)},[]),(0,b.jsx)(md,{as:hh,allowPinchZoom:!0,children:(0,b.jsx)(vh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:zc(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:zc(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:zc(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),_h=y.forwardRef($m(function(e,t){let n=ah(ph,e.__scopePopover),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(vh,{...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`)),vh=y.forwardRef($m(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=ah(ph,n),p=rh(n);return au(),(0,b.jsx)(Bl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,b.jsx)(Ol,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,b.jsx)(Ym,{"data-state":xh(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`)),yh=`PopoverClose`,bh=y.forwardRef($m(function(e,t){let{__scopePopover:n,...r}=e,i=ah(yh,n);return(0,b.jsx)(kc.button,{type:`button`,...r,ref:t,onClick:zc(e.onClick,()=>i.onOpenChange(!1))})},`PopoverClose`));function xh(e){return e?`open`:`closed`}$m(xh,`getState`);var Sh=oh,Ch=ch,wh=fh,Th=mh,Eh=bh,Dh=ic(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm 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:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,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:`bg-destructive/10 text-destructive hover:bg-destructive/20 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-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2`,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-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] 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-8`,"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-7 rounded-[min(var(--radius-md),12px)] 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?pc:`button`;return(0,b.jsx)(a,{"data-slot":`button`,"data-variant":t,"data-size":n,className:W(Dh({variant:t,size:n,className:e})),...i})}function Oh({className:e,type:t,...n}){return(0,b.jsx)(`input`,{type:t,"data-slot":`input`,className:W(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base 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 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),...n})}function kh({className:e,...t}){return(0,b.jsx)(Zm,{"data-slot":`label`,className:W(`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 Ah=`۰۱۲۳۴۵۶۷۸۹`,jh=`٠١٢٣٤٥٦٧٨٩`;function Mh(e){return e.replace(/[۰-۹٠-٩]/g,e=>String(Math.max(Ah.indexOf(e),jh.indexOf(e))))}function Nh(e){return Mh(e).replace(/٫/g,`.`).replace(/٬/g,`,`)}function Ph(e){return e.replace(/[0-9]/g,e=>Ah[Number(e)])}function Fh(e){return Ph(e).replace(/\./g,`٫`).replace(/,/g,`٬`)}var Ih=`nma.calendar`,Lh=`nma.digits`;function Rh(e){try{return localStorage.getItem(e)}catch{return null}}function zh(e){let t=Rh(Ih),n=Rh(Lh);return{calendar:t===`gregorian`||t===`persian`?t:e.split(`-`)[0]===`fa`?`persian`:`gregorian`,digits:n===`latn`||n===`arabext`?n:`latn`}}function Bh(e){try{e.calendar&&localStorage.setItem(Ih,e.calendar),e.digits&&localStorage.setItem(Lh,e.digits)}catch{}}var Vh={"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.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.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.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}`,"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.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.`,"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.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.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.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.create":`Create`,"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}`},Hh={en:Vh,fa:{"common.loading":`در حال بارگذاری…`,"common.yes":`بله`,"common.no":`خیر`,"common.empty":`—`,"common.all":`همه`,"common.cancel":`انصراف`,"common.pageNotFound":`صفحه پیدا نشد.`,"common.requestFailed":`درخواست ناموفق بود ({status})`,"common.reference":`{message} (کد پیگیری: {id})`,"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.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.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}`,"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.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":`ابتدا تغییرات را ذخیره یا لغو کنید.`,"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.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.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.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.create":`ساختن`,"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} باشد`}},Uh=new Set([`fa`,`ar`,`he`,`ur`]),Wh=`nma.locale`,Gh=`en`,Kh={calendar:`gregorian`,digits:`latn`};function qh(){return Kh}function Jh(e){Kh=e}function Yh(){return Gh}function J(e,t={},n=Gh){return((Hh[n]??Vh)[e]??Vh[e]).replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e)}function Xh(e){return Uh.has(e.split(`-`)[0])}var Zh=e=>`-u-ca-${e.calendar===`persian`?`persian`:`gregory`}-nu-${e.digits}`;function Qh(e,t=Gh){return new Intl.NumberFormat(`${t}-u-nu-${Kh.digits}`).format(e)}function $h(e){return Kh.digits===`arabext`?Fh(e):e}function eg(e,t=Gh){return new Intl.DateTimeFormat(`${t}${Zh(Kh)}`,{dateStyle:`medium`,timeStyle:`short`}).format(e)}function tg(e,t=Gh){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}${Zh(Kh)}`,{dateStyle:`medium`,timeZone:`UTC`}).format(n)}function ng(e,t=new Date,n=Gh){let r=Math.min(0,Math.round((e.getTime()-t.getTime())/1e3)),i=new Intl.RelativeTimeFormat(`${n}-u-nu-${Kh.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 rg(e){Gh=e,document.documentElement.lang=e,document.documentElement.dir=Xh(e)?`rtl`:`ltr`}function ig(e,t){try{let t=localStorage.getItem(Wh);if(t&&e.includes(t))return t}catch{}return t}var ag=(0,y.createContext)(void 0);function og({locales:e,fallback:t,children:n}){let[r,i]=(0,y.useState)(()=>{let n=ig(e,t);return rg(n),n}),[a,o]=(0,y.useState)(()=>{let e=zh(r);return Jh(e),e});return(0,b.jsx)(ag.Provider,{value:{locale:r,locales:e,setLocale:e=>{rg(e);try{localStorage.setItem(Wh,e)}catch{}let t=zh(e);Jh(t),o(t),i(e)},t:(e,t)=>J(e,t,r),calendar:a.calendar,digits:a.digits,setDisplay:e=>{Bh(e);let t={...a,...e};Jh(t),o(t)}},children:n})}function Y(){let e=(0,y.useContext)(ag);if(!e)throw Error(`useLocale() outside LocaleProvider`);return e}function X(){return Y().t}function sg(){let e=document.getElementById(`nma-config`)?.textContent;if(e)return JSON.parse(e);throw Error(`nest-my-admin: runtime config missing`)}var cg=sg(),lg=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 ug(e){if(!(e instanceof lg))return e.message;let t=Object.entries(e.fields).map(([e,t])=>`${e}: ${t.join(`, `)}`);return[e.message,...t].join(` — `)}var dg,fg;function pg(e){dg=e}function mg(){return dg}function hg(e){fg=e}function gg(){dg=void 0,fg?.()}function _g(e){return!e||!e.startsWith(`/`)||e.startsWith(`//`)||e.startsWith(`/\\`)||e.startsWith(`/login`)?`/`:e}var vg=`nma-view-as`;function yg(){try{return sessionStorage.getItem(vg)??void 0}catch{return}}function bg(e){try{e===void 0?sessionStorage.removeItem(vg):sessionStorage.setItem(vg,e)}catch{}}var xg=class extends Error{constructor(){super(`Upload aborted`),this.name=`UploadAbortedError`}},Sg=`application/octet-stream`;function Cg(e){return typeof e==`object`&&!!e&&`code`in e&&`message`in e}function wg(e){return typeof e==`object`&&!!e&&typeof e.token==`string`}function Tg(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`,Sg),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&&wg(e);i.status===401&&n.onSignedOut?.(),c(()=>{t?(r?.(1),o(e)):Cg(e)?s(new lg(i.status,e)):i.status===413?s(new lg(413,{code:`BAD_REQUEST`,message:J(`upload.tooLarge`,{},n.locale),correlationId:``})):s(new lg(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 xg)),i.send(e)}),abort:()=>{a||i.abort()}}}function Eg(e){if(e instanceof lg){let t=Object.values(e.fields).flat();if(t.length>0)return t.join(` `)}return e instanceof Error?e.message:String(e)}function Dg(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 Og(e,t,n){if(e.size===0)return J(`upload.empty`,{},n);if(e.size>t.maxBytes)return J(`upload.tooLargeMax`,{max:Ag(t.maxBytes,n)},n);if(e.type!==``&&!Dg(e.type.split(`;`)[0].trim(),t.accept))return J(`upload.typeRefused`,{},n)}var kg=[`upload.bytes`,`upload.kilobytes`,`upload.megabytes`,`upload.gigabytes`,`upload.terabytes`];function Ag(e,t){let n=e,r=0;for(;n>=1024&&r<kg.length-1;)n/=1024,r+=1;let i=new Intl.NumberFormat(t??`${Yh()}-u-nu-${qh().digits}`,{maximumFractionDigits:r===0?0:1}).format(n);return J(kg[r],{value:i},t)}function jg(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 Mg(e){return{...e,creatable:!1,actions:[],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,Mg(t)]))}:{}}}function Ng(e){return e.schema.readonly?e:{...e,schema:{...e.schema,readonly:!0}}}function Pg(e){return e.viewAs?{...e,rbac:{...e.rbac,manage:!1}}:e}function Fg(e){return typeof e==`object`&&!!e&&`code`in e&&`message`in e}async function Z(e,t={}){let n=t.method??`GET`,r=mg(),i=e===`/session`&&n===`POST`?void 0:yg(),a=await fetch(`${cg.apiBase}${e}`,{...t,credentials:`same-origin`,headers:{Accept:`application/json`,"Accept-Language":Yh(),...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`)&&gg();let o=await a.text(),s;try{s=o?JSON.parse(o):void 0}catch{s=void 0}if(!a.ok)throw new lg(a.status,Fg(s)?s:{code:`INTERNAL`,message:J(`common.requestFailed`,{status:a.status}),correlationId:``});return s}var Ig=encodeURIComponent,Lg=e=>typeof e==`number`||typeof e==`string`?{"If-Match":`"${e}"`}:{},Q={session:async()=>Pg(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/${Ig(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`),rbac:{catalog:()=>Z(`/rbac/catalog`),roles:()=>Z(`/rbac/roles`),role:e=>Z(`/rbac/roles/${Ig(e)}`),createRole:e=>Z(`/rbac/roles`,{method:`POST`,body:JSON.stringify(e)}),updateRole:(e,t)=>Z(`/rbac/roles/${Ig(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),deleteRole:e=>Z(`/rbac/roles/${Ig(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/${Ig(e)}`),createUser:e=>Z(`/rbac/users`,{method:`POST`,body:JSON.stringify(e)}),updateUser:(e,t)=>Z(`/rbac/users/${Ig(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),setPassword:(e,t)=>Z(`/rbac/users/${Ig(e)}/password`,{method:`POST`,body:JSON.stringify({password:t})}),resetTwoFactor:e=>Z(`/rbac/users/${Ig(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)=>Tg(e,t,{apiBase:cg.apiBase,csrfToken:mg(),viewAs:yg(),locale:Yh(),onSignedOut:gg},n),search:e=>Z(`/search?${new URLSearchParams({q:e})}`),schema:async e=>{let t=await Z(`/meta/resources/${Ig(e)}`);return yg()?Mg(t):t},list:(e,t)=>Z(`/resources/${Ig(e)}?${t}`),remove:(e,t,n)=>Z(`/resources/${Ig(e)}/${Ig(t)}`,{method:`DELETE`,headers:Lg(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/${Ig(e)}/fields/${Ig(t)}/options${r.size?`?${r}`:``}`)},bulkDelete:(e,t)=>Z(`/resources/${Ig(e)}/bulk-delete`,{method:`POST`,body:JSON.stringify({ids:t})}),runAction:(e,t,n)=>Z(`/resources/${Ig(e)}/actions/${Ig(t)}`,{method:`POST`,body:JSON.stringify(n)}),page:async e=>{let t=await Z(`/pages/${Ig(e)}`);return yg()?Ng(t):t},savePage:(e,t)=>Z(`/pages/${Ig(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),history:(e,t,n)=>Z(`/resources/${Ig(e)}/${Ig(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/${Ig(e)}/${Ig(t)}/restore`,{method:`POST`,body:`{}`}),get:(e,t)=>Z(`/resources/${Ig(e)}/${Ig(t)}`),create:(e,t)=>Z(`/resources/${Ig(e)}`,{method:`POST`,body:JSON.stringify(t)}),update:(e,t,n,r)=>Z(`/resources/${Ig(e)}/${Ig(t)}`,{method:`PATCH`,body:JSON.stringify(n),headers:Lg(r)})},Rg=()=>ft({queryKey:[`session`],queryFn:async()=>{let e=await Q.session();return pg(e.csrfToken),e},retry:!1,staleTime:3e5}),zg=()=>{let{locale:e}=Y();return ft({queryKey:[`meta`,e],queryFn:Q.meta})},Bg=e=>{let{locale:t}=Y();return ft({queryKey:[`schema`,e,t],queryFn:()=>Q.schema(e)})},Vg=e=>{let{locale:t}=Y();return ft({queryKey:[`page`,e,t],queryFn:()=>Q.page(e)})},Hg=(e,t,n=!0)=>ft({queryKey:[`list`,e,t],queryFn:()=>Q.list(e,new URLSearchParams(t)),placeholderData:ue,enabled:n}),Ug=(e,t)=>ft({queryKey:[`record`,e,t],queryFn:()=>Q.get(e,t),enabled:t!==void 0}),Wg=(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}),Gg=(e,t,n)=>ft({queryKey:[`options`,e,t,`ids`,n],queryFn:()=>Q.options(e,t,{ids:n}),enabled:n.length>0}),Kg=function(e,t){let n=e,r=Jg[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=Xg.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=Xg.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=Xg.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=Xg.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=Xg.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=Xg.getErrorCorrectPolynomial(l),d=Qg(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=$g.getRSBlocks(e,t),i=e_();for(let t=0;t<n.length;t+=1){let r=n[t];i.put(r.getMode(),4),i.put(r.getLength(),Xg.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=t_(e);break;case`Alphanumeric`:n=n_(e);break;case`Byte`:n=r_(e);break;case`Kanji`:n=i_(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=$g.getRSBlocks(e,r),n=e_();for(let t=0;t<s.length;t++){let r=s[t];n.put(r.getMode(),4),n.put(r.getLength(),Xg.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 l_(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
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};Kg.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},Kg.createStringToBytes=function(e,t){let n=function(){let n=s_(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 qg={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Jg={L:1,M:0,Q:3,H:2},Yg={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Xg=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 Yg.PATTERN000:return function(e,t){return(e+t)%2==0};case Yg.PATTERN001:return function(e,t){return e%2==0};case Yg.PATTERN010:return function(e,t){return t%3==0};case Yg.PATTERN011:return function(e,t){return(e+t)%3==0};case Yg.PATTERN100:return function(e,t){return(Math.floor(e/2)+Math.floor(t/3))%2==0};case Yg.PATTERN101:return function(e,t){return e*t%2+e*t%3==0};case Yg.PATTERN110:return function(e,t){return(e*t%2+e*t%3)%2==0};case Yg.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=Qg([1],0);for(let n=0;n<e;n+=1)t=t.multiply(Qg([1,Zg.gexp(n)],0));return t},r.getLengthInBits=function(e,t){if(1<=t&&t<10)switch(e){case qg.MODE_NUMBER:return 10;case qg.MODE_ALPHA_NUM:return 9;case qg.MODE_8BIT_BYTE:return 8;case qg.MODE_KANJI:return 8;default:throw`mode:`+e}else if(t<27)switch(e){case qg.MODE_NUMBER:return 12;case qg.MODE_ALPHA_NUM:return 11;case qg.MODE_8BIT_BYTE:return 16;case qg.MODE_KANJI:return 10;default:throw`mode:`+e}else if(t<41)switch(e){case qg.MODE_NUMBER:return 14;case qg.MODE_ALPHA_NUM:return 13;case qg.MODE_8BIT_BYTE:return 16;case qg.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}(),Zg=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}(),Qg=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]^=Zg.gexp(Zg.glog(r.getAt(n))+Zg.glog(e.getAt(i)));return Qg(t,0)},r.mod=function(e){if(r.getLength()-e.getLength()<0)return r;let t=Zg.glog(r.getAt(0))-Zg.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]^=Zg.gexp(Zg.glog(e.getAt(r))+t);return Qg(n,0).mod(e)},r},$g=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 Jg.L:return e[(t-1)*4+0];case Jg.M:return e[(t-1)*4+1];case Jg.Q:return e[(t-1)*4+2];case Jg.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}(),e_=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},t_=function(e){let t=qg.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},n_=function(e){let t=qg.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},r_=function(e){let t=qg.MODE_8BIT_BYTE,n=Kg.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},i_=function(e){let t=qg.MODE_KANJI,n=Kg.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},a_=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},o_=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},s_=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},c_=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=a_(),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},l_=function(e,t,n){let r=c_(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=a_();r.write(i);let a=o_(),o=i.toByteArray();for(let e=0;e<o.length;e+=1)a.writeByte(o[e]);return a.flush(),`data:image/gif;base64,`+a};Kg.stringToBytes;function u_({text:e,label:t}){let{size:n,path:r}=(0,y.useMemo)(()=>{let t=Kg(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 d_(){let{t:e}=Y(),t=Rg();if(t.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});if(!t.data)return null;if(t.data.viewAs)return(0,b.jsx)(Da,{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-xl font-semibold`,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)(f_,{}),r.twoFactor&&(0,b.jsx)(p_,{}),r.sessions&&(0,b.jsx)(h_,{revokeOthers:r.revokeOthers})]})}function f_(){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 lg&&Object.keys(e.fields).length>0?e.fields:{form:[ug(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)(kh,{htmlFor:`password-${e}`,children:t}),(0,b.jsx)(Oh,{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-lg border 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 p_(){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 lg&&Object.keys(e.fields).length>0?Object.values(e.fields).flat().join(` `):ug(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-lg border 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)(u_,{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)(kh,{htmlFor:`two-factor-code`,children:e(`twoFactor.code`)}),(0,b.jsx)(Oh,{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)(kh,{htmlFor:`two-factor-password`,children:e(`twoFactor.password`)}),(0,b.jsx)(Oh,{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 m_(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 h_({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-lg border 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:ug(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:[m_(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:eg(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:m_(e.userAgent,t(`auth.unknownDevice`))}),children:t(`auth.revoke`)})]},e.id))})]})}function g_(e,t){return e==null?``:typeof e==`string`?e:e[t]??e[cg.locale]??Object.values(e)[0]??``}function __(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 cg.locales.length===1?t[n[0]]:t}function v_(e){let t=Object.fromEntries(cg.locales.map(e=>[e,``]));return typeof e==`string`?t[cg.locale]=e:e&&Object.assign(t,e),t}function y_({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-xl font-semibold`,children:e}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t})]})}function b_({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 x_=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function S_(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:x_(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var C_=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},w_=e=>{let t=C_(e);return t.charAt(0).toUpperCase()+t.slice(1)},T_=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),E_={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 D_(e){return e!=null}function O_(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??E_.width,a=e.size??e.height??E_.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?T_(...c):T_(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??E_[`stroke-width`])*Number(e.size??e.width??E_.width)/Number(t.size??t.width??E_.width):t.strokeWidth??E_[`stroke-width`];return[`svg`,{...Object.entries(E_).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&D_(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&D_(t.width)&&{[r(`width`)]:t.width},...`height`in t&&D_(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 k_(e,t={}){return O_(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var A_=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},j_=(0,y.createContext)({}),M_=()=>(0,y.useContext)(j_),N_=(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=``}=M_()??{},b=!!c||A_(d),[x,S,C=[]]=k_(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:T_(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`?S_(e,t,n):e,i=(0,y.forwardRef)(({className:e,...t},n)=>(0,y.createElement)(N_,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=w_(r.name)),i}var P_={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`}]]};P_.node;var F_=$(P_),I_={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};I_.node;var L_=$(I_),R_={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};R_.node;var z_=$(R_),B_={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};B_.node;var V_=$(B_),H_={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`}]]};H_.node;var U_=$(H_),W_={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`}]]};W_.node;var G_=$(W_),K_={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`}]]};K_.node;var q_=$(K_),J_={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`}]]};J_.node;var Y_=$(J_),X_={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`}]]};X_.node;var Z_=$(X_),Q_={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`}]]};Q_.node;var $_=$(Q_),ev={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`]};ev.node;var tv=$(ev),nv={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`}]]};nv.node;var rv=$(nv),iv={name:`calendar-cog`,size:24,node:[[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m15.228 19.148-.923.383`,key:`51cr3n`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`m16.47 14.305.382.923`,key:`obybxd`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`m20.773 16.852.924-.383`,key:`ybmb4k`}],[`path`,{d:`m20.773 19.148.924.383`,key:`1c2d3p`}],[`path`,{d:`M21 10.5V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h5.5`,key:`1e6z1y`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]};iv.node;var av=$(iv),ov={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`}]]};ov.node;var sv=$(ov),cv={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`]};cv.node;var lv=$(cv),uv={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};uv.node;var dv=$(uv),fv={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};fv.node;var pv=$(fv),mv={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};mv.node;var hv=$(mv),gv={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};gv.node;var _v=$(gv),vv={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};vv.node;var yv=$(vv),bv={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`]};bv.node;var xv=$(bv),Sv={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`}]]};Sv.node;var Cv=$(Sv),wv={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`}]]};wv.node;var Tv=$(wv),Ev={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`}]]};Ev.node;var Dv=$(Ev),Ov={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`}]]};Ov.node;var kv=$(Ov),Av={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`}]]};Av.node;var jv=$(Av),Mv={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`}]]};Mv.node;var Nv=$(Mv),Pv={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`}]]};Pv.node;var Fv=$(Pv),Iv={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`}]]};Iv.node;var Lv=$(Iv),Rv={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`}]]};Rv.node;var zv=$(Rv),Bv={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`}]]};Bv.node;var Vv=$(Bv),Hv={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`}]]};Hv.node;var Uv=$(Hv),Wv={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`}]]};Wv.node;var Gv=$(Wv),Kv={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`}]]};Kv.node;var qv=$(Kv),Jv={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`]};Jv.node;var Yv=$(Jv),Xv={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`}]]};Xv.node;var Zv=$(Xv),Qv={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`}]]};Qv.node;var $v=$(Qv),ey={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`}]]};ey.node;var ty=$(ey),ny={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};ny.node;var ry=$(ny),iy={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`}]]};iy.node;var ay=$(iy),oy={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`}]]};oy.node;var sy=$(oy),cy={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`]};cy.node;var ly=$(cy),uy={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`}]]};uy.node;var dy=$(uy),fy={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`}]]};fy.node;var py=$(fy),my={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`}]]};my.node;var hy=$(my),gy={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`}]]};gy.node;var _y=$(gy),vy={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`}]]};vy.node;var yy=$(vy),by={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`}]]};by.node;var xy=$(by),Sy={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`}]]};Sy.node;var Cy=$(Sy),wy={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`}]]};wy.node;var Ty=$(wy),Ey={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Ey.node;var Dy=$(Ey),Oy={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`}]]};Oy.node;var ky=$(Oy),Ay={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`}]]};Ay.node;var jy=$(Ay),My={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`}]]};My.node;var Ny=$(My),Py={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`}]]};Py.node;var Fy=$(Py),Iy={name:`panel-left-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]],aliases:[`sidebar-close`]};Iy.node;var Ly=$(Iy),Ry={name:`panel-left-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]],aliases:[`sidebar-open`]};Ry.node;var zy=$(Ry),By={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`}]]};By.node;var Vy=$(By),Hy={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`}]]};Hy.node;var Uy=$(Hy),Wy={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`}]]};Wy.node;var Gy=$(Wy),Ky={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`}]]};Ky.node;var qy=$(Ky),Jy={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Jy.node;var Yy=$(Jy),Xy={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`}]]};Xy.node;var Zy=$(Xy),Qy={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`}]]};Qy.node;var $y=$(Qy),eb={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`}]]};eb.node;var tb=$(eb),nb={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`]};nb.node;var rb=$(nb),ib={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`}]]};ib.node;var ab=$(ib),ob={name:`search-check`,size:24,node:[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};ob.node;var sb=$(ob),cb={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};cb.node;var lb=$(cb),ub={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`}]]};ub.node;var db=$(ub),fb={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`}]]};fb.node;var pb=$(fb),mb={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`}]]};mb.node;var hb=$(mb),gb={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`}]]};gb.node;var _b=$(gb),vb={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`}]]};vb.node;var yb=$(vb),bb={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`}]]};bb.node;var xb=$(bb),Sb={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`}]]};Sb.node;var Cb=$(Sb),wb={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`}]]};wb.node;var Tb=$(wb),Eb={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`}]]};Eb.node;var Db=$(Eb),Ob={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`}]]};Ob.node;var kb=$(Ob),Ab={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`}]]};Ab.node;var jb=$(Ab),Mb={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`}]]};Mb.node;var Nb=$(Mb),Pb={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`}]]};Pb.node;var Fb=$(Pb),Ib={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`]};Ib.node;var Lb=$(Ib),Rb={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`}]]};Rb.node;var zb=$(Rb),Bb={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`}]]};Bb.node;var Vb=$(Bb),Hb={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`]};Hb.node;var Ub=$(Hb),Wb={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`}]]};Wb.node;var Gb=$(Wb),Kb={name:`users-round`,size:24,node:[[`path`,{d:`M18 21a8 8 0 0 0-16 0`,key:`3ypg7q`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3`,key:`10s06x`}]],aliases:[`users-2`]};Kb.node;var qb=$(Kb),Jb={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`}]]};Jb.node;var Yb=$(Jb),Xb={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`}]]};Xb.node;var Zb=$(Xb),Qb={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`}]]};Qb.node;var $b=$(Qb),ex={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`}]]};ex.node;var tx=$(ex),nx={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};nx.node;var rx=$(nx),ix={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`}]]};ix.node;var ax=$(ix),ox=/^(-?)(\d+)(?:\.(\d*))?$/,sx=/^-?\d{1,3}(,\d{3})+(\.\d*)?$/;function cx(e,t){let n=Nh(e).trim(),r=ox.exec(sx.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 lx(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 dx(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`${$h(cx(String(e),t.scale))}${t.currency?` ${t.currency}`:``}`;if(t.type===`number`||t.type===`decimal`||t.type===`bigint`)return $h(String(e));if(t.type===`date`)return tg(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):eg(t)}return String(e)}var ux={amp:`&`,lt:`<`,gt:`>`,quot:`"`,"#39":`'`,nbsp:` `};function dx(e,t=120){let n=e.replace(/<[^>]*>/g,` `).replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(e,t)=>ux[t]).replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t).trimEnd()}…`:n}function fx(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 px={created:`audit.event.created`,updated:`audit.event.updated`,deleted:`audit.event.deleted`,restored:`audit.event.restored`,purged:`audit.event.purged`},mx={"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`},hx={WRONG_CODE:`audit.event.loginFailedCode`,RATE_LIMITED:`audit.event.loginFailedLimited`};function gx(e){return e.event.startsWith(`*.`)||e.event.startsWith(`page.*.`)}function _x(e){return e.resource!==void 0&&e.event.startsWith(`${e.resource}.`)?e.event.slice(e.resource.length+1):void 0}var vx=/^page\.(.+)\.updated$/;function yx(e,t={}){if(gx(e))return J(`audit.event.unseen`);let n=_x(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=px[n];return r?J(r):e.event}let r=vx.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&&hx[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=mx[e.event];return i?J(i):e.event}function bx(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 xx(e,t={}){if(!gx(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 Sx(e){if(e.restricted&&!gx(e))return J(e.resource===void 0?`audit.restrictedChanges`:`audit.restrictedRecord`)}function Cx(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?Dx(i.before,t,n):void 0,after:`after`in i&&i.after!==void 0?Dx(i.after,t,n):void 0,truncated:a}}var wx=`—`,Tx=1e5;function Ex(e){return e==null||e===``?wx:typeof e==`boolean`?J(e?`common.yes`:`common.no`):typeof e==`string`?e:Array.isArray(e)?e.length===0?wx:e.every(e=>typeof e!=`object`||!e)?e.map(String).join(`, `):JSON.stringify(e):typeof e==`object`?JSON.stringify(e):String(e)}function Dx(e,t,n){if(e==null||e===``)return wx;if(!t)return Ex(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 Ex(e);let i=t.map(e=>String(r(e)));return i.length===0?wx: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)?lx(e,t):Ex(e):t.type===`json`||t.type===`object`?typeof e==`string`?e:JSON.stringify(e):typeof e==`object`?Ex(e):t.widget===`richtext`?dx(String(e),Tx)||wx:lx(e,t)}var Ox=[`actor`,`event`,`resource`,`record`,`from`,`to`],kx=/^(\d{4})-(\d{2})-(\d{2})$/;function Ax(e,t){let n=kx.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 jx(e){let t=new URLSearchParams;for(let n of Ox){let r=e.get(n);r!==null&&r!==``&&(n!==`record`||e.get(`resource`))&&t.set(n,n===`from`?Ax(r,!1):n===`to`?Ax(r,!0):r)}return t.sort(),t.toString()}function Mx(e){return jx(e)!==``}function Nx(e,t){let n=t.trim();return e===`resource`?{resource:n||null,record:null}:{[e]:n||null}}function Px(){return Object.fromEntries(Ox.map(e=>[e,null]))}function Fx({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-lg border`,children:e.map(e=>(0,b.jsx)(Lx,{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 Ix=/\.(deleted|purged)$/;function Lx({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?xx(e,n):void 0,p=s&&e.resource!==void 0&&e.recordId!==void 0&&!Ix.test(e.event)&&!e.meta?.deleted,m=Sx(e),h=bx(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===Rx(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":gx(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:yx(e,n)}),f!==void 0&&(p?(0,b.jsx)(bo,{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:[ng(u,t),` · `,eg(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)(zx,{row:Cx(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)(Vx,{text:Dx(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 Rx(e){let t=`${e.resource}.action.`;return e.event.startsWith(t)?e.event.slice(t.length):void 0}function zx({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)(Vx,{text:e.before})]}),e.before!==void 0&&e.after!==void 0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(z_,{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)(Vx,{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 Bx=160;function Vx({text:e}){let{t}=Y(),[n,r]=(0,y.useState)(!1);return e.length<=Bx?(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,Bx).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 Hx=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178],Ux=(e,t)=>Math.trunc(e/t),Wx=(e,t)=>e-Math.trunc(e/t)*t;function Gx(e){let t=e+621,n=-14,r=Hx[0];if(e<r||e>=Hx[Hx.length-1])throw RangeError(`Jalali year ${e} is out of range`);let i=0;for(let t=1;t<Hx.length;t++){let a=Hx[t];if(i=a-r,e<a)break;n+=Ux(i,33)*8+Ux(Wx(i,33),4),r=a}let a=e-r;n+=Ux(a,33)*8+Ux(Wx(a,33)+3,4),Wx(i,33)===4&&i-a===4&&(n+=1);let o=Ux(t,4)-Ux((Ux(t,100)+1)*3,4)-150,s=20+n-o;i-a<6&&(a=a-i+Ux(i+4,33)*33);let c=Wx(Wx(a+1,33)-1,4);return c===-1&&(c=4),{leap:c,gy:t,march:s}}function Kx(e,t,n){return Ux((e+Ux(t-8,6)+100100)*1461,4)+Ux(153*Wx(t+9,12)+2,5)+n-34840408-Ux(Ux(e+100100+Ux(t-8,6),100)*3,4)+752}function qx(e){let t=4*e+139361631;t=t+Ux(Ux(4*e+183187720,146097)*3,4)*4-3908;let n=Ux(Wx(t,1461),4)*5+308,r=Ux(Wx(n,153),5)+1,i=Wx(Ux(n,153),12)+1;return{gy:Ux(t,1461)-100100+Ux(8-i,6),gm:i,gd:r}}function Jx(e,t,n){let{gy:r,march:i}=Gx(e);return Kx(r,3,i)+(t-1)*31-Ux(t,7)*(t-7)+n-1}function Yx(e){let{gy:t}=qx(e),n=t-621,r=Gx(n),i=e-Kx(t,3,r.march);if(i>=0){if(i<=185)return{jy:n,jm:1+Ux(i,31),jd:Wx(i,31)+1};i-=186}else--n,i+=179,r.leap===1&&(i+=1);return{jy:n,jm:7+Ux(i,30),jd:Wx(i,30)+1}}var Xx=(e,t=2)=>String(e).padStart(t,`0`),Zx=/^(\d{4})-(\d{2})-(\d{2})$/;function Qx(e){return Gx(e).leap===0}function $x(e,t){return t<=6?31:t<=11||Qx(e)?30:29}function eS(e){let t=Zx.exec(e);if(!t)throw RangeError(`not an ISO date: ${e}`);return Yx(Kx(Number(t[1]),Number(t[2]),Number(t[3])))}function tS(e,t,n){let{gy:r,gm:i,gd:a}=qx(Jx(e,t,n));return`${Xx(r,4)}-${Xx(i)}-${Xx(a)}`}function nS(e,t,n){return Number.isInteger(e)&&e>=1&&e<3178&&t>=1&&t<=12&&n>=1&&n<=$x(e,t)}function rS(e){let{jy:t,jm:n,jd:r}=eS(e);return`${t}/${Xx(n)}/${Xx(r)}`}function iS(e){let t=/^(\d{4})[/\-.](\d{1,2})[/\-.](\d{1,2})$/.exec(Mh(e.trim()));if(!t)return;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];return nS(n,r,i)?tS(n,r,i):void 0}function aS(e,t){let{jy:n,jm:r,jd:i}=eS(e),a=n*12+(r-1)+t,o=Math.floor(a/12),s=a%12+1;return tS(o,s,Math.min(i,$x(o,s)))}function oS(e,t){return new Date(Date.parse(`${e}T00:00:00Z`)+t*864e5).toISOString().slice(0,10)}function sS(){let e=new Date;return`${Xx(e.getFullYear(),4)}-${Xx(e.getMonth()+1)}-${Xx(e.getDate())}`}var cS=/^\d{4}-\d{2}-\d{2}$/;function lS(e){let{calendar:t}=Y();if(t===`persian`)return(0,b.jsx)(dS,{...e});let{id:n,value:r,onChange:i,live:a,className:o,label:s,...c}=e;return(0,b.jsx)(uS,{id:n,value:r,onChange:i,live:a,className:o,...c})}function uS({id:e,value:t,onChange:n,live:r,className:i,...a}){let[o,s]=(0,y.useState)(t);return(0,y.useEffect)(()=>s(t),[t]),(0,b.jsx)(Oh,{id:e,type:`date`,className:i,value:r?t:o,onChange:e=>r?n(e.target.value):s(e.target.value),...a,onBlur:()=>{!r&&o!==t&&n(o),a.onBlur?.()},onKeyDown:e=>{!r&&e.key===`Enter`&&(e.preventDefault(),o!==t&&n(o)),a.onKeyDown?.(e)}})}function dS({id:e,value:t,onChange:n,label:r,live:i,className:a,...o}){let{t:s,digits:c}=Y(),l=e=>cS.test(e)?$h(rS(e)):e,[u,d]=(0,y.useState)(()=>l(t)),[f,p]=(0,y.useState)(!1),m=(0,y.useRef)(t);(0,y.useEffect)(()=>{t!==m.current&&(m.current=t,d(l(t)))},[t,c]);function h(e){m.current=e,n(e)}function g(){let e=u.trim();if(e===``)return t!==``&&h(``);let n=iS(e);n?(d(l(n)),n!==t&&h(n)):i&&h(Mh(e))}function _(e){d(l(e)),p(!1),h(e)}return(0,b.jsxs)(`div`,{className:W(`flex items-center gap-1`,a),children:[(0,b.jsx)(Oh,{id:e,dir:`ltr`,inputMode:`numeric`,placeholder:s(`date.placeholder`),value:u,...o,onChange:e=>{if(d(e.target.value),!i)return;let t=e.target.value.trim();h((t===``?``:iS(t))??Mh(t))},onBlur:()=>{g(),o.onBlur?.()},onKeyDown:e=>{e.key===`Enter`&&(g(),i||e.preventDefault()),o.onKeyDown?.(e)}}),(0,b.jsxs)(Sh,{open:f,onOpenChange:p,children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":s(`date.openCalendar`,{name:r}),children:(0,b.jsx)(rv,{})})}),(0,b.jsx)(wh,{children:(0,b.jsx)(Th,{align:`end`,sideOffset:4,className:`z-50 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md`,"aria-label":s(`date.calendar`,{name:r}),children:(0,b.jsx)(fS,{value:cS.test(t)?t:void 0,onPick:_,onClear:()=>_(``)})})})]})]})}function fS({value:e,onPick:t,onClear:n}){let{t:r,locale:i}=Y(),a=sS(),[o,s]=(0,y.useState)(e??a),[c,l]=(0,y.useState)(`days`),u=(0,y.useRef)(null),d=(0,y.useRef)(!1),{jy:f,jm:p}=eS(o),m=Xh(i);(0,y.useEffect)(()=>{d.current&&(d.current=!1,u.current?.querySelector(`[data-iso="${o}"]`)?.focus())},[o]);let h=e=>new Intl.DateTimeFormat(`${i}-u-ca-persian`,{month:`long`,timeZone:`UTC`}).format(Date.parse(`${tS(1403,e,1)}T00:00:00Z`)),g=e=>$h(String(e)),_=Array.from({length:7},(e,t)=>new Intl.DateTimeFormat(i,{weekday:`narrow`,timeZone:`UTC`}).format(Date.parse(`${oS(tS(1403,1,4),t)}T00:00:00Z`))),v=tS(f,p,1),x=(new Date(`${v}T00:00:00Z`).getUTCDay()+1)%7,S=$x(f,p),C=[...Array.from({length:x},()=>null),...Array.from({length:S},(e,t)=>oS(v,t))];function w(e){let t={ArrowRight:m?-1:1,ArrowLeft:m?1:-1,ArrowDown:7,ArrowUp:-7},n;e.key in t?n=oS(o,t[e.key]):e.key===`PageDown`?n=aS(o,e.shiftKey?12:1):e.key===`PageUp`&&(n=aS(o,e.shiftKey?-12:-1)),n&&(e.preventDefault(),d.current=!0,s(n))}let T=(e,t,n,i)=>(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":r(`date.previous`),onClick:()=>n(-1),children:(0,b.jsx)(hv,{className:`rtl:rotate-180`})}),t?(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":i,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":r(`date.next`),onClick:()=>n(1),children:(0,b.jsx)(_v,{className:`rtl:rotate-180`})})]}),E;if(c===`years`){let e=f-f%12;E=(0,b.jsxs)(b.Fragment,{children:[T(`${g(e)}–${g(e+11)}`,void 0,e=>s(aS(o,e*144)),``),(0,b.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:Array.from({length:12},(t,n)=>e+n).map(e=>(0,b.jsx)(q,{type:`button`,variant:e===f?`secondary`:`ghost`,size:`sm`,onClick:()=>{s(tS(e,p,Math.min(eS(o).jd,$x(e,p)))),l(`months`)},children:g(e)},e))})]})}else E=c===`months`?(0,b.jsxs)(b.Fragment,{children:[T(g(f),()=>l(`years`),e=>s(aS(o,e*12)),r(`date.chooseYear`)),(0,b.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:Array.from({length:12},(e,t)=>t+1).map(e=>(0,b.jsx)(q,{type:`button`,variant:e===p?`secondary`:`ghost`,size:`sm`,onClick:()=>{s(tS(f,e,Math.min(eS(o).jd,$x(f,e)))),l(`days`)},children:h(e)},e))})]}):(0,b.jsxs)(b.Fragment,{children:[T(`${h(p)} ${g(f)}`,()=>l(`months`),e=>s(aS(o,e)),r(`date.chooseMonth`)),(0,b.jsxs)(`div`,{ref:u,role:`grid`,"aria-label":`${h(p)} ${g(f)}`,onKeyDown:w,className:`grid grid-cols-7 gap-0.5 text-center`,children:[(0,b.jsx)(`div`,{role:`row`,className:`contents`,children:_.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)},(n,r)=>(0,b.jsx)(`div`,{role:`row`,className:`contents`,children:C.slice(r*7,r*7+7).map((n,i)=>n?(0,b.jsx)(`div`,{role:`gridcell`,"aria-selected":n===e,children:(0,b.jsx)(`button`,{type:`button`,"data-iso":n,tabIndex:n===o?0:-1,"aria-label":tg(n),"aria-current":n===a?`date`:void 0,onClick:()=>t(n),className:W(`size-8 rounded-md text-sm hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,n===a&&`font-semibold text-primary`,n===e&&`bg-primary text-primary-foreground hover:bg-primary/90`),children:g(eS(n).jd)})},n):(0,b.jsx)(`div`,{role:`gridcell`},`empty-${r}-${i}`))},r))]})]});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:()=>t(a),children:r(`date.today`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:n,children:r(`date.clear`)})]})]})}function pS({id:e,value:t,onChange:n,label:r,...i}){let{t:a,calendar:o}=Y();if(o!==`persian`)return(0,b.jsx)(Oh,{id:e,type:`datetime-local`,value:t,onChange:e=>n(e.target.value),...i});let[s=``,c=``]=t.split(`T`),l=(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)(lS,{id:e,live:!0,value:s,label:r,onChange:e=>l(e,c),className:`min-w-44 flex-1`,...i}),(0,b.jsx)(Oh,{type:`time`,dir:`ltr`,"aria-label":a(`date.time`,{name:r}),className:`w-28`,value:c,onChange:e=>l(s,e.target.value)})]})}function mS(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 hS=(e,t)=>String(e.id)===String(t.id);function gS({id:e,resource:t,field:n,value:r,onChange:i,clearable:a,values:o,invalid:s,describedBy:c}){let l=X(),u=n.relation?.kind===`to-many`,d=u&&Array.isArray(r)?r:[],f=!u&&r&&!Array.isArray(r)?r:null,[p,m]=(0,y.useState)(``),[h,g]=(0,y.useState)(!1),[_,v]=(0,y.useState)(0),x=mS(p.trim(),250),S=Wg(t,n.name,x,h,o),C=(S.data?.items??[]).filter(e=>!d.some(t=>hS(t,e))),w=`${e}-options`,T=t=>`${e}-option-${t}`;(0,y.useEffect)(()=>{v(0)},[x,S.data]);function E(e){m(``),g(!1),i(u?[...d,e]:e)}function D(e){e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),h?v(t=>Math.max(0,Math.min(C.length-1,t+(e.key===`ArrowDown`?1:-1)))):g(!0)):e.key===`Enter`&&h?(e.preventDefault(),C[_]&&E(C[_])):e.key===`Escape`&&h?(e.preventDefault(),g(!1),m(``)):e.key===`Backspace`&&u&&p===``&&d.length>0&&i(d.slice(0,-1))}return(0,b.jsxs)(`div`,{className:`relative flex flex-col gap-1.5`,children:[u&&d.length>0&&(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,"aria-label":l(`picker.selected`,{name:n.label}),children:d.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":l(`picker.remove`,{name:e.title}),onClick:()=>i(d.filter(t=>!hS(t,e))),children:(0,b.jsx)(rx,{className:`size-3.5`})})]},String(e.id)))}),(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(Oh,{id:e,role:`combobox`,autoComplete:`off`,"aria-autocomplete":`list`,"aria-expanded":h,"aria-controls":w,"aria-activedescendant":h&&C[_]?T(_):void 0,"aria-invalid":s||void 0,"aria-describedby":c,className:W(f&&a&&`pe-8`),placeholder:f?f.title:l(u?`picker.typeToAdd`:`picker.typeToSearch`),value:h||p?p:f?.title??``,onChange:e=>{m(e.target.value),g(!0)},onFocus:()=>g(!0),onBlur:()=>{g(!1),m(``)},onKeyDown:D}),f&&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":l(`picker.clear`,{name:n.label}),onClick:()=>i(null),children:(0,b.jsx)(rx,{className:`size-4`})})]}),h&&(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:w,role:`listbox`,"aria-label":n.label,children:C.map((e,t)=>(0,b.jsx)(`li`,{id:T(t),role:`option`,"aria-selected":t===_,className:W(`cursor-pointer rounded-md px-2 py-1.5 text-sm`,t===_&&`bg-accent text-accent-foreground`),onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>v(t),onClick:()=>E(e),children:e.title},String(e.id)))}),C.length===0&&(0,b.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,children:S.isError?ug(S.error):l(S.isFetching||S.isPending?`picker.searching`:`picker.noMatches`)})]})]})}var _S=/^filter\[([^\][]+)\]\[([^\][]+)\]$/;function vS(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 tg(t);if(e.type===`number`||e.type===`decimal`||e.type===`bigint`)return $h(t);if(e.type===`datetime`){let e=new Date(t);return Number.isNaN(e.getTime())?t:eg(e)}return t}function yS(e,t){let n=[],r=t.get(`search`);r&&n.push({key:`search`,label:J(`filters.search`),value:`“${r}”`,remove:[`search`]});let i=new Map;for(let[e,n]of t){let t=_S.exec(e);if(!t||n===``)continue;let[,r,a]=t;i.set(r,[...i.get(r)??[],{operator:a,raw:n,key:e}])}for(let[t,r]of i){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(`${vS(i,s.raw)} – ${vS(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=>vS(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}var bS=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{},xS=e=>Array.isArray(e)?e:[];function SS(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`id`in e&&`title`in e}function CS(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`name`in e&&`size`in e&&(`key`in e||`token`in e)}function wS(e){return(Array.isArray(e)?e:[e]).filter(CS)}function TS(e,t){let n=e?._files?.[t];return n==null?[]:Array.isArray(n)?n:[n]}var ES=e=>e.token===void 0?`key:${e.key}`:`token:${e.token}`,DS=e=>e.token===void 0?{key:e.key}:{token:e.token},OS=(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)))},kS=/<img\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;function AS(e){return e.replace(kS,``)}var jS=e=>String(e).padStart(2,`0`);function MS(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.getFullYear()}-${jS(t.getMonth()+1)}-${jS(t.getDate())}T${jS(t.getHours())}:${jS(t.getMinutes())}`}function NS(e,t){let n={};for(let r of e){let e=t?.[r.name];if(r.file){let e=TS(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=>NS(t,e)):NS(t,e??void 0)}else r.relation?.kind===`to-many`?n[r.name]=Array.isArray(e)?e.filter(SS):[]:r.type===`relation`?n[r.name]=SS(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]=MS(String(e)):r.widget===`money`?n[r.name]=cx(String(e),r.scale):n[r.name]=String(e)}return n}function PS(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 FS(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=xS(e).map((e,n)=>FS(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?xS(n[o.name]).map(e=>FS(t,e).payload):void 0;(l?JSON.stringify(l)!==JSON.stringify(c):c.length>0)&&(i[o.name]=c);continue}let r=FS(t,bS(e),n?bS(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=wS(e),r=n?wS(n[o.name]):void 0;if(r&&t.map(ES).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)(u_,{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)(kh,{htmlFor:`two-factor-code`,children:e(`twoFactor.code`)}),(0,b.jsx)(Oh,{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)(kh,{htmlFor:`two-factor-password`,children:e(`twoFactor.password`)}),(0,b.jsx)(Oh,{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 m_(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 h_({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-lg border 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:ug(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:[m_(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:eg(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:m_(e.userAgent,t(`auth.unknownDevice`))}),children:t(`auth.revoke`)})]},e.id))})]})}function g_(e,t){return e==null?``:typeof e==`string`?e:e[t]??e[cg.locale]??Object.values(e)[0]??``}function __(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 cg.locales.length===1?t[n[0]]:t}function v_(e){let t=Object.fromEntries(cg.locales.map(e=>[e,``]));return typeof e==`string`?t[cg.locale]=e:e&&Object.assign(t,e),t}function y_({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-xl font-semibold`,children:e}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t})]})}function b_({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 x_=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function S_(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:x_(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var C_=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},w_=e=>{let t=C_(e);return t.charAt(0).toUpperCase()+t.slice(1)},T_=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),E_={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 D_(e){return e!=null}function O_(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??E_.width,a=e.size??e.height??E_.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?T_(...c):T_(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??E_[`stroke-width`])*Number(e.size??e.width??E_.width)/Number(t.size??t.width??E_.width):t.strokeWidth??E_[`stroke-width`];return[`svg`,{...Object.entries(E_).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&D_(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&D_(t.width)&&{[r(`width`)]:t.width},...`height`in t&&D_(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 k_(e,t={}){return O_(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var A_=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},j_=(0,y.createContext)({}),M_=()=>(0,y.useContext)(j_),N_=(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=``}=M_()??{},b=!!c||A_(d),[x,S,C=[]]=k_(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:T_(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`?S_(e,t,n):e,i=(0,y.forwardRef)(({className:e,...t},n)=>(0,y.createElement)(N_,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=w_(r.name)),i}var P_={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`}]]};P_.node;var F_=$(P_),I_={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};I_.node;var L_=$(I_),R_={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};R_.node;var z_=$(R_),B_={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};B_.node;var V_=$(B_),H_={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`}]]};H_.node;var U_=$(H_),W_={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`}]]};W_.node;var G_=$(W_),K_={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`}]]};K_.node;var q_=$(K_),J_={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`}]]};J_.node;var Y_=$(J_),X_={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`}]]};X_.node;var Z_=$(X_),Q_={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`}]]};Q_.node;var $_=$(Q_),ev={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`]};ev.node;var tv=$(ev),nv={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`}]]};nv.node;var rv=$(nv),iv={name:`calendar-cog`,size:24,node:[[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m15.228 19.148-.923.383`,key:`51cr3n`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`m16.47 14.305.382.923`,key:`obybxd`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`m20.773 16.852.924-.383`,key:`ybmb4k`}],[`path`,{d:`m20.773 19.148.924.383`,key:`1c2d3p`}],[`path`,{d:`M21 10.5V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h5.5`,key:`1e6z1y`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]};iv.node;var av=$(iv),ov={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`}]]};ov.node;var sv=$(ov),cv={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`]};cv.node;var lv=$(cv),uv={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};uv.node;var dv=$(uv),fv={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};fv.node;var pv=$(fv),mv={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};mv.node;var hv=$(mv),gv={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};gv.node;var _v=$(gv),vv={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};vv.node;var yv=$(vv),bv={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`]};bv.node;var xv=$(bv),Sv={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`}]]};Sv.node;var Cv=$(Sv),wv={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`}]]};wv.node;var Tv=$(wv),Ev={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`}]]};Ev.node;var Dv=$(Ev),Ov={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`}]]};Ov.node;var kv=$(Ov),Av={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`}]]};Av.node;var jv=$(Av),Mv={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`}]]};Mv.node;var Nv=$(Mv),Pv={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`}]]};Pv.node;var Fv=$(Pv),Iv={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`}]]};Iv.node;var Lv=$(Iv),Rv={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`}]]};Rv.node;var zv=$(Rv),Bv={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`}]]};Bv.node;var Vv=$(Bv),Hv={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`}]]};Hv.node;var Uv=$(Hv),Wv={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`}]]};Wv.node;var Gv=$(Wv),Kv={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`}]]};Kv.node;var qv=$(Kv),Jv={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`]};Jv.node;var Yv=$(Jv),Xv={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`}]]};Xv.node;var Zv=$(Xv),Qv={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`}]]};Qv.node;var $v=$(Qv),ey={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`}]]};ey.node;var ty=$(ey),ny={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};ny.node;var ry=$(ny),iy={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`}]]};iy.node;var ay=$(iy),oy={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`}]]};oy.node;var sy=$(oy),cy={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`]};cy.node;var ly=$(cy),uy={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`}]]};uy.node;var dy=$(uy),fy={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`}]]};fy.node;var py=$(fy),my={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`}]]};my.node;var hy=$(my),gy={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`}]]};gy.node;var _y=$(gy),vy={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`}]]};vy.node;var yy=$(vy),by={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`}]]};by.node;var xy=$(by),Sy={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`}]]};Sy.node;var Cy=$(Sy),wy={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`}]]};wy.node;var Ty=$(wy),Ey={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Ey.node;var Dy=$(Ey),Oy={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`}]]};Oy.node;var ky=$(Oy),Ay={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`}]]};Ay.node;var jy=$(Ay),My={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`}]]};My.node;var Ny=$(My),Py={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`}]]};Py.node;var Fy=$(Py),Iy={name:`panel-left-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]],aliases:[`sidebar-close`]};Iy.node;var Ly=$(Iy),Ry={name:`panel-left-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]],aliases:[`sidebar-open`]};Ry.node;var zy=$(Ry),By={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`}]]};By.node;var Vy=$(By),Hy={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`}]]};Hy.node;var Uy=$(Hy),Wy={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`}]]};Wy.node;var Gy=$(Wy),Ky={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`}]]};Ky.node;var qy=$(Ky),Jy={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Jy.node;var Yy=$(Jy),Xy={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`}]]};Xy.node;var Zy=$(Xy),Qy={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`}]]};Qy.node;var $y=$(Qy),eb={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`}]]};eb.node;var tb=$(eb),nb={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`]};nb.node;var rb=$(nb),ib={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`}]]};ib.node;var ab=$(ib),ob={name:`search-check`,size:24,node:[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};ob.node;var sb=$(ob),cb={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};cb.node;var lb=$(cb),ub={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`}]]};ub.node;var db=$(ub),fb={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`}]]};fb.node;var pb=$(fb),mb={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`}]]};mb.node;var hb=$(mb),gb={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`}]]};gb.node;var _b=$(gb),vb={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`}]]};vb.node;var yb=$(vb),bb={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`}]]};bb.node;var xb=$(bb),Sb={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`}]]};Sb.node;var Cb=$(Sb),wb={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`}]]};wb.node;var Tb=$(wb),Eb={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`}]]};Eb.node;var Db=$(Eb),Ob={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`}]]};Ob.node;var kb=$(Ob),Ab={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`}]]};Ab.node;var jb=$(Ab),Mb={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`}]]};Mb.node;var Nb=$(Mb),Pb={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`}]]};Pb.node;var Fb=$(Pb),Ib={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`]};Ib.node;var Lb=$(Ib),Rb={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`}]]};Rb.node;var zb=$(Rb),Bb={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`}]]};Bb.node;var Vb=$(Bb),Hb={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`]};Hb.node;var Ub=$(Hb),Wb={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`}]]};Wb.node;var Gb=$(Wb),Kb={name:`users-round`,size:24,node:[[`path`,{d:`M18 21a8 8 0 0 0-16 0`,key:`3ypg7q`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3`,key:`10s06x`}]],aliases:[`users-2`]};Kb.node;var qb=$(Kb),Jb={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`}]]};Jb.node;var Yb=$(Jb),Xb={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`}]]};Xb.node;var Zb=$(Xb),Qb={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`}]]};Qb.node;var $b=$(Qb),ex={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`}]]};ex.node;var tx=$(ex),nx={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};nx.node;var rx=$(nx),ix={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`}]]};ix.node;var ax=$(ix),ox=/^(-?)(\d+)(?:\.(\d*))?$/,sx=/^-?\d{1,3}(,\d{3})+(\.\d*)?$/;function cx(e,t){let n=Nh(e).trim(),r=ox.exec(sx.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 lx(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 dx(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`${$h(cx(String(e),t.scale))}${t.currency?` ${t.currency}`:``}`;if(t.type===`number`||t.type===`decimal`||t.type===`bigint`)return $h(String(e));if(t.type===`date`)return tg(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):eg(t)}return String(e)}var ux={amp:`&`,lt:`<`,gt:`>`,quot:`"`,"#39":`'`,nbsp:` `};function dx(e,t=120){let n=e.replace(/<[^>]*>/g,` `).replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(e,t)=>ux[t]).replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t).trimEnd()}…`:n}function fx(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 px={created:`audit.event.created`,updated:`audit.event.updated`,deleted:`audit.event.deleted`,restored:`audit.event.restored`,purged:`audit.event.purged`},mx={"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`},hx={WRONG_CODE:`audit.event.loginFailedCode`,RATE_LIMITED:`audit.event.loginFailedLimited`};function gx(e){return e.event.startsWith(`*.`)||e.event.startsWith(`page.*.`)}function _x(e){return e.resource!==void 0&&e.event.startsWith(`${e.resource}.`)?e.event.slice(e.resource.length+1):void 0}var vx=/^page\.(.+)\.updated$/;function yx(e,t={}){if(gx(e))return J(`audit.event.unseen`);let n=_x(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=px[n];return r?J(r):e.event}let r=vx.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&&hx[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=mx[e.event];return i?J(i):e.event}function bx(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 xx(e,t={}){if(!gx(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 Sx(e){if(e.restricted&&!gx(e))return J(e.resource===void 0?`audit.restrictedChanges`:`audit.restrictedRecord`)}function Cx(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?Dx(i.before,t,n):void 0,after:`after`in i&&i.after!==void 0?Dx(i.after,t,n):void 0,truncated:a}}var wx=`—`,Tx=1e5;function Ex(e){return e==null||e===``?wx:typeof e==`boolean`?J(e?`common.yes`:`common.no`):typeof e==`string`?e:Array.isArray(e)?e.length===0?wx:e.every(e=>typeof e!=`object`||!e)?e.map(String).join(`, `):JSON.stringify(e):typeof e==`object`?JSON.stringify(e):String(e)}function Dx(e,t,n){if(e==null||e===``)return wx;if(!t)return Ex(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 Ex(e);let i=t.map(e=>String(r(e)));return i.length===0?wx: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)?lx(e,t):Ex(e):t.type===`json`||t.type===`object`?typeof e==`string`?e:JSON.stringify(e):typeof e==`object`?Ex(e):t.widget===`richtext`?dx(String(e),Tx)||wx:lx(e,t)}var Ox=[`actor`,`event`,`resource`,`record`,`from`,`to`],kx=/^(\d{4})-(\d{2})-(\d{2})$/;function Ax(e,t){let n=kx.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 jx(e){let t=new URLSearchParams;for(let n of Ox){let r=e.get(n);r!==null&&r!==``&&(n!==`record`||e.get(`resource`))&&t.set(n,n===`from`?Ax(r,!1):n===`to`?Ax(r,!0):r)}return t.sort(),t.toString()}function Mx(e){return jx(e)!==``}function Nx(e,t){let n=t.trim();return e===`resource`?{resource:n||null,record:null}:{[e]:n||null}}function Px(){return Object.fromEntries(Ox.map(e=>[e,null]))}function Fx({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-lg border`,children:e.map(e=>(0,b.jsx)(Lx,{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 Ix=/\.(deleted|purged)$/;function Lx({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?xx(e,n):void 0,p=s&&e.resource!==void 0&&e.recordId!==void 0&&!Ix.test(e.event)&&!e.meta?.deleted,m=Sx(e),h=bx(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===Rx(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":gx(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:yx(e,n)}),f!==void 0&&(p?(0,b.jsx)(bo,{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:[ng(u,t),` · `,eg(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)(zx,{row:Cx(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)(Vx,{text:Dx(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 Rx(e){let t=`${e.resource}.action.`;return e.event.startsWith(t)?e.event.slice(t.length):void 0}function zx({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)(Vx,{text:e.before})]}),e.before!==void 0&&e.after!==void 0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(z_,{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)(Vx,{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 Bx=160;function Vx({text:e}){let{t}=Y(),[n,r]=(0,y.useState)(!1);return e.length<=Bx?(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,Bx).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 Hx=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178],Ux=(e,t)=>Math.trunc(e/t),Wx=(e,t)=>e-Math.trunc(e/t)*t;function Gx(e){let t=e+621,n=-14,r=Hx[0];if(e<r||e>=Hx[Hx.length-1])throw RangeError(`Jalali year ${e} is out of range`);let i=0;for(let t=1;t<Hx.length;t++){let a=Hx[t];if(i=a-r,e<a)break;n+=Ux(i,33)*8+Ux(Wx(i,33),4),r=a}let a=e-r;n+=Ux(a,33)*8+Ux(Wx(a,33)+3,4),Wx(i,33)===4&&i-a===4&&(n+=1);let o=Ux(t,4)-Ux((Ux(t,100)+1)*3,4)-150,s=20+n-o;i-a<6&&(a=a-i+Ux(i+4,33)*33);let c=Wx(Wx(a+1,33)-1,4);return c===-1&&(c=4),{leap:c,gy:t,march:s}}function Kx(e,t,n){return Ux((e+Ux(t-8,6)+100100)*1461,4)+Ux(153*Wx(t+9,12)+2,5)+n-34840408-Ux(Ux(e+100100+Ux(t-8,6),100)*3,4)+752}function qx(e){let t=4*e+139361631;t=t+Ux(Ux(4*e+183187720,146097)*3,4)*4-3908;let n=Ux(Wx(t,1461),4)*5+308,r=Ux(Wx(n,153),5)+1,i=Wx(Ux(n,153),12)+1;return{gy:Ux(t,1461)-100100+Ux(8-i,6),gm:i,gd:r}}function Jx(e,t,n){let{gy:r,march:i}=Gx(e);return Kx(r,3,i)+(t-1)*31-Ux(t,7)*(t-7)+n-1}function Yx(e){let{gy:t}=qx(e),n=t-621,r=Gx(n),i=e-Kx(t,3,r.march);if(i>=0){if(i<=185)return{jy:n,jm:1+Ux(i,31),jd:Wx(i,31)+1};i-=186}else--n,i+=179,r.leap===1&&(i+=1);return{jy:n,jm:7+Ux(i,30),jd:Wx(i,30)+1}}var Xx=(e,t=2)=>String(e).padStart(t,`0`),Zx=/^(\d{4})-(\d{2})-(\d{2})$/;function Qx(e){return Gx(e).leap===0}function $x(e,t){return t<=6?31:t<=11||Qx(e)?30:29}function eS(e){let t=Zx.exec(e);if(!t)throw RangeError(`not an ISO date: ${e}`);return Yx(Kx(Number(t[1]),Number(t[2]),Number(t[3])))}function tS(e,t,n){let{gy:r,gm:i,gd:a}=qx(Jx(e,t,n));return`${Xx(r,4)}-${Xx(i)}-${Xx(a)}`}function nS(e,t,n){return Number.isInteger(e)&&e>=1&&e<3178&&t>=1&&t<=12&&n>=1&&n<=$x(e,t)}function rS(e){let{jy:t,jm:n,jd:r}=eS(e);return`${t}/${Xx(n)}/${Xx(r)}`}function iS(e){let t=/^(\d{4})[/\-.](\d{1,2})[/\-.](\d{1,2})$/.exec(Mh(e.trim()));if(!t)return;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])];return nS(n,r,i)?tS(n,r,i):void 0}function aS(e,t){let{jy:n,jm:r,jd:i}=eS(e),a=n*12+(r-1)+t,o=Math.floor(a/12),s=a%12+1;return tS(o,s,Math.min(i,$x(o,s)))}function oS(e,t){return new Date(Date.parse(`${e}T00:00:00Z`)+t*864e5).toISOString().slice(0,10)}function sS(){let e=new Date;return`${Xx(e.getFullYear(),4)}-${Xx(e.getMonth()+1)}-${Xx(e.getDate())}`}var cS=/^\d{4}-\d{2}-\d{2}$/;function lS(e){let{calendar:t}=Y();if(t===`persian`)return(0,b.jsx)(dS,{...e});let{id:n,value:r,onChange:i,live:a,className:o,label:s,...c}=e;return(0,b.jsx)(uS,{id:n,value:r,onChange:i,live:a,className:o,...c})}function uS({id:e,value:t,onChange:n,live:r,className:i,...a}){let[o,s]=(0,y.useState)(t);return(0,y.useEffect)(()=>s(t),[t]),(0,b.jsx)(Oh,{id:e,type:`date`,className:i,value:r?t:o,onChange:e=>r?n(e.target.value):s(e.target.value),...a,onBlur:()=>{!r&&o!==t&&n(o),a.onBlur?.()},onKeyDown:e=>{!r&&e.key===`Enter`&&(e.preventDefault(),o!==t&&n(o)),a.onKeyDown?.(e)}})}function dS({id:e,value:t,onChange:n,label:r,live:i,className:a,...o}){let{t:s,digits:c}=Y(),l=e=>cS.test(e)?$h(rS(e)):e,[u,d]=(0,y.useState)(()=>l(t)),[f,p]=(0,y.useState)(!1),m=(0,y.useRef)(t);(0,y.useEffect)(()=>{t!==m.current&&(m.current=t,d(l(t)))},[t,c]);function h(e){m.current=e,n(e)}function g(){let e=u.trim();if(e===``)return t!==``&&h(``);let n=iS(e);n?(d(l(n)),n!==t&&h(n)):i&&h(Mh(e))}function _(e){d(l(e)),p(!1),h(e)}return(0,b.jsxs)(`div`,{className:W(`flex items-center gap-1`,a),children:[(0,b.jsx)(Oh,{id:e,dir:`ltr`,inputMode:`numeric`,placeholder:s(`date.placeholder`),value:u,...o,onChange:e=>{if(d(e.target.value),!i)return;let t=e.target.value.trim();h((t===``?``:iS(t))??Mh(t))},onBlur:()=>{g(),o.onBlur?.()},onKeyDown:e=>{e.key===`Enter`&&(g(),i||e.preventDefault()),o.onKeyDown?.(e)}}),(0,b.jsxs)(Sh,{open:f,onOpenChange:p,children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsx)(q,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":s(`date.openCalendar`,{name:r}),children:(0,b.jsx)(rv,{})})}),(0,b.jsx)(wh,{children:(0,b.jsx)(Th,{align:`end`,sideOffset:4,className:`z-50 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md`,"aria-label":s(`date.calendar`,{name:r}),children:(0,b.jsx)(fS,{value:cS.test(t)?t:void 0,onPick:_,onClear:()=>_(``)})})})]})]})}function fS({value:e,onPick:t,onClear:n}){let{t:r,locale:i}=Y(),a=sS(),[o,s]=(0,y.useState)(e??a),[c,l]=(0,y.useState)(`days`),u=(0,y.useRef)(null),d=(0,y.useRef)(!1),{jy:f,jm:p}=eS(o),m=Xh(i);(0,y.useEffect)(()=>{d.current&&(d.current=!1,u.current?.querySelector(`[data-iso="${o}"]`)?.focus())},[o]);let h=e=>new Intl.DateTimeFormat(`${i}-u-ca-persian`,{month:`long`,timeZone:`UTC`}).format(Date.parse(`${tS(1403,e,1)}T00:00:00Z`)),g=e=>$h(String(e)),_=Array.from({length:7},(e,t)=>new Intl.DateTimeFormat(i,{weekday:`narrow`,timeZone:`UTC`}).format(Date.parse(`${oS(tS(1403,1,4),t)}T00:00:00Z`))),v=tS(f,p,1),x=(new Date(`${v}T00:00:00Z`).getUTCDay()+1)%7,S=$x(f,p),C=[...Array.from({length:x},()=>null),...Array.from({length:S},(e,t)=>oS(v,t))];function w(e){let t={ArrowRight:m?-1:1,ArrowLeft:m?1:-1,ArrowDown:7,ArrowUp:-7},n;e.key in t?n=oS(o,t[e.key]):e.key===`PageDown`?n=aS(o,e.shiftKey?12:1):e.key===`PageUp`&&(n=aS(o,e.shiftKey?-12:-1)),n&&(e.preventDefault(),d.current=!0,s(n))}let T=(e,t,n,i)=>(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":r(`date.previous`),onClick:()=>n(-1),children:(0,b.jsx)(hv,{className:`rtl:rotate-180`})}),t?(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":i,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":r(`date.next`),onClick:()=>n(1),children:(0,b.jsx)(_v,{className:`rtl:rotate-180`})})]}),E;if(c===`years`){let e=f-f%12;E=(0,b.jsxs)(b.Fragment,{children:[T(`${g(e)}–${g(e+11)}`,void 0,e=>s(aS(o,e*144)),``),(0,b.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:Array.from({length:12},(t,n)=>e+n).map(e=>(0,b.jsx)(q,{type:`button`,variant:e===f?`secondary`:`ghost`,size:`sm`,onClick:()=>{s(tS(e,p,Math.min(eS(o).jd,$x(e,p)))),l(`months`)},children:g(e)},e))})]})}else E=c===`months`?(0,b.jsxs)(b.Fragment,{children:[T(g(f),()=>l(`years`),e=>s(aS(o,e*12)),r(`date.chooseYear`)),(0,b.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:Array.from({length:12},(e,t)=>t+1).map(e=>(0,b.jsx)(q,{type:`button`,variant:e===p?`secondary`:`ghost`,size:`sm`,onClick:()=>{s(tS(f,e,Math.min(eS(o).jd,$x(f,e)))),l(`days`)},children:h(e)},e))})]}):(0,b.jsxs)(b.Fragment,{children:[T(`${h(p)} ${g(f)}`,()=>l(`months`),e=>s(aS(o,e)),r(`date.chooseMonth`)),(0,b.jsxs)(`div`,{ref:u,role:`grid`,"aria-label":`${h(p)} ${g(f)}`,onKeyDown:w,className:`grid grid-cols-7 gap-0.5 text-center`,children:[(0,b.jsx)(`div`,{role:`row`,className:`contents`,children:_.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)},(n,r)=>(0,b.jsx)(`div`,{role:`row`,className:`contents`,children:C.slice(r*7,r*7+7).map((n,i)=>n?(0,b.jsx)(`div`,{role:`gridcell`,"aria-selected":n===e,children:(0,b.jsx)(`button`,{type:`button`,"data-iso":n,tabIndex:n===o?0:-1,"aria-label":tg(n),"aria-current":n===a?`date`:void 0,onClick:()=>t(n),className:W(`size-8 rounded-md text-sm hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none`,n===a&&`font-semibold text-primary`,n===e&&`bg-primary text-primary-foreground hover:bg-primary/90`),children:g(eS(n).jd)})},n):(0,b.jsx)(`div`,{role:`gridcell`},`empty-${r}-${i}`))},r))]})]});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:()=>t(a),children:r(`date.today`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:n,children:r(`date.clear`)})]})]})}function pS({id:e,value:t,onChange:n,label:r,...i}){let{t:a,calendar:o}=Y();if(o!==`persian`)return(0,b.jsx)(Oh,{id:e,type:`datetime-local`,value:t,onChange:e=>n(e.target.value),...i});let[s=``,c=``]=t.split(`T`),l=(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)(lS,{id:e,live:!0,value:s,label:r,onChange:e=>l(e,c),className:`min-w-44 flex-1`,...i}),(0,b.jsx)(Oh,{type:`time`,dir:`ltr`,"aria-label":a(`date.time`,{name:r}),className:`w-28`,value:c,onChange:e=>l(s,e.target.value)})]})}function mS(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 hS=(e,t)=>String(e.id)===String(t.id);function gS({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=mS(m.trim(),250),C=Wg(t,n.name,S,g,o,s),w=(C.data?.items??[]).filter(e=>!f.some(t=>hS(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=>!hS(t,e))),children:(0,b.jsx)(rx,{className:`size-3.5`})})]},String(e.id)))}),(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(Oh,{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:W(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)(rx,{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:W(`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?ug(C.error):u(C.isFetching||C.isPending?`picker.searching`:`picker.noMatches`)})]})]})}var _S=/^filter\[([^\][]+)\]\[([^\][]+)\]$/;function vS(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 tg(t);if(e.type===`number`||e.type===`decimal`||e.type===`bigint`)return $h(t);if(e.type===`datetime`){let e=new Date(t);return Number.isNaN(e.getTime())?t:eg(e)}return t}function yS(e,t){let n=[],r=t.get(`search`);r&&n.push({key:`search`,label:J(`filters.search`),value:`“${r}”`,remove:[`search`]});let i=new Map;for(let[e,n]of t){let t=_S.exec(e);if(!t||n===``)continue;let[,r,a]=t;i.set(r,[...i.get(r)??[],{operator:a,raw:n,key:e}])}for(let[t,r]of i){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(`${vS(i,s.raw)} – ${vS(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=>vS(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}var bS=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{},xS=e=>Array.isArray(e)?e:[];function SS(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`id`in e&&`title`in e}function CS(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`name`in e&&`size`in e&&(`key`in e||`token`in e)}function wS(e){return(Array.isArray(e)?e:[e]).filter(CS)}function TS(e,t){let n=e?._files?.[t];return n==null?[]:Array.isArray(n)?n:[n]}var ES=e=>e.token===void 0?`key:${e.key}`:`token:${e.token}`,DS=e=>e.token===void 0?{key:e.key}:{token:e.token},OS=(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)))},kS=/<img\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;function AS(e){return e.replace(kS,``)}var jS=e=>String(e).padStart(2,`0`);function MS(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.getFullYear()}-${jS(t.getMonth()+1)}-${jS(t.getDate())}T${jS(t.getHours())}:${jS(t.getMinutes())}`}function NS(e,t){let n={};for(let r of e){let e=t?.[r.name];if(r.file){let e=TS(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=>NS(t,e)):NS(t,e??void 0)}else r.relation?.kind===`to-many`?n[r.name]=Array.isArray(e)?e.filter(SS):[]:r.type===`relation`?n[r.name]=SS(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]=MS(String(e)):r.widget===`money`?n[r.name]=cx(String(e),r.scale):n[r.name]=String(e)}return n}function PS(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 FS(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=xS(e).map((e,n)=>FS(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?xS(n[o.name]).map(e=>FS(t,e).payload):void 0;(l?JSON.stringify(l)!==JSON.stringify(c):c.length>0)&&(i[o.name]=c);continue}let r=FS(t,bS(e),n?bS(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=wS(e),r=n?wS(n[o.name]):void 0;if(r&&t.map(ES).join(`
|
|
54
54
|
`)===r.map(ES).join(`
|
|
55
|
-
`))continue;o.file.many?(r||t.length>0)&&(i[o.name]=t.map(DS)):t[0]?i[o.name]=DS(t[0]):(o.nullable||n)&&(i[o.name]=null);continue}if(o.relation?.kind===`to-many`){let t=Array.isArray(e)?e.filter(SS):[],r=n?.[o.name];(n?!OS(t,Array.isArray(r)?r.filter(SS):[]):t.length>0)&&(i[o.name]=t.map(e=>e.id));continue}if(o.type===`relation`){let t=SS(e)?e:null,r=n?.[o.name];if(n&&String(t?.id)===String(SS(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=PS(Nh(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=Mh(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(Mh(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 IS(e,t){let{payload:n}=FS(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 LS=new Set([`page`,`pageSize`,`sort`,`search`,`trashed`,`after`]),RS=e=>LS.has(e)||e.startsWith(`filter[`);function zS(e){let t=new URLSearchParams;for(let[n,r]of e)r!==``&&RS(n)&&t.append(n,r);return t.sort(),t.toString()}function BS(e,t){return`filter[${e}][${t}]`}function VS(e){return[...e.keys()].some(e=>e===`search`||e.startsWith(`filter[`))}function HS(e){let t={};for(let n of e.keys())(n===`search`||n.startsWith(`filter[`))&&(t[n]=null);return t}function US(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 WS(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=Qh(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}}var GS=`(max-width: 767px)`;function KS(e){let t=window.matchMedia(GS);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function qS(){return(0,y.useSyncExternalStore)(KS,()=>window.matchMedia(GS).matches,()=>!1)}function JS(e,t){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 YS(e,t){return e.enumLabels?.[t]??t}var XS=`h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,ZS=new Set([`number`,`decimal`,`bigint`,`date`,`datetime`]);function QS({schema:e,params:t,onChange:n}){let r=X(),i=qS(),[a,o]=(0,y.useState)(!1),s=t.get(`search`)??``,[c,l]=(0,y.useState)(s);(0,y.useEffect)(()=>{l(s)},[s]);let u=e.list.filters.map(t=>({operators:t.operators,field:e.fields.find(e=>e.name===t.field)})).filter(e=>e.field!==void 0),d=e.list.search.length>0,f=i&&(u.length>0||e.list.sortable.length>0);if(u.length===0&&!d&&!f)return null;let p=e.list.search.map(t=>e.fields.find(e=>e.name===t)?.label??t);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[d&&(0,b.jsxs)(`form`,{role:`search`,className:`flex flex-1 gap-2`,onSubmit:e=>{e.preventDefault(),n({search:c.trim()||null})},children:[(0,b.jsx)(Oh,{"aria-label":r(`filters.search`),placeholder:r(`filters.searchIn`,{fields:p.join(`, `)}),value:c,onChange:e=>l(e.target.value)}),(0,b.jsx)(q,{type:`submit`,variant:`outline`,children:r(`filters.search`)})]}),f&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,"aria-haspopup":`dialog`,onClick:()=>o(!0),children:[(0,b.jsx)(Cb,{}),r(`filters.filters`)]})]}),!i&&u.length>0&&(0,b.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:u.map(({field:r,operators:i})=>(0,b.jsx)(eC,{resource:e.name,field:r,operators:i,params:t,onChange:n},r.name))}),f&&(0,b.jsx)(jd,{open:a,onOpenChange:o,children:(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:`fixed inset-0 z-40 bg-black/30`}),(0,b.jsxs)(Ud,{"aria-describedby":void 0,className:`fixed inset-x-0 bottom-0 z-50 flex max-h-[85dvh] flex-col rounded-t-2xl border-t bg-background shadow-xl outline-none`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between border-b px-4 py-3`,children:[(0,b.jsx)(Jd,{className:`text-base font-semibold`,children:r(`filters.filtersAndSort`)}),(0,b.jsx)(Xd,{asChild:!0,children:(0,b.jsx)(q,{variant:`ghost`,size:`icon-sm`,"aria-label":r(`list.close`),children:(0,b.jsx)(rx,{})})})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-4 overflow-y-auto p-4`,children:[e.list.sortable.length>0&&(0,b.jsx)($S,{schema:e,params:t,onChange:n}),u.map(({field:r,operators:i})=>(0,b.jsx)(eC,{resource:e.name,field:r,operators:i,params:t,onChange:n},r.name))]}),(0,b.jsxs)(`div`,{className:`flex gap-2 border-t p-4`,children:[VS(t)&&(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>n(HS(t)),children:r(`filters.clear`)}),(0,b.jsx)(Xd,{asChild:!0,children:(0,b.jsx)(q,{className:`flex-1`,children:r(`filters.showResults`)})})]})]})]})}),VS(t)&&(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(iC,{schema:e,params:t,onChange:n}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>n(HS(t)),children:r(`filters.clear`)})]})]})}function $S({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)(kh,{htmlFor:`list-sort`,children:r(`filters.sortBy`)}),(0,b.jsx)(`select`,{id:`list-sort`,className:XS,value:o,onChange:e=>n({sort:e.target.value,page:null,after:null}),children:e.list.sortable.flatMap(e=>[(0,b.jsx)(`option`,{value:e,children:r(`filters.ascending`,{name:s(e)})},e),(0,b.jsx)(`option`,{value:`-${e}`,children:r(`filters.descending`,{name:s(e)})},`-${e}`)])})]})}function eC(e){let t=(0,b.jsx)(rC,{...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)(tC,{field:n,params:i,onChange:a})]})}function tC({field:e,params:t,onChange:n}){let r=X(),i=BS(e.name,`isNull`);return(0,b.jsxs)(`select`,{"aria-label":r(`filters.emptyValues`,{field:e.label}),className:W(XS,`h-7 text-xs text-muted-foreground`),value:t.get(i)??``,onChange:e=>n({[i]:e.target.value||null}),children:[(0,b.jsx)(`option`,{value:``,children:r(`filters.any`)}),(0,b.jsx)(`option`,{value:`true`,children:r(`filters.onlyEmpty`)}),(0,b.jsx)(`option`,{value:`false`,children:r(`filters.hideEmpty`)})]})}function nC({id:e,field:t,params:n,onChange:r}){let i=X(),a=BS(t.name,`in`),o=(n.get(a)??``).split(`,`).filter(Boolean),s=e=>{let t=o.includes(e)?o.filter(t=>t!==e):[...o,e];r({[a]:t.length>0?t.join(`,`):null})};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:e,children:t.label}),(0,b.jsxs)(Sh,{children:[(0,b.jsx)(Ch,{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:o.length===0?i(`common.all`):o.length<=2?o.map(e=>YS(t,e)).join(`, `):i(`filters.selected`,{count:o.length})}),(0,b.jsx)(pv,{className:`size-4 opacity-60`,"aria-hidden":!0})]})}),(0,b.jsx)(wh,{children:(0,b.jsx)(Th,{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)(`ul`,{"aria-label":t.label,children:(t.enumValues??[]).map(e=>(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)(ff,{checked:o.includes(e),onCheckedChange:()=>s(e),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)(dv,{className:`size-3`})})}),YS(t,e)]})},e))})})})]})]})}function rC({resource:e,field:t,operators:n,params:r,onChange:i}){let{t:a,calendar:o}=Y(),s=`filter-${t.name}`;if(t.type===`enum`&&n.includes(`in`))return(0,b.jsx)(nC,{id:s,field:t,params:r,onChange:i});if(t.type===`relation`){let a=t.relation?.kind===`to-many`?`in`:`eq`;return n.includes(a)?(0,b.jsx)(oC,{id:s,resource:e,field:t,operator:a,params:r,onChange:i}):null}if((t.type===`enum`||t.type===`boolean`)&&n.includes(`eq`)){let e=BS(t.name,`eq`),n=t.type===`boolean`?[[`true`,a(`common.yes`)],[`false`,a(`common.no`)]]:(t.enumValues??[]).map(e=>[e,YS(t,e)]);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:s,children:t.label}),(0,b.jsxs)(`select`,{id:s,className:XS,value:r.get(e)??``,onChange:t=>i({[e]:t.target.value||null}),children:[(0,b.jsx)(`option`,{value:``,children:a(`common.all`)}),n.map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))]})]})}if((t.type===`date`||t.type===`datetime`&&o===`persian`)&&n.includes(`gte`)&&n.includes(`lte`)){let e=(e,n)=>t.type===`date`||!n?n:new Date(`${n}T${e===`gte`?`00:00:00.000`:`23:59:59.999`}`).toISOString(),n=e=>e&&t.type===`datetime`?MS(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:t.label}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`gte`,`lte`].map(o=>{let c=BS(t.name,o),l=`${s}-${o}`,u=a(o===`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)(kh,{htmlFor:l,className:`text-xs text-muted-foreground`,children:u}),(0,b.jsx)(lS,{id:l,label:`${t.label} ${u}`,value:n(r.get(c)),onChange:t=>i({[c]:e(o,t)||null})})]},o)})})]})}if(ZS.has(t.type)&&n.includes(`gte`)&&n.includes(`lte`)){let e=t.type===`date`?`date`:t.type===`datetime`?`datetime-local`:`text`,n=e=>t.type===`datetime`&&e?new Date(e).toISOString():Nh(e.trim()).replace(/,/g,``),o=e=>e&&t.type===`datetime`?MS(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:t.label}),(0,b.jsx)(`div`,{className:`flex gap-2`,children:[`gte`,`lte`].map(c=>{let l=BS(t.name,c),u=`${s}-${c}`;return(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1`,children:[(0,b.jsx)(kh,{htmlFor:u,className:`text-xs text-muted-foreground`,children:a(c===`gte`?`filters.from`:`filters.to`)}),(0,b.jsx)(sC,{id:u,type:e,inputMode:e===`text`?`decimal`:void 0,value:o(r.get(l)),onCommit:e=>i({[l]:n(e)||null})})]},c)})})]})}let c=n.includes(`contains`)?`contains`:n.includes(`eq`)?`eq`:void 0;if(!c)return null;let l=BS(t.name,c);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:s,children:c===`contains`?a(`filters.contains`,{field:t.label}):t.label}),(0,b.jsx)(sC,{id:s,value:r.get(l)??``,onCommit:e=>i({[l]:e.trim()||null})})]})}function iC({schema:e,params:t,onChange:n}){let r=X(),i=yS(e,t);return(0,b.jsx)(`ul`,{"aria-label":r(`filters.active`),className:`flex flex-wrap gap-1.5`,children:i.map(t=>(0,b.jsxs)(`li`,{className:`inline-flex items-center gap-1 rounded-full border bg-muted/50 py-0.5 ps-2.5 pe-1 text-xs`,children:[(0,b.jsxs)(`span`,{className:`font-medium`,children:[t.label,`:`]}),t.ref?(0,b.jsx)(aC,{resource:e.name,chip:t}):(0,b.jsx)(`span`,{children:t.value}),(0,b.jsx)(`button`,{type:`button`,className:`rounded-full p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":r(`filters.removeChip`,{label:t.label}),onClick:()=>n(Object.fromEntries(t.remove.map(e=>[e,null]))),children:(0,b.jsx)(rx,{className:`size-3`})})]},t.key))})}function aC({resource:e,chip:t}){let n=Gg(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 oC({id:e,resource:t,field:n,operator:r,params:i,onChange:a}){let o=BS(n.name,r),s=(i.get(o)??``).split(`,`).filter(Boolean),c=Gg(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)(kh,{htmlFor:e,children:n.label}),(0,b.jsx)(gS,{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 sC({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)(Oh,{id:e,type:n,inputMode:r,value:a,onChange:e=>o(e.target.value),onBlur:s,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),s())}})}var cC=[`auth.*`,`auth.login`,`auth.login_failed`,`auth.view_as`,`rbac.*`,`rbac.role.changed`,`rbac.user_roles.changed`,`page.*`],lC=[`*`,`created`,`updated`,`deleted`,`restored`,`purged`,`action.*`];function uC(){let{t:e,locale:t}=Y(),[n,r]=wo(),i=zg(),a=Rg(),o=a.data?.audit.view===!0,s=jx(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=>US(n,Nx(e,t))),y=c.error instanceof lg&&(c.error.status===403||c.error.status===404);if(a.isPending)return(0,b.jsx)(G,{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)(y_,{children:e(`audit.title`)}),(0,b.jsx)(G,{tone:`error`,children:y?ug(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)(y_,{children:e(`audit.title`)}),(0,b.jsxs)(`fieldset`,{className:`grid gap-3 rounded-lg border 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)(dC,{label:e(`audit.filter.actor`),value:n.get(`actor`)??``,onCommit:e=>v(`actor`,e)}),(0,b.jsx)(dC,{label:e(`audit.filter.event`),placeholder:e(`audit.filter.eventHint`),value:n.get(`event`)??``,onCommit:e=>v(`event`,e),hints:[...S?lC.map(e=>`${S}.${e}`):[],...cC]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`audit-resource`,children:e(`audit.filter.resource`)}),(0,b.jsxs)(`select`,{id:`audit-resource`,className:XS,value:S,onChange:e=>v(`resource`,e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:e(`common.all`)}),S&&!x.some(e=>e.name===S)&&(0,b.jsx)(`option`,{value:S,children:S}),x.map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]}),(0,b.jsx)(dC,{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)(kh,{htmlFor:`audit-${t}`,children:e(`filters.${t}`)}),(0,b.jsx)(lS,{id:`audit-${t}`,label:e(`filters.${t}`),value:n.get(t)??``,onChange:e=>v(t,e)})]},t)),Mx(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=>US(e,Px())),children:e(`filters.clear`)})})]}),c.isError&&(0,b.jsx)(b_,{children:ug(c.error)}),c.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):l.length===0?!c.isError&&(0,b.jsx)(G,{children:e(Mx(n)?`audit.noMatches`:`audit.empty`)}):(0,b.jsx)(Fx,{entries:l,now:new Date(c.dataUpdatedAt),names:fx(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 dC({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)(kh,{htmlFor:o,children:e}),(0,b.jsx)(Oh,{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 fC={hidden:`rbac.rule.hidden`,view:`rbac.rule.readonly`,edit:`rbac.rule.edit`};function pC(){let{t:e}=Y(),[t,n]=wo(),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)(y_,{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-lg border 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)(kh,{htmlFor:`debug-user`,children:e(`debugger.user`)}),(0,b.jsx)(Oh,{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)(kh,{htmlFor:`debug-resource`,children:e(`debugger.resource`)}),(0,b.jsxs)(`select`,{id:`debug-resource`,className:`h-9 rounded-md border bg-background px-2 text-sm`,value:u,onChange:e=>d(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`—`}),(o.data?.resources??[]).map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`debug-record`,children:e(`debugger.record`)}),(0,b.jsx)(Oh,{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)(G,{children:e(`common.loading`)}):_.isError?(0,b.jsx)(G,{tone:`error`,children:ug(_.error)}):(0,b.jsx)(hC,{data:_.data})]})}function mC({allowed:e}){let{t}=Y();return(0,b.jsx)(`span`,{className:W(`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 hC({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:g_(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-lg border`,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)(mC,{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-lg border`,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)(mC,{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-lg border`,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(fC[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(fC[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)(mC,{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-lg border`,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)(mC,{allowed:n.view})}),(0,b.jsx)(`td`,{className:`px-3 py-2`,"data-operation":`update`,children:(0,b.jsx)(mC,{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 gC(){let{t:e,locale:t}=Y(),n=Rg(),r=ft({queryKey:[`rbac`,`groups`],queryFn:Q.rbac.groups});return r.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(G,{tone:`error`,children:ug(r.error)}):(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(y_,{actions:n.data?.rbac.manage&&(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/groups/new`,children:[(0,b.jsx)(Yy,{}),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-lg border empty:hidden`,children:r.data.items.map(n=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{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:g_(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 _C(){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)(G,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(G,{tone:`error`,children:ug(r.error)}):!n&&i.isError?(0,b.jsx)(G,{tone:`error`,children:ug(i.error)}):(0,b.jsx)(vC,{roles:r.data.items,group:n?void 0:i.data},t??`new`)}function vC({roles:e,group:t}){let{t:n,locale:r}=Y(),i=Yi(),a=S(),o=Rg().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:__(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(ug(e))}),O=pt({mutationFn:()=>Q.rbac.deleteGroup(t.id),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`rbac`]}),i(`/-/groups`)},onError:e=>E(ug(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)(y_,{children:t?g_(t.label,r)||t.name:n(`rbac.newGroup`)}),T&&(0,b.jsx)(b_,{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)(kh,{htmlFor:`group-name`,children:n(`rbac.name`)}),(0,b.jsx)(Oh,{id:`group-name`,dir:`ltr`,value:s,disabled:o,onChange:e=>c(e.target.value)})]}),cg.locales.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`group-label-${e}`,children:n(`rbac.labelIn`,{language:e})}),(0,b.jsx)(Oh,{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))}),g_(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)(rx,{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)(kh,{htmlFor:`member-search`,children:n(`rbac.addMember`)}),(0,b.jsx)(Oh,{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)(Yy,{}),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 yC=[`view`,`create`,`update`,`delete`,`purge`,`field`,`action`];function bC(e,t){let n=e.split(`.`),r=t.split(`.`),i=r[0]===`page`&&!yC.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 xC(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 SC(e,t){return e.some(e=>bC(e,t))}function CC(e,t,n,r){if(n)return SC(e,t)?e:[...e,t];let i=[];for(let n of e)if(n!==t){if(n.includes(`*`)&&bC(n,t)){for(let e of r)e!==t&&bC(n,e)&&!i.includes(e)&&i.push(e);continue}i.push(n)}return i.filter(e=>e===t||!bC(e,t))}var wC=[`view`,`update`,`delete`];function TC(){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)(G,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(G,{tone:`error`,children:ug(r.error)}):!n&&i.isError?(0,b.jsx)(G,{tone:`error`,children:ug(i.error)}):(0,b.jsx)(EC,{catalog:r.data,role:n?void 0:i.data},t??`new`)}function EC({catalog:e,role:t}){let{t:n,locale:r}=Y(),i=Yi(),a=S(),o=Rg(),s=t?.system===!0||o.data?.rbac.manage!==!0,c=xC(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:__(d),permissions:p,fields:DC(h),scopes:DC(_)};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 lg?[e.message,...Object.values(e.fields).flat()].join(` — `):ug(e))}),D=pt({mutationFn:()=>Q.rbac.deleteRole(t.name),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`rbac`]}),i(`/-/roles`)},onError:e=>T(ug(e))}),O=(e,t)=>m(n=>CC(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)(y_,{children:t?g_(t.label,r)||t.name:n(`rbac.newRole`)}),t?.system&&(0,b.jsx)(b_,{tone:`success`,children:n(`rbac.systemNote`)}),w&&(0,b.jsx)(b_,{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)(kh,{htmlFor:`role-name`,children:n(`rbac.name`)}),(0,b.jsx)(Oh,{id:`role-name`,dir:`ltr`,value:l,disabled:!!t,onChange:e=>u(e.target.value)})]}),cg.locales.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`role-label-${e}`,children:n(`rbac.labelIn`,{language:e})}),(0,b.jsx)(Oh,{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-lg border`,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:SC(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)(pv,{className:W(`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)(`label`,{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.jsxs)(`select`,{className:`h-8 rounded-lg border border-input bg-transparent px-2 text-sm`,value:h[t.name]?.[e.name]??``,disabled:s,"aria-label":n(`rbac.fieldRule`,{field:e.label}),onChange:n=>k(t.name,e.name,n.target.value),children:[(0,b.jsx)(`option`,{value:``,children:n(e.restricted?`rbac.rule.defaultHidden`:`rbac.rule.default`)}),(0,b.jsx)(`option`,{value:`hidden`,children:n(`rbac.rule.hidden`)}),(0,b.jsx)(`option`,{value:`readonly`,children:n(`rbac.rule.readonly`)}),(0,b.jsx)(`option`,{value:`edit`,children: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`)}),wC.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:SC(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:SC(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-lg border`,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=SC(p,r)&&!SC(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||SC(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:SC(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:SC(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 DC(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 OC(){let{t:e,locale:t}=Y(),n=Rg(),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)(G,{children:e(`common.loading`)}):i.isError?(0,b.jsx)(G,{tone:`error`,children:ug(i.error)}):(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(y_,{actions:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(q,{variant:`outline`,onClick:()=>void u(),children:[(0,b.jsx)(jv,{}),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)(Vb,{}),e(`rbac.import`)]}),(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/roles/new`,children:[(0,b.jsx)(Yy,{}),e(`rbac.newRole`)]})})]})]}),children:e(`rbac.roles`)}),o&&(0,b.jsx)(b_,{tone:`success`,children:o}),l.isError&&(0,b.jsx)(b_,{children:l.error instanceof SyntaxError?e(`rbac.notJson`):ug(l.error)}),(0,b.jsx)(`ul`,{"aria-label":e(`rbac.roles`),className:`flex flex-col divide-y rounded-lg border`,children:i.data.items.map(n=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{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:g_(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 kC(){let{t:e}=Y(),t=Rg(),[n,r]=wo(),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)(G,{children:e(`common.loading`)});if(c.isError)return(0,b.jsx)(G,{tone:`error`,children:ug(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)(y_,{actions:t.data?.rbac.manage&&f.create&&(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/users/new`,children:[(0,b.jsx)(Yy,{}),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)(Oh,{"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-lg border`,children:[l.map(t=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{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 AC(){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)(G,{children:e(`common.loading`)});let s=r.error??i.error??o.error??(n?null:a.error);return s?(0,b.jsx)(G,{tone:`error`,children:ug(s)}):(0,b.jsx)(jC,{user:n?void 0:a.data,roles:r.data.items,groups:i.data.items,capabilities:o.data.capabilities},t??`new`)}function jC({user:e,roles:t,groups:n,capabilities:r}){let{t:i,locale:a}=Y(),o=Yi(),s=S(),c=Rg(),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 lg&&Object.keys(e.fields).length>0?(j(e.fields),N(e.message)):(j({}),N(ug(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)(kh,{htmlFor:t,children:n}),(0,b.jsx)(Oh,{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)(y_,{actions:ie&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,onClick:()=>{bg(e.id),s.clear(),o(`/`)},children:[(0,b.jsx)(Fv,{}),i(`viewAs.start`)]}),children:e?e.displayName:i(`rbac.newUser`)}),M&&(0,b.jsx)(b_,{children:M}),ee&&(0,b.jsx)(b_,{tone:`success`,children:ee}),e?.isSuperuser&&!u&&(0,b.jsx)(b_,{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))}),g_(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))}),g_(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-lg border 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)(kh,{htmlFor:`user-new-password`,children:i(`auth.newPassword`)}),(0,b.jsx)(Oh,{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-lg border 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`)})})]})]})}function MC(e){return Mh(e).toLocaleLowerCase().replace(/[يى]/g,`ی`).replace(/ك/g,`ک`).replace(//g,` `)}function NC(e,t){let n=MC(e);return MC(t).split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function PC(e,t,n){let r=[],i=[];for(let a of e.groups){e.groups.length>1&&NC(a.label,t)&&r.push({id:`group:${a.key}`,section:`go`,label:a.label,to:`/g/${a.key}`});for(let e of a.resources){NC(`${e.label} ${a.label}`,t)&&r.push({id:`go:${e.name}`,section:`go`,label:e.label,detail:a.label,to:`/${e.name}`});let o=n(e.label);e.creatable&&t.trim()!==``&&NC(o,t)&&i.push({id:`new:${e.name}`,section:`create`,label:o,to:`/${e.name}/new`})}for(let e of a.pages)NC(`${e.label} ${a.label}`,t)&&r.push({id:`page:${e.name}`,section:`go`,label:e.label,detail:a.label,to:`/p/${e.name}`})}return[...r,...i]}function FC(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 IC(){let{t:e}=Y(),t=Yi(),n=zg(),r=Rg(),[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=FC(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=n.data?PC(n.data,o,t=>e(`palette.new`,{name:t})):[],g=[...h.filter(e=>e.section===`go`),...r.data?.audit.view&&NC(e(`audit.title`),o)?[{id:`audit`,section:`go`,label:e(`audit.title`),to:`/-/audit`}]:[],...h.filter(e=>e.section!==`go`),...p&&o.trim()===f?(m.data?.groups??[]).flatMap(e=>e.items.map(t=>({id:`record:${e.resource}:${t._id}`,section:`records`,label:t._title,detail:e.label,to:`/${e.resource}/${encodeURIComponent(t._id)}`}))):[]],_=Math.min(c,Math.max(0,g.length-1));(0,y.useEffect)(()=>l(0),[o,m.data]),(0,y.useEffect)(()=>{d.current?.querySelector(`[data-index="${_}"]`)?.scrollIntoView({block:`nearest`})},[_]);function v(e){e&&(a(!1),t(e.to))}function x(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),g.length===0)return;l((_+(e.key===`ArrowDown`?1:-1)+g.length)%g.length)}else e.key===`Enter`&&(e.preventDefault(),v(g[_]))}let S=[[`go`,e(`palette.goTo`)],[`create`,e(`palette.create`)],[`records`,e(`palette.records`)]],C=e=>`${u}-${e}`,w=p&&(m.isFetching||o.trim()!==f)?e(`palette.searching`):g.length===0?e(`palette.noResults`):``;return(0,b.jsxs)(jd,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,b.jsx)(Nd,{asChild:!0,children:(0,b.jsxs)(q,{variant:`outline`,size:`sm`,className:`gap-2 text-muted-foreground`,"aria-keyshortcuts":`Control+K Meta+K`,"aria-label":e(`palette.open`),children:[(0,b.jsx)(lb,{}),(0,b.jsx)(`span`,{className:`hidden lg:inline`,children:e(`palette.open`)}),(0,b.jsx)(`kbd`,{className:`hidden rounded border bg-muted px-1 font-sans text-[0.7rem] lg:inline`,children:`⌘K`})]})}),(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:`fixed inset-0 z-40 bg-black/30`}),(0,b.jsxs)(Ud,{"aria-describedby":void 0,className:`fixed inset-x-3 top-[12vh] z-50 mx-auto flex max-h-[70vh] max-w-xl flex-col overflow-hidden rounded-xl border bg-popover text-popover-foreground shadow-xl outline-none`,children:[(0,b.jsx)(Jd,{className:`sr-only`,children:e(`palette.open`)}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-3`,children:[(0,b.jsx)(lb,{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":g.length>0?C(_):void 0,"aria-label":e(`palette.open`),placeholder:e(`palette.placeholder`),className:`h-12 flex-1 bg-transparent text-sm outline-none`,value:o,onChange:e=>s(e.target.value),onKeyDown:x})]}),(0,b.jsx)(`ul`,{ref:d,id:u,role:`listbox`,"aria-label":e(`palette.results`),className:`flex-1 overflow-y-auto p-1`,children:S.map(([e,t])=>{let n=g.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 pt-2 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:C(t),role:`option`,"aria-selected":t===_,"data-index":t,className:W(`flex cursor-pointer items-center justify-between gap-3 rounded-md px-2 py-2 text-sm`,t===_&&`bg-accent text-accent-foreground`),onMouseMove:()=>l(t),onClick:()=>v(e),children:[(0,b.jsx)(`span`,{className:`truncate`,children:e.label}),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:W(`px-3 text-sm text-muted-foreground`,w&&`border-t py-2`),children:w})]})]})]})}var LC=`nma.theme`,RC=`oklch(0.145 0 0)`,zC=`oklch(0.985 0 0)`;function BC(){try{let e=localStorage.getItem(LC);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}function VC(e,t){return e===`system`?t?`dark`:`light`:e}var HC=()=>typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches;function UC(e){let t=VC(e,HC());document.documentElement.classList.toggle(`dark`,t===`dark`),document.documentElement.style.colorScheme=t}function WC(e){try{localStorage.setItem(LC,e)}catch{}UC(e)}function GC(e){if(typeof matchMedia!=`function`)return()=>void 0;let t=matchMedia(`(prefers-color-scheme: dark)`),n=()=>{e()===`system`&&UC(`system`)};return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)}function KC(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 qC(e){let t={};if(e.primaryColor){let n=KC(e.primaryColor),r=e.primaryForeground??(n!==void 0&&n>.45?RC:zC);Object.assign(t,{"--primary":e.primaryColor,"--primary-foreground":r,"--ring":e.primaryColor,"--sidebar-primary":e.primaryColor,"--sidebar-primary-foreground":r})}return e.radius&&(t[`--radius`]=e.radius),t}function JC(e){for(let[t,n]of Object.entries(qC(e)))document.documentElement.style.setProperty(t,n)}var YC={en:`English`,fa:`فارسی`};function XC(){let{t:e}=Y(),[t,n]=(0,y.useState)(BC),r=[[`light`,e(`shell.themeLight`),kb],[`dark`,e(`shell.themeDark`),Ny],[`system`,e(`shell.themeSystem`),jy]];return(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":e(`shell.theme`),className:`flex items-center rounded-lg 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:W(`rounded-md p-1.5 text-muted-foreground hover:text-foreground`,t===e&&`bg-muted text-foreground`),onClick:()=>{WC(e),n(e)},children:(0,b.jsx)(i,{className:`size-4`})},e))})}function ZC(){let{t:e,locale:t,locales:n,setLocale:r}=Y();return n.length<2?null:(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,b.jsx)(sy,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`sr-only`,children:e(`shell.language`)}),(0,b.jsx)(`select`,{className:`h-8 rounded-lg border border-input bg-transparent px-2 text-sm`,value:t,onChange:e=>r(e.target.value),children:n.map(e=>(0,b.jsx)(`option`,{value:e,lang:e,children:YC[e]??e},e))})]})}function QC(){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-lg border p-0.5`,children:n.map(([e,n])=>(0,b.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":t===e,className:W(`flex-1 rounded-md px-2 py-1 text-sm text-muted-foreground hover:text-foreground`,t===e&&`bg-muted text-foreground`),onClick:()=>r(e),children:n},e))})]});return(0,b.jsxs)(Sh,{children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,"aria-label":e(`display.title`),title:e(`display.title`),children:(0,b.jsx)(av,{})})}),(0,b.jsx)(wh,{children:(0,b.jsxs)(Th,{align:`end`,sideOffset:6,className:`z-50 flex w-64 flex-col gap-3 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md`,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})),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:hidden`,children:[(0,b.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e(`shell.theme`)}),(0,b.jsx)(XC,{})]})]})})]})}function $C(){let{t:e}=Y(),t=Rg(),n=Yi(),r=S(),i=t.data;if(!i||i.open)return null;let{user:a,auth:o}=i,s=a.displayName.split(/\s+/).filter(Boolean).slice(0,2).map(e=>[...e][0].toUpperCase()).join(``);async function c(){try{await Q.logout()}finally{pg(void 0),bg(void 0),r.clear(),n(`/login`,{replace:!0})}}return(0,b.jsxs)(Sh,{children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,className:`rounded-full text-xs font-semibold`,"aria-label":e(`auth.userMenu`,{name:a.displayName}),children:s||(0,b.jsx)(Ub,{})})}),(0,b.jsx)(wh,{children:(0,b.jsxs)(Th,{align:`end`,sideOffset:6,className:`z-50 flex w-60 flex-col gap-1 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:[(0,b.jsxs)(`div`,{className:`border-b px-2 py-2`,children:[(0,b.jsx)(`div`,{className:`truncate text-sm font-medium`,children:a.displayName}),(a.username||a.email)&&(0,b.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:a.email??a.username})]}),(o.password||o.sessions||o.twoFactor)&&!i.viewAs&&(0,b.jsx)(Eh,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/account`,className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent`,children:[(0,b.jsx)(Ub,{className:`size-4`}),e(`auth.account`)]})}),i.audit.view&&(0,b.jsx)(Eh,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/audit`,className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent`,children:[(0,b.jsx)(rb,{className:`size-4`}),e(`audit.title`)]})}),o.logout&&(0,b.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-start text-sm hover:bg-accent`,onClick:()=>void c(),children:[(0,b.jsx)(yy,{className:`size-4 rtl:-scale-x-100`}),e(`auth.signOut`)]})]})})]})}var ew=`nma.nav`,tw={pinned:[],recent:[],collapsedGroups:[],railCollapsed:!1};function nw(e){let t=tw;try{let n=e?.getItem(ew);n&&(t={...tw,...JSON.parse(n)})}catch{t=tw}let n=new Set,r=r=>{t=r;try{e?.setItem(ew,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=>r({...t,collapsedGroups:i(t.collapsedGroups,e)}),toggleRail:()=>r({...t,railCollapsed:!t.railCollapsed})}}function rw(){try{return typeof localStorage>`u`?void 0:localStorage}catch{return}}var iw=nw(rw());function aw(){return(0,y.useSyncExternalStore)(iw.subscribe,iw.get)}function ow(e,t){return e.filter(e=>t.has(e))}function sw(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=Ug(n??``,a),s=[{label:t(`shell.home`),to:`/`}];if(n===`account`&&!r)return[...s,{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 s.push({label:t(`rbac.administration`)},{label:e,to:`/-/${r}`}),i&&s.push({label:i===`new`?t(`list.new`):i}),s}if(!n||!e)return s;if(n===`g`){let t=e.groups.find(e=>e.key===r);return t&&s.push({label:t.label}),s}if(n===`p`){let t=e.groups.find(e=>e.pages.some(e=>e.name===r)),n=t?.pages.find(e=>e.name===r);return t&&n&&s.push({label:t.label,to:`/g/${t.key}`},{label:n.label}),s}let c=e.groups.find(e=>e.resources.some(e=>e.name===n)),l=c?.resources.find(e=>e.name===n);return!c||!l?s:(s.push({label:c.label,to:`/g/${c.key}`},{label:l.label,to:`/${l.name}`}),r===`new`?s.push({label:t(`form.new`,{name:l.label})}):a&&s.push({label:typeof o.data?._title==`string`?o.data._title:`#${a}`}),s)}function cw({meta:e,onOpenMenu:t}){let{t:n}=Y(),r=aw(),i=sw(e),a=i.length-1;return(0,b.jsxs)(`header`,{className:`flex h-14 items-center gap-2 border-b px-4`,children:[(0,b.jsx)(q,{variant:`ghost`,size:`icon`,className:`md:hidden`,"aria-label":n(`shell.menu`),onClick:t,children:(0,b.jsx)(Dy,{})}),(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:()=>iw.toggleRail(),children:r.railCollapsed?(0,b.jsx)(zy,{className:`rtl:-scale-x-100`}):(0,b.jsx)(Ly,{className:`rtl:-scale-x-100`})}),(0,b.jsx)(`nav`,{"aria-label":n(`shell.breadcrumbs`),className:`min-w-0 flex-1`,children:(0,b.jsx)(`ol`,{className:`flex min-w-0 items-center gap-1 text-sm text-muted-foreground`,children:i.map((e,t)=>(0,b.jsxs)(y.Fragment,{children:[t>0&&(0,b.jsx)(_v,{className:`size-3.5 shrink-0 rtl: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)(bo,{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-2`,children:[(0,b.jsx)(IC,{}),(0,b.jsx)(ZC,{}),(0,b.jsx)(QC,{}),(0,b.jsx)($C,{}),(0,b.jsx)(`div`,{className:`hidden sm:flex`,children:(0,b.jsx)(XC,{})})]})]})}var lw={archive:F_,ban:U_,bell:G_,book:q_,box:Y_,boxes:Z_,briefcase:$_,building:tv,calendar:sv,chart:lv,check:dv,clock:yv,"credit-card":Tv,database:Dv,dollar:kv,file:zv,"file-text":Lv,folder:Vv,globe:Uv,heart:qv,history:rb,home:Yv,image:$v,inbox:ty,key:ay,layers:ly,link:dy,list:hy,lock:_y,mail:xy,map:Ty,"map-pin":Cy,message:ky,package:Fy,phone:Uy,printer:Zy,receipt:$y,refresh:tb,send:db,server:pb,settings:hb,shield:_b,"shopping-bag":yb,cart:xb,"shopping-cart":xb,star:Tb,store:Db,tag:jb,tags:Nb,ticket:Fb,truck:zb,user:Gb,users:Yb,video:Zb,wallet:$b,wrench:tx,x:rx,zap:ax};Object.keys(lw);function uw(e,t){return dw(e)??(t===`group`?Vv:t===`page`?hb:Lv)}function dw(e){return e&&Object.hasOwn(lw,e)?lw[e]:void 0}var fw=e=>({isActive:t})=>W(`flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-sidebar-accent`,e&&`justify-center px-0`,t&&`bg-sidebar-accent font-medium`);function pw({title:e,logo:t,groups:n,rail:r=!1}){let{t:i}=Y(),a=aw(),[o,s]=(0,y.useState)(``),c=new Map(n.flatMap(e=>e.resources.map(e=>[e.name,e]))),l=ow(a.pinned,new Set(c.keys())).map(e=>c.get(e)),u=ow(a.recent,new Set(c.keys())).filter(e=>!a.pinned.includes(e)).map(e=>c.get(e)),d=o.trim().toLocaleLowerCase(),f=e=>d!==``&&!e.label.toLocaleLowerCase().includes(d),p=n.map(e=>({group:e,resources:f(e)?e.resources.filter(e=>e.label.toLocaleLowerCase().includes(d)):e.resources,pages:f(e)?e.pages.filter(e=>e.label.toLocaleLowerCase().includes(d)):e.pages})).filter(e=>e.resources.length>0||e.pages.length>0),m=e=>{let t=uw(e.icon,`page`);return(0,b.jsx)(`li`,{className:`flex items-center`,children:(0,b.jsxs)(xo,{to:`/p/${e.name}`,className:fw(r),"aria-label":r?e.label:void 0,title:r?e.label:void 0,children:[(0,b.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),!r&&(0,b.jsx)(`span`,{className:`truncate`,children:e.label})]})},`page:${e.name}`)},h=(e,t)=>{let n=uw(e.icon,`resource`),o=a.pinned.includes(e.name);return(0,b.jsxs)(`li`,{className:`group/item flex items-center`,children:[(0,b.jsxs)(xo,{to:`/${e.name}`,className:fw(r),"aria-label":r?e.label:void 0,title:r?e.label:void 0,children:[(0,b.jsx)(n,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),!r&&(0,b.jsx)(`span`,{className:`truncate`,children:e.label})]}),!r&&(0,b.jsx)(`button`,{type:`button`,className:W(`rounded-md p-1 text-muted-foreground opacity-0 hover:text-foreground focus-visible:opacity-100 group-hover/item:opacity-100`,o&&`opacity-100`),"aria-label":i(o?`shell.unpin`:`shell.pin`,{name:e.label}),"aria-pressed":o,onClick:()=>iw.togglePin(e.name),children:o?(0,b.jsx)(Gy,{className:`size-3.5`}):(0,b.jsx)(qy,{className:`size-3.5`})})]},`${t}:${e.name}`)};return(0,b.jsxs)(`nav`,{"aria-label":i(`shell.resources`),className:W(`flex h-full flex-col gap-4 overflow-y-auto p-3`,r&&`items-stretch px-2`),children:[(0,b.jsxs)(`div`,{className:W(`flex items-center gap-2 px-2 py-1`,r&&`justify-center px-0`),children:[t&&(0,b.jsx)(`img`,{src:t,alt:``,className:`size-7 shrink-0 rounded-md object-contain`}),!r&&(0,b.jsx)(`span`,{className:`truncate text-lg font-semibold`,children:e})]}),!r&&(0,b.jsx)(Oh,{type:`search`,"aria-label":i(`shell.filterResources`),placeholder:i(`shell.filterResources`),value:o,onChange:e=>s(e.target.value)}),!r&&!d&&l.length>0&&(0,b.jsx)(hw,{label:i(`shell.pinned`),children:(0,b.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:l.map(e=>h(e,`pinned`))})}),!r&&!d&&u.length>0&&(0,b.jsx)(hw,{label:i(`shell.recent`),children:(0,b.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:u.map(e=>h(e,`recent`))})}),p.map(({group:e,resources:t,pages:n})=>{let o=!d&&!r&&a.collapsedGroups.includes(e.key),s=uw(e.icon,`group`),c=`nav-group-${e.key}`;return(0,b.jsxs)(`div`,{children:[!r&&(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 pb-1 text-xs font-medium text-muted-foreground hover:text-foreground`,"aria-expanded":!o,"aria-controls":c,"aria-label":i(o?`shell.expandGroup`:`shell.collapseGroup`,{name:e.label}),onClick:()=>iw.toggleGroup(e.key),children:[(0,b.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`flex-1 truncate text-start`,children:e.label}),(0,b.jsx)(pv,{className:W(`size-3.5 transition-transform`,o&&`-rotate-90 rtl:rotate-90`),"aria-hidden":!0})]}),r&&(0,b.jsx)(`div`,{className:`mx-2 mb-1 border-t`,"aria-hidden":!0}),!o&&(0,b.jsxs)(`ul`,{id:c,className:`flex flex-col gap-0.5`,"aria-label":e.label,children:[t.map(t=>h(t,e.key)),n.map(m)]})]},e.key)}),d&&p.length===0&&(0,b.jsx)(`p`,{className:`px-2 text-sm text-muted-foreground`,children:i(`shell.noMatches`)}),!d&&(0,b.jsx)(mw,{rail:r})]})}function mw({rail:e}){let{t}=Y();if(!Rg().data?.rbac.view)return null;let n=[[`/-/users`,t(`rbac.users`),Ub],[`/-/groups`,t(`rbac.groups`),qb],[`/-/roles`,t(`rbac.roles`),ry],[`/-/debugger`,t(`debugger.title`),sb]];return(0,b.jsxs)(`div`,{className:`mt-auto border-t pt-3`,children:[!e&&(0,b.jsx)(`div`,{className:`px-2 pb-1 text-xs font-medium text-muted-foreground`,children:t(`rbac.administration`)}),(0,b.jsx)(`ul`,{className:`flex flex-col gap-0.5`,"aria-label":t(`rbac.administration`),children:n.map(([t,n,r])=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(xo,{to:t,className:fw(e),"aria-label":e?n:void 0,title:e?n:void 0,children:[(0,b.jsx)(r,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),!e&&(0,b.jsx)(`span`,{className:`truncate`,children:n})]})},t))})]})}function hw({label:e,children:t}){return(0,b.jsxs)(`section`,{"aria-label":e,children:[(0,b.jsx)(`div`,{className:`px-2 pb-1 text-xs font-medium text-muted-foreground`,children:e}),t]})}var gw={success:5e3,error:1e4},_w=4;function vw(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-_w)))o(e.id);return a([...t,{id:c,message:i,tone:s}]),r.set(c,e.setTimeout(()=>o(c),gw[s])),c},dismiss:o}}var yw=vw(),bw=(e,t=`success`)=>yw.show(e,t);function xw(){return(0,y.useSyncExternalStore)(yw.subscribe,yw.get)}function Sw(){let e=X(),t=xw();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:W(`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:W(`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:()=>yw.dismiss(t.id),children:(0,b.jsx)(rx,{className:`size-4`,"aria-hidden":!0})})]},t.id))})}function Cw(e,t){return e===void 0||typeof e==`string`?e:e[t]??e[cg.locale]??Object.values(e)[0]}function ww(){let{t:e}=Y(),t=Rg(),n=qi(),r=S(),i=t.isError&&yg()!==void 0&&t.error instanceof lg&&(t.error.status===403||t.error.status===404);return(0,y.useEffect)(()=>{i&&(bg(void 0),r.clear())},[i,r]),t.isPending||i?(0,b.jsx)(G,{children:e(`common.loading`)}):t.isError?t.error instanceof lg&&t.error.status===401?(0,b.jsx)(Da,{to:`/login?${new URLSearchParams({next:n.pathname+n.search})}`,replace:!0}):(0,b.jsxs)(G,{tone:`error`,children:[ug(t.error),` `,(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:e(`list.retry`)})]}):(0,b.jsx)(Ew,{})}function Tw(){let{t:e}=Y(),t=Rg(),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)(Fv,{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;bg(void 0),n.clear(),r(`/-/users/${encodeURIComponent(e)}`)},children:e(`viewAs.stop`)})]}):null}function Ew(){let e=zg(),{t,locale:n}=Y(),r=aw(),i=qi(),[a,o]=(0,y.useState)(!1),s=(0,y.useRef)(null),c=e.data?.groups??[],l=Cw(cg.branding.name,n)??e.data?.title??cg.title,u=cg.branding.logo;return(0,y.useEffect)(()=>{o(!1);let e=decodeURIComponent(i.pathname.split(`/`).filter(Boolean)[0]??``);c.some(t=>t.resources.some(t=>t.name===e))&&iw.visit(e)},[i.pathname,c]),(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)(`aside`,{className:W(`hidden shrink-0 border-e bg-sidebar text-sidebar-foreground md:block`,r.railCollapsed?`w-16`:`w-64`),children:(0,b.jsx)(pw,{title:l,logo:u,groups:c,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`,"aria-hidden":!0,onClick:()=>o(!1)}),(0,b.jsxs)(`aside`,{className:`absolute inset-y-0 start-0 flex w-72 max-w-[85vw] flex-col border-e bg-sidebar text-sidebar-foreground shadow-xl`,onClick:e=>{e.target.closest(`a`)&&o(!1)},children:[(0,b.jsx)(`div`,{className:`flex justify-end p-2`,children:(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":t(`shell.closeMenu`),onClick:()=>o(!1),children:(0,b.jsx)(rx,{})})}),(0,b.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,b.jsx)(pw,{title:l,logo:u,groups:c})})]})]}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,inert:a||void 0,children:[(0,b.jsx)(Tw,{}),(0,b.jsx)(cw,{meta:e.data,onOpenMenu:()=>o(!0)}),(0,b.jsx)(`main`,{className:`flex-1 p-4 md:p-6`,children:(0,b.jsx)(Oa,{})})]}),(0,b.jsx)(Sw,{})]})}function Dw(e){let t=cg.branding.name;return t===void 0?cg.title:typeof t==`string`?t:t[e]??t[cg.locale]??Object.values(t)[0]??cg.title}function Ow(){let{t:e,locale:t}=Y(),n=Yi(),r=S(),[i]=wo(),a=_g(i.get(`next`)),o=Rg(),[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)(Da,{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);pg(e.csrfToken),bg(void 0),r.clear(),r.setQueryData([`session`],e),n(a,{replace:!0})}catch(t){if(t instanceof lg&&t.body.code===`TWO_FACTOR_REQUIRED`){g(d===`otp`?t.message:null),f(`otp`),m(``);return}f(`password`),m(``),u(``),g(t instanceof lg&&(t.status===401||t.status===429||t.status===404)?t.message:e(`auth.failed`))}finally{v(!1)}}let C=cg.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)(ZC,{}),(0,b.jsx)(XC,{})]}),(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:[C&&(0,b.jsx)(`img`,{src:C,alt:``,className:`size-10 rounded-md object-contain`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:Dw(t)}),(0,b.jsx)(`h1`,{id:`login-title`,className:`text-xl font-semibold`,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)(kh,{htmlFor:`login-otp`,children:e(`auth.otp`)}),(0,b.jsx)(Oh,{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)(kh,{htmlFor:`login-username`,children:e(`auth.username`)}),(0,b.jsx)(Oh,{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)(kh,{htmlFor:`login-password`,children:e(`auth.password`)}),(0,b.jsx)(Oh,{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 kw=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 xg||(this.problems=[...this.problems,this.options.describe(n.name,Eg(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 Aw({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 kw({send:(e,t)=>Q.upload(e,{resource:o.current.resource,field:o.current.field.name},t),check:e=>Og(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 jw({resource:e,field:t,value:n,onChange:r,onBusy:i}){let a=t.file?.many===!0,o=wS(n),s=(0,y.useRef)(o);s.current=o;let c=Aw({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(jg(o,e,t)),cancel:e=>c.cancel(e),previewOf:e=>e.url??(e.token?l.current.get(e.token):void 0)}}function Mw(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 Nw({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:W(`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)(Vb,{}),n]}),!r&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[o(u?`upload.dropMany`:`upload.drop`),t.file&&` · ${o(`upload.limit`,{max:Ag(t.file.maxBytes)})}`]})]})}function Pw({upload:e,onCancel:t,className:n}){let r=X(),i=Math.round(e.progress*100);return(0,b.jsxs)(`div`,{className:W(`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)(rx,{})})]})}function Fw({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 Iw(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}=jw(e),p=Mw(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:W(`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)(Gv,{className:`size-4 shrink-0 cursor-grab text-muted-foreground`,"aria-hidden":!0}):(0,b.jsx)(zv,{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:Ag(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)(V_,{})}),(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)(L_,{})})]}),(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)(rx,{})})]},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)(Pw,{upload:e,onCancel:()=>f(e.id)})]},`pending-${e.id}`))]}),(0,b.jsx)(Nw,{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)(Fw,{problems:c})]})}function Lw(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}=jw(e),m=Mw(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:W(`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)(Zv,{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)(rx,{})}),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)(hv,{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)(_v,{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)(Pw,{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)(Nw,{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)(Fw,{problems:c})]})}function Rw({className:e,...t}){return(0,b.jsx)(`textarea`,{"data-slot":`textarea`,className:W(`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 zw({id:e,field:t,value:n,onChange:r,aria:i}){return(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(Oh,{id:e,type:`text`,inputMode:`decimal`,dir:`ltr`,className:`text-end`,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),onBlur:()=>r(cx(n,t.scale)),...i}),t.currency&&(0,b.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.currency})]})}function Bw({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:W(`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:W(`block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-4 rtl:-translate-x-4`:`translate-x-0`)})})}function Vw({id:e,field:t,value:n,onChange:r,aria:i,label:a,required:o}){let s=X(),c=(t.enumValues??[]).map(e=>[e,YS(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 Hw=/^#[0-9a-f]{6}$/i;function Uw({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:Hw.test(n)?n.toLowerCase():`#000000`,onChange:e=>r(e.target.value)}),(0,b.jsx)(Oh,{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 Ww({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)(Rw,{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 Gw({id:e,field:t,value:n,onChange:r,aria:i}){return(0,b.jsx)(Rw,{id:e,rows:4,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),...i})}function Kw({id:e,field:t,value:n,onChange:r,aria:i,...a}){return(0,b.jsx)(Oh,{id:e,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),...a,...i})}var qw=(0,y.lazy)(()=>Xa(()=>import(`./rich-text-input-VQ88acdQ.js`),__vite__mapDeps([0,1]),import.meta.url));function Jw(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)(qw,{...e})})}var Yw=`h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive`;function Xw({resource:e,field:t,value:n,required:r,errors:i,constraints:a,formValues:o,onChange:s,onBusy:c,idPrefix:l=`field`}){let u=`${l}-${t.name}`,d=`${u}-error`,f=`${u}-help`,p=(i?.length??0)>0,m=[t.help?f:void 0,p?d:void 0].filter(Boolean).join(` `)||void 0,h={"aria-invalid":p?!0:void 0,"aria-describedby":m},g=typeof n==`string`?n:``,_=t.type===`relation`?void 0:JS(t,a),v=(0,b.jsxs)(b.Fragment,{children:[t.label,r&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`text-destructive`,children:`*`})]}),y=(0,b.jsx)(kh,{htmlFor:u,children:v}),x=t.help?(0,b.jsx)(`p`,{id:f,className:`text-sm text-muted-foreground`,children:t.help}):null,S={id:u,field:t,value:g,onChange:e=>s(e),aria:h};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:[_===`switch`?(0,b.jsx)(Bw,{id:u,checked:e,onChange:s,aria:h}):(0,b.jsx)(`input`,{id:u,type:`checkbox`,className:`size-4 accent-primary`,checked:e,onChange:e=>s(e.target.checked),...h}),y]}),x,(0,b.jsx)(Qw,{id:d,errors:i})]})}if(t.type===`enum`&&_===`radio`)return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(Vw,{...S,label:v,required:r}),x,(0,b.jsx)(Qw,{id:d,errors:i})]});let C;if(t.type===`relation`)C=(0,b.jsx)(gS,{id:u,resource:e,field:t,value:n??null,onChange:s,clearable:t.nullable,values:o,invalid:p,describedBy:m});else if(t.type===`enum`)C=(0,b.jsxs)(`select`,{id:u,className:Yw,value:g,onChange:e=>s(e.target.value),...h,children:[(0,b.jsx)(`option`,{value:``,children:t.placeholder??`—`}),t.enumValues?.map(e=>(0,b.jsx)(`option`,{value:e,children:YS(t,e)},e))]});else switch(_){case`file`:C=(0,b.jsx)(Iw,{id:u,resource:e,field:t,value:n,onChange:s,onBusy:c,aria:h});break;case`image`:C=(0,b.jsx)(Lw,{id:u,resource:e,field:t,value:n,onChange:s,onBusy:c,aria:h});break;case`richtext`:C=(0,b.jsx)(Jw,{id:u,resource:e,field:t,value:g,onChange:s,onBusy:c,invalid:p,describedBy:m});break;case`money`:C=(0,b.jsx)(zw,{...S});break;case`date`:C=(0,b.jsx)(lS,{id:u,live:!0,value:g,label:t.label,onChange:e=>s(e),...h});break;case`datetime`:C=(0,b.jsx)(pS,{id:u,value:g,label:t.label,onChange:e=>s(e),...h});break;case`json`:C=(0,b.jsx)(Ww,{...S});break;case`textarea`:C=(0,b.jsx)(Gw,{...S});break;case`color`:C=(0,b.jsx)(Uw,{...S});break;case`password`:C=(0,b.jsx)(Kw,{...S,type:`password`,autoComplete:`new-password`});break;case`slug`:C=(0,b.jsx)(Kw,{...S,dir:`ltr`,autoCapitalize:`none`,spellCheck:!1});break;default:C=(0,b.jsx)(Kw,{...S,...Zw(t,_)})}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[y,C,x,(0,b.jsx)(Qw,{id:d,errors:i})]})}function Zw(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 Qw({id:e,errors:t}){return t?.length?(0,b.jsx)(`p`,{id:e,className:`text-sm text-destructive`,children:t.join(` `)}):null}var $w={1:``,2:`md:grid-cols-2`,3:`md:grid-cols-2 lg:grid-cols-3`};function eT({layout:e,names:t,render:n,errors:r}){let i=new Set((e??[]).flatMap(e=>`tab`in e?e.sections:[e]).flatMap(e=>e.fields)),a=t.filter(e=>!i.has(e)),o=(e??[]).filter(e=>`tab`in e),s=(e??[]).findIndex(e=>`tab`in e),c=s===-1?(e??[]).filter(e=>!(`tab`in e)):(e??[]).slice(0,s).filter(e=>!(`tab`in e)),l=s===-1?[]:(e??[]).slice(s).filter(e=>!(`tab`in e));return(0,b.jsxs)(b.Fragment,{children:[c.map((e,t)=>(0,b.jsx)(tT,{section:e,render:n},`b${t}`)),o.length>0&&(0,b.jsx)(nT,{tabs:o,render:n,errors:r}),l.map((e,t)=>(0,b.jsx)(tT,{section:e,render:n},`a${t}`)),a.length>0&&(0,b.jsx)(tT,{section:{fields:a,columns:1},render:n})]})}function tT({section:e,render:t}){let n=(0,y.useId)(),r=e.fields.map(e=>[e,t(e)]).filter(([,e])=>e!==null);if(r.length===0)return null;let i=(0,b.jsx)(`div`,{className:W(`grid gap-5`,$w[e.columns]),children:r.map(([e,t])=>(0,b.jsx)(`div`,{className:`min-w-0`,children:t},e))});return e.title?(0,b.jsxs)(`section`,{"aria-labelledby":n,className:`flex flex-col gap-4`,children:[(0,b.jsx)(`h2`,{id:n,className:`border-b pb-1.5 text-sm font-semibold text-muted-foreground`,children:e.title}),i]}):i}function nT({tabs:e,render:t,errors:n}){let r=X(),{locale:i}=Y(),a=(0,y.useId)(),[o,s]=(0,y.useState)(0),c=(0,y.useRef)([]),l=e=>e.sections.some(e=>e.fields.some(e=>Object.keys(n).some(t=>t===e||t.startsWith(`${e}.`))));(0,y.useEffect)(()=>{if(l(e[o]))return;let t=e.findIndex(l);t!==-1&&s(t)},[n]);function u(t){let n=Xh(i)?`ArrowLeft`:`ArrowRight`,r=Xh(i)?`ArrowRight`:`ArrowLeft`,a;t.key===n?a=(o+1)%e.length:t.key===r?a=(o-1+e.length)%e.length:t.key===`Home`?a=0:t.key===`End`&&(a=e.length-1),a!==void 0&&(t.preventDefault(),s(a),c.current[a]?.focus())}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`div`,{role:`tablist`,className:`flex gap-1 overflow-x-auto border-b`,onKeyDown:u,children:e.map((e,t)=>(0,b.jsxs)(`button`,{ref:e=>{c.current[t]=e},id:`${a}-tab-${t}`,type:`button`,role:`tab`,"aria-selected":t===o,"aria-controls":`${a}-panel-${t}`,tabIndex:t===o?0:-1,onClick:()=>s(t),className:W(`-mb-px flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,t===o?`border-primary font-medium`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e.tab,l(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:r(`form.tabHasErrors`)})]})]},t))}),e.map((e,n)=>(0,b.jsx)(`div`,{id:`${a}-panel-${n}`,role:`tabpanel`,"aria-labelledby":`${a}-tab-${n}`,hidden:n!==o,className:W(`flex-col gap-5`,n===o?`flex`:`hidden`),children:e.sections.map((e,n)=>(0,b.jsx)(tT,{section:e,render:t},n))},n))]})}var rT=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{};function iT({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)(aT,{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)(Lb,{}),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,NS(t.fields??[])]),children:[(0,b.jsx)(Yy,{}),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)(aT,{resource:e,field:t,path:n,pattern:r,value:rT(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 aT({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)(iT,{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)(Xw,{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 oT(e,t){let n=t?._perm?.actions;return e.actions.filter(e=>e.target===`record`&&(n===void 0||n.includes(e.name)))}function sT(e,t){let n=e.actions.filter(e=>e.target===`record`&&e.bulk);return t.length===0?n:n.filter(n=>t.some(t=>oT(e,t).includes(n)))}function cT(e){return e.actions.filter(e=>e.target===`resource`)}function lT(e,t=0){return e.confirm!==void 0||e.variant===`destructive`||t>1}function uT(e,t=0){return!e.input&&!lT(e,t)}function dT(e,t,n,r){if(lT(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 fT(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 pT(e,t){return e.kind===`bulk`?e.result:{ok:t,failed:[]}}function mT(e,t){if(!(e instanceof lg))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(` — `)}}function hT(e,t){let n=SS(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(Nh(n).trim().replace(/,/g,``))===t:n===t}function gT(e,t){return!e.showIf||Object.entries(e.showIf).every(([e,n])=>(Array.isArray(n)?n:[n]).some(n=>hT(t[e],n)))}var _T=/^.+@[^\s@]+\.[^\s@]+$/,vT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function yT(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 bT(e,t){try{return new RegExp(t.source,t.flags).test(e)}catch{return!0}}function xT(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 ST(e,t){let n=[];if(typeof e==`string`){let r=xT(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&&!bT(e,t.pattern)&&n.push(t.pattern.message??J(`validation.pattern`)),t.format===`email`&&!_T.test(e)&&n.push(J(`validation.email`)),t.format===`url`&&!yT(e)&&n.push(J(`validation.url`)),t.format===`uuid`&&!vT.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 CT(e,t,n){let r={};for(let[i,a]of Object.entries(t))for(let{path:t,value:o,sent:s,parentSent:c}of wT(e,i.split(`.`))){if(o==null||o===``){a.required&&c&&(n===`create`||s)&&(r[t]=[J(`validation.required`)]);continue}let e=ST(o,a);e.length>0&&(r[t]=e)}return r}function wT(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)=>wT(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}]:wT(c,a,`${l}.`,r&&s)}function TT({resource:e,action:t,count:n,subject:r,running:i,error:a,onRun:o,onClose:s}){let c=X(),l=t.input?.fields??[],[u,d]=(0,y.useState)(()=>NS(l)),[f,p]=(0,y.useState)({}),[m,h]=(0,y.useState)(!1),g=l.filter(e=>gT(e,u)),_=a&&!m?mT(a,l.map(e=>e.name)):{fields:{},form:null},v={..._.fields,...f};function x(e){if(e.preventDefault(),e.stopPropagation(),!t.input)return o(void 0);let{payload:n,errors:r}=FS(g,u),i={...CT(n,Object.fromEntries(Object.entries(t.input.constraints).filter(([e])=>g.some(t=>t.name===e.split(`.`)[0]))),`create`),...r};p(i),h(Object.keys(i).length>0),Object.keys(i).length===0&&o(n)}let S=dT(t,n,r,c);function C(n){let r=g.find(e=>e.name===n);if(!r||!t.input)return null;let i=e=>d(t=>({...t,[n]:e}));return r.type===`object`?(0,b.jsx)(iT,{resource:e,field:r,path:n,pattern:n,value:u[n],constraints:t.input.constraints,markRequired:!0,errors:v,idPrefix:`action`,onChange:i}):(0,b.jsx)(Xw,{resource:e,field:r,value:u[n],required:t.input.required.includes(n),errors:v[n],constraints:t.input.constraints[n],idPrefix:`action`,onChange:i})}return(0,b.jsx)(jd,{open:!0,onOpenChange:e=>!e&&!i&&s(),children:(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:`fixed inset-0 z-40 bg-black/30`}),(0,b.jsx)(Ud,{"aria-describedby":S?`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:x,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)(Jd,{className:`text-lg font-semibold`,children:t.label}),S&&(0,b.jsx)(`p`,{id:`action-question`,className:`text-sm`,children:S}),n>1&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(t.atomic?`action.atomicNote`:`action.eachNote`,{count:n})}),_.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:_.form}),t.input&&(0,b.jsx)(eT,{layout:void 0,names:l.map(e=>e.name),errors:v,render:C})]}),(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 ET({resource:e,action:t,ids:n,subject:r,size:i=`default`,blocked:a=!1,describedBy:o,onDone:s}){let c=X(),l=S(),[u,d]=(0,y.useState)(!1),f=uT(t,n?.length??0),p=pt({mutationFn:r=>Q.runAction(e,t.name,{...n?{ids:n}:{},...r?{input:r}:{}}),onSuccess:r=>{let i=fT(r);d(!1),i.kind===`bulk`?i.message&&bw(i.message):bw(i.message??c(i.kind===`record`&&i.record===null?`action.doneGone`:`action.done`,{action:t.label})),s(i,n??[]);for(let t of[`list`,`count`,`record`,`history`])l.invalidateQueries({queryKey:[t,e]})},onError:e=>{f&&bw(ug(e),`error`)}}),m=dw(t.icon);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(q,{type:`button`,size:i,variant:t.variant===`destructive`?`destructive`:`outline`,disabled:a||p.isPending,"aria-describedby":o,"data-action":t.name,onClick:()=>{p.reset(),f?p.mutate(void 0):d(!0)},children:[m&&(0,b.jsx)(m,{"aria-hidden":!0}),t.label]}),u&&(0,b.jsx)(TT,{resource:e,action:t,count:n?.length??0,subject:r,running:p.isPending,error:p.error,onRun:e=>p.mutate(e),onClose:()=>d(!1)})]})}function DT({schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a}){let o=X(),s=S(),c=oT(e,t);if(c.length===0)return null;let l=`record-actions-note`;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:l,className:`text-xs text-muted-foreground`,children:o(`action.saveFirst`)}),c.map(o=>(0,b.jsx)(ET,{resource:e.name,action:o,ids:[n],subject:typeof t._title==`string`?t._title:`#${n}`,blocked:r,describedBy:r?l:void 0,onDone:t=>{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))]})}function OT(e){let t=(0,y.useRef)(!1),n=ha(({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 kT({blocker:e}){let t=X();return e.state===`blocked`?(0,b.jsxs)(`div`,{role:`alertdialog`,"aria-labelledby":`leave-title`,className:`sticky top-2 z-10 flex flex-wrap items-center gap-2 rounded-md border border-amber-500/50 bg-background p-3 shadow-sm`,children:[(0,b.jsx)(`p`,{id:`leave-title`,className:`flex-1 text-sm font-medium`,children:t(`form.leaveTitle`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,autoFocus:!0,onClick:()=>e.reset(),children:t(`form.stay`)}),(0,b.jsx)(q,{type:`button`,variant:`destructive`,onClick:()=>e.proceed(),children:t(`form.leave`)})]}):null}function AT(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 jT(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)}}var MT=(e,t)=>t===void 0?[`history`,e]:[`history`,e,t];function NT({schema:e,id:t,record:n}){let r=X(),i=zg(),a=mt({queryKey:MT(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)(G,{children:r(`common.loading`)});if(a.isError&&!a.data)return(0,b.jsx)(G,{tone:`error`,children:ug(a.error)});let o=a.data.pages.flatMap(e=>e.entries);if(o.length===0)return(0,b.jsx)(G,{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)(Fx,{entries:o,now:new Date(a.dataUpdatedAt),names:fx(i.data,s),schemaOf:s,titleOf:(e,t)=>PT(n,e,t)}),a.isError&&(0,b.jsx)(G,{tone:`error`,children:ug(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 PT(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}var FT=3;function IT({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,FT);return(0,b.jsxs)(`span`,{className:W(`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:W(`rounded-md border bg-muted object-cover`,n?`size-24`:`size-8`)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(zv,{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:Ag(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 LT={gray:`bg-muted text-muted-foreground`,red:`bg-red-500/15 text-red-700 dark:text-red-300`,amber:`bg-amber-500/15 text-amber-800 dark:text-amber-300`,green:`bg-green-500/15 text-green-800 dark:text-green-300`,blue:`bg-blue-500/15 text-blue-800 dark:text-blue-300`,purple:`bg-purple-500/15 text-purple-800 dark:text-purple-300`,pink:`bg-pink-500/15 text-pink-800 dark:text-pink-300`};function RT({value:e,field:t,className:n}){if(e==null)return(0,b.jsx)(b.Fragment,{children:lx(e,t)});let r=t.colors?.[String(e)]??`gray`;return(0,b.jsx)(`span`,{"data-color":r,className:W(`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap`,LT[r],n),children:lx(e,t)})}function zT({value:e,field:t,record:n,detailed:r,plain:i}){return t.file&&n?(0,b.jsx)(IT,{field:t,files:TS(n,t.name),detailed:r,plain:i}):t.widget===`badge`?(0,b.jsx)(RT,{value:e,field:t}):(0,b.jsx)(b.Fragment,{children:lx(e,t)})}function BT(e){return e.normalize(`NFKD`).replace(/\p{M}/gu,``).normalize(`NFC`).toLowerCase().replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-+|-+$/g,``)}function VT(e,t,n){let r=typeof t?._title==`string`?t._title:`#${n}`;return r.startsWith(`#`)?`${e} ${r}`:`${e}: ${r}`}function HT({mode:e}){let t=X(),{resource:n=``,id:r}=$i(),i=qi(),[a]=wo(),o=e===`create`?a.get(`from`)??void 0:void 0,s=e===`edit`?r:o,c=Bg(n),l=Ug(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)(G,{children:t(`common.loading`)});if(c.isError)return(0,b.jsx)(G,{tone:`error`,children:c.error.message});if(s!==void 0&&l.isError)return(0,b.jsx)(G,{tone:`error`,children:l.error.message});let g=i.state?.saved;return(0,b.jsx)(WT,{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 UT(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`?AS(t):t]))}function WT({schema:e,mode:t,id:n,record:r,source:i,saved:a,onChanged:o,tab:s,onTab:c}){let l=X(),u=Yi(),d=S(),f=r?._perm,p=t===`create`||e.permissions?.update!==!1&&f?.update!==!1,m=e.permissions?.delete!==!1&&f?.delete!==!1,h=new Set(t===`edit`?p?[...e.form.readonly,...qT(r)]:[...e.form.update,...e.form.readonly]:[]),g=t===`create`?e.form.create:[...e.form.update,...e.form.readonly],_=e.fields.filter(e=>g.includes(e.name)),v=_.filter(e=>!h.has(e.name)),x=v.map(e=>e.name),[C,w]=(0,y.useState)(r),[T,E]=(0,y.useState)(()=>NS(v,r??(i?UT(e,i):void 0))),[D,O]=(0,y.useState)(T),k=e.version?C?.[e.version]:void 0,[A,j]=(0,y.useState)(null),M=IS(v,D),[N,ee]=(0,y.useState)({}),[P,F]=(0,y.useState)(null),te=Rg(),ne=t===`edit`&&n!==void 0&&te.data?.audit.enabled===!0,re=ne?s:`details`,ie=(0,y.useRef)(new Set(v.filter(e=>e.widget===`slug`&&T[e.name]!==``).map(e=>e.name)));function ae(e,t){O(n=>{let r={...n,[e]:t};if(typeof t==`string`)for(let n of v)n.slugFrom===e&&!ie.current.has(n.name)&&(r[n.name]=BT(t));return r}),v.some(t=>t.name===e&&t.widget===`slug`)&&ie.current.add(e)}let[oe,se]=(0,y.useState)(a?l(`form.savedName`,{name:a}):null),ce=jT(()=>F(null)),le=JSON.stringify(D)!==JSON.stringify(T),{blocker:ue,release:de}=OT(le),fe=(0,y.useRef)(null),pe=(0,y.useRef)(`list`);AT(fe,()=>{pe.current=`stay`});let me=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})=>{d.invalidateQueries({queryKey:MT(e.name)}),await d.invalidateQueries({queryKey:[`list`,e.name]});let a=typeof r._title==`string`?r._title:`#${String(r._id)}`;if(i===`stay`&&t===`edit`){let t=NS(v,r);w(r),E(t),O(t),se(l(`form.savedName`,{name:a})),await d.invalidateQueries({queryKey:[`record`,e.name,n]});return}de(),d.removeQueries({queryKey:[`record`,e.name]}),i===`new`?u(`/${e.name}/new`,{state:{saved:a}}):i===`stay`?u(`/${e.name}/${encodeURIComponent(String(r._id))}`,{replace:!0,state:{saved:a}}):u(`/${e.name}`)},onError:e=>{if(c(`details`),!(e instanceof lg)){F(e.message);return}if(e.status===409&&e.body.current){j(e.body.current);return}let t=mT(e,x);ee(t.fields),F(t.form)}}),[I,L]=(0,y.useState)(!1),he=pt({mutationFn:()=>Q.remove(e.name,n,k),onSuccess:async()=>{de(),await d.invalidateQueries({queryKey:[`list`,e.name]}),u(`/${e.name}`),d.removeQueries({queryKey:[`record`,e.name,n]})},onError:e=>{L(!1),F(ug(e))}}),ge=v.filter(e=>gT(e,D));function _e(){return FS(ge,D,t===`edit`?T:void 0)}function ve(n){if(n.preventDefault(),!p)return;let r=n.nativeEvent.submitter,i=r?.value===`new`?`new`:r?`list`:pe.current;if(pe.current=`list`,se(null),ce.busy){F(l(`upload.busy`)),ce.refuse();return}let{payload:a,errors:o}=_e(),s=t===`create`?`create`:`update`,u={...CT(a,Object.fromEntries(Object.entries(e.form.constraints[s]).filter(([e])=>ge.some(t=>t.name===e.split(`.`)[0]))),s),...o};ee(u),F(null),Object.keys(u).length===0?me.mutate({payload:a,version:k,then:i}):c(`details`)}function ye(t){j(null),me.mutate({payload:_e().payload,version:e.version?t[e.version]:void 0,then:me.variables?.then??`list`})}function be(e){let t=NS(v,e);j(null),w(e),E(t),O(t),ee({})}function xe(n){let i=_.find(e=>e.name===n);if(!i||!gT(i,D))return null;if(h.has(n))return(0,b.jsx)(JT,{resource:e.name,field:i,record:r});let a=t===`create`?`create`:`update`;return i.type===`object`?(0,b.jsx)(iT,{resource:e.name,field:i,path:i.name,pattern:i.name,value:D[i.name],constraints:e.form.constraints[a],markRequired:t===`create`,errors:N,onChange:e=>ae(i.name,e)}):(0,b.jsx)(Xw,{resource:e.name,field:i,value:D[i.name],required:t===`create`&&e.form.requiredOnCreate.includes(i.name),errors:N[i.name],formValues:i.type===`relation`?M:void 0,constraints:e.form.constraints[a][i.name],onChange:e=>ae(i.name,e),onBusy:e=>ce.setBusy(i.name,e)})}return(0,b.jsxs)(`form`,{ref:fe,onSubmit:ve,noValidate:!0,className:W(`flex flex-col gap-5`,e.form.layout?.length?`max-w-4xl`:`max-w-2xl`),children:[t===`create`?(0,b.jsx)(`h1`,{className:`text-xl font-semibold`,children:l(`form.new`,{name:e.label})}):(0,b.jsx)(YT,{schema:e,record:r,id:n,dirty:le,onGone:()=>{de(),u(`/${e.name}`)},onChanged:o}),!p&&(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`)}),oe&&(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:oe}),(0,b.jsx)(kT,{blocker:ue}),ne&&(0,b.jsx)(KT,{active:re,onChange:c}),A&&(0,b.jsx)(XT,{fields:v,before:C,current:A,busy:me.isPending,onKeepMine:()=>ye(A),onLoadTheirs:()=>be(A)}),P&&(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:P}),ne&&re===`history`&&(0,b.jsx)(`div`,{role:`tabpanel`,id:`record-panel-history`,"aria-labelledby":`record-tab-history`,children:(0,b.jsx)(NT,{schema:e,id:n,record:r})}),(0,b.jsxs)(`div`,{className:re===`details`?`contents`:`hidden`,...ne?{role:`tabpanel`,id:`record-panel-details`,"aria-labelledby":`record-tab-details`}:{},children:[(0,b.jsx)(eT,{layout:e.form.layout,names:_.map(e=>e.name),errors:N,render:xe}),(0,b.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap gap-2 border-t bg-background py-3 md:static md:border-0 md:py-0`,children:[p&&(0,b.jsx)(q,{type:`submit`,value:`list`,disabled:me.isPending||ce.busy,"aria-keyshortcuts":`Control+S Meta+S`,children:l(me.isPending?`form.saving`:`form.save`)}),p&&e.creatable&&(0,b.jsx)(q,{type:`submit`,value:`new`,variant:`outline`,disabled:me.isPending||ce.busy,children:l(`form.saveAndNew`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>u(`/${e.name}`),children:l(p?`common.cancel`:`form.back`)}),t===`edit`&&e.creatable&&(0,b.jsx)(q,{asChild:!0,variant:`outline`,children:(0,b.jsxs)(bo,{to:`/${e.name}/new?${new URLSearchParams({from:n})}`,children:[(0,b.jsx)(Cv,{}),l(`form.duplicate`)]})}),t===`edit`&&m&&(I?(0,b.jsxs)(`div`,{className:`ms-auto flex gap-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`destructive`,disabled:he.isPending,onClick:()=>he.mutate(),children:l(he.isPending?`form.deleting`:e.softDelete?`form.confirmMoveToTrash`:`form.confirmDelete`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>L(!1),children:l(`form.keep`)})]}):(0,b.jsx)(q,{type:`button`,variant:`outline`,className:`ms-auto`,onClick:()=>L(!0),children:l(e.softDelete?`form.moveToTrash`:`form.delete`)}))]}),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)(bo,{to:`/${t.resource}?${new URLSearchParams({[`filter[${t.field}][${t.operator}]`]:String(r[e.primaryKeys[0]])})}`,children:t.label})})},`${t.resource}:${t.field}`))})]})]})]})}var GT=[`details`,`history`];function KT({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-1 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:GT.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:W(`-mb-px border-b-2 px-3 py-2 text-sm whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,i===e?`border-primary font-medium`:`border-transparent text-muted-foreground hover:text-foreground`),children:n(i===`details`?`audit.details`:`audit.history`)},i))})}var qT=e=>Array.isArray(e?._readonly)?e._readonly:[];function JT({resource:e,field:t,record:n}){let r=X(),i=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:`flex items-center gap-1.5 text-sm font-medium`,children:[t.label,(0,b.jsx)(_y,{className:`size-3.5 text-muted-foreground`,"aria-label":r(`form.readOnly`),role:`img`})]}),(0,b.jsx)(`div`,{className:`min-h-8 rounded-lg bg-muted/50 px-2.5 py-1.5 text-sm break-words`,children:t.widget===`richtext`&&typeof i==`string`&&i!==``?(0,b.jsx)(Jw,{id:`field-${t.name}`,resource:e,field:t,value:i,readOnly:!0}):(0,b.jsx)(zT,{value:i,field:t,record:n,detailed:!0})}),t.help&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.help})]})}function YT({schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a}){let o=X(),s=e.fields.filter(e=>e.widget===`badge`&&t?.[e.name]!==void 0&&t?.[e.name]!==null),c=Array.isArray(t?._links)?t._links:[];return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h1`,{className:`text-xl font-semibold`,children:VT(e.label,t,n)}),s.map(e=>(0,b.jsx)(RT,{value:t[e.name],field:e},e.name)),t&&n!==void 0&&(0,b.jsx)(DT,{schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a})]}),c.length>0&&(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-sm`,children:c.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":o(`form.externalLink`,{name:e.label}),children:[e.label,(0,b.jsx)(Nv,{className:`size-3.5 rtl:-scale-x-100`,"aria-hidden":!0})]})},`${e.label}:${e.href}`))})]})}function XT({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)(`div`,{role:`alertdialog`,"aria-labelledby":`conflict-title`,"aria-describedby":`conflict-body`,className:`flex flex-col gap-3 rounded-md border border-amber-500/50 bg-amber-500/10 p-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:lx(t?.[e.name],e)}),` → `,lx(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`,onClick:a,children:o(`form.loadTheirs`)})]})]})}function ZT(){let{t:e}=Y(),{group:t}=$i(),n=zg();if(n.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});if(n.isError)return(0,b.jsx)(G,{tone:`error`,children:n.error.message});let r=n.data.groups.find(e=>e.key===t);return r?(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`h1`,{className:`text-xl font-semibold`,children:r.label}),(0,b.jsx)($T,{group:r})]}):(0,b.jsx)(G,{children:e(`common.pageNotFound`)})}function QT({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)(bo,{to:`/g/${e.key}`,className:`hover:underline`,children:e.label})}),(0,b.jsx)($T,{group:e})]},e.key))})}function $T({group:e}){return(0,b.jsxs)(b.Fragment,{children:[e.resources.length>0&&(0,b.jsx)(nE,{resources:e.resources}),e.pages.length>0&&(0,b.jsx)(tE,{pages:e.pages})]})}var eE=`flex items-center gap-3 rounded-lg border p-4 hover:bg-muted/50`;function tE({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=uw(e.icon,`page`);return(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{to:`/p/${e.name}`,className:eE,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 nE({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=uw(e.icon,`resource`),o=r[i]?.data,s=o&&o.total!==null?t(o.estimated?`shell.aboutRecords`:`shell.records`,{count:Qh(o.total,n)}):void 0;return(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{to:`/${e.name}`,className:eE,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)})})}function rE(){let e=X(),t=zg();return t.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):t.isError?(0,b.jsx)(G,{tone:`error`,children:t.error.message}):t.data.groups.length===0?(0,b.jsx)(G,{children:e(`shell.noResources`)}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`h1`,{className:`text-xl font-semibold`,children:t.data.title}),(0,b.jsx)(QT,{groups:t.data.groups})]})}var iE={order:[],hidden:[],widths:{},density:`comfortable`},aE=e=>`nma.columns.${e}`;function oE(e,t){return sE(e,t).filter(e=>!t.hidden.includes(e))}function sE(e,t){let n=t.order.filter(t=>e.includes(t));return[...n,...e.filter(e=>!n.includes(e))]}function cE(e){let t=new Map,n=new Set,r=n=>{let r=t.get(n);if(!r){r=iE;try{let t=e?.getItem(aE(n));t&&(r={...iE,...JSON.parse(t)})}catch{r=iE}t.set(n,r)}return r},i=(r,i)=>{t.set(r,i);try{e?.setItem(aE(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=sE(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(aE(r))}catch{}t.set(r,iE);for(let e of n)e()}}}function lE(){try{return typeof localStorage>`u`?void 0:localStorage}catch{return}}var uE=cE(lE());function dE(e){return(0,y.useSyncExternalStore)(uE.subscribe,()=>uE.get(e))}function fE({schema:e,prefs:t}){let n=X(),r=sE(e.list.columns,t),i=t=>e.fields.find(e=>e.name===t)?.label??t,a=r.filter(e=>!t.hidden.includes(e));return(0,b.jsxs)(Sh,{children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsxs)(q,{variant:`outline`,className:`hidden md:inline-flex`,children:[(0,b.jsx)(xv,{}),n(`list.columns`)]})}),(0,b.jsx)(wh,{children:(0,b.jsxs)(Th,{align:`end`,sideOffset:4,className:`z-50 flex w-72 flex-col gap-3 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md`,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)(ff,{checked:c,disabled:c&&a.length===1,onCheckedChange:()=>uE.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)(dv,{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:()=>uE.move(e.name,e.list.columns,o,-1),children:(0,b.jsx)(V_,{})}),(0,b.jsx)(q,{variant:`ghost`,size:`icon-sm`,"aria-label":n(`list.moveDown`,{name:i(o)}),disabled:s===r.length-1,onClick:()=>uE.move(e.name,e.list.columns,o,1),children:(0,b.jsx)(L_,{})})]},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:()=>uE.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:()=>uE.reset(e.name),children:n(`list.resetColumns`)})]})})]})}function pE({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:W(`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);uE.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;uE.setWidth(e,t,i+(o?10:-10))},onClick:e=>e.stopPropagation()})}var mE=`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 hE({schema:e,item:t,field:n}){let r=X(),i=S(),[a,o]=(0,y.useState)(!1),s=NS([n],t)[n.name],[c,l]=(0,y.useState)(s),[u,d]=(0,y.useState)(null),f=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 lg?e.fields[n.name]?.join(` `)??e.message:e.message),l(s),o(!1)}});function p(t=c){if(t===s){o(!1);return}let{payload:r,errors:i}=FS([n],{[n.name]:t},{[n.name]:s}),a=CT(r,{[n.name]:e.form.constraints.update[n.name]??{}},`update`),l=i[n.name]??a[n.name];if(l){d(l.join(` `));return}f.mutate(r)}let m=e=>{e.key===`Enter`?(e.preventDefault(),p()):e.key===`Escape`&&(e.preventDefault(),l(s),d(null),o(!1))},h=`cell-${e.name}-${String(t._id)}-${n.name}-error`,g={"aria-label":n.label,"aria-invalid":u?!0:void 0,"aria-describedby":u?h:void 0,autoFocus:!0,disabled:f.isPending,className:mE,onKeyDown:m},_;if(!a)_=(0,b.jsx)(`button`,{type:`button`,className:W(`-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:lx(t[n.name],n)}),onClick:()=>{l(s),o(!0)},children:(0,b.jsx)(zT,{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,YS(n,e)]);_=(0,b.jsxs)(`select`,{...g,value:String(c),onChange:e=>{let t=n.type===`boolean`?e.target.value===`true`:e.target.value;l(t),p(t)},onBlur:()=>o(!1),children:[n.nullable&&n.type===`enum`&&(0,b.jsx)(`option`,{value:``,children:r(`common.empty`)}),e.map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))]})}else if(n.type===`date`)_=(0,b.jsx)(lS,{id:`cell-${e.name}-${String(t._id)}-${n.name}`,label:n.label,value:String(c),onChange:e=>{l(e),p(e)},autoFocus:!0,"aria-invalid":u?!0:void 0,"aria-describedby":u?h:void 0,className:`min-w-44`,onKeyDown:m});else{let e=n.type===`number`||n.type===`decimal`||n.type===`bigint`;_=(0,b.jsx)(`input`,{...g,type:`text`,inputMode:e?n.type===`bigint`?`numeric`:`decimal`:void 0,value:String(c),onChange:e=>l(e.target.value),onBlur:()=>p()})}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-0.5`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[_,u&&(0,b.jsx)(`p`,{id:h,role:`alert`,className:`text-xs text-destructive`,children:u})]})}var gE=e=>e.total===null?e.hasMore===!0:e.page*e.pageSize<e.total;function _E({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:gE(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`,children:[d.isPending&&Array.from({length:4},(e,t)=>(0,b.jsx)(`li`,{"aria-hidden":!0,className:`h-20 animate-pulse rounded-lg border bg-muted/40`},`skeleton-${t}`)),p.map(t=>{let o=String(t._id),c=(0,b.jsx)(vE,{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-lg border p-3`,children:[c,s(t)]}):i?(0,b.jsxs)(`label`,{className:W(`flex cursor-pointer items-start gap-3 rounded-lg border p-3`,a.has(o)&&`border-primary bg-primary/5`),children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`mt-1 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)(bo,{to:`/${e.name}/${encodeURIComponent(o)}`,className:`block rounded-lg border p-3 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:Qh(p.length)}):l(`list.showingOf`,{shown:Qh(p.length),total:Qh(m)})}),g&&(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:_,onClick:()=>void v(),children:l(_?`common.loading`:`list.loadMore`)})]})]})}function vE({schema:e,item:t,columns:n}){let r=e.list.mobile,i=typeof t._title==`string`?t._title:String(t._id);if(!r)return(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`div`,{className:`font-medium`,children:i}),(0,b.jsx)(`dl`,{className:`mt-1 grid grid-cols-2 gap-x-3 gap-y-0.5 text-sm`,children:n.filter(e=>lx(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)(zT,{value:t[e.name],field:e,record:t,plain:!0})})]},e.name))})]});let a=t=>t?e.fields.find(e=>e.name===t):void 0,o=a(r.title),s=a(r.subtitle),c=a(r.badge),l=r.meta.map(a).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 font-medium`,children:o?lx(t[o.name],o):i}),c&&t[c.name]!==null&&t[c.name]!==void 0&&(0,b.jsx)(RT,{value:t[c.name],field:c,className:`shrink-0`})]}),s&&(0,b.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:lx(t[s.name],s)}),l.length>0&&(0,b.jsx)(`dl`,{className:`mt-1 flex flex-wrap gap-x-4 gap-y-0.5 text-sm`,children:l.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)(zT,{value:t[e.name],field:e,record:t,plain:!0})})]},e.name))})]})}function yE({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=Ug(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)(jd,{open:t!==void 0,onOpenChange:e=>!e&&n(),children:(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:`fixed inset-0 z-40 bg-black/30`}),(0,b.jsxs)(Ud,{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)(Jd,{className:`min-w-0 flex-1 truncate text-lg font-semibold`,children:r(`list.quickView`,{name:s})}),(0,b.jsx)(Xd,{asChild:!0,children:(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":r(`list.close`),children:(0,b.jsx)(rx,{})})})]}),(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)(zT,{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)(bo,{to:`/${e.name}/${encodeURIComponent(a??``)}`,children:[(0,b.jsx)(Vy,{}),r(`list.edit`)]})}),(0,b.jsx)(Xd,{asChild:!0,children:(0,b.jsx)(q,{variant:`outline`,children:r(`list.close`)})})]})]})]})})}function bE({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:W(`w-full caption-bottom text-sm`,e),...t})})}function xE({className:e,...t}){return(0,b.jsx)(`thead`,{"data-slot":`table-header`,className:W(`[&_tr]:border-b`,e),...t})}function SE({className:e,...t}){return(0,b.jsx)(`tbody`,{"data-slot":`table-body`,className:W(`[&_tr:last-child]:border-0`,e),...t})}function CE({className:e,...t}){return(0,b.jsx)(`tr`,{"data-slot":`table-row`,className:W(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function wE({className:e,...t}){return(0,b.jsx)(`th`,{"data-slot":`table-head`,className:W(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function TE({className:e,...t}){return(0,b.jsx)(`td`,{"data-slot":`table-cell`,className:W(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}function EE(e){let t=e.map(e=>String(e).replace(/~/g,`~0`).replace(/,/g,`~1`)).join(`,`);return t===`new`?`~new`:t}function DE(){let{resource:e=``}=$i(),[t,n]=wo(),r=Math.max(1,Number(t.get(`page`))||1),i=t.get(`sort`)??void 0,a=Bg(e),o=qS(),s=Hg(e,zS(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=dE(e),h=zS(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)(G,{children:d(`common.loading`)});if(a.isError)return(0,b.jsx)(G,{tone:`error`,children:a.error.message});let M=a.data,N=oE(M.list.columns,m).map(e=>M.fields.find(t=>t.name===e)).filter(e=>e!==void 0),ee=N.filter(e=>!M.primaryKeys.includes(e.name)),P=i?{field:i.replace(/^-/,``),direction:i.startsWith(`-`)?`desc`:`asc`}:M.list.defaultSort,F=s.data?.items??[],te=M.list.pagination===`keyset`,ne=t.get(`after`),re=te?{summary:WS(s.data,1).summary,label:d(`list.page`,{page:k.length+1}),hasNext:!!s.data?.nextCursor}:WS(s.data,r),ie=te?k.length>0:r>1;function ae(){if(!te)return de({page:String(r+1)});A([...k,ne??``]),de({after:s.data?.nextCursor??null})}function oe(){if(!te)return de({page:String(r-1)});let e=k[k.length-1];A(k.slice(0,-1)),de({after:e||null})}let se=M.permissions??{create:!0,update:!0,delete:!0,purge:!0},ce=!p&&(se.delete||sT(M,[]).length>0),le=sT(M,F.filter(e=>_.has(String(e._id)))),ue=e=>`/${M.name}/${encodeURIComponent(String(e._id))}`;function de(e){n(t=>US(t,e))}function fe(e){de({sort:P.field===e&&P.direction===`asc`?`-${e}`:e})}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`h1`,{className:`text-xl font-semibold`,children:M.label}),(0,b.jsx)(`div`,{className:`ms-auto`}),(0,b.jsx)(fE,{schema:M,prefs:m}),M.softDelete&&se.delete&&(0,b.jsxs)(q,{variant:p?`secondary`:`outline`,"aria-pressed":p,onClick:()=>de({trashed:p?null:`only`}),children:[(0,b.jsx)(Lb,{}),d(`list.trash`)]}),o&&ce&&(0,b.jsxs)(q,{variant:c?`secondary`:`outline`,"aria-pressed":c,onClick:()=>{l(!c),v(new Set)},children:[(0,b.jsx)(py,{}),d(c?`list.done`:`list.select`)]}),!p&&cT(M).map(e=>(0,b.jsx)(ET,{resource:M.name,action:e,onDone:()=>void 0},e.name)),M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/${M.name}/new`,children:[(0,b.jsx)(Yy,{}),d(`list.new`)]})})]}),(0,b.jsx)(QS,{schema:M,params:t,onChange:de}),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`),` `,ug(s.error)]}),(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void s.refetch(),children:d(`list.retry`)})]}),f.isError&&(0,b.jsx)(G,{tone:`error`,children:ug(f.error)}),p&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d(`list.trashNote`)}),ce&&_.size>0&&(0,b.jsxs)(`div`,{role:`region`,"aria-label":d(`list.selected`,{count:_.size}),className:`flex flex-wrap items-center gap-2 rounded-lg border bg-muted/40 px-3 py-2 text-sm`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:d(`list.selected`,{count:_.size})}),le.map(e=>(0,b.jsx)(ET,{resource:M.name,action:e,ids:[..._],size:`sm`,onDone:(t,n)=>{let r=pT(t,n);v(new Set),O.reset(),D({title:d(`action.bulkDone`,{action:e.label,count:r.ok.length}),result:r})}},e.name)),se.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:`sm`,onClick:()=>T(!0),children:[(0,b.jsx)(Lb,{}),d(`list.deleteSelected`)]}):null,(0,b.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>v(new Set),children:d(`list.clearSelection`)})]}),E&&(0,b.jsx)(AE,{title:E.title,result:E.result,items:F}),O.isError&&(0,b.jsx)(G,{tone:`error`,children:ug(O.error)}),o?(0,b.jsx)(_E,{schema:M,query:g,columns:ee,trash:p,selectMode:c,selected:_,onSelect:v,restore:e=>(0,b.jsx)(kE,{item:e,pending:f.isPending,onRestore:e=>f.mutate(e)}),empty:(0,b.jsxs)(b.Fragment,{children:[d(VS(t)?`list.noMatches`:`list.noRecords`),!VS(t)&&M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,children:(0,b.jsxs)(bo,{to:`/${M.name}/new`,children:[(0,b.jsx)(Yy,{}),d(`list.new`)]})})]})}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-lg border`,children:(0,b.jsxs)(bE,{className:W(m.density===`compact`&&`[&_td]:py-1 [&_th]:h-8`),children:[(0,b.jsx)(xE,{children:(0,b.jsxs)(CE,{children:[ce&&(0,b.jsx)(wE,{className:`w-0`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":d(`list.selectPage`),checked:F.length>0&&F.every(e=>_.has(String(e._id))),onChange:e=>v(e.target.checked?new Set(F.map(e=>String(e._id))):new Set)})}),N.map(e=>(0,b.jsxs)(wE,{className:`relative`,style:m.widths[e.name]?{width:m.widths[e.name],minWidth:m.widths[e.name]}:void 0,"aria-sort":P.field===e.name?P.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:()=>fe(e.name),children:[e.label,P.field===e.name&&(P.direction===`asc`?(0,b.jsx)(V_,{className:`size-3.5`}):(0,b.jsx)(L_,{className:`size-3.5`}))]}):e.label,(0,b.jsx)(pE,{resource:M.name,column:e.name,label:e.label,width:m.widths[e.name]})]},e.name)),p&&(0,b.jsx)(wE,{className:`w-0`,children:(0,b.jsx)(`span`,{className:`sr-only`,children:d(`list.actions`)})})]})}),(0,b.jsxs)(SE,{children:[s.isPending&&Array.from({length:5},(e,t)=>(0,b.jsxs)(CE,{"aria-hidden":!0,children:[ce&&(0,b.jsx)(TE,{}),N.map(e=>(0,b.jsx)(TE,{children:(0,b.jsx)(`div`,{className:`h-4 w-3/4 animate-pulse rounded bg-muted`})},e.name))]},`skeleton-${t}`)),F.map(e=>(0,b.jsxs)(CE,{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:[ce&&(0,b.jsx)(TE,{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)(TE,{children:n===0&&!p?(0,b.jsx)(bo,{to:ue(e),className:`font-medium hover:underline`,onClick:e=>e.stopPropagation(),children:lx(e[t.name],t)}):!p&&M.list.editable.includes(t.name)&&!(Array.isArray(e._readonly)&&e._readonly.includes(t.name))&&e._perm?.update!==!1?(0,b.jsx)(hE,{schema:M,item:e,field:t}):(0,b.jsx)(OE,{value:e[t.name],field:t,record:e})},t.name)),p&&(0,b.jsx)(TE,{children:(0,b.jsx)(kE,{item:e,pending:f.isPending,onRestore:e=>f.mutate(e)})})]},String(e._id))),s.isSuccess&&F.length===0&&(0,b.jsx)(CE,{children:(0,b.jsx)(TE,{colSpan:N.length+(p||ce?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(VS(t)?`list.noMatches`:`list.noRecords`),!VS(t)&&M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,children:(0,b.jsxs)(bo,{to:`/${M.name}/new`,children:[(0,b.jsx)(Yy,{}),d(`list.new`)]})})]})})})]})]})}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm text-muted-foreground`,children:[(0,b.jsx)(`span`,{children:re.summary}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,"aria-label":d(`list.previousPage`),disabled:!ie,onClick:oe,children:(0,b.jsx)(hv,{className:`rtl:rotate-180`})}),(0,b.jsx)(`span`,{children:re.label}),(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,"aria-label":d(`list.nextPage`),disabled:!re.hasNext,onClick:ae,children:(0,b.jsx)(_v,{className:`rtl:rotate-180`})})]})]})]}),(0,b.jsx)(yE,{schema:M,item:x,onClose:()=>C(void 0)})]})}function OE({value:e,field:t,record:n}){let r=t.relation?.resource;if(!r||e==null)return(0,b.jsx)(zT,{value:e,field:t,record:n});let i=(Array.isArray(e)?e:[e]).filter(SS);return i.length===0?(0,b.jsx)(b.Fragment,{children:lx(e,t)}):(0,b.jsx)(b.Fragment,{children:i.map((e,t)=>(0,b.jsxs)(y.Fragment,{children:[t>0&&`, `,(0,b.jsx)(bo,{to:`/${r}/${encodeURIComponent(EE([e.id]))}`,className:`hover:underline`,onClick:e=>e.stopPropagation(),children:e.title})]},String(e.id)))})}function kE({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)(ab,{}),r(`list.restore`)]})}function AE({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 jE(){let e=X();return(0,b.jsx)(G,{children:e(`common.pageNotFound`)})}function ME(e){let t=NS(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 NE(e,t,n){let r=e.filter(e=>gT(e,t)),i=r.filter(e=>!e.secret),{payload:a,errors:o}=FS(i,t,n),s=FS(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 PE(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{...CT(e,Object.fromEntries(a),`create`),...CT(e,Object.fromEntries(i),`update`)}}function FE(){let e=X(),{page:t=``}=$i(),n=Vg(t);return n.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):n.isError?(0,b.jsx)(G,{tone:`error`,children:ug(n.error)}):(0,b.jsx)(IE,{page:n.data},t)}function IE({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)(()=>ME(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=jT(()=>h(null)),x=JSON.stringify(c)!==JSON.stringify(o),{blocker:C}=OT(x),w=(0,y.useRef)(null);AT(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=ME(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=mT(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}=NE(i.fields,c,o),a={...PE(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||!gT(n,c))return null;let r=i.required.includes(t);return n.secret?(0,b.jsx)(LE,{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)(JT,{resource:`page:${i.name}`,field:n,record:O}):n.type===`object`?(0,b.jsx)(iT,{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)(Xw,{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:W(`flex flex-col gap-5`,i.layout?.length?`max-w-4xl`:`max-w-2xl`),children:[(0,b.jsx)(`h1`,{className:`text-xl font-semibold`,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)(kT,{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)(eT,{layout:i.layout,names:a,errors:f,render:k}),!i.readonly&&(0,b.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap gap-2 border-t bg-background py-3 md:static md:border-0 md:py-0`,children:[(0,b.jsx)(q,{type:`submit`,disabled:E.isPending||v.busy,"aria-keyshortcuts":`Control+S Meta+S`,children:t(E.isPending?`form.saving`:`form.save`)}),x&&(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:E.isPending,onClick:()=>{l(o),d([]),p({}),h(null)},children:t(`settings.discard`)})]})]})}function LE({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)(Oh,{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)(dv,{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=cg.title,UC(BC()),JC(cg.branding),GC(BC);var RE=new Qe({defaultOptions:{queries:{retry:1,staleTime:3e4}}}),zE=_o([{path:`login`,element:(0,b.jsx)(Ow,{})},{element:(0,b.jsx)(ww,{}),children:[{index:!0,element:(0,b.jsx)(rE,{})},{path:`account`,element:(0,b.jsx)(d_,{})},{path:`-/users`,element:(0,b.jsx)(kC,{})},{path:`-/users/new`,element:(0,b.jsx)(AC,{})},{path:`-/users/:id`,element:(0,b.jsx)(AC,{})},{path:`-/groups`,element:(0,b.jsx)(gC,{})},{path:`-/groups/new`,element:(0,b.jsx)(_C,{})},{path:`-/groups/:id`,element:(0,b.jsx)(_C,{})},{path:`-/roles`,element:(0,b.jsx)(OC,{})},{path:`-/roles/new`,element:(0,b.jsx)(TC,{})},{path:`-/roles/:name`,element:(0,b.jsx)(TC,{})},{path:`-/debugger`,element:(0,b.jsx)(pC,{})},{path:`-/audit`,element:(0,b.jsx)(uC,{})},{path:`g/:group`,element:(0,b.jsx)(ZT,{})},{path:`p/:page`,element:(0,b.jsx)(FE,{})},{path:`:resource`,element:(0,b.jsx)(DE,{})},{path:`:resource/new`,element:(0,b.jsx)(HT,{mode:`create`})},{path:`:resource/:id`,element:(0,b.jsx)(HT,{mode:`edit`})},{path:`*`,element:(0,b.jsx)(jE,{})}]}],{basename:cg.basePath});hg(()=>{let{pathname:e,search:t}=zE.state.location;e!==`/login`&&(RE.clear(),zE.navigate(`/login?${new URLSearchParams({next:e+t})}`,{replace:!0}))}),(0,Ka.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(y.StrictMode,{children:(0,b.jsx)(og,{locales:cg.locales,fallback:cg.locale,children:(0,b.jsx)(C,{client:RE,children:(0,b.jsx)(Ca,{router:zE})})})}));export{c as _,hy as a,$ as c,q as d,W as f,o as g,u as h,Lb as i,X as l,m,Pw as n,dy as o,v as p,Aw as r,xv as s,Fw as t,Oh as u};
|
|
55
|
+
`))continue;o.file.many?(r||t.length>0)&&(i[o.name]=t.map(DS)):t[0]?i[o.name]=DS(t[0]):(o.nullable||n)&&(i[o.name]=null);continue}if(o.relation?.kind===`to-many`){let t=Array.isArray(e)?e.filter(SS):[],r=n?.[o.name];(n?!OS(t,Array.isArray(r)?r.filter(SS):[]):t.length>0)&&(i[o.name]=t.map(e=>e.id));continue}if(o.type===`relation`){let t=SS(e)?e:null,r=n?.[o.name];if(n&&String(t?.id)===String(SS(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=PS(Nh(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=Mh(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(Mh(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 IS(e,t){let{payload:n}=FS(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 LS=new Set([`page`,`pageSize`,`sort`,`search`,`trashed`,`after`]),RS=e=>LS.has(e)||e.startsWith(`filter[`);function zS(e){let t=new URLSearchParams;for(let[n,r]of e)r!==``&&RS(n)&&t.append(n,r);return t.sort(),t.toString()}function BS(e,t){return`filter[${e}][${t}]`}function VS(e){return[...e.keys()].some(e=>e===`search`||e.startsWith(`filter[`))}function HS(e){let t={};for(let n of e.keys())(n===`search`||n.startsWith(`filter[`))&&(t[n]=null);return t}function US(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 WS(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=Qh(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}}var GS=`(max-width: 767px)`;function KS(e){let t=window.matchMedia(GS);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function qS(){return(0,y.useSyncExternalStore)(KS,()=>window.matchMedia(GS).matches,()=>!1)}function JS(e,t){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 YS(e,t){return e.enumLabels?.[t]??t}var XS=`h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,ZS=new Set([`number`,`decimal`,`bigint`,`date`,`datetime`]);function QS({schema:e,params:t,onChange:n}){let r=X(),i=qS(),[a,o]=(0,y.useState)(!1),s=t.get(`search`)??``,[c,l]=(0,y.useState)(s);(0,y.useEffect)(()=>{l(s)},[s]);let u=e.list.filters.map(t=>({operators:t.operators,field:e.fields.find(e=>e.name===t.field)})).filter(e=>e.field!==void 0),d=e.list.search.length>0,f=i&&(u.length>0||e.list.sortable.length>0);if(u.length===0&&!d&&!f)return null;let p=e.list.search.map(t=>e.fields.find(e=>e.name===t)?.label??t);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[d&&(0,b.jsxs)(`form`,{role:`search`,className:`flex flex-1 gap-2`,onSubmit:e=>{e.preventDefault(),n({search:c.trim()||null})},children:[(0,b.jsx)(Oh,{"aria-label":r(`filters.search`),placeholder:r(`filters.searchIn`,{fields:p.join(`, `)}),value:c,onChange:e=>l(e.target.value)}),(0,b.jsx)(q,{type:`submit`,variant:`outline`,children:r(`filters.search`)})]}),f&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,"aria-haspopup":`dialog`,onClick:()=>o(!0),children:[(0,b.jsx)(Cb,{}),r(`filters.filters`)]})]}),!i&&u.length>0&&(0,b.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:u.map(({field:r,operators:i})=>(0,b.jsx)(eC,{resource:e.name,field:r,operators:i,params:t,onChange:n},r.name))}),f&&(0,b.jsx)(jd,{open:a,onOpenChange:o,children:(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:`fixed inset-0 z-40 bg-black/30`}),(0,b.jsxs)(Ud,{"aria-describedby":void 0,className:`fixed inset-x-0 bottom-0 z-50 flex max-h-[85dvh] flex-col rounded-t-2xl border-t bg-background shadow-xl outline-none`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between border-b px-4 py-3`,children:[(0,b.jsx)(Jd,{className:`text-base font-semibold`,children:r(`filters.filtersAndSort`)}),(0,b.jsx)(Xd,{asChild:!0,children:(0,b.jsx)(q,{variant:`ghost`,size:`icon-sm`,"aria-label":r(`list.close`),children:(0,b.jsx)(rx,{})})})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-4 overflow-y-auto p-4`,children:[e.list.sortable.length>0&&(0,b.jsx)($S,{schema:e,params:t,onChange:n}),u.map(({field:r,operators:i})=>(0,b.jsx)(eC,{resource:e.name,field:r,operators:i,params:t,onChange:n},r.name))]}),(0,b.jsxs)(`div`,{className:`flex gap-2 border-t p-4`,children:[VS(t)&&(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>n(HS(t)),children:r(`filters.clear`)}),(0,b.jsx)(Xd,{asChild:!0,children:(0,b.jsx)(q,{className:`flex-1`,children:r(`filters.showResults`)})})]})]})]})}),VS(t)&&(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(iC,{schema:e,params:t,onChange:n}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>n(HS(t)),children:r(`filters.clear`)})]})]})}function $S({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)(kh,{htmlFor:`list-sort`,children:r(`filters.sortBy`)}),(0,b.jsx)(`select`,{id:`list-sort`,className:XS,value:o,onChange:e=>n({sort:e.target.value,page:null,after:null}),children:e.list.sortable.flatMap(e=>[(0,b.jsx)(`option`,{value:e,children:r(`filters.ascending`,{name:s(e)})},e),(0,b.jsx)(`option`,{value:`-${e}`,children:r(`filters.descending`,{name:s(e)})},`-${e}`)])})]})}function eC(e){let t=(0,b.jsx)(rC,{...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)(tC,{field:n,params:i,onChange:a})]})}function tC({field:e,params:t,onChange:n}){let r=X(),i=BS(e.name,`isNull`);return(0,b.jsxs)(`select`,{"aria-label":r(`filters.emptyValues`,{field:e.label}),className:W(XS,`h-7 text-xs text-muted-foreground`),value:t.get(i)??``,onChange:e=>n({[i]:e.target.value||null}),children:[(0,b.jsx)(`option`,{value:``,children:r(`filters.any`)}),(0,b.jsx)(`option`,{value:`true`,children:r(`filters.onlyEmpty`)}),(0,b.jsx)(`option`,{value:`false`,children:r(`filters.hideEmpty`)})]})}function nC({id:e,field:t,params:n,onChange:r}){let i=X(),a=BS(t.name,`in`),o=(n.get(a)??``).split(`,`).filter(Boolean),s=e=>{let t=o.includes(e)?o.filter(t=>t!==e):[...o,e];r({[a]:t.length>0?t.join(`,`):null})};return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:e,children:t.label}),(0,b.jsxs)(Sh,{children:[(0,b.jsx)(Ch,{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:o.length===0?i(`common.all`):o.length<=2?o.map(e=>YS(t,e)).join(`, `):i(`filters.selected`,{count:o.length})}),(0,b.jsx)(pv,{className:`size-4 opacity-60`,"aria-hidden":!0})]})}),(0,b.jsx)(wh,{children:(0,b.jsx)(Th,{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)(`ul`,{"aria-label":t.label,children:(t.enumValues??[]).map(e=>(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)(ff,{checked:o.includes(e),onCheckedChange:()=>s(e),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)(dv,{className:`size-3`})})}),YS(t,e)]})},e))})})})]})]})}function rC({resource:e,field:t,operators:n,params:r,onChange:i}){let{t:a,calendar:o}=Y(),s=`filter-${t.name}`;if(t.type===`enum`&&n.includes(`in`))return(0,b.jsx)(nC,{id:s,field:t,params:r,onChange:i});if(t.type===`relation`){let a=t.relation?.kind===`to-many`?`in`:`eq`;return n.includes(a)?(0,b.jsx)(oC,{id:s,resource:e,field:t,operator:a,params:r,onChange:i}):null}if((t.type===`enum`||t.type===`boolean`)&&n.includes(`eq`)){let e=BS(t.name,`eq`),n=t.type===`boolean`?[[`true`,a(`common.yes`)],[`false`,a(`common.no`)]]:(t.enumValues??[]).map(e=>[e,YS(t,e)]);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:s,children:t.label}),(0,b.jsxs)(`select`,{id:s,className:XS,value:r.get(e)??``,onChange:t=>i({[e]:t.target.value||null}),children:[(0,b.jsx)(`option`,{value:``,children:a(`common.all`)}),n.map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))]})]})}if((t.type===`date`||t.type===`datetime`&&o===`persian`)&&n.includes(`gte`)&&n.includes(`lte`)){let e=(e,n)=>t.type===`date`||!n?n:new Date(`${n}T${e===`gte`?`00:00:00.000`:`23:59:59.999`}`).toISOString(),n=e=>e&&t.type===`datetime`?MS(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:t.label}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`gte`,`lte`].map(o=>{let c=BS(t.name,o),l=`${s}-${o}`,u=a(o===`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)(kh,{htmlFor:l,className:`text-xs text-muted-foreground`,children:u}),(0,b.jsx)(lS,{id:l,label:`${t.label} ${u}`,value:n(r.get(c)),onChange:t=>i({[c]:e(o,t)||null})})]},o)})})]})}if(ZS.has(t.type)&&n.includes(`gte`)&&n.includes(`lte`)){let e=t.type===`date`?`date`:t.type===`datetime`?`datetime-local`:`text`,n=e=>t.type===`datetime`&&e?new Date(e).toISOString():Nh(e.trim()).replace(/,/g,``),o=e=>e&&t.type===`datetime`?MS(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:t.label}),(0,b.jsx)(`div`,{className:`flex gap-2`,children:[`gte`,`lte`].map(c=>{let l=BS(t.name,c),u=`${s}-${c}`;return(0,b.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1`,children:[(0,b.jsx)(kh,{htmlFor:u,className:`text-xs text-muted-foreground`,children:a(c===`gte`?`filters.from`:`filters.to`)}),(0,b.jsx)(sC,{id:u,type:e,inputMode:e===`text`?`decimal`:void 0,value:o(r.get(l)),onCommit:e=>i({[l]:n(e)||null})})]},c)})})]})}let c=n.includes(`contains`)?`contains`:n.includes(`eq`)?`eq`:void 0;if(!c)return null;let l=BS(t.name,c);return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:s,children:c===`contains`?a(`filters.contains`,{field:t.label}):t.label}),(0,b.jsx)(sC,{id:s,value:r.get(l)??``,onCommit:e=>i({[l]:e.trim()||null})})]})}function iC({schema:e,params:t,onChange:n}){let r=X(),i=yS(e,t);return(0,b.jsx)(`ul`,{"aria-label":r(`filters.active`),className:`flex flex-wrap gap-1.5`,children:i.map(t=>(0,b.jsxs)(`li`,{className:`inline-flex items-center gap-1 rounded-full border bg-muted/50 py-0.5 ps-2.5 pe-1 text-xs`,children:[(0,b.jsxs)(`span`,{className:`font-medium`,children:[t.label,`:`]}),t.ref?(0,b.jsx)(aC,{resource:e.name,chip:t}):(0,b.jsx)(`span`,{children:t.value}),(0,b.jsx)(`button`,{type:`button`,className:`rounded-full p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":r(`filters.removeChip`,{label:t.label}),onClick:()=>n(Object.fromEntries(t.remove.map(e=>[e,null]))),children:(0,b.jsx)(rx,{className:`size-3`})})]},t.key))})}function aC({resource:e,chip:t}){let n=Gg(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 oC({id:e,resource:t,field:n,operator:r,params:i,onChange:a}){let o=BS(n.name,r),s=(i.get(o)??``).split(`,`).filter(Boolean),c=Gg(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)(kh,{htmlFor:e,children:n.label}),(0,b.jsx)(gS,{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 sC({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)(Oh,{id:e,type:n,inputMode:r,value:a,onChange:e=>o(e.target.value),onBlur:s,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),s())}})}var cC=[`auth.*`,`auth.login`,`auth.login_failed`,`auth.view_as`,`rbac.*`,`rbac.role.changed`,`rbac.user_roles.changed`,`page.*`],lC=[`*`,`created`,`updated`,`deleted`,`restored`,`purged`,`action.*`];function uC(){let{t:e,locale:t}=Y(),[n,r]=wo(),i=zg(),a=Rg(),o=a.data?.audit.view===!0,s=jx(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=>US(n,Nx(e,t))),y=c.error instanceof lg&&(c.error.status===403||c.error.status===404);if(a.isPending)return(0,b.jsx)(G,{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)(y_,{children:e(`audit.title`)}),(0,b.jsx)(G,{tone:`error`,children:y?ug(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)(y_,{children:e(`audit.title`)}),(0,b.jsxs)(`fieldset`,{className:`grid gap-3 rounded-lg border 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)(dC,{label:e(`audit.filter.actor`),value:n.get(`actor`)??``,onCommit:e=>v(`actor`,e)}),(0,b.jsx)(dC,{label:e(`audit.filter.event`),placeholder:e(`audit.filter.eventHint`),value:n.get(`event`)??``,onCommit:e=>v(`event`,e),hints:[...S?lC.map(e=>`${S}.${e}`):[],...cC]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`audit-resource`,children:e(`audit.filter.resource`)}),(0,b.jsxs)(`select`,{id:`audit-resource`,className:XS,value:S,onChange:e=>v(`resource`,e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:e(`common.all`)}),S&&!x.some(e=>e.name===S)&&(0,b.jsx)(`option`,{value:S,children:S}),x.map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]}),(0,b.jsx)(dC,{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)(kh,{htmlFor:`audit-${t}`,children:e(`filters.${t}`)}),(0,b.jsx)(lS,{id:`audit-${t}`,label:e(`filters.${t}`),value:n.get(t)??``,onChange:e=>v(t,e)})]},t)),Mx(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=>US(e,Px())),children:e(`filters.clear`)})})]}),c.isError&&(0,b.jsx)(b_,{children:ug(c.error)}),c.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):l.length===0?!c.isError&&(0,b.jsx)(G,{children:e(Mx(n)?`audit.noMatches`:`audit.empty`)}):(0,b.jsx)(Fx,{entries:l,now:new Date(c.dataUpdatedAt),names:fx(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 dC({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)(kh,{htmlFor:o,children:e}),(0,b.jsx)(Oh,{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 fC={hidden:`rbac.rule.hidden`,view:`rbac.rule.readonly`,edit:`rbac.rule.edit`};function pC(){let{t:e}=Y(),[t,n]=wo(),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)(y_,{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-lg border 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)(kh,{htmlFor:`debug-user`,children:e(`debugger.user`)}),(0,b.jsx)(Oh,{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)(kh,{htmlFor:`debug-resource`,children:e(`debugger.resource`)}),(0,b.jsxs)(`select`,{id:`debug-resource`,className:`h-9 rounded-md border bg-background px-2 text-sm`,value:u,onChange:e=>d(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`—`}),(o.data?.resources??[]).map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`debug-record`,children:e(`debugger.record`)}),(0,b.jsx)(Oh,{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)(G,{children:e(`common.loading`)}):_.isError?(0,b.jsx)(G,{tone:`error`,children:ug(_.error)}):(0,b.jsx)(hC,{data:_.data})]})}function mC({allowed:e}){let{t}=Y();return(0,b.jsx)(`span`,{className:W(`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 hC({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:g_(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-lg border`,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)(mC,{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-lg border`,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)(mC,{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-lg border`,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(fC[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(fC[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)(mC,{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-lg border`,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)(mC,{allowed:n.view})}),(0,b.jsx)(`td`,{className:`px-3 py-2`,"data-operation":`update`,children:(0,b.jsx)(mC,{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 gC(){let{t:e,locale:t}=Y(),n=Rg(),r=ft({queryKey:[`rbac`,`groups`],queryFn:Q.rbac.groups});return r.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(G,{tone:`error`,children:ug(r.error)}):(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(y_,{actions:n.data?.rbac.manage&&(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/groups/new`,children:[(0,b.jsx)(Yy,{}),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-lg border empty:hidden`,children:r.data.items.map(n=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{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:g_(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 _C(){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)(G,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(G,{tone:`error`,children:ug(r.error)}):!n&&i.isError?(0,b.jsx)(G,{tone:`error`,children:ug(i.error)}):(0,b.jsx)(vC,{roles:r.data.items,group:n?void 0:i.data},t??`new`)}function vC({roles:e,group:t}){let{t:n,locale:r}=Y(),i=Yi(),a=S(),o=Rg().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:__(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(ug(e))}),O=pt({mutationFn:()=>Q.rbac.deleteGroup(t.id),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`rbac`]}),i(`/-/groups`)},onError:e=>E(ug(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)(y_,{children:t?g_(t.label,r)||t.name:n(`rbac.newGroup`)}),T&&(0,b.jsx)(b_,{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)(kh,{htmlFor:`group-name`,children:n(`rbac.name`)}),(0,b.jsx)(Oh,{id:`group-name`,dir:`ltr`,value:s,disabled:o,onChange:e=>c(e.target.value)})]}),cg.locales.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`group-label-${e}`,children:n(`rbac.labelIn`,{language:e})}),(0,b.jsx)(Oh,{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))}),g_(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)(rx,{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)(kh,{htmlFor:`member-search`,children:n(`rbac.addMember`)}),(0,b.jsx)(Oh,{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)(Yy,{}),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 yC=[`view`,`create`,`update`,`delete`,`purge`,`field`,`action`];function bC(e,t){let n=e.split(`.`),r=t.split(`.`),i=r[0]===`page`&&!yC.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 xC(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 SC(e,t){return e.some(e=>bC(e,t))}function CC(e,t,n,r){if(n)return SC(e,t)?e:[...e,t];let i=[];for(let n of e)if(n!==t){if(n.includes(`*`)&&bC(n,t)){for(let e of r)e!==t&&bC(n,e)&&!i.includes(e)&&i.push(e);continue}i.push(n)}return i.filter(e=>e===t||!bC(e,t))}var wC=[`view`,`update`,`delete`];function TC(){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)(G,{children:e(`common.loading`)}):r.isError?(0,b.jsx)(G,{tone:`error`,children:ug(r.error)}):!n&&i.isError?(0,b.jsx)(G,{tone:`error`,children:ug(i.error)}):(0,b.jsx)(EC,{catalog:r.data,role:n?void 0:i.data},t??`new`)}function EC({catalog:e,role:t}){let{t:n,locale:r}=Y(),i=Yi(),a=S(),o=Rg(),s=t?.system===!0||o.data?.rbac.manage!==!0,c=xC(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:__(d),permissions:p,fields:DC(h),scopes:DC(_)};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 lg?[e.message,...Object.values(e.fields).flat()].join(` — `):ug(e))}),D=pt({mutationFn:()=>Q.rbac.deleteRole(t.name),onSuccess:async()=>{await a.invalidateQueries({queryKey:[`rbac`]}),i(`/-/roles`)},onError:e=>T(ug(e))}),O=(e,t)=>m(n=>CC(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)(y_,{children:t?g_(t.label,r)||t.name:n(`rbac.newRole`)}),t?.system&&(0,b.jsx)(b_,{tone:`success`,children:n(`rbac.systemNote`)}),w&&(0,b.jsx)(b_,{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)(kh,{htmlFor:`role-name`,children:n(`rbac.name`)}),(0,b.jsx)(Oh,{id:`role-name`,dir:`ltr`,value:l,disabled:!!t,onChange:e=>u(e.target.value)})]}),cg.locales.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(kh,{htmlFor:`role-label-${e}`,children:n(`rbac.labelIn`,{language:e})}),(0,b.jsx)(Oh,{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-lg border`,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:SC(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)(pv,{className:W(`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)(`label`,{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.jsxs)(`select`,{className:`h-8 rounded-lg border border-input bg-transparent px-2 text-sm`,value:h[t.name]?.[e.name]??``,disabled:s,"aria-label":n(`rbac.fieldRule`,{field:e.label}),onChange:n=>k(t.name,e.name,n.target.value),children:[(0,b.jsx)(`option`,{value:``,children:n(e.restricted?`rbac.rule.defaultHidden`:`rbac.rule.default`)}),(0,b.jsx)(`option`,{value:`hidden`,children:n(`rbac.rule.hidden`)}),(0,b.jsx)(`option`,{value:`readonly`,children:n(`rbac.rule.readonly`)}),(0,b.jsx)(`option`,{value:`edit`,children: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`)}),wC.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:SC(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:SC(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-lg border`,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=SC(p,r)&&!SC(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||SC(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:SC(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:SC(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 DC(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 OC(){let{t:e,locale:t}=Y(),n=Rg(),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)(G,{children:e(`common.loading`)}):i.isError?(0,b.jsx)(G,{tone:`error`,children:ug(i.error)}):(0,b.jsxs)(`div`,{className:`flex max-w-4xl flex-col gap-4`,children:[(0,b.jsx)(y_,{actions:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(q,{variant:`outline`,onClick:()=>void u(),children:[(0,b.jsx)(jv,{}),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)(Vb,{}),e(`rbac.import`)]}),(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/roles/new`,children:[(0,b.jsx)(Yy,{}),e(`rbac.newRole`)]})})]})]}),children:e(`rbac.roles`)}),o&&(0,b.jsx)(b_,{tone:`success`,children:o}),l.isError&&(0,b.jsx)(b_,{children:l.error instanceof SyntaxError?e(`rbac.notJson`):ug(l.error)}),(0,b.jsx)(`ul`,{"aria-label":e(`rbac.roles`),className:`flex flex-col divide-y rounded-lg border`,children:i.data.items.map(n=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{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:g_(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 kC(){let{t:e}=Y(),t=Rg(),[n,r]=wo(),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)(G,{children:e(`common.loading`)});if(c.isError)return(0,b.jsx)(G,{tone:`error`,children:ug(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)(y_,{actions:t.data?.rbac.manage&&f.create&&(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/users/new`,children:[(0,b.jsx)(Yy,{}),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)(Oh,{"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-lg border`,children:[l.map(t=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{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 AC(){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)(G,{children:e(`common.loading`)});let s=r.error??i.error??o.error??(n?null:a.error);return s?(0,b.jsx)(G,{tone:`error`,children:ug(s)}):(0,b.jsx)(jC,{user:n?void 0:a.data,roles:r.data.items,groups:i.data.items,capabilities:o.data.capabilities},t??`new`)}function jC({user:e,roles:t,groups:n,capabilities:r}){let{t:i,locale:a}=Y(),o=Yi(),s=S(),c=Rg(),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 lg&&Object.keys(e.fields).length>0?(j(e.fields),N(e.message)):(j({}),N(ug(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)(kh,{htmlFor:t,children:n}),(0,b.jsx)(Oh,{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)(y_,{actions:ie&&(0,b.jsxs)(q,{type:`button`,variant:`outline`,onClick:()=>{bg(e.id),s.clear(),o(`/`)},children:[(0,b.jsx)(Fv,{}),i(`viewAs.start`)]}),children:e?e.displayName:i(`rbac.newUser`)}),M&&(0,b.jsx)(b_,{children:M}),ee&&(0,b.jsx)(b_,{tone:`success`,children:ee}),e?.isSuperuser&&!u&&(0,b.jsx)(b_,{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))}),g_(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))}),g_(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-lg border 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)(kh,{htmlFor:`user-new-password`,children:i(`auth.newPassword`)}),(0,b.jsx)(Oh,{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-lg border 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`)})})]})]})}function MC(e){return Mh(e).toLocaleLowerCase().replace(/[يى]/g,`ی`).replace(/ك/g,`ک`).replace(//g,` `)}function NC(e,t){let n=MC(e);return MC(t).split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function PC(e,t,n){let r=[],i=[];for(let a of e.groups){e.groups.length>1&&NC(a.label,t)&&r.push({id:`group:${a.key}`,section:`go`,label:a.label,to:`/g/${a.key}`});for(let e of a.resources){NC(`${e.label} ${a.label}`,t)&&r.push({id:`go:${e.name}`,section:`go`,label:e.label,detail:a.label,to:`/${e.name}`});let o=n(e.label);e.creatable&&t.trim()!==``&&NC(o,t)&&i.push({id:`new:${e.name}`,section:`create`,label:o,to:`/${e.name}/new`})}for(let e of a.pages)NC(`${e.label} ${a.label}`,t)&&r.push({id:`page:${e.name}`,section:`go`,label:e.label,detail:a.label,to:`/p/${e.name}`})}return[...r,...i]}function FC(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 IC(){let{t:e}=Y(),t=Yi(),n=zg(),r=Rg(),[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=FC(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=n.data?PC(n.data,o,t=>e(`palette.new`,{name:t})):[],g=[...h.filter(e=>e.section===`go`),...r.data?.audit.view&&NC(e(`audit.title`),o)?[{id:`audit`,section:`go`,label:e(`audit.title`),to:`/-/audit`}]:[],...h.filter(e=>e.section!==`go`),...p&&o.trim()===f?(m.data?.groups??[]).flatMap(e=>e.items.map(t=>({id:`record:${e.resource}:${t._id}`,section:`records`,label:t._title,detail:e.label,to:`/${e.resource}/${encodeURIComponent(t._id)}`}))):[]],_=Math.min(c,Math.max(0,g.length-1));(0,y.useEffect)(()=>l(0),[o,m.data]),(0,y.useEffect)(()=>{d.current?.querySelector(`[data-index="${_}"]`)?.scrollIntoView({block:`nearest`})},[_]);function v(e){e&&(a(!1),t(e.to))}function x(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),g.length===0)return;l((_+(e.key===`ArrowDown`?1:-1)+g.length)%g.length)}else e.key===`Enter`&&(e.preventDefault(),v(g[_]))}let S=[[`go`,e(`palette.goTo`)],[`create`,e(`palette.create`)],[`records`,e(`palette.records`)]],C=e=>`${u}-${e}`,w=p&&(m.isFetching||o.trim()!==f)?e(`palette.searching`):g.length===0?e(`palette.noResults`):``;return(0,b.jsxs)(jd,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,b.jsx)(Nd,{asChild:!0,children:(0,b.jsxs)(q,{variant:`outline`,size:`sm`,className:`gap-2 text-muted-foreground`,"aria-keyshortcuts":`Control+K Meta+K`,"aria-label":e(`palette.open`),children:[(0,b.jsx)(lb,{}),(0,b.jsx)(`span`,{className:`hidden lg:inline`,children:e(`palette.open`)}),(0,b.jsx)(`kbd`,{className:`hidden rounded border bg-muted px-1 font-sans text-[0.7rem] lg:inline`,children:`⌘K`})]})}),(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:`fixed inset-0 z-40 bg-black/30`}),(0,b.jsxs)(Ud,{"aria-describedby":void 0,className:`fixed inset-x-3 top-[12vh] z-50 mx-auto flex max-h-[70vh] max-w-xl flex-col overflow-hidden rounded-xl border bg-popover text-popover-foreground shadow-xl outline-none`,children:[(0,b.jsx)(Jd,{className:`sr-only`,children:e(`palette.open`)}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-3`,children:[(0,b.jsx)(lb,{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":g.length>0?C(_):void 0,"aria-label":e(`palette.open`),placeholder:e(`palette.placeholder`),className:`h-12 flex-1 bg-transparent text-sm outline-none`,value:o,onChange:e=>s(e.target.value),onKeyDown:x})]}),(0,b.jsx)(`ul`,{ref:d,id:u,role:`listbox`,"aria-label":e(`palette.results`),className:`flex-1 overflow-y-auto p-1`,children:S.map(([e,t])=>{let n=g.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 pt-2 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:C(t),role:`option`,"aria-selected":t===_,"data-index":t,className:W(`flex cursor-pointer items-center justify-between gap-3 rounded-md px-2 py-2 text-sm`,t===_&&`bg-accent text-accent-foreground`),onMouseMove:()=>l(t),onClick:()=>v(e),children:[(0,b.jsx)(`span`,{className:`truncate`,children:e.label}),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:W(`px-3 text-sm text-muted-foreground`,w&&`border-t py-2`),children:w})]})]})]})}var LC=`nma.theme`,RC=`oklch(0.145 0 0)`,zC=`oklch(0.985 0 0)`;function BC(){try{let e=localStorage.getItem(LC);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}function VC(e,t){return e===`system`?t?`dark`:`light`:e}var HC=()=>typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches;function UC(e){let t=VC(e,HC());document.documentElement.classList.toggle(`dark`,t===`dark`),document.documentElement.style.colorScheme=t}function WC(e){try{localStorage.setItem(LC,e)}catch{}UC(e)}function GC(e){if(typeof matchMedia!=`function`)return()=>void 0;let t=matchMedia(`(prefers-color-scheme: dark)`),n=()=>{e()===`system`&&UC(`system`)};return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)}function KC(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 qC(e){let t={};if(e.primaryColor){let n=KC(e.primaryColor),r=e.primaryForeground??(n!==void 0&&n>.45?RC:zC);Object.assign(t,{"--primary":e.primaryColor,"--primary-foreground":r,"--ring":e.primaryColor,"--sidebar-primary":e.primaryColor,"--sidebar-primary-foreground":r})}return e.radius&&(t[`--radius`]=e.radius),t}function JC(e){for(let[t,n]of Object.entries(qC(e)))document.documentElement.style.setProperty(t,n)}var YC={en:`English`,fa:`فارسی`};function XC(){let{t:e}=Y(),[t,n]=(0,y.useState)(BC),r=[[`light`,e(`shell.themeLight`),kb],[`dark`,e(`shell.themeDark`),Ny],[`system`,e(`shell.themeSystem`),jy]];return(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":e(`shell.theme`),className:`flex items-center rounded-lg 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:W(`rounded-md p-1.5 text-muted-foreground hover:text-foreground`,t===e&&`bg-muted text-foreground`),onClick:()=>{WC(e),n(e)},children:(0,b.jsx)(i,{className:`size-4`})},e))})}function ZC(){let{t:e,locale:t,locales:n,setLocale:r}=Y();return n.length<2?null:(0,b.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,b.jsx)(sy,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`sr-only`,children:e(`shell.language`)}),(0,b.jsx)(`select`,{className:`h-8 rounded-lg border border-input bg-transparent px-2 text-sm`,value:t,onChange:e=>r(e.target.value),children:n.map(e=>(0,b.jsx)(`option`,{value:e,lang:e,children:YC[e]??e},e))})]})}function QC(){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-lg border p-0.5`,children:n.map(([e,n])=>(0,b.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":t===e,className:W(`flex-1 rounded-md px-2 py-1 text-sm text-muted-foreground hover:text-foreground`,t===e&&`bg-muted text-foreground`),onClick:()=>r(e),children:n},e))})]});return(0,b.jsxs)(Sh,{children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,"aria-label":e(`display.title`),title:e(`display.title`),children:(0,b.jsx)(av,{})})}),(0,b.jsx)(wh,{children:(0,b.jsxs)(Th,{align:`end`,sideOffset:6,className:`z-50 flex w-64 flex-col gap-3 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md`,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})),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:hidden`,children:[(0,b.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:e(`shell.theme`)}),(0,b.jsx)(XC,{})]})]})})]})}function $C(){let{t:e}=Y(),t=Rg(),n=Yi(),r=S(),i=t.data;if(!i||i.open)return null;let{user:a,auth:o}=i,s=a.displayName.split(/\s+/).filter(Boolean).slice(0,2).map(e=>[...e][0].toUpperCase()).join(``);async function c(){try{await Q.logout()}finally{pg(void 0),bg(void 0),r.clear(),n(`/login`,{replace:!0})}}return(0,b.jsxs)(Sh,{children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,className:`rounded-full text-xs font-semibold`,"aria-label":e(`auth.userMenu`,{name:a.displayName}),children:s||(0,b.jsx)(Ub,{})})}),(0,b.jsx)(wh,{children:(0,b.jsxs)(Th,{align:`end`,sideOffset:6,className:`z-50 flex w-60 flex-col gap-1 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:[(0,b.jsxs)(`div`,{className:`border-b px-2 py-2`,children:[(0,b.jsx)(`div`,{className:`truncate text-sm font-medium`,children:a.displayName}),(a.username||a.email)&&(0,b.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:a.email??a.username})]}),(o.password||o.sessions||o.twoFactor)&&!i.viewAs&&(0,b.jsx)(Eh,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/account`,className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent`,children:[(0,b.jsx)(Ub,{className:`size-4`}),e(`auth.account`)]})}),i.audit.view&&(0,b.jsx)(Eh,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/-/audit`,className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent`,children:[(0,b.jsx)(rb,{className:`size-4`}),e(`audit.title`)]})}),o.logout&&(0,b.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-start text-sm hover:bg-accent`,onClick:()=>void c(),children:[(0,b.jsx)(yy,{className:`size-4 rtl:-scale-x-100`}),e(`auth.signOut`)]})]})})]})}var ew=`nma.nav`,tw={pinned:[],recent:[],collapsedGroups:[],railCollapsed:!1};function nw(e){let t=tw;try{let n=e?.getItem(ew);n&&(t={...tw,...JSON.parse(n)})}catch{t=tw}let n=new Set,r=r=>{t=r;try{e?.setItem(ew,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=>r({...t,collapsedGroups:i(t.collapsedGroups,e)}),toggleRail:()=>r({...t,railCollapsed:!t.railCollapsed})}}function rw(){try{return typeof localStorage>`u`?void 0:localStorage}catch{return}}var iw=nw(rw());function aw(){return(0,y.useSyncExternalStore)(iw.subscribe,iw.get)}function ow(e,t){return e.filter(e=>t.has(e))}function sw(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=Ug(n??``,a),s=[{label:t(`shell.home`),to:`/`}];if(n===`account`&&!r)return[...s,{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 s.push({label:t(`rbac.administration`)},{label:e,to:`/-/${r}`}),i&&s.push({label:i===`new`?t(`list.new`):i}),s}if(!n||!e)return s;if(n===`g`){let t=e.groups.find(e=>e.key===r);return t&&s.push({label:t.label}),s}if(n===`p`){let t=e.groups.find(e=>e.pages.some(e=>e.name===r)),n=t?.pages.find(e=>e.name===r);return t&&n&&s.push({label:t.label,to:`/g/${t.key}`},{label:n.label}),s}let c=e.groups.find(e=>e.resources.some(e=>e.name===n)),l=c?.resources.find(e=>e.name===n);return!c||!l?s:(s.push({label:c.label,to:`/g/${c.key}`},{label:l.label,to:`/${l.name}`}),r===`new`?s.push({label:t(`form.new`,{name:l.label})}):a&&s.push({label:typeof o.data?._title==`string`?o.data._title:`#${a}`}),s)}function cw({meta:e,onOpenMenu:t}){let{t:n}=Y(),r=aw(),i=sw(e),a=i.length-1;return(0,b.jsxs)(`header`,{className:`flex h-14 items-center gap-2 border-b px-4`,children:[(0,b.jsx)(q,{variant:`ghost`,size:`icon`,className:`md:hidden`,"aria-label":n(`shell.menu`),onClick:t,children:(0,b.jsx)(Dy,{})}),(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:()=>iw.toggleRail(),children:r.railCollapsed?(0,b.jsx)(zy,{className:`rtl:-scale-x-100`}):(0,b.jsx)(Ly,{className:`rtl:-scale-x-100`})}),(0,b.jsx)(`nav`,{"aria-label":n(`shell.breadcrumbs`),className:`min-w-0 flex-1`,children:(0,b.jsx)(`ol`,{className:`flex min-w-0 items-center gap-1 text-sm text-muted-foreground`,children:i.map((e,t)=>(0,b.jsxs)(y.Fragment,{children:[t>0&&(0,b.jsx)(_v,{className:`size-3.5 shrink-0 rtl: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)(bo,{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-2`,children:[(0,b.jsx)(IC,{}),(0,b.jsx)(ZC,{}),(0,b.jsx)(QC,{}),(0,b.jsx)($C,{}),(0,b.jsx)(`div`,{className:`hidden sm:flex`,children:(0,b.jsx)(XC,{})})]})]})}var lw={archive:F_,ban:U_,bell:G_,book:q_,box:Y_,boxes:Z_,briefcase:$_,building:tv,calendar:sv,chart:lv,check:dv,clock:yv,"credit-card":Tv,database:Dv,dollar:kv,file:zv,"file-text":Lv,folder:Vv,globe:Uv,heart:qv,history:rb,home:Yv,image:$v,inbox:ty,key:ay,layers:ly,link:dy,list:hy,lock:_y,mail:xy,map:Ty,"map-pin":Cy,message:ky,package:Fy,phone:Uy,printer:Zy,receipt:$y,refresh:tb,send:db,server:pb,settings:hb,shield:_b,"shopping-bag":yb,cart:xb,"shopping-cart":xb,star:Tb,store:Db,tag:jb,tags:Nb,ticket:Fb,truck:zb,user:Gb,users:Yb,video:Zb,wallet:$b,wrench:tx,x:rx,zap:ax};Object.keys(lw);function uw(e,t){return dw(e)??(t===`group`?Vv:t===`page`?hb:Lv)}function dw(e){return e&&Object.hasOwn(lw,e)?lw[e]:void 0}var fw=e=>({isActive:t})=>W(`flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-sidebar-accent`,e&&`justify-center px-0`,t&&`bg-sidebar-accent font-medium`);function pw({title:e,logo:t,groups:n,rail:r=!1}){let{t:i}=Y(),a=aw(),[o,s]=(0,y.useState)(``),c=new Map(n.flatMap(e=>e.resources.map(e=>[e.name,e]))),l=ow(a.pinned,new Set(c.keys())).map(e=>c.get(e)),u=ow(a.recent,new Set(c.keys())).filter(e=>!a.pinned.includes(e)).map(e=>c.get(e)),d=o.trim().toLocaleLowerCase(),f=e=>d!==``&&!e.label.toLocaleLowerCase().includes(d),p=n.map(e=>({group:e,resources:f(e)?e.resources.filter(e=>e.label.toLocaleLowerCase().includes(d)):e.resources,pages:f(e)?e.pages.filter(e=>e.label.toLocaleLowerCase().includes(d)):e.pages})).filter(e=>e.resources.length>0||e.pages.length>0),m=e=>{let t=uw(e.icon,`page`);return(0,b.jsx)(`li`,{className:`flex items-center`,children:(0,b.jsxs)(xo,{to:`/p/${e.name}`,className:fw(r),"aria-label":r?e.label:void 0,title:r?e.label:void 0,children:[(0,b.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),!r&&(0,b.jsx)(`span`,{className:`truncate`,children:e.label})]})},`page:${e.name}`)},h=(e,t)=>{let n=uw(e.icon,`resource`),o=a.pinned.includes(e.name);return(0,b.jsxs)(`li`,{className:`group/item flex items-center`,children:[(0,b.jsxs)(xo,{to:`/${e.name}`,className:fw(r),"aria-label":r?e.label:void 0,title:r?e.label:void 0,children:[(0,b.jsx)(n,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),!r&&(0,b.jsx)(`span`,{className:`truncate`,children:e.label})]}),!r&&(0,b.jsx)(`button`,{type:`button`,className:W(`rounded-md p-1 text-muted-foreground opacity-0 hover:text-foreground focus-visible:opacity-100 group-hover/item:opacity-100`,o&&`opacity-100`),"aria-label":i(o?`shell.unpin`:`shell.pin`,{name:e.label}),"aria-pressed":o,onClick:()=>iw.togglePin(e.name),children:o?(0,b.jsx)(Gy,{className:`size-3.5`}):(0,b.jsx)(qy,{className:`size-3.5`})})]},`${t}:${e.name}`)};return(0,b.jsxs)(`nav`,{"aria-label":i(`shell.resources`),className:W(`flex h-full flex-col gap-4 overflow-y-auto p-3`,r&&`items-stretch px-2`),children:[(0,b.jsxs)(`div`,{className:W(`flex items-center gap-2 px-2 py-1`,r&&`justify-center px-0`),children:[t&&(0,b.jsx)(`img`,{src:t,alt:``,className:`size-7 shrink-0 rounded-md object-contain`}),!r&&(0,b.jsx)(`span`,{className:`truncate text-lg font-semibold`,children:e})]}),!r&&(0,b.jsx)(Oh,{type:`search`,"aria-label":i(`shell.filterResources`),placeholder:i(`shell.filterResources`),value:o,onChange:e=>s(e.target.value)}),!r&&!d&&l.length>0&&(0,b.jsx)(hw,{label:i(`shell.pinned`),children:(0,b.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:l.map(e=>h(e,`pinned`))})}),!r&&!d&&u.length>0&&(0,b.jsx)(hw,{label:i(`shell.recent`),children:(0,b.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:u.map(e=>h(e,`recent`))})}),p.map(({group:e,resources:t,pages:n})=>{let o=!d&&!r&&a.collapsedGroups.includes(e.key),s=uw(e.icon,`group`),c=`nav-group-${e.key}`;return(0,b.jsxs)(`div`,{children:[!r&&(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 pb-1 text-xs font-medium text-muted-foreground hover:text-foreground`,"aria-expanded":!o,"aria-controls":c,"aria-label":i(o?`shell.expandGroup`:`shell.collapseGroup`,{name:e.label}),onClick:()=>iw.toggleGroup(e.key),children:[(0,b.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),(0,b.jsx)(`span`,{className:`flex-1 truncate text-start`,children:e.label}),(0,b.jsx)(pv,{className:W(`size-3.5 transition-transform`,o&&`-rotate-90 rtl:rotate-90`),"aria-hidden":!0})]}),r&&(0,b.jsx)(`div`,{className:`mx-2 mb-1 border-t`,"aria-hidden":!0}),!o&&(0,b.jsxs)(`ul`,{id:c,className:`flex flex-col gap-0.5`,"aria-label":e.label,children:[t.map(t=>h(t,e.key)),n.map(m)]})]},e.key)}),d&&p.length===0&&(0,b.jsx)(`p`,{className:`px-2 text-sm text-muted-foreground`,children:i(`shell.noMatches`)}),!d&&(0,b.jsx)(mw,{rail:r})]})}function mw({rail:e}){let{t}=Y();if(!Rg().data?.rbac.view)return null;let n=[[`/-/users`,t(`rbac.users`),Ub],[`/-/groups`,t(`rbac.groups`),qb],[`/-/roles`,t(`rbac.roles`),ry],[`/-/debugger`,t(`debugger.title`),sb]];return(0,b.jsxs)(`div`,{className:`mt-auto border-t pt-3`,children:[!e&&(0,b.jsx)(`div`,{className:`px-2 pb-1 text-xs font-medium text-muted-foreground`,children:t(`rbac.administration`)}),(0,b.jsx)(`ul`,{className:`flex flex-col gap-0.5`,"aria-label":t(`rbac.administration`),children:n.map(([t,n,r])=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(xo,{to:t,className:fw(e),"aria-label":e?n:void 0,title:e?n:void 0,children:[(0,b.jsx)(r,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),!e&&(0,b.jsx)(`span`,{className:`truncate`,children:n})]})},t))})]})}function hw({label:e,children:t}){return(0,b.jsxs)(`section`,{"aria-label":e,children:[(0,b.jsx)(`div`,{className:`px-2 pb-1 text-xs font-medium text-muted-foreground`,children:e}),t]})}var gw={success:5e3,error:1e4},_w=4;function vw(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-_w)))o(e.id);return a([...t,{id:c,message:i,tone:s}]),r.set(c,e.setTimeout(()=>o(c),gw[s])),c},dismiss:o}}var yw=vw(),bw=(e,t=`success`)=>yw.show(e,t);function xw(){return(0,y.useSyncExternalStore)(yw.subscribe,yw.get)}function Sw(){let e=X(),t=xw();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:W(`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:W(`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:()=>yw.dismiss(t.id),children:(0,b.jsx)(rx,{className:`size-4`,"aria-hidden":!0})})]},t.id))})}function Cw(e,t){return e===void 0||typeof e==`string`?e:e[t]??e[cg.locale]??Object.values(e)[0]}function ww(){let{t:e}=Y(),t=Rg(),n=qi(),r=S(),i=t.isError&&yg()!==void 0&&t.error instanceof lg&&(t.error.status===403||t.error.status===404);return(0,y.useEffect)(()=>{i&&(bg(void 0),r.clear())},[i,r]),t.isPending||i?(0,b.jsx)(G,{children:e(`common.loading`)}):t.isError?t.error instanceof lg&&t.error.status===401?(0,b.jsx)(Da,{to:`/login?${new URLSearchParams({next:n.pathname+n.search})}`,replace:!0}):(0,b.jsxs)(G,{tone:`error`,children:[ug(t.error),` `,(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:e(`list.retry`)})]}):(0,b.jsx)(Ew,{})}function Tw(){let{t:e}=Y(),t=Rg(),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)(Fv,{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;bg(void 0),n.clear(),r(`/-/users/${encodeURIComponent(e)}`)},children:e(`viewAs.stop`)})]}):null}function Ew(){let e=zg(),{t,locale:n}=Y(),r=aw(),i=qi(),[a,o]=(0,y.useState)(!1),s=(0,y.useRef)(null),c=e.data?.groups??[],l=Cw(cg.branding.name,n)??e.data?.title??cg.title,u=cg.branding.logo;return(0,y.useEffect)(()=>{o(!1);let e=decodeURIComponent(i.pathname.split(`/`).filter(Boolean)[0]??``);c.some(t=>t.resources.some(t=>t.name===e))&&iw.visit(e)},[i.pathname,c]),(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)(`aside`,{className:W(`sticky top-0 hidden h-svh shrink-0 border-e bg-sidebar text-sidebar-foreground md:block`,r.railCollapsed?`w-16`:`w-64`),children:(0,b.jsx)(pw,{title:l,logo:u,groups:c,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`,"aria-hidden":!0,onClick:()=>o(!1)}),(0,b.jsxs)(`aside`,{className:`absolute inset-y-0 start-0 flex w-72 max-w-[85vw] flex-col border-e bg-sidebar text-sidebar-foreground shadow-xl`,onClick:e=>{e.target.closest(`a`)&&o(!1)},children:[(0,b.jsx)(`div`,{className:`flex justify-end p-2`,children:(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":t(`shell.closeMenu`),onClick:()=>o(!1),children:(0,b.jsx)(rx,{})})}),(0,b.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,b.jsx)(pw,{title:l,logo:u,groups:c})})]})]}),(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)(Tw,{}),(0,b.jsx)(cw,{meta:e.data,onOpenMenu:()=>o(!0)})]}),(0,b.jsx)(`main`,{className:`flex-1 p-4 md:p-6`,children:(0,b.jsx)(Oa,{})})]}),(0,b.jsx)(Sw,{})]})}function Dw(e){let t=cg.branding.name;return t===void 0?cg.title:typeof t==`string`?t:t[e]??t[cg.locale]??Object.values(t)[0]??cg.title}function Ow(){let{t:e,locale:t}=Y(),n=Yi(),r=S(),[i]=wo(),a=_g(i.get(`next`)),o=Rg(),[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)(Da,{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);pg(e.csrfToken),bg(void 0),r.clear(),r.setQueryData([`session`],e),n(a,{replace:!0})}catch(t){if(t instanceof lg&&t.body.code===`TWO_FACTOR_REQUIRED`){g(d===`otp`?t.message:null),f(`otp`),m(``);return}f(`password`),m(``),u(``),g(t instanceof lg&&(t.status===401||t.status===429||t.status===404)?t.message:e(`auth.failed`))}finally{v(!1)}}let C=cg.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)(ZC,{}),(0,b.jsx)(XC,{})]}),(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:[C&&(0,b.jsx)(`img`,{src:C,alt:``,className:`size-10 rounded-md object-contain`}),(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:Dw(t)}),(0,b.jsx)(`h1`,{id:`login-title`,className:`text-xl font-semibold`,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)(kh,{htmlFor:`login-otp`,children:e(`auth.otp`)}),(0,b.jsx)(Oh,{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)(kh,{htmlFor:`login-username`,children:e(`auth.username`)}),(0,b.jsx)(Oh,{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)(kh,{htmlFor:`login-password`,children:e(`auth.password`)}),(0,b.jsx)(Oh,{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 kw=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 xg||(this.problems=[...this.problems,this.options.describe(n.name,Eg(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 Aw({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 kw({send:(e,t)=>Q.upload(e,{resource:o.current.resource,field:o.current.field.name},t),check:e=>Og(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 jw({resource:e,field:t,value:n,onChange:r,onBusy:i}){let a=t.file?.many===!0,o=wS(n),s=(0,y.useRef)(o);s.current=o;let c=Aw({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(jg(o,e,t)),cancel:e=>c.cancel(e),previewOf:e=>e.url??(e.token?l.current.get(e.token):void 0)}}function Mw(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 Nw({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:W(`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)(Vb,{}),n]}),!r&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,children:[o(u?`upload.dropMany`:`upload.drop`),t.file&&` · ${o(`upload.limit`,{max:Ag(t.file.maxBytes)})}`]})]})}function Pw({upload:e,onCancel:t,className:n}){let r=X(),i=Math.round(e.progress*100);return(0,b.jsxs)(`div`,{className:W(`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)(rx,{})})]})}function Fw({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 Iw(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}=jw(e),p=Mw(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:W(`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)(Gv,{className:`size-4 shrink-0 cursor-grab text-muted-foreground`,"aria-hidden":!0}):(0,b.jsx)(zv,{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:Ag(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)(V_,{})}),(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)(L_,{})})]}),(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)(rx,{})})]},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)(Pw,{upload:e,onCancel:()=>f(e.id)})]},`pending-${e.id}`))]}),(0,b.jsx)(Nw,{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)(Fw,{problems:c})]})}function Lw(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}=jw(e),m=Mw(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:W(`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)(Zv,{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)(rx,{})}),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)(hv,{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)(_v,{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)(Pw,{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)(Nw,{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)(Fw,{problems:c})]})}function Rw({className:e,...t}){return(0,b.jsx)(`textarea`,{"data-slot":`textarea`,className:W(`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 zw({id:e,field:t,value:n,onChange:r,aria:i}){return(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(Oh,{id:e,type:`text`,inputMode:`decimal`,dir:`ltr`,className:`text-end`,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),onBlur:()=>r(cx(n,t.scale)),...i}),t.currency&&(0,b.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.currency})]})}function Bw({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:W(`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:W(`block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-4 rtl:-translate-x-4`:`translate-x-0`)})})}function Vw({id:e,field:t,value:n,onChange:r,aria:i,label:a,required:o}){let s=X(),c=(t.enumValues??[]).map(e=>[e,YS(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 Hw=/^#[0-9a-f]{6}$/i;function Uw({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:Hw.test(n)?n.toLowerCase():`#000000`,onChange:e=>r(e.target.value)}),(0,b.jsx)(Oh,{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 Ww({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)(Rw,{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 Gw({id:e,field:t,value:n,onChange:r,aria:i}){return(0,b.jsx)(Rw,{id:e,rows:4,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),...i})}function Kw({id:e,field:t,value:n,onChange:r,aria:i,...a}){return(0,b.jsx)(Oh,{id:e,value:n,placeholder:t.placeholder,onChange:e=>r(e.target.value),...a,...i})}var qw=(0,y.lazy)(()=>Xa(()=>import(`./rich-text-input-5aNBuPwS.js`),__vite__mapDeps([0,1]),import.meta.url));function Jw(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)(qw,{...e})})}var Yw=`h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive`;function Xw({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}){let f=`${l}-${t.name}`,p=`${f}-error`,m=`${f}-help`,h=(i?.length??0)>0,g=[t.help?m:void 0,h?p:void 0].filter(Boolean).join(` `)||void 0,_={"aria-invalid":h?!0:void 0,"aria-describedby":g},v=typeof n==`string`?n:``,y=t.type===`relation`?void 0:JS(t,a),x=(0,b.jsxs)(b.Fragment,{children:[t.label,r&&(0,b.jsx)(`span`,{"aria-hidden":!0,className:`text-destructive`,children:`*`})]}),S=(0,b.jsx)(kh,{htmlFor:f,className:d?`sr-only`:void 0,children:x}),C=t.help?(0,b.jsx)(`p`,{id:m,className:`text-sm text-muted-foreground`,children:t.help}):null,w={id:f,field:t,value:v,onChange:e=>s(e),aria:_};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:[y===`switch`?(0,b.jsx)(Bw,{id:f,checked:e,onChange:s,aria:_}):(0,b.jsx)(`input`,{id:f,type:`checkbox`,className:`size-4 accent-primary`,checked:e,onChange:e=>s(e.target.checked),..._}),S]}),C,(0,b.jsx)(Qw,{id:p,errors:i})]})}if(t.type===`enum`&&y===`radio`)return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,b.jsx)(Vw,{...w,label:x,required:r}),C,(0,b.jsx)(Qw,{id:p,errors:i})]});let T;if(t.type===`relation`)T=(0,b.jsx)(gS,{id:f,resource:e,field:t,value:n??null,onChange:s,clearable:t.nullable,values:o,parent:u,invalid:h,describedBy:g});else if(t.type===`enum`)T=(0,b.jsxs)(`select`,{id:f,className:Yw,value:v,onChange:e=>s(e.target.value),..._,children:[(0,b.jsx)(`option`,{value:``,children:t.placeholder??`—`}),t.enumValues?.map(e=>(0,b.jsx)(`option`,{value:e,children:YS(t,e)},e))]});else switch(y){case`file`:T=(0,b.jsx)(Iw,{id:f,resource:e,field:t,value:n,onChange:s,onBusy:c,aria:_});break;case`image`:T=(0,b.jsx)(Lw,{id:f,resource:e,field:t,value:n,onChange:s,onBusy:c,aria:_});break;case`richtext`:T=(0,b.jsx)(Jw,{id:f,resource:e,field:t,value:v,onChange:s,onBusy:c,invalid:h,describedBy:g});break;case`money`:T=(0,b.jsx)(zw,{...w});break;case`date`:T=(0,b.jsx)(lS,{id:f,live:!0,value:v,label:t.label,onChange:e=>s(e),..._});break;case`datetime`:T=(0,b.jsx)(pS,{id:f,value:v,label:t.label,onChange:e=>s(e),..._});break;case`json`:T=(0,b.jsx)(Ww,{...w});break;case`textarea`:T=(0,b.jsx)(Gw,{...w});break;case`color`:T=(0,b.jsx)(Uw,{...w});break;case`password`:T=(0,b.jsx)(Kw,{...w,type:`password`,autoComplete:`new-password`});break;case`slug`:T=(0,b.jsx)(Kw,{...w,dir:`ltr`,autoCapitalize:`none`,spellCheck:!1});break;default:T=(0,b.jsx)(Kw,{...w,...Zw(t,y)})}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[S,T,C,(0,b.jsx)(Qw,{id:p,errors:i})]})}function Zw(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 Qw({id:e,errors:t}){return t?.length?(0,b.jsx)(`p`,{id:e,className:`text-sm text-destructive`,children:t.join(` `)}):null}var $w={1:``,2:`md:grid-cols-2`,3:`md:grid-cols-2 lg:grid-cols-3`};function eT({layout:e,names:t,render:n,errors:r,renderInline:i}){let a=e&&(i?e:rT(e)),o=new Set((a??[]).flatMap(e=>`tab`in e?e.sections:[e]).flatMap(e=>nT(e)?[]:e.fields)),s=t.filter(e=>!o.has(e)),c=(a??[]).filter(e=>`tab`in e),l=(a??[]).findIndex(e=>`tab`in e),u=l===-1?(a??[]).filter(e=>!(`tab`in e)):(a??[]).slice(0,l).filter(e=>!(`tab`in e)),d=l===-1?[]:(a??[]).slice(l).filter(e=>!(`tab`in e)),f=(e,t)=>nT(e)?(0,b.jsx)(y.Fragment,{children:i?.(e)},t):(0,b.jsx)(tT,{section:e,render:n},t);return(0,b.jsxs)(b.Fragment,{children:[u.map((e,t)=>f(e,`b${t}`)),c.length>0&&(0,b.jsx)(iT,{tabs:c,render:n,errors:r,block:f}),d.map((e,t)=>f(e,`a${t}`)),s.length>0&&(0,b.jsx)(tT,{section:{fields:s,columns:1},render:n})]})}function tT({section:e,render:t}){let n=(0,y.useId)(),r=e.fields.map(e=>[e,t(e)]).filter(([,e])=>e!==null);if(r.length===0)return null;let i=(0,b.jsx)(`div`,{className:W(`grid gap-5`,$w[e.columns]),children:r.map(([e,t])=>(0,b.jsx)(`div`,{className:`min-w-0`,children:t},e))});return e.title?(0,b.jsxs)(`section`,{"aria-labelledby":n,className:`flex flex-col gap-4`,children:[(0,b.jsx)(`h2`,{id:n,className:`border-b pb-1.5 text-sm font-semibold text-muted-foreground`,children:e.title}),i]}):i}var nT=e=>`inline`in e;function rT(e){return e.filter(e=>!nT(e)).map(e=>`tab`in e?{...e,sections:e.sections.filter(e=>!nT(e))}:e)}function iT({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=>(nT(e)?[`_inlines.${e.inline}`]: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=Xh(a)?`ArrowLeft`:`ArrowRight`,r=Xh(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-1 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:W(`-mb-px flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,t===s?`border-primary font-medium`:`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:W(`flex-col gap-5`,t===s?`flex`:`hidden`),children:e.sections.map((e,t)=>r(e,String(t)))},t))]})}var aT=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{};function oT({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)(sT,{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)(Lb,{}),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,NS(t.fields??[])]),children:[(0,b.jsx)(Yy,{}),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)(sT,{resource:e,field:t,path:n,pattern:r,value:aT(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 sT({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)(oT,{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)(Xw,{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 cT(e,t){let n=t?._perm?.actions;return e.actions.filter(e=>e.target===`record`&&(n===void 0||n.includes(e.name)))}function lT(e,t){let n=e.actions.filter(e=>e.target===`record`&&e.bulk);return t.length===0?n:n.filter(n=>t.some(t=>cT(e,t).includes(n)))}function uT(e){return e.actions.filter(e=>e.target===`resource`)}function dT(e,t=0){return e.confirm!==void 0||e.variant===`destructive`||t>1}function fT(e,t=0){return!e.input&&!dT(e,t)}function pT(e,t,n,r){if(dT(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 mT(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 hT(e,t){return e.kind===`bulk`?e.result:{ok:t,failed:[]}}function gT(e,t){if(!(e instanceof lg))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(` — `)}}function _T(e,t){let n=SS(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(Nh(n).trim().replace(/,/g,``))===t:n===t}function vT(e,t){return!e.showIf||Object.entries(e.showIf).every(([e,n])=>(Array.isArray(n)?n:[n]).some(n=>_T(t[e],n)))}var yT=/^.+@[^\s@]+\.[^\s@]+$/,bT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function xT(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 ST(e,t){try{return new RegExp(t.source,t.flags).test(e)}catch{return!0}}function CT(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 wT(e,t){let n=[];if(typeof e==`string`){let r=CT(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&&!ST(e,t.pattern)&&n.push(t.pattern.message??J(`validation.pattern`)),t.format===`email`&&!yT.test(e)&&n.push(J(`validation.email`)),t.format===`url`&&!xT(e)&&n.push(J(`validation.url`)),t.format===`uuid`&&!bT.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 TT(e,t,n){let r={};for(let[i,a]of Object.entries(t))for(let{path:t,value:o,sent:s,parentSent:c}of ET(e,i.split(`.`))){if(o==null||o===``){a.required&&c&&(n===`create`||s)&&(r[t]=[J(`validation.required`)]);continue}let e=wT(o,a);e.length>0&&(r[t]=e)}return r}function ET(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)=>ET(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}]:ET(c,a,`${l}.`,r&&s)}function DT({resource:e,action:t,count:n,subject:r,running:i,error:a,onRun:o,onClose:s}){let c=X(),l=t.input?.fields??[],[u,d]=(0,y.useState)(()=>NS(l)),[f,p]=(0,y.useState)({}),[m,h]=(0,y.useState)(!1),g=l.filter(e=>vT(e,u)),_=a&&!m?gT(a,l.map(e=>e.name)):{fields:{},form:null},v={..._.fields,...f};function x(e){if(e.preventDefault(),e.stopPropagation(),!t.input)return o(void 0);let{payload:n,errors:r}=FS(g,u),i={...TT(n,Object.fromEntries(Object.entries(t.input.constraints).filter(([e])=>g.some(t=>t.name===e.split(`.`)[0]))),`create`),...r};p(i),h(Object.keys(i).length>0),Object.keys(i).length===0&&o(n)}let S=pT(t,n,r,c);function C(n){let r=g.find(e=>e.name===n);if(!r||!t.input)return null;let i=e=>d(t=>({...t,[n]:e}));return r.type===`object`?(0,b.jsx)(oT,{resource:e,field:r,path:n,pattern:n,value:u[n],constraints:t.input.constraints,markRequired:!0,errors:v,idPrefix:`action`,onChange:i}):(0,b.jsx)(Xw,{resource:e,field:r,value:u[n],required:t.input.required.includes(n),errors:v[n],constraints:t.input.constraints[n],idPrefix:`action`,onChange:i})}return(0,b.jsx)(jd,{open:!0,onOpenChange:e=>!e&&!i&&s(),children:(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:`fixed inset-0 z-40 bg-black/30`}),(0,b.jsx)(Ud,{"aria-describedby":S?`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:x,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)(Jd,{className:`text-lg font-semibold`,children:t.label}),S&&(0,b.jsx)(`p`,{id:`action-question`,className:`text-sm`,children:S}),n>1&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(t.atomic?`action.atomicNote`:`action.eachNote`,{count:n})}),_.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:_.form}),t.input&&(0,b.jsx)(eT,{layout:void 0,names:l.map(e=>e.name),errors:v,render:C})]}),(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 OT({resource:e,action:t,ids:n,subject:r,size:i=`default`,blocked:a=!1,describedBy:o,onDone:s}){let c=X(),l=S(),[u,d]=(0,y.useState)(!1),f=fT(t,n?.length??0),p=pt({mutationFn:r=>Q.runAction(e,t.name,{...n?{ids:n}:{},...r?{input:r}:{}}),onSuccess:r=>{let i=mT(r);d(!1),i.kind===`bulk`?i.message&&bw(i.message):bw(i.message??c(i.kind===`record`&&i.record===null?`action.doneGone`:`action.done`,{action:t.label})),s(i,n??[]);for(let t of[`list`,`count`,`record`,`history`])l.invalidateQueries({queryKey:[t,e]})},onError:e=>{f&&bw(ug(e),`error`)}}),m=dw(t.icon);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(q,{type:`button`,size:i,variant:t.variant===`destructive`?`destructive`:`outline`,disabled:a||p.isPending,"aria-describedby":o,"data-action":t.name,onClick:()=>{p.reset(),f?p.mutate(void 0):d(!0)},children:[m&&(0,b.jsx)(m,{"aria-hidden":!0}),t.label]}),u&&(0,b.jsx)(DT,{resource:e,action:t,count:n?.length??0,subject:r,running:p.isPending,error:p.error,onRun:e=>p.mutate(e),onClose:()=>d(!1)})]})}function kT({schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a}){let o=X(),s=S(),c=cT(e,t);if(c.length===0)return null;let l=`record-actions-note`;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:l,className:`text-xs text-muted-foreground`,children:o(`action.saveFirst`)}),c.map(o=>(0,b.jsx)(OT,{resource:e.name,action:o,ids:[n],subject:typeof t._title==`string`?t._title:`#${n}`,blocked:r,describedBy:r?l:void 0,onDone:t=>{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))]})}function AT(e){let t=(0,y.useRef)(!1),n=ha(({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 jT({blocker:e}){let t=X();return e.state===`blocked`?(0,b.jsxs)(`div`,{role:`alertdialog`,"aria-labelledby":`leave-title`,className:`sticky top-16 z-10 flex flex-wrap items-center gap-2 rounded-md border border-amber-500/50 bg-background p-3 shadow-sm`,children:[(0,b.jsx)(`p`,{id:`leave-title`,className:`flex-1 text-sm font-medium`,children:t(`form.leaveTitle`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,autoFocus:!0,onClick:()=>e.reset(),children:t(`form.stay`)}),(0,b.jsx)(q,{type:`button`,variant:`destructive`,onClick:()=>e.proceed(),children:t(`form.leave`)})]}):null}function MT(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 NT(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)}}var PT=3;function FT({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,PT);return(0,b.jsxs)(`span`,{className:W(`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:W(`rounded-md border bg-muted object-cover`,n?`size-24`:`size-8`)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(zv,{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:Ag(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 IT={gray:`bg-muted text-muted-foreground`,red:`bg-red-500/15 text-red-700 dark:text-red-300`,amber:`bg-amber-500/15 text-amber-800 dark:text-amber-300`,green:`bg-green-500/15 text-green-800 dark:text-green-300`,blue:`bg-blue-500/15 text-blue-800 dark:text-blue-300`,purple:`bg-purple-500/15 text-purple-800 dark:text-purple-300`,pink:`bg-pink-500/15 text-pink-800 dark:text-pink-300`};function LT({value:e,field:t,className:n}){if(e==null)return(0,b.jsx)(b.Fragment,{children:lx(e,t)});let r=t.colors?.[String(e)]??`gray`;return(0,b.jsx)(`span`,{"data-color":r,className:W(`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap`,IT[r],n),children:lx(e,t)})}function RT({value:e,field:t,record:n,detailed:r,plain:i}){return t.file&&n?(0,b.jsx)(FT,{field:t,files:TS(n,t.name),detailed:r,plain:i}):t.widget===`badge`?(0,b.jsx)(LT,{value:e,field:t}):(0,b.jsx)(b.Fragment,{children:lx(e,t)})}function zT(e,t){return e.fields.filter(t=>t!==e.order).flatMap(e=>t.fields.filter(t=>t.name===e))}function BT(e,t,n){let r=n?._inlines?.[e.inline],i=zT(e,t);return(r?.rows??[]).map(e=>({key:String(e._id),id:String(e._id),record:e,values:NS(i,e)}))}function VT(e,t,n){return{key:n,values:NS(zT(e,t))}}function HT(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 UT(e,t,n,r){let i=zT(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=HT(e,t),{payload:o,errors:c}=FS(i.filter(e=>!r.has(e.name)),e.values,n.values),l={...TT(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}=FS(i,e.values),s={...TT(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
|
+
`)!==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 WT(e,t,n,r,i){let a={},o={};for(let s of e){let e=t[s.inline];if(!e)continue;let c=r[s.inline]??[],l=UT(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 GT(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 KT=e=>Object.values(e).some(e=>e.inline.length>0||Object.keys(e.rows).length>0);function qT({inline:e,child:t,rows:n,onChange:r,readOnly:i,errors:a,parent:o,parentValues:s,onBusy:c,truncated:l}){let u=X(),d=(0,y.useId)(),f=zT(e,t),p=(0,y.useRef)(0),[m,h]=(0,y.useState)(null),g=!i&&t.permissions?.create!==!1&&t.form.create.length>0&&n.length<e.max,_=!i&&e.order!==void 0&&t.form.update.includes(e.order)&&n.length>1,v=e=>!i&&(e.id===void 0||t.permissions?.delete!==!1&&e.record?._perm?.delete!==!1),x=e=>s===void 0?void 0:JSON.stringify({...JSON.parse(IS(f,e.values)??`{}`),_parent:JSON.parse(s)});function S(){let i;do i=`n${++p.current}`;while(n.some(e=>e.key===i));r([...n,VT(e,t,i)])}let C=(e,t,i)=>r(n.map(n=>n.key===e?{...n,values:{...n.values,[t]:i}}:n)),w=e=>r(n.filter(t=>t.key!==e));function T(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 E(e,n,r){let s=`inline-${t.name}-${e.key}`,l=a?.rows[e.key]??{},u=e.id===void 0;if(i||!(u?t.form.create:t.form.update).includes(n.name)||HT(e,t).has(n.name))return u?null:(0,b.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-readonly":n.name,children:[!r&&(0,b.jsx)(`span`,{className:`text-sm font-medium`,children:n.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)(RT,{value:e.record?.[n.name],field:n,record:e.record})})]});let d=u?`create`:`update`;return n.type===`object`?(0,b.jsx)(oT,{resource:t.name,field:n,path:n.name,pattern:n.name,value:e.values[n.name],constraints:t.form.constraints[d],markRequired:u,errors:l,idPrefix:s,onChange:t=>C(e.key,n.name,t)}):(0,b.jsx)(Xw,{resource:t.name,field:n,value:e.values[n.name],required:u&&t.form.requiredOnCreate.includes(n.name),errors:l[n.name],constraints:t.form.constraints[d][n.name],formValues:n.type===`relation`?x(e):void 0,parent:o,idPrefix:s,hideLabel:r,onChange:t=>C(e.key,n.name,t),onBusy:r=>c(`${t.name}:${e.key}:${n.name}`,r)})}function D(t,r){let i=u(`inline.row`,{name:e.label,index:r+1});return(0,b.jsxs)(`div`,{className:`flex items-center gap-1`,children:[_&&(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`,h(r)},onDragEnd:()=>h(null),children:(0,b.jsx)(Gv,{className:`size-4`})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:r===0,"aria-label":u(`inline.moveUp`,{name:i}),onClick:()=>T(r,r-1),children:(0,b.jsx)(V_,{})}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:r===n.length-1,"aria-label":u(`inline.moveDown`,{name:i}),onClick:()=>T(r,r+1),children:(0,b.jsx)(L_,{})})]}),v(t)&&(0,b.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":u(`inline.remove`,{name:i}),onClick:()=>w(t.key),children:(0,b.jsx)(Lb,{})})]})}let O=e=>_?{onDragOver:e=>{m!==null&&e.preventDefault()},onDrop:t=>{t.preventDefault(),m!==null&&T(m,e),h(null)}}:{},k=e=>{let t=Object.entries(a?.rows[e.key]??{}).filter(([e])=>!f.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},A=_||n.some(v);return(0,b.jsxs)(`section`,{"aria-labelledby":d,className:`flex min-w-0 flex-col gap-3`,"data-inline":t.name,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2 border-b pb-1.5`,children:[(0,b.jsx)(`h2`,{id:d,className:`text-sm font-semibold text-muted-foreground`,children:e.label}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:YT(u,e,n.length)})]}),l&&(0,b.jsxs)(`p`,{role:`note`,className:`text-sm text-muted-foreground`,children:[u(`inline.truncated`,{count:l.total-n.length}),` `,(0,b.jsx)(bo,{to:l.href,className:`text-primary hover:underline`,children:u(`inline.openList`)})]}),n.length===0&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:u(`inline.empty`)}),n.length>0&&e.display===`table`&&(0,b.jsx)(`div`,{className:`relative overflow-x-auto rounded-lg border`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{className:`bg-muted/40`,children:(0,b.jsxs)(`tr`,{children:[f.map(e=>(0,b.jsxs)(`th`,{scope:`col`,className:`px-2 py-1.5 text-start font-medium`,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)),A&&(0,b.jsx)(`th`,{scope:`col`,className:`px-2 py-1.5`,children:(0,b.jsx)(`span`,{className:`sr-only`,children:u(`inline.rowActions`)})})]})}),(0,b.jsx)(`tbody`,{children:n.map((e,t)=>(0,b.jsxs)(`tr`,{"data-row":e.key,className:W(`border-t align-top`,m===t&&`opacity-50`),...O(t),children:[f.map(t=>(0,b.jsx)(`td`,{className:`min-w-32 px-2 py-1.5`,children:E(e,t,!0)},t.name)),A&&(0,b.jsx)(`td`,{className:`px-2 py-1.5`,children:D(e,t)})]},e.key))})]})}),e.display===`table`&&n.map(e=>(0,b.jsx)(y.Fragment,{children:k(e)},e.key)),e.display===`cards`&&n.map((n,r)=>(0,b.jsxs)(`div`,{"data-row":n.key,className:W(`flex flex-col gap-4 rounded-lg border p-3`,m===r&&`opacity-50`),...O(r),children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,b.jsx)(`span`,{className:`text-sm font-medium`,children:JT(n)??u(`inline.newRow`,{name:e.label,index:r+1})}),D(n,r)]}),(0,b.jsx)(eT,{layout:t.form.layout,names:f.map(e=>e.name),errors:a?.rows[n.key]??{},render:e=>{let t=f.find(t=>t.name===e);return t?E(n,t,!1):null}}),k(n)]},n.key)),a&&a.inline.length>0&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a.inline.join(` — `)}),g&&(0,b.jsx)(`div`,{children:(0,b.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:S,children:[(0,b.jsx)(Yy,{}),u(`form.add`,{name:e.label})]})})]})}var JT=e=>typeof e.record?._title==`string`?e.record._title:void 0;function YT(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 XT=(e,t)=>t===void 0?[`history`,e]:[`history`,e,t];function ZT({schema:e,id:t,record:n}){let r=X(),i=zg(),a=mt({queryKey:XT(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)(G,{children:r(`common.loading`)});if(a.isError&&!a.data)return(0,b.jsx)(G,{tone:`error`,children:ug(a.error)});let o=a.data.pages.flatMap(e=>e.entries);if(o.length===0)return(0,b.jsx)(G,{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)(Fx,{entries:o,now:new Date(a.dataUpdatedAt),names:fx(i.data,s),schemaOf:s,titleOf:(e,t)=>QT(n,e,t)}),a.isError&&(0,b.jsx)(G,{tone:`error`,children:ug(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 QT(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 $T(e){return e.normalize(`NFKD`).replace(/\p{M}/gu,``).normalize(`NFC`).toLowerCase().replace(/[^\p{L}\p{N}]+/gu,`-`).replace(/^-+|-+$/g,``)}function eE(e,t,n){let r=typeof t?._title==`string`?t._title:`#${n}`;return r.startsWith(`#`)?`${e} ${r}`:`${e}: ${r}`}function tE({mode:e}){let t=X(),{resource:n=``,id:r}=$i(),i=qi(),[a]=wo(),o=e===`create`?a.get(`from`)??void 0:void 0,s=e===`edit`?r:o,c=Bg(n),l=Ug(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)(G,{children:t(`common.loading`)});if(c.isError)return(0,b.jsx)(G,{tone:`error`,children:c.error.message});if(s!==void 0&&l.isError)return(0,b.jsx)(G,{tone:`error`,children:l.error.message});let g=i.state?.saved;return(0,b.jsx)(rE,{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 nE(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`?AS(t):t]))}function rE({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=new Set(t===`edit`?m?[...e.form.readonly,...sE(r)]:[...e.form.update,...e.form.readonly]:[]),_=t===`create`?e.form.create:[...e.form.update,...e.form.readonly],v=e.fields.filter(e=>_.includes(e.name)),x=v.filter(e=>!g.has(e.name)),C=x.map(e=>e.name),[w,T]=(0,y.useState)(r),[E,D]=(0,y.useState)(()=>NS(x,r??(i?nE(e,i):void 0))),[O,k]=(0,y.useState)(E),A=iE(e),j=t=>Object.fromEntries(A.map(n=>[n.inline,BT(n,e.inlines[n.inline],t)])),[M,N]=(0,y.useState)(()=>j(r)),[ee,P]=(0,y.useState)(M),[F,te]=(0,y.useState)({}),ne=(0,y.useRef)(void 0),re=e.version?w?.[e.version]:void 0,[ie,ae]=(0,y.useState)(null),oe=IS(x,O),[se,ce]=(0,y.useState)({}),[le,ue]=(0,y.useState)(null),de=Rg(),fe=t===`edit`&&n!==void 0&&de.data?.audit.enabled===!0,pe=fe?s:`details`,me=(0,y.useRef)(new Set(x.filter(e=>e.widget===`slug`&&E[e.name]!==``).map(e=>e.name)));function I(e,t){k(n=>{let r={...n,[e]:t};if(typeof t==`string`)for(let n of x)n.slugFrom===e&&!me.current.has(n.name)&&(r[n.name]=$T(t));return r}),x.some(t=>t.name===e&&t.widget===`slug`)&&me.current.add(e)}let[L,he]=(0,y.useState)(a?l(`form.savedName`,{name:a}):null),ge=NT(()=>ue(null)),_e=JSON.stringify(O)!==JSON.stringify(E)||JSON.stringify(ee)!==JSON.stringify(M),{blocker:ve,release:ye}=AT(_e),be=(0,y.useRef)(null),xe=(0,y.useRef)(`list`);MT(be,()=>{xe.current=`stay`});let Se=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:XT(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=NS(x,r),i=j(r);T(r),D(t),k(t),N(i),P(i),te({}),he(l(`form.savedName`,{name:a})),await f.invalidateQueries({queryKey:[`record`,e.name,n]});return}ye(),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 lg)){ue(e.message);return}if(e.status===409&&e.body.current){ae(e.body.current);return}let t=gT(e,[...C,`_inlines`]),n=GT(t.fields,ne.current);ce(n.parent),te(n.inlines),ue(t.form)}}),[Ce,we]=(0,y.useState)(!1),Te=pt({mutationFn:()=>Q.remove(e.name,n,re),onSuccess:async()=>{ye(),await f.invalidateQueries({queryKey:[`list`,e.name]}),d(`/${e.name}`),f.removeQueries({queryKey:[`record`,e.name,n]})},onError:e=>{we(!1),ue(ug(e))}}),Ee=x.filter(e=>vT(e,O));function De(){let n=FS(Ee,O,t===`edit`?E:void 0),r=WT(A,e.inlines??{},M,ee,(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 ne.current=r.changes,{payload:r.changes?{...n.payload,_inlines:r.changes}:n.payload,errors:n.errors,inlineErrors:r.errors}}function Oe(n){if(n.preventDefault(),!m)return;let r=n.nativeEvent.submitter,i=r?.value===`new`?`new`:r?`list`:xe.current;if(xe.current=`list`,he(null),ge.busy){ue(l(`upload.busy`)),ge.refuse();return}let{payload:a,errors:o,inlineErrors:s}=De(),u=t===`create`?`create`:`update`,d={...TT(a,Object.fromEntries(Object.entries(e.form.constraints[u]).filter(([e])=>Ee.some(t=>t.name===e.split(`.`)[0]))),u),...o};ce(d),te(s),ue(null),Object.keys(d).length===0&&!KT(s)?Se.mutate({payload:a,version:re,then:i}):c(`details`)}function ke(t){ae(null),Se.mutate({payload:De().payload,version:e.version?t[e.version]:void 0,then:Se.variables?.then??`list`})}function Ae(e){let t=NS(x,e);ae(null),T(e),D(t),k(t),ce({})}function je(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)(qT,{inline:t,child:i,rows:ee[t.inline]??[],onChange:e=>P(n=>({...n,[t.inline]:e})),readOnly:!m||o!==void 0,errors:F[t.inline],parent:e.name,parentValues:oe,onBusy:ge.setBusy,truncated:o})}function Me(n){let i=v.find(e=>e.name===n);if(!i||!vT(i,O))return null;if(g.has(n))return(0,b.jsx)(cE,{resource:e.name,field:i,record:r});let a=t===`create`?`create`:`update`;return i.type===`object`?(0,b.jsx)(oT,{resource:e.name,field:i,path:i.name,pattern:i.name,value:O[i.name],constraints:e.form.constraints[a],markRequired:t===`create`,errors:se,onChange:e=>I(i.name,e)}):(0,b.jsx)(Xw,{resource:e.name,field:i,value:O[i.name],required:t===`create`&&e.form.requiredOnCreate.includes(i.name),errors:se[i.name],formValues:i.type===`relation`?oe:void 0,constraints:e.form.constraints[a][i.name],onChange:e=>I(i.name,e),onBusy:e=>ge.setBusy(i.name,e)})}return(0,b.jsxs)(`form`,{ref:be,onSubmit:Oe,noValidate:!0,className:W(`flex flex-col gap-5`,e.form.layout?.length?`max-w-4xl`:`max-w-2xl`),children:[t===`create`?(0,b.jsx)(`h1`,{className:`text-xl font-semibold`,children:l(`form.new`,{name:e.label})}):(0,b.jsx)(lE,{schema:e,record:r,id:n,dirty:_e,onGone:()=>{ye(),d(`/${e.name}`)},onChanged:o}),i&&A.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(A.map(e=>e.label))})}),!m&&(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`)}),L&&(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:L}),(0,b.jsx)(jT,{blocker:ve}),fe&&(0,b.jsx)(oE,{active:pe,onChange:c}),ie&&(0,b.jsx)(uE,{fields:x,before:w,current:ie,busy:Se.isPending,onKeepMine:()=>ke(ie),onLoadTheirs:()=>Ae(ie)}),le&&(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:le}),fe&&pe===`history`&&(0,b.jsx)(`div`,{role:`tabpanel`,id:`record-panel-history`,"aria-labelledby":`record-tab-history`,children:(0,b.jsx)(ZT,{schema:e,id:n,record:r})}),(0,b.jsxs)(`div`,{className:pe===`details`?`contents`:`hidden`,...fe?{role:`tabpanel`,id:`record-panel-details`,"aria-labelledby":`record-tab-details`}:{},children:[(0,b.jsx)(eT,{layout:e.form.layout,names:v.map(e=>e.name),errors:{...se,...Object.fromEntries(Object.entries(F).filter(([,e])=>KT({found:e})).map(([e])=>[`_inlines.${e}`,[``]]))},render:Me,renderInline:je}),(0,b.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap gap-2 border-t bg-background py-3 md:static md:border-0 md:py-0`,children:[m&&(0,b.jsx)(q,{type:`submit`,value:`list`,disabled:Se.isPending||ge.busy,"aria-keyshortcuts":`Control+S Meta+S`,children:l(Se.isPending?`form.saving`:`form.save`)}),m&&e.creatable&&(0,b.jsx)(q,{type:`submit`,value:`new`,variant:`outline`,disabled:Se.isPending||ge.busy,children:l(`form.saveAndNew`)}),(0,b.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>d(`/${e.name}`),children:l(m?`common.cancel`:`form.back`)}),t===`edit`&&e.creatable&&(0,b.jsx)(q,{asChild:!0,variant:`outline`,children:(0,b.jsxs)(bo,{to:`/${e.name}/new?${new URLSearchParams({from:n})}`,children:[(0,b.jsx)(Cv,{}),l(`form.duplicate`)]})}),t===`edit`&&h&&(Ce?(0,b.jsxs)(`div`,{className:`ms-auto flex gap-2`,children:[(0,b.jsx)(q,{type:`button`,variant:`destructive`,disabled:Te.isPending,onClick:()=>Te.mutate(),children:l(Te.isPending?`form.deleting`:e.softDelete?`form.confirmMoveToTrash`:`form.confirmDelete`)}),(0,b.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>we(!1),children:l(`form.keep`)})]}):(0,b.jsx)(q,{type:`button`,variant:`outline`,className:`ms-auto`,onClick:()=>we(!0),children:l(e.softDelete?`form.moveToTrash`:`form.delete`)}))]}),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)(bo,{to:`/${t.resource}?${new URLSearchParams({[`filter[${t.field}][${t.operator}]`]:String(r[e.primaryKeys[0]])})}`,children:t.label})})},`${t.resource}:${t.field}`))})]})]})]})}function iE(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 aE=[`details`,`history`];function oE({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-1 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:aE.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:W(`-mb-px border-b-2 px-3 py-2 text-sm whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,i===e?`border-primary font-medium`:`border-transparent text-muted-foreground hover:text-foreground`),children:n(i===`details`?`audit.details`:`audit.history`)},i))})}var sE=e=>Array.isArray(e?._readonly)?e._readonly:[];function cE({resource:e,field:t,record:n}){let r=X(),i=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:`flex items-center gap-1.5 text-sm font-medium`,children:[t.label,(0,b.jsx)(_y,{className:`size-3.5 text-muted-foreground`,"aria-label":r(`form.readOnly`),role:`img`})]}),(0,b.jsx)(`div`,{className:`min-h-8 rounded-lg bg-muted/50 px-2.5 py-1.5 text-sm break-words`,children:t.widget===`richtext`&&typeof i==`string`&&i!==``?(0,b.jsx)(Jw,{id:`field-${t.name}`,resource:e,field:t,value:i,readOnly:!0}):(0,b.jsx)(RT,{value:i,field:t,record:n,detailed:!0})}),t.help&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.help})]})}function lE({schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a}){let o=X(),s=e.fields.filter(e=>e.widget===`badge`&&t?.[e.name]!==void 0&&t?.[e.name]!==null),c=Array.isArray(t?._links)?t._links:[];return(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h1`,{className:`text-xl font-semibold`,children:eE(e.label,t,n)}),s.map(e=>(0,b.jsx)(LT,{value:t[e.name],field:e},e.name)),t&&n!==void 0&&(0,b.jsx)(kT,{schema:e,record:t,id:n,dirty:r,onGone:i,onChanged:a})]}),c.length>0&&(0,b.jsx)(`ul`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-sm`,children:c.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":o(`form.externalLink`,{name:e.label}),children:[e.label,(0,b.jsx)(Nv,{className:`size-3.5 rtl:-scale-x-100`,"aria-hidden":!0})]})},`${e.label}:${e.href}`))})]})}function uE({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)(`div`,{role:`alertdialog`,"aria-labelledby":`conflict-title`,"aria-describedby":`conflict-body`,className:`flex flex-col gap-3 rounded-md border border-amber-500/50 bg-amber-500/10 p-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:lx(t?.[e.name],e)}),` → `,lx(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`,onClick:a,children:o(`form.loadTheirs`)})]})]})}function dE(){let{t:e}=Y(),{group:t}=$i(),n=zg();if(n.isPending)return(0,b.jsx)(G,{children:e(`common.loading`)});if(n.isError)return(0,b.jsx)(G,{tone:`error`,children:n.error.message});let r=n.data.groups.find(e=>e.key===t);return r?(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`h1`,{className:`text-xl font-semibold`,children:r.label}),(0,b.jsx)(pE,{group:r})]}):(0,b.jsx)(G,{children:e(`common.pageNotFound`)})}function fE({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)(bo,{to:`/g/${e.key}`,className:`hover:underline`,children:e.label})}),(0,b.jsx)(pE,{group:e})]},e.key))})}function pE({group:e}){return(0,b.jsxs)(b.Fragment,{children:[e.resources.length>0&&(0,b.jsx)(gE,{resources:e.resources}),e.pages.length>0&&(0,b.jsx)(hE,{pages:e.pages})]})}var mE=`flex items-center gap-3 rounded-lg border p-4 hover:bg-muted/50`;function hE({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=uw(e.icon,`page`);return(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{to:`/p/${e.name}`,className:mE,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 gE({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=uw(e.icon,`resource`),o=r[i]?.data,s=o&&o.total!==null?t(o.estimated?`shell.aboutRecords`:`shell.records`,{count:Qh(o.total,n)}):void 0;return(0,b.jsx)(`li`,{children:(0,b.jsxs)(bo,{to:`/${e.name}`,className:mE,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)})})}function _E(){let e=X(),t=zg();return t.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):t.isError?(0,b.jsx)(G,{tone:`error`,children:t.error.message}):t.data.groups.length===0?(0,b.jsx)(G,{children:e(`shell.noResources`)}):(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsx)(`h1`,{className:`text-xl font-semibold`,children:t.data.title}),(0,b.jsx)(fE,{groups:t.data.groups})]})}var vE={order:[],hidden:[],widths:{},density:`comfortable`},yE=e=>`nma.columns.${e}`;function bE(e,t){return xE(e,t).filter(e=>!t.hidden.includes(e))}function xE(e,t){let n=t.order.filter(t=>e.includes(t));return[...n,...e.filter(e=>!n.includes(e))]}function SE(e){let t=new Map,n=new Set,r=n=>{let r=t.get(n);if(!r){r=vE;try{let t=e?.getItem(yE(n));t&&(r={...vE,...JSON.parse(t)})}catch{r=vE}t.set(n,r)}return r},i=(r,i)=>{t.set(r,i);try{e?.setItem(yE(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=xE(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(yE(r))}catch{}t.set(r,vE);for(let e of n)e()}}}function CE(){try{return typeof localStorage>`u`?void 0:localStorage}catch{return}}var wE=SE(CE());function TE(e){return(0,y.useSyncExternalStore)(wE.subscribe,()=>wE.get(e))}function EE({schema:e,prefs:t}){let n=X(),r=xE(e.list.columns,t),i=t=>e.fields.find(e=>e.name===t)?.label??t,a=r.filter(e=>!t.hidden.includes(e));return(0,b.jsxs)(Sh,{children:[(0,b.jsx)(Ch,{asChild:!0,children:(0,b.jsxs)(q,{variant:`outline`,className:`hidden md:inline-flex`,children:[(0,b.jsx)(xv,{}),n(`list.columns`)]})}),(0,b.jsx)(wh,{children:(0,b.jsxs)(Th,{align:`end`,sideOffset:4,className:`z-50 flex w-72 flex-col gap-3 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md`,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)(ff,{checked:c,disabled:c&&a.length===1,onCheckedChange:()=>wE.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)(dv,{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:()=>wE.move(e.name,e.list.columns,o,-1),children:(0,b.jsx)(V_,{})}),(0,b.jsx)(q,{variant:`ghost`,size:`icon-sm`,"aria-label":n(`list.moveDown`,{name:i(o)}),disabled:s===r.length-1,onClick:()=>wE.move(e.name,e.list.columns,o,1),children:(0,b.jsx)(L_,{})})]},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:()=>wE.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:()=>wE.reset(e.name),children:n(`list.resetColumns`)})]})})]})}function DE({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:W(`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);wE.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;wE.setWidth(e,t,i+(o?10:-10))},onClick:e=>e.stopPropagation()})}var OE=`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 kE({schema:e,item:t,field:n}){let r=X(),i=S(),[a,o]=(0,y.useState)(!1),s=NS([n],t)[n.name],[c,l]=(0,y.useState)(s),[u,d]=(0,y.useState)(null),f=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 lg?e.fields[n.name]?.join(` `)??e.message:e.message),l(s),o(!1)}});function p(t=c){if(t===s){o(!1);return}let{payload:r,errors:i}=FS([n],{[n.name]:t},{[n.name]:s}),a=TT(r,{[n.name]:e.form.constraints.update[n.name]??{}},`update`),l=i[n.name]??a[n.name];if(l){d(l.join(` `));return}f.mutate(r)}let m=e=>{e.key===`Enter`?(e.preventDefault(),p()):e.key===`Escape`&&(e.preventDefault(),l(s),d(null),o(!1))},h=`cell-${e.name}-${String(t._id)}-${n.name}-error`,g={"aria-label":n.label,"aria-invalid":u?!0:void 0,"aria-describedby":u?h:void 0,autoFocus:!0,disabled:f.isPending,className:OE,onKeyDown:m},_;if(!a)_=(0,b.jsx)(`button`,{type:`button`,className:W(`-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:lx(t[n.name],n)}),onClick:()=>{l(s),o(!0)},children:(0,b.jsx)(RT,{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,YS(n,e)]);_=(0,b.jsxs)(`select`,{...g,value:String(c),onChange:e=>{let t=n.type===`boolean`?e.target.value===`true`:e.target.value;l(t),p(t)},onBlur:()=>o(!1),children:[n.nullable&&n.type===`enum`&&(0,b.jsx)(`option`,{value:``,children:r(`common.empty`)}),e.map(([e,t])=>(0,b.jsx)(`option`,{value:e,children:t},e))]})}else if(n.type===`date`)_=(0,b.jsx)(lS,{id:`cell-${e.name}-${String(t._id)}-${n.name}`,label:n.label,value:String(c),onChange:e=>{l(e),p(e)},autoFocus:!0,"aria-invalid":u?!0:void 0,"aria-describedby":u?h:void 0,className:`min-w-44`,onKeyDown:m});else{let e=n.type===`number`||n.type===`decimal`||n.type===`bigint`;_=(0,b.jsx)(`input`,{...g,type:`text`,inputMode:e?n.type===`bigint`?`numeric`:`decimal`:void 0,value:String(c),onChange:e=>l(e.target.value),onBlur:()=>p()})}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-0.5`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[_,u&&(0,b.jsx)(`p`,{id:h,role:`alert`,className:`text-xs text-destructive`,children:u})]})}var AE=e=>e.total===null?e.hasMore===!0:e.page*e.pageSize<e.total;function jE({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:AE(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`,children:[d.isPending&&Array.from({length:4},(e,t)=>(0,b.jsx)(`li`,{"aria-hidden":!0,className:`h-20 animate-pulse rounded-lg border bg-muted/40`},`skeleton-${t}`)),p.map(t=>{let o=String(t._id),c=(0,b.jsx)(ME,{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-lg border p-3`,children:[c,s(t)]}):i?(0,b.jsxs)(`label`,{className:W(`flex cursor-pointer items-start gap-3 rounded-lg border p-3`,a.has(o)&&`border-primary bg-primary/5`),children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`mt-1 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)(bo,{to:`/${e.name}/${encodeURIComponent(o)}`,className:`block rounded-lg border p-3 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:Qh(p.length)}):l(`list.showingOf`,{shown:Qh(p.length),total:Qh(m)})}),g&&(0,b.jsx)(q,{variant:`outline`,size:`sm`,disabled:_,onClick:()=>void v(),children:l(_?`common.loading`:`list.loadMore`)})]})]})}function ME({schema:e,item:t,columns:n}){let r=e.list.mobile,i=typeof t._title==`string`?t._title:String(t._id);if(!r)return(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`div`,{className:`font-medium`,children:i}),(0,b.jsx)(`dl`,{className:`mt-1 grid grid-cols-2 gap-x-3 gap-y-0.5 text-sm`,children:n.filter(e=>lx(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)(RT,{value:t[e.name],field:e,record:t,plain:!0})})]},e.name))})]});let a=t=>t?e.fields.find(e=>e.name===t):void 0,o=a(r.title),s=a(r.subtitle),c=a(r.badge),l=r.meta.map(a).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 font-medium`,children:o?lx(t[o.name],o):i}),c&&t[c.name]!==null&&t[c.name]!==void 0&&(0,b.jsx)(LT,{value:t[c.name],field:c,className:`shrink-0`})]}),s&&(0,b.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:lx(t[s.name],s)}),l.length>0&&(0,b.jsx)(`dl`,{className:`mt-1 flex flex-wrap gap-x-4 gap-y-0.5 text-sm`,children:l.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)(RT,{value:t[e.name],field:e,record:t,plain:!0})})]},e.name))})]})}function NE({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=Ug(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)(jd,{open:t!==void 0,onOpenChange:e=>!e&&n(),children:(0,b.jsxs)(Ld,{children:[(0,b.jsx)(zd,{className:`fixed inset-0 z-40 bg-black/30`}),(0,b.jsxs)(Ud,{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)(Jd,{className:`min-w-0 flex-1 truncate text-lg font-semibold`,children:r(`list.quickView`,{name:s})}),(0,b.jsx)(Xd,{asChild:!0,children:(0,b.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":r(`list.close`),children:(0,b.jsx)(rx,{})})})]}),(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)(RT,{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)(bo,{to:`/${e.name}/${encodeURIComponent(a??``)}`,children:[(0,b.jsx)(Vy,{}),r(`list.edit`)]})}),(0,b.jsx)(Xd,{asChild:!0,children:(0,b.jsx)(q,{variant:`outline`,children:r(`list.close`)})})]})]})]})})}function PE({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:W(`w-full caption-bottom text-sm`,e),...t})})}function FE({className:e,...t}){return(0,b.jsx)(`thead`,{"data-slot":`table-header`,className:W(`[&_tr]:border-b`,e),...t})}function IE({className:e,...t}){return(0,b.jsx)(`tbody`,{"data-slot":`table-body`,className:W(`[&_tr:last-child]:border-0`,e),...t})}function LE({className:e,...t}){return(0,b.jsx)(`tr`,{"data-slot":`table-row`,className:W(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function RE({className:e,...t}){return(0,b.jsx)(`th`,{"data-slot":`table-head`,className:W(`h-10 px-2 text-start align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pe-0`,e),...t})}function zE({className:e,...t}){return(0,b.jsx)(`td`,{"data-slot":`table-cell`,className:W(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pe-0`,e),...t})}function BE(e){let t=e.map(e=>String(e).replace(/~/g,`~0`).replace(/,/g,`~1`)).join(`,`);return t===`new`?`~new`:t}function VE(){let{resource:e=``}=$i(),[t,n]=wo(),r=Math.max(1,Number(t.get(`page`))||1),i=t.get(`sort`)??void 0,a=Bg(e),o=qS(),s=Hg(e,zS(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=TE(e),h=zS(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)(G,{children:d(`common.loading`)});if(a.isError)return(0,b.jsx)(G,{tone:`error`,children:a.error.message});let M=a.data,N=bE(M.list.columns,m).map(e=>M.fields.find(t=>t.name===e)).filter(e=>e!==void 0),ee=N.filter(e=>!M.primaryKeys.includes(e.name)),P=i?{field:i.replace(/^-/,``),direction:i.startsWith(`-`)?`desc`:`asc`}:M.list.defaultSort,F=s.data?.items??[],te=M.list.pagination===`keyset`,ne=t.get(`after`),re=te?{summary:WS(s.data,1).summary,label:d(`list.page`,{page:k.length+1}),hasNext:!!s.data?.nextCursor}:WS(s.data,r),ie=te?k.length>0:r>1;function ae(){if(!te)return de({page:String(r+1)});A([...k,ne??``]),de({after:s.data?.nextCursor??null})}function oe(){if(!te)return de({page:String(r-1)});let e=k[k.length-1];A(k.slice(0,-1)),de({after:e||null})}let se=M.permissions??{create:!0,update:!0,delete:!0,purge:!0},ce=!p&&(se.delete||lT(M,[]).length>0),le=lT(M,F.filter(e=>_.has(String(e._id)))),ue=e=>`/${M.name}/${encodeURIComponent(String(e._id))}`;function de(e){n(t=>US(t,e))}function fe(e){de({sort:P.field===e&&P.direction===`asc`?`-${e}`:e})}return(0,b.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`h1`,{className:`text-xl font-semibold`,children:M.label}),(0,b.jsx)(`div`,{className:`ms-auto`}),(0,b.jsx)(EE,{schema:M,prefs:m}),M.softDelete&&se.delete&&(0,b.jsxs)(q,{variant:p?`secondary`:`outline`,"aria-pressed":p,onClick:()=>de({trashed:p?null:`only`}),children:[(0,b.jsx)(Lb,{}),d(`list.trash`)]}),o&&ce&&(0,b.jsxs)(q,{variant:c?`secondary`:`outline`,"aria-pressed":c,onClick:()=>{l(!c),v(new Set)},children:[(0,b.jsx)(py,{}),d(c?`list.done`:`list.select`)]}),!p&&uT(M).map(e=>(0,b.jsx)(OT,{resource:M.name,action:e,onDone:()=>void 0},e.name)),M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,children:(0,b.jsxs)(bo,{to:`/${M.name}/new`,children:[(0,b.jsx)(Yy,{}),d(`list.new`)]})})]}),(0,b.jsx)(QS,{schema:M,params:t,onChange:de}),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`),` `,ug(s.error)]}),(0,b.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void s.refetch(),children:d(`list.retry`)})]}),f.isError&&(0,b.jsx)(G,{tone:`error`,children:ug(f.error)}),p&&(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:d(`list.trashNote`)}),ce&&_.size>0&&(0,b.jsxs)(`div`,{role:`region`,"aria-label":d(`list.selected`,{count:_.size}),className:`flex flex-wrap items-center gap-2 rounded-lg border bg-muted/40 px-3 py-2 text-sm`,children:[(0,b.jsx)(`span`,{className:`font-medium`,children:d(`list.selected`,{count:_.size})}),le.map(e=>(0,b.jsx)(OT,{resource:M.name,action:e,ids:[..._],size:`sm`,onDone:(t,n)=>{let r=hT(t,n);v(new Set),O.reset(),D({title:d(`action.bulkDone`,{action:e.label,count:r.ok.length}),result:r})}},e.name)),se.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:`sm`,onClick:()=>T(!0),children:[(0,b.jsx)(Lb,{}),d(`list.deleteSelected`)]}):null,(0,b.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>v(new Set),children:d(`list.clearSelection`)})]}),E&&(0,b.jsx)(WE,{title:E.title,result:E.result,items:F}),O.isError&&(0,b.jsx)(G,{tone:`error`,children:ug(O.error)}),o?(0,b.jsx)(jE,{schema:M,query:g,columns:ee,trash:p,selectMode:c,selected:_,onSelect:v,restore:e=>(0,b.jsx)(UE,{item:e,pending:f.isPending,onRestore:e=>f.mutate(e)}),empty:(0,b.jsxs)(b.Fragment,{children:[d(VS(t)?`list.noMatches`:`list.noRecords`),!VS(t)&&M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,children:(0,b.jsxs)(bo,{to:`/${M.name}/new`,children:[(0,b.jsx)(Yy,{}),d(`list.new`)]})})]})}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-lg border`,children:(0,b.jsxs)(PE,{className:W(m.density===`compact`&&`[&_td]:py-1 [&_th]:h-8`),children:[(0,b.jsx)(FE,{children:(0,b.jsxs)(LE,{children:[ce&&(0,b.jsx)(RE,{className:`w-0`,children:(0,b.jsx)(`input`,{type:`checkbox`,className:`size-4 accent-primary`,"aria-label":d(`list.selectPage`),checked:F.length>0&&F.every(e=>_.has(String(e._id))),onChange:e=>v(e.target.checked?new Set(F.map(e=>String(e._id))):new Set)})}),N.map(e=>(0,b.jsxs)(RE,{className:`relative`,style:m.widths[e.name]?{width:m.widths[e.name],minWidth:m.widths[e.name]}:void 0,"aria-sort":P.field===e.name?P.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:()=>fe(e.name),children:[e.label,P.field===e.name&&(P.direction===`asc`?(0,b.jsx)(V_,{className:`size-3.5`}):(0,b.jsx)(L_,{className:`size-3.5`}))]}):e.label,(0,b.jsx)(DE,{resource:M.name,column:e.name,label:e.label,width:m.widths[e.name]})]},e.name)),p&&(0,b.jsx)(RE,{className:`w-0`,children:(0,b.jsx)(`span`,{className:`sr-only`,children:d(`list.actions`)})})]})}),(0,b.jsxs)(IE,{children:[s.isPending&&Array.from({length:5},(e,t)=>(0,b.jsxs)(LE,{"aria-hidden":!0,children:[ce&&(0,b.jsx)(zE,{}),N.map(e=>(0,b.jsx)(zE,{children:(0,b.jsx)(`div`,{className:`h-4 w-3/4 animate-pulse rounded bg-muted`})},e.name))]},`skeleton-${t}`)),F.map(e=>(0,b.jsxs)(LE,{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:[ce&&(0,b.jsx)(zE,{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)(zE,{children:n===0&&!p?(0,b.jsx)(bo,{to:ue(e),className:`font-medium hover:underline`,onClick:e=>e.stopPropagation(),children:lx(e[t.name],t)}):!p&&M.list.editable.includes(t.name)&&!(Array.isArray(e._readonly)&&e._readonly.includes(t.name))&&e._perm?.update!==!1?(0,b.jsx)(kE,{schema:M,item:e,field:t}):(0,b.jsx)(HE,{value:e[t.name],field:t,record:e})},t.name)),p&&(0,b.jsx)(zE,{children:(0,b.jsx)(UE,{item:e,pending:f.isPending,onRestore:e=>f.mutate(e)})})]},String(e._id))),s.isSuccess&&F.length===0&&(0,b.jsx)(LE,{children:(0,b.jsx)(zE,{colSpan:N.length+(p||ce?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(VS(t)?`list.noMatches`:`list.noRecords`),!VS(t)&&M.creatable&&!p&&(0,b.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,children:(0,b.jsxs)(bo,{to:`/${M.name}/new`,children:[(0,b.jsx)(Yy,{}),d(`list.new`)]})})]})})})]})]})}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm text-muted-foreground`,children:[(0,b.jsx)(`span`,{children:re.summary}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,"aria-label":d(`list.previousPage`),disabled:!ie,onClick:oe,children:(0,b.jsx)(hv,{className:`rtl:rotate-180`})}),(0,b.jsx)(`span`,{children:re.label}),(0,b.jsx)(q,{variant:`outline`,size:`icon-sm`,"aria-label":d(`list.nextPage`),disabled:!re.hasNext,onClick:ae,children:(0,b.jsx)(_v,{className:`rtl:rotate-180`})})]})]})]}),(0,b.jsx)(NE,{schema:M,item:x,onClose:()=>C(void 0)})]})}function HE({value:e,field:t,record:n}){let r=t.relation?.resource;if(!r||e==null)return(0,b.jsx)(RT,{value:e,field:t,record:n});let i=(Array.isArray(e)?e:[e]).filter(SS);return i.length===0?(0,b.jsx)(b.Fragment,{children:lx(e,t)}):(0,b.jsx)(b.Fragment,{children:i.map((e,t)=>(0,b.jsxs)(y.Fragment,{children:[t>0&&`, `,(0,b.jsx)(bo,{to:`/${r}/${encodeURIComponent(BE([e.id]))}`,className:`hover:underline`,onClick:e=>e.stopPropagation(),children:e.title})]},String(e.id)))})}function UE({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)(ab,{}),r(`list.restore`)]})}function WE({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 GE(){let e=X();return(0,b.jsx)(G,{children:e(`common.pageNotFound`)})}function KE(e){let t=NS(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 qE(e,t,n){let r=e.filter(e=>vT(e,t)),i=r.filter(e=>!e.secret),{payload:a,errors:o}=FS(i,t,n),s=FS(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 JE(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{...TT(e,Object.fromEntries(a),`create`),...TT(e,Object.fromEntries(i),`update`)}}function YE(){let e=X(),{page:t=``}=$i(),n=Vg(t);return n.isPending?(0,b.jsx)(G,{children:e(`common.loading`)}):n.isError?(0,b.jsx)(G,{tone:`error`,children:ug(n.error)}):(0,b.jsx)(XE,{page:n.data},t)}function XE({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)(()=>KE(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=NT(()=>h(null)),x=JSON.stringify(c)!==JSON.stringify(o),{blocker:C}=AT(x),w=(0,y.useRef)(null);MT(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=KE(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=gT(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}=qE(i.fields,c,o),a={...JE(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||!vT(n,c))return null;let r=i.required.includes(t);return n.secret?(0,b.jsx)(ZE,{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)(cE,{resource:`page:${i.name}`,field:n,record:O}):n.type===`object`?(0,b.jsx)(oT,{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)(Xw,{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:W(`flex flex-col gap-5`,i.layout?.length?`max-w-4xl`:`max-w-2xl`),children:[(0,b.jsx)(`h1`,{className:`text-xl font-semibold`,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)(jT,{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)(eT,{layout:i.layout,names:a,errors:f,render:k}),!i.readonly&&(0,b.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap gap-2 border-t bg-background py-3 md:static md:border-0 md:py-0`,children:[(0,b.jsx)(q,{type:`submit`,disabled:E.isPending||v.busy,"aria-keyshortcuts":`Control+S Meta+S`,children:t(E.isPending?`form.saving`:`form.save`)}),x&&(0,b.jsx)(q,{type:`button`,variant:`outline`,disabled:E.isPending,onClick:()=>{l(o),d([]),p({}),h(null)},children:t(`settings.discard`)})]})]})}function ZE({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)(Oh,{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)(dv,{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=cg.title,UC(BC()),JC(cg.branding),GC(BC);var QE=new Qe({defaultOptions:{queries:{retry:1,staleTime:3e4}}}),$E=_o([{path:`login`,element:(0,b.jsx)(Ow,{})},{element:(0,b.jsx)(ww,{}),children:[{index:!0,element:(0,b.jsx)(_E,{})},{path:`account`,element:(0,b.jsx)(d_,{})},{path:`-/users`,element:(0,b.jsx)(kC,{})},{path:`-/users/new`,element:(0,b.jsx)(AC,{})},{path:`-/users/:id`,element:(0,b.jsx)(AC,{})},{path:`-/groups`,element:(0,b.jsx)(gC,{})},{path:`-/groups/new`,element:(0,b.jsx)(_C,{})},{path:`-/groups/:id`,element:(0,b.jsx)(_C,{})},{path:`-/roles`,element:(0,b.jsx)(OC,{})},{path:`-/roles/new`,element:(0,b.jsx)(TC,{})},{path:`-/roles/:name`,element:(0,b.jsx)(TC,{})},{path:`-/debugger`,element:(0,b.jsx)(pC,{})},{path:`-/audit`,element:(0,b.jsx)(uC,{})},{path:`g/:group`,element:(0,b.jsx)(dE,{})},{path:`p/:page`,element:(0,b.jsx)(YE,{})},{path:`:resource`,element:(0,b.jsx)(VE,{})},{path:`:resource/new`,element:(0,b.jsx)(tE,{mode:`create`})},{path:`:resource/:id`,element:(0,b.jsx)(tE,{mode:`edit`})},{path:`*`,element:(0,b.jsx)(GE,{})}]}],{basename:cg.basePath});hg(()=>{let{pathname:e,search:t}=$E.state.location;e!==`/login`&&(QE.clear(),$E.navigate(`/login?${new URLSearchParams({next:e+t})}`,{replace:!0}))}),(0,Ka.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(y.StrictMode,{children:(0,b.jsx)(og,{locales:cg.locales,fallback:cg.locale,children:(0,b.jsx)(C,{client:QE,children:(0,b.jsx)(Ca,{router:$E})})})}));export{c as _,hy as a,$ as c,q as d,W as f,o as g,u as h,Lb as i,X as l,m,Pw as n,dy as o,v as p,Aw as r,xv as s,Fw as t,Oh as u};
|