@object-ui/runner 17.7.0 → 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +285 -0
- package/dist/assets/AdvancedChartImpl-PhZEnfsm.js +15 -0
- package/dist/assets/DatePickerField-DaUsI9YX.js +1 -0
- package/dist/assets/KanbanImpl-CVbnhntu.js +5 -0
- package/dist/assets/RegistryRefField-BBaXjRP0.js +1 -0
- package/dist/assets/ar-CnrvoISn.js +6 -0
- package/dist/assets/calendar-days-DDMVQ3ae.js +1 -0
- package/dist/assets/currency-Cl9ypka7.js +1 -0
- package/dist/assets/de-B12FmC0E.js +6 -0
- package/dist/assets/es-D2maTLF_.js +6 -0
- package/dist/assets/fr-NNM2FcU7.js +6 -0
- package/dist/assets/index-DFcMwITB.css +2 -0
- package/dist/assets/index-p98lzmz1.js +24 -0
- package/dist/assets/ja-D5J713KV.js +6 -0
- package/dist/assets/ko-C4rPOAji.js +6 -0
- package/dist/assets/lock-EVpnRX1f.js +1 -0
- package/dist/assets/number-format-DmDAHe_V.js +1 -0
- package/dist/assets/numberBadInput-CS8mDcT0.js +1 -0
- package/dist/assets/pencil-CZComqRM.js +1 -0
- package/dist/assets/pt-BjxxUc-x.js +6 -0
- package/dist/assets/ru-DeOkF7oF.js +6 -0
- package/dist/assets/sigma-CFlQ_mlO.js +1 -0
- package/dist/assets/src-BsbBN4hR.js +202 -0
- package/dist/assets/toDomProps-xVeX7COf.js +1 -0
- package/dist/assets/{toHostGroupProps-BH7JIO6T.js → toHostGroupProps-t1JEgvEe.js} +1 -1
- package/dist/assets/useCascadingOptions-B4v3GyIv.js +1 -0
- package/dist/assets/useDisplayLocale-AnZcfoq7.js +1 -0
- package/dist/assets/useFieldTranslation-xZl7XDc9.js +1 -0
- package/dist/assets/zh-CVILgvJZ.js +6 -0
- package/dist/index.html +2 -2
- package/package.json +8 -8
- package/dist/assets/AdvancedChartImpl-Cbz0k4EW.js +0 -15
- package/dist/assets/KanbanImpl-CBVkfYnm.js +0 -5
- package/dist/assets/ar-CYJHHPHB.js +0 -4
- package/dist/assets/calendar-days-C3we_i39.js +0 -1
- package/dist/assets/cog-BmLzMGc1.js +0 -1
- package/dist/assets/de-BKqMiXjL.js +0 -4
- package/dist/assets/es-WqKorF87.js +0 -4
- package/dist/assets/fr-_c3qhjnD.js +0 -4
- package/dist/assets/index-DGZ5sbIm.css +0 -2
- package/dist/assets/index-yPIFleR8.js +0 -24
- package/dist/assets/ja-B1W4DIAx.js +0 -4
- package/dist/assets/ko-CQXwaA77.js +0 -4
- package/dist/assets/pt-CS2YylQ0.js +0 -4
- package/dist/assets/ru-DQ8CiS1i.js +0 -4
- package/dist/assets/sigma-DUL8CyLc.js +0 -1
- package/dist/assets/src-6YkZO2yB.js +0 -192
- package/dist/assets/toDomProps-BYsZW0J2.js +0 -1
- package/dist/assets/upload-error-message-oz88n6bD.js +0 -1
- package/dist/assets/useCascadingOptions-z9aPSr6f.js +0 -1
- package/dist/assets/useDisplayLocale-BGw3UToo.js +0 -1
- package/dist/assets/useFieldTranslation-VcmV4bnt.js +0 -1
- package/dist/assets/zh-CvYWw7xk.js +0 -4
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/src-BL3SEdAz.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e,n as t,r as n,t as r}from"./react-SIfiwpqq.js";import{r as i}from"./clsx-CqtU6Wi8.js";import{t as a}from"./jsx-runtime-0vZSBttN.js";import{$ as o,$n as s,$t as c,A as l,An as u,At as d,B as f,Bn as p,Bt as m,C as h,Cr as g,Ct as _,D as v,Dn as y,Dt as b,E as x,En as S,Et as C,F as w,Ft as T,G as E,Gn as D,Gt as O,H as k,Hn as A,Ht as j,I as M,In as ee,It as N,J as P,Jn as F,Jt as te,K as ne,Kn as I,Kt as L,L as re,Ln as R,Lt as z,M as B,Mn as V,Mt as H,N as ie,Nn as ae,Nt as U,O as W,On as oe,Ot as se,P as G,Pt as K,Q as ce,Qn as le,Qt as ue,R as de,Rn as fe,Rt as pe,S as me,Sn as he,Sr as ge,St as _e,T as q,Tn as ve,Tt as ye,U as be,Un as xe,Ut as Se,V as Ce,Vn as we,Vt as Te,W as Ee,Wn as De,Wt as Oe,X as ke,Xn as Ae,Xt as je,Y as Me,Yn as Ne,Yt as Pe,Z as Fe,Zn as Ie,Zt as Le,_ as Re,_n as ze,_r as Be,_t as Ve,a as He,an as Ue,ar as We,at as Ge,b as Ke,bn as qe,br as Je,bt as Ye,c as Xe,cn as Ze,cr as Qe,ct as $e,d as et,dn as tt,dr as nt,dt as rt,en as it,er as at,et as ot,f as st,fn as ct,fr as lt,ft as ut,g as dt,gn as ft,gr as pt,gt as mt,h as ht,hn as gt,hr as _t,ht as vt,i as yt,in as bt,ir as xt,it as St,j as Ct,jn as wt,jt as J,k as Tt,kn as Et,kt as Dt,l as Y,ln as Ot,lr as kt,lt as At,m as jt,mn as Mt,mr as Nt,mt as Pt,n as Ft,nt as It,o as Lt,on as Rt,or as zt,ot as Bt,p as Vt,pn as Ht,pr as Ut,q as Wt,qn as Gt,qt as Kt,r as qt,rr as Jt,rt as Yt,s as Xt,sn as Zt,sr as Qt,st as $t,tn as en,tr as tn,tt as nn,u as rn,un as an,ur as on,ut as sn,v as cn,vn as ln,vt as un,w as dn,wn as fn,wr as pn,wt as mn,x as hn,xn as gn,xr as _n,xt as vn,y as yn,yn as bn,yr as xn,yt as Sn,z as Cn,zn as wn,zt as Tn}from"./src-6YkZO2yB.js";import{_ as En,a as Dn,c as On,d as kn,f as An,h as jn,i as Mn,l as Nn,m as Pn,n as Fn,o as In,p as Ln,r as Rn,s as X,t as zn,u as Bn}from"./useDisplayLocale-BGw3UToo.js";import{t as Vn}from"./createLucideIcon--xDTGZXf.js";import{t as Hn}from"./arrow-down-1mq0hSmg.js";import{t as Un}from"./arrow-left-BXaV2k39.js";import{t as Wn}from"./arrow-right-Ct0Gffoh.js";import{t as Gn}from"./arrow-up-down-CI6lKUYI.js";import{t as Kn}from"./arrow-up-Bl-41W93.js";import{t as qn}from"./box-C6EfSIlr.js";import{t as Jn}from"./calendar-C49E94Ac.js";import{t as Yn}from"./camera-CJo23d6_.js";import{t as Xn}from"./check-CPShAWmX.js";import{t as Zn}from"./chevron-down-DU5bzHCG.js";import{t as Qn}from"./chevron-left-CQGBxU3t.js";import{t as $n}from"./chevron-right-CLxrUMAo.js";import{t as er}from"./circle-alert-Be3uBFFY.js";import{t as tr}from"./circle-BnRq1q9n.js";import{t as nr}from"./copy-BuxGMWGx.js";import{t as rr}from"./crop-CrWNtGgi.js";import{t as ir}from"./crosshair-Cp-l20E4.js";import{t as ar}from"./eraser-CxN5D9MH.js";import{t as or}from"./eye-off-Bp-sJa49.js";import{t as sr}from"./eye-D5x_7qBQ.js";import{t as cr}from"./file-jnEmRXz-.js";import{t as lr}from"./grip-vertical-CvhugeFd.js";import{t as ur}from"./image-BjkFtEXU.js";import{t as dr}from"./inbox-BBA9E6Va.js";import{t as fr}from"./loader-circle-BOLp6p5h.js";import{t as pr}from"./map-pin-C_iRGDSb.js";import{t as mr}from"./maximize-2-CncaanPf.js";import{t as hr}from"./plus-C74ekJZJ.js";import{t as gr}from"./qr-code-CJ-h19_G.js";import{t as _r}from"./rotate-cw-Cgup1CCS.js";import{t as vr}from"./search-BnRsQVCj.js";import{t as yr}from"./sliders-horizontal-DqBDrbfP.js";import{t as br}from"./square-pen-DmSyN40K.js";import{t as xr}from"./star-DsTSDvK0.js";import{t as Sr}from"./table-properties-Da79shwS.js";import{t as Cr}from"./trash-BdqsAFor.js";import{t as wr}from"./triangle-alert-C82p5Abr.js";import{t as Tr}from"./upload-avt7VUnl.js";import{t as Er}from"./x-9fDeAP-2.js";import{n as Dr,t as Or}from"./currency-CjzeK1pa.js";import{a as kr,c as Ar,i as jr,l as Mr,n as Nr,o as Pr,r as Fr,s as Ir,t as Lr,u as Rr}from"./upload-error-message-oz88n6bD.js";import{t as Z}from"./toDomProps-BYsZW0J2.js";import{t as zr}from"./useFieldTranslation-VcmV4bnt.js";import{n as Br,t as Vr}from"./toHostGroupProps-BH7JIO6T.js";import{n as Hr,t as Ur}from"./useCascadingOptions-z9aPSr6f.js";var Wr=t((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}}}})),Gr=t(((e,t)=>{t.exports=Wr()})),Kr=t((e=>{var t=Gr(),n=r(),a=i();function o(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 s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function l(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 u(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 d(e){if(c(e)!==e)throw Error(o(188))}function f(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return d(i),e;if(a===r)return d(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,l=i.child;l;){if(l===n){s=!0,n=i,r=a;break}if(l===r){s=!0,r=i,n=a;break}l=l.sibling}if(!s){for(l=a.child;l;){if(l===n){s=!0,n=a,r=i;break}if(l===r){s=!0,r=a,n=i;break}l=l.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(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}var m=Object.assign,h=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var M=Symbol.for(`react.client.reference`);function ee(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===M?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?ee(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return ee(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},ne=[],I=-1;function L(e){return{current:e}}function re(e){0>I||(e.current=ne[I],ne[I]=null,I--)}function R(e,t){I++,ne[I]=e.current,e.current=t}var z=L(null),B=L(null),V=L(null),H=L(null);function ie(e,t){switch(R(V,t),R(B,e),R(z,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}re(z),R(z,e)}function ae(){re(z),re(B),re(V)}function U(e){e.memoizedState!==null&&R(H,e);var t=z.current,n=Hd(t,e.type);t!==n&&(R(B,e),R(z,n))}function W(e){B.current===e&&(re(z),re(B)),H.current===e&&(re(H),Qf._currentValue=te)}var oe,se;function G(e){if(oe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);oe=t&&t[1]||``,se=-1<e.stack.indexOf(`
|
|
3
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
-
`+oe+e+se}var K=!1;function ce(e,t){if(!e||K)return``;K=!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}e.call(n.prototype)}}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(`
|
|
5
|
-
`),l=s.split(`
|
|
6
|
-
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
7
|
-
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{K=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?G(n):``}function le(e,t){switch(e.tag){case 26:case 27:case 5:return G(e.type);case 16:return G(`Lazy`);case 13:return e.child!==t&&t!==null?G(`Suspense Fallback`):G(`Suspense`);case 19:return G(`SuspenseList`);case 0:case 15:return ce(e.type,!1);case 11:return ce(e.type.render,!1);case 1:return ce(e.type,!0);case 31:return G(`Activity`);default:return``}}function ue(e){try{var t=``,n=null;do t+=le(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
-
Error generating stack: `+e.message+`
|
|
9
|
-
`+e.stack}}var de=Object.prototype.hasOwnProperty,fe=t.unstable_scheduleCallback,pe=t.unstable_cancelCallback,me=t.unstable_shouldYield,he=t.unstable_requestPaint,ge=t.unstable_now,_e=t.unstable_getCurrentPriorityLevel,q=t.unstable_ImmediatePriority,ve=t.unstable_UserBlockingPriority,ye=t.unstable_NormalPriority,be=t.unstable_LowPriority,xe=t.unstable_IdlePriority,Se=t.log,Ce=t.unstable_setDisableYieldValue,we=null,Te=null;function Ee(e){if(typeof Se==`function`&&Ce(e),Te&&typeof Te.setStrictMode==`function`)try{Te.setStrictMode(we,e)}catch{}}var De=Math.clz32?Math.clz32:Ae,Oe=Math.log,ke=Math.LN2;function Ae(e){return e>>>=0,e===0?32:31-(Oe(e)/ke|0)|0}var je=256,Me=262144,Ne=4194304;function Pe(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Fe(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Pe(n))):i=Pe(o):i=Pe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Pe(n))):i=Pe(o)):i=Pe(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ie(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Le(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Re(){var e=Ne;return Ne<<=1,!(Ne&62914560)&&(Ne=4194304),e}function ze(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Be(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ve(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-De(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&He(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function He(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-De(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ue(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-De(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function We(e,t){var n=t&-t;return n=n&42?1:Ge(n),(n&(e.suspendedLanes|t))===0?n:0}function Ge(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ke(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function qe(){var e=F.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function Je(e,t){var n=F.p;try{return F.p=e,t()}finally{F.p=n}}var Ye=Math.random().toString(36).slice(2),Xe=`__reactFiber$`+Ye,Ze=`__reactProps$`+Ye,Qe=`__reactContainer$`+Ye,$e=`__reactEvents$`+Ye,et=`__reactListeners$`+Ye,tt=`__reactHandles$`+Ye,nt=`__reactResources$`+Ye,rt=`__reactMarker$`+Ye;function it(e){delete e[Xe],delete e[Ze],delete e[$e],delete e[et],delete e[tt]}function at(e){var t=e[Xe];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Qe]||n[Xe]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[Xe])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function ot(e){if(e=e[Xe]||e[Qe]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function st(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function ct(e){var t=e[nt];return t||=e[nt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function lt(e){e[rt]=!0}var ut=new Set,dt={};function ft(e,t){pt(e,t),pt(e+`Capture`,t)}function pt(e,t){for(dt[e]=t,e=0;e<t.length;e++)ut.add(t[e])}var mt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),ht={},gt={};function _t(e){return de.call(gt,e)?!0:de.call(ht,e)?!1:mt.test(e)?gt[e]=!0:(ht[e]=!0,!1)}function vt(e,t,n){if(_t(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function yt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function bt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function xt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function St(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ct(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function wt(e){if(!e._valueTracker){var t=St(e)?`checked`:`value`;e._valueTracker=Ct(e,t,``+e[t])}}function J(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=St(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Tt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Et=/[\n"\\]/g;function Dt(e){return e.replace(Et,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Y(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+xt(t)):e.value!==``+xt(t)&&(e.value=``+xt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):kt(e,o,xt(n)):kt(e,o,xt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+xt(s):e.removeAttribute(`name`)}function Ot(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){wt(e);return}n=n==null?``:``+xt(n),t=t==null?n:``+xt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),wt(e)}function kt(e,t,n){t===`number`&&Tt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function At(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+xt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function jt(e,t,n){if(t!=null&&(t=``+xt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+xt(n)}function Mt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(o(92));if(N(r)){if(1<r.length)throw Error(o(93));r=r[0]}n=r}n??=``,t=n}n=xt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),wt(e)}function Nt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Pt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Ft(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Pt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function It(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(o(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&Ft(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&Ft(e,a,t[a])}function Lt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Rt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),zt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Bt(e){return zt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Vt(){}var Ht=null;function Ut(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wt=null,Gt=null;function Kt(e){var t=ot(e);if(t&&(e=t.stateNode)){var n=e[Ze]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Y(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Dt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[Ze]||null;if(!i)throw Error(o(90));Y(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&J(r)}break a;case`textarea`:jt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&At(e,!!n.multiple,t,!1)}}}var qt=!1;function Jt(e,t,n){if(qt)return e(t,n);qt=!0;try{return e(t)}finally{if(qt=!1,(Wt!==null||Gt!==null)&&(_u(),Wt&&(t=Wt,e=Gt,Gt=Wt=null,Kt(t),e)))for(t=0;t<e.length;t++)Kt(e[t])}}function Yt(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Ze]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(o(231,t,typeof n));return n}var Xt=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),Zt=!1;if(Xt)try{var Qt={};Object.defineProperty(Qt,"passive",{get:function(){Zt=!0}}),window.addEventListener(`test`,Qt,Qt),window.removeEventListener(`test`,Qt,Qt)}catch{Zt=!1}var $t=null,en=null,tn=null;function nn(){if(tn)return tn;var e,t=en,n=t.length,r,i=`value`in $t?$t.value:$t.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return tn=i.slice(e,1<r?1-r:void 0)}function rn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function an(){return!0}function on(){return!1}function sn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?an:on,this.isPropagationStopped=on,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=an)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=an)},persist:function(){},isPersistent:an}),t}var cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ln=sn(cn),un=m({},cn,{view:0,detail:0}),dn=sn(un),fn,pn,mn,hn=m({},un,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:En,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==mn&&(mn&&e.type===`mousemove`?(fn=e.screenX-mn.screenX,pn=e.screenY-mn.screenY):pn=fn=0,mn=e),fn)},movementY:function(e){return`movementY`in e?e.movementY:pn}}),gn=sn(hn),_n=sn(m({},hn,{dataTransfer:0})),vn=sn(m({},un,{relatedTarget:0})),yn=sn(m({},cn,{animationName:0,elapsedTime:0,pseudoElement:0})),bn=sn(m({},cn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),xn=sn(m({},cn,{data:0})),Sn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Cn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},wn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Tn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=wn[e])?!!t[e]:!1}function En(){return Tn}var Dn=sn(m({},un,{key:function(e){if(e.key){var t=Sn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=rn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Cn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:En,charCode:function(e){return e.type===`keypress`?rn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?rn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),On=sn(m({},hn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),kn=sn(m({},un,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:En})),An=sn(m({},cn,{propertyName:0,elapsedTime:0,pseudoElement:0})),jn=sn(m({},hn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Mn=sn(m({},cn,{newState:0,oldState:0})),Nn=[9,13,27,32],Pn=Xt&&`CompositionEvent`in window,Fn=null;Xt&&`documentMode`in document&&(Fn=document.documentMode);var In=Xt&&`TextEvent`in window&&!Fn,Ln=Xt&&(!Pn||Fn&&8<Fn&&11>=Fn),Rn=` `,X=!1;function zn(e,t){switch(e){case`keyup`:return Nn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Bn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Vn=!1;function Hn(e,t){switch(e){case`compositionend`:return Bn(t);case`keypress`:return t.which===32?(X=!0,Rn):null;case`textInput`:return e=t.data,e===Rn&&X?null:e;default:return null}}function Un(e,t){if(Vn)return e===`compositionend`||!Pn&&zn(e,t)?(e=nn(),tn=en=$t=null,Vn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Ln&&t.locale!==`ko`?null:t.data;default:return null}}var Wn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Gn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Wn[e.type]:t===`textarea`}function Kn(e,t,n,r){Wt?Gt?Gt.push(r):Gt=[r]:Wt=r,t=Td(t,`onChange`),0<t.length&&(n=new ln(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var qn=null,Jn=null;function Yn(e){_d(e,0)}function Xn(e){if(J(st(e)))return e}function Zn(e,t){if(e===`change`)return t}var Qn=!1;if(Xt){var $n;if(Xt){var er=`oninput`in document;if(!er){var tr=document.createElement(`div`);tr.setAttribute(`oninput`,`return;`),er=typeof tr.oninput==`function`}$n=er}else $n=!1;Qn=$n&&(!document.documentMode||9<document.documentMode)}function nr(){qn&&(qn.detachEvent(`onpropertychange`,rr),Jn=qn=null)}function rr(e){if(e.propertyName===`value`&&Xn(Jn)){var t=[];Kn(t,Jn,e,Ut(e)),Jt(Yn,t)}}function ir(e,t,n){e===`focusin`?(nr(),qn=t,Jn=n,qn.attachEvent(`onpropertychange`,rr)):e===`focusout`&&nr()}function ar(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Xn(Jn)}function or(e,t){if(e===`click`)return Xn(t)}function sr(e,t){if(e===`input`||e===`change`)return Xn(t)}function cr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var lr=typeof Object.is==`function`?Object.is:cr;function ur(e,t){if(lr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!de.call(t,i)||!lr(e[i],t[i]))return!1}return!0}function dr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function fr(e,t){var n=dr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=dr(n)}}function pr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?pr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function mr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Tt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Tt(e.document)}return t}function hr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var gr=Xt&&`documentMode`in document&&11>=document.documentMode,_r=null,vr=null,yr=null,br=!1;function xr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;br||_r==null||_r!==Tt(r)||(r=_r,`selectionStart`in r&&hr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),yr&&ur(yr,r)||(yr=r,r=Td(vr,`onSelect`),0<r.length&&(t=new ln(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=_r)))}function Sr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Cr={animationend:Sr(`Animation`,`AnimationEnd`),animationiteration:Sr(`Animation`,`AnimationIteration`),animationstart:Sr(`Animation`,`AnimationStart`),transitionrun:Sr(`Transition`,`TransitionRun`),transitionstart:Sr(`Transition`,`TransitionStart`),transitioncancel:Sr(`Transition`,`TransitionCancel`),transitionend:Sr(`Transition`,`TransitionEnd`)},wr={},Tr={};Xt&&(Tr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Cr.animationend.animation,delete Cr.animationiteration.animation,delete Cr.animationstart.animation),`TransitionEvent`in window||delete Cr.transitionend.transition);function Er(e){if(wr[e])return wr[e];if(!Cr[e])return e;var t=Cr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Tr)return wr[e]=t[n];return e}var Dr=Er(`animationend`),Or=Er(`animationiteration`),kr=Er(`animationstart`),Ar=Er(`transitionrun`),jr=Er(`transitionstart`),Mr=Er(`transitioncancel`),Nr=Er(`transitionend`),Pr=new Map,Fr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Fr.push(`scrollEnd`);function Ir(e,t){Pr.set(e,t),ft(t,[e])}var Lr=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)},Rr=[],Z=0,zr=0;function Br(){for(var e=Z,t=zr=Z=0;t<e;){var n=Rr[t];Rr[t++]=null;var r=Rr[t];Rr[t++]=null;var i=Rr[t];Rr[t++]=null;var a=Rr[t];if(Rr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Wr(n,i,a)}}function Vr(e,t,n,r){Rr[Z++]=e,Rr[Z++]=t,Rr[Z++]=n,Rr[Z++]=r,zr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Hr(e,t,n,r){return Vr(e,t,n,r),Kr(e)}function Ur(e,t){return Vr(e,null,null,t),Kr(e)}function Wr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-De(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Kr(e){if(50<cu)throw cu=0,lu=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var qr={};function Jr(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yr(e,t,n,r){return new Jr(e,t,n,r)}function Xr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Zr(e,t){var n=e.alternate;return n===null?(n=Yr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Qr(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function $r(e,t,n,r,i,a){var s=0;if(r=e,typeof e==`function`)Xr(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,z.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case O:return e=Yr(31,n,t,i),e.elementType=O,e.lanes=a,e;case v:return ei(n.children,i,a,t);case y:s=8,i|=24;break;case b:return e=Yr(12,n,t,i|2),e.elementType=b,e.lanes=a,e;case w:return e=Yr(13,n,t,i),e.elementType=w,e.lanes=a,e;case T:return e=Yr(19,n,t,i),e.elementType=T,e.lanes=a,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case S:s=10;break a;case x:s=9;break a;case C:s=11;break a;case E:s=14;break a;case D:s=16,r=null;break a}s=29,n=Error(o(130,e===null?`null`:typeof e,``)),r=null}return t=Yr(s,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function ei(e,t,n,r){return e=Yr(7,e,r,t),e.lanes=n,e}function ti(e,t,n){return e=Yr(6,e,null,t),e.lanes=n,e}function ni(e){var t=Yr(18,null,null,0);return t.stateNode=e,t}function ri(e,t,n){return t=Yr(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ii=new WeakMap;function ai(e,t){if(typeof e==`object`&&e){var n=ii.get(e);return n===void 0?(t={value:e,source:t,stack:ue(t)},ii.set(e,t),t):n}return{value:e,source:t,stack:ue(t)}}var oi=[],si=0,ci=null,li=0,ui=[],di=0,fi=null,pi=1,mi=``;function hi(e,t){oi[si++]=li,oi[si++]=ci,ci=e,li=t}function gi(e,t,n){ui[di++]=pi,ui[di++]=mi,ui[di++]=fi,fi=e;var r=pi;e=mi;var i=32-De(r)-1;r&=~(1<<i),n+=1;var a=32-De(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,pi=1<<32-De(t)+i|n<<i|r,mi=a+e}else pi=1<<a|n<<i|r,mi=e}function _i(e){e.return!==null&&(hi(e,1),gi(e,1,0))}function vi(e){for(;e===ci;)ci=oi[--si],oi[si]=null,li=oi[--si],oi[si]=null;for(;e===fi;)fi=ui[--di],ui[di]=null,mi=ui[--di],ui[di]=null,pi=ui[--di],ui[di]=null}function yi(e,t){ui[di++]=pi,ui[di++]=mi,ui[di++]=fi,pi=t.id,mi=t.overflow,fi=e}var bi=null,xi=null,Si=!1,Ci=null,wi=!1,Ti=Error(o(519));function Ei(e){throw Mi(ai(Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ti}function Di(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Xe]=e,t[Ze]=r,n){case`dialog`:vd(`cancel`,t),vd(`close`,t);break;case`iframe`:case`object`:case`embed`:vd(`load`,t);break;case`video`:case`audio`:for(n=0;n<hd.length;n++)vd(hd[n],t);break;case`source`:vd(`error`,t);break;case`img`:case`image`:case`link`:vd(`error`,t),vd(`load`,t);break;case`details`:vd(`toggle`,t);break;case`input`:vd(`invalid`,t),Ot(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:vd(`invalid`,t);break;case`textarea`:vd(`invalid`,t),Mt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||jd(t.textContent,n)?(r.popover!=null&&(vd(`beforetoggle`,t),vd(`toggle`,t)),r.onScroll!=null&&vd(`scroll`,t),r.onScrollEnd!=null&&vd(`scrollend`,t),r.onClick!=null&&(t.onclick=Vt),t=!0):t=!1,t||Ei(e,!0)}function Oi(e){for(bi=e.return;bi;)switch(bi.tag){case 5:case 31:case 13:wi=!1;return;case 27:case 3:wi=!0;return;default:bi=bi.return}}function ki(e){if(e!==bi)return!1;if(!Si)return Oi(e),Si=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Ud(e.type,e.memoizedProps)),n=!n),n&&xi&&Ei(e),Oi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));xi=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));xi=uf(e)}else t===27?(t=xi,Zd(e.type)?(e=lf,lf=null,xi=e):xi=t):xi=bi?cf(e.stateNode.nextSibling):null;return!0}function Ai(){xi=bi=null,Si=!1}function ji(){var e=Ci;return e!==null&&(Jl===null?Jl=e:Jl.push.apply(Jl,e),Ci=null),e}function Mi(e){Ci===null?Ci=[e]:Ci.push(e)}var Ni=L(null),Pi=null,Fi=null;function Ii(e,t,n){R(Ni,t._currentValue),t._currentValue=n}function Li(e){e._currentValue=Ni.current,re(Ni)}function Ri(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function zi(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var s=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Ri(a.return,n,e),r||(s=null);break a}a=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(o(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Ri(s,n,e),s=null}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function Bi(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(o(387));if(s=s.memoizedProps,s!==null){var c=i.type;lr(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===H.current){if(s=i.alternate,s===null)throw Error(o(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}i=i.return}e!==null&&zi(t,e,n,r),t.flags|=262144}function Vi(e){for(e=e.firstContext;e!==null;){if(!lr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Hi(e){Pi=e,Fi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ui(e){return Gi(Pi,e)}function Wi(e,t){return Pi===null&&Hi(e),Gi(e,t)}function Gi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Fi===null){if(e===null)throw Error(o(308));Fi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Fi=Fi.next=t;return n}var Ki=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},qi=t.unstable_scheduleCallback,Ji=t.unstable_NormalPriority,Yi={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Xi(){return{controller:new Ki,data:new Map,refCount:0}}function Zi(e){e.refCount--,e.refCount===0&&qi(Ji,function(){e.controller.abort()})}var Qi=null,$i=0,ea=0,ta=null;function na(e,t){if(Qi===null){var n=Qi=[];$i=0,ea=ld(),ta={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return $i++,t.then(ra,ra),t}function ra(){if(--$i===0&&Qi!==null){ta!==null&&(ta.status=`fulfilled`);var e=Qi;Qi=null,ea=0,ta=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ia(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var aa=P.S;P.S=function(e,t){Zl=ge(),typeof t==`object`&&t&&typeof t.then==`function`&&na(e,t),aa!==null&&aa(e,t)};var oa=L(null);function sa(){var e=oa.current;return e===null?Ml.pooledCache:e}function ca(e,t){t===null?R(oa,oa.current):R(oa,t.pool)}function la(){var e=sa();return e===null?null:{parent:Yi._currentValue,pool:e}}var ua=Error(o(460)),da=Error(o(474)),fa=Error(o(542)),pa={then:function(){}};function ma(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ha(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Vt,Vt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ya(e),e;default:if(typeof t.status==`string`)t.then(Vt,Vt);else{if(e=Ml,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ya(e),e}throw _a=t,ua}}function ga(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(_a=e,ua):e}}var _a=null;function va(){if(_a===null)throw Error(o(459));var e=_a;return _a=null,e}function ya(e){if(e===ua||e===fa)throw Error(o(483))}var ba=null,xa=0;function Sa(e){var t=xa;return xa+=1,ba===null&&(ba=[]),ha(ba,e,t)}function Ca(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function wa(e,t){throw t.$$typeof===h?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ta(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=Zr(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ti(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===v?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===D&&ga(a)===t.type)?(t=i(t,n.props),Ca(t,n),t.return=e,t):(t=$r(n.type,n.key,n.props,null,e.mode,r),Ca(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ri(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=ei(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ti(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case g:return n=$r(t.type,t.key,t.props,null,e.mode,n),Ca(n,t),n.return=e,n;case _:return t=ri(t,e.mode,n),t.return=e,t;case D:return t=ga(t),f(e,t,n)}if(N(t)||j(t))return t=ei(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Sa(t),n);if(t.$$typeof===S)return f(e,Wi(e,t),n);wa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case g:return n.key===i?l(e,t,n,r):null;case _:return n.key===i?u(e,t,n,r):null;case D:return n=ga(n),p(e,t,n,r)}if(N(n)||j(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Sa(n),r);if(n.$$typeof===S)return p(e,t,Wi(e,n),r);wa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case g:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case _:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case D:return r=ga(r),m(e,t,n,r,i)}if(N(r)||j(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Sa(r),i);if(r.$$typeof===S)return m(e,t,n,Wi(t,r),i);wa(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Si&&hi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return Si&&hi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Si&&hi(i,h),l}function y(i,s,c,l){if(c==null)throw Error(o(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=a(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),Si&&hi(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return Si&&hi(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),Si&&hi(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===v&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case g:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===v){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===D&&ga(l)===r.type){n(e,r.sibling),c=i(r,a.props),Ca(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===v?(c=ei(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=$r(a.type,a.key,a.props,null,e.mode,c),Ca(c,a),c.return=e,e=c)}return s(e);case _:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=ri(a,e.mode,c),c.return=e,e=c}return s(e);case D:return a=ga(a),b(e,r,a,c)}if(N(a))return h(e,r,a,c);if(j(a)){if(l=j(a),typeof l!=`function`)throw Error(o(150));return a=l.call(a),y(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,Sa(a),c);if(a.$$typeof===S)return b(e,r,Wi(e,a),c);wa(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=ti(a,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{xa=0;var i=b(e,t,n,r);return ba=null,i}catch(t){if(t===ua||t===fa)throw t;var a=Yr(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ea=Ta(!0),Da=Ta(!1),Oa=!1;function ka(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Aa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ja(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ma(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,jl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Kr(e),Wr(e,null,n),t}return Vr(e,r,t,n),Kr(e)}function Na(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ue(e,n)}}function Pa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Fa=!1;function Ia(){if(Fa){var e=ta;if(e!==null)throw e}}function La(e,t,n,r){Fa=!1;var i=e.updateQueue;Oa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Pl&f)===f:(r&f)===f){f!==0&&f===ea&&(Fa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Oa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Hl|=o,e.lanes=o,e.memoizedState=d}}function Ra(e,t){if(typeof e!=`function`)throw Error(o(191,e));e.call(t)}function za(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ra(n[e],t)}var Ba=L(null),Va=L(0);function Ha(e,t){e=Bl,R(Va,e),R(Ba,t),Bl=e|t.baseLanes}function Ua(){R(Va,Bl),R(Ba,Ba.current)}function Wa(){Bl=Va.current,re(Ba),re(Va)}var Ga=L(null),Ka=null;function qa(e){var t=e.alternate;R(Qa,Qa.current&1),R(Ga,e),Ka===null&&(t===null||Ba.current!==null||t.memoizedState!==null)&&(Ka=e)}function Ja(e){R(Qa,Qa.current),R(Ga,e),Ka===null&&(Ka=e)}function Ya(e){e.tag===22?(R(Qa,Qa.current),R(Ga,e),Ka===null&&(Ka=e)):Xa(e)}function Xa(){R(Qa,Qa.current),R(Ga,Ga.current)}function Za(e){re(Ga),Ka===e&&(Ka=null),re(Qa)}var Qa=L(0);function $a(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var eo=0,to=null,no=null,ro=null,io=!1,ao=!1,oo=!1,so=0,co=0,lo=null,uo=0;function fo(){throw Error(o(321))}function po(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!lr(e[n],t[n]))return!1;return!0}function mo(e,t,n,r,i,a){return eo=a,to=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,P.H=e===null||e.memoizedState===null?ks:As,oo=!1,a=n(r,i),oo=!1,ao&&(a=go(t,n,r,i)),ho(e),a}function ho(e){P.H=Os;var t=no!==null&&no.next!==null;if(eo=0,ro=no=to=null,io=!1,co=0,lo=null,t)throw Error(o(300));e===null||qs||(e=e.dependencies,e!==null&&Vi(e)&&(qs=!0))}function go(e,t,n,r){to=e;var i=0;do{if(ao&&(lo=null),co=0,ao=!1,25<=i)throw Error(o(301));if(i+=1,ro=no=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}P.H=js,a=t(n,r)}while(ao);return a}function _o(){var e=P.H,t=e.useState()[0];return t=typeof t.then==`function`?wo(t):t,e=e.useState()[0],(no===null?null:no.memoizedState)!==e&&(to.flags|=1024),t}function vo(){var e=so!==0;return so=0,e}function yo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function bo(e){if(io){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}io=!1}eo=0,ro=no=to=null,ao=!1,co=so=0,lo=null}function xo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ro===null?to.memoizedState=ro=e:ro=ro.next=e,ro}function So(){if(no===null){var e=to.alternate;e=e===null?null:e.memoizedState}else e=no.next;var t=ro===null?to.memoizedState:ro.next;if(t!==null)ro=t,no=e;else{if(e===null)throw to.alternate===null?Error(o(467)):Error(o(310));no=e,e={memoizedState:no.memoizedState,baseState:no.baseState,baseQueue:no.baseQueue,queue:no.queue,next:null},ro===null?to.memoizedState=ro=e:ro=ro.next=e}return ro}function Co(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function wo(e){var t=co;return co+=1,lo===null&&(lo=[]),e=ha(lo,e,t),t=to,(ro===null?t.memoizedState:ro.next)===null&&(t=t.alternate,P.H=t===null||t.memoizedState===null?ks:As),e}function To(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return wo(e);if(e.$$typeof===S)return Ui(e)}throw Error(o(438,String(e)))}function Eo(e){var t=null,n=to.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=to.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Co(),to.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=k;return t.index++,n}function Do(e,t){return typeof t==`function`?t(e):t}function Oo(e){return ko(So(),no,e)}function ko(e,t,n){var r=e.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var s=i.next;i.next=a.next,a.next=s}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(eo&f)===f:(Pl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ea&&(d=!0);else if((eo&p)===p){u=u.next,p===ea&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=a):l=l.next=f,to.lanes|=p,Hl|=p;f=u.action,oo&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=a):l=l.next=p,to.lanes|=f,Hl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=a:l.next=c,!lr(a,e.memoizedState)&&(qs=!0,d&&(n=ta,n!==null)))throw n;e.memoizedState=a,e.baseState=s,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Ao(e){var t=So(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do a=e(a,s.action),s=s.next;while(s!==i);lr(a,t.memoizedState)||(qs=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function jo(e,t,n){var r=to,i=So(),a=Si;if(a){if(n===void 0)throw Error(o(407));n=n()}else n=t();var s=!lr((no||i).memoizedState,n);if(s&&(i.memoizedState=n,qs=!0),i=i.queue,ns(Po.bind(null,r,i,e),[e]),i.getSnapshot!==t||s||ro!==null&&ro.memoizedState.tag&1){if(r.flags|=2048,Zo(9,{destroy:void 0},No.bind(null,r,i,n,t),null),Ml===null)throw Error(o(349));a||eo&127||Mo(r,t,n)}return n}function Mo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=to.updateQueue,t===null?(t=Co(),to.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function No(e,t,n,r){t.value=n,t.getSnapshot=r,Fo(t)&&Io(e)}function Po(e,t,n){return n(function(){Fo(t)&&Io(e)})}function Fo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!lr(e,n)}catch{return!0}}function Io(e){var t=Ur(e,2);t!==null&&fu(t,e,2)}function Lo(e){var t=xo();if(typeof e==`function`){var n=e;if(e=n(),oo){Ee(!0);try{n()}finally{Ee(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Do,lastRenderedState:e},t}function Ro(e,t,n,r){return e.baseState=n,ko(e,no,typeof r==`function`?r:Do)}function zo(e,t,n,r,i){if(Ts(e))throw Error(o(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};P.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,Bo(t,a)):(a.next=n.next,t.pending=n.next=a)}}function Bo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=P.T,o={};P.T=o;try{var s=n(i,r),c=P.S;c!==null&&c(o,s),Vo(e,t,s)}catch(n){Uo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),P.T=a}}else try{a=n(i,r),Vo(e,t,a)}catch(n){Uo(e,t,n)}}function Vo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Ho(e,t,n)},function(n){return Uo(e,t,n)}):Ho(e,t,n)}function Ho(e,t,n){t.status=`fulfilled`,t.value=n,Wo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Bo(e,n)))}function Uo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Wo(t),t=t.next;while(t!==r)}e.action=null}function Wo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Go(e,t){return t}function Ko(e,t){if(Si){var n=Ml.formState;if(n!==null){a:{var r=to;if(Si){if(xi){b:{for(var i=xi,a=wi;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){xi=cf(i.nextSibling),r=i.data===`F!`;break a}}Ei(r)}r=!1}r&&(t=n[0])}}return n=xo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Go,lastRenderedState:t},n.queue=r,n=Ss.bind(null,to,r),r.dispatch=n,r=Lo(!1),a=ws.bind(null,to,!1,r.queue),r=xo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=zo.bind(null,to,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function qo(e){return Jo(So(),no,e)}function Jo(e,t,n){if(t=ko(e,t,Go)[0],e=Oo(Do)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=wo(t)}catch(e){throw e===ua?fa:e}else r=t;t=So();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(to.flags|=2048,Zo(9,{destroy:void 0},Yo.bind(null,i,n),null)),[r,a,e]}function Yo(e,t){e.action=t}function Xo(e){var t=So(),n=no;if(n!==null)return Jo(t,n,e);So(),t=t.memoizedState,n=So();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Zo(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=to.updateQueue,t===null&&(t=Co(),to.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Qo(){return So().memoizedState}function $o(e,t,n,r){var i=xo();to.flags|=e,i.memoizedState=Zo(1|t,{destroy:void 0},n,r===void 0?null:r)}function es(e,t,n,r){var i=So();r=r===void 0?null:r;var a=i.memoizedState.inst;no!==null&&r!==null&&po(r,no.memoizedState.deps)?i.memoizedState=Zo(t,a,n,r):(to.flags|=e,i.memoizedState=Zo(1|t,a,n,r))}function ts(e,t){$o(8390656,8,e,t)}function ns(e,t){es(2048,8,e,t)}function rs(e){to.flags|=4;var t=to.updateQueue;if(t===null)t=Co(),to.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function is(e){var t=So().memoizedState;return rs({ref:t,nextImpl:e}),function(){if(jl&2)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function as(e,t){return es(4,2,e,t)}function os(e,t){return es(4,4,e,t)}function ss(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function cs(e,t,n){n=n==null?null:n.concat([e]),es(4,4,ss.bind(null,t,e),n)}function ls(){}function us(e,t){var n=So();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&po(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ds(e,t){var n=So();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&po(t,r[1]))return r[0];if(r=e(),oo){Ee(!0);try{e()}finally{Ee(!1)}}return n.memoizedState=[r,t],r}function fs(e,t,n){return n===void 0||eo&1073741824&&!(Pl&261930)?e.memoizedState=t:(e.memoizedState=n,e=du(),to.lanes|=e,Hl|=e,n)}function ps(e,t,n,r){return lr(n,t)?n:Ba.current===null?!(eo&42)||eo&1073741824&&!(Pl&261930)?(qs=!0,e.memoizedState=n):(e=du(),to.lanes|=e,Hl|=e,t):(e=fs(e,n,r),lr(e,t)||(qs=!0),e)}function ms(e,t,n,r,i){var a=F.p;F.p=a!==0&&8>a?a:8;var o=P.T,s={};P.T=s,ws(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Cs(e,t,ia(c,r),uu(e)):Cs(e,t,r,uu(e))}catch(n){Cs(e,t,{then:function(){},status:`rejected`,reason:n},uu())}finally{F.p=a,o!==null&&s.types!==null&&(o.types=s.types),P.T=o}}function hs(){}function gs(e,t,n,r){if(e.tag!==5)throw Error(o(476));var i=_s(e).queue;ms(e,i,t,te,n===null?hs:function(){return vs(e),n(r)})}function _s(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Do,lastRenderedState:te},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Do,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function vs(e){var t=_s(e);t.next===null&&(t=e.alternate.memoizedState),Cs(e,t.next.queue,{},uu())}function Q(){return Ui(Qf)}function $(){return So().memoizedState}function ys(){return So().memoizedState}function bs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=uu();e=ja(n);var r=Ma(t,e,n);r!==null&&(fu(r,t,n),Na(r,t,n)),t={cache:Xi()},e.payload=t;return}t=t.return}}function xs(e,t,n){var r=uu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ts(e)?Es(t,n):(n=Hr(e,t,n,r),n!==null&&(fu(n,e,r),Ds(n,t,r)))}function Ss(e,t,n){Cs(e,t,n,uu())}function Cs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ts(e))Es(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,lr(s,o))return Vr(e,t,i,0),Ml===null&&Br(),!1}catch{}if(n=Hr(e,t,i,r),n!==null)return fu(n,e,r),Ds(n,t,r),!0}return!1}function ws(e,t,n,r){if(r={lane:2,revertLane:ld(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ts(e)){if(t)throw Error(o(479))}else t=Hr(e,n,r,2),t!==null&&fu(t,e,2)}function Ts(e){var t=e.alternate;return e===to||t!==null&&t===to}function Es(e,t){ao=io=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ds(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ue(e,n)}}var Os={readContext:Ui,use:To,useCallback:fo,useContext:fo,useEffect:fo,useImperativeHandle:fo,useLayoutEffect:fo,useInsertionEffect:fo,useMemo:fo,useReducer:fo,useRef:fo,useState:fo,useDebugValue:fo,useDeferredValue:fo,useTransition:fo,useSyncExternalStore:fo,useId:fo,useHostTransitionStatus:fo,useFormState:fo,useActionState:fo,useOptimistic:fo,useMemoCache:fo,useCacheRefresh:fo};Os.useEffectEvent=fo;var ks={readContext:Ui,use:To,useCallback:function(e,t){return xo().memoizedState=[e,t===void 0?null:t],e},useContext:Ui,useEffect:ts,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),$o(4194308,4,ss.bind(null,t,e),n)},useLayoutEffect:function(e,t){return $o(4194308,4,e,t)},useInsertionEffect:function(e,t){$o(4,2,e,t)},useMemo:function(e,t){var n=xo();t=t===void 0?null:t;var r=e();if(oo){Ee(!0);try{e()}finally{Ee(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=xo();if(n!==void 0){var i=n(t);if(oo){Ee(!0);try{n(t)}finally{Ee(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=xs.bind(null,to,e),[r.memoizedState,e]},useRef:function(e){var t=xo();return e={current:e},t.memoizedState=e},useState:function(e){e=Lo(e);var t=e.queue,n=Ss.bind(null,to,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ls,useDeferredValue:function(e,t){return fs(xo(),e,t)},useTransition:function(){var e=Lo(!1);return e=ms.bind(null,to,e.queue,!0,!1),xo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=to,i=xo();if(Si){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Ml===null)throw Error(o(349));Pl&127||Mo(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,ts(Po.bind(null,r,a,e),[e]),r.flags|=2048,Zo(9,{destroy:void 0},No.bind(null,r,a,n,t),null),n},useId:function(){var e=xo(),t=Ml.identifierPrefix;if(Si){var n=mi,r=pi;n=(r&~(1<<32-De(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=so++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=uo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Q,useFormState:Ko,useActionState:Ko,useOptimistic:function(e){var t=xo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ws.bind(null,to,!0,n),n.dispatch=t,[e,t]},useMemoCache:Eo,useCacheRefresh:function(){return xo().memoizedState=bs.bind(null,to)},useEffectEvent:function(e){var t=xo(),n={impl:e};return t.memoizedState=n,function(){if(jl&2)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},As={readContext:Ui,use:To,useCallback:us,useContext:Ui,useEffect:ns,useImperativeHandle:cs,useInsertionEffect:as,useLayoutEffect:os,useMemo:ds,useReducer:Oo,useRef:Qo,useState:function(){return Oo(Do)},useDebugValue:ls,useDeferredValue:function(e,t){return ps(So(),no.memoizedState,e,t)},useTransition:function(){var e=Oo(Do)[0],t=So().memoizedState;return[typeof e==`boolean`?e:wo(e),t]},useSyncExternalStore:jo,useId:$,useHostTransitionStatus:Q,useFormState:qo,useActionState:qo,useOptimistic:function(e,t){return Ro(So(),no,e,t)},useMemoCache:Eo,useCacheRefresh:ys};As.useEffectEvent=is;var js={readContext:Ui,use:To,useCallback:us,useContext:Ui,useEffect:ns,useImperativeHandle:cs,useInsertionEffect:as,useLayoutEffect:os,useMemo:ds,useReducer:Ao,useRef:Qo,useState:function(){return Ao(Do)},useDebugValue:ls,useDeferredValue:function(e,t){var n=So();return no===null?fs(n,e,t):ps(n,no.memoizedState,e,t)},useTransition:function(){var e=Ao(Do)[0],t=So().memoizedState;return[typeof e==`boolean`?e:wo(e),t]},useSyncExternalStore:jo,useId:$,useHostTransitionStatus:Q,useFormState:Xo,useActionState:Xo,useOptimistic:function(e,t){var n=So();return no===null?(n.baseState=e,[e,n.queue.dispatch]):Ro(n,no,e,t)},useMemoCache:Eo,useCacheRefresh:ys};js.useEffectEvent=is;function Ms(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ns={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=uu(),i=ja(r);i.payload=t,n!=null&&(i.callback=n),t=Ma(e,i,r),t!==null&&(fu(t,e,r),Na(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=uu(),i=ja(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ma(e,i,r),t!==null&&(fu(t,e,r),Na(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=uu(),r=ja(n);r.tag=2,t!=null&&(r.callback=t),t=Ma(e,r,n),t!==null&&(fu(t,e,n),Na(t,e,n))}};function Ps(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!ur(n,r)||!ur(i,a):!0}function Fs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ns.enqueueReplaceState(t,t.state,null)}function Is(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ls(e){Lr(e)}function Rs(e){console.error(e)}function zs(e){Lr(e)}function Bs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Vs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Hs(e,t,n){return n=ja(n),n.tag=3,n.payload={element:null},n.callback=function(){Bs(e,t)},n}function Us(e){return e=ja(e),e.tag=3,e}function Ws(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Vs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Vs(t,n,r),typeof i!=`function`&&(eu===null?eu=new Set([this]):eu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Gs(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Bi(t,n,i,!0),n=Ga.current,n!==null){switch(n.tag){case 31:case 13:return Ka===null?wu():n.alternate===null&&Vl===0&&(Vl=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===pa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Uu(e,r,i)),!1;case 22:return n.flags|=65536,r===pa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Uu(e,r,i)),!1}throw Error(o(435,n.tag))}return Uu(e,r,i),wu(),!1}if(Si)return t=Ga.current,t===null?(r!==Ti&&(t=Error(o(423),{cause:r}),Mi(ai(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=ai(r,n),i=Hs(e.stateNode,r,i),Pa(e,i),Vl!==4&&(Vl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Ti&&(e=Error(o(422),{cause:r}),Mi(ai(e,n)))),!1;var a=Error(o(520),{cause:r});if(a=ai(a,n),ql===null?ql=[a]:ql.push(a),Vl!==4&&(Vl=2),t===null)return!0;r=ai(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Hs(n.stateNode,r,e),Pa(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(eu===null||!eu.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Us(i),Ws(i,e,n,r),Pa(n,i),!1}n=n.return}while(n!==null);return!1}var Ks=Error(o(461)),qs=!1;function Js(e,t,n,r){t.child=e===null?Da(t,null,n,r):Ea(t,e.child,n,r)}function Ys(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Hi(t),r=mo(e,t,n,o,a,i),s=vo(),e!==null&&!qs?(yo(e,t,i),yc(e,t,i)):(Si&&s&&_i(t),t.flags|=1,Js(e,t,r,i),t.child)}function Xs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Xr(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Zs(e,t,a,r,i)):(e=$r(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!bc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?ur:n,n(o,r)&&e.ref===t.ref)return yc(e,t,i)}return t.flags|=1,e=Zr(a,r),e.ref=t.ref,e.return=t,t.child=e}function Zs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(ur(a,r)&&e.ref===t.ref){if(qs=!1,t.pendingProps=r=a,bc(e,i))e.flags&131072&&(qs=!0);else return t.lanes=e.lanes,yc(e,t,i)}}return ac(e,t,n,r,i)}function Qs(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return ec(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ca(t,a===null?null:a.cachePool),a===null?Ua():Ha(t,a),Ya(t);else return r=t.lanes=536870912,ec(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ca(t,null),Ua(),Xa(t)):(ca(t,a.cachePool),Ha(t,a),Xa(t),t.memoizedState=null);return Js(e,t,i,n),t.child}function $s(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ec(e,t,n,r,i){var a=sa();return a=a===null?null:{parent:Yi._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ca(t,null),Ua(),Ya(t),e!==null&&Bi(e,t,r,!0),t.childLanes=i,null}function tc(e,t){return t=mc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function nc(e,t,n){return Ea(t,e.child,null,n),e=tc(t,t.pendingProps),e.flags|=2,Za(t),t.memoizedState=null,e}function rc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(Si){if(r.mode===`hidden`)return e=tc(t,r),t.lanes=536870912,$s(null,e);if(Ja(t),(e=xi)?(e=rf(e,wi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:fi===null?null:{id:pi,overflow:mi},retryLane:536870912,hydrationErrors:null},n=ni(e),n.return=t,t.child=n,bi=t,xi=null)):e=null,e===null)throw Ei(t);return t.lanes=536870912,null}return tc(t,r)}var a=e.memoizedState;if(a!==null){var s=a.dehydrated;if(Ja(t),i){if(t.flags&256)t.flags&=-257,t=nc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558))}else if(qs||Bi(e,t,n,!1),i=(n&e.childLanes)!==0,qs||i){if(r=Ml,r!==null&&(s=We(r,n),s!==0&&s!==a.retryLane))throw a.retryLane=s,Ur(e,s),fu(r,e,s),Ks;wu(),t=nc(e,t,n)}else e=a.treeContext,xi=cf(s.nextSibling),bi=t,Si=!0,Ci=null,wi=!1,e!==null&&yi(t,e),t=tc(t,r),t.flags|=4096;return t}return e=Zr(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ic(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function ac(e,t,n,r,i){return Hi(t),n=mo(e,t,n,r,void 0,i),r=vo(),e!==null&&!qs?(yo(e,t,i),yc(e,t,i)):(Si&&r&&_i(t),t.flags|=1,Js(e,t,n,i),t.child)}function oc(e,t,n,r,i,a){return Hi(t),t.updateQueue=null,n=go(t,r,n,i),ho(e),r=vo(),e!==null&&!qs?(yo(e,t,a),yc(e,t,a)):(Si&&r&&_i(t),t.flags|=1,Js(e,t,n,a),t.child)}function sc(e,t,n,r,i){if(Hi(t),t.stateNode===null){var a=qr,o=n.contextType;typeof o==`object`&&o&&(a=Ui(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ns,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},ka(t),o=n.contextType,a.context=typeof o==`object`&&o?Ui(o):qr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ms(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ns.enqueueReplaceState(a,a.state,null),La(t,r,a,i),Ia(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Is(n,s);a.props=c;var l=a.context,u=n.contextType;o=qr,typeof u==`object`&&u&&(o=Ui(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Fs(t,a,r,o),Oa=!1;var f=t.memoizedState;a.state=f,La(t,r,a,i),Ia(),l=t.memoizedState,s||f!==l||Oa?(typeof d==`function`&&(Ms(t,n,d,r),l=t.memoizedState),(c=Oa||Ps(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Aa(e,t),o=t.memoizedProps,u=Is(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=qr,typeof l==`object`&&l&&(c=Ui(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Fs(t,a,r,c),Oa=!1,f=t.memoizedState,a.state=f,La(t,r,a,i),Ia();var p=t.memoizedState;o!==d||f!==p||Oa||e!==null&&e.dependencies!==null&&Vi(e.dependencies)?(typeof s==`function`&&(Ms(t,n,s,r),p=t.memoizedState),(u=Oa||Ps(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Vi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,ic(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ea(t,e.child,null,i),t.child=Ea(t,null,n,i)):Js(e,t,n,i),t.memoizedState=a.state,e=t.child):e=yc(e,t,i),e}function cc(e,t,n,r){return Ai(),t.flags|=256,Js(e,t,n,r),t.child}var lc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function uc(e){return{baseLanes:e,cachePool:la()}}function dc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Gl),e}function fc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),s;if((s=a)||(s=e!==null&&e.memoizedState===null?!1:!!(Qa.current&2)),s&&(i=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Si){if(i?qa(t):Xa(t),(e=xi)?(e=rf(e,wi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:fi===null?null:{id:pi,overflow:mi},retryLane:536870912,hydrationErrors:null},n=ni(e),n.return=t,t.child=n,bi=t,xi=null)):e=null,e===null)throw Ei(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(Xa(t),i=t.mode,c=mc({mode:`hidden`,children:c},i),r=ei(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=uc(n),r.childLanes=dc(e,s,n),t.memoizedState=lc,$s(null,r)):(qa(t),pc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(a)t.flags&256?(qa(t),t.flags&=-257,t=hc(e,t,n)):t.memoizedState===null?(Xa(t),c=r.fallback,i=t.mode,r=mc({mode:`visible`,children:r.children},i),c=ei(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ea(t,e.child,null,n),r=t.child,r.memoizedState=uc(n),r.childLanes=dc(e,s,n),t.memoizedState=lc,t=$s(null,r)):(Xa(t),t.child=e.child,t.flags|=128,t=null);else if(qa(t),of(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(o(419)),r.stack=``,r.digest=s,Mi({value:r,source:null,stack:null}),t=hc(e,t,n)}else if(qs||Bi(e,t,n,!1),s=(n&e.childLanes)!==0,qs||s){if(s=Ml,s!==null&&(r=We(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Ur(e,r),fu(s,e,r),Ks;af(c)||wu(),t=hc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,xi=cf(c.nextSibling),bi=t,Si=!0,Ci=null,wi=!1,e!==null&&yi(t,e),t=pc(t,r.children),t.flags|=4096);return t}return i?(Xa(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=Zr(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ei(c,i,n,null),c.flags|=2):c=Zr(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,$s(null,r),r=t.child,c=e.child.memoizedState,c===null?c=uc(n):(i=c.cachePool,i===null?i=la():(l=Yi._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=dc(e,s,n),t.memoizedState=lc,$s(e.child,r)):(qa(t),n=e.child,e=n.sibling,n=Zr(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function pc(e,t){return t=mc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function mc(e,t){return e=Yr(22,e,null,t),e.lanes=0,e}function hc(e,t,n){return Ea(t,e.child,null,n),e=pc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function gc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ri(e.return,t,n)}function _c(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function vc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Qa.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,R(Qa,o),Js(e,t,r,n),r=Si?li:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gc(e,n,t);else if(e.tag===19)gc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&$a(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),_c(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&$a(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}_c(t,!0,n,null,a,r);break;case`together`:_c(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function yc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Hl|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Bi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=Zr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Zr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function bc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Vi(e)))}function xc(e,t,n){switch(t.tag){case 3:ie(t,t.stateNode.containerInfo),Ii(t,Yi,e.memoizedState.cache),Ai();break;case 27:case 5:U(t);break;case 4:ie(t,t.stateNode.containerInfo);break;case 10:Ii(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ja(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(qa(t),e=yc(e,t,n),e===null?null:e.sibling):fc(e,t,n):(qa(t),t.flags|=128,null);qa(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Bi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return vc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),R(Qa,Qa.current),r)break;return null;case 22:return t.lanes=0,Qs(e,t,n,t.pendingProps);case 24:Ii(t,Yi,e.memoizedState.cache)}return yc(e,t,n)}function Sc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)qs=!0;else{if(!bc(e,n)&&!(t.flags&128))return qs=!1,xc(e,t,n);qs=!!(e.flags&131072)}}else qs=!1,Si&&t.flags&1048576&&gi(t,li,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ga(t.elementType),t.type=e,typeof e==`function`)Xr(e)?(r=Is(e,r),t.tag=1,t=sc(null,t,e,r,n)):(t.tag=0,t=ac(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===C){t.tag=11,t=Ys(null,t,e,r,n);break a}if(i===E){t.tag=14,t=Xs(null,t,e,r,n);break a}}throw t=ee(e)||e,Error(o(306,t,``))}}return t;case 0:return ac(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Is(r,t.pendingProps),sc(e,t,r,i,n);case 3:a:{if(ie(t,t.stateNode.containerInfo),e===null)throw Error(o(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,Aa(e,t),La(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ii(t,Yi,r),r!==a.cache&&zi(t,[Yi],n,!0),Ia(),r=s.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=cc(e,t,r,n);break a}if(r!==i){i=ai(Error(o(424)),t),Mi(i),t=cc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(xi=cf(e.firstChild),bi=t,Si=!0,Ci=null,wi=!0,n=Da(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ai(),r===i){t=yc(e,t,n);break a}Js(e,t,r,n)}t=t.child}return t;case 26:return ic(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Si||(n=t.type,e=t.pendingProps,r=Bd(V.current).createElement(n),r[Xe]=t,r[Ze]=e,Pd(r,n,e),lt(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return U(t),e===null&&Si&&(r=t.stateNode=ff(t.type,t.pendingProps,V.current),bi=t,wi=!0,i=xi,Zd(t.type)?(lf=i,xi=cf(r.firstChild)):xi=i),Js(e,t,t.pendingProps.children,n),ic(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Si&&((i=r=xi)&&(r=tf(r,t.type,t.pendingProps,wi),r===null?i=!1:(t.stateNode=r,bi=t,xi=cf(r.firstChild),wi=!1,i=!0)),i||Ei(t)),U(t),i=t.type,a=t.pendingProps,s=e===null?null:e.memoizedProps,r=a.children,Ud(i,a)?r=null:s!==null&&Ud(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=mo(e,t,_o,null,null,n),Qf._currentValue=i),ic(e,t),Js(e,t,r,n),t.child;case 6:return e===null&&Si&&((e=n=xi)&&(n=nf(n,t.pendingProps,wi),n===null?e=!1:(t.stateNode=n,bi=t,xi=null,e=!0)),e||Ei(t)),null;case 13:return fc(e,t,n);case 4:return ie(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ea(t,null,r,n):Js(e,t,r,n),t.child;case 11:return Ys(e,t,t.type,t.pendingProps,n);case 7:return Js(e,t,t.pendingProps,n),t.child;case 8:return Js(e,t,t.pendingProps.children,n),t.child;case 12:return Js(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ii(t,t.type,r.value),Js(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Hi(t),i=Ui(i),r=r(i),t.flags|=1,Js(e,t,r,n),t.child;case 14:return Xs(e,t,t.type,t.pendingProps,n);case 15:return Zs(e,t,t.type,t.pendingProps,n);case 19:return vc(e,t,n);case 31:return rc(e,t,n);case 22:return Qs(e,t,n,t.pendingProps);case 24:return Hi(t),r=Ui(Yi),e===null?(i=sa(),i===null&&(i=Ml,a=Xi(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},ka(t),Ii(t,Yi,i)):((e.lanes&n)!==0&&(Aa(e,t),La(t,null,null,n),Ia()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,Ii(t,Yi,r),r!==i.cache&&zi(t,[Yi],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Ii(t,Yi,r))),Js(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function Cc(e){e.flags|=4}function wc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(xu())e.flags|=8192;else throw _a=pa,da}}else e.flags&=-16777217}function Tc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t)){if(xu())e.flags|=8192;else throw _a=pa,da}}function Ec(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Re(),e.lanes|=t,Kl|=t)}function Dc(e,t){if(!Si)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Oc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function kc(e,t,n){var r=t.pendingProps;switch(vi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Oc(t),null;case 1:return Oc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Li(Yi),ae(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ki(t)?Cc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ji())),Oc(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(Cc(t),a===null?(Oc(t),wc(t,i,null,r,n)):(Oc(t),Tc(t,a))):a?a===e.memoizedState?(Oc(t),t.flags&=-16777217):(Cc(t),Oc(t),Tc(t,a)):(e=e.memoizedProps,e!==r&&Cc(t),Oc(t),wc(t,i,e,r,n)),null;case 27:if(W(t),n=V.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Cc(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return Oc(t),null}e=z.current,ki(t)?Di(t,e):(e=ff(i,r,n),t.stateNode=e,Cc(t))}return Oc(t),null;case 5:if(W(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Cc(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return Oc(t),null}if(a=z.current,ki(t))Di(t,a);else{var s=Bd(V.current);switch(a){case 1:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=s.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}a[Xe]=t,a[Ze]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)a.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=a;a:switch(Pd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Cc(t)}}return Oc(t),wc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Cc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(o(166));if(e=V.current,ki(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=bi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Xe]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Ei(t,!0)}else e=Bd(e).createTextNode(r),e[Xe]=t,t.stateNode=e}return Oc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ki(t),n!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(557));e[Xe]=t}else Ai(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Oc(t),e=!1}else n=ji(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Za(t),t):(Za(t),null);if(t.flags&128)throw Error(o(558))}return Oc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=ki(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(o(317));i[Xe]=t}else Ai(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Oc(t),i=!1}else i=ji(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Za(t),t):(Za(t),null)}return Za(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Ec(t,t.updateQueue),Oc(t),null);case 4:return ae(),e===null&&xd(t.stateNode.containerInfo),Oc(t),null;case 10:return Li(t.type),Oc(t),null;case 19:if(re(Qa),r=t.memoizedState,r===null)return Oc(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)Dc(r,!1);else{if(Vl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=$a(e),a!==null){for(t.flags|=128,Dc(r,!1),e=a.updateQueue,t.updateQueue=e,Ec(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Qr(n,e),n=n.sibling;return R(Qa,Qa.current&1|2),Si&&hi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ge()>Ql&&(t.flags|=128,i=!0,Dc(r,!1),t.lanes=4194304)}}else{if(!i){if(e=$a(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Ec(t,e),Dc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!Si)return Oc(t),null}else 2*ge()-r.renderingStartTime>Ql&&n!==536870912&&(t.flags|=128,i=!0,Dc(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(Oc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ge(),e.sibling=null,n=Qa.current,R(Qa,i?n&1|2:n&1),Si&&hi(t,r.treeForkCount),e);case 22:case 23:return Za(t),Wa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Oc(t),t.subtreeFlags&6&&(t.flags|=8192)):Oc(t),n=t.updateQueue,n!==null&&Ec(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&re(oa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Li(Yi),Oc(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Ac(e,t){switch(vi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Li(Yi),ae(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return W(t),null;case 31:if(t.memoizedState!==null){if(Za(t),t.alternate===null)throw Error(o(340));Ai()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Za(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ai()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return re(Qa),null;case 4:return ae(),null;case 10:return Li(t.type),null;case 22:case 23:return Za(t),Wa(),e!==null&&re(oa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Li(Yi),null;case 25:return null;default:return null}}function jc(e,t){switch(vi(t),t.tag){case 3:Li(Yi),ae();break;case 26:case 27:case 5:W(t);break;case 4:ae();break;case 31:t.memoizedState!==null&&Za(t);break;case 13:Za(t);break;case 19:re(Qa);break;case 10:Li(t.type);break;case 22:case 23:Za(t),Wa(),e!==null&&re(oa);break;case 24:Li(Yi)}}function Mc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Hu(t,t.return,e)}}function Nc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Hu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Hu(t,t.return,e)}}function Pc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{za(t,n)}catch(t){Hu(e,e.return,t)}}}function Fc(e,t,n){n.props=Is(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Hu(e,t,n)}}function Ic(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Hu(e,t,n)}}function Lc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Hu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Hu(e,t,n)}else n.current=null}}function Rc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Hu(e,e.return,t)}}function zc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[Ze]=t}catch(t){Hu(e,e.return,t)}}function Bc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Vc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Bc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Hc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Vt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Hc(e,t,n),e=e.sibling;e!==null;)Hc(e,t,n),e=e.sibling}function Uc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Uc(e,t,n),e=e.sibling;e!==null;)Uc(e,t,n),e=e.sibling}function Wc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[Xe]=e,t[Ze]=n}catch(t){Hu(e,e.return,t)}}var Gc=!1,Kc=!1,qc=!1,Jc=typeof WeakSet==`function`?WeakSet:Set,Yc=null;function Xc(e,t){if(e=e.containerInfo,Rd=sp,e=mr(e),hr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==a||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===a&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,Yc=t;Yc!==null;)if(t=Yc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Yc=e;else for(;Yc!==null;){switch(t=Yc,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&a!==null){e=void 0,n=t,i=a.memoizedProps,a=a.memoizedState,r=n.stateNode;try{var h=Is(n.type,i);e=r.getSnapshotBeforeUpdate(h,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Hu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,Yc=e;break}Yc=t.return}}function Zc(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:fl(e,n),r&4&&Mc(5,n);break;case 1:if(fl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Hu(n,n.return,e)}else{var i=Is(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Hu(n,n.return,e)}}}r&64&&Pc(n),r&512&&Ic(n,n.return);break;case 3:if(fl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{za(e,t)}catch(e){Hu(n,n.return,e)}}break;case 27:t===null&&r&4&&Wc(n);case 26:case 5:fl(e,n),t===null&&r&4&&Rc(n),r&512&&Ic(n,n.return);break;case 12:fl(e,n);break;case 31:fl(e,n),r&4&&rl(e,n);break;case 13:fl(e,n),r&4&&il(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Ku.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Gc,!r){t=t!==null&&t.memoizedState!==null||Kc,i=Gc;var a=Kc;Gc=r,(Kc=t)&&!a?ml(e,n,!!(n.subtreeFlags&8772)):fl(e,n),Gc=i,Kc=a}break;case 30:break;default:fl(e,n)}}function Qc(e){var t=e.alternate;t!==null&&(e.alternate=null,Qc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&it(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var $c=null,el=!1;function tl(e,t,n){for(n=n.child;n!==null;)nl(e,t,n),n=n.sibling}function nl(e,t,n){if(Te&&typeof Te.onCommitFiberUnmount==`function`)try{Te.onCommitFiberUnmount(we,n)}catch{}switch(n.tag){case 26:Kc||Lc(n,t),tl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Kc||Lc(n,t);var r=$c,i=el;Zd(n.type)&&($c=n.stateNode,el=!1),tl(e,t,n),pf(n.stateNode),$c=r,el=i;break;case 5:Kc||Lc(n,t);case 6:if(r=$c,i=el,$c=null,tl(e,t,n),$c=r,el=i,$c!==null){if(el)try{($c.nodeType===9?$c.body:$c.nodeName===`HTML`?$c.ownerDocument.body:$c).removeChild(n.stateNode)}catch(e){Hu(n,t,e)}else try{$c.removeChild(n.stateNode)}catch(e){Hu(n,t,e)}}break;case 18:$c!==null&&(el?(e=$c,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd($c,n.stateNode));break;case 4:r=$c,i=el,$c=n.stateNode.containerInfo,el=!0,tl(e,t,n),$c=r,el=i;break;case 0:case 11:case 14:case 15:Nc(2,n,t),Kc||Nc(4,n,t),tl(e,t,n);break;case 1:Kc||(Lc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Fc(n,t,r)),tl(e,t,n);break;case 21:tl(e,t,n);break;case 22:Kc=(r=Kc)||n.memoizedState!==null,tl(e,t,n),Kc=r;break;default:tl(e,t,n)}}function rl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Hu(t,t.return,e)}}}function il(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Hu(t,t.return,e)}}function al(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Jc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Jc),t;default:throw Error(o(435,e.tag))}}function ol(e,t){var n=al(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=qu.bind(null,e,t);t.then(r,r)}})}function sl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],a=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){$c=c.stateNode,el=!1;break a}break;case 5:$c=c.stateNode,el=!1;break a;case 3:case 4:$c=c.stateNode.containerInfo,el=!0;break a}c=c.return}if($c===null)throw Error(o(160));nl(a,s,i),$c=null,el=!1,a=i.alternate,a!==null&&(a.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ll(t,e),t=t.sibling}var cl=null;function ll(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:sl(t,e),ul(e),r&4&&(Nc(3,e,e.return),Mc(3,e),Nc(5,e,e.return));break;case 1:sl(t,e),ul(e),r&512&&(Kc||n===null||Lc(n,n.return)),r&64&&Gc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=cl;if(sl(t,e),ul(e),r&512&&(Kc||n===null||Lc(n,n.return)),r&4){var a=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:a=i.getElementsByTagName(`title`)[0],(!a||a[rt]||a[Xe]||a.namespaceURI===`http://www.w3.org/2000/svg`||a.hasAttribute(`itemprop`))&&(a=i.createElement(r),i.head.insertBefore(a,i.querySelector(`head > title`))),Pd(a,r,n),a[Xe]=e,lt(a),r=a;break a;case`link`:var s=Vf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(a=s[c],a.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&a.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&a.getAttribute(`title`)===(n.title==null?null:n.title)&&a.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}a=i.createElement(r),Pd(a,r,n),i.head.appendChild(a);break;case`meta`:if(s=Vf(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(a=s[c],a.getAttribute(`content`)===(n.content==null?null:``+n.content)&&a.getAttribute(`name`)===(n.name==null?null:n.name)&&a.getAttribute(`property`)===(n.property==null?null:n.property)&&a.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}a=i.createElement(r),Pd(a,r,n),i.head.appendChild(a);break;default:throw Error(o(468,r))}a[Xe]=e,lt(a),r=a}e.stateNode=r}else Hf(i,e.type,e.stateNode)}else e.stateNode=If(i,r,e.memoizedProps)}else a===r?r===null&&e.stateNode!==null&&zc(e,e.memoizedProps,n.memoizedProps):(a===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):a.count--,r===null?Hf(i,e.type,e.stateNode):If(i,r,e.memoizedProps))}break;case 27:sl(t,e),ul(e),r&512&&(Kc||n===null||Lc(n,n.return)),n!==null&&r&4&&zc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(sl(t,e),ul(e),r&512&&(Kc||n===null||Lc(n,n.return)),e.flags&32){i=e.stateNode;try{Nt(i,``)}catch(t){Hu(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,zc(e,i,n===null?i:n.memoizedProps)),r&1024&&(qc=!0);break;case 6:if(sl(t,e),ul(e),r&4){if(e.stateNode===null)throw Error(o(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Hu(e,e.return,t)}}break;case 3:if(Bf=null,i=cl,cl=gf(t.containerInfo),sl(t,e),cl=i,ul(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Hu(e,e.return,t)}qc&&(qc=!1,dl(e));break;case 4:r=cl,cl=gf(e.stateNode.containerInfo),sl(t,e),ul(e),cl=r;break;case 12:sl(t,e),ul(e);break;case 31:sl(t,e),ul(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ol(e,r)));break;case 13:sl(t,e),ul(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Xl=ge()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ol(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Gc,d=Kc;if(Gc=u||i,Kc=d||l,sl(t,e),Kc=d,Gc=u,ul(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||Gc||Kc||pl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(a=l.stateNode,i)s=a.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Hu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){Hu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?$d(m,!0):$d(l.stateNode,!1)}catch(e){Hu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,ol(e,n))));break;case 19:sl(t,e),ul(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ol(e,r)));break;case 30:break;case 21:break;default:sl(t,e),ul(e)}}function ul(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Bc(r)){n=r;break}r=r.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var i=n.stateNode;Uc(e,Vc(e),i);break;case 5:var a=n.stateNode;n.flags&32&&(Nt(a,``),n.flags&=-33),Uc(e,Vc(e),a);break;case 3:case 4:var s=n.stateNode.containerInfo;Hc(e,Vc(e),s);break;default:throw Error(o(161))}}catch(t){Hu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function dl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;dl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function fl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Zc(e,t.alternate,t),t=t.sibling}function pl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Nc(4,t,t.return),pl(t);break;case 1:Lc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Fc(t,t.return,n),pl(t);break;case 27:pf(t.stateNode);case 26:case 5:Lc(t,t.return),pl(t);break;case 22:t.memoizedState===null&&pl(t);break;case 30:pl(t);break;default:pl(t)}e=e.sibling}}function ml(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:ml(i,a,n),Mc(4,a);break;case 1:if(ml(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Hu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ra(c[i],s)}catch(e){Hu(r,r.return,e)}}n&&o&64&&Pc(a),Ic(a,a.return);break;case 27:Wc(a);case 26:case 5:ml(i,a,n),n&&r===null&&o&4&&Rc(a),Ic(a,a.return);break;case 12:ml(i,a,n);break;case 31:ml(i,a,n),n&&o&4&&rl(i,a);break;case 13:ml(i,a,n),n&&o&4&&il(i,a);break;case 22:a.memoizedState===null&&ml(i,a,n),Ic(a,a.return);break;case 30:break;default:ml(i,a,n)}t=t.sibling}}function hl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Zi(n))}function gl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Zi(e))}function _l(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)vl(e,t,n,r),t=t.sibling}function vl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:_l(e,t,n,r),i&2048&&Mc(9,t);break;case 1:_l(e,t,n,r);break;case 3:_l(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Zi(e)));break;case 12:if(i&2048){_l(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Hu(t,t.return,e)}}else _l(e,t,n,r);break;case 31:_l(e,t,n,r);break;case 13:_l(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?_l(e,t,n,r):(a._visibility|=2,yl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?_l(e,t,n,r):bl(e,t),i&2048&&hl(o,t);break;case 24:_l(e,t,n,r),i&2048&&gl(t.alternate,t);break;default:_l(e,t,n,r)}}function yl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:yl(a,o,s,c,i),Mc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,yl(a,o,s,c,i)):u._visibility&2?yl(a,o,s,c,i):bl(a,o),i&&l&2048&&hl(o.alternate,o);break;case 24:yl(a,o,s,c,i),i&&l&2048&&gl(o.alternate,o);break;default:yl(a,o,s,c,i)}t=t.sibling}}function bl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:bl(n,r),i&2048&&hl(r.alternate,r);break;case 24:bl(n,r),i&2048&&gl(r.alternate,r);break;default:bl(n,r)}t=t.sibling}}var xl=8192;function Sl(e,t,n){if(e.subtreeFlags&xl)for(e=e.child;e!==null;)Cl(e,t,n),e=e.sibling}function Cl(e,t,n){switch(e.tag){case 26:Sl(e,t,n),e.flags&xl&&e.memoizedState!==null&&Gf(n,cl,e.memoizedState,e.memoizedProps);break;case 5:Sl(e,t,n);break;case 3:case 4:var r=cl;cl=gf(e.stateNode.containerInfo),Sl(e,t,n),cl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=xl,xl=16777216,Sl(e,t,n),xl=r):Sl(e,t,n));break;default:Sl(e,t,n)}}function wl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Tl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Yc=r,Ol(r,e)}wl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)El(e),e=e.sibling}function El(e){switch(e.tag){case 0:case 11:case 15:Tl(e),e.flags&2048&&Nc(9,e,e.return);break;case 3:Tl(e);break;case 12:Tl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Dl(e)):Tl(e);break;default:Tl(e)}}function Dl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Yc=r,Ol(r,e)}wl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Nc(8,t,t.return),Dl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Dl(t));break;default:Dl(t)}e=e.sibling}}function Ol(e,t){for(;Yc!==null;){var n=Yc;switch(n.tag){case 0:case 11:case 15:Nc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Zi(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Yc=r;else a:for(n=e;Yc!==null;){r=Yc;var i=r.sibling,a=r.return;if(Qc(r),r===n){Yc=null;break a}if(i!==null){i.return=a,Yc=i;break a}Yc=a}}}var kl={getCacheForType:function(e){var t=Ui(Yi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ui(Yi).controller.signal}},Al=typeof WeakMap==`function`?WeakMap:Map,jl=0,Ml=null,Nl=null,Pl=0,Fl=0,Il=null,Ll=!1,Rl=!1,zl=!1,Bl=0,Vl=0,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=null,Jl=null,Yl=!1,Xl=0,Zl=0,Ql=1/0,$l=null,eu=null,tu=0,nu=null,ru=null,iu=0,au=0,ou=null,su=null,cu=0,lu=null;function uu(){return jl&2&&Pl!==0?Pl&-Pl:P.T===null?qe():ld()}function du(){if(Gl===0){if(!(Pl&536870912)||Si){var e=Me;Me<<=1,!(Me&3932160)&&(Me=262144),Gl=e}else Gl=536870912}return e=Ga.current,e!==null&&(e.flags|=32),Gl}function fu(e,t,n){(e===Ml&&(Fl===2||Fl===9)||e.cancelPendingCommit!==null)&&(yu(e,0),gu(e,Pl,Gl,!1)),Be(e,n),(!(jl&2)||e!==Ml)&&(e===Ml&&(!(jl&2)&&(Ul|=n),Vl===4&&gu(e,Pl,Gl,!1)),td(e))}function pu(e,t,n){if(jl&6)throw Error(o(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Ie(e,t),i=r?Du(e,t):Tu(e,t,!0),a=r;do{if(i===0){Rl&&!r&&gu(e,t,0,!1);break}if(n=e.current.alternate,a&&!hu(n)){i=Tu(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=ql;var l=c.current.memoizedState.isDehydrated;if(l&&(yu(c,s).flags|=256),s=Tu(c,s,!1),s!==2){if(zl&&!l){c.errorRecoveryDisabledLanes|=a,Ul|=a,i=4;break a}a=Jl,Jl=i,a!==null&&(Jl===null?Jl=a:Jl.push.apply(Jl,a))}i=s}if(a=!1,i!==2)continue}}if(i===1){yu(e,0),gu(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:gu(r,t,Gl,!Ll);break a;case 2:Jl=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(i=Xl+300-ge(),10<i)){if(gu(r,t,Gl,!Ll),Fe(r,0,!0)!==0)break a;iu=t,r.timeoutHandle=Kd(mu.bind(null,r,n,Jl,$l,Yl,t,Gl,Ul,Kl,Ll,a,`Throttled`,-0,0),i);break a}mu(r,n,Jl,$l,Yl,t,Gl,Ul,Kl,Ll,a,null,-0,0)}break}while(1);td(e)}function mu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Vt},Cl(t,a,d);var m=(a&62914560)===a?Xl-ge():(a&4194048)===a?Zl-ge():0;if(m=qf(d,m),m!==null){iu=a,e.cancelPendingCommit=m(Pu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),gu(e,a,o,!l);return}}Pu(e,t,a,n,r,i,o,s,c)}function hu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!lr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function gu(e,t,n,r){t&=~Wl,t&=~Ul,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-De(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&He(e,n,t)}function _u(){return jl&6?!0:(nd(0,!1),!1)}function vu(){if(Nl!==null){if(Fl===0)var e=Nl.return;else e=Nl,Fi=Pi=null,bo(e),ba=null,xa=0,e=Nl;for(;e!==null;)jc(e.alternate,e),e=e.return;Nl=null}}function yu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),iu=0,vu(),Ml=e,Nl=n=Zr(e.current,null),Pl=t,Fl=0,Il=null,Ll=!1,Rl=Ie(e,t),zl=!1,Kl=Gl=Wl=Ul=Hl=Vl=0,Jl=ql=null,Yl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-De(r),a=1<<i;t|=e[i],r&=~a}return Bl=t,Br(),n}function bu(e,t){to=null,P.H=Os,t===ua||t===fa?(t=va(),Fl=3):t===da?(t=va(),Fl=4):Fl=t===Ks?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Il=t,Nl===null&&(Vl=1,Bs(e,ai(t,e.current)))}function xu(){var e=Ga.current;return e===null?!0:(Pl&4194048)===Pl?Ka===null:(Pl&62914560)===Pl||Pl&536870912?e===Ka:!1}function Su(){var e=P.H;return P.H=Os,e===null?Os:e}function Cu(){var e=P.A;return P.A=kl,e}function wu(){Vl=4,Ll||(Pl&4194048)!==Pl&&Ga.current!==null||(Rl=!0),!(Hl&134217727)&&!(Ul&134217727)||Ml===null||gu(Ml,Pl,Gl,!1)}function Tu(e,t,n){var r=jl;jl|=2;var i=Su(),a=Cu();(Ml!==e||Pl!==t)&&($l=null,yu(e,t)),t=!1;var o=Vl;a:do try{if(Fl!==0&&Nl!==null){var s=Nl,c=Il;switch(Fl){case 8:vu(),o=6;break a;case 3:case 2:case 9:case 6:Ga.current===null&&(t=!0);var l=Fl;if(Fl=0,Il=null,ju(e,s,c,l),n&&Rl){o=0;break a}break;default:l=Fl,Fl=0,Il=null,ju(e,s,c,l)}}Eu(),o=Vl;break}catch(t){bu(e,t)}while(1);return t&&e.shellSuspendCounter++,Fi=Pi=null,jl=r,P.H=i,P.A=a,Nl===null&&(Ml=null,Pl=0,Br()),o}function Eu(){for(;Nl!==null;)ku(Nl)}function Du(e,t){var n=jl;jl|=2;var r=Su(),i=Cu();Ml!==e||Pl!==t?($l=null,Ql=ge()+500,yu(e,t)):Rl=Ie(e,t);a:do try{if(Fl!==0&&Nl!==null){t=Nl;var a=Il;b:switch(Fl){case 1:Fl=0,Il=null,ju(e,t,a,1);break;case 2:case 9:if(ma(a)){Fl=0,Il=null,Au(t);break}t=function(){Fl!==2&&Fl!==9||Ml!==e||(Fl=7),td(e)},a.then(t,t);break a;case 3:Fl=7;break a;case 4:Fl=5;break a;case 7:ma(a)?(Fl=0,Il=null,Au(t)):(Fl=0,Il=null,ju(e,t,a,7));break;case 5:var s=null;switch(Nl.tag){case 26:s=Nl.memoizedState;case 5:case 27:var c=Nl;if(s?Wf(s):c.stateNode.complete){Fl=0,Il=null;var l=c.sibling;if(l!==null)Nl=l;else{var u=c.return;u===null?Nl=null:(Nl=u,Mu(u))}break b}}Fl=0,Il=null,ju(e,t,a,5);break;case 6:Fl=0,Il=null,ju(e,t,a,6);break;case 8:vu(),Vl=6;break a;default:throw Error(o(462))}}Ou();break}catch(t){bu(e,t)}while(1);return Fi=Pi=null,P.H=r,P.A=i,jl=n,Nl===null?(Ml=null,Pl=0,Br(),Vl):0}function Ou(){for(;Nl!==null&&!me();)ku(Nl)}function ku(e){var t=Sc(e.alternate,e,Bl);e.memoizedProps=e.pendingProps,t===null?Mu(e):Nl=t}function Au(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=oc(n,t,t.pendingProps,t.type,void 0,Pl);break;case 11:t=oc(n,t,t.pendingProps,t.type.render,t.ref,Pl);break;case 5:bo(t);default:jc(n,t),t=Nl=Qr(t,Bl),t=Sc(n,t,Bl)}e.memoizedProps=e.pendingProps,t===null?Mu(e):Nl=t}function ju(e,t,n,r){Fi=Pi=null,bo(t),ba=null,xa=0;var i=t.return;try{if(Gs(e,i,t,n,Pl)){Vl=1,Bs(e,ai(n,e.current)),Nl=null;return}}catch(t){if(i!==null)throw Nl=i,t;Vl=1,Bs(e,ai(n,e.current)),Nl=null;return}t.flags&32768?(Si||r===1?e=!0:Rl||Pl&536870912?e=!1:(Ll=e=!0,(r===2||r===9||r===3||r===6)&&(r=Ga.current,r!==null&&r.tag===13&&(r.flags|=16384))),Nu(t,e)):Mu(t)}function Mu(e){var t=e;do{if(t.flags&32768){Nu(t,Ll);return}e=t.return;var n=kc(t.alternate,t,Bl);if(n!==null){Nl=n;return}if(t=t.sibling,t!==null){Nl=t;return}Nl=t=e}while(t!==null);Vl===0&&(Vl=5)}function Nu(e,t){do{var n=Ac(e.alternate,e);if(n!==null){n.flags&=32767,Nl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Nl=e;return}Nl=e=n}while(e!==null);Vl=6,Nl=null}function Pu(e,t,n,r,i,a,s,c,l){e.cancelPendingCommit=null;do zu();while(tu!==0);if(jl&6)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(a=t.lanes|t.childLanes,a|=zr,Ve(e,n,a,s,c,l),e===Ml&&(Nl=Ml=null,Pl=0),ru=t,nu=e,iu=n,au=a,ou=i,su=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Ju(ye,function(){return Bu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=P.T,P.T=null,i=F.p,F.p=2,s=jl,jl|=4;try{Xc(e,t,n)}finally{jl=s,F.p=i,P.T=r}}tu=1,Fu(),Iu(),Lu()}}function Fu(){if(tu===1){tu=0;var e=nu,t=ru,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=jl;jl|=4;try{ll(t,e);var a=zd,o=mr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&pr(s.ownerDocument.documentElement,s)){if(c!==null&&hr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=fr(s,h),v=fr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{jl=i,F.p=r,P.T=n}}e.current=t,tu=2}}function Iu(){if(tu===2){tu=0;var e=nu,t=ru,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=jl;jl|=4;try{Zc(e,t.alternate,t)}finally{jl=i,F.p=r,P.T=n}}tu=3}}function Lu(){if(tu===4||tu===3){tu=0,he();var e=nu,t=ru,n=iu,r=su;t.subtreeFlags&10256||t.flags&10256?tu=5:(tu=0,ru=nu=null,Ru(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(eu=null),Ke(n),t=t.stateNode,Te&&typeof Te.onCommitFiberRoot==`function`)try{Te.onCommitFiberRoot(we,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=P.T,i=F.p,F.p=2,P.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{P.T=t,F.p=i}}iu&3&&zu(),td(e),i=e.pendingLanes,n&261930&&i&42?e===lu?cu++:(cu=0,lu=e):cu=0,nd(0,!1)}}function Ru(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Zi(t)))}function zu(){return Fu(),Iu(),Lu(),Bu()}function Bu(){if(tu!==5)return!1;var e=nu,t=au;au=0;var n=Ke(iu),r=P.T,i=F.p;try{F.p=32>n?32:n,P.T=null,n=ou,ou=null;var a=nu,s=iu;if(tu=0,ru=nu=null,iu=0,jl&6)throw Error(o(331));var c=jl;if(jl|=4,El(a.current),vl(a,a.current,s,n),jl=c,nd(0,!1),Te&&typeof Te.onPostCommitFiberRoot==`function`)try{Te.onPostCommitFiberRoot(we,a)}catch{}return!0}finally{F.p=i,P.T=r,Ru(e,t)}}function Vu(e,t,n){t=ai(n,t),t=Hs(e.stateNode,t,2),e=Ma(e,t,2),e!==null&&(Be(e,2),td(e))}function Hu(e,t,n){if(e.tag===3)Vu(e,e,n);else for(;t!==null;){if(t.tag===3){Vu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(eu===null||!eu.has(r))){e=ai(n,e),n=Us(2),r=Ma(t,n,2),r!==null&&(Ws(n,r,t,e),Be(r,2),td(r));break}}t=t.return}}function Uu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Al;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(zl=!0,i.add(n),e=Wu.bind(null,e,t,n),t.then(e,e))}function Wu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ml===e&&(Pl&n)===n&&(Vl===4||Vl===3&&(Pl&62914560)===Pl&&300>ge()-Xl?!(jl&2)&&yu(e,0):Wl|=n,Kl===Pl&&(Kl=0)),td(e)}function Gu(e,t){t===0&&(t=Re()),e=Ur(e,t),e!==null&&(Be(e,t),td(e))}function Ku(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gu(e,n)}function qu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),Gu(e,n)}function Ju(e,t){return fe(e,t)}var Yu=null,Xu=null,Zu=!1,Qu=!1,$u=!1,ed=0;function td(e){e!==Xu&&e.next===null&&(Xu===null?Yu=Xu=e:Xu=Xu.next=e),Qu=!0,Zu||(Zu=!0,cd())}function nd(e,t){if(!$u&&Qu){$u=!0;do for(var n=!1,r=Yu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-De(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,sd(r,a))}else a=Pl,a=Fe(r,r===Ml?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ie(r,a)||(n=!0,sd(r,a))}r=r.next}while(n);$u=!1}}function rd(){id()}function id(){Qu=Zu=!1;var e=0;ed!==0&&Gd()&&(e=ed);for(var t=ge(),n=null,r=Yu;r!==null;){var i=r.next,a=ad(r,t);a===0?(r.next=null,n===null?Yu=i:n.next=i,i===null&&(Xu=n)):(n=r,(e!==0||a&3)&&(Qu=!0)),r=i}tu!==0&&tu!==5||nd(e,!1),ed!==0&&(ed=0)}function ad(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-De(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Le(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ml,n=Pl,n=Fe(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Fl===2||Fl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&pe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ie(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&pe(r),Ke(n)){case 2:case 8:n=ve;break;case 32:n=ye;break;case 268435456:n=xe;break;default:n=ye}return r=od.bind(null,e),n=fe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&pe(r),e.callbackPriority=2,e.callbackNode=null,2}function od(e,t){if(tu!==0&&tu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(zu()&&e.callbackNode!==n)return null;var r=Pl;return r=Fe(e,e===Ml?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(pu(e,r,t),ad(e,ge()),e.callbackNode!=null&&e.callbackNode===n?od.bind(null,e):null)}function sd(e,t){if(zu())return null;pu(e,t,!0)}function cd(){Yd(function(){jl&6?fe(q,rd):id()})}function ld(){if(ed===0){var e=ea;e===0&&(e=je,je<<=1,!(je&261888)&&(je=256)),ed=e}return ed}function ud(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Bt(``+e)}function dd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function fd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=ud((i[Ze]||null).action),o=r.submitter;o&&(t=(t=o[Ze]||null)?ud(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new ln(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ed!==0){var e=o?dd(i,o):new FormData(i);gs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?dd(i,o):new FormData(i),gs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var pd=0;pd<Fr.length;pd++){var md=Fr[pd];Ir(md.toLowerCase(),`on`+(md[0].toUpperCase()+md.slice(1)))}Ir(Dr,`onAnimationEnd`),Ir(Or,`onAnimationIteration`),Ir(kr,`onAnimationStart`),Ir(`dblclick`,`onDoubleClick`),Ir(`focusin`,`onFocus`),Ir(`focusout`,`onBlur`),Ir(Ar,`onTransitionRun`),Ir(jr,`onTransitionStart`),Ir(Mr,`onTransitionCancel`),Ir(Nr,`onTransitionEnd`),pt(`onMouseEnter`,[`mouseout`,`mouseover`]),pt(`onMouseLeave`,[`mouseout`,`mouseover`]),pt(`onPointerEnter`,[`pointerout`,`pointerover`]),pt(`onPointerLeave`,[`pointerout`,`pointerover`]),ft(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),ft(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),ft(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),ft(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),ft(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),ft(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var hd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),gd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(hd));function _d(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Lr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Lr(e)}i.currentTarget=null,a=c}}}}function vd(e,t){var n=t[$e];n===void 0&&(n=t[$e]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,ut.forEach(function(t){t!==`selectionchange`&&(gd.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!Zt||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Cd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=at(s),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=a=o;continue a}s=s.parentNode}}r=r.return}Jt(function(){var r=a,i=Ut(n),o=[];a:{var s=Pr.get(e);if(s!==void 0){var l=ln,u=e;switch(e){case`keypress`:if(rn(n)===0)break a;case`keydown`:case`keyup`:l=Dn;break;case`focusin`:u=`focus`,l=vn;break;case`focusout`:u=`blur`,l=vn;break;case`beforeblur`:case`afterblur`:l=vn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=gn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=_n;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=kn;break;case Dr:case Or:case kr:l=yn;break;case Nr:l=An;break;case`scroll`:case`scrollend`:l=dn;break;case`wheel`:l=jn;break;case`copy`:case`cut`:case`paste`:l=bn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=On;break;case`toggle`:case`beforetoggle`:l=Mn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=Yt(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(s=new l(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,s&&n!==Ht&&(u=n.relatedTarget||n.fromElement)&&(at(u)||u[Qe]))break a;if((l||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?at(u):null,u!==null&&(f=c(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=gn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=On,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?s:st(l),h=u==null?s:st(u),s=new d(g,m+`leave`,l,n,i),s.target=f,s.relatedTarget=h,g=null,at(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Ed,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Dd(o,s,l,d,!1),u!==null&&f!==null&&Dd(o,f,u,d,!0)}}a:{if(s=r?st(r):window,l=s.nodeName&&s.nodeName.toLowerCase(),l===`select`||l===`input`&&s.type===`file`)var v=Zn;else if(Gn(s)){if(Qn)v=sr;else{v=ar;var y=ir}}else l=s.nodeName,!l||l.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Lt(r.elementType)&&(v=Zn):v=or;if(v&&=v(e,r)){Kn(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&kt(s,`number`,s.value)}switch(y=r?st(r):window,e){case`focusin`:(Gn(y)||y.contentEditable===`true`)&&(_r=y,vr=r,yr=null);break;case`focusout`:yr=vr=_r=null;break;case`mousedown`:br=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:br=!1,xr(o,n,i);break;case`selectionchange`:if(gr)break;case`keydown`:case`keyup`:xr(o,n,i)}var b;if(Pn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Vn?zn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Ln&&n.locale!==`ko`&&(Vn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Vn&&(b=nn()):($t=i,en=`value`in $t?$t.value:$t.textContent,Vn=!0)),y=Td(r,x),0<y.length&&(x=new xn(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=Bn(n),b!==null&&(x.data=b)))),(b=In?Hn(e,n):Un(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new xn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),fd(o,e,r,n,i)}_d(o,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=Yt(e,n),i!=null&&r.unshift(wd(e,i,a)),i=Yt(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=Yt(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=Yt(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
|
|
10
|
-
`).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Nt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Nt(e,``+r);break;case`className`:yt(e,`class`,r);break;case`tabIndex`:yt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:yt(e,n,r);break;case`style`:It(e,r,a);break;case`data`:if(t!==`object`){yt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Bt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,i.name,i,null),Md(e,t,`formEncType`,i.formEncType,i,null),Md(e,t,`formMethod`,i.formMethod,i,null),Md(e,t,`formTarget`,i.formTarget,i,null)):(Md(e,t,`encType`,i.encType,i,null),Md(e,t,`method`,i.method,i,null),Md(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Bt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Vt);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Bt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:vd(`beforetoggle`,e),vd(`toggle`,e),vt(e,`popover`,r);break;case`xlinkActuate`:bt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:bt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:bt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:bt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:bt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:bt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:bt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:bt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:bt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:vt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Rt.get(n)||n,vt(e,n,r))}}function Nd(e,t,n,r,i,a){switch(n){case`style`:It(e,r,a);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Nt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Nt(e,``+r);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Vt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!dt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),a=e[Ze]||null,a=a==null?null:a[n],typeof a==`function`&&e.removeEventListener(t,a,i),typeof r==`function`)){typeof a!=`function`&&a!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):vt(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:vd(`error`,e),vd(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var s=n[a];if(s!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:Md(e,t,a,s,n,null)}}i&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:vd(`invalid`,e);var c=a=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(o(137,t));break;default:Md(e,t,r,d,n,null)}}Ot(e,a,c,l,u,s,i,!1);return;case`select`:for(i in vd(`invalid`,e),r=s=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Md(e,t,i,c,n,null)}t=a,n=s,e.multiple=!!r,t==null?n!=null&&At(e,!!r,n,!0):At(e,!!r,t,!1);return;case`textarea`:for(s in vd(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(o(91));break;default:Md(e,t,s,c,n,null)}Mt(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:vd(`beforetoggle`,e),vd(`toggle`,e),vd(`cancel`,e),vd(`close`,e);break;case`iframe`:case`object`:vd(`load`,e);break;case`video`:case`audio`:for(r=0;r<hd.length;r++)vd(hd[r],e);break;case`image`:vd(`error`,e),vd(`load`,e);break;case`details`:vd(`toggle`,e);break;case`embed`:case`source`:case`link`:vd(`error`,e),vd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:Md(e,t,u,r,n,null)}return;default:if(Lt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:a=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(o(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}Y(e,s,c,l,u,d,a,i);return;case`select`:for(a in m=s=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||Md(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:p=a;break;case`defaultValue`:c=a;break;case`multiple`:s=a;default:a!==l&&Md(e,t,i,a,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?At(e,!!n,n?[]:``,!1):At(e,!!n,t,!0)):At(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,i)}for(s in r)if(i=r[s],a=n[s],r.hasOwnProperty(s)&&(i!=null||a!=null))switch(s){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(o(91));break;default:i!==a&&Md(e,t,s,i,r,a)}jt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(o(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(Lt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e!==Wd&&(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[rt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body)}n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),it(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[rt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(o(452));return e;case`head`:if(e=t.head,!e)throw Error(o(453));return e;case`body`:if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);it(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=F.d;F.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=_u();return e||t}function yf(e){var t=ot(e);t!==null&&t.tag===5&&t.type===`form`?vs(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Dt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),lt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Dt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Dt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Dt(n.imageSizes)+`"]`)):i+=`[href="`+Dt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),lt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Dt(r)+`"][href="`+Dt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),lt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=ct(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);lt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=ct(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),lt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=ct(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),lt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=V.current)?gf(i):null;if(!i)throw Error(o(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=ct(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var a=ct(i).hoistableStyles,s=a.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,s),(a=i.querySelector(jf(e)))&&!a._p&&(s.instance=a,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),a||Nf(i,e,n,s.state))),t&&r===null)throw Error(o(528,``));return s}if(t&&r!==null)throw Error(o(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=ct(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Af(e){return`href="`+Dt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),lt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Dt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Dt(n.href)+`"]`);if(r)return t.instance=r,lt(r),r;var i=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),lt(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var a=e.querySelector(jf(i));if(a)return t.state.loading|=4,t.instance=a,lt(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),lt(a);var s=a;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(a,`link`,r),t.state.loading|=4,Lf(a,n.precedence,e),t.instance=a;case`script`:return a=Pf(n.src),(i=e.querySelector(Ff(a)))?(t.instance=i,lt(i),i):(r=n,(i=mf.get(a))&&(r=m({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),lt(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(o(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[rt]||a[Xe]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,lt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),lt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:S,Provider:null,Consumer:null,_currentValue:te,_currentValue2:te,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ze(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ze(0),this.hiddenUpdates=ze(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Yr(3,null,null,t),e.current=a,a.stateNode=e,t=Xi(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},ka(a),e}function tp(e){return e?(e=qr,e):qr}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=ja(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ma(e,r,t),n!==null&&(fu(n,e,t),Na(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Ur(e,67108864);t!==null&&fu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=uu();t=Ge(t);var n=Ur(e,t);n!==null&&fu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=2,up(e,t,n,r)}finally{F.p=a,P.T=i}}function lp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=8,up(e,t,n,r)}finally{F.p=a,P.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=ot(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Pe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-De(o);s.entanglements[1]|=c,o&=~c}td(a),!(jl&6)&&(Ql=ge()+500,nd(0,!1))}}break;case 31:case 13:s=Ur(a,2),s!==null&&fu(s,a,2),_u(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=Ut(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=at(e),e!==null){var t=c(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=l(t),e!==null)return e;e=null}else if(n===31){if(e=u(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(_e()){case q:return 2;case ve:return 8;case ye:case be:return 32;case xe:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ot(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=at(e.target);if(t!==null){var n=c(t);if(n!==null){if(t=n.tag,t===13){if(t=l(n),t!==null){e.blockedOn=t,Je(e.priority,function(){op(n)});return}}else if(t===31){if(t=u(n),t!==null){e.blockedOn=t,Je(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ht=r,n.target.dispatchEvent(r),Ht=null}else return t=ot(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=ot(n);a!==null&&(e.splice(t,3),t-=3,gs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[Ze]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Ze]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current;np(n,uu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),_u(),t[Qe]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=qe();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.8`)throw Error(o(527,Lp,`19.2.8`));F.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(o(188)):(e=Object.keys(e).join(`,`),Error(o(268,e)));return e=f(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:P,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{we=zp.inject(Rp),Te=zp}catch{}}e.createRoot=function(e,t){if(!s(e))throw Error(o(299));var n=!1,r=``,i=Ls,a=Rs,c=zs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,i,a,c,Pp),e[Qe]=t.current,xd(e),new Fp(t)}})),qr=t(((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=Kr()}));function Jr(e,t){if(e==null)return{enabled:t};if(typeof e==`boolean`)return{enabled:e};let n=e.enabled??t;if(e.visibleWhen==null&&e.disabledWhen==null)return{enabled:n};let r={};return e.visibleWhen!=null&&(r.visibleWhen=e.visibleWhen),e.disabledWhen!=null&&(r.disabledWhen=e.disabledWhen),{enabled:n,predicates:r}}function Yr(e){return Jr(e,!1).predicates}var Xr={create:`create`,import:`import`,edit:`update`,delete:`delete`,exportCsv:`export`};function Zr(e,t){let n=_n({managedBy:e?.managedBy??void 0,userActions:e?.userActions??void 0});if(Array.isArray(t)){let e=new Set(t);for(let[t,r]of Object.entries(Xr))n[t]&&!e.has(r)&&(n[t]=!1)}return n}function Qr(e,t){return Zr(e,t).edit}function $r(e){if(Array.isArray(e))return e;if(e&&typeof e==`object`){if(Array.isArray(e.data))return e.data;if(Array.isArray(e.value))return e.value}return[]}var ei=pt;function ti(e){return!!e&&typeof e==`object`&&ei.has(e.type)}var ni=Symbol.for(`objectui.objectSortability`);function ri(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e.sortable;if(typeof t!=`boolean`)return;let n=e.reason,r=e.caveat;return{sortable:t,...typeof n==`string`?{reason:n}:{},...typeof r==`string`?{caveat:r}:{}}}function ii(e){if(!e||typeof e!=`object`)return;let t=e[ni];if(!t||typeof t!=`object`)return;let n=t.fields;if(n&&typeof n==`object`&&!Array.isArray(n))return t}function ai(e,t){if(typeof t!=`string`||t.length===0)return!1;let n=e.fields?.[t];return ri(n)?.sortable===!0}var oi=new Set(`id._id.__v._version._rev.created.created_at.createdAt.created_by.createdBy.modified.modified_by.updated_at.updatedAt.updated_by.updatedBy.deleted.deleted_at.deletedAt.is_deleted.instance_state.locked.owner_id.organization_id.tenant_id.company_id.space`.split(`.`)),si={createdAt:`created_at`,createdBy:`created_by`,updatedAt:`updated_at`,updatedBy:`updated_by`};new Set(Object.values(si));function ci(e,t){return t?.system===!0||oi.has(e)}var li=`[{ field: 'name', order: 'desc' }]`,ui=new Set;function di(e,t){return`${e}\n${t}`}function fi(e){let t=di(`scalar`,e);ui.has(t)||(ui.add(t),console.error(`[object-ui] convertSortToQueryParams: the legacy string \`sort\` clause is retired (objectui#8221) and was REFUSED — received ${JSON.stringify(e)}, so this query carries no \`$orderby\`. Write the array form instead: sort: ${li} — both keys, on every entry. \`order\` is required: on \`SortConfig\`, on its zod counterpart, and on \`@objectstack/spec\`'s \`SortItemSchema\`, which refuses an entry without it. (A missing \`order\` is still read as \`'asc'\` here — that is a runtime tolerance, not permission to omit the key: metadata written that way is refused when it is published.) The array is the only spelling every \`sort\` input declares, and the only one \`@objectstack/spec\` accepts.`))}function pi(e){let t=di(`entry`,e);ui.has(t)||(ui.add(t),console.error(`[object-ui] convertSortToQueryParams: a \`sort\` ARRAY ENTRY is the retired string clause (objectui#8221) and was REFUSED — received ${JSON.stringify(e)} as an entry of the \`sort\` array, so that entry orders nothing (and if it was the only usable entry, this query carries no \`$orderby\` at all). The retirement is about the SPELLING, not the container: wrapping the clause in an array does not revive it. Write entry OBJECTS instead: sort: ${li} — both keys, on every entry. \`order\` is required: on \`SortConfig\`, on its zod counterpart, and on \`@objectstack/spec\`'s \`SortItemSchema\`, which refuses an entry without it. (A missing \`order\` is still read as \`'asc'\` here — that is a runtime tolerance, not permission to omit the key: metadata written that way is refused when it is published.) The array OF OBJECTS is the only spelling every \`sort\` input declares, and the only one \`@objectstack/spec\` accepts.`))}function mi(e){if(e){if(typeof e==`string`){fi(e);return}if(Array.isArray(e)){let t=[];for(let n of e){if(typeof n==`string`){let e=n;e!==``&&pi(e);continue}n&&typeof n.field==`string`&&n.field!==``&&t.push({field:n.field,order:n.order===`desc`?`desc`:`asc`})}return t.length>0?t:void 0}}}function hi(e){let t=mi(e);if(!t)return;let n={};for(let e of t)n[e.field]=e.order;return n}var gi=/\$\{event\.([a-zA-Z0-9_]+)\}/g;function _i(e,t){return typeof e!=`string`||e.indexOf("${event.")===-1?e:e.replace(gi,(e,n)=>{let r=t[n];return r==null?``:String(r)})}function vi(e,t){if(typeof e==`string`){let n=e.match(/^\$\{event\.([a-zA-Z0-9_]+)\}$/);if(n){let e=t[n[1]];return e===``||e===void 0?null:e}return _i(e,t)}if(Array.isArray(e))return e.map(e=>vi(e,t));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))n[r]=vi(i,t);return n}return e}function yi(e,t,n={}){if(e?.filter)return vi(e.filter,t);let r={},{rowField:i,columnField:a,groupByField:o}=n,s=t.scope??`cell`;return s===`total`?r:((s===`cell`||s===`row`)&&i&&`rowKey`in t&&(r[i]=t.rowKey===``?null:t.rowKey),(s===`cell`||s===`column`)&&a&&`colKey`in t&&(r[a]=t.colKey===``?null:t.colKey),o&&`category`in t&&(r[o]=t.category===``?null:t.category),r)}function bi(e,t,n=`Details`){if(e?.title){let n=_i(e.title,t).trim();if(n)return n}let r=[];return t.rowLabel&&r.push(t.rowLabel),t.colLabel&&r.push(t.colLabel),t.categoryLabel?r.push(t.categoryLabel):t.category&&r.push(t.category),t.series&&r.push(t.series),r.length>0?r.join(` × `):n}function xi(e){return e?e.enabled!==!1:!1}function Si(e,t){let n=nt(e,t);try{return xn(n)}catch(e){throw e?.code===`INVALID_FILTER`?new kt(e.message):e}}var Ci={current_week_start:`last_week_start`,current_week_end:`last_week_end`,current_month_start:`last_month_start`,current_month_end:`last_month_end`,current_quarter_start:`last_quarter_start`,current_quarter_end:`last_quarter_end`,current_year_start:`last_year_start`,current_year_end:`last_year_end`,week_start:`last_week_start`,week_end:`last_week_end`,month_start:`last_month_start`,month_end:`last_month_end`,quarter_start:`last_quarter_start`,quarter_end:`last_quarter_end`,year_start:`last_year_start`,year_end:`last_year_end`,today:`yesterday`};function wi(e,t){if(e==null)return e;if(typeof e==`string`)return e.replace(/\$?\{([a-zA-Z0-9_]+)\}/g,(e,n)=>{let r=t[n];return r?`{${r}}`:e});if(Array.isArray(e))return e.map(e=>wi(e,t));if(typeof e==`object`){let n={};for(let r of Object.keys(e))n[r]=wi(e[r],t);return n}return e}function Ti(e,t,n=new Date){if(t.kind===`previousYear`){let t=new Date(n.getFullYear()-1,n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds());return wt(e,t)}let r=wi(e,Ci);return wt(r,n)}function Ei(e,t){if(e.kind===`previousYear`)return`vsLastYear`;let n=t?JSON.stringify(t):``;return/current_year_|year_start|year_end/.test(n)?`vsLastYear`:/current_quarter_|quarter_start|quarter_end/.test(n)?`vsLastQuarter`:/current_month_|month_start|month_end/.test(n)?`vsLastMonth`:/current_week_|week_start|week_end/.test(n)?`vsLastWeek`:/\btoday\b/.test(n)?`vsYesterday`:`vsPreviousPeriod`}var Di=e=>e==null?null:String(e),Oi=e=>JSON.stringify(e),ki=[`count`,`sum`,`avg`,`min`,`max`,`count_distinct`];function Ai(e){return typeof e==`string`&&ki.includes(e)}function ji(e,t){let n=e.builtinAggregate;if(Ai(n)){let e=t?.[n];if(typeof e==`string`&&e!==``)return e}return e.label??e.name}function Mi(e){return Oi([Di(e)])}var Ni=`__bucketId`;function Pi(e){if(!e||typeof e!=`object`)return;let t=e[Ni];return typeof t==`string`&&t!==``?t:void 0}function Fi(e,t){return Ii(e,t)&&e[t]==null}function Ii(e,t){return!!e&&typeof e==`object`&&t in e}function Li(e){return e==null?``:String(e)}function Ri(e){let t=new Map;for(let{id:n,display:r}of e){let e=t.get(r);e||t.set(r,e=new Set),e.add(n)}let n=new Set;for(let[e,r]of t)r.size>1&&n.add(e);return n}function zi(e,t,n){let r=e=>Fi(e,t)?n:e[t],i=Ri(e.filter(e=>Ii(e,t)).map(e=>({id:Mi(e[t]),display:Li(r(e))}))),a=!1,o=e.map(e=>{if(!Ii(e,t))return e;let o=Fi(e,t),s=i.has(Li(r(e)));return!o&&!s?e:(a=!0,{...e,...o?{[t]:n}:{},...s?{[Ni]:Mi(e[t])}:{}})});return a?o:e}function Bi(e,t,n,r){let i=new Map;for(let r of e){if(!Ii(r,t))continue;let e=Mi(r[t]);i.has(e)||i.set(e,{id:e,label:Fi(r,t)?n:String(r[t])})}let a=Array.from(i.values()),o=Ri(a.map(({id:e,label:t})=>({id:e,display:t}))),s=new Set([r,Ni]),c=new Set(a.map(({id:e})=>e));return a.map(({id:e,label:t})=>({id:e,label:t,dataKey:o.has(t)||s.has(t)||c.has(t)?e:t}))}function Vi(e,t,n,r,i){let a=(t??[]).filter(Boolean),o=(n??[]).filter(Boolean),s=Array.isArray(e)?e:[],c=e=>{let t=(r??[]).find(t=>t.name===e);return t?ji(t,i?.builtinAggregateLabels):e};if(a.length>=2&&o.length===1){let e=a[0],t=a[1],n=o[0],r=i?.nullCategoryLabel??`(None)`,c=Bi(s,t,r,e),l=new Map(c.map(({id:e,dataKey:t})=>[e,t])),u=new Map;for(let i of s){let a=i[e],o=Mi(a),s=u.get(o);s||u.set(o,s={}),Ii(i,e)&&!Ii(s,e)&&(s[e]=Fi(i,e)?r:a);let c=Ii(i,t)?l.get(Mi(i[t])):void 0;c!==void 0&&(s[c]=i[n])}let d=Ri(Array.from(u.entries()).map(([t,n])=>({id:t,display:Li(n[e])})));return{data:Array.from(u.entries()).map(([t,n])=>d.has(Li(n[e]))?{...n,[Ni]:t}:n),xAxisKey:e,series:c.map(({dataKey:e,label:t})=>({dataKey:e,label:t}))}}let l=a[0];return{data:l?zi(s,l,i?.nullCategoryLabel??`(None)`):s,xAxisKey:l,series:o.map(e=>({dataKey:e,label:c(e)}))}}function Hi(e,t){let n=Array.isArray(e)?e:[];if(!t)return n;let r=Object.keys(t).filter(e=>t[e]&&Object.keys(t[e]).length>0);return r.length===0?n:n.map(e=>{let n=null;for(let i of r){let r=e[i];if(r==null)continue;let a=t[i][String(r)];a!=null&&a!==r&&(n||={...e},n[i]=a)}return n??e})}function Ui(e){if(!Array.isArray(e)||e.length===0)return null;let t={};for(let n of e)if(n&&typeof n==`object`){let e=n;typeof e.color==`string`&&e.color&&(e.value!=null&&(t[String(e.value)]=e.color),e.label!=null&&(t[String(e.label)]=e.color))}return Object.keys(t).length>0?t:null}function Wi(e){if(!Array.isArray(e)||e.length===0)return null;let t=new Map;return e.forEach((e,n)=>{t.has(e)||t.set(e,n)}),t.size>0?t:null}function Gi(e){if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return{value:String(e),label:String(e)};if(e&&typeof e==`object`){let t=e;if(t.value!=null&&t.label!=null)return{value:String(t.value),label:String(t.label)}}return null}function Ki(e,t){if(!t||!Array.isArray(e)||e.length===0)return e;let n=!1,r=e.map(e=>{let r=Gi(e);if(!r)return e;let i=t(r.value,r.label);return i===r.label?e:(n=!0,e&&typeof e==`object`?{...e,label:i}:{value:r.value,label:i})});return n?r:e}function qi(e,t){if(!Array.isArray(e)||e.length===0)return null;let n={},r={};for(let i of e){let e=Gi(i);if(!e)continue;let a=t?t(e.value,e.label):e.label;a!==e.value&&(n[e.value]=a),a!==e.label&&(r[e.label]=a)}let i={...r,...n};return Object.keys(i).length>0?i:null}var Ji=new Set([`lookup`,`master_detail`,`masterdetail`,`master-detail`]);function Yi(e){let t=e?.fields;return t&&typeof t==`object`&&!Array.isArray(t)?t:null}function Xi(e){if(!e||typeof e!=`object`)return;let t=e,n=typeof t.type==`string`?t.type.toLowerCase():``;if(!Ji.has(n))return;let r=t.reference;return typeof r==`string`&&r?r:void 0}async function Zi(e,t,n){let r={},i=Array.from(new Set((t??[]).filter(e=>!!e)));if(i.length===0)return r;let a=new Map,o=e?.name;typeof o==`string`&&o&&a.set(o,Promise.resolve(e));let s=e=>{let t=a.get(e);return t||(t=Promise.resolve().then(()=>n(e)).catch(()=>null),a.set(e,t)),t};for(let t of i){let n=t.split(`.`),i=e,a=typeof o==`string`&&o?o:void 0,c=!0;for(let e=0;e<n.length-1;e+=1){let t=Xi(Yi(i)?.[n[e]]);if(!t){c=!1;break}if(i=await s(t),!i){c=!1;break}let r=i.name;a=typeof r==`string`&&r?r:t}if(!c)continue;let l=n[n.length-1],u=Yi(i)?.[l];u?.options!==void 0&&(r[t]={object:a,field:l,options:u.options})}return r}function Qi(e,t){let n=e?.object;if(!n||!t)return;let r=e.field;return(e,i)=>t(n,r,e,i)}function $i(e,t,n){if(!e||!t||t.length===0)return null;let r={};for(let{dim:i,path:a}of t){let t=e[a],o=qi(t?.options,Qi(t,n));o&&(r[i]=o)}return Object.keys(r).length>0?r:null}async function ea(e,t,n){return Zi(await e(t),n,e)}function ta(e,t){return pn(e)??t}function na(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function ra(e,t,n){let r=e.function,i={function:r,alias:ta(e,r||`count`)};return r!==`count`&&e.field&&(i.field=e.field),{groupBy:[t],aggregations:[i],where:n}}var ia=new Set([`pie`,`donut`,`funnel`,`scatter`]);function aa(e){return typeof e==`string`&&ia.has(e)}function oa(e,t){if(t===`fraction`)return e*100;if(t===`whole`)return e;throw TypeError(`percentDisplayValue: percentScale must be 'fraction' or 'whole' (the spec's PercentScale), got ${String(t)}`)}function sa(e,t,n,r){if(!t?.isLoaded||!n||!e||typeof e!=`object`)return e;let i={},a=!1;for(let[o,s]of Object.entries(e))o===`id`||o===`_id`||r?.includes(o)||t.checkField(n,o,`read`)?i[o]=s:a=!0;return a?i:e}var ca=new Set([`id`,`created_at`,`created_by`,`updated_at`,`updated_by`,`owner_id`,`organization_id`,`owning_business_unit_id`]),la=/\b(?:record|data)\.([A-Za-z_][A-Za-z0-9_]*)/g,ua=/^[A-Za-z_][A-Za-z0-9_]*$/,da=/\{([a-z_][a-z0-9_]*)\}/gi;function fa(e){if(!e||typeof e!=`object`)return;let t=e;if(t.defaultFromRow)return t.field??t.name}function pa(e){let t=[];for(let n of[e.patch,e.bodyExtra])n&&typeof n==`object`&&!Array.isArray(n)&&t.push(...Object.keys(n));if(Array.isArray(e.params))for(let n of e.params){if(!n||typeof n!=`object`)continue;let e=n;t.push(e.name??e.field)}return t.filter(e=>e!==`recordId`)}function ma(e){if(typeof e==`string`)return e.trim()||null;if(e&&typeof e==`object`){let t=e.source;if(typeof t==`string`)return t.trim()||null}return null}function ha(e){let t=[],n=new Set;for(let r of e){let e=ma(r);if(e){la.lastIndex=0;for(let r=la.exec(e);r;r=la.exec(e)){let e=r[1];n.has(e)||(n.add(e),t.push(e))}}}return t}function ga(e){let t=[];for(let n of e.conditionalFormatting??[]){if(!n||typeof n!=`object`)continue;let e=n;t.push(e.condition,e.expression),typeof e.field==`string`&&e.field&&t.push(`record.${e.field}`)}for(let n of[e.rowActionDefs,e.bulkActionDefs,e.objectActions])for(let e of n??[]){if(!e||typeof e!=`object`)continue;let n=e;if(t.push(n.visible,n.disabled),typeof n.recordIdField==`string`&&ua.test(n.recordIdField)&&t.push(`record.${n.recordIdField}`),Array.isArray(n.params))for(let e of n.params){let n=fa(e);typeof n==`string`&&ua.test(n)&&t.push(`record.${n}`)}if(typeof n.target==`string`){da.lastIndex=0;for(let e=da.exec(n.target);e;e=da.exec(n.target))t.push(`record.${e[1]}`)}if(n.undoable)for(let e of pa(n))typeof e==`string`&&ua.test(e)&&t.push(`record.${e}`)}for(let n of Object.values(e.userActions??{})){if(!n||typeof n!=`object`)continue;let e=n;t.push(e.visibleWhen,e.disabledWhen)}return t}function _a(e){return e.replace(/[_-]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function va(e){return{count:e(`report.aggregate.count`,`Count`),count_distinct:e(`report.aggregate.countDistinct`,`Distinct Count`),sum:e(`report.aggregate.sum`,`Sum`),avg:e(`report.aggregate.avg`,`Average`),min:e(`report.aggregate.min`,`Min`),max:e(`report.aggregate.max`,`Max`)}}function ya(e,t){let n=e?.currencyConfig;return e?.currency||(n?.currencyMode===`fixed`?n.defaultCurrency:void 0)||e?.defaultCurrency||t||void 0}var ba=n({__iconData:()=>xa,default:()=>Sa}),xa={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};xa.node;var Sa=Vn(xa),Ca=n({__iconData:()=>wa,default:()=>Ta}),wa={name:`arrow-right-left`,size:24,node:[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]};wa.node;var Ta=Vn(wa),Ea=n({__iconData:()=>Da,default:()=>Oa}),Da={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};Da.node;var Oa=Vn(Da),ka=n({__iconData:()=>Aa,default:()=>ja}),Aa={name:`at-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]};Aa.node;var ja=Vn(Aa),Ma=n({__iconData:()=>Na,default:()=>Pa}),Na={name:`badge-check`,size:24,node:[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`verified`]};Na.node;var Pa=Vn(Na),Fa=n({__iconData:()=>Ia,default:()=>La}),Ia={name:`bell-off`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]};Ia.node;var La=Vn(Ia),Ra=n({__iconData:()=>za,default:()=>Ba}),za={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`}]]};za.node;var Ba=Vn(za),Va=n({__iconData:()=>Ha,default:()=>Ua}),Ha={name:`bold`,size:24,node:[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]};Ha.node;var Ua=Vn(Ha),Wa=n({__iconData:()=>Ga,default:()=>Ka}),Ga={name:`circle-plus`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]],aliases:[`plus-circle`]};Ga.node;var Ka=Vn(Ga),qa=n({__iconData:()=>Ja,default:()=>Ya}),Ja={name:`circle-question-mark`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`help-circle`,`circle-help`]};Ja.node;var Ya=Vn(Ja),Xa=n({__iconData:()=>Za,default:()=>Qa}),Za={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};Za.node;var Qa=Vn(Za),$a=n({__iconData:()=>eo,default:()=>to}),eo={name:`code`,size:24,node:[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]};eo.node;var to=Vn(eo),no=n({__iconData:()=>ro,default:()=>io}),ro={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`}]]};ro.node;var io=Vn(ro),ao=n({__iconData:()=>oo,default:()=>so}),oo={name:`face-slightly-smiling-plus`,size:24,node:[[`path`,{d:`M13.267 2.08a10 10 0 108.653 8.653`,key:`1wbpyh`}],[`path`,{d:`M15 10V9`,key:`4dkmfx`}],[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M16.472 15a6 6 0 01-8.943 0`,key:`7qomzy`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M9 10V9`,key:`1lazqi`}]],aliases:[`smile-plus`]};oo.node;var so=Vn(oo),co=n({__iconData:()=>lo,default:()=>uo}),lo={name:`file-archive`,size:24,node:[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]};lo.node;var uo=Vn(lo),fo=n({__iconData:()=>po,default:()=>mo}),po={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`}]]};po.node;var mo=Vn(po),ho=n({__iconData:()=>go,default:()=>_o}),go={name:`italic`,size:24,node:[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]};go.node;var _o=Vn(go),vo=n({__iconData:()=>yo,default:()=>bo}),yo={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`}]]};yo.node;var bo=Vn(yo),xo=n({__iconData:()=>So,default:()=>Co}),So={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`}]]};So.node;var Co=Vn(So),wo=n({__iconData:()=>To,default:()=>Eo}),To={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`}]]};To.node;var Eo=Vn(To),Do=n({__iconData:()=>Oo,default:()=>ko}),Oo={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Oo.node;var ko=Vn(Oo),Ao=n({__iconData:()=>jo,default:()=>Mo}),jo={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`}]]};jo.node;var Mo=Vn(jo),No=n({__iconData:()=>Po,default:()=>Fo}),Po={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`}]]};Po.node;var Fo=Vn(Po),Io=n({__iconData:()=>Lo,default:()=>Ro}),Lo={name:`panel-right-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]};Lo.node;var Ro=Vn(Lo),zo=n({__iconData:()=>Bo,default:()=>Vo}),Bo={name:`panel-right-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]};Bo.node;var Vo=Vn(Bo),Ho=n({__iconData:()=>Uo,default:()=>Wo}),Uo={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};Uo.node;var Wo=Vn(Uo),Go=n({__iconData:()=>Ko,default:()=>qo}),Ko={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`}]]};Ko.node;var qo=Vn(Ko),Jo=n({__iconData:()=>Yo,default:()=>Xo}),Yo={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`}]]};Yo.node;var Xo=Vn(Yo),Zo=n({__iconData:()=>Qo,default:()=>$o}),Qo={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`}]]};Qo.node;var $o=Vn(Qo),es=n({__iconData:()=>ts,default:()=>ns}),ts={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};ts.node;var ns=Vn(ts),rs=n({__iconData:()=>is,default:()=>as}),is={name:`share-2`,size:24,node:[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]};is.node;var as=Vn(is),os=n({__iconData:()=>ss,default:()=>cs}),ss={name:`square-check-big`,size:24,node:[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]],aliases:[`check-square`]};ss.node;var cs=Vn(ss),ls=n({__iconData:()=>us,default:()=>ds}),us={name:`sticky-note`,size:24,node:[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]};us.node;var ds=Vn(us),fs=n({__iconData:()=>ps,default:()=>ms}),ps={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`}]]};ps.node;var ms=Vn(ps),hs=n({__iconData:()=>gs,default:()=>_s}),gs={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`}]]};gs.node;var _s=Vn(gs),vs=e(qr(),1),Q=a(),$=e(r(),1),ys=(0,$.createContext)(null);ys.displayName=`PermissionContext`;var bs=Object.freeze([]),xs=Object.freeze({check:()=>({allowed:!0}),checkField:()=>!0,getFieldPermissions:()=>[],getRowFilter:()=>void 0,getObjectApiOperations:()=>void 0,roles:bs,userId:null,systemPermissions:void 0,hasCapabilities:()=>!0,isLoaded:!1,can:()=>!0,cannot:()=>!1}),Ss=new WeakMap;function Cs(e){let t=Ss.get(e);if(t)return t;let n={...e,can:(t,n)=>e.check(t,n).allowed,cannot:(t,n)=>!e.check(t,n).allowed};return Ss.set(e,n),n}function ws(){let e=(0,$.useContext)(ys);return e?Cs(e):xs}function Ts(e){let{checkField:t,getFieldPermissions:n}=ws(),r=(0,$.useMemo)(()=>n(e),[n,e]);return(0,$.useMemo)(()=>({permissions:r,canRead:n=>t(e,n,`read`),canWrite:n=>t(e,n,`write`),readableFields:n=>n.filter(n=>t(e,n,`read`)),writableFields:n=>n.filter(n=>t(e,n,`write`))}),[r,t,e])}function Es(e){let t=({schema:t,field:n,...r})=>(0,Q.jsx)(e,{...r,field:n??t});return t.displayName=`FieldCarrier(${e.displayName||e.name||`Component`})`,t}function Ds(e){return e.postalCode??e.zipCode}function Os(e){return e==null?``:String(e).trim()}var ks=new Set([`zh`,`ja`,`ko`]);function As(e){return(e||``).split(/[-_]/)[0].toLowerCase()}function js(e,t){let n=Os(e.street),r=Os(e.city),i=Os(e.state),a=Os(Ds(e)),o=Os(e.country);return ks.has(As(t))?[o,[a,i].filter(Boolean).join(` `),r,n].filter(Boolean).join(`, `):[n,r,[i,a].filter(Boolean).join(` `),o].filter(Boolean).join(`, `)}function Ms(e,t,n){let r=ge({type:t.type,scale:`scale`in t?t.scale:void 0}),i=`useGrouping`in t&&typeof t.useGrouping==`boolean`?t.useGrouping:void 0;return oe(e,{locale:n,scale:r,useGrouping:i,...r===void 0?{minimumFractionDigits:0,maximumFractionDigits:20}:{minimumFractionDigits:r,maximumFractionDigits:r}})}function Ns(e){return e?Or(e):2}function Ps(e,t,n){let r=Ns(t);try{return oe(e,{locale:n,...t?{currency:t}:{},minimumFractionDigits:r,maximumFractionDigits:r})}catch{return t?`${t} ${e.toFixed(r)}`:e.toFixed(r)}}function Fs(e){if(e?.type===`progress`)return`whole`;let t=typeof e?.max==`number`?e.max:void 0;return Je({type:`percent`,max:t})}function Is(e,t,n){try{return oe(e,{locale:n,style:`percentPoints`,minimumFractionDigits:t,maximumFractionDigits:t})}catch{return`${e.toFixed(t)}%`}}function Ls({images:e,index:t,open:n,onOpenChange:r,onIndexChange:i}){let{t:a}=In(),o=e.length,s=e[t],c=$.useCallback(e=>{if(o<=1)return;let n=(t+e+o)%o;i?.(n)},[o,t,i]),l=$.useCallback(e=>{e.key===`ArrowRight`?(e.preventDefault(),c(1)):e.key===`ArrowLeft`&&(e.preventDefault(),c(-1))},[c]);return s?(0,Q.jsx)(nn,{open:n,onOpenChange:r,children:(0,Q.jsxs)(It,{className:`max-w-[92vw] sm:max-w-4xl p-0 bg-transparent border-0 shadow-none`,onKeyDown:l,children:[(0,Q.jsx)(Bt,{className:`sr-only`,children:s.name||a(`fields.image.preview`)}),(0,Q.jsxs)(`div`,{className:`relative flex items-center justify-center`,children:[(0,Q.jsx)(`img`,{src:s.url,alt:s.name||a(`fields.image.imageAlt`,{index:t+1}),className:`max-h-[85vh] max-w-full rounded-md object-contain`}),o>1&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>c(-1),"aria-label":a(`fields.image.previous`),className:`absolute left-2 top-1/2 -translate-y-1/2 flex size-9 items-center justify-center rounded-full bg-black/50 text-white hover:bg-black/70 transition-colors`,children:(0,Q.jsx)(Qn,{className:`size-5`})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>c(1),"aria-label":a(`fields.image.next`),className:`absolute right-2 top-1/2 -translate-y-1/2 flex size-9 items-center justify-center rounded-full bg-black/50 text-white hover:bg-black/70 transition-colors`,children:(0,Q.jsx)($n,{className:`size-5`})}),(0,Q.jsx)(`div`,{className:`absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-black/50 px-2.5 py-1 text-xs font-medium text-white`,children:a(`fields.image.counter`,{current:t+1,total:o})})]})]})]})}):null}function Rs({view:e,fallback:t,className:n,icon:r=!0}){let i=e.url?.trim();if(!i)return(0,Q.jsx)(Q.Fragment,{children:t});let a=e.name;return(0,Q.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,title:a,onClick:e=>e.stopPropagation(),"data-slot":`file-download-link`,className:U(`inline-flex min-w-0 max-w-full items-center gap-1 align-middle text-blue-600 hover:text-blue-800 hover:underline`,n),children:[r&&(0,Q.jsx)(cr,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:a})]})}function zs(e){if(e==null||typeof e==`number`||typeof e==`boolean`||typeof e==`string`)return e;if(e instanceof Date)return e.toISOString();if(Array.isArray(e))return e.map(e=>{if(typeof e==`object`&&e){let t=e;return String(t.name||t.label||t.externalId||t.id||t._id||`[Object]`)}return String(e)}).join(`, `);if(typeof e==`object`){let t=e;return`$numberDecimal`in t?Number(t.$numberDecimal):`$oid`in t?String(t.$oid):`$date`in t?String(t.$date):String(t.name||t.label||t.externalId||t.id||t._id||`[Object]`)}return String(e)}var Bs=$.lazy(()=>X(()=>import(`./MarkdownContent-DHtoj-cP.js`),[]));function Vs(e){let t=zs(e);if(t!=null&&t!==``)return String(t)}function Hs({value:e}){let t=Vs(e);return t===void 0?(0,Q.jsx)(Y,{}):(0,Q.jsx)($.Suspense,{fallback:(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.slice(0,80)}),children:(0,Q.jsx)(Bs,{value:t})})}function Us(e){return e.replace(/<\s*(script|style|iframe|object|embed)[^>]*>[\s\S]*?<\s*\/\s*\1\s*>/gi,``).replace(/\son\w+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,``).replace(/(href|src)\s*=\s*("javascript:[^"]*"|'javascript:[^']*')/gi,`$1="#"`)}function Ws({value:e}){let t=Vs(e);return t===void 0?(0,Q.jsx)(Y,{}):(0,Q.jsx)(`div`,{className:`prose prose-sm max-w-none dark:prose-invert break-words`,dangerouslySetInnerHTML:{__html:Us(t)}})}var Gs={markdown:Hs,html:Ws,richtext:Ws};Object.keys(Gs);function Ks(e){let t=qs(e);if(t)return t===Hs?`markdown`:`html`}function qs(e){return Gs[e]}var Js;function Ys(e){Js=e}function Xs(){return Js}var Zs={select:`field:multiselect`},Qs=`field:`;function $s(e,t){return t?.multiple&&Zs[e]?Zs[e]:{text:`field:text`,textarea:`field:textarea`,markdown:`field:markdown`,html:`field:html`,richtext:`field:richtext`,secret:`field:password`,number:`field:number`,currency:`field:currency`,percent:`field:percent`,slider:`field:slider`,progress:`field:slider`,rating:`field:rating`,date:`field:date`,datetime:`field:datetime`,time:`field:time`,boolean:`field:boolean`,toggle:`field:boolean`,select:`field:select`,multiselect:`field:multiselect`,radio:`field:radio`,checkboxes:`field:checkboxes`,tags:`field:tags`,lookup:`field:lookup`,master_detail:`field:master_detail`,tree:`field:lookup`,user:`field:user`,email:`field:email`,phone:`field:phone`,url:`field:url`,file:`field:file`,image:`field:image`,avatar:`field:avatar`,video:`field:file`,audio:`field:file`,signature:`field:signature`,password:`field:password`,location:`field:location`,geolocation:`field:geolocation`,address:`field:address`,color:`field:color`,code:`field:code`,json:`field:object`,qrcode:`field:qrcode`,vector:`field:vector`,object:`field:object`,composite:`field:object`,record:`field:object`,repeater:`field:grid`,formula:`field:formula`,summary:`field:summary`,autonumber:`field:auto_number`,auto_number:`field:auto_number`}[e]||(Ne(e)?`${Qs}${e}`:`field:text`)}var ec=[`error`,`onUploadingChange`,`dataSource`,`dependentValues`,`dependsOn`,`dependsOnLabels`,`emptyHint`,`onSelectRecord`,`onCreateNew`];function tc(e){let t=new Set(ec),n={};for(let r of Object.keys(e))t.has(r)&&(n[r]=e[r]);return n}var nc=n({TextField:()=>rc});function rc({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let s=n;if(r)return(0,Q.jsx)(`span`,{className:`text-sm`,children:e||(0,Q.jsx)(Y,{})});let c=s?.rows,l=Z(a),u=s?.maxLength;return c&&c>1?(0,Q.jsx)(Re,{...l,value:e||``,onChange:e=>t(e.target.value),placeholder:s?.placeholder,maxLength:u,disabled:r||l.disabled,"aria-invalid":!!i}):(0,Q.jsx)(o,{...l,type:s?.type===`password`?`password`:`text`,value:e||``,onChange:e=>t(e.target.value),placeholder:s?.placeholder,maxLength:u,disabled:r||l.disabled,"aria-invalid":!!i})}function ic(e){return(0,Q.jsx)(Vt,{...e})}var ac=n({TextAreaField:()=>oc});function oc({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=n,s=o?.maxLength,c=(0,$.useId)(),l=`${c}-charcount`,u=`${c}-fullscreen-charcount`;if(r)return(0,Q.jsx)(`div`,{className:`text-sm whitespace-pre-wrap`,children:e||(0,Q.jsx)(Y,{})});let d=o?.rows||4,f=!!o?.mobile_fullscreen,p=Z(a),m=!!p.disabled,h=[p[`aria-describedby`],s?l:void 0].filter(Boolean).join(` `)||void 0;return(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(Re,{...p,value:e||``,onChange:e=>t(e.target.value),placeholder:o?.placeholder,disabled:r||m,rows:d,maxLength:s,"aria-invalid":!!i,"aria-describedby":h,className:p.className}),s&&(0,Q.jsx)(st,{length:(e||``).length,maxLength:s,descriptionId:l,announceNearLimit:!0,className:`absolute bottom-2 right-2 text-xs text-gray-400`,testId:`textarea-character-count`}),f&&(0,Q.jsx)(ic,{value:e??``,onCommit:t,label:o?.label,testIdPrefix:`textarea`,disabled:m,error:i,footer:e=>s?(0,Q.jsx)(st,{length:e.length,maxLength:s,descriptionId:u,announceNearLimit:!1,className:`text-xs text-muted-foreground self-center`,testId:`textarea-fullscreen-character-count`}):null,children:(e,t,n,r)=>(0,Q.jsx)(Re,{autoFocus:!0,value:e,onChange:e=>t(e.target.value),disabled:n,maxLength:s,placeholder:o?.placeholder,...r,"aria-describedby":s?u:void 0,className:`h-full min-h-full resize-none text-base`,"data-testid":`textarea-fullscreen-input`})})]})}function sc(e,t){return e(`fields.number.badInput`,{example:t})}function cc(e){let[t,n]=(0,$.useState)(null),{t:r}=zr();return{refusal:t,readBadInput:(0,$.useCallback)(t=>{let i=t?.validity?.badInput===!0;return n(i?sc(r,e):null),i},[e,r])}}function lc({refusal:e}){return e?(0,Q.jsx)(`p`,{className:`text-xs text-red-500`,children:e}):null}var uc=`border-red-500 focus-visible:ring-red-500`,dc=n({NumberField:()=>fc});function fc({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let{refusal:s,readBadInput:c}=cc(`1234`),l=zn();if(r)return e==null?(0,Q.jsx)(Y,{}):(0,Q.jsx)(`span`,{className:`text-sm`,children:typeof e==`number`?Ms(e,n,l):e});let u=n,d=u?.scale,f=typeof u?.step==`number`?u.step:typeof d==`number`?10**-d:`any`,p=Z(a),m=e=>{c(e.target),p.onBlur?.(e)};return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(o,{...p,type:`number`,value:e??``,onChange:e=>{c(e.target);let n=e.target.value;t(n===``?null:Number(n))},onBlur:m,placeholder:u?.placeholder,disabled:r||p.disabled,className:U(s?uc:``,p.className),min:typeof u?.min==`number`?u.min:void 0,max:typeof u?.max==`number`?u.max:void 0,step:f,"aria-invalid":!!i||!!s}),(0,Q.jsx)(lc,{refusal:s})]})}var pc=n({CurrencyField:()=>mc});function mc({value:e,onChange:t,field:n,readonly:r,error:i,className:a,...s}){let c=n,{currency:l}=Fn(),u=zn(),d=ya(c,l),f=Ns(d),{refusal:p,readBadInput:m}=cc(`1234.56`);if(r)return e==null?(0,Q.jsx)(Y,{}):(0,Q.jsx)(`span`,{className:`text-sm font-medium tabular-nums`,children:Ps(Number(e),d,u)});let h=Z(s),g=e=>{m(e.target);let n=parseFloat(e.target.value);isNaN(n)||t(parseFloat(n.toFixed(f))),h.onBlur?.(e)},_=d?Dr(d,u):``;return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[_&&(0,Q.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500`,children:_}),(0,Q.jsx)(o,{...h,type:`number`,value:e??``,onChange:e=>{m(e.target),t(e.target.value===``?null:parseFloat(e.target.value))},onBlur:g,placeholder:c?.placeholder||`0.00`,disabled:r||s.disabled,className:U(_?`pl-8`:``,p?uc:``,a),min:typeof c?.min==`number`?c.min:void 0,max:typeof c?.max==`number`?c.max:void 0,step:(10**-f).toFixed(f),"aria-invalid":!!i||!!p})]}),(0,Q.jsx)(lc,{refusal:p})]})}var hc=n({PercentField:()=>_c}),gc=e=>{if(!Number.isFinite(e))return e;let[t,n]=String(e).split(`e`);return Number(`${t}e${n?Number(n)-2:-2}`)};function _c({value:e,onChange:t,field:n,readonly:r,error:i,className:a,...s}){let c=n,u=ge({type:`percent`,scale:c?.scale}),{refusal:d,readBadInput:f}=cc(`12.5`),p=zn(),m=typeof c?.max==`number`?c.max:void 0,h=Je({type:`percent`,max:m})===`whole`,g=e=>h?e:e*100,_=e=>h?e:gc(e),v=h?m:100;if(r)return e==null?(0,Q.jsx)(Y,{}):(0,Q.jsx)(`span`,{className:`text-sm font-medium tabular-nums`,children:Is(g(e),u,p)});let y=e==null?``:g(e),b=e==null?0:g(e),x=e=>{if(f(e.target),e.target.value===``){t(null);return}let n=parseFloat(e.target.value);t(isNaN(n)?null:_(n))},S=Z(s),C=e=>{f(e.target),S.onBlur?.(e)},w=e=>{if(r||s.disabled)return;if(!Array.isArray(e)||e.length===0){t(null);return}let n=e[0];t(typeof n==`number`?_(n):null)},T=10**-u;return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(o,{...S,type:`number`,value:y,onChange:x,onBlur:C,placeholder:c?.placeholder||`0`,disabled:r||s.disabled,className:U(`pr-8`,d?uc:``,a),step:(10**-u).toFixed(u),"aria-invalid":!!i||!!d}),(0,Q.jsx)(`span`,{className:`absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500`,children:`%`})]}),(0,Q.jsx)(lc,{refusal:d}),(0,Q.jsx)(l,{value:[b],onValueChange:w,min:0,max:v,step:T,disabled:r||s.disabled,className:`w-full`,"aria-label":`Percentage`,"data-testid":`percent-slider`})]})}var vc=n({SliderField:()=>yc});function yc({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=n,s=o?.min??0,c=o?.max??100,u=o?.step??1;if(r)return(0,Q.jsxs)(`div`,{...Br(a,`instead-of-the-inputs`),className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium`,children:e??s}),(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`/ `,c]})]});let{name:d,disabled:f,className:p,...m}=Z(a);return(0,Q.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Q.jsx)(l,{name:d,value:[e??s],onValueChange:e=>t(e[0]),min:s,max:c,step:u,disabled:r||a.disabled,className:a.className,thumbProps:{...m,"aria-invalid":!!i}}),(0,Q.jsx)(`span`,{className:`text-sm font-medium w-12 text-right`,children:e??s})]})}var bc=n({RatingField:()=>xc});function xc({value:e,onChange:t,field:n,readonly:r,className:i,error:a,...o}){let s=n?.max??5,c=e??0,[l,u]=$.useState(null),d=l===null?c:l;if(r)return(0,Q.jsxs)(`div`,{...Br(o,`instead-of-the-inputs`),className:U(`flex items-center gap-1`,i),children:[Array.from({length:s},(e,t)=>(0,Q.jsx)(xr,{className:`w-5 h-5 ${t<c?`fill-yellow-400 text-yellow-400`:`text-muted-foreground`}`},t)),(0,Q.jsxs)(`span`,{className:`ml-2 text-sm text-muted-foreground`,children:[c,` / `,s]})]});let{"aria-invalid":f,name:p,...m}=Z(o),h=m[`aria-labelledby`]!=null;return(0,Q.jsxs)(`div`,{...m,role:h?`group`:void 0,className:U(`flex items-center gap-1`,i),children:[Array.from({length:s},(e,n)=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>t(n+1),onMouseEnter:()=>u(n+1),onMouseLeave:()=>u(null),className:`focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded`,disabled:r||o.disabled,"aria-invalid":!!a,children:(0,Q.jsx)(xr,{className:`w-5 h-5 transition-colors ${n<d?`fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500`:`text-muted-foreground hover:text-yellow-400`}`})},n)),(0,Q.jsxs)(`span`,{className:`ml-2 text-sm text-muted-foreground`,children:[c,` / `,s]})]})}var Sc=n({BooleanField:()=>Cc});function Cc({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=n,s=o?.widget,c=(0,$.useId)(),l=a.id,u=l||o?.name||c,d=o?.label||`Checkbox`,f=!l;if(r)return typeof e==`boolean`?(0,Q.jsx)(`span`,{className:`text-sm`,children:e?`Yes`:`No`}):(0,Q.jsx)(Y,{});let p=Z(a);return s===`checkbox`?(0,Q.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,Q.jsx)(sn,{...p,id:u,checked:!!e,onCheckedChange:e=>t(!!e),disabled:r||p.disabled,"aria-invalid":!!i}),f&&(0,Q.jsx)(ot,{htmlFor:u,className:`sr-only`,children:d})]}):(0,Q.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,Q.jsx)(W,{...p,id:u,checked:!!e,onCheckedChange:t,disabled:r||p.disabled,"aria-invalid":!!i}),f&&(0,Q.jsx)(ot,{htmlFor:u,className:`sr-only`,children:d})]})}var wc=n({MultiSelectField:()=>Tc});function Tc({value:e,onChange:t,field:n,readonly:r,className:i,dependentValues:a,dependsOn:o,emptyHint:s,dataSource:c,error:l,...u}){let d=n,f=d?.options||[],p=Array.isArray(e)?e:e==null?[]:[e],m=u.name||d?.name||u.id||``,h=n?.dependsOn??o,{options:g,gated:_,dependsOnFields:v}=Ur(f,h,a);(0,$.useEffect)(()=>{if(r||f.length===0||_||p.length===0)return;let e=p.filter(e=>g.some(t=>t.value===e));e.length!==p.length&&t(e)},[g,_]);let y=Br(u,`instead-of-the-inputs`);if(r)return p.length===0?(0,Q.jsx)(Y,{...y}):(0,Q.jsx)(`div`,{...y,className:`flex flex-wrap gap-1`,children:p.map(e=>{let t=f.find(t=>t.value===e);return(0,Q.jsx)(mt,{variant:`outline`,children:t?ae(t):e},e)})});if(g.length===0)return(0,Q.jsx)(Hr,{emptyHint:s,gated:_,dependsOnFields:v,testId:m?`multiselect-empty-${m}`:void 0,className:`min-h-9`,hostGroupProps:y});let b=e=>{t(p.includes(e)?p.filter(t=>t!==e):[...p,e])},{"aria-invalid":x,name:S,...C}=Z(u),w=C[`aria-labelledby`]!=null,T=p.length===0?n?.placeholder:void 0;return(0,Q.jsxs)(`div`,{...C,role:w?`group`:void 0,className:U(`flex flex-wrap gap-1.5`,i),"data-testid":m?`multiselect-${m}`:void 0,children:[T?(0,Q.jsx)(`span`,{className:`self-center text-sm text-muted-foreground`,children:T}):null,g.map(e=>{let t=String(e.value),n=p.includes(t);return(0,Q.jsx)(`button`,{type:`button`,onClick:()=>b(t),disabled:u.disabled,"aria-pressed":n,"aria-invalid":!!l,"data-testid":`multiselect-option-${e.value}`,className:U(`rounded-full border px-3 py-1 text-sm transition-colors`,n?`border-primary bg-primary text-primary-foreground`:`border-input bg-background text-foreground hover:bg-accent`),children:ae(e)},t)})]})}var Ec=n({SelectField:()=>Dc});function Dc(e){return e.field?.multiple?(0,Q.jsx)(Tc,{...e}):(0,Q.jsx)(Oc,{...e})}function Oc({value:e,onChange:t,field:n,readonly:r,error:i,dependentValues:a,dependsOn:o,emptyHint:s,dataSource:c,...l}){let u=n,d=u?.options||[],{t:f}=zr(),p=l.name||u?.name||l.id||``,m=n?.dependsOn??o,{options:h,gated:g,dependsOnFields:_}=Ur(d,m,a);if((0,$.useEffect)(()=>{r||d.length!==0&&(g||e!=null&&e!==``&&(V(e,h)||t?.(null)))},[h,g]),r){let t=d.find(t=>t.value===e),n=t?ae(t):e;return n?(0,Q.jsx)(`span`,{className:`text-sm`,children:n}):(0,Q.jsx)(Y,{})}if(h.length===0)return(0,Q.jsx)(Hr,{emptyHint:s,gated:g,dependsOnFields:_,testId:p?`select-empty-${p}`:void 0,className:`h-9`,hostControlProps:Vr(l)});let{name:v,disabled:y,...b}=Z(l);return(0,Q.jsxs)(k,{name:v,value:e===null?``:e,onValueChange:t,disabled:r||l.disabled,children:[(0,Q.jsx)(E,{...b,"data-testid":p?`select-trigger-${p}`:void 0,"aria-invalid":!!i,children:(0,Q.jsx)(ne,{placeholder:u?.placeholder||f(`common.selectOption`)})}),(0,Q.jsx)(be,{position:`popper`,children:h.map(e=>(0,Q.jsx)(Ee,{value:e.value,"data-testid":`select-option-${e.value}`,children:ae(e)},e.value))})]})}var kc=n({RadioField:()=>Ac});function Ac({value:e,onChange:t,field:n,readonly:r,className:i,dependentValues:a,dependsOn:o,emptyHint:s,dataSource:c,error:l,...u}){let d=n,f=d?.options||[],p=(0,$.useId)(),m=u.name||d?.name||u.id||``,h=n?.dependsOn??o,{options:g,gated:_,dependsOnFields:v}=Ur(f,h,a);(0,$.useEffect)(()=>{r||f.length!==0&&(_||e!=null&&e!==``&&(V(e,g)||t?.(null)))},[g,_]);let y=Br(u,`instead-of-the-inputs`);if(r){if(e==null||e===``)return(0,Q.jsx)(Y,{...y});let t=f.find(t=>t.value===e);return(0,Q.jsx)(`span`,{...y,className:`text-sm`,children:t?ae(t):String(e)})}return g.length===0?(0,Q.jsx)(Hr,{emptyHint:s,gated:_,dependsOnFields:v,testId:m?`radio-empty-${m}`:void 0,className:`min-h-9`,hostGroupProps:y}):(0,Q.jsx)(P,{...Z(u),value:e??``,onValueChange:t,disabled:u.disabled,className:i,"aria-invalid":!!l,children:g.map(e=>{let t=String(e.value),n=`${p}-${t}`;return(0,Q.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,Q.jsx)(Me,{value:t,id:n,"data-testid":`radio-option-${t}`}),(0,Q.jsx)(ot,{htmlFor:n,className:`font-normal`,children:ae(e)})]},t)})})}var jc=n({CheckboxesField:()=>Mc});function Mc({value:e,onChange:t,field:n,readonly:r,className:i,dependentValues:a,dependsOn:o,emptyHint:s,dataSource:c,error:l,...u}){let d=n,f=d?.options||[],p=Array.isArray(e)?e:e==null?[]:[e],m=(0,$.useId)(),h=u.name||d?.name||u.id||``,g=n?.dependsOn??o,{options:_,gated:v,dependsOnFields:y}=Ur(f,g,a);(0,$.useEffect)(()=>{if(r||f.length===0||v||p.length===0)return;let e=p.filter(e=>_.some(t=>t.value===e));e.length!==p.length&&t(e)},[_,v]);let b=Br(u,`instead-of-the-inputs`);if(r)return p.length===0?(0,Q.jsx)(Y,{...b}):(0,Q.jsx)(`div`,{...b,className:`flex flex-wrap gap-1`,children:p.map(e=>{let t=f.find(t=>t.value===e);return(0,Q.jsx)(mt,{variant:`outline`,children:t?ae(t):e},e)})});if(_.length===0)return(0,Q.jsx)(Hr,{emptyHint:s,gated:v,dependsOnFields:y,testId:h?`checkboxes-empty-${h}`:void 0,className:`min-h-9`,hostGroupProps:b});let x=(e,n)=>{t(n?[...p.filter(t=>t!==e),e]:p.filter(t=>t!==e))},{"aria-invalid":S,name:C,...w}=Z(u),T=w[`aria-labelledby`]!=null;return(0,Q.jsx)(`div`,{...w,role:T?`group`:void 0,className:i,"data-testid":h?`checkboxes-${h}`:void 0,children:_.map(e=>{let t=String(e.value),n=`${m}-${t}`;return(0,Q.jsxs)(`div`,{className:`flex items-center space-x-2 py-0.5`,children:[(0,Q.jsx)(sn,{id:n,checked:p.includes(t),onCheckedChange:e=>x(t,!!e),disabled:u.disabled,"aria-invalid":!!l,"data-testid":`checkboxes-option-${t}`}),(0,Q.jsx)(ot,{htmlFor:n,className:`font-normal`,children:ae(e)})]},t)})})}var Nc=n({TagsField:()=>Pc});function Pc({value:e,onChange:t,field:n,readonly:r,className:i,error:a,...s}){let c=Array.isArray(e)?e:e==null?[]:[e],[l,u]=$.useState(``),{t:d}=zr();if(r)return c.length===0?(0,Q.jsx)(Y,{}):(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:c.map(e=>(0,Q.jsx)(mt,{variant:`secondary`,children:e},e))});let f=e=>{let n=e.trim();n&&!c.includes(n)&&(t([...c,n]),u(``))},p=e=>t(c.filter(t=>t!==e)),m=Z(s),h=e=>{f(l),m.onBlur?.(e)},g=e=>{e.key===`Enter`||e.key===`,`?(e.preventDefault(),f(l)):e.key===`Backspace`&&l===``&&c.length>0&&p(c[c.length-1])};return(0,Q.jsxs)(`div`,{className:U(`flex flex-wrap items-center gap-1.5 rounded-md border border-input bg-background p-1.5`,i),children:[c.map(e=>(0,Q.jsxs)(mt,{variant:`secondary`,className:`gap-1`,children:[e,(0,Q.jsx)(`button`,{type:`button`,onClick:()=>p(e),className:`ml-0.5 rounded-full text-muted-foreground hover:text-foreground`,"aria-label":`Remove ${e}`,children:`×`})]},e)),(0,Q.jsx)(o,{...m,value:l,onChange:e=>u(e.target.value),onKeyDown:g,onBlur:h,disabled:s.disabled,placeholder:c.length===0?n?.placeholder||d(`fields.tags.placeholder`):``,className:`h-7 flex-1 border-0 bg-transparent p-0 px-1 shadow-none focus-visible:ring-0 min-w-[8ch]`,"aria-invalid":!!a})]})}function Fc(e){if(!(e.disabled||e.readOnly))try{e.showPicker?.()}catch{}}var Ic=n({DateField:()=>Lc});function Lc({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let s=zn(),{t:c}=zr(),l=$.useId();if(r)return!e||isNaN(En(e).getTime())?(0,Q.jsx)(Y,{}):(0,Q.jsx)(`span`,{className:`text-sm`,children:An(e,void 0,{locale:s})});let u=Z(a),d=Nn(e),f=d?[u[`aria-describedby`],l].filter(Boolean).join(` `):u[`aria-describedby`],p=(0,Q.jsx)(o,{...u,type:`date`,value:d?``:Bn(e),onChange:e=>t(e.target.value),onClick:e=>{Fc(e.currentTarget),u.onClick?.(e)},disabled:r||u.disabled,"aria-invalid":!!i||d,"aria-describedby":f});return d?(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[p,(0,Q.jsx)(`p`,{id:l,className:`text-xs text-destructive`,"data-testid":`date-impossible-day`,children:c(`fields.date.impossibleDay`,{value:String(e)})})]}):p}var Rc=n({DateTimeField:()=>zc});function zc({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let s=zn(),{t:c}=zr(),l=$.useId();if(r)return e?(0,Q.jsx)(`span`,{className:`text-sm`,children:Ln(e,{locale:s})}):(0,Q.jsx)(Y,{});let u=Z(a),d=Nn(e),f=d?[u[`aria-describedby`],l].filter(Boolean).join(` `):u[`aria-describedby`],p=(0,Q.jsx)(o,{...u,type:`datetime-local`,value:kn(e),onChange:e=>t(On(e.target.value)),onClick:e=>{Fc(e.currentTarget),u.onClick?.(e)},disabled:r||u.disabled,"aria-invalid":!!i||d,"aria-describedby":f});return d?(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[p,(0,Q.jsx)(`p`,{id:l,className:`text-xs text-destructive`,"data-testid":`datetime-impossible-day`,children:c(`fields.dateTime.impossibleDay`,{value:String(e)})})]}):p}var Bc=n({TimeField:()=>Vc});function Vc({value:e,onChange:t,field:n,readonly:r,error:i,...a}){if(r)return(0,Q.jsx)(`span`,{className:`text-sm`,children:e||(0,Q.jsx)(Y,{})});let s=Z(a);return(0,Q.jsx)(o,{...s,type:`time`,value:e||``,onChange:e=>t(e.target.value),onClick:e=>{Fc(e.currentTarget),s.onClick?.(e)},disabled:r||s.disabled,"aria-invalid":!!i})}var Hc=n({EmailField:()=>Uc});function Uc({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let s=n;if(r)return e?(0,Q.jsx)(`a`,{href:`mailto:${e}`,className:`text-sm text-blue-600 hover:text-blue-800 hover:underline`,children:e}):(0,Q.jsx)(Y,{});let c=Z(a);return(0,Q.jsx)(o,{...c,type:`email`,value:e||``,onChange:e=>t(e.target.value),placeholder:s?.placeholder||`email@example.com`,disabled:r||c.disabled,"aria-invalid":!!i})}var Wc=n({PhoneField:()=>Gc});function Gc({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let s=n;if(r)return e?(0,Q.jsx)(`a`,{href:`tel:${e}`,className:`text-sm text-blue-600 hover:text-blue-800 hover:underline`,children:e}):(0,Q.jsx)(Y,{});let c=Z(a);return(0,Q.jsx)(o,{...c,type:`tel`,value:e||``,onChange:e=>t(e.target.value),placeholder:s?.placeholder||`(555) 123-4567`,disabled:r||c.disabled,"aria-invalid":!!i})}var Kc=n({UrlField:()=>qc});function qc({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let s=n;if(r)return e?e.startsWith(`http://`)||e.startsWith(`https://`)?(0,Q.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-blue-600 hover:text-blue-800 hover:underline`,children:e}):(0,Q.jsx)(`span`,{className:`text-sm`,children:e}):(0,Q.jsx)(Y,{});let c=Z(a);return(0,Q.jsx)(o,{...c,type:`url`,value:e||``,onChange:e=>t(e.target.value),placeholder:s?.placeholder||`https://example.com`,disabled:r||c.disabled,"aria-invalid":!!i})}function Jc(e){return e==null?!1:Array.isArray(e)?e.length>0:typeof e==`object`&&Object.keys(e).length>0}function Yc(e){let{dataSource:t,objectName:n,enabled:r=!0,pageSize:i=50,paginate:a=!1,filter:o,expand:s,searchFields:c,debounceMs:l=300}=e,[u,d]=(0,$.useState)([]),[f,p]=(0,$.useState)(!1),[m,h]=(0,$.useState)(null),[g,_]=(0,$.useState)(0),[v,y]=(0,$.useState)(1),[b,x]=(0,$.useState)(``),[S,C]=(0,$.useState)(null),w=(0,$.useRef)(null),T=(0,$.useRef)(0),E=(0,$.useCallback)(()=>{w.current&&=(clearTimeout(w.current),null)},[]),D=(0,$.useMemo)(()=>Jc(o)?JSON.stringify(o):``,[o]),O=(0,$.useMemo)(()=>s?.length?s.join(`,`):``,[s]),k=(0,$.useMemo)(()=>c?.length?c.join(`,`):``,[c]),A=!!r&&!!t&&typeof t.find==`function`&&!!n,j=(0,$.useCallback)(async(e,r,l)=>{if(!A||!t||!n)return;let u=++T.current,f=()=>T.current===u;p(!0),h(null);try{let u={$top:i};a&&(u.$skip=(r-1)*i),e&&e.trim()&&(u.$search=e.trim()),c&&c.length>0&&(u.$searchFields=c),l&&(u.$orderby={[l.field]:l.direction}),Jc(o)&&(u.$filter=o),s&&s.length>0&&(u.$expand=s);let p=await t.find(n,u);if(!f())return;let m=p?.data??p??[];d(m),_(p?.total??m.length)}catch(e){if(!f())return;h(e instanceof Error?e.message:String(e)),d([])}finally{f()&&p(!1)}},[A,t,n,i,a,D,O,k]);(0,$.useEffect)(()=>{A&&j(b,v,S)},[A,v,S,j]);let M=(0,$.useCallback)(()=>{T.current+=1,E(),p(!1),d([]),h(null),x(``),y(1),C(null)},[E]);(0,$.useEffect)(()=>{A||M()},[A,M]),(0,$.useEffect)(()=>()=>E(),[j,v,S,E]);let ee=(0,$.useCallback)(e=>{x(e),y(1),E(),w.current=setTimeout(()=>{j(e,1,S)},l)},[j,S,l,E]),N=(0,$.useCallback)(e=>{y(e)},[]),P=(0,$.useCallback)(e=>{C(t=>t&&t.field===e?{field:e,direction:t.direction===`asc`?`desc`:`asc`}:{field:e,direction:`asc`}),y(1)},[]),F=(0,$.useCallback)(e=>{C(e),y(1)},[]),te=(0,$.useCallback)(()=>{j(b,v,S)},[j,b,v,S]);return{records:u,loading:f,error:m,total:g,totalPages:Math.max(1,Math.ceil(g/Math.max(1,i))),page:v,search:b,sort:S,setPage:N,setSearch:ee,toggleSort:P,setSort:F,reset:M,refetch:te}}function Xc(e){return typeof e==`string`?{field:e}:e}function Zc(e){return e.replace(/_/g,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/\b\w/g,e=>e.toUpperCase())}function Qc(e,t,n,r){let i=e?.options;if(!Array.isArray(i)||i.length===0)return;let a=i;return t?r(t,n,a):a}function $c(e,t,n,r){let i={};for(let a of e){let e=t?.[a.field],o=a.type??e?.type;if(!o)continue;let s=e?{...e,name:a.field,type:o}:{name:a.field,type:o},c=Qc(e,n,a.field,r);c&&(s.options=c),i[a.field]=s}return i}function el(e,t,n){let{descriptors:r,cellRenderer:i,objectSchema:a,titleField:o,displayField:s,displayLocale:c}=n;if(a&&t.field===s){let t=A(a,e,{titleField:o}),n=e?.id??e?._id;if(!(t===`Untitled`||n!=null&&t===`Record #${n}`))return t}let l=e?.[t.field],u=r[t.field];if(u&&i){let e=i(u.type);if(e)return(0,Q.jsx)(e,{value:l,field:u})}return l==null?``:typeof l==`object`?l.$numberDecimal?String(Number(l.$numberDecimal)):l.$oid?String(l.$oid):l.$date?An(l.$date,void 0,{locale:c}):l.name||l.label?String(l.name||l.label):JSON.stringify(l):typeof l==`boolean`?l?`Yes`:`No`:String(l)}var tl=10,nl=60,rl=5;function il(e){let t={};for(let n of e)switch(n.operator){case`eq`:t[n.field]=n.value;break;case`ne`:t[n.field]={$ne:n.value};break;case`gt`:t[n.field]={$gt:n.value};break;case`lt`:t[n.field]={$lt:n.value};break;case`gte`:t[n.field]={$gte:n.value};break;case`lte`:t[n.field]={$lte:n.value};break;case`contains`:t[n.field]={$contains:n.value};break;case`in`:t[n.field]={$in:n.value};break;case`notIn`:t[n.field]={$nin:n.value}}return t}function al(e){return e==null?void 0:String(e)}function ol(e,t){let n=e?.find(e=>String(e.value)===t);return n?n.value:t}function sl(e,t){let n={};for(let r of t){let t=e[r.field];t!=null&&t!==``&&(r.type===`boolean`?n[r.field]=!!t:r.type===`text`?n[r.field]={$contains:t}:n[r.field]=t)}return n}function cl({open:e,onOpenChange:t,title:n=`Select Record`,multiple:r=!1,dataSource:i,objectName:a,columns:s,displayField:c,objectSchema:l,idField:u=`id`,pageSize:d=tl,value:f,onSelect:p,onSelectRecords:m,lookupFilters:g,baseFilter:_,cellRenderer:y,fieldsMeta:b,filterColumns:S,renderFilterBar:C,renderGrid:T}){let D=c??`name`,{t:O}=zr(),{translateOptions:A}=Ze(),j=zn(),[M,N]=(0,$.useState)(new Set),P=(0,$.useRef)(new Map),[F,te]=(0,$.useState)(-1),I=(0,$.useRef)(null),[L,re]=(0,$.useState)(!1),[R,z]=(0,$.useState)({}),[B,V]=(0,$.useState)({}),H=(0,$.useRef)(null),[ie,ae]=(0,$.useState)(``),W=(0,$.useMemo)(()=>s&&s.length>0?s.map(Xc):[{field:D,label:Zc(D)}],[s,D]),oe=(0,$.useMemo)(()=>$c(W,b,a,A),[W,b,a,A]),se=ws(),G=(0,$.useMemo)(()=>{let e=W.filter(e=>e.field!==u);if(e.length===0)return[];let t=Ie(b,e);return se.isLoaded?t.filter(e=>se.checkField(a,e,`read`)):t},[b,W,u,se,a]),K=(0,$.useMemo)(()=>{if(!se.isLoaded)return W;let e=W.filter(e=>e.field===u||se.checkField(a,e.field,`read`));return e.length>0?e:[{field:u,label:Zc(u)}]},[W,se,a,u]),ce=(0,$.useMemo)(()=>{if(S&&S.length>0)return S;if(g&&g.length>0)return g.map(e=>{let t=`text`;return typeof e.value==`boolean`?t=`boolean`:Array.isArray(e.value)?t=`select`:typeof e.value==`number`||e.operator===`gt`||e.operator===`lt`||e.operator===`gte`||e.operator===`lte`?t=`number`:(e.operator===`in`||e.operator===`notIn`)&&(t=`select`),{field:e.field,label:Zc(e.field),type:t,...Array.isArray(e.value)?{options:e.value.map(e=>{if(typeof e==`object`&&e){let t=e;return{label:String(t.name||t.label||t.title||e),value:e}}return{label:String(e),value:e}})}:{}}})},[S,g]),le=(0,$.useMemo)(()=>{if(ce)return ce.map(e=>{if(e.type!==`select`||e.options&&e.options.length>0)return e;let t=Qc(b?.[e.field],a,e.field,A);return t?{...e,options:t}:e})},[ce,b,a,A]),ue=(0,$.useMemo)(()=>{let e=g?.length?il(g):{},t=le?.length?sl(R,le):{},n=Array.isArray(_)?_:void 0,r=n?void 0:_,i={...e,...t,...r??{}},a=Object.keys(i).length>0?i:void 0;if(!n)return{ok:!0,node:a};let o=lt(a);if(!o.ok)return o;let s=lt(n);return s.ok?{ok:!0,node:nt(o.node,s.node)}:s},[g,le,R,_]),de=ue.ok?void 0:ue.refusal,fe=Yc({dataSource:i,objectName:a,enabled:e&&ue.ok,pageSize:d,paginate:!0,filter:ue.ok?ue.node:void 0,expand:G}),{records:pe,loading:he}=fe,ge=de?de.message:fe.error,_e=fe.total,ve=fe.totalPages,ye=fe.search,xe=fe.page,Se=fe.sort?.field??null,Ce=fe.sort?.direction??`asc`,we=fe.setPage,Te=fe.toggleSort,De=fe.setSearch;(0,$.useEffect)(()=>{e||(te(-1),re(!1),z({}),V({}),ae(``),N(new Set(r&&Array.isArray(f)?f:[])),P.current.clear())},[e]),(0,$.useEffect)(()=>{e&&r&&N(new Set(Array.isArray(f)?f:[]))},[e,r,f]),(0,$.useEffect)(()=>{te(-1)},[pe]);let Oe=(0,$.useCallback)(e=>e[u]??e.id??e._id,[u]),ke=(0,$.useCallback)(e=>{let t=Oe(e);return r?M.has(t):f===t},[r,f,M,Oe]),Ae=(0,$.useCallback)(e=>{let n=Oe(e),i=ee(e,b);r?N(e=>{let t=new Set(e);return t.has(n)?(t.delete(n),P.current.delete(n)):(t.add(n),P.current.set(n,i)),t}):(p(n),m?.([i]),t(!1))},[r,Oe,b,p,m,t]),je=(0,$.useCallback)(()=>{let e=Array.from(M);p(e);let n=e.map(e=>P.current.get(e)).filter(Boolean);m?.(n),t(!1)},[M,p,m,t]),Me=(0,$.useCallback)(()=>{we(Math.max(1,xe-1))},[we,xe]),Ne=(0,$.useCallback)(()=>{we(Math.min(ve,xe+1))},[we,xe,ve]),Pe=(0,$.useCallback)(e=>{if(e.key!==`Enter`)return;let t=parseInt(ie,10);!isNaN(t)&&t>=1&&t<=ve&&we(t),ae(``)},[ie,ve]),Fe=(0,$.useCallback)(e=>{pe.length!==0&&(e.key===`ArrowDown`?(e.preventDefault(),te(e=>Math.min(e+1,pe.length-1))):e.key===`ArrowUp`?(e.preventDefault(),te(e=>Math.max(e-1,0))):(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),F>=0&&F<pe.length&&Ae(pe[F])))},[pe,F,Ae]);(0,$.useEffect)(()=>{if(F>=0&&I.current){let e=I.current.querySelector(`[data-row-index="${F}"]`);e&&typeof e.scrollIntoView==`function`&&e.scrollIntoView({block:`nearest`})}},[F]);let Le=(0,$.useCallback)((e,t)=>el(l&&t.field===D?sa(ee(e,b),se,a,[u]):e,t,{descriptors:oe,cellRenderer:y,objectSchema:l,titleField:c,displayField:D,displayLocale:j}),[y,l,c,D,b,oe,j,se,a,u]),Re=(0,$.useCallback)(e=>Se===e?Ce===`asc`?(0,Q.jsx)(Kn,{className:`ml-1 size-3`}):(0,Q.jsx)(Hn,{className:`ml-1 size-3`}):(0,Q.jsx)(Gn,{className:`ml-1 size-3 opacity-40`}),[Se,Ce]),ze=(0,$.useCallback)((e,t,n)=>{e.preventDefault(),e.stopPropagation(),H.current={field:t,startX:e.clientX,startWidth:n};let r=e=>{if(!H.current)return;let t=e.clientX-H.current.startX,n=Math.max(nl,H.current.startWidth+t);V(e=>({...e,[H.current.field]:n}))},i=()=>{H.current=null,document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[]),Be=(0,$.useCallback)((e,t)=>{z(n=>({...n,[e]:t})),we(1)},[]),Ve=(0,$.useCallback)(()=>{z({}),we(1)},[]),He=(0,$.useMemo)(()=>Object.values(R).filter(e=>e!=null&&e!==``).length,[R]),Ue=(0,$.useCallback)(e=>{let t=R[e.field],n=e.label||Zc(e.field);switch(e.type){case`select`:return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(ot,{className:`text-xs text-muted-foreground`,children:n}),(0,Q.jsxs)(k,{value:al(t)??``,onValueChange:t=>Be(e.field,ol(e.options,t)),children:[(0,Q.jsx)(E,{className:`h-8 text-xs`,children:(0,Q.jsx)(ne,{placeholder:O(`lookup.filterPlaceholder`,{label:n})})}),(0,Q.jsx)(be,{children:e.options?.map(e=>(0,Q.jsx)(Ee,{value:String(e.value),children:e.label},String(e.value)))})]})]});case`number`:return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(ot,{className:`text-xs text-muted-foreground`,children:n}),(0,Q.jsx)(o,{type:`number`,className:`h-8 text-xs`,value:t??``,placeholder:O(`lookup.filterPlaceholder`,{label:n}),onChange:t=>{let n=t.target.value;Be(e.field,n===``?``:Number(n))}})]});case`date`:return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(ot,{className:`text-xs text-muted-foreground`,children:n}),(0,Q.jsx)(o,{type:`date`,className:`h-8 text-xs`,value:t??``,onChange:t=>Be(e.field,t.target.value)})]});case`boolean`:return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(ot,{className:`text-xs text-muted-foreground`,children:n}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 h-8`,children:[(0,Q.jsx)(sn,{checked:!!t,onCheckedChange:t=>Be(e.field,!!t)}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:O(`lookup.yes`)})]})]});default:return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(ot,{className:`text-xs text-muted-foreground`,children:n}),(0,Q.jsx)(o,{className:`h-8 text-xs`,value:t??``,placeholder:O(`lookup.filterPlaceholder`,{label:n}),onChange:t=>Be(e.field,t.target.value)})]})}},[R,Be]),We=(0,$.useCallback)((e,t)=>e?`bg-primary/5 hover:bg-primary/10`:t%2==1?`bg-muted/20 hover:bg-accent/30`:`hover:bg-accent/30`,[]);return(0,Q.jsx)(nn,{open:e,onOpenChange:t,children:(0,Q.jsxs)(It,{className:`w-[95vw] sm:max-w-3xl lg:max-w-5xl max-h-[85vh] sm:max-h-[80vh] flex flex-col gap-0`,"data-testid":`record-picker-dialog`,children:[(0,Q.jsx)(Ge,{children:(0,Q.jsxs)(Bt,{children:[n,r&&(0,Q.jsx)(`span`,{className:`sr-only`,children:` (multiple selection)`})]})}),(0,Q.jsxs)(`div`,{className:`relative rounded-md border bg-muted/30 mb-3`,children:[(0,Q.jsx)(vr,{className:`absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground`}),(0,Q.jsx)(o,{placeholder:O(`table.search`),value:ye,onChange:e=>De(e.target.value),className:`pl-9 border-0 bg-transparent shadow-none focus-visible:ring-0`,"data-testid":`record-picker-search`}),he&&(0,Q.jsx)(fr,{className:`absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground`,"data-testid":`record-picker-loading-indicator`})]}),le&&le.length>0&&(0,Q.jsx)(`div`,{className:`py-2`,children:C?(0,Q.jsx)(`div`,{"data-testid":`record-picker-filter-bar`,children:C({filterColumns:le,values:R,onChange:Be,onClear:Ve,activeCount:He})}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`record-picker-filter-bar`,children:[(0,Q.jsxs)(J,{type:`button`,variant:He>0?`secondary`:`outline`,size:`sm`,className:`gap-1.5 shrink-0`,onClick:()=>re(e=>!e),children:[(0,Q.jsx)(yr,{className:`size-3.5`}),O(`lookup.filters`),He>0&&(0,Q.jsx)(`span`,{className:`inline-flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-primary`,children:He})]}),He>0&&(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,className:`gap-1 text-xs`,onClick:Ve,children:[(0,Q.jsx)(Er,{className:`size-3`}),O(`lookup.clear`)]})]}),L&&(0,Q.jsx)(`div`,{className:`mt-2 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 border rounded-md p-3 bg-muted/30`,"data-testid":`record-picker-filter-panel`,children:le.map(e=>(0,Q.jsx)(`div`,{children:Ue(e)},e.field))})]})}),ge&&(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-4`,role:`alert`,children:[(0,Q.jsx)(er,{className:`size-5 text-destructive`}),(0,Q.jsx)(`p`,{className:`text-sm text-destructive`,children:ge}),de?null:(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>fe.refetch(),type:`button`,children:O(`lookup.retry`)})]}),T?(0,Q.jsx)(`div`,{className:`flex-1 min-h-0`,"data-testid":`record-picker-grid-slot`,children:T({columns:K,records:pe,loading:he,totalCount:_e,currentPage:xe,pageSize:d,sortField:Se,sortDirection:Ce,onSort:Te,onPageChange:we,onRowClick:Ae,isSelected:ke,multiple:r,idField:u,cellRenderer:y})}):(0,Q.jsxs)(Q.Fragment,{children:[he&&pe.length===0&&!ge&&(0,Q.jsx)(`div`,{className:`flex-1 overflow-hidden min-h-0 border rounded-md`,role:`status`,"aria-live":`polite`,"data-testid":`record-picker-skeleton`,children:(0,Q.jsxs)(me,{children:[(0,Q.jsx)(x,{children:(0,Q.jsxs)(v,{className:`bg-muted/40`,children:[r&&(0,Q.jsx)(q,{className:`w-10`}),K.map(e=>(0,Q.jsx)(q,{children:(0,Q.jsx)(w,{className:`h-4 w-20`})},e.field))]})}),(0,Q.jsx)(h,{children:Array.from({length:rl},(e,t)=>(0,Q.jsxs)(v,{children:[r&&(0,Q.jsx)(dn,{className:`w-10`,children:(0,Q.jsx)(w,{className:`size-4 rounded`})}),K.map(e=>(0,Q.jsx)(dn,{children:(0,Q.jsx)(w,{className:`h-4 w-full`})},e.field))]},t))})]})}),!he&&!ge&&pe.length===0&&(0,Q.jsx)(`div`,{className:`py-8 text-center`,children:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:O(`lookup.noRecords`)})}),!ge&&pe.length>0&&(0,Q.jsxs)(`div`,{className:`relative flex-1 overflow-auto min-h-0 border rounded-md`,"aria-busy":he||void 0,"data-state":he?`loading`:`idle`,tabIndex:0,onKeyDown:Fe,role:`grid`,"aria-label":`Records`,children:[he&&(0,Q.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center bg-background/60`,"data-testid":`record-picker-loading-overlay`,children:(0,Q.jsx)(fr,{className:`size-6 animate-spin text-muted-foreground`})}),(0,Q.jsxs)(me,{style:Object.keys(B).length>0?{tableLayout:`fixed`}:void 0,children:[(0,Q.jsx)(x,{className:`sticky top-0 z-[5] bg-muted/50 [&_tr]:border-b`,"data-testid":`record-picker-sticky-header`,children:(0,Q.jsxs)(v,{children:[r&&(0,Q.jsx)(q,{className:`w-10`}),K.map(e=>{let t=B[e.field],n=t?{width:`${t}px`,minWidth:`${t}px`}:e.width?{width:e.width}:void 0;return(0,Q.jsxs)(q,{style:n,className:`cursor-pointer select-none relative group text-xs font-semibold uppercase tracking-wider`,onClick:()=>Te(e.field),"aria-sort":Se===e.field?Ce===`asc`?`ascending`:`descending`:`none`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center`,children:[e.label||Zc(e.field),Re(e.field)]}),(0,Q.jsx)(`span`,{role:`separator`,"aria-orientation":`vertical`,className:`absolute right-0 top-0 bottom-0 w-1 cursor-col-resize opacity-0 group-hover:opacity-100 bg-border hover:bg-primary/50 transition-opacity`,onMouseDown:t=>{let n=t.currentTarget.parentElement?.getBoundingClientRect();ze(t,e.field,n?.width??100)},onClick:e=>e.stopPropagation(),"data-testid":`resize-handle-${e.field}`})]},e.field)})]})}),(0,Q.jsx)(h,{ref:I,children:pe.map((e,t)=>{let n=Oe(e),i=ke(e),a=t===F;return(0,Q.jsxs)(v,{"data-row-index":t,className:U(`cursor-pointer transition-colors`,We(i,t),a&&`ring-2 ring-primary ring-inset`),onClick:()=>Ae(e),"data-testid":`record-row-${n}`,"aria-selected":i,children:[r&&(0,Q.jsx)(dn,{className:`w-10`,children:i&&(0,Q.jsx)(Xn,{className:`size-4 text-primary`})}),K.map(t=>(0,Q.jsx)(dn,{className:`py-2.5`,"data-lookup-cell":t.field,children:Le(e,t)},t.field))]},n??t)})})]})]}),!ge&&_e>0&&(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-sm text-muted-foreground border-t pt-3 mt-2 px-1`,"data-testid":`record-picker-pagination`,children:[(0,Q.jsxs)(`span`,{children:[O(`lookup.recordCount`,{count:_e}),ve>1&&` · ${O(`lookup.pageOf`,{current:xe,total:ve})}`]}),ve>1&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(J,{variant:`outline`,size:`icon`,className:`size-7`,onClick:Me,disabled:xe<=1,type:`button`,"aria-label":O(`lookup.prevPage`),children:(0,Q.jsx)(Qn,{className:`size-4`})}),(0,Q.jsx)(o,{className:`h-7 w-12 text-center text-xs px-1`,placeholder:String(xe),value:ie,onChange:e=>ae(e.target.value),onKeyDown:Pe,"aria-label":O(`lookup.jumpToPage`),"data-testid":`record-picker-page-jump`}),(0,Q.jsx)(J,{variant:`outline`,size:`icon`,className:`size-7`,onClick:Ne,disabled:xe>=ve,type:`button`,"aria-label":O(`lookup.nextPage`),children:(0,Q.jsx)($n,{className:`size-4`})})]})]})]}),r&&(0,Q.jsx)(St,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 w-full justify-between`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:O(`table.selected`,{count:M.size})}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(J,{variant:`outline`,type:`button`,onClick:()=>t(!1),children:O(`common.cancel`)}),(0,Q.jsx)(J,{type:`button`,onClick:je,children:O(`common.confirm`)})]})]})})]})})}function ll(e,t){if(e&&t)return t.includes(`.`)?t.split(`.`).reduce((e,t)=>e==null?e:e[t],e):e[t]}function ul(e=`name`){return[e,`name`,`username`,`label`]}function dl(e,t=`name`){if(e==null)return``;if(typeof e!=`object`)return String(e);let n=typeof t==`string`?ul(t):t;for(let t of n)if(e[t]!=null)return String(e[t]);return``}function fl(e){let t=(e||``).trim();if(!t)return`?`;let n=t.split(/\s+/).filter(Boolean);if(n.length>=2)return(n[0][0]+n[n.length-1][0]).toUpperCase();let r=n[0];return/[㐀-鿿]/.test(r)?r.length<=2?r:r.slice(-2):r.slice(0,2).toUpperCase()}function pl(e,t){return!e||!t||t.length===0?``:t.map(t=>ll(e,t)).filter(e=>e!=null&&e!==``).map(e=>String(e)).join(` · `)}function ml(e,t=`image`){let n=e&&t?ll(e,t):void 0;return n?String(n):void 0}function hl(e,t=`id`){return!e||typeof e!=`object`?e:e[t]??e.id??e._id}function gl(e,t){let n=e??``,r=(t??``).trim().toLowerCase();if(!r||!n)return[];let i=n.toLowerCase(),a=[],o=0;for(;;){let e=i.indexOf(r,o);if(e===-1)break;a.push([e,e+r.length]),o=e+r.length}return a}function _l({text:e,query:t}){let n=t?gl(e,t):[];if(n.length===0)return(0,Q.jsx)(Q.Fragment,{children:e});let r=[],i=0;return n.forEach(([t,n],a)=>{t>i&&r.push(e.slice(i,t)),r.push((0,Q.jsx)(`mark`,{className:`rounded-[2px] bg-primary/20 px-px text-inherit`,children:e.slice(t,n)},a)),i=n}),i<e.length&&r.push(e.slice(i)),(0,Q.jsx)(Q.Fragment,{children:r})}function vl({record:e,displayField:t=`name`,nameFields:n,subtitleFields:r,avatarField:i=`image`,selected:a=!1,active:o=!1,highlightQuery:s,onSelect:c,className:l}){let u=dl(e,n??t),d=pl(e,r),f=ml(e,i),p=fl(u),m=(0,$.useRef)(null);return(0,$.useEffect)(()=>{o&&m.current?.scrollIntoView?.({block:`nearest`})},[o]),(0,Q.jsxs)(`button`,{ref:m,type:`button`,tabIndex:-1,onClick:()=>c?.(e),"aria-pressed":a,"data-testid":`person-row`,"data-active":o||void 0,className:U(`flex w-full items-center gap-3 rounded-md px-2 py-1.5 text-left transition-colors`,`hover:bg-accent focus-visible:outline-none`,a&&`bg-accent`,o&&`bg-accent ring-1 ring-inset ring-ring`,l),children:[(0,Q.jsxs)(Ve,{className:`size-9 shrink-0`,children:[f&&(0,Q.jsx)(Sn,{src:f,alt:u}),(0,Q.jsx)(un,{className:`text-xs`,children:p})]}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium`,children:u?(0,Q.jsx)(_l,{text:u,query:s}):`—`}),d&&(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:(0,Q.jsx)(_l,{text:d,query:s})})]}),a&&(0,Q.jsx)(Xn,{className:`size-4 shrink-0 text-primary`,"aria-hidden":!0})]})}function yl({records:e,onRemove:t,displayField:n=`name`,nameFields:r,avatarField:i=`image`,idField:a=`id`,label:o,onClear:s,clearLabel:c,emptyText:l,className:u}){let d=!!o||!!s&&e.length>0;return(0,Q.jsxs)(`div`,{className:U(`flex flex-col gap-1.5`,u),"data-testid":`selection-tray`,children:[d&&(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[o&&(0,Q.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:o}),s&&e.length>0&&(0,Q.jsx)(`button`,{type:`button`,onClick:s,className:`text-xs text-muted-foreground transition-colors hover:text-foreground`,"data-testid":`selection-clear`,children:c??`Clear all`})]}),e.length===0?(0,Q.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:l??``}):(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map(e=>{let o=hl(e,a),s=dl(e,r??n),c=ml(e,i),l=fl(s);return(0,Q.jsxs)(`span`,{"data-testid":`selection-chip`,className:`inline-flex items-center gap-1.5 rounded-full border bg-background py-0.5 pl-0.5 pr-1.5 text-sm`,children:[(0,Q.jsxs)(Ve,{className:`size-6 shrink-0`,children:[c&&(0,Q.jsx)(Sn,{src:c,alt:s}),(0,Q.jsx)(un,{className:`text-[10px]`,children:l})]}),(0,Q.jsx)(`span`,{className:`max-w-[10rem] truncate`,children:s||`—`}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>t(o),"aria-label":`Remove ${s}`,className:`rounded-full p-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,Q.jsx)(Er,{className:`size-3.5`,"aria-hidden":!0})})]},String(o))})})]})}var bl=`objectui:lookup:recent:`,xl=5;function Sl(){try{return typeof localStorage<`u`?localStorage:null}catch{return null}}function Cl(e){let t=Sl();if(!e||!t)return[];try{let n=t.getItem(bl+e);if(!n)return[];let r=JSON.parse(n);return Array.isArray(r)?r.slice(0,xl):[]}catch{return[]}}function wl(e,t){let n=Sl();if(e&&t!=null&&t!==``&&n)try{let r=[t,...Cl(e).filter(e=>e!==t)].slice(0,xl);n.setItem(bl+e,JSON.stringify(r))}catch{}}var Tl=25,El=6;function Dl({open:e,onOpenChange:t,title:n,multiple:r=!1,dataSource:i,objectName:a,displayField:s=`name`,idField:c=`id`,subtitleFields:l,avatarField:u=`image`,expand:d,searchFields:p,pageSize:m=Tl,lookupFilters:h,baseFilter:g,value:_,onSelect:v,onSelectRecords:y,inline:b=!1,trigger:x}){let{t:S}=zr(),C=M(),T=(0,$.useMemo)(()=>{let e={...h?.length?il(h):{},...g??{}};return Object.keys(e).length>0?e:void 0},[h,g]),E=ws(),D=(0,$.useMemo)(()=>{let e;if(d&&d.length)e=d;else{let t=new Set;(l??[]).forEach(e=>{e.includes(`.`)&&t.add(e.split(`.`)[0])}),e=Array.from(t)}let t=e.filter(e=>!E.isLoaded||E.checkField(a,e,`read`));return t.length?t:void 0},[d,l,E,a]),O=(0,$.useMemo)(()=>l?.filter(e=>!E.isLoaded||E.checkField(a,e.split(`.`)[0],`read`)),[l,E,a]),k=(0,$.useMemo)(()=>!E.isLoaded||E.checkField(a,u.split(`.`)[0],`read`)?u:null,[u,E,a]),A=(0,$.useMemo)(()=>ul(s).filter(e=>!E.isLoaded||E.checkField(a,e.split(`.`)[0],`read`)),[s,E,a]),j=Yc({dataSource:i,objectName:a,enabled:e,pageSize:m,filter:T,expand:D,searchFields:p}),ee=(0,$.useMemo)(()=>e?Cl(a):[],[e,a]),N=(0,$.useMemo)(()=>r?Array.isArray(_)?_:[]:_!=null&&_!==``?[_]:[],[r,_]),P=Yc({dataSource:i,objectName:a,enabled:e&&N.length>0,pageSize:Math.max(1,N.length),filter:{[c]:{$in:N}},expand:D}),F=(0,$.useMemo)(()=>{let e={[c]:{$in:ee}};if(!T)return{ok:!0,node:e};let t=lt(T);return t.ok?{ok:!0,node:nt(t.node,e)}:t},[T,c,ee]),te=F.ok?void 0:F.refusal,ne=Yc({dataSource:i,objectName:a,enabled:e&&ee.length>0&&F.ok,pageSize:Math.max(1,ee.length),filter:F.ok?F.node:void 0,expand:D}),I=(0,$.useMemo)(()=>{let e=new Map;for(let t of P.records)e.set(String(hl(t,c)),t);return e},[P.records,c]),[L,R]=(0,$.useState)([]),z=(0,$.useRef)(!1),B=(0,$.useRef)(!1);(0,$.useEffect)(()=>{e||(z.current=!1,B.current=!1,R([]))},[e]),(0,$.useEffect)(()=>{if(!e||z.current)return;if(N.length===0){z.current=!0;return}if(P.loading){B.current=!0;return}if(!B.current)return;let t=N.map(e=>I.get(String(e))).filter(Boolean);R(t),z.current=!0},[e,N,P.loading,I]);let V=(0,$.useMemo)(()=>new Set(L.map(e=>String(hl(e,c)))),[L,c]),H=(0,$.useCallback)((e,n)=>{v(r?e:e[0]??null),y?.(n),e.forEach(e=>wl(a,e)),t(!1)},[r,a,v,y,t]),ie=(0,$.useCallback)(e=>{v(e.map(e=>hl(e,c))),y?.(e)},[v,y,c]),ae=(0,$.useCallback)(e=>{let t=hl(e,c);if(!r){H([t],[e]);return}let n=String(t),i=L.some(e=>String(hl(e,c))===n),o=i?L.filter(e=>String(hl(e,c))!==n):[...L,e];R(o),b&&(i||wl(a,t),ie(o))},[r,c,H,L,b,a,ie]),W=(0,$.useCallback)(e=>{let t=String(e),n=L.filter(e=>String(hl(e,c))!==t);R(n),b&&ie(n)},[c,L,b,ie]),oe=(0,$.useCallback)(()=>{H(L.map(e=>hl(e,c)),L)},[H,L,c]),se=j.search.trim().length>0,G=(0,$.useMemo)(()=>{if(se)return[];let e=new Map(ne.records.map(e=>[String(hl(e,c)),e]));return ee.map(t=>e.get(String(t))).filter(Boolean)},[se,ee,ne.records,c]),K=(0,$.useMemo)(()=>{if(se)return j.records;let e=new Set(ee.map(String));return j.records.filter(t=>!e.has(String(hl(t,c))))},[se,j.records,ee,c]),le=(0,$.useMemo)(()=>[...G,...K],[G,K]),[ue,fe]=(0,$.useState)(-1),pe=(0,$.useMemo)(()=>j.records.map(e=>String(hl(e,c))).join(`\0`),[j.records,c]),me=`${j.search}\u0000${pe}`,[he,ge]=(0,$.useState)(me);he!==me&&(ge(me),fe(-1)),(0,$.useEffect)(()=>{fe(e=>e>=le.length?le.length-1:e)},[le.length]);let _e=(0,$.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),fe(e=>le.length?Math.min(le.length-1,e+1):-1)):e.key===`ArrowUp`?(e.preventDefault(),fe(e=>Math.max(0,e-1))):e.key===`Enter`?ue>=0&&ue<le.length&&(e.preventDefault(),ae(le[ue])):e.key===`Backspace`&&j.search.length===0&&r&&L.length>0&&W(hl(L[L.length-1],c))},[le,ue,ae,j.search,r,L,W,c]),q=j.error??te?.message??null,ve=j.loading&&!q&&j.records.length===0&&G.length===0,ye=j.loading&&!ve,be=!j.loading&&!q&&K.length===0&&G.length===0,xe=(e,t)=>{let n=hl(e,c);return(0,Q.jsx)(vl,{record:e,displayField:s,nameFields:A,subtitleFields:O,avatarField:k,selected:V.has(String(n)),active:t===ue,highlightQuery:j.search,onSelect:ae},String(n))},Se=n||S(`lookup.selectRecord`),we=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(vr,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`,"aria-hidden":!0}),(0,Q.jsx)(o,{autoFocus:!C,value:j.search,onChange:e=>j.setSearch(e.target.value),onKeyDown:_e,placeholder:S(`table.search`),className:`px-8`,role:`combobox`,"aria-expanded":!0,"aria-controls":`people-picker-list`,"data-testid":`people-picker-search`}),j.loading&&(0,Q.jsx)(fr,{className:`pointer-events-none absolute right-2.5 top-1/2 size-4 -translate-y-1/2 animate-spin text-muted-foreground`,"aria-hidden":!0})]}),(0,Q.jsx)(Wt,{className:`min-h-0 flex-1`,"data-testid":`people-picker-list`,children:(0,Q.jsx)(`div`,{id:`people-picker-list`,role:`listbox`,"aria-busy":j.loading,className:U(`flex flex-col gap-0.5 pr-2 transition-opacity`,ye&&`opacity-70`),children:q?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center text-sm text-muted-foreground`,"data-testid":`people-picker-error`,children:[(0,Q.jsx)(er,{className:`size-5 text-destructive`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`max-w-xs`,children:q}),j.error?(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:j.refetch,children:S(`lookup.retry`)}):null]}):ve?Array.from({length:El}).map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 px-2 py-1.5`,children:[(0,Q.jsx)(w,{className:`size-9 shrink-0 rounded-full`}),(0,Q.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Q.jsx)(w,{className:`h-3 w-1/3`}),(0,Q.jsx)(w,{className:`h-2.5 w-1/2`})]})]},t)):(0,Q.jsxs)(Q.Fragment,{children:[G.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`px-2 py-1 text-xs font-medium text-muted-foreground`,children:S(`lookup.recentlyUsed`)}),G.map((e,t)=>xe(e,t)),K.length>0&&(0,Q.jsxs)(`div`,{className:`mt-1 flex items-center gap-1.5 px-2 py-1 text-xs font-medium text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:S(`lookup.allResults`)}),(0,Q.jsxs)(`span`,{className:`font-normal opacity-70`,children:[`· `,j.total]})]})]}),K.map((e,t)=>xe(e,G.length+t)),be&&(0,Q.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:S(`lookup.noRecords`)})]})})}),r&&!b&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(yl,{records:L,onRemove:W,onClear:()=>R([]),clearLabel:S(`lookup.clear`),displayField:s,nameFields:A,avatarField:k,idField:c,label:S(`table.selected`,{count:L.length}),className:U(`border-t pt-3`)}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:S(`common.cancel`)}),(0,Q.jsx)(J,{type:`button`,onClick:oe,children:S(`common.confirm`)})]})]})]});return b?C?(0,Q.jsxs)(re,{open:e,onOpenChange:t,children:[(0,Q.jsx)(Ce,{asChild:!0,children:x}),(0,Q.jsxs)(de,{side:`bottom`,className:`flex h-[85vh] flex-col gap-3`,"data-testid":`people-picker-sheet`,children:[(0,Q.jsx)(Cn,{className:`text-left`,children:(0,Q.jsx)(f,{children:Se})}),we]})]}):(0,Q.jsxs)(ke,{open:e,onOpenChange:t,children:[(0,Q.jsx)(ce,{asChild:!0,children:x}),(0,Q.jsx)(Fe,{align:`start`,className:`flex max-h-[min(28rem,60vh)] w-[var(--radix-popover-trigger-width)] min-w-72 flex-col gap-3 p-3`,"data-testid":`people-picker-inline`,children:we})]}):C?(0,Q.jsx)(re,{open:e,onOpenChange:t,children:(0,Q.jsxs)(de,{side:`bottom`,className:`flex h-[85vh] flex-col gap-3`,"data-testid":`people-picker-sheet`,children:[(0,Q.jsx)(Cn,{className:`text-left`,children:(0,Q.jsx)(f,{children:Se})}),we]})}):(0,Q.jsx)(nn,{open:e,onOpenChange:t,children:(0,Q.jsxs)(It,{className:`flex max-h-[80vh] flex-col gap-3 sm:max-w-lg`,"data-testid":`people-picker-dialog`,children:[(0,Q.jsx)(Ge,{children:(0,Q.jsx)(Bt,{children:Se})}),we]})})}var Ol=new Set([`json`,`object`,`grid`,`html`,`richtext`,`markdown`,`code`,`image`,`file`,`avatar`,`vector`,`location`,`geometry`,`textarea`,`secret`,`password`,`encrypted`]);function kl(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Al(e,{displayField:t,max:n=4}){let r=e?.fields??{},i=e=>r[e]??{},a=e=>{let t=i(e);return{field:e,...t.label?{label:t.label}:{},...t.type?{type:t.type}:{}}};if(Object.keys(r).length===0)return[];let o=e=>!Array.isArray(e)||e.length===0?null:kl([t,...e.filter(e=>typeof e==`string`&&e.length>0).filter(e=>e!==t)]).slice(0,n).map(a);return o(e?.highlightFields)||o(e?.displayFields)||kl([t,...Object.keys(r).filter(e=>{if(e===t)return!1;let n=i(e);return!(ci(e,n)||n.hidden||n.type&&Ol.has(n.type))})]).slice(0,n).map(a)}var jl=n({LookupField:()=>Ul}),Ml=50,Nl=ln,Pl=/^(sys_|cloud_|ai_)/,Fl=new Set([`user`,`users`]);function Il(e){return!!e&&!Pl.test(e)&&!Fl.has(e)}var Ll=`name`;function Rl(e,t,n,r,i,a,o){let s=zl(e,n),c=sa(e,a,o,[n]),l;if(i){let n=A(i,c,{titleField:t}),r=e?.id??e?._id;n===`Untitled`||r!=null&&n===`Record #${r}`||(l=n)}let u=l??c[t??Ll]??c.label??c.name??c.full_name??c.title??c.subject??c.externalId??String(s),d=r?e[r]:void 0,f={value:s,label:String(u),description:d,...e};return c===e?f:{...f,label:String(u)}}function zl(e,t){return e[t]??e.id??e._id??e.externalId}function Bl(e,t,n){let r=new Map(e.map(e=>[zl(e,n),e]));for(let e of t)r.set(zl(e,n),e);return Array.from(r.values())}function Vl(e){if(typeof e!=`string`)return null;let t=e.trim();if(!t.startsWith(`{`)||!t.endsWith(`}`))return null;try{let e=JSON.parse(t);return e&&typeof e==`object`&&!Array.isArray(e)?e:null}catch{return null}}function Hl(e){return{text:`text`,number:`number`,currency:`number`,percent:`number`,select:`select`,status:`select`,date:`date`,datetime:`date`,boolean:`boolean`}[e]}function Ul({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let[s,c]=(0,$.useState)(!1),{t:l}=zr(),{translateOptions:u}=Ze(),d=zn(),f=$.useId(),[p,m]=(0,$.useState)(null),[h,g]=(0,$.useState)([]),[_,v]=(0,$.useState)([]),[y,b]=(0,$.useState)(()=>new Set),[x,S]=(0,$.useState)(-1),C=(0,$.useRef)(null),w=n,T=w?.field,E=T&&typeof T==`object`&&(`reference`in T||`type`in T)?T:w,D=E?.options||[],O=E?.multiple||!1,k=E?.displayField||E?.reference_field||void 0,A=k||Ll,j=E?.descriptionField,M=E?.idField||`id`,N=E?.reference,P=E?.allow_create??E?.allowCreate,F=P==null?Il(N):!!P,te=E?.lookup_columns??E?.lookupColumns,ne=E?.lookup_page_size??E?.lookupPageSize,I=E?.lookupFilters,L=E?.picker,re=E?.subtitle,R=E?.avatar_field??E?.avatarField??`image`,z=E,B=(0,$.useMemo)(()=>{let e=z?.dependsOn;return!e||!Array.isArray(e)?[]:e.map(e=>typeof e==`string`?{field:e,param:e}:{field:e.field,param:e.param??e.field})},[z?.dependsOn]),V=a.dependsOnLabels,H=(0,$.useMemo)(()=>B.map(e=>V?.[e.field]||e.field).join(l(`validation.formInvalidJoiner`)),[B,V,l]),ie=a.dependentValues,ae=(0,$.useContext)(Nl)?.dataSource??null,W=a.dataSource??w?.dataSource??E?.dataSource??ae,oe=(0,$.useMemo)(()=>ie??{},[ie]),se=(0,$.useMemo)(()=>B.length!==0&&B.some(({field:e})=>{let t=oe[e];return t==null||t===``||Array.isArray(t)&&t.length===0}),[B,oe]),G=W!=null&&typeof W.find==`function`&&!!N,[K,le]=(0,$.useState)(null);(0,$.useEffect)(()=>{if(!W||!N)return;let e=W.getObjectSchema;if(typeof e!=`function`)return;let t=!0;return Promise.resolve(e.call(W,N)).then(e=>{t&&le(e)}).catch(()=>{}),()=>{t=!1}},[W,N]);let ue=(0,$.useMemo)(()=>{if(te&&te.length>0)return te;let e=Al(K,{displayField:A});return e.length>0?e:void 0},[te,K,A]),de=(0,$.useMemo)(()=>{if(j)return j;let e=ue?.find(e=>(typeof e==`string`?e:e.field)!==A);if(e)return typeof e==`string`?e:e.field},[j,ue,A]),fe=(0,$.useMemo)(()=>{let e=[],t=new Set([A]);j&&(e.push({field:j}),t.add(j));for(let n of ue??[]){let r=Xc(n);t.has(r.field)||(t.add(r.field),e.push(r))}return e},[j,ue,A]),pe=(0,$.useMemo)(()=>$c(fe,K?.fields,N??``,u),[fe,K,N,u]),me=ws(),he=(0,$.useMemo)(()=>{if(fe.length===0)return[];let e=Ie(K?.fields,fe);return!me.isLoaded||!N?e:e.filter(e=>me.checkField(N,e,`read`))},[K,fe,me,N]),ge=(0,$.useMemo)(()=>fe.filter(e=>!me.isLoaded||!N||e.field===M||me.checkField(N,e.field,`read`)),[fe,me,N,M]),_e=(0,$.useMemo)(()=>{if(!ue)return;let e=[];for(let t of ue)if(typeof t==`object`&&t.type){let n=Hl(t.type);n&&e.push({field:t.field,label:t.label,type:n})}return e.length>0?e:void 0},[ue]),q=a.onCreateNew??w?.onCreateNew,[ve,ye]=(0,$.useState)(!1),be=(0,$.useMemo)(()=>{let e={};for(let{field:t,param:n}of B){let r=oe[t];r!=null&&r!==``&&(e[n]=typeof r==`number`?r:String(r))}return Object.keys(e).length>0?e:void 0},[B,oe]),xe=(0,$.useMemo)(()=>{let e={...I&&I.length>0?il(I):{},...be??{}};return Object.keys(e).length>0?e:void 0},[be,I]),Se=Yc({dataSource:W,objectName:N,enabled:s&&G&&!se,pageSize:Ml,filter:xe,expand:he}),Ce=Se.search,we=Se.loading,Te=Se.total,Ee=Se.error??p,De=(0,$.useMemo)(()=>Se.records.map(e=>Rl(ee(e,K?.fields),k,M,de,K,me,N)),[Se.records,k,M,de,K,me,N]),Oe=G?De:D,Ae=(0,$.useMemo)(()=>{if(G||!Ce)return Oe;let e=Ce.toLowerCase();return Oe.filter(t=>t.label.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e))},[G,Oe,Ce]);(0,$.useEffect)(()=>{S(-1)},[Ae.length]),(0,$.useEffect)(()=>{s||S(-1)},[s]);let je=(0,$.useCallback)(e=>Se.setSearch(e),[Se.setSearch]);(0,$.useEffect)(()=>{if(!G||!W||!N)return;let t=(O?Array.isArray(e)?e:[]:e!=null&&e!==``?[e]:[]).filter(e=>e!=null&&e!==``&&typeof e!=`object`&&!Vl(e));if(!t.length)return;let n=t.filter(e=>!Pe(e));if(!n.length)return;let r=!1;return(async()=>{try{let e=[];if(n.length===1){let t=n[0];if(typeof W.findOne==`function`&&M===`id`){let n=await W.findOne(N,t);n&&e.push(n)}else{let n=await W.find(N,{$filter:{[M]:t},$top:1}),r=n?.data??n??[];r[0]&&e.push(r[0])}}else{let t=[];for(let e=0;e<n.length;e+=Ml)t.push(n.slice(e,e+Ml));let r=await Promise.all(t.map(e=>W.find(N,{$filter:{[M]:{$in:e}},$top:e.length})));for(let t of r){let n=t?.data??t??[];if(Array.isArray(n))for(let t of n)e.push(t)}}!r&&e.length&&v(t=>Bl(t,e,M))}catch{}finally{r||b(e=>{let t=new Set(e);for(let e of n)t.add(String(e));return t})}})(),()=>{r=!0}},[e,G,N,M,O]);let[Me,Ne]=(0,$.useMemo)(()=>{let e=e=>Rl(e,k,M,de,K,me,N);return[h.map(e),_.map(e)]},[h,_,k,M,de,K,me,N]),Pe=(0,$.useCallback)(e=>D.find(t=>t.value===e)??De.find(t=>t.value===e)??Me.find(t=>t.value===e)??Ne.find(t=>t.value===e),[D,De,Me,Ne]),Le=(0,$.useCallback)(e=>{let t=String(e);return D.find(e=>String(e.value)===t)??De.find(e=>String(e.value)===t)??Me.find(e=>String(e.value)===t)??Ne.find(e=>String(e.value)===t)},[D,De,Me,Ne]),Re=(0,$.useCallback)(e=>{let t=typeof e==`object`&&e?e:Vl(e);return t?t[M]??t.id??t._id??t.externalId:e},[M]),ze=(0,$.useMemo)(()=>O?Array.isArray(e)?e.map(Re):[]:Re(e),[O,e,Re]),Be=(0,$.useCallback)(e=>{if(e==null||e===``)return;let t=typeof e==`object`?e:Vl(e);return t?Rl(t,k,M,de,K,me,N):Pe(e)??Le(e)},[Pe,Le,k,M,de,K,me,N]),He=(0,$.useMemo)(()=>G?(O?Array.isArray(e)?e:[]:e!=null&&e!==``?[e]:[]).some(e=>e!=null&&e!==``&&typeof e!=`object`&&!Vl(e)&&!Pe(e)&&!Le(e)&&!y.has(String(e))):!1,[G,O,e,Pe,Le,y]),We=O?(Array.isArray(e)?e:[]).filter(e=>e!=null&&e!==``).length:+(e!=null&&e!==``),Ge=O?(Array.isArray(e)?e:[]).map(Be).filter(Boolean):e?[Be(e)].filter(Boolean):[],Ke=a.onSelectRecord,qe=(0,$.useCallback)((n,r)=>{if(r&&n&&n.value!=null&&g(e=>Bl(e,[r],M)),O){let r=(Array.isArray(e)?e:[]).map(Re);r.includes(n.value)?t(r.filter(e=>e!==n.value)):(N&&wl(N,n.value),t([...r,n.value]))}else N&&wl(N,n.value),Ke?Ke(n):t(n.value),c(!1)},[O,e,t,Ke,N,Re,M]),Je=n=>{t(O?(Array.isArray(e)?e:[]).map(Re).filter(e=>e!==n):null)},Ye=(0,$.useCallback)(e=>{N&&e.forEach(e=>wl(N,zl(e,M))),g(e)},[M,N]),[Xe,Qe]=(0,$.useState)([]),$e=he.join(`,`);(0,$.useEffect)(()=>{if(!s||!G||!W||!N||Ce)return;if(se){Qe([]);return}let e=Cl(N);if(!e.length){Qe([]);return}let t=!1;return(async()=>{try{let n={[M]:{$in:e}},r=await W.find(N,{$filter:xe?nt(xe,n):n,$top:e.length,...he.length>0?{$expand:he}:{}}),i=r?.data??r??[],a=new Map;if(Array.isArray(i))for(let e of i){let t=ee(e,K?.fields),n=t?.[M]??t?.id??t?._id;n!=null&&a.set(String(n),e)}let o=e.map(e=>a.get(String(e))).filter(Boolean);t||Qe(o)}catch{t||Qe([])}})(),()=>{t=!0}},[s,G,N,Ce,se,xe,M,$e]);let et=(0,$.useMemo)(()=>Xe.map(e=>Rl(ee(e,K?.fields),k,M,de,K,me,N)),[Xe,k,M,de,K,me,N]),tt=(0,$.useMemo)(()=>{let e=new Map;for(let t of[...Xe,...Se.records]){let n=ee(t,K?.fields),r=n?.[M]??n?.id??n?._id??n?.externalId;r!=null&&!e.has(String(r))&&e.set(String(r),t)}return e},[Xe,Se.records,K,M]),rt=(0,$.useCallback)(e=>{let t=tt.get(String(e.value));qe(e,t?ee(t,K?.fields):void 0)},[tt,K,qe]),it=!Ce&&G?et.length:0,at=(0,$.useMemo)(()=>{if(Ce||!G||et.length===0)return Ae;let e=new Set(et.map(e=>e.value));return[...et,...Ae.filter(t=>!e.has(t.value))]},[Ce,G,et,Ae]);(0,$.useEffect)(()=>{S(-1)},[at.length]);let[ot,st]=(0,$.useState)(!1),{execute:ct}=bt(),lt=Ue(),ut=!!q||F&&(lt||G),dt=(0,$.useCallback)(async e=>{let t=(e||``).trim();if(q){q(t),c(!1);return}if(F&&N){if(m(null),lt){c(!1),await new Promise(e=>setTimeout(e,0));let e=await ct({type:`modal`,modal:{objectName:N,mode:`create`}});if(e?.success&&e.data){let t=Rl(e.data,k,M,de,K,me,N);qe(t,e.data);return}if(!(e?.success&&e.modal))return}if(W&&t){st(!0);try{let e=await W.create(N,{[A]:t}),n=Rl(e,k,M,de,K,me,N);qe(n,e)}catch(e){m(e instanceof Error?e.message:String(e))}finally{st(!1)}}}},[q,F,N,lt,ct,W,A,k,M,de,K,qe,me]),ft=(0,$.useCallback)(e=>{let t=tt.get(String(e.value)),n=t?{...e,...t}:e,r=ge.filter(e=>{let t=n[e.field];return t!=null&&t!==``});return r.length===0?null:r.map((e,t)=>(0,Q.jsxs)($.Fragment,{children:[t>0&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 opacity-60`,children:`·`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 truncate`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 opacity-70`,children:`${e.label||Zc(e.field)}:`}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,"data-lookup-preview":e.field,children:el(n,e,{descriptors:pe,cellRenderer:Xs(),displayLocale:d})})]})]},e.field))},[tt,ge,pe,d]),pt=(0,$.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),S(e=>e<at.length-1?e+1:e)):e.key===`ArrowUp`?(e.preventDefault(),S(e=>e>0?e-1:0)):e.key===`Enter`&&(e.preventDefault(),x>=0&&x<at.length&&rt(at[x]))},[at,x,rt]);if((0,$.useEffect)(()=>{x>=0&&C.current&&C.current.querySelector(`[data-lookup-index="${x}"]`)?.scrollIntoView({block:`nearest`})},[x]),r)return Ge.length?O?(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Ge.map((e,t)=>(0,Q.jsx)(mt,{variant:`outline`,children:e?.label||e?.[A]},t))}):(0,Q.jsx)(`span`,{className:`text-sm`,children:Ge[0]?.label||Ge[0]?.[A]}):He?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-sm text-muted-foreground`,"data-testid":`lookup-hydrating`,children:[(0,Q.jsx)(fr,{className:`size-3.5 animate-spin`}),O?l(`table.selected`,{count:We}):l(`lookup.loading`)]}):(0,Q.jsx)(Y,{});let ht=!!a.compact,gt=Ge[0]?.label||Ge[0]?.[A],{name:_t,...vt}=Z(a),yt=(0,Q.jsxs)(J,{...vt,variant:`outline`,className:U(`min-w-0 max-w-full flex-1 justify-start text-left font-normal`,ht&&`h-8 rounded-none border-0 bg-transparent px-2 shadow-none focus-visible:ring-1 focus-visible:ring-ring/60`),type:`button`,disabled:se||a.disabled,"data-testid":se?`lookup-trigger-gated`:a.name||w?.name?`lookup-trigger-${a.name||w.name}`:`lookup-trigger`,title:se?l(`lookup.selectFirst`,{fields:H}):void 0,"aria-invalid":!!i,children:[He?(0,Q.jsx)(fr,{className:U(`size-4 shrink-0 animate-spin text-muted-foreground`,ht?`mr-1.5`:`mr-2`),"data-testid":`lookup-hydrating`}):(0,Q.jsx)(vr,{className:U(`size-4 shrink-0 text-muted-foreground`,ht?`mr-1.5`:`mr-2`)}),(0,Q.jsx)(`span`,{className:U(`truncate`,ht&&Ge.length===0&&`text-muted-foreground`),children:se?l(`lookup.selectFirst`,{fields:H}):He?O?l(`table.selected`,{count:We}):l(`lookup.loading`):ht&&!O&&Ge.length>0?gt:Ge.length===0?w?.placeholder||l(`common.select`):O?l(`table.selected`,{count:Ge.length}):l(`common.select`)})]}),xt=!a.disabled,St=e=>{let t=sa(e,me,N,[M]),n=t?.[R]||t?.image;return n?String(n):void 0};return(0,Q.jsxs)(`div`,{className:ht?``:`space-y-2`,children:[Ge.length>0&&!ht&&(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Ge.map((e,t)=>{let n=e?.label||e?.[A];if(L===`search`){let r=St(e);return(0,Q.jsxs)(`span`,{"data-testid":`people-field-chip`,className:`inline-flex items-center gap-1.5 rounded-full border bg-background py-0.5 pl-0.5 pr-1.5 text-sm`,children:[(0,Q.jsxs)(Ve,{className:`size-6 shrink-0`,children:[r&&(0,Q.jsx)(Sn,{src:r,alt:String(n||``)}),(0,Q.jsx)(un,{className:`text-[10px]`,children:fl(String(n||``))})]}),(0,Q.jsx)(`span`,{className:`max-w-[10rem] truncate`,children:n}),xt&&(0,Q.jsx)(`button`,{onClick:()=>Je(e?.value),className:`rounded-full p-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,type:`button`,"aria-label":l(`lookup.remove`,{label:n}),children:(0,Q.jsx)(Er,{className:`size-3`})})]},t)}return(0,Q.jsxs)(mt,{variant:`outline`,className:`gap-1`,children:[n,xt&&(0,Q.jsx)(`button`,{onClick:()=>Je(e?.value),className:`ml-1 hover:text-destructive`,type:`button`,"aria-label":l(`lookup.remove`,{label:n}),children:(0,Q.jsx)(Er,{className:`size-3`})})]},t)})}),L===`search`&&G&&W&&N?(0,Q.jsx)(Dl,{inline:!0,trigger:yt,open:ve,onOpenChange:ye,title:w?.label||l(`common.select`),multiple:O,dataSource:W,objectName:N,displayField:A,idField:M,subtitleFields:re,avatarField:R,pageSize:ne,value:ze,onSelect:t,onSelectRecords:Ye,lookupFilters:I,baseFilter:be}):(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsxs)(ke,{open:s,onOpenChange:e=>{se||c(e)},children:[(0,Q.jsx)(ce,{asChild:!0,children:yt}),(0,Q.jsxs)(Fe,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,children:[(0,Q.jsx)(`div`,{className:`p-2`,children:(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(vr,{className:`absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground`}),(0,Q.jsx)(o,{placeholder:l(`table.search`),value:Ce,onChange:e=>je(e.target.value),onKeyDown:pt,className:`w-full pl-9 h-8 text-sm`,role:`combobox`,"aria-autocomplete":`list`,"aria-controls":f,"aria-expanded":s,"aria-activedescendant":x>=0?`${f}-opt-${x}`:void 0}),we&&(0,Q.jsx)(fr,{className:`absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground`,"data-testid":`lookup-loading`})]})}),Ee&&(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-4 px-2`,role:`alert`,children:[(0,Q.jsx)(er,{className:`size-5 text-destructive`}),(0,Q.jsx)(`p`,{className:`text-sm text-destructive`,children:Ee}),(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>Se.refetch(),type:`button`,children:l(`lookup.retry`)})]}),we&&Ae.length===0&&!Ee&&(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6`,role:`status`,"aria-live":`polite`,children:[(0,Q.jsx)(fr,{className:`size-6 animate-spin text-muted-foreground`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l(`lookup.loading`)})]}),!Ee&&!(we&&Ae.length===0)&&(0,Q.jsx)(`div`,{ref:C,className:`max-h-64 overflow-y-auto px-1 pb-1`,role:`listbox`,id:f,children:at.length===0?(0,Q.jsxs)(`div`,{className:`py-4 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l(`lookup.noOptions`)}),ut&&(0,Q.jsxs)(J,{variant:`ghost`,size:`sm`,className:`mt-2 gap-1`,type:`button`,disabled:ot,onClick:()=>dt(Ce),children:[ot?(0,Q.jsx)(fr,{className:`size-4 animate-spin`}):(0,Q.jsx)(hr,{className:`size-4`}),Ce?l(`lookup.createNamed`,{name:Ce}):l(`lookup.createNew`)]})]}):(0,Q.jsxs)(Q.Fragment,{children:[at.map((t,n)=>{let r=O?(Array.isArray(e)?e:[]).map(Re).includes(t.value):Re(e)===t.value,i=n===x,a=it>0&&n===0,o=it>0&&n===it;return(0,Q.jsxs)($.Fragment,{children:[a&&(0,Q.jsx)(`div`,{className:`px-3 pt-2 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:l(`lookup.recentlyUsed`)}),o&&(0,Q.jsx)(`div`,{className:`mt-1 border-t px-3 pt-2 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:l(`lookup.allResults`)}),(0,Q.jsxs)(`button`,{id:`${f}-opt-${n}`,"data-lookup-index":n,role:`option`,"aria-selected":r,title:String(t.label??``),onClick:()=>rt(t),className:`w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${i?`bg-accent text-accent-foreground`:r?`bg-accent/50 text-accent-foreground`:``}`,type:`button`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block truncate`,children:t.label}),(()=>{let e=ft(t);return e?(0,Q.jsx)(`span`,{className:`flex min-w-0 items-center gap-1 overflow-hidden text-xs text-muted-foreground`,"data-testid":`lookup-option-preview`,children:e}):null})()]}),r&&(0,Q.jsx)(mt,{variant:`default`,className:`ml-2 shrink-0`,children:l(`lookup.selectedBadge`)})]})]},t.value)}),G&&Te>Ae.length&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground text-center py-2`,children:l(`lookup.showingResults`,{shown:Ae.length,total:Te})}),G&&Te>Ae.length&&(0,Q.jsxs)(`button`,{type:`button`,className:`w-full text-center px-3 py-2 rounded-md text-sm font-medium text-primary hover:bg-accent flex items-center justify-center gap-1.5`,onClick:()=>{c(!1),ye(!0)},"data-testid":`show-all-results`,children:[(0,Q.jsx)(Sr,{className:`size-3.5`}),l(`lookup.showAllResults`,{count:Te})]}),ut&&(0,Q.jsxs)(`button`,{type:`button`,className:`w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center gap-1.5 text-muted-foreground`,disabled:ot,onClick:()=>dt(Ce),children:[ot?(0,Q.jsx)(fr,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(hr,{className:`size-3.5`}),Ce?l(`lookup.createNamed`,{name:Ce}):l(`lookup.createNew`)]})]})})]})]}),G&&L!==`search`&&(0,Q.jsx)(J,{variant:`outline`,size:`icon`,className:`shrink-0`,type:`button`,disabled:se||a.disabled,onClick:()=>ye(!0),"aria-label":l(`lookup.browseAll`),title:se?l(`lookup.selectFirst`,{fields:H}):l(`lookup.browseAll`),"data-testid":`browse-all-records`,children:(0,Q.jsx)(Sr,{className:`size-4`})})]}),G&&W&&N&&L!==`search`&&(0,Q.jsx)(cl,{open:ve,onOpenChange:ye,title:w?.label||l(`common.select`),multiple:O,dataSource:W,objectName:N,columns:ue,displayField:k,objectSchema:K,idField:M,pageSize:ne,value:ze,onSelect:t,onSelectRecords:Ye,lookupFilters:I,baseFilter:be,cellRenderer:Xs(),fieldsMeta:K?.fields,filterColumns:_e})]})}var Wl=n({UserField:()=>Kl});function Gl(e){let t=Array.isArray(e)?e:[];return t.some(e=>e?.field===`banned`)?t:[...t,{field:`banned`,operator:`ne`,value:!0}]}function Kl(e){let t=e.field,n=t?.field&&typeof t.field==`object`&&(`reference`in t.field||`type`in t.field),r=n?t.field:t,i={...r||{},reference:r?.reference||`sys_user`,displayField:r?.displayField||r?.reference_field||`name`,picker:r?.picker??`search`,subtitle:r?.subtitle??[`primary_business_unit_id.name`,`email`],avatar_field:r?.avatar_field??r?.avatarField??`image`,lookupFilters:Gl(r?.lookupFilters)},a=n?{...t,field:i}:i;return(0,Q.jsx)(Ul,{...e,field:a})}var ql=n({ColorField:()=>Jl});function Jl({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let s=n;return r?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`w-6 h-6 rounded border border-input`,style:{backgroundColor:e||`#000000`}}),(0,Q.jsx)(`span`,{className:`text-sm`,children:e||(0,Q.jsx)(Y,{})})]}):(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`color`,value:e||`#000000`,onChange:e=>t(e.target.value),disabled:r||a.disabled,className:`w-10 h-10 rounded border border-input cursor-pointer`,"aria-invalid":!!i}),(0,Q.jsx)(o,{...Z(a),type:`text`,value:e||``,onChange:e=>t(e.target.value),placeholder:s?.placeholder||`#000000`,disabled:r||a.disabled,className:a.className,pattern:`^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$`,"aria-invalid":!!i})]})}var Yl=n({AddressField:()=>Xl});function Xl({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let s=e||{},{id:c,"aria-labelledby":l,...u}=Z(a),d=Br(a,`instead-of-the-inputs`),f=Br(a,`above-the-inputs`),p=(0,$.useId)(),m=e=>`${p}-${e}`,{t:h}=zr(),g=zn(),_=Ds(s),v=(e,n)=>{let r={...s};delete r.zipCode,t({...r,..._?{postalCode:_}:null,[e]:n})};if(r){let e=js(s,g);return e?(0,Q.jsx)(`span`,{...d,className:`text-sm`,children:e}):(0,Q.jsx)(Y,{...d})}return(0,Q.jsxs)(`div`,{className:`space-y-3`,...f,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(ot,{htmlFor:m(`street`),className:`text-xs`,children:h(`fields.address.street`)}),(0,Q.jsx)(o,{...u,id:m(`street`),type:`text`,value:s.street||``,onChange:e=>v(`street`,e.target.value),disabled:r||a.disabled,className:a.className,"aria-invalid":!!i})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(ot,{htmlFor:m(`city`),className:`text-xs`,children:h(`fields.address.city`)}),(0,Q.jsx)(o,{id:m(`city`),type:`text`,value:s.city||``,onChange:e=>v(`city`,e.target.value),disabled:r||a.disabled,"aria-invalid":!!i})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(ot,{htmlFor:m(`state`),className:`text-xs`,children:h(`fields.address.state`)}),(0,Q.jsx)(o,{id:m(`state`),type:`text`,value:s.state||``,onChange:e=>v(`state`,e.target.value),disabled:r||a.disabled,"aria-invalid":!!i})]})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(ot,{htmlFor:m(`postalCode`),className:`text-xs`,children:h(`fields.address.postalCode`)}),(0,Q.jsx)(o,{id:m(`postalCode`),type:`text`,value:_||``,onChange:e=>v(`postalCode`,e.target.value),disabled:r||a.disabled,"aria-invalid":!!i})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(ot,{htmlFor:m(`country`),className:`text-xs`,children:h(`fields.address.country`)}),(0,Q.jsx)(o,{id:m(`country`),type:`text`,value:s.country||``,onChange:e=>v(`country`,e.target.value),disabled:r||a.disabled,"aria-invalid":!!i})]})]})]})}var Zl=n({LocationField:()=>fu});function Ql(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let{lat:t,lng:n}=e;return $l(t)&&$l(n)}function $l(e){return typeof e==`number`&&Number.isFinite(e)}function eu(e){return _t.safeParse(e).success}function tu(e,t,n){let r={lat:e,lng:t};return Ql(n)?($l(n.altitude)&&(r.altitude=n.altitude),$l(n.accuracy)&&(r.accuracy=n.accuracy),r):r}function nu(e){return Ql(e)?`${e.lat}, ${e.lng}`:``}var ru=/^[+-]?(?:Infinity|(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)$/,iu=[`latitude`,`longitude`];function au(e){if(!e.trim())return{kind:`cleared`};let t=e.split(`,`).map(e=>e.trim());if(t.length!==2)return{kind:`unparsable`};let n=parseFloat(t[0]),r=parseFloat(t[1]);if(isNaN(n)||isNaN(r))return{kind:`unparsable`};let i=iu.map((e,n)=>({label:e,text:t[n]})).filter(e=>!ru.test(e.text));return i.length>0?{kind:`residue`,residue:i}:{kind:`pair`,lat:n,lng:r}}function ou(e,t){let n=au(e);return n.kind===`cleared`?!Ql(t):n.kind===`pair`&&Ql(t)&&t.lat===n.lat&&t.lng===n.lng}function su(e){return e(`fields.location.refusedFormat`)}function cu(e,t){let n=_t.safeParse(t);return n.success?``:e(`fields.location.refusedRange`,{detail:n.error.issues.map(e=>`${e.path.join(`.`)||`value`}: ${e.message}`).join(`; `)})}function lu(e,t){let[n,r]=t.map(t=>({name:uu(e,t.label),text:t.text}));return r?e(`fields.location.refusedResidue`,{name:n.name,text:n.text,otherName:r.name,otherText:r.text}):e(`fields.location.refusedResidueOne`,{name:n.name,text:n.text})}function uu(e,t){return e(t===`latitude`?`fields.location.latitude`:`fields.location.longitude`)}function du(e){return iu.map(t=>uu(e,t)).join(`, `)}function fu({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let s=n,[c,l]=(0,$.useState)(()=>nu(e)),[u,d]=(0,$.useState)(null),{t:f}=zr(),p=(0,$.useRef)(e);if((0,$.useEffect)(()=>{Object.is(p.current,e)||(p.current=e,!u&&(ou(c,e)||l(nu(e))))},[e,c,u]),r)return(0,Q.jsx)(`span`,{className:`text-sm`,children:nu(e)||(0,Q.jsx)(Y,{})});let m=n=>{let r=n.target.value;l(r);let i=au(r);if(i.kind===`cleared`){d(null),t(null);return}if(i.kind===`unparsable`){d(su(f));return}if(i.kind===`residue`){d(lu(f,i.residue));return}let a=tu(i.lat,i.lng,e);if(eu(a)){d(null),t(a);return}d(cu(f,a))};return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(o,{...Z(a),type:`text`,value:c,onChange:m,placeholder:s?.placeholder||du(f),disabled:r||a.disabled,className:U(u?`border-red-500 focus-visible:ring-red-500`:``,a.className),"aria-invalid":!!i||!!u}),u&&(0,Q.jsx)(`p`,{className:`text-xs text-red-500`,children:u})]})}var pu=n({GeolocationField:()=>gu}),mu=e=>typeof e==`number`&&!Number.isNaN(e),hu=e=>mu(e.latitude)&&mu(e.longitude);function gu({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let[s,c]=$.useState(!1),l=cc(`30.2741`),u=cc(`120.1551`),d=e||{},{id:f,"aria-labelledby":p,...m}=Z(a),h=Br(a,`instead-of-the-inputs`),g=Br(a,`above-the-inputs`),_=(0,$.useId)(),v=e=>`${_}-${e}`,y=(e,n)=>{t({...d,[e]:n?Number(n):null})},b=e=>{l.readBadInput(e.target),m.onBlur?.(e)},x=()=>{if(!navigator.geolocation){console.error(`Geolocation is not supported by this browser`);return}c(!0),navigator.geolocation.getCurrentPosition(e=>{t({latitude:e.coords.latitude,longitude:e.coords.longitude,accuracy:e.coords.accuracy}),c(!1)},e=>{console.error(`Error getting location:`,e.message),c(!1)},{enableHighAccuracy:!0,timeout:5e3,maximumAge:0})},S=e=>hu(e)?`${e.latitude.toFixed(6)}, ${e.longitude.toFixed(6)}`:``,C=()=>{if(!hu(d))return;let e=`https://www.google.com/maps?q=${d.latitude},${d.longitude}`;window.open(e,`_blank`)};if(r){let e=S(d);return(0,Q.jsxs)(`div`,{...h,className:`flex items-center gap-2`,children:[(0,Q.jsx)(pr,{className:`w-4 h-4 text-muted-foreground`}),e?(0,Q.jsx)(`span`,{className:`text-sm`,children:e}):(0,Q.jsx)(Y,{}),hu(d)&&(0,Q.jsx)(J,{type:`button`,variant:`link`,size:`sm`,onClick:C,className:`p-0 h-auto`,children:`View on map`})]})}return(0,Q.jsxs)(`div`,{className:`space-y-3`,...g,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:x,disabled:r||s,children:[(0,Q.jsx)(ir,{className:`w-4 h-4 mr-2`}),s?`Getting location...`:`Use Current Location`]}),hu(d)&&(0,Q.jsxs)(J,{type:`button`,variant:`link`,size:`sm`,onClick:C,children:[(0,Q.jsx)(pr,{className:`w-4 h-4 mr-2`}),`View on map`]})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(ot,{htmlFor:v(`latitude`),className:`text-xs`,children:`Latitude`}),(0,Q.jsx)(o,{...m,id:v(`latitude`),type:`number`,value:d.latitude??``,onChange:e=>{l.readBadInput(e.target),y(`latitude`,e.target.value)},onBlur:b,placeholder:`37.7749`,disabled:r||a.disabled,step:`any`,className:U(l.refusal?uc:``,a.className),"aria-invalid":!!i||!!l.refusal}),(0,Q.jsx)(lc,{refusal:l.refusal})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(ot,{htmlFor:v(`longitude`),className:`text-xs`,children:`Longitude`}),(0,Q.jsx)(o,{id:v(`longitude`),type:`number`,value:d.longitude??``,onChange:e=>{u.readBadInput(e.target),y(`longitude`,e.target.value)},onBlur:e=>u.readBadInput(e.target),placeholder:`-122.4194`,disabled:r||a.disabled,step:`any`,className:u.refusal?uc:void 0,"aria-invalid":!!i||!!u.refusal}),(0,Q.jsx)(lc,{refusal:u.refusal})]})]}),mu(d.accuracy)&&(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Accuracy: ±`,d.accuracy.toFixed(0),`m`]})]})}var _u=n({CodeField:()=>vu});function vu({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=n,s=o?.language??`javascript`;return r?(0,Q.jsx)(`pre`,{className:U(`text-sm bg-muted p-2 rounded overflow-x-auto border`,a.className),children:(0,Q.jsx)(`code`,{children:e||(0,Q.jsx)(Y,{})})}):(0,Q.jsx)(Re,{...Z(a),value:e||``,onChange:e=>t(e.target.value),placeholder:o?.placeholder||`// Write ${s} code here...`,disabled:r||a.disabled,className:U(`font-mono text-sm`,a.className),rows:12,spellCheck:!1,"aria-invalid":!!i})}var yu=n({ObjectField:()=>Su});function bu(e){return e==null?``:JSON.stringify(e,null,2)}function xu(e,t){if(!e.trim())return t==null;try{return JSON.stringify(JSON.parse(e))===JSON.stringify(t)}catch{return!1}}function Su({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=n,[s,c]=(0,$.useState)(()=>bu(e)),[l,u]=(0,$.useState)(null),{t:d}=zr(),f=(0,$.useRef)(null),p=(0,$.useRef)(e);if((0,$.useEffect)(()=>{Object.is(p.current,e)||(p.current=e,!l&&(xu(s,e)||c(bu(e))))},[e,s,l]),(0,$.useEffect)(()=>{f.current?.setCustomValidity(l??``)},[l]),r)return tn(e)&&!Array.isArray(e)?(0,Q.jsx)(Y,{}):(0,Q.jsx)(`pre`,{className:U(`text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40`,a.className),children:JSON.stringify(e,null,2)});let m=e=>{let n=e.target.value;if(c(n),!n.trim()){u(null),t(null);return}try{let e=JSON.parse(n);u(null),t(e)}catch{u(d(`fields.object.invalidJson`))}};return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(Re,{...Z(a),ref:f,value:s,onChange:m,placeholder:o?.placeholder||`{
|
|
11
|
-
"key": "value"
|
|
12
|
-
}`,disabled:r||a.disabled,className:U(`font-mono text-xs`,l?`border-red-500 focus-visible:ring-red-500`:``,a.className),rows:6,"aria-invalid":!!i||!!l}),l&&(0,Q.jsx)(`p`,{className:`text-xs text-red-500`,children:l})]})}var Cu=n({QRCodeField:()=>wu});function wu({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let[s,c]=$.useState(!1),l=n,u=e=>`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(e)}`,d=()=>{e&&navigator.clipboard.writeText(e)};return r?(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-sm flex-1 truncate`,children:e||(0,Q.jsx)(Y,{})}),e&&(0,Q.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>c(!s),children:[(0,Q.jsx)(gr,{className:`w-4 h-4 mr-2`}),s?`Hide`:`Show`,` QR`]})]}):(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(o,{...Z(a),type:`text`,value:e||``,onChange:e=>t(e.target.value),placeholder:l?.placeholder||`Enter text for QR code`,disabled:r||a.disabled,className:a.className,"aria-invalid":!!i}),e&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:d,children:(0,Q.jsx)(nr,{className:`w-4 h-4`})}),(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>c(!s),children:(0,Q.jsx)(gr,{className:`w-4 h-4`})})]})]}),s&&e&&(0,Q.jsx)(`div`,{className:`border rounded p-4 bg-white flex justify-center`,children:(0,Q.jsx)(`img`,{src:u(e),alt:`QR Code`,className:`w-48 h-48`})}),e&&(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`QR code contains: `,e.length,` characters`]})]})}var Tu={text:rc,textarea:oc,number:fc,currency:mc,percent:_c,slider:yc,progress:yc,rating:xc,boolean:Cc,toggle:Cc,select:Dc,status:Dc,multiselect:Tc,radio:Ac,checkboxes:Mc,tags:Pc,date:Lc,datetime:zc,time:Vc,email:Uc,phone:Gc,url:qc,lookup:Ul,master_detail:Ul,user:Kl,color:Jl,address:Xl,location:fu,geolocation:gu,code:vu,json:Su,qrcode:wu},Eu=new Set([`formula`,`summary`,`auto_number`,`file`,`image`,`avatar`,`signature`,`markdown`,`html`,`richtext`,`password`,`secret`,`object`,`grid`,`vector`,`object-ref`,`filter-condition`,`recipient-picker`]);function Du(e){return e in Tu||Eu.has(e)?e:$s(e).replace(/^field:/,``)}function Ou(e){return!e||F(e)?!1:Du(e)in Tu}function ku(e){return e?F(e)?!0:Eu.has(Du(e)):!1}var Au=new Set([`lookup`,`master_detail`,`user`]);function ju(e){let{field:t,value:n,onChange:r,readonly:i}=e;if(t?.type&&F(t.type))return Ne(t.type),null;let a=t?.type?Du(t.type):void 0,o=a?Tu[a]:void 0;if(!o)return null;let s=a&&Au.has(a)?{compact:!0}:{};return(0,Q.jsx)(o,{...Z(e),...tc(e),field:t,value:n,onChange:r,readonly:i,...s})}var Mu=n({PasswordField:()=>Nu});function Nu({value:e,onChange:t,field:n,readonly:r,className:i,...a}){let[s,c]=(0,$.useState)(!1),l=n;if(r)return tn(zs(e))?(0,Q.jsx)(Y,{}):(0,Q.jsx)(`span`,{className:`text-sm`,children:`••••••••`});let u=Z(a);return(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(o,{...u,type:s?`text`:`password`,value:e||``,onChange:e=>t(e.target.value),placeholder:l?.placeholder,disabled:r||u.disabled,className:`pr-10 ${i||``}`}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent`,onClick:()=>c(!s),tabIndex:-1,children:s?(0,Q.jsx)(or,{className:`size-4 text-gray-500`}):(0,Q.jsx)(sr,{className:`size-4 text-gray-500`})})]})}var Pu=n({RichTextField:()=>Lu});function Fu({value:e,onChange:t,formatLabel:n,hint:r,placeholder:i,rows:a,disabled:o,error:s,className:c,fullHeight:l,autoFocus:u,textareaTestId:d,overlay:f,counter:p,maxLength:m,describedBy:h,domProps:g,editorAria:_}){return(0,Q.jsxs)(`div`,{className:U(`space-y-2`,l&&`flex flex-col h-full`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-gray-500`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(`span`,{className:`italic`,children:r})]}),(0,Q.jsxs)(`div`,{className:U(`relative`,l&&`flex-1 min-h-0`),children:[(0,Q.jsx)(Re,{autoFocus:u,"data-testid":d,...g,value:e||``,onChange:e=>t(e.target.value),placeholder:i,disabled:o,rows:l?void 0:a,maxLength:m,className:U(`font-mono`,l?`text-base h-full min-h-full resize-none`:`text-sm`,c),"aria-invalid":!!s,"aria-describedby":h,..._}),p,f]})]})}function Iu(e){let t=e?.type,n=typeof t==`string`?t:``;return n.startsWith(`field:`)?n.slice(6):n}function Lu({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let{t:o}=In(),s=Iu(n),c=Ks(s),l=(0,$.useId)(),u=`${l}-charcount`,d=`${l}-fullscreen-charcount`;if(r){let t=qs(s);return t?(0,Q.jsx)(t,{value:e,field:n}):(0,Q.jsx)(`div`,{className:`text-sm whitespace-pre-wrap break-words`,children:e||(0,Q.jsx)(Y,{})})}let f=n,p=f?.rows||8,m=f?.maxLength,h=c??``,g=!!f?.mobile_fullscreen,_=Z(a),v=!!_.disabled,y=[_[`aria-describedby`],m?u:void 0].filter(Boolean).join(` `)||void 0,b=o(`fields.richText.format`,{format:h,defaultValue:`Format: ${h}`}),x=o(`fields.richText.basicEditorHint`,{defaultValue:`Rich text editor (basic)`}),S=f?.placeholder||o(`fields.richText.placeholder`,{defaultValue:`Enter text…`});return(0,Q.jsx)(Fu,{value:e,onChange:t,formatLabel:b,hint:x,placeholder:S,rows:p,disabled:r||v,error:i,className:_.className,maxLength:m,describedBy:y,domProps:_,counter:m?(0,Q.jsx)(st,{length:(e||``).length,maxLength:m,descriptionId:u,announceNearLimit:!0,className:`absolute bottom-2 right-2 text-xs text-gray-400`,testId:`richtext-character-count`}):null,overlay:g&&(0,Q.jsx)(ic,{value:e??``,onCommit:t,label:f?.label,testIdPrefix:`richtext`,disabled:v,error:i,footer:e=>m?(0,Q.jsx)(st,{length:e.length,maxLength:m,descriptionId:d,announceNearLimit:!1,className:`text-xs text-muted-foreground self-center`,testId:`richtext-fullscreen-character-count`}):null,children:(e,t,n,r)=>(0,Q.jsx)(Fu,{value:e,onChange:t,formatLabel:b,hint:x,placeholder:S,disabled:n,autoFocus:!0,fullHeight:!0,maxLength:m,describedBy:m?d:void 0,textareaTestId:`richtext-fullscreen-input`,editorAria:r})})})}function Ru(e){if(Array.isArray(e))return e.map(e=>String(e)).filter(Boolean);if(typeof e==`string`){let t=e.trim();if(!t)return[];try{let e=JSON.parse(t);return Array.isArray(e)?e.map(e=>String(e)).filter(Boolean):[String(e)].filter(Boolean)}catch{return t.split(`,`).map(e=>e.trim()).filter(Boolean)}}return[]}var zu=n({ObjectRefField:()=>Bu,default:()=>Bu});function Bu({value:e,onChange:t,readonly:n,className:r,error:i,...a}){let o=$.useContext(ln),{t:s}=zr(),c=a.dataSource??o?.dataSource??null,l=a.disabled,[u,d]=$.useState(null);$.useEffect(()=>{if(!c)return;let e=!1;return(async()=>{try{let t=[];if(typeof c.getObjects==`function`)t=await c.getObjects()??[];else if(typeof c.find==`function`){let e=await c.find(`sys_metadata`,{$filter:{type:`object`},$top:1e3});t=(e?.data??e?.records??(Array.isArray(e)?e:[])).map(e=>({name:String(e?.name??``),label:e?.label==null?void 0:String(e.label)})).filter(e=>e.name)}e||d(t)}catch{e||d([])}})(),()=>{e=!0}},[c]);let f=$.useMemo(()=>{let t=(u??[]).map(e=>({value:e.name,label:e.label?`${e.label} (${e.name})`:e.name}));return e&&!t.some(t=>t.value===e)&&t.unshift({value:e,label:e}),t.sort((e,t)=>e.label.localeCompare(t.label))},[u,e]);if(n){if(!e)return(0,Q.jsx)(Y,{});let t=f.find(t=>t.value===e)?.label??e;return(0,Q.jsx)(`span`,{className:r,children:t})}let{name:p,...m}=Z(a);return(0,Q.jsx)(et,{...m,options:f,value:e??``,onValueChange:e=>t(e),placeholder:s(u===null?`fields.objectRef.loading`:`fields.objectRef.placeholder`),searchPlaceholder:s(`fields.objectRef.search`),emptyText:s(u===null?`common.loading`:`fields.objectRef.empty`),disabled:l,className:U(`w-full`,r),"aria-invalid":!!i})}var Vu=n({FILTER_CONDITION_EXTRA_OPERATORS:()=>Uu,FilterConditionField:()=>sd,condToMongo:()=>$u,default:()=>sd,isMatchAllCriteria:()=>ad,kvToCondition:()=>rd}),Hu={id:`root`,logic:`and`,conditions:[]},Uu=[`exists`,`notExists`],Wu=new Set([`object`,`vector`,`file`,`image`,`avatar`,`signature`,`richtext`,`html`,`markdown`,`location`,`grid`,`json`,`code`]);function Gu(e){let t=e?.fields,n=Array.isArray(t)?t.map(e=>[e?.name,e]):t&&typeof t==`object`?Object.entries(t):[],r=[];for(let[e,t]of n){if(!e||!t||t.hidden)continue;let n=t.type;n&&Wu.has(n)||r.push({value:e,label:t.label||e,type:n,options:Array.isArray(t.options)?t.options.map(e=>typeof e==`string`?{value:e,label:e}:{value:String(e?.value),label:String(e?.label??e?.value)}):void 0,referenceTo:t.reference})}return r}function Ku(e,t){if(e==null)return e;if(t===`boolean`||t===`toggle`)return typeof e==`boolean`?e:e===`true`||e!==`false`&&e;if(t===`number`||t===`currency`||t===`percent`||t===`rating`||t===`slider`){let t=Number(e);return Number.isFinite(t)&&e!==``?t:e}return e}var qu=new Set([`contains`,`icontains`,`not_contains`,`starts_with`,`ends_with`]);function Ju(e){return e==null||e===``}function Yu(e){return Array.isArray(e)?e:typeof e==`string`?e.split(`,`).map(e=>e.trim()).filter(Boolean):e==null?[]:[e]}function Xu(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Zu(e){if(!Xu(e))return null;let t=Object.entries(e);if(t.length!==1||t[0][0].startsWith(`$`))return null;let[n,r]=t[0];if(!Xu(r))return null;let i=Object.entries(r);return i.length===1?[n,i[0][0],i[0][1]]:null}function Qu(e){if(!Array.isArray(e)||e.length!==2)return null;let t=Zu(e[0]),n=Zu(e[1]);if(!t||!n||t[0]!==n[0])return null;let[r,i,a]=t;return i===`$in`&&td(a,[``])&&n[1]===`$null`&&n[2]===!0?r:null}function $u(e,t){let{field:n,operator:r,value:i}=e||{};if(!n||qu.has(r)&&Ju(i))return null;let a=t(n),o=Ku(i,a);switch(r){case`equals`:return{[n]:o};case`not_equals`:return{[n]:{$ne:o}};case`contains`:return{[n]:{$contains:i}};case`icontains`:return{[n]:{$icontains:i}};case`not_contains`:return{[n]:{$notContains:i}};case`starts_with`:return{[n]:{$startsWith:i}};case`ends_with`:return{[n]:{$endsWith:i}};case`is_empty`:return{[n]:{$empty:!0}};case`is_not_empty`:return{[n]:{$empty:!1}};case`is_null`:return{[n]:{$null:!0}};case`is_not_null`:return{[n]:{$null:!1}};case`exists`:return{[n]:{$exists:!0}};case`notExists`:return{[n]:{$exists:!1}};case`greater_than`:case`after`:return{[n]:{$gt:o}};case`less_than`:case`before`:return{[n]:{$lt:o}};case`greater_than_or_equal`:return{[n]:{$gte:o}};case`less_than_or_equal`:return{[n]:{$lte:o}};case`between`:{let[e,t]=Array.isArray(i)?i:[void 0,void 0];return Ju(e)||Ju(t)?null:{[n]:{$gte:Ku(e,a),$lte:Ku(t,a)}}}case`in`:return{[n]:{$in:Yu(i).map(e=>Ku(e,a))}};case`not_in`:return{[n]:{$nin:Yu(i).map(e=>Ku(e,a))}};default:return{[n]:o}}}function ed(e,t){let n=(e?.conditions??[]).map(e=>$u(e,t)).filter(e=>!!e);if(n.length===0)return null;if(e.logic===`or`)return{$or:n};if(n.length===1)return n[0];let r=n.flatMap(e=>Object.keys(e));return new Set(r).size===r.length?Object.assign({},...n):{$and:n}}function td(e,t){return Array.isArray(e)&&e.length===t.length&&e.every((e,n)=>e===t[n])}function nd(e){if(e==null||typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0)return``;try{return JSON.stringify(e)??``}catch{return`[unserialisable criteria]`}}function rd(e,t,n){if(e.startsWith(`$`)){let r=e===`$or`?Qu(t):null;return r===null?null:{id:`c_${n}_${r}`,field:r,operator:`is_empty`,value:``}}let r=`c_${n}_${e}`;if(typeof t!=`object`||!t||Array.isArray(t))return{id:r,field:e,operator:`equals`,value:t};let i=Object.keys(t);if(i.length===1){let n=i[0],a=t[n];switch(n){case`$ne`:return{id:r,field:e,operator:`not_equals`,value:a};case`$contains`:return{id:r,field:e,operator:`contains`,value:a};case`$icontains`:return{id:r,field:e,operator:`icontains`,value:a};case`$notContains`:case`$ncontains`:return{id:r,field:e,operator:`not_contains`,value:a};case`$gt`:return{id:r,field:e,operator:`greater_than`,value:a};case`$lt`:return{id:r,field:e,operator:`less_than`,value:a};case`$gte`:return{id:r,field:e,operator:`greater_than_or_equal`,value:a};case`$lte`:return{id:r,field:e,operator:`less_than_or_equal`,value:a};case`$startsWith`:return{id:r,field:e,operator:`starts_with`,value:a};case`$endsWith`:return{id:r,field:e,operator:`ends_with`,value:a};case`$null`:return{id:r,field:e,operator:a===!1?`is_not_null`:`is_null`,value:``};case`$exists`:return{id:r,field:e,operator:a===!1?`notExists`:`exists`,value:``};case`$empty`:return a===!0?{id:r,field:e,operator:`is_empty`,value:``}:a===!1?{id:r,field:e,operator:`is_not_empty`,value:``}:null;case`$in`:return td(a,[null,``])?{id:r,field:e,operator:`is_empty`,value:``}:{id:r,field:e,operator:`in`,value:a};case`$nin`:return td(a,[null,``])?{id:r,field:e,operator:`is_not_empty`,value:``}:{id:r,field:e,operator:`not_in`,value:a};default:return null}}return i.length===2&&`$gte`in t&&`$lte`in t?{id:r,field:e,operator:`between`,value:[t.$gte,t.$lte]}:i.length===2&&`$nin`in t&&`$null`in t&&td(t.$nin,[``])&&t.$null===!1?{id:r,field:e,operator:`is_not_empty`,value:``}:null}function id(e){if(e==null)return{...Hu,conditions:[]};if(typeof e!=`object`||Array.isArray(e))return null;let t=Object.entries(e);if(t.length===0)return{...Hu,conditions:[]};if(t.length===1&&(e.$or||e.$and)&&!rd(t[0][0],t[0][1],0)){let t=e.$or?`or`:`and`,n=e.$or||e.$and;if(!Array.isArray(n))return null;let r=[];for(let e=0;e<n.length;e++){let t=n[e];if(!t||typeof t!=`object`||Object.keys(t).length!==1)return null;let i=Object.keys(t)[0],a=rd(i,t[i],e);if(!a)return null;r.push(a)}return{id:`root`,logic:t,conditions:r}}let n=[],r=0;for(let[e,i]of t){let t=rd(e,i,r++);if(!t)return null;n.push(t)}return{id:`root`,logic:`and`,conditions:n}}function ad(e){if(e==null)return!0;if(Array.isArray(e))return e.every(ad);if(typeof e!=`object`)return!0;let t=Object.entries(e);if(t.length===0)return!0;for(let[e,n]of t){if(e===`$and`){if(!Array.isArray(n)||n.every(ad))continue;return!1}if(e===`$or`){if(!Array.isArray(n)||n.length===0||n.some(ad))continue;return!1}return!1}return!0}function od(e){if(e==null||e===``)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return``}}function sd({value:e,onChange:t,readonly:n,className:r,error:i,...a}){let o=$.useContext(ln),{t:s}=zr(),c=a.dataSource??o?.dataSource??null,l=a.dependentValues??{},u=String(l.object_name??``),[d,f]=$.useState(null);$.useEffect(()=>{if(f(null),!c||!u||typeof c.getObjectSchema!=`function`)return;let e=!1;return(async()=>{try{let t=await c.getObjectSchema(u);e||f(Gu(t))}catch{e||f([])}})(),()=>{e=!0}},[c,u]);let p=$.useMemo(()=>od(e),[e]),m=$.useMemo(()=>{if(!p.trim())return{mongo:{},ok:!0};try{return{mongo:JSON.parse(p),ok:!0}}catch{return{mongo:null,ok:!1}}},[p]),h=$.useMemo(()=>m.ok?id(m.mongo):null,[m]),g=$.useMemo(()=>m.ok&&ad(m.mongo),[m]),_=m.ok&&h!==null,[v,y]=$.useState(!_);$.useEffect(()=>{_||y(!0)},[_]);let b=$.useMemo(()=>{let e=new Map((d??[]).map(e=>[e.value,e.type]));return t=>e.get(t)},[d]),[x,S]=$.useState(()=>h??Hu),C=m.ok?nd(m.mongo):null,w=nd(ed(x,b));return $.useEffect(()=>{h!==null&&C!==null&&C!==w&&S(h)},[h,C,w]),u?n?p.trim()?(0,Q.jsx)(`pre`,{className:U(`overflow-x-auto rounded bg-muted/40 p-2 text-xs`,r),children:p}):(0,Q.jsx)(`span`,{className:U(`text-sm text-destructive`,r),children:s(`fields.filterCondition.noCriteria`)}):(0,Q.jsxs)(`div`,{className:U(`flex flex-col gap-2`,r),children:[v?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{...Z(a),className:`min-h-[96px] w-full rounded border bg-background px-2 py-1 font-mono text-xs`,value:p,placeholder:`{ "type": "customer", "is_active": true }`,onChange:e=>t(e.target.value),"aria-invalid":!!i||!m.ok}),!m.ok&&(0,Q.jsx)(`span`,{className:`text-xs text-destructive`,children:s(`fields.filterCondition.invalidJson`)})]}):(0,Q.jsx)(rn,{fields:d??[],value:x,onChange:e=>{S(e);let n=ed(e,b);t(n==null?``:JSON.stringify(n))},extraOperators:Uu}),g&&(0,Q.jsx)(`span`,{className:`text-xs text-destructive`,children:s(`fields.filterCondition.criteriaRequired`)}),(0,Q.jsx)(`button`,{type:`button`,className:`self-start text-xs text-muted-foreground underline-offset-2 hover:underline`,onClick:()=>y(e=>!e),disabled:!_&&!v,title:_?void 0:s(`fields.filterCondition.jsonOnly`),children:s(v?`fields.filterCondition.useVisualBuilder`:`fields.filterCondition.editAsJson`)})]}):(0,Q.jsx)(`p`,{className:U(`text-sm text-muted-foreground`,r),children:s(`fields.filterCondition.selectObjectFirst`)})}var cd=n({RecipientPickerField:()=>pd,default:()=>pd,deriveUserFields:()=>fd,fieldHoldsUsers:()=>dd}),ld={user:{object:`sys_user`,storeField:`id`,labelFields:[`name`,`full_name`,`email`],placeholderKey:`fields.recipient.selectUser`},team:{object:`sys_team`,storeField:`id`,labelFields:[`name`,`label`],placeholderKey:`fields.recipient.selectTeam`},business_unit:{object:`sys_business_unit`,storeField:`id`,labelFields:[`name`,`label`],placeholderKey:`fields.recipient.selectBusinessUnit`},unit_and_subordinates:{object:`sys_business_unit`,storeField:`id`,labelFields:[`name`,`label`],placeholderKey:`fields.recipient.selectUnitAndSubordinates`},position:{object:`sys_position`,storeField:`name`,labelFields:[`label`,`name`],placeholderKey:`fields.recipient.selectPosition`}},ud=`field`;function dd(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`user`||(t.type===`lookup`||t.type===`master_detail`)&&t.reference===`sys_user`}function fd(e){let t=e?.fields,n=Array.isArray(t)?t.map(e=>[e?.name,e]):t&&typeof t==`object`?Object.entries(t):[],r=[];for(let[e,t]of n)e&&dd(t)&&r.push({name:String(e),label:t.label?String(t.label):String(e)});return r}function pd({value:e,onChange:t,readonly:n,className:r,error:i,...a}){let o=$.useContext(ln),{t:s}=zr(),c=a.dataSource??o?.dataSource??null,l=a.disabled,u=a.dependentValues??{},d=String(u.recipient_type??``),f=ld[d],p=String(u.object_name??``),m=d===ud&&!!c&&typeof c.getObjectSchema==`function`,[h,g]=$.useState(null),[_,v]=$.useState(null),y=$.useRef(``);$.useEffect(()=>{y.current&&d&&y.current!==d&&e&&t(``),y.current=d},[d]),$.useEffect(()=>{if(g(null),!c||!f||typeof c.find!=`function`)return;let e=!1;return(async()=>{try{let t=await c.find(f.object,{$top:500,$orderby:{name:`asc`}}),n=t?.data??t?.records??(Array.isArray(t)?t:[]);e||g(Array.isArray(n)?n:[])}catch{e||g([])}})(),()=>{e=!0}},[c,f?.object]),$.useEffect(()=>{if(v(null),!m||!p)return;let e=!1;return(async()=>{try{let t=await c.getObjectSchema(p);e||v(fd(t))}catch{e||v([])}})(),()=>{e=!0}},[c,p,m]);let b=e=>{for(let t of f?.labelFields??[`name`])if(e?.[t])return String(e[t]);return String(e?.id??``)},x=e=>String(e?.[f?.storeField??`id`]??``),S=$.useMemo(()=>{let t=(h??[]).map(e=>({value:x(e),label:b(e)})).filter(e=>e.value);return e&&!t.some(t=>t.value===e)&&t.unshift({value:e,label:e}),t},[h,e,f]),C=$.useMemo(()=>(_??[]).map(e=>({value:e.name,label:e.label})),[_]),{name:w,...T}=Z(a);if(!d)return(0,Q.jsx)(`p`,{className:U(`text-sm text-muted-foreground`,r),children:s(`fields.recipient.selectTypeFirst`)});if(m){if(!p)return(0,Q.jsx)(`p`,{className:U(`text-sm text-muted-foreground`,r),children:s(`fields.filterCondition.selectObjectFirst`)});let a=e&&!C.some(t=>t.value===e)?[{value:e,label:s(`fields.recipient.fieldNotUserTyped`,{name:e})},...C]:C;return n?e?(0,Q.jsx)(`span`,{className:r,children:a.find(t=>t.value===e)?.label??e}):(0,Q.jsx)(Y,{}):(0,Q.jsx)(et,{...T,options:a,value:e??``,onValueChange:e=>t(e),placeholder:s(_===null?`fields.recipient.loading`:`fields.recipient.selectField`),searchPlaceholder:s(`fields.recipient.search`),emptyText:s(_===null?`fields.recipient.loading`:`fields.recipient.noUserFields`),disabled:l,className:U(`w-full`,r),"aria-invalid":!!i})}return f?n?e?(0,Q.jsx)(`span`,{className:r,children:S.find(t=>t.value===e)?.label??e}):(0,Q.jsx)(Y,{}):(0,Q.jsx)(et,{...T,options:S,value:e??``,onValueChange:e=>t(e),placeholder:s(h===null?`fields.recipient.loading`:f.placeholderKey??`fields.recipient.select`),searchPlaceholder:s(`fields.recipient.search`),emptyText:s(h===null?`fields.recipient.loading`:`fields.recipient.empty`),disabled:l,className:U(`w-full`,r),"aria-invalid":!!i}):(0,Q.jsx)(`input`,{...Z(a),className:U(`w-full rounded border bg-background px-2 py-1 text-sm`,r),value:e??``,disabled:l||n,onChange:e=>t(e.target.value),"aria-invalid":!!i})}var md=1048576;function hd(e,t,n){if(!n||t.size<=n)return null;let r=(n/md).toFixed(1);return e(`fields.file.exceedsMaxSize`,{defaultValue:`"${t.name}" exceeds max size (${r} MB)`,name:t.name,max:r})}var gd=n({FileCell:()=>yd,FileField:()=>vd});function _d(e){let{files:t,multiple:n,maxSize:r,onChange:i,holdScope:a}=e,{upload:o}=jr(),{t:s}=In(),[c,l]=(0,$.useState)([]),[u,d]=(0,$.useState)({}),[f,p]=(0,$.useState)(!1),[m,h]=(0,$.useState)({});return{processFiles:(0,$.useCallback)(async e=>{if(e.length===0)return;let c=[],u=e.filter(e=>{let t=hd(s,e,r);return!t||(c.push(t),!1)});if(l(c),u.length===0)return;let f=a?.();p(!0);try{let e=(await Promise.all(u.map(async e=>{try{let t=await o(e,{onProgress:t=>d(n=>({...n,[e.name]:t}))}),n=kr(t,e.name);return{result:t,originalName:e.name,value:n}}catch(t){return c.push(Lr(s,e.name,t)),l([...c]),null}}))).filter(Boolean);if(e.length===0)return;let r={};for(let{result:t,originalName:n}of e){let e=Mr(t,n);e.id&&(r[e.id]=e)}Object.keys(r).length>0&&h(e=>({...e,...r}));let a=e.map(({value:e})=>e);i(n?[...t,...a]:a[0])}finally{f?.(),p(!1),d({})}},[t,n,i,r,o,s,a]),errors:c,uploading:f,uploadProgress:u,recent:m}}function vd({value:e,onChange:t,field:n,readonly:r,onUploadingChange:i,error:a,...o}){let{t:s}=In(),c=(0,$.useRef)(null),l=(0,$.useRef)(null),u=n,d=u?.multiple||!1,f=u?.accept?u.accept.join(`,`):void 0,p=u?.maxSize,m=u?.capture??null,h=!f||f.split(`,`).some(e=>e.trim().startsWith(`image/`)||e.trim()===`image/*`||e.trim().startsWith(`.jp`)||e.trim().startsWith(`.png`)||e.trim().startsWith(`.gif`)||e.trim().startsWith(`.webp`)),g=typeof navigator<`u`&&(navigator.maxTouchPoints>0||/Mobi|Android/i.test(navigator.userAgent)),_=m===!1?!1:m??(h&&g?`environment`:null),[v,y]=(0,$.useState)(!1),b=e?Array.isArray(e)?e:[e]:[],{processFiles:x,errors:S,uploading:C,uploadProgress:w,recent:T}=_d({files:b,multiple:d,maxSize:p,onChange:t,holdScope:Fr()}),E=s(`fields.file.fileFallback`,{defaultValue:`File`}),D=Rr(Ar(e,E),T);Nr(C,i);let O=(0,$.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),y(!0)},[]),k=(0,$.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),y(!1)},[]),A=(0,$.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),y(!1);let t=Array.from(e.dataTransfer.files);if(f){let e=f.split(`,`).map(e=>e.trim().toLowerCase()),n=t.filter(t=>{let n=t.name.split(`.`),r=n.length>1?`.`+n.pop()?.toLowerCase():``;return e.some(e=>e===t.type||r&&e===r||e.endsWith(`/*`)&&t.type.startsWith(e.replace(`/*`,`/`)))});x(n)}else x(t)},[f,x]);if(r){let t=Br(o,`instead-of-the-inputs`);return e?(0,Q.jsx)(`div`,{...t,className:`flex flex-wrap gap-2`,children:D.map((e,t)=>(0,Q.jsx)(Rs,{view:e,className:`text-sm max-w-xs`,fallback:(0,Q.jsx)(`span`,{className:`text-sm truncate max-w-xs`,children:e.name})},t))}):(0,Q.jsx)(Y,{...t})}let j=e=>{x(Array.from(e.target.files||[]))},M=e=>{if(d){let n=b.filter((t,n)=>n!==e);t(n.length>0?n:null)}else t(null)},{name:ee,...N}=Z(o);return(0,Q.jsxs)(`div`,{className:o.className,children:[(0,Q.jsx)(`input`,{ref:c,type:`file`,multiple:d,accept:f,onChange:j,className:`hidden`}),_&&(0,Q.jsx)(`input`,{ref:l,type:`file`,accept:`image/*`,capture:_,onChange:j,className:`hidden`,"aria-label":s(`fields.file.cameraCapture`,{defaultValue:`Camera capture`}),"data-testid":`file-field-camera-input`}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{...N,onDragOver:O,onDragLeave:k,onDrop:A,onClick:()=>c.current?.click(),className:`
|
|
13
|
-
flex flex-col items-center justify-center gap-2 p-6
|
|
14
|
-
border-2 border-dashed rounded-lg cursor-pointer
|
|
15
|
-
transition-colors duration-200
|
|
16
|
-
${v?`border-primary bg-primary/5 text-primary`:`border-muted-foreground/25 hover:border-primary/50 text-muted-foreground hover:text-foreground`}
|
|
17
|
-
`,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c.current?.click())},"aria-invalid":!!a,children:[(0,Q.jsx)(Tr,{className:`size-8 ${v?`text-primary`:`text-muted-foreground`}`}),(0,Q.jsxs)(`div`,{className:`text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:v?s(`fields.file.dropFilesHere`,{defaultValue:`Drop files here`}):s(`fields.file.dragDropHere`,{defaultValue:`Drag & drop files here`})}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:_?s(`fields.file.browseHintCamera`,{defaultValue:`or click to browse • use the camera button below`}):s(`fields.file.browseHint`,{defaultValue:`or click to browse`})})]})]}),_&&(0,Q.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,className:`w-full`,onClick:e=>{e.stopPropagation(),l.current?.click()},"data-testid":`file-field-camera-button`,children:[(0,Q.jsx)(Yn,{className:`size-4 mr-2`}),_===`user`?s(`fields.file.takeSelfie`,{defaultValue:`Take selfie`}):s(`fields.file.takePhoto`,{defaultValue:`Take photo`})]}),C&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,"data-testid":`file-field-uploading`,children:[(0,Q.jsx)(fr,{className:`size-3 animate-spin`}),(0,Q.jsx)(`span`,{children:(()=>{let e=Object.keys(w);if(e.length===0)return s(`fields.file.uploading`,{defaultValue:`Uploading…`});let t=Math.round(Object.values(w).reduce((e,t)=>e+t,0)/e.length*100);return s(`fields.file.uploadingPct`,{defaultValue:`Uploading… (${t}%)`,pct:t})})()})]}),S.length>0&&(0,Q.jsx)(`div`,{className:`space-y-0.5`,children:S.map((e,t)=>(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:e},t))}),D.length>0&&(0,Q.jsx)(`div`,{className:`space-y-1`,children:D.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 p-2 bg-muted/50 rounded-md border`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[Pr(e)&&e.url?(0,Q.jsx)(`img`,{src:e.url,alt:e.name,className:`size-8 object-cover rounded shrink-0`}):Pr(e)?(0,Q.jsx)(ur,{className:`size-4 text-muted-foreground shrink-0`}):(0,Q.jsx)(cr,{className:`size-4 text-muted-foreground shrink-0`}),(0,Q.jsx)(Rs,{view:e,className:`text-sm`,icon:!1,fallback:(0,Q.jsx)(`span`,{className:`text-sm truncate`,children:e.name})}),e.size&&(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,(e.size/1024).toFixed(1),` KB)`]})]}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,onClick:e=>{e.stopPropagation(),M(t)},className:`h-6 w-6 p-0`,children:(0,Q.jsx)(Er,{className:`size-3`})})]},t))})]})]})}function yd({value:e,onChange:t,disabled:n,multiple:r,accept:i,maxSize:a,error:o,"aria-label":s,"data-cell":c}){let{t:l}=In(),u=(0,$.useRef)(null),d=e?Array.isArray(e)?e:[e]:[],{processFiles:f,errors:p,uploading:m,recent:h}=_d({files:d,multiple:!!r,maxSize:a,onChange:t}),g=l(`fields.file.fileFallback`,{defaultValue:`File`}),_=Rr(Ar(e,g),h),v=e=>{if(r){let n=d.filter((t,n)=>n!==e);t(n.length>0?n:null)}else t(null)},y=!n&&!m&&(r||d.length===0);return(0,Q.jsxs)(`div`,{className:`flex min-h-8 flex-wrap items-center gap-1 px-1 py-0.5`,children:[(0,Q.jsx)(`input`,{ref:u,type:`file`,multiple:r,accept:i,onChange:e=>{f(Array.from(e.target.files||[])),e.target.value=``},className:`hidden`}),_.map((e,t)=>(0,Q.jsxs)(`span`,{className:`inline-flex max-w-40 items-center gap-1 rounded border bg-muted/50 px-1 py-0.5 text-xs`,title:e.name,"data-testid":`file-cell-chip`,children:[Pr(e)&&e.url?(0,Q.jsx)(`img`,{src:e.url,alt:e.name,className:`size-5 shrink-0 rounded object-cover`}):(0,Q.jsx)(cr,{className:`size-3 shrink-0 text-muted-foreground`}),(0,Q.jsx)(Rs,{view:e,icon:!1,fallback:(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})}),!n&&(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground`,"aria-label":l(`fields.file.remove`,{defaultValue:`Remove ${e.name}`,name:e.name}),onClick:()=>v(t),children:(0,Q.jsx)(Er,{className:`size-3`})})]},t)),m&&(0,Q.jsx)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted-foreground`,"data-testid":`file-cell-uploading`,children:(0,Q.jsx)(fr,{className:`size-3.5 animate-spin`})}),y&&(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 gap-1 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>u.current?.click(),"aria-label":s,"data-cell":c,disabled:n,"aria-invalid":!!o,children:[(0,Q.jsx)(Tr,{className:`size-3.5`}),d.length===0&&l(`fields.file.upload`,{defaultValue:`Upload`})]}),p.length>0&&(0,Q.jsx)(`span`,{className:`w-full truncate text-[11px] text-destructive`,title:p.join(`; `),children:p[0]})]})}var bd=n({ImageField:()=>Sd}),xd=(0,$.lazy)(()=>X(()=>Promise.resolve().then(()=>Cd).then(e=>({default:e.ImageCropperDialog})),void 0));function Sd({value:e,onChange:t,field:n,readonly:r,onUploadingChange:i,error:a,...o}){let s=(0,$.useRef)(null),c=n,l=c?.multiple||!1,u=c?.accept?c.accept.join(`,`):`image/*`,d=c?.maxSize,f=c?.crop!==!1,[p,m]=(0,$.useState)(null),[h,g]=(0,$.useState)(null),{upload:_}=jr(),{t:v}=In(),[y,b]=(0,$.useState)(!1),[x,S]=(0,$.useState)([]),[C,w]=(0,$.useState)({});Nr(y,i);let T=Fr(),E=e?Array.isArray(e)?e:[e]:[],D=Rr(Ar(e,``),C),O=(0,$.useCallback)((e,t)=>{let n=Mr(e,t);n.id&&w(e=>({...e,[n.id]:n}))},[]),k=(0,$.useCallback)(async(e,n)=>{if(!p)return;let r=hd(v,{name:n,size:e.size},d);if(r){S([r]),m(null);return}S([]);let i=T();b(!0);try{let r=await _(e),i=kr(r,n);if(O(r,n),l){let e=[...E];e[p.index]=i,t(e)}else t(i)}catch(e){S([Lr(v,n,e)])}finally{i(),b(!1),m(null)}},[p,E,l,t,_,O,d,v,T]),A=(0,$.useCallback)(e=>{let t=D[e];t?.url&&m({index:e,src:t.url,name:t.name||`image-${e}.png`})},[D]),j=D.filter(e=>e.url).map(e=>({url:e.url,name:e.name}));if(r)return!e||j.length===0?(0,Q.jsx)(Y,{}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:j.map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>g(t),className:`group relative overflow-hidden rounded-md border border-border focus:outline-none focus:ring-2 focus:ring-ring`,"aria-label":v(`fields.image.enlarge`,{name:e.name||v(`fields.image.imageAlt`,{index:t+1})}),children:[(0,Q.jsx)(`img`,{src:e.url,alt:e.name||v(`fields.image.imageAlt`,{index:t+1}),className:`size-20 object-cover transition-transform duration-150 group-hover:scale-105`}),(0,Q.jsx)(`span`,{className:`pointer-events-none absolute inset-0 bg-black/0 transition-colors group-hover:bg-black/10`})]},t))}),h!==null&&(0,Q.jsx)(Ls,{images:j,index:h,open:!0,onOpenChange:e=>!e&&g(null),onIndexChange:g})]});let M=async e=>{let n=Array.from(e.target.files||[]);if(s.current&&(s.current.value=``),n.length===0)return;let r=[],i=n.filter(e=>{let t=hd(v,e,d);return!t||(r.push(t),!1)});if(S(r),i.length===0)return;let a=[],o=T();b(!0);try{let e=await Promise.all(i.map(async e=>{try{let t=await _(e),n=kr(t,e.name);return O(t,e.name),n}catch(t){return a.push(Lr(v,e.name,t)),null}}));a.length>0&&S([...r,...a]);let n=e.filter(e=>e!==null);if(n.length===0)return;t(l?[...E,...n]:n[0])}finally{o(),b(!1)}},ee=e=>{if(l){let n=E.filter((t,n)=>n!==e);t(n.length>0?n:null)}else t(null)};return(0,Q.jsxs)(`div`,{className:o.className,children:[(0,Q.jsx)(`input`,{ref:s,type:`file`,multiple:l,accept:u,onChange:M,className:`hidden`}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[D.length>0&&(0,Q.jsx)(`div`,{className:`grid grid-cols-4 gap-2`,children:D.map((e,t)=>(0,Q.jsxs)(`div`,{className:`relative group`,children:[(0,Q.jsx)(`img`,{src:e.url||``,alt:e.name||v(`fields.image.imageAlt`,{index:t+1}),className:`size-20 rounded-md object-cover border border-gray-200`}),(0,Q.jsxs)(`div`,{className:`absolute top-1 right-1 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity`,children:[f&&(0,Q.jsx)(J,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>A(t),className:`h-6 w-6 p-0`,"aria-label":v(`fields.image.crop`,{index:t+1}),"data-testid":`image-field-crop-${t}`,children:(0,Q.jsx)(rr,{className:`size-3`})}),(0,Q.jsx)(J,{type:`button`,variant:`destructive`,size:`sm`,onClick:()=>ee(t),className:`h-6 w-6 p-0`,"aria-label":v(`fields.image.remove`,{index:t+1}),children:(0,Q.jsx)(Er,{className:`size-3`})})]})]},t))}),(0,Q.jsxs)(J,{...Z(o),type:`button`,variant:`outline`,onClick:()=>s.current?.click(),className:`w-full`,disabled:y,"data-testid":`image-field-upload-button`,"aria-invalid":!!a,children:[y?(0,Q.jsx)(fr,{className:`size-4 mr-2 animate-spin`}):(0,Q.jsx)(ur,{className:`size-4 mr-2`}),y?v(`fields.image.uploading`):E.length>0?v(`fields.image.addMore`):v(`fields.image.upload`)]}),x.length>0&&(0,Q.jsx)(`div`,{className:`space-y-0.5`,children:x.map((e,t)=>(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:e},t))})]}),f&&p&&(0,Q.jsx)($.Suspense,{fallback:null,children:(0,Q.jsx)(xd,{open:!0,onOpenChange:e=>!e&&m(null),src:p.src,outputName:p.name,onConfirm:k})})]})}var Cd=n({ImageCropperDialog:()=>wd}),wd=({open:e,onOpenChange:t,src:n,outputType:r=`image/png`,outputName:i=`cropped.png`,onConfirm:a})=>{let o=(0,$.useRef)(null),s=(0,$.useRef)(null),[c,l]=(0,$.useState)(0),[u,d]=(0,$.useState)({x:0,y:0,width:100,height:100}),[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(!1);(0,$.useEffect)(()=>{if(!e||!n)return;h(!1);let t=new Image;t.crossOrigin=`anonymous`,t.onload=()=>{s.current=t;let e=t.naturalWidth*.8,n=t.naturalHeight*.8;d({x:(t.naturalWidth-e)/2,y:(t.naturalHeight-n)/2,width:e,height:n}),l(0),h(!0)},t.onerror=()=>h(!1),t.src=n},[e,n]),(0,$.useEffect)(()=>{if(!m||!s.current||!o.current)return;let e=s.current,t=o.current,n=t.getContext(`2d`);if(!n)return;let r=480/e.naturalWidth,i=e.naturalHeight*r;t.width=480,t.height=i,n.clearRect(0,0,480,i),n.save(),n.translate(240,i/2),n.rotate(c*Math.PI/180);let a=c%180==0?480:i,l=c%180==0?i:480;n.drawImage(e,-a/2,-l/2,a,l),n.restore();let d=u.x*r,f=u.y*r,p=u.width*r,h=u.height*r;n.fillStyle=`rgba(0,0,0,0.45)`,n.fillRect(0,0,480,f),n.fillRect(0,f+h,480,i-f-h),n.fillRect(0,f,d,h),n.fillRect(d+p,f,480-d-p,h),n.strokeStyle=`#3b82f6`,n.lineWidth=2,n.strokeRect(d,f,p,h)},[m,u,c]);let g=(0,$.useCallback)(e=>{if(!s.current||!o.current)return;let t=o.current.getBoundingClientRect(),n=s.current.naturalWidth/t.width;p({ox:(e.clientX-t.left)*n,oy:(e.clientY-t.top)*n,cx:u.x,cy:u.y}),e.target.setPointerCapture(e.pointerId)},[u]),_=(0,$.useCallback)(e=>{if(!f||!s.current||!o.current)return;let t=o.current.getBoundingClientRect(),n=s.current.naturalWidth/t.width,r=(e.clientX-t.left)*n-f.ox,i=(e.clientY-t.top)*n-f.oy,a=Math.max(0,Math.min(f.cx+r,s.current.naturalWidth-u.width)),c=Math.max(0,Math.min(f.cy+i,s.current.naturalHeight-u.height));d(e=>({...e,x:a,y:c}))},[f,u.width,u.height]),v=(0,$.useCallback)(()=>p(null),[]),y=(0,$.useCallback)(()=>l(e=>(e+90)%360),[]),b=(0,$.useCallback)(async()=>{if(!s.current)return;let e=s.current,n=document.createElement(`canvas`),o=u.width,l=u.height;n.width=c%180==0?o:l,n.height=c%180==0?l:o;let d=n.getContext(`2d`);if(!d)return;d.save(),d.translate(n.width/2,n.height/2),d.rotate(c*Math.PI/180),d.drawImage(e,u.x,u.y,o,l,-o/2,-l/2,o,l),d.restore();let f=await new Promise(e=>n.toBlob(e,r));f&&(a(f,i),t(!1))},[u,c,i,r,a,t]);return(0,Q.jsx)(nn,{open:e,onOpenChange:t,children:(0,Q.jsxs)(It,{className:`max-w-xl`,children:[(0,Q.jsxs)(Ge,{children:[(0,Q.jsx)(Bt,{children:`Crop & rotate image`}),(0,Q.jsx)(Yt,{children:`Drag the highlighted box to reposition the crop. Use the rotate button to spin the image in 90° increments.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[m?(0,Q.jsx)(`canvas`,{ref:o,"data-testid":`image-cropper-canvas`,role:`img`,"aria-label":`Image crop preview`,className:`border rounded-md cursor-move touch-none max-w-full`,onPointerDown:g,onPointerMove:_,onPointerUp:v,onPointerCancel:v}):(0,Q.jsx)(`div`,{className:`flex h-[270px] w-full items-center justify-center text-sm text-muted-foreground`,children:`Loading image…`}),(0,Q.jsxs)(`div`,{className:`flex w-full items-center justify-between text-xs text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{children:[`Crop: `,Math.round(u.width),` × `,Math.round(u.height),` px`]}),(0,Q.jsxs)(`span`,{children:[`Rotation: `,c,`°`]})]})]}),(0,Q.jsxs)(St,{className:`flex justify-between sm:justify-between`,children:[(0,Q.jsxs)(J,{type:`button`,variant:`outline`,onClick:y,"data-testid":`image-cropper-rotate`,children:[(0,Q.jsx)(_r,{className:`size-4 mr-2`}),`Rotate 90°`]}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(J,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsxs)(J,{type:`button`,onClick:b,disabled:!m,"data-testid":`image-cropper-confirm`,children:[(0,Q.jsx)(rr,{className:`size-4 mr-2`}),`Apply crop`]})]})]})]})})},Td=n({FormulaField:()=>Ed});function Ed({value:e,field:t,...n}){let r=zn(),i=t?.returnType??`text`;if(e==null)return(0,Q.jsx)(Y,{className:n.className});let a;if(i===`number`)a=typeof e==`number`?e.toFixed(2):String(e);else if(i===`boolean`)a=e?`Yes`:`No`;else if(i===`date`){if(isNaN(En(e).getTime()))return(0,Q.jsx)(Y,{className:n.className});a=An(e,void 0,{locale:r})}else a=String(e);return(0,Q.jsx)(`span`,{className:`text-sm font-mono text-gray-700 ${n.className||``}`,children:a})}var Dd=n({SummaryField:()=>Od});function Od({value:e,field:t,...n}){let r=t?.summaryOperations?.function??`count`;if(e==null)return(0,Q.jsx)(Y,{className:n.className});let i;return i=r===`count`?String(e):[`sum`,`avg`,`min`,`max`].includes(r)&&typeof e==`number`?e.toFixed(2):String(e),(0,Q.jsx)(`span`,{className:`text-sm font-medium tabular-nums text-gray-700 ${n.className||``}`,children:i})}var kd=n({AutoNumberField:()=>Ad});function Ad({value:e,field:t,...n}){return e==null?(0,Q.jsx)(Y,{className:n.className}):(0,Q.jsx)(`span`,{className:`text-sm font-mono text-gray-700 ${n.className||``}`,children:String(e)})}var jd=n({VectorField:()=>Md});function Md({value:e,field:t,...n}){let r=t?.dimensions||(Array.isArray(e)?e.length:0);if(!e||!Array.isArray(e))return(0,Q.jsx)(Y,{});let i=e.slice(0,3).map(e=>{let t=Number(e);return isNaN(t)?`0`:t.toFixed(4)}).join(`, `);return(0,Q.jsxs)(`div`,{className:`text-sm ${n.className||``}`,children:[(0,Q.jsxs)(`span`,{className:`font-mono text-gray-700`,children:[`[`,i,`...]`]}),(0,Q.jsxs)(`span`,{className:`text-gray-500 ml-2`,children:[`(`,r,`D)`]})]})}var Nd=n({GridField:()=>$d,computeRow:()=>Gd,evalArith:()=>Bd,lookupAutofillPatch:()=>Vd,sumColumn:()=>Qd}),Pd=e=>e===`number`||e===`currency`,Fd={text:160,select:132,lookup:168,number:104,currency:116,date:150,datetime:200,time:116,file:168},Id=e=>e.width??Fd[e.type??`text`]??132;function Ld(e){if(e.width)return{width:e.width,minWidth:e.width};if((e.type??`text`)===`text`)return{minWidth:180};let t=Fd[e.type??`text`]??132;return{width:t,minWidth:t}}function Rd(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===` `||r===` `||r===`
|
|
18
|
-
`){n++;continue}if(r>=`0`&&r<=`9`||r===`.`){let r=n+1;for(;r<e.length&&(e[r]>=`0`&&e[r]<=`9`||e[r]===`.`);)r++;t.push({t:`num`,v:e.slice(n,r)}),n=r;continue}if(/[a-zA-Z_]/.test(r)){let r=n+1;for(;r<e.length&&/[a-zA-Z0-9_.]/.test(e[r]);)r++;t.push({t:`id`,v:e.slice(n,r)}),n=r;continue}if(r===`+`||r===`-`||r===`*`||r===`/`||r===`%`){t.push({t:`op`,v:r}),n++;continue}if(r===`(`){t.push({t:`lp`,v:r}),n++;continue}if(r===`)`){t.push({t:`rp`,v:r}),n++;continue}return null}return t}function zd(e,t){let n=e.startsWith(`record.`)?e.slice(7):e,r=t?.[n];if(r==null||r===``)return null;let i=Number(r);return Number.isFinite(i)?i:null}function Bd(e,t){let n=Rd(e);if(!n||n.length===0)return null;let r=0,i=!1,a=()=>n[r],o=()=>n[r++];function s(){let e=a();if(!e)return i=!0,NaN;if(e.t===`op`&&e.v===`-`)return o(),-s();if(e.t===`op`&&e.v===`+`)return o(),s();if(e.t===`num`)return o(),Number(e.v);if(e.t===`id`){o();let n=zd(e.v,t);return n===null?(i=!0,NaN):n}if(e.t===`lp`){o();let e=l(),t=o();return(!t||t.t!==`rp`)&&(i=!0),e}return i=!0,NaN}function c(){let e=s();for(;a()&&a().t===`op`&&(a().v===`*`||a().v===`/`||a().v===`%`);){let t=o().v,n=s();e=t===`*`?e*n:t===`/`?e/n:e%n}return e}function l(){let e=c();for(;a()&&a().t===`op`&&(a().v===`+`||a().v===`-`);){let t=o().v,n=c();e=t===`+`?e+n:e-n}return e}let u=l();return i||r!==n.length||!Number.isFinite(u)?null:u}function Vd(e,t,n){let r={[t.name]:n?.value??n?.id??n?._id};if(t.autofill!==!1&&n&&typeof n==`object`)for(let i of e){if(i.name===t.name||i.computed||i.type===`lookup`)continue;let e=n[i.name];e!=null&&e!==``&&(r[i.name]=e)}return r}function Hd(e){return ya(void 0,e)}function Ud(e){return e?Or(e):void 0}function Wd(e,t){return e.type===`currency`?Ud(Hd(t)):e.scale}function Gd(e,t,n){let r=e.filter(e=>e.computed&&e.expr);if(r.length===0)return t;let i={...t};for(let e of r){let t=Bd(e.expr,i);if(t===null){i[e.name]=null;continue}let r=Wd(e,n);i[e.name]=r==null?t:Number(t.toFixed(r))}return i}var Kd=e=>e===`date`||e===`datetime`||e===`time`;function qd(e,t,n){let r=String(t);if(e===`time`)return r;if(e===`date`){let e=Bn(t);if(!e)return r;let i=En(e);return Number.isNaN(i.getTime())?r:An(i,void 0,{locale:n})}if(Number.isNaN(En(t instanceof Date?t:r).getTime()))return r;let i=t instanceof Date?t:new Date(r);return Ln(i,{style:`compact`,locale:n})}function Jd(e,t,n){return e.prefix?e.prefix:t?Dr(t,n):``}function Yd(e,t,n,r){let i=Ud(n),a=i===void 0?{}:{minimumFractionDigits:i,maximumFractionDigits:i};if(e.prefix||!n)return`${Jd(e,n,r)}${oe(t,{locale:r,...a})}`;try{return oe(t,{locale:r,currency:n,...a})}catch{return`${n} ${t.toFixed(i)}`}}function Xd(e,t,n,r){if(t==null||t===``)return`—`;if(Kd(e.type))return qd(e.type,t,n);if(e.type===`file`){let e=Array.isArray(t)?t:[t];if(e.length===0)return`—`;if(e.length>1)return`${e.length} files`;let n=e[0];return typeof n==`string`?n:n?.name||n?.original_name||`File`}if(e.type===`select`&&Array.isArray(e.options)){let n=e.options.find(e=>String(e.value)===String(t));return n?n.label:String(t)}if(Pd(e.type)){let i=Number(t);if(Number.isFinite(i))return e.type===`currency`?Yd(e,i,r,n):i.toLocaleString(n)}return Array.isArray(t)?t.join(`, `):String(t)}function Zd(e,t){if(Pd(e)){if(t===``||t==null)return null;let e=Number(t);return Number.isNaN(e)?t:e}return e===`datetime`?On(t):t}function Qd(e,t){return Array.isArray(e)?e.reduce((e,n)=>{let r=Number(n?.[t]);return e+(Number.isFinite(r)?r:0)},0):0}function $d({value:e,onChange:t,field:n,readonly:r,disabled:i,className:a,error:s,onRowExpand:c,displayMode:l,onAdd:u,...d}){let f=n||{},p=f.columns||[],m=Array.isArray(e)?e:[],h=d.contextRecord,g=zn(),{t:_}=zr(),v=_(`view.dragToReorder`,{defaultValue:`Drag to reorder`}),y=_(`fields.grid.openRow`,{defaultValue:`Open row`}),b=_(`fields.grid.duplicateRow`,{defaultValue:`Duplicate row`}),x=_(`fields.grid.removeRow`,{defaultValue:`Remove row`}),S=_(`form.masterDetail.total`,{defaultValue:`Total`}),C=e=>_(`validation.required`,{field:e.label||e.name,defaultValue:`{{field}} is required`}),w=$.useId(),{currency:T}=Fn(),D=Hd(T),O=(0,$.useCallback)((e,t)=>{if(!e.readonlyWhen&&!e.requiredWhen)return{readonly:!1,required:!!e.required};let n=xt({readonlyWhen:e.readonlyWhen,requiredWhen:e.requiredWhen},t||{},{required:!!e.required,readonly:!1},void 0,h?{parent:h}:void 0);return{readonly:n.readonly,required:n.required}},[h]),A=l===`list`&&!r,[j,M]=$.useState(()=>new Set),ee=p.filter(e=>e.defaultHidden&&!e.required),N=p.filter(e=>!e.defaultHidden||e.required||j.has(e.name)),P=(0,$.useCallback)(e=>{M(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),F=f.allow_add!==!1&&!r&&!i,te=f.allow_delete!==!1&&!r&&!i,I=F,L=typeof c==`function`&&!r,re=f.min_rows??0,R=f.max_rows,z=f.total_field,B=f.sort_field,V=f.allow_reorder!==!1&&!r&&!i,H=(0,$.useCallback)(e=>{t?.(B?e.map((e,t)=>({...e,[B]:t})):e)},[t,B]),ie=(0,$.useCallback)(()=>{let e={};for(let t of N)e[t.name]=null;return e},[N]),ae=(0,$.useCallback)((e,t)=>{if(e>=m.length){if(R!=null&&m.length>=R)return;H([...m,Gd(N,{...ie(),...t},T)]);return}H(m.map((n,r)=>r===e?Gd(N,{...n,...t},T):n))},[m,N,R,ie,H,T]),W=(0,$.useCallback)((e,t,n)=>ae(e,{[t]:n}),[ae]),oe=(0,$.useCallback)((e,t,n)=>{ae(e,Vd(N,t,n))},[N,ae]),se=(0,$.useCallback)((e,t,n)=>W(e,t,n),[W]),G=(0,$.useCallback)((e,t,n)=>{W(e,t.name,Zd(t.type,n))},[W]),K=(0,$.useCallback)(()=>{R!=null&&m.length>=R||H([...m,ie()])},[m,ie,R,H]),le=(0,$.useRef)(null),ue=(0,$.useCallback)((e,t)=>{let n=le.current?.querySelector(`[data-cell="${e}-${t}"]`);n&&(n.focus(),n instanceof HTMLInputElement&&n.select())},[]),de=(0,$.useCallback)((e,t,n)=>{e.key===`ArrowDown`||e.key===`Enter`?(e.preventDefault(),ue(t+1,n)):e.key===`ArrowUp`&&(e.preventDefault(),t>0&&ue(t-1,n))},[ue]),fe=(0,$.useCallback)(e=>{m.length<=re||H(m.filter((t,n)=>n!==e))},[m,re,H]),pe=(0,$.useCallback)(e=>{if(R!=null&&m.length>=R)return;let t=m[e];if(!t)return;let{id:n,_id:r,recordId:i,...a}=t,o=[...m];o.splice(e+1,0,{...a}),H(o)},[m,R,H]),me=(0,$.useCallback)((e,t)=>{if(e===t||e<0||t<0||e>=m.length||t>=m.length)return;let n=[...m],[r]=n.splice(e,1);n.splice(t,0,r),H(n)},[m,H]),he=(0,$.useRef)(null),ge=L||te||I,_e=(+!!L+ +!!I+ +!!te)*34+12,q=!!z,ve=q?Qd(m,z):0,ye=q?Math.max(0,N.findIndex(e=>e.name===z)):-1,xe=ee.length>0?(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(ce,{asChild:!0,children:(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 gap-1.5 text-xs text-muted-foreground`,"data-testid":`line-items-columns`,children:[(0,Q.jsx)(yr,{className:`h-3.5 w-3.5`}),_(`table.columns`,{defaultValue:`Columns`}),j.size>0&&(0,Q.jsxs)(`span`,{className:`rounded-full bg-primary/10 px-1.5 text-[10px] font-medium text-primary`,children:[`+`,j.size]})]})}),(0,Q.jsxs)(Fe,{align:`end`,className:`w-56 p-2`,children:[(0,Q.jsx)(`div`,{className:`px-1 pb-1.5 text-xs font-medium text-muted-foreground`,children:_(`fields.grid.optionalColumns`,{defaultValue:`Optional columns`})}),(0,Q.jsx)(`div`,{className:`max-h-64 space-y-0.5 overflow-y-auto`,children:ee.map(e=>{let t=`col-toggle-${e.name}`;return(0,Q.jsxs)(ot,{htmlFor:t,className:`flex cursor-pointer items-center gap-2 rounded-md px-1.5 py-1.5 text-sm font-normal hover:bg-muted`,children:[(0,Q.jsx)(sn,{id:t,checked:j.has(e.name),onCheckedChange:()=>P(e.name)}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.label||e.name})]},e.name)})})]})]}):null;if(r)return(0,Q.jsxs)(`div`,{...Br(d,`instead-of-the-inputs`),className:U(`space-y-2`,a),children:[xe&&(0,Q.jsx)(`div`,{className:`flex justify-end`,children:xe}),(0,Q.jsx)(`div`,{className:`border border-border rounded-lg overflow-x-auto`,"data-testid":`line-items-readonly`,children:(0,Q.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Q.jsx)(`thead`,{className:`bg-muted border-b border-border`,children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{className:`w-10 px-2 py-2 text-right text-xs font-medium text-muted-foreground`,children:`#`}),N.map(e=>(0,Q.jsx)(`th`,{style:{minWidth:Id(e)},className:U(`px-3 py-2 text-xs font-medium text-muted-foreground whitespace-nowrap`,Pd(e.type)?`text-right`:`text-left`),children:e.label||e.name},e.name))]})}),(0,Q.jsx)(`tbody`,{className:`divide-y divide-border`,children:m.length===0?(0,Q.jsx)(`tr`,{children:(0,Q.jsx)(`td`,{colSpan:N.length+1,className:`px-3 py-6 text-center text-muted-foreground`,children:_(`fields.grid.noItems`,{defaultValue:`No items`})})}):m.map((e,t)=>(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`td`,{className:`px-2 py-2 text-right text-muted-foreground tabular-nums`,children:t+1}),N.map(t=>(0,Q.jsx)(`td`,{className:U(`px-3 py-2 text-foreground`,Pd(t.type)&&`text-right tabular-nums`),children:t.type===`lookup`&&e[t.name]!=null&&e[t.name]!==``?(0,Q.jsx)(Ul,{value:e[t.name],onChange:()=>{},readonly:!0,field:{reference:t.reference,displayField:t.displayField,idField:t.idField}}):t.type===`file`||Kd(t.type)?Xd(t,e[t.name],g,D):e[t.name]!=null&&e[t.name]!==``?String(e[t.name]):`—`},t.name))]},t))}),q&&(0,Q.jsx)(`tfoot`,{className:`border-t border-border bg-muted/40`,children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`td`,{colSpan:1+ye,className:`px-3 py-2 text-right text-xs font-medium text-muted-foreground`,children:S}),(0,Q.jsx)(`td`,{className:`px-3 py-2 text-right font-semibold text-foreground tabular-nums`,children:ve.toLocaleString(g)}),N.length-ye-1>0&&(0,Q.jsx)(`td`,{colSpan:N.length-ye-1})]})})]})})]});let Se=!A&&F&&(R==null||m.length<R),Ce=Se?[...m,ie()]:m,we=!!s&&m.length===0,Te=(e,t,n,r,a=!1)=>{let s=r?.[e.name],c=i||O(e,r).readonly;if(A)return e.type===`lookup`&&s!=null&&s!==``?(0,Q.jsx)(Ul,{value:s,onChange:()=>{},readonly:!0,field:{reference:e.reference,displayField:e.displayField,idField:e.idField}}):(0,Q.jsx)(`span`,{className:U(`px-2 text-sm text-foreground`,Pd(e.type)&&`tabular-nums`,(s==null||s===``)&&`text-muted-foreground`),children:Xd(e,s,g,D)});if(e.computed)return(0,Q.jsx)(`span`,{className:U(`block px-2 text-sm tabular-nums`,Pd(e.type)?`text-right`:`text-left`,s==null||s===``?`text-muted-foreground`:`text-foreground`),title:_(`fields.grid.computed`,{defaultValue:`Computed`}),"data-computed":e.name,children:Xd(e,s,g,D)});if(e.type===`lookup`)return(0,Q.jsx)(Ul,{value:s,onChange:t=>se(n,e.name,t),onSelectRecord:t=>oe(n,e,t),compact:!0,field:{reference:e.reference,displayField:e.displayField,idField:e.idField,multiple:e.multiple,options:e.options,placeholder:`—`},disabled:c,error:a?C(e):void 0});if(e.type===`file`)return(0,Q.jsx)(yd,{value:s,onChange:t=>se(n,e.name,t),multiple:e.multiple,accept:Array.isArray(e.accept)&&e.accept.length>0?e.accept.join(`,`):void 0,disabled:c,"aria-label":e.label||e.name,"data-cell":`${n}-${t}`,error:a?C(e):void 0});if(e.type===`select`)return(0,Q.jsxs)(k,{value:s==null?``:String(s),onValueChange:t=>G(n,e,t),disabled:c,children:[(0,Q.jsx)(E,{className:`h-8 rounded-none border-0 bg-transparent px-2 shadow-none focus:ring-1 focus:ring-ring/60`,"aria-label":e.label||e.name,"aria-invalid":a||void 0,children:(0,Q.jsx)(ne,{placeholder:`—`})}),(0,Q.jsx)(be,{children:(e.options||[]).map(e=>(0,Q.jsx)(Ee,{value:e.value,children:e.label},e.value))})]});let l=e.type===`currency`?Jd(e,D,g):``,u=(e.type===`date`||e.type===`datetime`)&&Nn(s),d=u?`${w}-impossible-${n}-${t}`:void 0;return(0,Q.jsxs)(`div`,{className:`relative`,children:[l&&(0,Q.jsx)(`span`,{className:`pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-xs text-muted-foreground`,children:l}),(0,Q.jsx)(o,{"data-cell":`${n}-${t}`,"aria-invalid":a||u||void 0,"aria-describedby":d,onKeyDown:e=>de(e,n,t),className:U(`h-8 rounded-none border-0 bg-transparent px-2 shadow-none focus-visible:ring-1 focus-visible:ring-ring/60`,l&&`pl-6`,Pd(e.type)&&`text-right tabular-nums`),type:e.type===`date`?`date`:e.type===`datetime`?`datetime-local`:e.type===`time`?`time`:Pd(e.type)?`number`:`text`,step:Pd(e.type)?e.step??`any`:void 0,"aria-label":e.label||e.name,value:e.type===`date`?u?``:Bn(s):e.type===`datetime`?kn(s):s==null?``:String(s),onChange:t=>G(n,e,t.target.value),disabled:c}),u&&(0,Q.jsx)(`p`,{id:d,className:`px-2 pb-1 text-xs text-destructive`,"data-testid":`line-items-impossible-day-${n}-${e.name}`,children:_(e.type===`date`?`fields.date.impossibleDay`:`fields.dateTime.impossibleDay`,{value:String(s)})})]})},{"aria-invalid":De,name:Oe,...Ae}=Z(d),je=Ae[`aria-labelledby`]!=null;return(0,Q.jsxs)(`div`,{...Ae,role:je?`group`:void 0,className:U(`space-y-2`,a),"data-testid":`line-items`,children:[xe&&(0,Q.jsx)(`div`,{className:`flex justify-end`,children:xe}),(0,Q.jsx)(`div`,{className:`border border-border rounded-lg overflow-x-auto`,children:(0,Q.jsxs)(`table`,{ref:le,className:`w-full text-sm`,children:[(0,Q.jsx)(`thead`,{className:`bg-muted/60 border-b border-border`,children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{className:U(`px-2 py-2 text-right text-xs font-medium text-muted-foreground`,V?`w-14`:`w-10`),children:`#`}),N.map(e=>(0,Q.jsxs)(`th`,{className:U(`px-2 py-2 text-xs font-medium text-muted-foreground whitespace-nowrap`,Pd(e.type)?`text-right`:`text-left`),style:Ld(e),children:[e.label||e.name,e.required&&!e.computed&&(0,Q.jsx)(`span`,{className:`text-destructive`,children:` *`})]},e.name)),ge&&(0,Q.jsx)(`th`,{style:{width:_e}})]})}),(0,Q.jsx)(`tbody`,{className:`divide-y divide-border`,children:A&&m.length===0?(0,Q.jsx)(`tr`,{children:(0,Q.jsx)(`td`,{colSpan:N.length+ +!!ge+1,className:`px-3 py-6 text-center text-muted-foreground`,children:_(`fields.grid.noItemsAddHint`,{label:f.add_label||_(`detail.add`,{defaultValue:`Add`}),defaultValue:`No items yet — click “{{label}}” to begin.`})})}):Ce.map((e,t)=>{let n=Se&&t===m.length,r=V&&!n&&!A;return(0,Q.jsxs)(`tr`,{className:U(`group`,!n&&`hover:bg-muted/30`),...V&&!n?{onDragOver:e=>{he.current!=null&&e.preventDefault()},onDrop:e=>{e.preventDefault(),he.current!=null&&(me(he.current,t),he.current=null)}}:{},children:[(0,Q.jsx)(`td`,{className:`px-1 py-1 text-right align-middle text-xs text-muted-foreground tabular-nums`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center justify-end gap-0.5`,children:[r&&(0,Q.jsx)(`span`,{draggable:!0,onDragStart:()=>{he.current=t},onDragEnd:()=>{he.current=null},className:`cursor-grab text-muted-foreground/40 opacity-0 transition-opacity group-hover:opacity-100`,title:v,"aria-label":v,"data-testid":`line-items-drag-${t}`,children:(0,Q.jsx)(lr,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`span`,{className:U(n&&`opacity-30`),children:t+1})]})}),N.map((r,i)=>{let a=O(r,e).required,o=(!n||we)&&!A&&a&&!r.computed&&(e[r.name]==null||e[r.name]===``);return(0,Q.jsx)(`td`,{title:o?C(r):void 0,"data-testid":o?`line-items-invalid-${t}-${r.name}`:void 0,className:U(`border-r border-border/40 px-1 py-0.5 align-middle last:border-r-0`,A&&`px-2 py-1.5`,o&&`bg-destructive/5 ring-1 ring-inset ring-destructive/50`),children:Te(r,i,t,e,o)},r.name)}),ge&&(0,Q.jsx)(`td`,{className:`px-1 py-0.5 align-middle whitespace-nowrap`,children:(0,Q.jsxs)(`div`,{className:`flex items-center justify-center gap-0.5`,children:[!n&&L&&(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground hover:text-foreground`,"aria-label":y,title:y,"data-testid":`line-items-expand-${t}`,onClick:()=>c(t),children:(0,Q.jsx)(mr,{className:`h-3.5 w-3.5`})}),!n&&I&&(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground hover:text-foreground`,"aria-label":b,title:b,"data-testid":`line-items-duplicate-${t}`,onClick:()=>pe(t),disabled:i||R!=null&&m.length>=R,children:(0,Q.jsx)(nr,{className:`h-3.5 w-3.5`})}),!n&&te&&(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground hover:text-destructive`,"aria-label":x,"data-testid":`line-items-remove-${t}`,onClick:()=>fe(t),disabled:i||m.length<=re,children:(0,Q.jsx)(Cr,{className:`h-4 w-4`})})]})})]},t)})}),q&&(0,Q.jsx)(`tfoot`,{className:`border-t border-border bg-muted/40`,children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`td`,{colSpan:1+ye,className:`px-3 py-2 text-right text-xs font-medium text-muted-foreground`,children:S}),(0,Q.jsx)(`td`,{className:`px-3 py-2 text-right font-semibold text-foreground tabular-nums`,"data-testid":`line-items-total`,children:ve.toLocaleString(g)}),N.length-ye-1+ +!!ge>0&&(0,Q.jsx)(`td`,{colSpan:N.length-ye-1+ +!!ge})]})})]})}),F&&(0,Q.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:A&&u?u:K,disabled:R!=null&&m.length>=R,"data-testid":`line-items-add`,children:[(0,Q.jsx)(hr,{className:`mr-1.5 h-4 w-4`}),f.add_label||_(`fields.grid.addLine`,{defaultValue:`Add line`})]})]})}var ef=n({AvatarField:()=>tf});function tf({value:e,onChange:t,field:n,readonly:r,onUploadingChange:i,error:a,...o}){let[s,c]=$.useState(!1),l=$.useRef(null),{upload:u}=jr(),{t:d}=In(),[f,p]=$.useState(!1),[m,h]=$.useState(null),[g,_]=$.useState({});Nr(f,i);let v=Fr(),y=n,b=Rr(Ar(e,``),g)[0]?.url,x=async e=>{let n=e.target.files?.[0];if(l.current&&(l.current.value=``),!n)return;if(!n.type.startsWith(`image/`)){console.error(`Please select an image file`);return}if(n.size>5242880){console.error(`File size must be less than 5MB`);return}h(null);let r=v();p(!0);try{let e=await u(n),r=kr(e,n.name),i=Mr(e,n.name);i.id&&_(e=>({...e,[i.id]:i})),t(r)}catch(e){h(Lr(d,n.name,e))}finally{r(),p(!1)}},S=()=>{t(``)},C=()=>(y?.defaultName||y?.label||`User`).split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return r?(0,Q.jsxs)(Ve,{className:`w-16 h-16`,children:[b&&(0,Q.jsx)(Sn,{src:b,alt:y?.label}),(0,Q.jsx)(un,{children:C()})]}):(0,Q.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Q.jsxs)(`div`,{className:`relative`,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,Q.jsxs)(Ve,{className:`w-16 h-16`,children:[b&&(0,Q.jsx)(Sn,{src:b,alt:y?.label}),(0,Q.jsx)(un,{children:C()})]}),!r&&s&&e&&(0,Q.jsx)(`button`,{type:`button`,onClick:S,className:`absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90`,children:(0,Q.jsx)(Er,{className:`w-3 h-3`})})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`input`,{ref:l,type:`file`,accept:`image/*`,onChange:x,className:`hidden`}),(0,Q.jsx)(J,{...Z(o),type:`button`,variant:`outline`,size:`sm`,onClick:()=>l.current?.click(),disabled:r||o.disabled||f,"aria-invalid":!!a,children:f?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(fr,{className:`w-4 h-4 mr-2 animate-spin`}),d(`fields.image.uploading`,{defaultValue:`Uploading…`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Tr,{className:`w-4 h-4 mr-2`}),e?`Change`:`Upload`,` Avatar`]})}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`PNG, JPG up to 5MB`}),m&&(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:m})]})]})}var nf=n({SignatureField:()=>rf});function rf({value:e,onChange:t,readonly:n,...r}){let i=(0,$.useRef)(null),[a,o]=$.useState(!1),[s,c]=$.useState(!e);(0,$.useEffect)(()=>{if(e&&i.current){let t=i.current.getContext(`2d`);if(t){let n=new Image;n.onload=()=>{t.drawImage(n,0,0),c(!1)},n.src=e}}},[e]);let l=e=>{if(n)return;o(!0),c(!1);let t=i.current;if(!t)return;let r=t.getContext(`2d`);if(!r)return;let a=t.getBoundingClientRect(),s=`touches`in e?e.touches[0].clientX-a.left:e.clientX-a.left,l=`touches`in e?e.touches[0].clientY-a.top:e.clientY-a.top;r.beginPath(),r.moveTo(s,l)},u=e=>{if(!a||n)return;let t=i.current;if(!t)return;let r=t.getContext(`2d`);if(!r)return;let o=t.getBoundingClientRect(),s=`touches`in e?e.touches[0].clientX-o.left:e.clientX-o.left,c=`touches`in e?e.touches[0].clientY-o.top:e.clientY-o.top;r.lineTo(s,c),r.strokeStyle=`#000`,r.lineWidth=2,r.lineCap=`round`,r.lineJoin=`round`,r.stroke()},d=()=>{if(!a)return;o(!1);let e=i.current;e&&t(e.toDataURL(`image/png`))},f=()=>{let e=i.current;if(!e)return;let n=e.getContext(`2d`);n&&(n.clearRect(0,0,e.width,e.height),c(!0),t(``))},p=Br(r,`instead-of-the-inputs`);return n&&e?(0,Q.jsx)(`div`,{...p,className:`border rounded p-2 bg-white`,children:(0,Q.jsx)(`img`,{src:e,alt:`Signature`,loading:`lazy`,className:`max-w-full h-auto`})}):n&&!e?(0,Q.jsx)(`span`,{...p,className:`text-sm text-muted-foreground`,children:`No signature`}):(0,Q.jsxs)(`div`,{...p,className:`space-y-2`,children:[(0,Q.jsx)(`div`,{className:`border rounded bg-white`,children:(0,Q.jsx)(`canvas`,{ref:i,width:400,height:200,className:`w-full touch-none cursor-crosshair`,onMouseDown:l,onMouseMove:u,onMouseUp:d,onMouseLeave:d,onTouchStart:l,onTouchMove:u,onTouchEnd:d})}),(0,Q.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s?`Sign above`:`Signature captured`}),(0,Q.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:f,disabled:n||s,children:[(0,Q.jsx)(ar,{className:`w-4 h-4 mr-2`}),`Clear`]})]})]})}var af=new Map;function of(e,t){if(!e||typeof e!=`object`)return;if(t){let n=e[t];if(typeof n==`string`&&n.trim())return n.trim();if(typeof n==`number`)return String(n)}for(let t of[`name`,`full_name`,`display_name`,`label`,`title`,`subject`,`username`]){let n=e[t];if(typeof n==`string`&&n.trim())return n.trim();if(typeof n==`number`)return String(n)}let n=e.first_name,r=e.last_name,i=[e.salutation,n,r].filter(e=>typeof e==`string`&&e.trim()).map(e=>e.trim()).join(` `);if(i)return i;let a=e.email;if(typeof a==`string`&&a.trim())return a.trim();let o=new Set([`id`,`_id`,`organization_id`,`created_by`,`updated_by`,`created_at`,`updated_at`,`tenant_id`]),s=[`_name`,`_title`,`_number`,`_code`,`_label`];for(let[t,n]of Object.entries(e))if(!o.has(t)&&!t.endsWith(`_id`)&&s.some(e=>t.endsWith(e))){if(typeof n==`string`&&n.trim())return n.trim();if(typeof n==`number`)return String(n)}}var sf=new Map;async function cf(e,t){let n=()=>{let e=sf.get(t);return e?.state===`ok`?e.schema:void 0},r=sf.get(t);if(r?.state===`pending`)return await r.promise,n();if(r)return n();let i=e?.getObjectSchema;if(typeof i!=`function`)return;let a=Promise.resolve().then(()=>i.call(e,t)).then(e=>{sf.set(t,{state:`ok`,schema:e})}).catch(()=>{sf.set(t,{state:`err`})});return sf.set(t,{state:`pending`,promise:a}),await a,n()}function lf(e){let t=$.useContext(ln)?.dataSource,[,n]=$.useState(0),r=!!e&&!!t&&typeof t.getObjectSchema==`function`;if($.useEffect(()=>{if(!r)return;let i=sf.get(e);if(i&&i.state!==`pending`)return;let a=!0;return cf(t,e).then(()=>{a&&n(e=>e+1)}),()=>{a=!1}},[r,e,t]),!r)return;let i=sf.get(e);return i?.state===`ok`?i.schema:void 0}function uf(e,t,n,r,i){if(!e||typeof e!=`object`)return;let a=sa(e,r,i);if(t){let e=A(t,a,{titleField:n}),r=a.id??a._id;if(!(e===`Untitled`||r!=null&&e===`Record #${r}`)&&e)return e}return of(a,n)}function df(e,t,n,r){let i=$.useContext(ln)?.dataSource,[,a]=$.useState(0),o=!!e&&!!i&&typeof i.find==`function`&&(typeof t==`string`||typeof t==`number`)&&t!==``,s=o?`${e}:${String(t)}:${n??``}`:``;if($.useEffect(()=>{if(!o)return;let n=af.get(s);if(n&&n.state!==`pending`&&n.promise==null||n?.state===`pending`)return;let r=(async()=>{try{let n;n=typeof i.findOne==`function`?await i.findOne(e,t):$r(await i.find(e,{$filter:{id:t},$top:1}))[0];let r=await cf(i,e);af.set(s,{state:`ok`,record:n,schema:r})}catch{af.set(s,{state:`err`})}a(e=>e+1)})();af.set(s,{state:`pending`,promise:r})},[s,o,e,t,i]),!o)return;let c=af.get(s);return c?.state===`ok`?uf(c.record,c.schema,n,r,e):void 0}function ff(){let{t:e}=In();return(t,n)=>{let r=e(t);return!r||r===t?n:r}}function pf(){let{t:e}=In();return e}function mf(e){return tn(e)||typeof e==`string`&&e.trim()===``}function hf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date)}function gf(e,t,n=0,r){return Is(oa(e,t),n,r)}function _f({text:e,className:t}){return(0,Q.jsx)(`span`,{className:U(`block max-w-full truncate`,t),title:e,children:e})}function vf({value:e}){let t=zs(e);return tn(t)?(0,Q.jsx)(Y,{}):(0,Q.jsx)(_f,{text:String(t)})}function yf({value:e,field:t}){let n=zn(),r=zs(e);if(mf(r))return(0,Q.jsx)(Y,{});let i=Number(r),a=isNaN(i)?String(r):Ms(i,t,n);return(0,Q.jsx)(`span`,{className:`tabular-nums`,children:a})}function bf({value:e,field:t}){let{currency:n}=Fn(),r=zn(),i=zs(e);if(mf(i))return(0,Q.jsx)(Y,{});let a=ya(t,n),o=Number(i),s=isNaN(o)?String(i):Ps(o,a,r);return(0,Q.jsx)(`span`,{className:`tabular-nums font-medium whitespace-nowrap`,children:s})}function xf({value:e,field:t}){let n=zn(),r=zs(e);if(mf(r))return(0,Q.jsx)(Y,{});let i=t,a=ge({type:i.type,scale:i.scale}),o=Number(r);if(isNaN(o))return(0,Q.jsx)(`span`,{className:`tabular-nums whitespace-nowrap`,children:String(r)});let s=Fs(i),c=oa(o,s),l=gf(o,s,a,n),u=Math.max(0,Math.min(100,c));return(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:`h-1.5 w-16 min-w-0 shrink rounded-full bg-muted ring-1 ring-inset ring-border/60 overflow-hidden`,role:`progressbar`,"aria-valuenow":u,"aria-valuemin":0,"aria-valuemax":100,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-all`,style:{width:`${u}%`}})}),(0,Q.jsx)(`span`,{className:`shrink-0 tabular-nums whitespace-nowrap`,children:l})]})}var Sf=new Set([`active`,`is_active`,`enabled`,`is_enabled`,`verified`,`is_verified`]);function Cf({value:e,field:t}){if(typeof e!=`boolean`)return(0,Q.jsx)(`span`,{className:`flex items-center justify-center`,children:(0,Q.jsx)(Y,{})});let n=t?.name?.toLowerCase()||``;return n===`completed`||n===`is_completed`||n===`done`||n===`is_done`?(0,Q.jsx)(`div`,{className:`flex items-center justify-center`,children:e?(0,Q.jsx)(`div`,{className:`size-5 rounded-full bg-green-500 flex items-center justify-center`,role:`img`,"aria-label":`Completed`,"data-testid":`completion-indicator`,children:(0,Q.jsx)(Xn,{className:`size-3 text-white`})}):(0,Q.jsx)(`div`,{className:`size-5 rounded-full border-2 border-muted-foreground/30`,role:`img`,"aria-label":`Not completed`,"data-testid":`completion-indicator`})}):Sf.has(n)&&e===!1?(0,Q.jsxs)(mt,{variant:`destructive`,className:`text-xs`,"data-testid":`boolean-warning-badge`,children:[t?.label||_a(n),` — Off`]}):(0,Q.jsx)(`div`,{className:`flex items-center justify-start`,children:(0,Q.jsx)(sn,{checked:e,disabled:!0,className:`pointer-events-none`})})}var wf=/(^|_)(due|deadline|expires?|expiry|expiration|expected_close|target_close|sla|return_by|renewal|next_action)(_|$)/;function Tf(e){if(e?.dueLike===!0)return!0;let t=e,n=String(t?.name||t?.accessorKey||t?.key||``).toLowerCase();return wf.test(n)}function Ef(e,t){if(!t)return!1;let n=new Date;return n.setHours(0,0,0,0),e<n}function Df({value:e,field:t}){let n=zn(),r=pf();if(!e)return(0,Q.jsx)(Y,{});let i=zs(e);if(mf(i))return(0,Q.jsx)(Y,{});let a=i==null?null:En(i);if(a===null||isNaN(a.getTime()))return(0,Q.jsx)(Y,{});let o=new Date(i),s=t.format||`relative`,c=Tf(t),l=An(i,s,{dueLike:c,locale:n,t:r}),u=Ef(a,c);return(0,Q.jsx)(`span`,{className:`tabular-nums${u?` text-red-600`:``}`,title:o.toISOString(),children:l})}function Of({value:e,field:t}){let n=zn(),r=pf();if(!e)return(0,Q.jsx)(Y,{});let i=zs(e),a=i==null?null:En(i);if(a===null||isNaN(a.getTime()))return(0,Q.jsx)(Y,{});let o=new Date(i),s=t?.format||`compact`,c=s===`short`?`compact`:s,l=Tf(t),u=`tabular-nums text-sm whitespace-nowrap${Ef(o,l)?` text-red-600`:``}`;if(c===`relative`)return(0,Q.jsx)(`span`,{className:u,children:jn(o,{dueLike:l,locale:n,t:r})});if(c===`compact`){let e=Pn(o,{locale:n});if(e)return(0,Q.jsxs)(`span`,{className:u,children:[(0,Q.jsx)(`span`,{children:e.date}),(0,Q.jsx)(`span`,{className:`ml-2 text-muted-foreground`,children:e.time})]})}return(0,Q.jsx)(`span`,{className:u,children:Ln(o,{style:c,locale:n,t:r})})}var kf={critical:`red`,urgent:`red`,high:`orange`,medium:`yellow`,normal:`blue`,low:`gray`,none:`gray`,paid:`green`,completed:`green`,done:`green`,active:`green`,approved:`green`,resolved:`green`,pending:`yellow`,waiting:`yellow`,on_hold:`yellow`,shipped:`blue`,in_progress:`blue`,open:`blue`,processing:`blue`,draft:`gray`,new:`gray`,inactive:`gray`,closed:`gray`,cancelled:`red`,canceled:`red`,rejected:`red`,failed:`red`,overdue:`red`,delivered:`purple`,archived:`indigo`,contacted:`blue`,qualified:`purple`,converted:`green`,won:`green`,lost:`red`,紧急:`red`,严重:`red`,高:`orange`,中:`yellow`,普通:`blue`,低:`gray`,无:`gray`,新建:`gray`,草稿:`gray`,待处理:`yellow`,待审核:`yellow`,待联系:`yellow`,挂起:`yellow`,进行中:`blue`,处理中:`blue`,已联系:`blue`,跟进中:`blue`,已发货:`blue`,打开:`blue`,已确认:`green`,已审核:`green`,已通过:`green`,已完成:`green`,已支付:`green`,已签收:`green`,已转化:`green`,成单:`green`,赢得:`green`,已签约:`green`,已交付:`purple`,已归档:`indigo`,已关闭:`gray`,已取消:`red`,已拒绝:`red`,失败:`red`,逾期:`red`,流失:`red`,丢失:`red`},Af={gray:`bg-gray-50 text-gray-700 border-gray-200 dark:bg-gray-800/50 dark:text-gray-200 dark:border-gray-700/60`,red:`bg-red-50 text-red-700 border-red-200 dark:bg-red-950/40 dark:text-red-300 dark:border-red-900/60`,orange:`bg-orange-50 text-orange-700 border-orange-200 dark:bg-orange-950/40 dark:text-orange-300 dark:border-orange-900/60`,yellow:`bg-yellow-50 text-yellow-800 border-yellow-200 dark:bg-yellow-950/40 dark:text-yellow-300 dark:border-yellow-900/60`,green:`bg-green-50 text-green-700 border-green-200 dark:bg-green-950/40 dark:text-green-300 dark:border-green-900/60`,blue:`bg-blue-50 text-blue-700 border-blue-200 dark:bg-blue-950/40 dark:text-blue-300 dark:border-blue-900/60`,indigo:`bg-indigo-50 text-indigo-700 border-indigo-200 dark:bg-indigo-950/40 dark:text-indigo-300 dark:border-indigo-900/60`,purple:`bg-purple-50 text-purple-700 border-purple-200 dark:bg-purple-950/40 dark:text-purple-300 dark:border-purple-900/60`,pink:`bg-pink-50 text-pink-700 border-pink-200 dark:bg-pink-950/40 dark:text-pink-300 dark:border-pink-900/60`},jf={gray:`bg-gray-400 dark:bg-gray-500`,red:`bg-red-500`,orange:`bg-orange-500`,yellow:`bg-yellow-500`,green:`bg-green-500`,blue:`bg-blue-500`,indigo:`bg-indigo-500`,purple:`bg-purple-500`,pink:`bg-pink-500`},Mf=[`blue`,`green`,`purple`,`orange`,`pink`,`indigo`,`yellow`,`red`];function Nf(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Mf[Math.abs(t)%Mf.length]}function Pf(e){let t=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(e.trim());if(!t)return;let n=t[1];n.length===3&&(n=n.split(``).map(e=>e+e).join(``));let r=parseInt(n.slice(0,2),16)/255,i=parseInt(n.slice(2,4),16)/255,a=parseInt(n.slice(4,6),16)/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=o-s,l=(o+s)/2;if((c===0?0:c/(1-Math.abs(2*l-1)))<.22)return`gray`;let u;return u=o===r?((i-a)/c%6+6)%6:o===i?(a-r)/c+2:(r-i)/c+4,u*=60,u>=345||u<15?`red`:u<30?`orange`:u<60?`yellow`:u<170?`green`:u<238?`blue`:u<250?`indigo`:u<295?`purple`:`pink`}function Ff(e){if(e){if(Af[e])return e;if(e.charAt(0)===`#`)return Pf(e)}}var If=4.5,Lf=1.9,Rf={r:255,g:255,b:255},zf={r:10,g:10,b:10},Bf=(e,t,n)=>Math.min(n,Math.max(t,e));function Vf(e){let t=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(e.trim());if(!t)return;let n=t[1];return n.length===3&&(n=n.split(``).map(e=>e+e).join(``)),{r:parseInt(n.slice(0,2),16),g:parseInt(n.slice(2,4),16),b:parseInt(n.slice(4,6),16)}}function Hf({r:e,g:t,b:n}){let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=o-s,l=(o+s)/2,u=c===0?0:c/(1-Math.abs(2*l-1)),d=0;return c!==0&&(d=o===r?((i-a)/c%6+6)%6:o===i?(a-r)/c+2:(r-i)/c+4,d*=60),{h:d,s:u,l}}function Uf(e,t,n){let r=(e%360+360)%360,i=(1-Math.abs(2*n-1))*t,a=i*(1-Math.abs(r/60%2-1)),o=n-i/2,s;return s=r<60?[i,a,0]:r<120?[a,i,0]:r<180?[0,i,a]:r<240?[0,a,i]:r<300?[a,0,i]:[i,0,a],{r:Math.round((s[0]+o)*255),g:Math.round((s[1]+o)*255),b:Math.round((s[2]+o)*255)}}var Wf=({r:e,g:t,b:n})=>`#`+[e,t,n].map(e=>Bf(Math.round(e),0,255).toString(16).padStart(2,`0`)).join(``);function Gf({r:e,g:t,b:n}){let r=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(e)+.7152*r(t)+.0722*r(n)}function Kf(e,t){let n=Gf(e),r=Gf(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function qf(e,t,n,r,i){let a,o=1/0;for(let s=0;s<=100;s++){let c=s/100,l=Uf(e,t,c);if(Kf(l,r)<i)continue;let u=Math.abs(c-n);u<o&&(o=u,a=l)}if(a)return a;let s={r:0,g:0,b:0},c={r:255,g:255,b:255};return Kf(s,r)>=Kf(c,r)?s:c}function Jf(e){let t=Vf(e);if(!t)return;let{h:n,s:r,l:i}=Hf(t),a=Bf(r,.18,.92),o=.95-.32*(1-i),s=Uf(n,a*(.55+.25*(1-i)),o),c=Uf(n,a*.62,Bf(o-.14,0,1)),l=qf(n,a,i,s,If),u=.1+.3*i,d=Uf(n,a*.6,u),f=Uf(n,a*.55,Bf(u+.12,0,1)),p=qf(n,a,i,d,If);return{bg:Wf(s),fg:Wf(l),border:Wf(c),bgDark:Wf(d),fgDark:Wf(p),borderDark:Wf(f),dot:Wf(qf(n,a,i,Rf,Lf)),dotDark:Wf(qf(n,a,i,zf,Lf))}}var Yf=`bg-[color:var(--os-badge-bg)] text-[color:var(--os-badge-fg)] border-[color:var(--os-badge-border)] dark:bg-[color:var(--os-badge-bg-dark)] dark:text-[color:var(--os-badge-fg-dark)] dark:border-[color:var(--os-badge-border-dark)]`,Xf=`bg-[color:var(--os-dot-bg)] dark:bg-[color:var(--os-dot-bg-dark)]`;function Zf(e){if(!e||e.charAt(0)!==`#`)return;let t=Jf(e);if(t)return{className:Yf,style:{"--os-badge-bg":t.bg,"--os-badge-fg":t.fg,"--os-badge-border":t.border,"--os-badge-bg-dark":t.bgDark,"--os-badge-fg-dark":t.fgDark,"--os-badge-border-dark":t.borderDark}}}function Qf(e){if(!e||e.charAt(0)!==`#`)return;let t=Jf(e);if(t)return{className:Xf,style:{"--os-dot-bg":t.dot,"--os-dot-bg-dark":t.dotDark}}}function $f(e,t){let n=Ff(e);if(n&&Af[n])return Af[n];if(t==null||t===``)return`bg-muted text-muted-foreground border-border`;let r=String(t).toLowerCase().replace(/[\s-]/g,`_`),i=kf[r];return i&&Af[i]?Af[i]:Af[Nf(r)]}function ep({value:e,field:t}){let n=t,r=n.options||[],i=n.appearance===`dot`?`dot`:`badge`;if(tn(e))return(0,Q.jsx)(Y,{});let a=e=>{let t=r.find(t=>t.value===e);if(t)return t;let n=String(e).toLowerCase();return r.find(e=>String(e.value).toLowerCase()===n)},o=(e,t)=>{let n=a(e),r=n?.label||(hf(e)?String(zs(e)):_a(String(e)));if(i===`dot`){let i=Qf(n?.color),a=Ff(n?.color)||kf[String(e).toLowerCase().replace(/[\s-]/g,`_`)]||Nf(String(e).toLowerCase().replace(/[\s-]/g,`_`)),o=i?i.className:jf[a]||jf.gray;return(0,Q.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1.5 text-sm`,title:r,children:[(0,Q.jsx)(`span`,{className:U(`h-1.5 w-1.5 rounded-full shrink-0`,o),style:i?.style,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:r})]},t)}let o=Zf(n?.color),s=o?o.className:$f(n?.color,e);return(0,Q.jsx)(mt,{variant:`outline`,className:U(`max-w-full min-w-0`,s),style:o?.style,title:r,children:(0,Q.jsx)(`span`,{className:`truncate`,children:r})},t)};return Array.isArray(e)?(0,Q.jsx)(`div`,{className:U(`flex flex-wrap`,i===`dot`?`gap-x-3 gap-y-1`:`gap-1`),children:e.map((e,t)=>o(e,t))}):o(e)}function tp({value:e}){let t=ff(),[n,r]=$.useState(!1);if(!e)return(0,Q.jsx)(Y,{});let i=zs(e);if(mf(i))return(0,Q.jsx)(Y,{});let a=String(i);return hf(e)?(0,Q.jsx)(_f,{text:a}):(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 group/email`,children:[(0,Q.jsx)(J,{variant:`link`,className:`p-0 h-auto font-normal text-blue-600 hover:text-blue-800`,asChild:!0,children:(0,Q.jsx)(`a`,{href:`mailto:${a}`,onClick:e=>e.stopPropagation(),children:a})}),(0,Q.jsx)(`button`,{type:`button`,className:`opacity-0 group-hover/email:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted`,onClick:e=>{e.stopPropagation(),e.preventDefault(),navigator.clipboard.writeText(a).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)}).catch(()=>{})},"aria-label":t(`detail.copyEmail`,`Copy email`),children:n?(0,Q.jsx)(Xn,{className:`h-3 w-3 text-green-600`}):(0,Q.jsx)(nr,{className:`h-3 w-3 text-muted-foreground`})})]})}function np({value:e}){if(!e)return(0,Q.jsx)(Y,{});let t=zs(e);if(mf(t))return(0,Q.jsx)(Y,{});let n=String(t);return hf(e)?(0,Q.jsx)(_f,{text:n}):(0,Q.jsx)(J,{variant:`link`,className:`p-0 h-auto font-normal text-blue-600 hover:text-blue-800`,asChild:!0,children:(0,Q.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:n})})}function rp({value:e}){let t=ff(),[n,r]=$.useState(!1);if(!e)return(0,Q.jsx)(Y,{});let i=zs(e);if(mf(i))return(0,Q.jsx)(Y,{});let a=String(i);return hf(e)?(0,Q.jsx)(_f,{text:a}):(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 group/phone`,children:[(0,Q.jsxs)(`a`,{href:`tel:${a}`,className:`inline-flex items-center gap-1 text-blue-600 hover:text-blue-800`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(Xo,{className:`h-3 w-3`}),a]}),(0,Q.jsx)(`button`,{type:`button`,className:`opacity-0 group-hover/phone:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted`,onClick:e=>{e.stopPropagation(),e.preventDefault(),navigator.clipboard.writeText(a).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)}).catch(()=>{})},"aria-label":t(`detail.copyPhone`,`Copy phone number`),children:n?(0,Q.jsx)(Xn,{className:`h-3 w-3 text-green-600`}):(0,Q.jsx)(nr,{className:`h-3 w-3 text-muted-foreground`})})]})}function ip({value:e,field:t}){let n=pf();if(!e)return(0,Q.jsx)(Y,{});t.multiple;let r=n?.(`fields.file.fileFallback`),i=!r||r===`fields.file.fileFallback`?`File`:r,a=(e,t)=>(0,Q.jsx)(Rs,{view:e,className:`text-sm`,fallback:(0,Q.jsx)(_f,{text:e.name,className:`text-sm`})},t),o=e=>{let t=n?.(`detail.fileCount`,{count:e});return!t||t===`detail.fileCount`?`${e} ${e===1?`file`:`files`}`:t};if(Array.isArray(e)){let t=Ar(e,i);return t.length===0?(0,Q.jsx)(`span`,{className:`text-sm text-gray-600`,children:o(t.length)}):(0,Q.jsx)(`span`,{className:`flex min-w-0 max-w-full flex-wrap items-center gap-x-2 gap-y-0.5`,children:t.map((e,t)=>a(e,t))})}return hf(e)&&Object.keys(e).length===0?(0,Q.jsx)(Y,{}):a(Ir(e,i))}function ap(e){return Ar(e,``).filter(e=>e.url).map(e=>({url:e.url,name:e.name||void 0}))}function op({value:e}){let{t}=In(),[n,r]=$.useState(null),i=$.useMemo(()=>ap(e),[e]);if(!e||i.length===0)return(0,Q.jsx)(Y,{});let a=(e,n)=>n||t(`fields.image.imageAlt`,{index:e+1}),o=e=>t=>{t.stopPropagation(),r(e)},s=i.length>1,c=n!==null&&(0,Q.jsx)(Ls,{images:i,index:n,open:!0,onOpenChange:e=>!e&&r(null),onIndexChange:r});return s?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex -space-x-2`,children:[i.slice(0,3).map((e,t)=>(0,Q.jsx)(`img`,{src:e.url,alt:a(t,e.name),onClick:o(t),className:`size-8 cursor-zoom-in rounded-md border-2 border-background object-cover transition-transform hover:scale-110 hover:z-10`},t)),i.length>3&&(0,Q.jsxs)(`button`,{type:`button`,onClick:o(3),className:`size-8 rounded-md border-2 border-background bg-muted flex items-center justify-center text-xs font-medium text-muted-foreground hover:bg-muted/80`,children:[`+`,i.length-3]})]}),c]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`img`,{src:i[0].url,alt:a(0,i[0].name),onClick:o(0),className:`size-10 cursor-zoom-in rounded-md object-cover transition-transform hover:scale-105`}),c]})}function sp(e){return ap(e.value).length>0?(0,Q.jsx)(op,{...e}):(0,Q.jsx)(vf,{...e})}function cp(e){if(e!=null&&e!==``){if(typeof e==`object`){let t=e.id??e._id;return typeof t==`number`||typeof t==`string`&&t!==``?t:void 0}if(typeof e==`string`||typeof e==`number`)return e}}function lp({objectName:e,recordId:t,className:n,children:r}){let i=Zt(),a=e&&t!=null&&t!==``&&i?.recordHref?i.recordHref(e,t):null;return a?(0,Q.jsx)(`a`,{href:a,className:U(`text-primary underline-offset-4 hover:underline`,n),onClick:n=>{n.stopPropagation(),!(n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||n.button!==0)&&i?.openRecord&&(n.preventDefault(),i.openRecord(e,t))},children:r}):(0,Q.jsx)(Q.Fragment,{children:r})}var up=3;function dp({value:e,field:t}){let n=t.reference,r=t.displayField||t.reference_field||void 0,i=lf(n),a=ws(),o=(()=>{if(Array.isArray(e))return e.find(e=>e!=null&&(typeof e==`string`||typeof e==`number`)&&e!==``);if(e!=null&&e!==``&&(typeof e==`string`||typeof e==`number`)&&typeof e!=`object`)return e})(),s=df(n,o,r,a);if(tn(e))return(0,Q.jsx)(Y,{});if(typeof e==`string`){let t=e.trim();if(t.startsWith(`{`)&&t.endsWith(`}`)){let e=``,o;try{let s=JSON.parse(t);s&&typeof s==`object`&&(e=uf(s,i,r,a,n)||String(s.externalId??s.id??s._id??``),o=cp(s))}catch{}if(e)return(0,Q.jsx)(lp,{objectName:n,recordId:o,children:(0,Q.jsx)(_f,{text:e})})}}if(!Array.isArray(e)&&typeof e==`object`){let t=e,o=uf(t,i,r,a,n)||String(t.id||t._id||``);if(o)return(0,Q.jsx)(lp,{objectName:n,recordId:cp(t),children:(0,Q.jsx)(_f,{text:o})})}let c=t.options||[],l=e=>{if(c.length>0){let t=c.find(t=>String(t.value)===String(e));if(t)return{text:t.label,unresolved:!1}}return e===o&&s?{text:s,unresolved:!1}:{text:String(e),unresolved:!0}};if(Array.isArray(e)){let t=e=>{if(typeof e==`object`&&e)return{label:uf(e,i,r,a,n)||String(e.id||e._id||`[Object]`),unresolved:!1};let t=l(e);return{label:t.text,unresolved:t.unresolved}},o=e.slice(0,up),s=e.slice(up);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[o.map((e,r)=>{let{label:i,unresolved:a}=t(e);return(0,Q.jsx)(lp,{objectName:n,recordId:cp(e),className:`text-inherit`,children:(0,Q.jsx)(`span`,{className:U(`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium`,a?`bg-muted/40 text-muted-foreground`:`bg-gray-50 text-gray-700 dark:bg-gray-800/50 dark:text-gray-200`),children:a?(0,Q.jsx)(mp,{value:i}):i})},r)}),s.length>0&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-muted/40 text-muted-foreground`,title:s.map(e=>t(e).label).join(`, `),children:[`+`,s.length]})]})}if(typeof e==`object`&&e){let t=uf(e,i,r,a,n)||String(e.id||e._id||`[Object]`);return(0,Q.jsx)(lp,{objectName:n,recordId:cp(e),children:(0,Q.jsx)(_f,{text:t})})}let{text:u,unresolved:d}=l(e);return(0,Q.jsx)(lp,{objectName:n,recordId:cp(e),children:d?(0,Q.jsx)(mp,{value:u}):(0,Q.jsx)(_f,{text:u})})}function fp({value:e}){let t=zs(e);return tn(t)?(0,Q.jsx)(Y,{}):(0,Q.jsx)(`span`,{className:`text-gray-700 font-mono text-sm`,children:String(t)})}function pp({value:e,className:t}){let n=pf(),r=String(e),i=n?.(`detail.unresolvedReference`,{value:r}),a=!i||i===`detail.unresolvedReference`?`Unresolved reference: ${r} was not resolved to a user`:i;return(0,Q.jsx)(hp,{raw:r,hint:a,className:t})}function mp({value:e,className:t}){let n=pf(),r=String(e),i=n?.(`detail.unresolvedLookupReference`,{value:r}),a=!i||i===`detail.unresolvedLookupReference`?`Unresolved reference: ${r} was not resolved to a record on this screen`:i;return(0,Q.jsx)(hp,{raw:r,hint:a,className:t})}function hp({raw:e,hint:t,className:n}){return(0,Q.jsxs)(`span`,{"data-slot":`unresolved-reference`,className:U(`inline-flex min-w-0 max-w-full items-center gap-1 text-muted-foreground`,n),title:t,children:[(0,Q.jsx)(Ya,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e})]})}function gp({value:e,field:t}){let n=ws(),r=t?.reference||`sys_user`;if(tn(e)||!e)return(0,Q.jsx)(Y,{});if(typeof e!=`object`)return(0,Q.jsx)(pp,{value:e});if(Array.isArray(e))return(0,Q.jsxs)(`div`,{className:`flex -space-x-2`,children:[e.slice(0,3).map((e,t)=>{if(typeof e!=`object`||!e)return(0,Q.jsx)(pp,{value:e,className:`text-sm`},t);let i=sa(e,n,r);if(hf(i)&&Object.keys(i).length===0)return(0,Q.jsx)(_f,{text:String(zs(i)),className:`text-sm`},t);let a=i.name||i.username||`User`,o=a.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,Q.jsxs)(Ve,{className:`size-8 border-2 border-white`,title:a,children:[i.image&&(0,Q.jsx)(Sn,{src:i.image,alt:a}),(0,Q.jsx)(un,{className:`bg-blue-500 text-white text-xs`,children:o})]},t)}),e.length>3&&(0,Q.jsx)(Ve,{className:`size-8 border-2 border-white`,children:(0,Q.jsxs)(un,{className:`bg-gray-200 text-gray-600 text-xs`,children:[`+`,e.length-3]})})]});let i=sa(e,n,r);if(Object.keys(i).length===0)return(0,Q.jsx)(_f,{text:String(zs(i))});let a=i.name||i.username||`User`,o=a.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2);return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(Ve,{className:`size-8`,children:[i.image&&(0,Q.jsx)(Sn,{src:i.image,alt:a}),(0,Q.jsx)(un,{className:`bg-blue-500 text-white text-xs`,children:o})]}),(0,Q.jsx)(_f,{text:String(a)})]})}var _p=new Map;function vp(e,t){_p.set(e,t)}var yp={phone:`phone`,tel:`phone`,telephone:`phone`,email:`email`,url:`url`,uri:`url`,link:`url`,currency:`currency`,money:`currency`,percent:`percent`,percentage:`percent`},bp=new Set([`text`,`textarea`,`string`,`longtext`,``]);function xp(e){if(!e)return`text`;if(typeof e==`string`)return e;let t=(e.type||``).toLowerCase(),n=e.format,r=typeof n==`string`?n.toLowerCase():``;return r&&yp[r]&&bp.has(t)?yp[r]:e.type||`text`}function Sp({value:e}){if(tn(e)&&!Array.isArray(e))return(0,Q.jsx)(Y,{});let t;if(typeof e==`object`)try{t=JSON.stringify(e)}catch{t=String(e)}else t=String(e);return(0,Q.jsx)(_f,{text:t,className:`font-mono text-xs text-gray-600`})}function Cp({value:e}){if(tn(e))return(0,Q.jsx)(Y,{});if(hf(e)){let t=zs(e);return mf(t)?(0,Q.jsx)(Y,{}):(0,Q.jsx)(_f,{text:String(t)})}let t=String(e);return mf(t)?(0,Q.jsx)(Y,{}):(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`h-3.5 w-3.5 rounded border border-black/10 shrink-0`,style:{backgroundColor:t},"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:t})]})}function wp({value:e}){if(tn(e)&&!Array.isArray(e))return(0,Q.jsx)(Y,{});let t,n;if(typeof e==`object`&&!Array.isArray(e)){let r=e;t=typeof r.lat==`number`?r.lat:typeof r.latitude==`number`?r.latitude:void 0,n=typeof r.lng==`number`?r.lng:typeof r.lon==`number`?r.lon:typeof r.longitude==`number`?r.longitude:void 0}else if(Array.isArray(e)&&e.length===2)t=Number(e[0]),n=Number(e[1]);else if(typeof e==`string`){let r=e.split(`,`).map(e=>parseFloat(e.trim()));r.length===2&&!isNaN(r[0])&&!isNaN(r[1])&&([t,n]=r)}return typeof t==`number`&&typeof n==`number`&&!isNaN(t)&&!isNaN(n)?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-sm tabular-nums`,children:[(0,Q.jsx)(pr,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t.toFixed(4),`, `,n.toFixed(4)]}):(0,Q.jsx)(Sp,{value:e,field:{}})}function Tp({value:e}){let t=zn();if(tn(e)&&!Array.isArray(e))return(0,Q.jsx)(Y,{});if(typeof e==`string`)return(0,Q.jsx)(_f,{text:e,className:`text-sm`});if(typeof e==`object`&&!Array.isArray(e)){let n=js(e,t);if(n)return(0,Q.jsx)(_f,{text:n,className:`text-sm`});if(Object.keys(e).length===0)return(0,Q.jsx)(Y,{})}return(0,Q.jsx)(Sp,{value:e,field:{}})}function Ep({value:e}){let t=pf(),n=Array.isArray(e)?e.length:0;if(n===0)return(0,Q.jsx)(Y,{});let r=t?.(`detail.repeaterItemCount`,{count:n}),i=!r||r===`detail.repeaterItemCount`?`${n} ${n===1?`item`:`items`}`:r;return(0,Q.jsx)(`span`,{className:`text-gray-500 italic`,children:i})}function Dp({value:e}){return tn(zs(e))?(0,Q.jsx)(Y,{}):(0,Q.jsx)(`span`,{children:`••••••`})}var Op=new Set([`password`,`secret`]);function kp(e){if(!e)return!1;let t=Mp(),n=_p.has(e)?_p.get(e):t[e];return n===Dp?!0:Op.has(e)?!Object.values(t).some(e=>e===n):!1}function Ap({value:e}){return tn(e)?(0,Q.jsx)(Y,{}):(0,Q.jsx)(`span`,{className:`text-gray-500 italic`,children:`[Vector]`})}function jp({value:e}){return tn(e)?(0,Q.jsx)(Y,{}):(0,Q.jsx)(`span`,{className:`text-gray-500 italic`,children:`[Grid]`})}function Mp(){return{text:vf,textarea:vf,...Gs,code:vf,qrcode:vf,number:yf,currency:bf,percent:xf,progress:xf,slider:yf,rating:yf,boolean:Cf,toggle:Cf,date:Df,datetime:Of,time:vf,select:ep,status:ep,multiselect:ep,radio:ep,checkboxes:ep,tags:ep,lookup:dp,master_detail:dp,tree:dp,email:tp,url:np,phone:rp,file:ip,video:ip,audio:ip,image:op,avatar:op,signature:sp,formula:fp,summary:fp,auto_number:vf,user:gp,...Object.fromEntries([...Op].map(e=>[e,Dp])),location:wp,geolocation:wp,address:Tp,color:Cp,json:Sp,object:Sp,composite:Sp,record:Sp,repeater:Ep,vector:Ap,grid:jp}}function Np(e){return _p.has(e)?_p.get(e):(Ne(e),Mp()[e]||vf)}vp(`lookup`,dp),vp(`master_detail`,dp),vp(`select`,ep),vp(`status`,ep),vp(`user`,gp),Ys(Np);var Pp={text:()=>X(()=>Promise.resolve().then(()=>nc).then(e=>({default:e.TextField})),void 0),textarea:()=>X(()=>Promise.resolve().then(()=>ac).then(e=>({default:e.TextAreaField})),void 0),number:()=>X(()=>Promise.resolve().then(()=>dc).then(e=>({default:e.NumberField})),void 0),boolean:()=>X(()=>Promise.resolve().then(()=>Sc).then(e=>({default:e.BooleanField})),void 0),select:()=>X(()=>Promise.resolve().then(()=>Ec).then(e=>({default:e.SelectField})),void 0),date:()=>X(()=>Promise.resolve().then(()=>Ic).then(e=>({default:e.DateField})),void 0),datetime:()=>X(()=>Promise.resolve().then(()=>Rc).then(e=>({default:e.DateTimeField})),void 0),time:()=>X(()=>Promise.resolve().then(()=>Bc).then(e=>({default:e.TimeField})),void 0),email:()=>X(()=>Promise.resolve().then(()=>Hc).then(e=>({default:e.EmailField})),void 0),phone:()=>X(()=>Promise.resolve().then(()=>Wc).then(e=>({default:e.PhoneField})),void 0),url:()=>X(()=>Promise.resolve().then(()=>Kc).then(e=>({default:e.UrlField})),void 0),multiselect:()=>X(()=>Promise.resolve().then(()=>wc).then(e=>({default:e.MultiSelectField})),void 0),radio:()=>X(()=>Promise.resolve().then(()=>kc).then(e=>({default:e.RadioField})),void 0),checkboxes:()=>X(()=>Promise.resolve().then(()=>jc).then(e=>({default:e.CheckboxesField})),void 0),tags:()=>X(()=>Promise.resolve().then(()=>Nc).then(e=>({default:e.TagsField})),void 0),currency:()=>X(()=>Promise.resolve().then(()=>pc).then(e=>({default:e.CurrencyField})),void 0),percent:()=>X(()=>Promise.resolve().then(()=>hc).then(e=>({default:e.PercentField})),void 0),password:()=>X(()=>Promise.resolve().then(()=>Mu).then(e=>({default:e.PasswordField})),void 0),markdown:()=>X(()=>Promise.resolve().then(()=>Pu).then(e=>({default:e.RichTextField})),void 0),html:()=>X(()=>Promise.resolve().then(()=>Pu).then(e=>({default:e.RichTextField})),void 0),richtext:()=>X(()=>Promise.resolve().then(()=>Pu).then(e=>({default:e.RichTextField})),void 0),lookup:()=>X(()=>Promise.resolve().then(()=>jl).then(e=>({default:e.LookupField})),void 0),master_detail:()=>X(()=>Promise.resolve().then(()=>jl).then(e=>({default:e.LookupField})),void 0),file:()=>X(()=>Promise.resolve().then(()=>gd).then(e=>({default:e.FileField})),void 0),image:()=>X(()=>Promise.resolve().then(()=>bd).then(e=>({default:e.ImageField})),void 0),location:()=>X(()=>Promise.resolve().then(()=>Zl).then(e=>({default:e.LocationField})),void 0),formula:()=>X(()=>Promise.resolve().then(()=>Td).then(e=>({default:e.FormulaField})),void 0),summary:()=>X(()=>Promise.resolve().then(()=>Dd).then(e=>({default:e.SummaryField})),void 0),auto_number:()=>X(()=>Promise.resolve().then(()=>kd).then(e=>({default:e.AutoNumberField})),void 0),user:()=>X(()=>Promise.resolve().then(()=>Wl).then(e=>({default:e.UserField})),void 0),object:()=>X(()=>Promise.resolve().then(()=>yu).then(e=>({default:e.ObjectField})),void 0),vector:()=>X(()=>Promise.resolve().then(()=>jd).then(e=>({default:e.VectorField})),void 0),grid:()=>X(()=>Promise.resolve().then(()=>Nd).then(e=>({default:e.GridField})),void 0),color:()=>X(()=>Promise.resolve().then(()=>ql).then(e=>({default:e.ColorField})),void 0),slider:()=>X(()=>Promise.resolve().then(()=>vc).then(e=>({default:e.SliderField})),void 0),rating:()=>X(()=>Promise.resolve().then(()=>bc).then(e=>({default:e.RatingField})),void 0),code:()=>X(()=>Promise.resolve().then(()=>_u).then(e=>({default:e.CodeField})),void 0),avatar:()=>X(()=>Promise.resolve().then(()=>ef).then(e=>({default:e.AvatarField})),void 0),address:()=>X(()=>Promise.resolve().then(()=>Yl).then(e=>({default:e.AddressField})),void 0),geolocation:()=>X(()=>Promise.resolve().then(()=>pu).then(e=>({default:e.GeolocationField})),void 0),signature:()=>X(()=>Promise.resolve().then(()=>nf).then(e=>({default:e.SignatureField})),void 0),qrcode:()=>X(()=>Promise.resolve().then(()=>Cu).then(e=>({default:e.QRCodeField})),void 0),"object-ref":()=>X(()=>Promise.resolve().then(()=>zu).then(e=>({default:e.ObjectRefField})),void 0),"filter-condition":()=>X(()=>Promise.resolve().then(()=>Vu).then(e=>({default:e.FilterConditionField})),void 0),"recipient-picker":()=>X(()=>Promise.resolve().then(()=>cd).then(e=>({default:e.RecipientPickerField})),void 0)},Fp=Pp,Ip=Object.freeze(Object.keys(Pp)),Lp=new Set(`text.html.image.avatar.grid.textarea.select.email.password.slider.markdown.code.time.address.object-ref.filter-condition.recipient-picker.auto_number.boolean.checkboxes.color.currency.date.datetime.file.formula.geolocation.location.lookup.master_detail.multiselect.number.object.percent.phone.qrcode.radio.rating.richtext.signature.summary.tags.url.user.vector`.split(`.`)),Rp={text:`control`,textarea:`control`,number:`control`,boolean:`control`,select:`control`,date:`control`,datetime:`control`,time:`control`,email:`control`,phone:`control`,url:`control`,multiselect:`group`,radio:`group`,checkboxes:`group`,tags:`control`,currency:`control`,percent:`control`,password:`control`,markdown:`control`,html:`control`,richtext:`control`,lookup:`control`,master_detail:`control`,file:`group`,image:`control`,location:`control`,formula:`display`,summary:`display`,auto_number:`display`,user:`control`,object:`control`,vector:`display`,grid:`group`,color:`control`,slider:`group`,rating:`group`,code:`control`,avatar:`control`,address:`group`,geolocation:`group`,signature:`group`,qrcode:`control`,"object-ref":`control`,"filter-condition":`control`,"recipient-picker":`control`};function zp(e){let t=Fp[e];if(!t){console.warn(`Unknown field type: ${e}`);return}let n=$.lazy(t),r=Rp[e];Qt.register(e,Es(n),{namespace:`field`,skipFallback:Lp.has(e),...r===`control`?null:{labelling:r}})}var Bp=e=>{let t=e?.retiredFieldType??e?.field?.type??e?.schema?.type??e?.type??`unknown`,n=Gt[t]??`[object-ui] Field type \`${t}\` was retired.`;return $.useEffect(()=>{Ne(t)},[t]),(0,Q.jsx)(`div`,{role:`alert`,"data-testid":`field-retired-tombstone`,"data-retired-field-type":t,className:`rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:n})},Vp=new Map;function Hp(e){let t=Vp.get(e);if(!t){let n=t=>(0,Q.jsx)(Bp,{...t,retiredFieldType:e});n.displayName=`RetiredFieldTombstone(${e})`,t=n,Vp.set(e,t)}return t}function Up(){Object.keys(Pp).forEach(e=>{zp(e)}),Object.keys(Gt).forEach(e=>{Qt.register(e,Hp(e),{namespace:`field`,skipFallback:!0})})}Up();var Wp=new Set([`textarea`,`markdown`,`html`,`grid`,`richtext`,`field:textarea`,`field:markdown`,`field:html`,`field:grid`,`field:richtext`]);function Gp(e){return Wp.has(e)}function Kp(e,t){let n;return n=e<=3?1:e<=8?2:e<=15?3:4,t!==void 0&&t<640?Math.min(n,1):n}function qp(e,t){return t<=1?e:e.map(e=>e.span===void 0&&e.type&&Gp(e.type)?{...e,span:t}:e)}function Jp(e,t,n){if(t!==void 0)return{fields:qp(e,t),columns:t};let r=Kp(e.length,n);return{fields:qp(e,r),columns:r}}var Yp=Mn({"common.resizeDrawer":`Resize drawer`,"detail.back":`Back`,"detail.edit":`Edit`,"detail.editInline":`Edit`,"detail.save":`Save`,"detail.saveChanges":`Save changes`,"detail.saving":`Saving…`,"detail.editFieldsInline":`Edit fields`,"detail.editInlineHint":`Double-click to edit`,"detail.cancel":`Cancel`,"detail.cancelEdit":`Discard changes`,"detail.openInNewTab":`Open in new tab`,"detail.share":`Share`,"detail.duplicate":`Duplicate`,"detail.export":`Export`,"detail.viewHistory":`View history`,"detail.delete":`Delete`,"detail.moreActions":`More actions`,"detail.addReaction":`Add reaction`,"detail.emojiPicker":`Emoji picker`,"detail.reactionCount":`{{emoji}} {{count}} reactions`,"detail.reactionCount_one":`{{emoji}} {{count}} reaction`,"detail.reactionCount_other":`{{emoji}} {{count}} reactions`,"detail.addToFavorites":`Add to favorites`,"detail.removeFromFavorites":`Remove from favorites`,"detail.previousRecord":`Previous record`,"detail.nextRecord":`Next record`,"detail.recordOf":`{{current}} of {{total}}`,"detail.recordNotFound":`Record not found`,"detail.recordNotFoundDescription":`The record you are looking for does not exist or may have been deleted.`,"detail.goBack":`Go back`,"detail.details":`Details`,"detail.relatedRecords":`{{count}} records`,"detail.relatedRecordOne":`{{count}} record`,"detail.noRelatedRecords":`No related records found`,"detail.loading":`Loading…`,"detail.copyToClipboard":`Copy to clipboard`,"detail.copied":`Copied!`,"detail.deleteConfirmation":`Are you sure you want to delete this record?`,"detail.editRecord":`Edit record`,"detail.viewAll":`View All`,"detail.new":`New`,"detail.noValue":`No value`,"detail.activity":`Activity`,"detail.copyRecordId":`Copy record ID`,"detail.showEmptyFields":`Show {{count}} empty fields`,"detail.showEmptyFields_one":`Show {{count}} empty field`,"detail.showEmptyFields_other":`Show {{count}} empty fields`,"detail.hideEmptyFields":`Hide empty fields`,"detail.editRow":`Edit`,"detail.deleteRow":`Delete`,"detail.deleteRowConfirmation":`Are you sure you want to delete this record?`,"detail.actions":`Actions`,"detail.previousPage":`Previous`,"detail.nextPage":`Next`,"detail.pageOf":`Page {{current}} of {{total}}`,"detail.sortBy":`Sort by`,"detail.filterPlaceholder":`Filter…`,"detail.highlightFields":`Key Fields`,"detail.highlightsLabel":`Record highlights`,"detail.comments":`Comments`,"detail.searchComments":`Search comments…`,"detail.addCommentPlaceholder":`Add a comment… (Ctrl+Enter to submit)`,"detail.noMatchingComments":`No matching comments`,"detail.noCommentsYet":`No comments yet`,"detail.pinned":`Pinned`,"detail.pin":`Pin`,"detail.unpin":`Unpin`,"detail.justNow":`just now`,"detail.minutesAgo":`{{count}}m ago`,"detail.hoursAgo":`{{count}}h ago`,"detail.daysAgo":`{{count}}d ago`,"detail.createdBy":`Created by`,"detail.updatedBy":`Updated by`,"detail.created":`Created`,"detail.updated":`Updated`,"detail.dropFilesToUpload":`Drop files here or click to upload`,"detail.attachmentCount":`{{count}} attachment`,"detail.attachmentCount_one":`{{count}} attachment`,"detail.attachmentCount_other":`{{count}} attachments`,"detail.removeAttachment":`Remove attachment`,"detail.discussion":`Discussion`,"detail.showDiscussion":`Show Discussion ({{count}})`,"detail.hideDiscussion":`Hide discussion`,"detail.bold":`Bold (Ctrl+B)`,"detail.italic":`Italic (Ctrl+I)`,"detail.listFormat":`List`,"detail.inlineCode":`Inline code`,"detail.mentionSomeone":`Mention someone`,"detail.preview":`Preview`,"detail.submitComment":`Submit (Ctrl+Enter)`,"detail.sendComment":`Send`,"detail.writeComment":`Write a comment…`,"detail.subscribedTooltip":`Subscribed — click to unsubscribe`,"detail.unsubscribedTooltip":`Subscribe to notifications`,"detail.noRecords":`No records`,"detail.showEmptyRelated":`+ {{count}} empty`,"detail.showEmptyRelated_one":`+ {{count}} empty`,"detail.showEmptyRelated_other":`+ {{count}} empty`,"detail.allActivity":`All Activity`,"detail.commentsOnly":`Comments Only`,"detail.fieldChangesFilter":`Field Changes`,"detail.tasksOnly":`Tasks Only`,"detail.leaveCommentPlaceholder":`Leave a comment… (Ctrl+Enter to submit)`,"detail.noActivity":`No activity recorded`,"detail.activityAccessDenied":`You don't have permission to view activity on this record.`,"detail.commentsAccessDenied":`You don't have permission to view comments on this record.`,"detail.allFilter":`All`,"detail.createsFilter":`Creates`,"detail.deletesFilter":`Deletes`,"detail.statusChangesFilter":`Status Changes`,"detail.activityEmptyValue":`(empty)`,"detail.activityFieldChanged":`Changed {{field}} from "{{old}}" to "{{new}}"`,"detail.activityCreated":`Created this record`,"detail.activityDeleted":`Deleted this record`,"detail.activityStatusChanged":`Changed status to "{{value}}"`,"detail.activityUpdated":`Updated record`,"detail.loadMore":`Load more`,"detail.edited":`(edited)`,"detail.via":`via {{source}}`,"detail.viewSource":`View source`,"detail.replyCount":`{{count}} reply`,"detail.replyCount_one":`{{count}} reply`,"detail.replyCount_other":`{{count}} replies`,"detail.replyPlaceholder":`Reply…`,"detail.filterActivity":`Filter activity`,"detail.openDiscussion":`Open discussion panel`,"detail.closeDiscussion":`Close discussion panel`,"detail.subscribeAriaLabel":`Subscribe to notifications`,"detail.unsubscribeAriaLabel":`Unsubscribe from notifications`,"detail.clearSearch":`Clear search`,"detail.concurrentUpdateTitle":`This record was modified by someone else`,"detail.concurrentUpdateDescription":`Another user saved a newer version of {{field}} while you were editing. To prevent silently overwriting their change, please choose how to resolve the conflict.`,"detail.concurrentUpdateYourEdit":`Your edit`,"detail.concurrentUpdateCurrentValue":`Current value`,"detail.concurrentUpdateUpdatedBy":`Updated by {{name}}`,"detail.concurrentUpdateUpdatedAt":`Updated at {{when}}`,"detail.concurrentUpdateReload":`Reload latest`,"detail.concurrentUpdateOverwrite":`Overwrite anyway`,"detail.concurrentUpdateCancel":`Cancel`,"detail.lockedByApproval":`Locked for approval`,"detail.lockedTooltip":`This record has a pending approval request; editing is locked`,"detail.approvalPendingEditable":`In approval · editable`,"detail.approvalPendingTooltip":`This record has a pending approval request; this step still allows editing`,"detail.approvalProgress":`Approvals — {{got}} of {{need}}`,"detail.approvalProgressGroups":`Sign-off — {{got}} of {{need}} groups`,"detail.approvalProgressLabel":`Approval progress`,"detail.cancelApproval":`Recall approval`,"detail.cancelApprovalInFlight":`Recalling…`,"detail.cancelApprovalTooltip":`Recall the pending approval request to unlock this record`,"detail.cancelApprovalTooltipUnlocked":`Recall the pending approval request`,"detail.cancelApprovalFailed":`Failed to recall approval`,"detail.cancelApprovalUnavailable":`Recalling approvals is not supported on this data source`,"detail.pathLabel":`Record path`,"detail.pathStageCompleted":`{{stage}}, completed`,"detail.pathStageCurrent":`{{stage}}, current stage`,"detail.pathStageUpcoming":`{{stage}}, upcoming`,"detail.pathStageLostCurrent":`{{stage}}, closed lost, current stage`,"detail.pathStageLostUpcoming":`{{stage}}, closed lost, not reached`,"detail.pathStageWonUpcoming":`{{stage}}, goal stage, not reached`,"view.malformedFilter":`This view’s filter is malformed, so no records are shown: the {{subject}} condition cannot be applied.`},`detail.back`),Xp=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Zp=/^[\\/]{2}/;function Qp(e,t){return t+e.replace(/\\/g,`/`)}function $p(e,t){if(e===!1||e==null)throw Error(t)}function em(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function tm({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function nm(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function rm(e,t,n=`/`){return im(e,t,n,!1)}function im(e,t,n,r,i){let a=Cm((typeof t==`string`?nm(t):t).pathname||`/`,n);if(a==null)return null;let o=i??am(e),s=null,c=Sm(a);for(let e=0;s==null&&e<o.length;++e)s=vm(o[e],c,r);return s}function am(e){let t=om(e);return cm(t),t}function om(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;$p(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=jm([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&($p(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),om(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:gm(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=xm(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of sm(e.path))a(e,t,!0,n)}),t}function sm(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=sm(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function cm(e){e.sort((e,t)=>e.score===t.score?_m(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var lm=/^:[\w-]+$/,um=3,dm=2,fm=1,pm=10,mm=-2,hm=e=>e===`*`;function gm(e,t){let n=e.split(`/`),r=n.length;return n.some(hm)&&(r+=mm),t&&(r+=dm),n.filter(e=>!hm(e)).reduce((e,t)=>e+(lm.test(t)?um:t===``?fm:pm),r)}function _m(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function vm(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?bm(u,l,s.matcher,s.compiledParams):ym(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=ym({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:jm([a,d.pathname]),pathnameBase:Nm(jm([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=jm([a,d.pathnameBase]))}return o}function ym(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=xm(e.path,e.caseSensitive,e.end);return bm(e,t,n,r)}function bm(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function xm(e,t=!1,n=!0){em(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Sm(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return em(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Cm(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function wm(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?nm(e):e,a;return n?(n=Am(n),a=n.startsWith(`/`)?Tm(n.substring(1),`/`):Tm(n,t)):a=t,{pathname:a,search:Pm(r),hash:Fm(i)}}function Tm(e,t){let n=Mm(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Em(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Dm(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Om(e){let t=Dm(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function km(e,t,n,r=!1){let i;typeof e==`string`?i=nm(e):(i={...e},$p(!i.pathname||!i.pathname.includes(`?`),Em(`?`,`pathname`,`search`,i)),$p(!i.pathname||!i.pathname.includes(`#`),Em(`#`,`pathname`,`hash`,i)),$p(!i.search||!i.search.includes(`#`),Em(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=wm(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Am=e=>e.replace(/[\\/]{2,}/g,`/`),jm=e=>Am(e.join(`/`)),Mm=e=>e.replace(/\/+$/,``),Nm=e=>Mm(e).replace(/^\/*/,`/`),Pm=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Fm=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Im=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Lm(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Rm(e){return jm(e.map(e=>e.route.path).filter(Boolean))||`/`}var zm=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Bm(e,t){let n=e;if(typeof n!=`string`||!Xp.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(zm)try{let e=new URL(window.location.href),r=Zp.test(n)?new URL(Qp(n,e.protocol)):new URL(n),a=Cm(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{em(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Vm=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Vm);var Hm=[`GET`,...Vm];new Set(Hm);var Um=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Wm(e){try{return Um.includes(new URL(e).protocol)}catch{return!1}}var Gm=$.createContext(null);Gm.displayName=`DataRouter`;var Km=$.createContext(null);Km.displayName=`DataRouterState`;var qm=$.createContext(!1);function Jm(){return $.useContext(qm)}var Ym=$.createContext({isTransitioning:!1});Ym.displayName=`ViewTransition`;var Xm=$.createContext(new Map);Xm.displayName=`Fetchers`;var Zm=$.createContext(null);Zm.displayName=`Await`;var Qm=$.createContext(null);Qm.displayName=`Navigation`;var $m=$.createContext(null);$m.displayName=`Location`;var eh=$.createContext({outlet:null,matches:[],isDataRoute:!1});eh.displayName=`Route`;var th=$.createContext(null);th.displayName=`RouteError`;var nh=`REACT_ROUTER_ERROR`,rh=`REDIRECT`,ih=`ROUTE_ERROR_RESPONSE`;function ah(e){if(e.startsWith(`${nh}:${rh}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function oh(e){if(e.startsWith(`${nh}:${ih}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Im(t.status,t.statusText,t.data)}catch{}}function sh(e,{relative:t}={}){$p(ch(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=$.useContext(Qm),{hash:i,pathname:a,search:o}=hh(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:jm([n,a])),r.createHref({pathname:s,search:o,hash:i})}function ch(){return $.useContext($m)!=null}function lh(){return $p(ch(),`useLocation() may be used only in the context of a <Router> component.`),$.useContext($m).location}var uh=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function dh(e){$.useContext(Qm).static||$.useLayoutEffect(e)}function fh(){let{isDataRoute:e}=$.useContext(eh);return e?jh():ph()}function ph(){$p(ch(),`useNavigate() may be used only in the context of a <Router> component.`);let e=$.useContext(Gm),{basename:t,navigator:n}=$.useContext(Qm),{matches:r}=$.useContext(eh),{pathname:i}=lh(),a=JSON.stringify(Om(r)),o=$.useRef(!1);return dh(()=>{o.current=!0}),$.useCallback((r,s={})=>{if(em(o.current,uh),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=km(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:jm([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}$.createContext(null);function mh(){let{matches:e}=$.useContext(eh);return e[e.length-1]?.params??{}}function hh(e,{relative:t}={}){let{matches:n}=$.useContext(eh),{pathname:r}=lh(),i=JSON.stringify(Om(n));return $.useMemo(()=>km(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function gh(e,t,n){$p(ch(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=$.useContext(Qm),{matches:i}=$.useContext(eh),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Nh(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
19
|
-
|
|
20
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=lh(),d;if(t){let e=typeof t==`string`?nm(t):t;$p(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):rm(e,{pathname:p});em(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),em(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=Ch(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:jm([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:jm([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?$.createElement($m.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function _h(){let e=Ah(),t=Lm(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=$.createElement($.Fragment,null,$.createElement(`p`,null,`💿 Hey developer 👋`),$.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,$.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,$.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),$.createElement($.Fragment,null,$.createElement(`h2`,null,`Unexpected Application Error!`),$.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?$.createElement(`pre`,{style:i},n):null,o)}var vh=$.createElement(_h,null),yh=class extends $.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=oh(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:$.createElement(eh.Provider,{value:this.props.routeContext},$.createElement(th.Provider,{value:e,children:this.props.component}));return this.context?$.createElement(xh,{error:e},t):t}};yh.contextType=qm;var bh=new WeakMap;function xh({children:e,error:t}){let{basename:n}=$.useContext(Qm);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=ah(t.digest);if(e){let r=bh.get(t);if(r)throw r;let i=Bm(e.location,n),a=i.absoluteURL||i.to;if(Wm(a))throw Error(`Invalid redirect location`);if(zm&&!bh.get(t)){if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw bh.set(t,n),n}}return $.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function Sh({routeContext:e,match:t,children:n}){let r=$.useContext(Gm);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),$.createElement(eh.Provider,{value:e},n)}function Ch(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);$p(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Rm(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||vh,o&&(s<0&&c===0?(Nh(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?$.createElement(n.route.Component,null):n.route.element?n.route.element:e,$.createElement(Sh,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?$.createElement(yh,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function wh(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Th(e){let t=$.useContext(Gm);return $p(t,wh(e)),t}function Eh(e){let t=$.useContext(Km);return $p(t,wh(e)),t}function Dh(e){let t=$.useContext(eh);return $p(t,wh(e)),t}function Oh(e){let t=Dh(e),n=t.matches[t.matches.length-1];return $p(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function kh(){return Oh(`useRouteId`)}function Ah(){let e=$.useContext(th),t=Eh(`useRouteError`),n=Oh(`useRouteError`);return e===void 0?t.errors?.[n]:e}function jh(){let{router:e}=Th(`useNavigate`),t=Oh(`useNavigate`),n=$.useRef(!1);return dh(()=>{n.current=!0}),$.useCallback(async(r,i={})=>{em(n.current,uh),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Mh={};function Nh(e,t,n){!t&&!Mh[e]&&(Mh[e]=!0,em(!1,n))}$.memo(Ph);function Ph({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return gh(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}$.Component;var Fh=`get`,Ih=`application/x-www-form-urlencoded`;function Lh(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Rh(e){return Lh(e)&&e.tagName.toLowerCase()===`button`}function zh(e){return Lh(e)&&e.tagName.toLowerCase()===`form`}function Bh(e){return Lh(e)&&e.tagName.toLowerCase()===`input`}function Vh(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Hh(e,t){return e.button===0&&(!t||t===`_self`)&&!Vh(e)}var Uh=null;function Wh(){if(Uh===null)try{new FormData(document.createElement(`form`),0),Uh=!1}catch{Uh=!0}return Uh}var Gh=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Kh(e){return e!=null&&!Gh.has(e)?(em(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ih}"`),null):e}function qh(e,t){let n,r,i,a,o;if(zh(e)){let o=e.getAttribute(`action`);r=o?Cm(o,t):null,n=e.getAttribute(`method`)||Fh,i=Kh(e.getAttribute(`enctype`))||Ih,a=new FormData(e)}else if(Rh(e)||Bh(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?Cm(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Fh,i=Kh(e.getAttribute(`formenctype`))||Kh(o.getAttribute(`enctype`))||Ih,a=new FormData(o,e),!Wh()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Lh(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Fh,r=null,i=Ih,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Jh(e,t){if(e===!1||e==null)throw Error(t)}function Yh(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&Cm(i.pathname,t)===`/`?`${Mm(t)}/_root.${r}`:`${Mm(i.pathname)}.${r}`,i}async function Xh(e,t){if(e.id in t)return t[e.id];try{let n=await X(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Zh(e){return e!=null&&typeof e.page==`string`}function Qh(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function $h(e,t,n){return ig((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Xh(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Qh).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function eg(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function tg(e,t,{includeHydrateFallback:n}={}){return ng(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function ng(e){return[...new Set(e)]}function rg(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function ig(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Zh(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(rg(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function ag(){let e=$.useContext(Gm);return Jh(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function og(){let e=$.useContext(Km);return Jh(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var sg=$.createContext(void 0);sg.displayName=`FrameworkContext`;function cg(){let e=$.useContext(sg);return Jh(e,`You must render this element inside a <HydratedRouter> element`),e}function lg(e,t){let n=$.useContext(sg),[r,i]=$.useState(!1),[a,o]=$.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=$.useRef(null);$.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),$.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:ug(s,p),onBlur:ug(c,m),onMouseEnter:ug(l,p),onMouseLeave:ug(u,m),onTouchStart:ug(d,p)}]:[a,f,{}]:[!1,f,{}]}function ug(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function dg({page:e,...t}){let n=Jm(),{nonce:r}=cg(),{router:i}=ag(),a=$.useMemo(()=>rm(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?$.createElement(pg,{page:e,matches:a,...t}):$.createElement(mg,{page:e,matches:a,...t})):null}function fg(e){let{manifest:t,routeModules:n}=cg(),[r,i]=$.useState([]);return $.useEffect(()=>{let r=!1;return $h(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function pg({page:e,matches:t,...n}){let r=lh(),{future:i}=cg(),{basename:a}=ag(),o=$.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Yh(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return $.createElement($.Fragment,null,o.map(e=>$.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function mg({page:e,matches:t,...n}){let r=lh(),{future:i,manifest:a,routeModules:o}=cg(),{basename:s}=ag(),{loaderData:c,matches:l}=og(),u=$.useMemo(()=>eg(e,t,l,a,r,`data`),[e,t,l,a,r]),d=$.useMemo(()=>eg(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=$.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];t&&t.hasLoader&&(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Yh(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=$.useMemo(()=>tg(d,a),[d,a]),m=fg(d);return $.createElement($.Fragment,null,f.map(e=>$.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>$.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>$.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function hg(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}$.Component;var gg=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{gg&&(window.__reactRouterVersion=`7.18.2`)}catch{}var _g=$.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=$.useContext(Qm),v=typeof l==`string`&&Xp.test(l),y=Bm(l,h);l=y.to;let b=sh(l,{relative:r}),x=lh(),S=null;if(o){let e=km(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:jm([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=lg(n,p),E=Sg(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let O=!(y.isExternal||i),k=$.createElement(`a`,{...p,...T,href:(O?S:void 0)||y.absoluteURL||b,onClick:O?D:e,ref:hg(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?$.createElement($.Fragment,null,k,$.createElement(dg,{page:b})):k});_g.displayName=`Link`;var vg=$.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=hh(a,{relative:c.relative}),d=lh(),f=$.useContext(Km),{navigator:p,basename:m}=$.useContext(Qm),h=f!=null&&Dg(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=Cm(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return $.createElement(_g,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});vg.displayName=`NavLink`;var yg=$.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Fh,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=$.useContext(Qm),g=Tg(),_=Eg(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Xp.test(s);return $.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?$.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});yg.displayName=`Form`;function bg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function xg(e){let t=$.useContext(Gm);return $p(t,bg(e)),t}function Sg(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=fh(),d=lh(),f=hh(e,{relative:o});return $.useCallback(p=>{if(Hh(p,t)){p.preventDefault();let t=n===void 0?tm(d)===tm(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?$.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var Cg=0,wg=()=>`__${String(++Cg)}__`;function Tg(){let{router:e}=xg(`useSubmit`),{basename:t}=$.useContext(Qm),n=kh(),r=e.fetch,i=e.navigate;return $.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=qh(e,t);if(a.navigate===!1){let e=a.fetcherKey||wg();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Eg(e,{relative:t}={}){let{basename:n}=$.useContext(Qm),r=$.useContext(eh);$p(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...hh(e||`.`,{relative:t})},o=lh();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:jm([n,a.pathname])),tm(a)}function Dg(e,{relative:t}={}){let n=$.useContext(Ym);$p(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=xg(`useViewTransitionState`),i=hh(e,{relative:t});if(!n.isTransitioning)return!1;let a=Cm(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Cm(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ym(i.pathname,o)!=null||ym(i.pathname,a)!=null}function Og(e){if(typeof e==`string`){let t=e.trim();if(!t)return null;try{return JSON.parse(t)}catch{return t}}return e??null}function kg(e){let t=Og(e);return t==null||t===``?0:Array.isArray(t)?t.length:typeof t==`object`?Object.keys(t).length:1}function Ag({value:e,field:t}){let{t:n}=Yp(),r=ft(),{appName:i}=mh(),a=t?.name||``,o=r?.data?.name,s=i&&o?`/apps/${i}/metadata/permission/${encodeURIComponent(String(o))}`:null,c=kg(e),l=c===0,u=(()=>{if(l)return(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:n(`perm.facet.none`,{defaultValue:`None`})});if(a===`system_permissions`){let t=Ru(e),r=t.slice(0,6),i=t.length-r.length;return(0,Q.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1`,children:[r.map(e=>(0,Q.jsx)(mt,{variant:`outline`,children:e},e)),i>0&&(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n(`perm.facet.more`,{count:i,defaultValue:`+${i} more`})})]})}let t=(()=>{switch(a){case`object_permissions`:return n(`perm.facet.objects`,{count:c,defaultValue:`${c} object${c===1?``:`s`}`});case`field_permissions`:return n(`perm.facet.fields`,{count:c,defaultValue:`${c} field rule${c===1?``:`s`}`});case`row_level_security`:return n(`perm.facet.rls`,{count:c,defaultValue:`${c} RLS polic${c===1?`y`:`ies`}`});case`tab_permissions`:return n(`perm.facet.tabs`,{count:c,defaultValue:`${c} tab rule${c===1?``:`s`}`});case`admin_scope`:return n(`perm.facet.adminScope`,{defaultValue:`Delegated admin configured`});default:return String(c)}})();return(0,Q.jsx)(`span`,{className:`text-foreground`,children:t})})();return(0,Q.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[u,s?(0,Q.jsx)(_g,{to:s,className:`text-primary hover:underline whitespace-nowrap`,children:n(`perm.facet.designInStudio`,{defaultValue:`Design in Studio →`})}):(0,Q.jsx)(`span`,{className:`text-muted-foreground/60 whitespace-nowrap`,children:n(`perm.facet.designInStudioHint`,{defaultValue:`Design in Studio`})})]})}var jg=new Set([`id`,`_id`,`__v`,`created`,`created_at`,`createdAt`,`created_by`,`modified`,`modified_by`,`updated_at`,`updatedAt`,`updated_by`,`deleted_at`,`is_deleted`,`deleted`,`instance_state`]),Mg=new Set([`formula`,`summary`,`rollup`,`autonumber`,`auto_number`]);function Ng(e,t){return Mg.has(e)||Mg.has(t)}var Pg=new Set([`image`,`avatar`,`signature`,`file`,`video`,`audio`,`markdown`]);function Fg(e,t){return Ig(e)||Ig(t)}function Ig(e){return typeof e!=`string`||Pg.has(e)?!1:ku(e)}function Lg(e,t){return Rg(e)||Rg(t)}function Rg(e){return typeof e==`string`&&kp(e)}var zg=`options.currency.currencyConfig.precision.scale.useGrouping.min.max.step.format.widget.dueLike.multiple.reference_field.displayField.descriptionField.idField.allow_create.allowCreate.lookup_columns.lookupColumns.lookup_page_size.lookupPageSize.lookupFilters.picker.subtitle.avatar_field.avatarField.depends_on.dependsOn`.split(`.`);function Bg(e,t){let n={...e};if(!t)return n;!n.type&&t.type&&(n.type=t.type);for(let e of zg){let r=t[e];r!==void 0&&n[e]===void 0&&(n[e]=r)}let r=t.reference;return r&&n.reference===void 0&&(n.reference=r),n}var Vg=`inline-plain-text-input`,Hg=new Set([`text`,`email`,`phone`,`url`]);function Ug(e){return e?Ip.includes(e)||$s(e)!==`field:text`:!1}function Wg(e){let t=e?.type;return!t||Hg.has(t)?!0:t===`select`&&!e.multiple}var Gg=({field:e,value:t,onChange:n,dataSource:r,autoFocus:i,error:a,dependentValues:o})=>{let s=e.type;if(e.widget===`permission-facet-link`)return(0,Q.jsx)(Ag,{value:t,field:e});if(typeof s==`string`&&Gt[s])return(0,Q.jsx)(Bp,{field:e});let c=s===`multiselect`||!!e.multiple;if((s===`select`||s===`multiselect`)&&Array.isArray(e.options)&&e.options.length>0)return c?(0,Q.jsx)(Dc,{field:{...e,multiple:!0},value:Array.isArray(t)?t:t==null||t===``?[]:[t],onChange:e=>n(e),error:a,dependentValues:o}):(0,Q.jsx)(Dc,{field:e,value:t==null?``:String(t),onChange:e=>n(e),error:a,dependentValues:o});if(s===`boolean`)return(0,Q.jsx)(Cc,{field:e,value:!!t,onChange:e=>n(e),error:a});if(s===`image`)return(0,Q.jsx)(Sd,{field:e,value:t,onChange:e=>n(e),error:a});if(s===`avatar`)return(0,Q.jsx)(tf,{field:e,value:t,onChange:e=>n(e),error:a});if(s===`signature`)return(0,Q.jsx)(rf,{field:e,value:t,onChange:e=>n(e),error:a});if(s===`file`||s===`video`||s===`audio`)return(0,Q.jsx)(vd,{field:e,value:t,onChange:e=>n(e),error:a});if(s===`markdown`||s===`textarea`)return(0,Q.jsx)(oc,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a});let l=s===`user`,u=s===`lookup`||s===`master_detail`||s===`tree`||!!e.reference&&!Mg.has(s);if(l||u)return(0,Q.jsx)(l?Kl:Ul,{field:e,value:t,onChange:e=>n(e),dataSource:r,error:a,dependentValues:o});if(s===`number`)return(0,Q.jsx)(fc,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a});if(s===`currency`)return(0,Q.jsx)(mc,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a});if(s===`percent`)return(0,Q.jsx)(_c,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a});if(s===`address`)return(0,Q.jsx)(Xl,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a});if(s===`location`)return(0,Q.jsx)(fu,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a});if(s===`geolocation`)return(0,Q.jsx)(gu,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a});let d=s===`date`||s===`datetime`;if(!d&&!Wg(e)&&Ug(s)&&Ou(s))return(0,Q.jsx)(ju,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a,dependentValues:o});if(d)return(0,Q.jsx)(Lc,{field:e,value:t,onChange:e=>n(e&&new Date(e+`T00:00:00`).toISOString()),autoFocus:i,error:a});let f=t==null?``:String(typeof t==`object`?zs(t)??``:t);return(0,Q.jsx)(`input`,{type:`text`,"data-testid":Vg,autoFocus:i,"aria-invalid":a?!0:void 0,className:`w-full px-2 py-1.5 text-sm border rounded-md bg-background focus:outline-none focus:ring-2 focus:ring-ring`,value:f,onChange:e=>n(e.target.value)})},Kg=Object.freeze({muted:`bg-muted`,"muted/50":`bg-muted/50`,accent:`bg-accent`,"primary/10":`bg-primary/10`,"secondary/10":`bg-secondary/10`,"destructive/10":`bg-destructive/10`}),qg=Kg;function Jg(e){if(!e)return;let t=e.trim();if(t)return t.startsWith(`bg-`)?t:Object.prototype.hasOwnProperty.call(Kg,t)?Kg[t]:void 0}function Yg(e){return tn(e)?!1:typeof e==`object`&&e?!0:xe({value:e},`value`)!==void 0}var Xg=({name:e})=>/^[a-z0-9][a-z0-9-]*$/i.test(e)?(0,Q.jsx)(jt,{name:e,className:`h-4 w-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}):(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e});function Zg(e,t){return!e||e<=1||t<=1?``:t===2?e>=2?`md:col-span-2`:``:t===3?e===2?`md:col-span-2`:e>=3?`md:col-span-2 lg:col-span-3`:``:e===2?`md:col-span-2`:e===3?`md:col-span-2 lg:col-span-3`:e>=4?`md:col-span-2 lg:col-span-3 xl:col-span-4`:``}var Qg=({section:e,data:t,className:n,objectSchema:r,objectName:i,isEditing:a=!1,onFieldChange:o,onEnterInlineEdit:s,autoFocusField:c,dataSource:l,virtualScroll:u})=>{let[d,f]=$.useState(e.defaultCollapsed??!1),[p,m]=$.useState(null),[h,g]=$.useState(void 0),[_,v]=$.useState(!1),{t:y}=Yp(),{fieldLabel:b,translateOptions:x}=Ze(),S=it()?.fieldErrors??null,C=$.useCallback((e,t)=>{let n;if(t==null)n=``;else if(typeof t==`object`)try{n=JSON.stringify(t)}catch{n=String(t)}else n=String(t);navigator.clipboard.writeText(n).then(()=>{m(e),setTimeout(()=>m(null),2e3)})},[]),w=$.useCallback(e=>!Yg(t?.[e.name]??e.value),[t]),T=$.useMemo(()=>e.fields.filter(w).length,[e.fields,w]),E=M(),D=E?3:4,O=E?.2:.25,k=e.fields.length-T,A=!a&&e.fields.length>=D&&T/e.fields.length>=O&&k>0,j=e.fields.length>0&&k===0,ee=e.hideEmpty===!0&&j&&!a,N=!_&&(A||ee)?e.fields.filter(e=>!w(e)):e.fields,{fields:P,columns:F}=Jp(N,e.columns),te=Math.min(F,Math.max(1,N.length)),ne=e=>{let n=t?.[e.name]??e.value;if(e.render)return(0,Q.jsx)(Ht,{schema:tt(e.render),data:{...t,value:n}});let u=Zg(e.span,te),d=r?.fields?.[e.name],f=Bg(e,d);i&&Array.isArray(f.options)&&f.options.length>0&&(f.options=x(i,e.name,f.options));let m=Ng(e.type,d?.type),h=e.readonly===!0||d?.readonly===!0,g=jg.has(e.name),_=Fg(e.type,d?.type),v=Lg(e.type,d?.type),w=!h&&!m&&!g&&!_,T=w&&!!s,D=(()=>{if((f.widget||e.widget)===`permission-facet-link`)return(0,Q.jsx)(Ag,{value:n,field:f});if(!Yg(n))return(0,Q.jsx)(Y,{className:`pointer-events-auto`,title:y(`detail.noValue`,{defaultValue:`No value`})});let t=xp(f)||e.type;if(t){let e=Np(t);if(e)return(0,Q.jsx)(e,{value:n,field:f})}return String(n)})(),O=Yg(n)&&!v,k=O&&!T,A=p===e.name,j=b(i||``,e.name,e.label||e.name);return E&&!(a&&w)?(0,Q.jsxs)(`div`,{className:U(`flex items-baseline justify-between gap-4 py-2.5 min-h-[44px] group`,O&&`cursor-pointer active:bg-muted/40 transition-colors`),onClick:O?()=>C(e.name,n):void 0,onKeyDown:O?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),C(e.name,n))}:void 0,role:O?`button`:void 0,tabIndex:O?0:void 0,children:[(0,Q.jsx)(`span`,{className:`text-[15px] text-muted-foreground shrink-0`,children:j}),(0,Q.jsx)(`span`,{className:`text-[15px] text-foreground text-right break-words min-w-0 leading-snug`,children:D})]},e.name):(0,Q.jsxs)(`div`,{className:U(`space-y-1.5 group min-w-0`,u),children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:b(i||``,e.name,e.label||e.name)}),a&&w?(0,Q.jsxs)(`div`,{className:`min-h-[44px] sm:min-h-0`,children:[(0,Q.jsx)(Gg,{field:f,value:n,onChange:t=>o?.(e.name,t),dataSource:l,autoFocus:c===e.name,error:S?.[e.name],dependentValues:t}),S?.[e.name]&&(0,Q.jsx)(`p`,{role:`alert`,"data-inline-field-hint":e.name,className:`mt-1 text-xs text-destructive`,children:S[e.name]})]}):(0,Q.jsxs)(`div`,{className:U(`flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md`,k&&`cursor-pointer active:bg-muted/60 transition-colors`,T&&`cursor-pointer hover:bg-muted/40 transition-colors -mx-1.5 px-1.5`),onClick:k?()=>C(e.name,n):void 0,onDoubleClick:T?()=>s?.(e.name):void 0,onKeyDown:k?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),C(e.name,n))}:void 0,role:k?`button`:void 0,tabIndex:k?0:void 0,title:T?y(`detail.editInlineHint`):void 0,children:[(0,Q.jsx)(`div`,{className:`text-sm flex-1 min-w-0 break-words py-1`,children:D}),T?(0,Q.jsx)(ie,{children:(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(G,{asChild:!0,children:(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity shrink-0`,"aria-label":y(`detail.editInlineHint`),onClick:t=>{t.stopPropagation(),s?.(e.name)},children:(0,Q.jsx)(qo,{className:`h-3 w-3`})})}),(0,Q.jsx)(B,{children:y(`detail.editInlineHint`)})]})}):O?(0,Q.jsx)(ie,{children:(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(G,{asChild:!0,children:(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity shrink-0`,onClick:t=>{t.stopPropagation(),C(e.name,n)},children:A?(0,Q.jsx)(Xn,{className:`h-3 w-3 text-green-600`}):(0,Q.jsx)(nr,{className:`h-3 w-3`})})}),(0,Q.jsx)(B,{children:y(A?`detail.copied`:`detail.copyToClipboard`)})]})}):null]})]},e.name)},I=u?.enabled===!0,L=u?.batchSize??20;if($.useEffect(()=>{if(!I){g(void 0);return}if(P.length<=L){g(void 0);return}g(L);let e=setTimeout(()=>g(void 0),100);return()=>clearTimeout(e)},[I,P.length,L]),N.length===0&&T===e.fields.length)return null;let re=h===void 0?P:P.slice(0,h),R=T>0&&A,z=(0,Q.jsxs)(Q.Fragment,{children:[E?(0,Q.jsx)(`div`,{className:`flex flex-col divide-y divide-border/60`,children:re.map(ne)}):(0,Q.jsx)(`div`,{className:U(`grid gap-3 sm:gap-4`,te===1?`grid-cols-1`:te===2?`grid-cols-1 md:grid-cols-2`:te===3?`grid-cols-1 md:grid-cols-2 lg:grid-cols-3`:`grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`),children:re.map(ne)}),R&&(0,Q.jsx)(`div`,{className:`mt-3 -ml-2`,children:(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>v(e=>!e),className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,children:[_?(0,Q.jsx)(or,{className:`h-3.5 w-3.5 mr-1.5`}):(0,Q.jsx)(sr,{className:`h-3.5 w-3.5 mr-1.5`}),_?y(`detail.hideEmptyFields`,{defaultValue:`Hide empty fields`}):y(`detail.showEmptyFields`,{count:T,defaultValue:`Show {{count}} empty fields`})]})})]});return!e.title&&!e.collapsible&&e.showBorder===!1?(0,Q.jsx)(`div`,{className:U(n),children:z}):e.collapsible?(0,Q.jsx)($t,{open:!d,onOpenChange:e=>f(!e),className:n,children:(0,Q.jsxs)(rt,{className:U(e.showBorder===!1?`border-none shadow-none`:``),children:[(0,Q.jsx)(At,{asChild:!0,children:(0,Q.jsxs)(Pt,{className:U(`py-3 px-4 sm:py-4 sm:px-6 cursor-pointer hover:bg-muted/50 transition-colors`,Jg(e.headerColor)),children:[(0,Q.jsxs)(vt,{className:`flex items-center justify-between text-base font-semibold tracking-tight`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,Q.jsx)(Xg,{name:e.icon}),(0,Q.jsx)(`span`,{children:e.title})]}),(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:d?(0,Q.jsx)($n,{className:`h-4 w-4 text-muted-foreground`}):(0,Q.jsx)(Zn,{className:`h-4 w-4 text-muted-foreground`})})]}),e.description&&!d&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:e.description})]})}),(0,Q.jsx)($e,{children:(0,Q.jsx)(ut,{className:`pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5`,children:z})})]})}):(0,Q.jsxs)(rt,{className:U(e.showBorder===!1?`border-none shadow-none`:``,n),children:[e.title&&(0,Q.jsxs)(Pt,{className:U(`py-3 px-4 sm:py-4 sm:px-6`,Jg(e.headerColor)),children:[(0,Q.jsx)(vt,{className:`flex items-center justify-between text-base font-semibold tracking-tight`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,Q.jsx)(Xg,{name:e.icon}),(0,Q.jsx)(`span`,{children:e.title})]})}),e.description&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:e.description})]}),(0,Q.jsx)(ut,{className:`pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5`,children:z})]})},$g=({tabs:e,data:t,className:n})=>{let[r,i]=$.useState(e[0]?.key),a=e.filter(e=>typeof e.visible==`boolean`?e.visible:(e.visible,!0));return(0,Q.jsxs)(cn,{value:r,onValueChange:i,className:n,children:[(0,Q.jsx)(Ke,{className:`w-full justify-start border-b rounded-none bg-transparent p-0`,children:a.map(e=>(0,Q.jsx)(hn,{value:e.key,className:`relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon&&(0,Q.jsx)(`span`,{children:e.icon}),(0,Q.jsx)(`span`,{children:e.label}),e.badge&&(0,Q.jsx)(mt,{variant:`secondary`,className:`ml-1`,children:e.badge})]})},e.key))}),a.map(e=>(0,Q.jsx)(yn,{value:e.key,className:`mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150`,children:(0,Q.jsx)($.Suspense,{fallback:null,children:Array.isArray(e.content)?(0,Q.jsx)(`div`,{className:`space-y-4`,children:e.content.map((e,n)=>(0,Q.jsx)(Ht,{schema:tt(e),data:t},n))}):(0,Q.jsx)(Ht,{schema:tt(e.content),data:t})})},e.key))]})},e_=({group:e,data:t,className:n,objectSchema:r,objectName:i,isEditing:a=!1,onFieldChange:o,onEnterInlineEdit:s,autoFocusField:c,dataSource:l})=>{let u=e.collapsible??!0,[d,f]=$.useState(e.defaultCollapsed??!1),p=(0,Q.jsx)(`div`,{className:`space-y-3 sm:space-y-4`,children:e.sections.map((e,n)=>(0,Q.jsx)(Qg,{section:e,data:t,objectSchema:r,objectName:i,isEditing:a,onFieldChange:o,onEnterInlineEdit:s,autoFocusField:c,dataSource:l},n))});return u?(0,Q.jsxs)($t,{open:!d,onOpenChange:e=>f(!e),className:n,children:[(0,Q.jsx)(At,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 pb-2 border-b cursor-pointer hover:bg-muted/50 transition-colors rounded-t-md px-2 py-1.5`,children:[d?(0,Q.jsx)($n,{className:`h-4 w-4 text-muted-foreground shrink-0`}):(0,Q.jsx)(Zn,{className:`h-4 w-4 text-muted-foreground shrink-0`}),e.icon&&(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,Q.jsx)(`h3`,{className:`text-lg font-semibold`,children:e.title})]})}),e.description&&!d&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),(0,Q.jsx)($e,{children:(0,Q.jsx)(`div`,{className:`mt-3`,children:p})})]}):(0,Q.jsxs)(`div`,{className:U(`space-y-3`,n),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 pb-2 border-b`,children:[e.icon&&(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,Q.jsx)(`h3`,{className:`text-lg font-semibold`,children:e.title})]}),e.description&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),p]})},t_=({fields:e,data:t,className:n,objectName:r,objectSchema:i,dataSource:a})=>{let{fieldLabel:o}=Ze(),{t:s}=Yp(),c=it(),l=c?.editing??!1,u=c?.canEdit??!1,d=c?.draft,f=$.useMemo(()=>t&&d?{...t,...d}:t,[t,d]);if(!e.length||!t)return null;let p=l?e:e.filter(e=>{let n=t?.[e.name];return n!=null&&n!==``});return p.length===0?null:(0,Q.jsx)(ie,{children:(0,Q.jsx)(`section`,{className:U(`@container border-b border-border/60 pb-4`,n),"aria-label":s(`detail.highlightsLabel`),children:(0,Q.jsx)(`div`,{className:U(`flex flex-wrap gap-y-4`),children:p.map(e=>{let n=t[e.name],d=i?.fields?.[e.name],p=e.type||d?.type,m=Bg({name:e.name,label:e.label,type:p||`text`},d),h=f?f[e.name]:n,g=Ng(e.type,d?.type),_=e.readonly===!0||d?.readonly===!0,v=jg.has(e.name),y=Fg(e.type,d?.type),b=u&&!g&&!_&&!v&&!y,x=l&&b,S=Np(xp(m)||p||`text`),C=p===`number`||p===`integer`||p===`currency`||p===`percent`||p===`decimal`,w=p===`email`||p===`url`||p===`textarea`||!!p&&Ae.has(p),T=p===`boolean`,E=!Yg(h);return(0,Q.jsxs)(`div`,{className:U(`group flex flex-col gap-1 min-w-[7rem] px-5 border-l border-border/60 first:border-l-0 first:pl-0`,w||x?`basis-[16rem] max-w-[24rem]`:`basis-[9rem] max-w-[16rem]`),children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:o(r||``,e.name,e.label)}),x?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gg,{field:m,value:h,onChange:t=>c.setField(e.name,t),dataSource:a,autoFocus:c.autoFocusField===e.name,error:c.fieldErrors?.[e.name],dependentValues:f}),c.fieldErrors?.[e.name]&&(0,Q.jsx)(`p`,{role:`alert`,"data-inline-field-hint":e.name,className:`mt-1 text-xs text-destructive`,children:c.fieldErrors[e.name]})]}):(0,Q.jsxs)(`div`,{className:U(`flex items-start justify-between gap-1`,b&&`cursor-pointer rounded-md -mx-1.5 px-1.5 hover:bg-muted/40 transition-colors`),onDoubleClick:b?()=>c.enter(e.name):void 0,title:b?s(`detail.editInlineHint`):void 0,children:[(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:T?h?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 self-start rounded-full bg-emerald-500/10 px-2 py-0.5 text-xs font-medium text-emerald-600 ring-1 ring-inset ring-emerald-500/30 dark:text-emerald-400`,children:[(0,Q.jsx)(Xn,{className:`h-3 w-3`,"aria-hidden":!0}),`Yes`]}):(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 self-start rounded-full bg-amber-500/10 px-2 py-0.5 text-xs font-medium text-amber-700 ring-1 ring-inset ring-amber-500/30 dark:text-amber-400`,children:[(0,Q.jsx)(Er,{className:`h-3 w-3`,"aria-hidden":!0}),`No`]}):E?(0,Q.jsx)(Y,{className:`block`}):(0,Q.jsx)(`span`,{title:(Array.isArray(m.options)?m.options.find(e=>e?.value===h)?.label:void 0)??(typeof h==`string`||typeof h==`number`?String(h):void 0),className:U(`block min-w-0 truncate text-sm font-semibold`,C&&`tabular-nums tracking-tight`),children:(0,Q.jsx)(S,{value:h,field:m})})}),b&&(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(G,{asChild:!0,children:(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-5 w-5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity`,"aria-label":s(`detail.editInlineHint`),onClick:t=>{t.stopPropagation(),c.enter(e.name)},children:(0,Q.jsx)(qo,{className:`h-3 w-3`})})}),(0,Q.jsx)(B,{children:s(`detail.editInlineHint`)})]})]})]},e.name)})})})})};function n_(e,t,n){try{let r=new Date(e),i=new Date().getTime()-r.getTime(),a=Math.floor(i/6e4);if(a<1)return t(`detail.justNow`);if(a<60)return t(`detail.minutesAgo`,{count:a});let o=Math.floor(a/60);if(o<24)return t(`detail.hoursAgo`,{count:o});let s=Math.floor(o/24);return s<7?t(`detail.daysAgo`,{count:s}):r.toLocaleDateString(n)}catch{return e}}var r_=({comments:e,onAddComment:t,onTogglePin:n,searchable:r=!1,className:i})=>{let{t:a}=Yp(),o=zn(),[s,c]=$.useState(``),[l,u]=$.useState(!1),[d,f]=$.useState(``),p=$.useCallback(async()=>{let e=s.trim();if(e&&t){u(!0);try{await t(e),c(``)}catch{}finally{u(!1)}}},[s,t]),m=$.useCallback(e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),p())},[p]),h=$.useMemo(()=>[...d.trim()?e.filter(e=>{let t=d.trim().toLowerCase();return e.text.toLowerCase().includes(t)||e.author.toLowerCase().includes(t)}):e].sort((e,t)=>e.pinned&&!t.pinned?-1:!e.pinned&&t.pinned?1:0),[e,d]);return(0,Q.jsxs)(rt,{className:U(``,i),children:[(0,Q.jsx)(Pt,{children:(0,Q.jsxs)(vt,{className:`flex items-center gap-2 text-base`,children:[(0,Q.jsx)(Mo,{className:`h-4 w-4`}),a(`detail.comments`),(0,Q.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`(`,e.length,`)`]})]})}),(0,Q.jsxs)(ut,{className:`space-y-4`,children:[r&&(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Q.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Q.jsx)(vr,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,Q.jsx)(`input`,{className:`w-full rounded-md border border-input bg-background pl-8 pr-8 py-1.5 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,placeholder:a(`detail.searchComments`),value:d,onChange:e=>f(e.target.value),"aria-label":a(`detail.searchComments`)}),d&&(0,Q.jsx)(`button`,{className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>f(``),"aria-label":a(`detail.clearSearch`),type:`button`,children:(0,Q.jsx)(Er,{className:`h-3.5 w-3.5`})})]})}),t&&(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`textarea`,{className:`flex-1 min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-none`,placeholder:a(`detail.addCommentPlaceholder`),value:s,onChange:e=>c(e.target.value),onKeyDown:m,disabled:l}),(0,Q.jsx)(J,{size:`icon`,variant:`default`,onClick:p,disabled:!s.trim()||l,className:`shrink-0 self-end`,children:(0,Q.jsx)(ns,{className:`h-4 w-4`})})]}),h.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-4`,children:d.trim()?a(`detail.noMatchingComments`):a(`detail.noCommentsYet`)}):(0,Q.jsx)(`div`,{className:`space-y-3`,children:h.map(e=>(0,Q.jsxs)(`div`,{className:U(`flex gap-3`,e.pinned&&`bg-muted/40 rounded-md p-2 -mx-2`),children:[(0,Q.jsx)(`div`,{className:`shrink-0`,children:e.avatarUrl?(0,Q.jsx)(`img`,{src:e.avatarUrl,alt:e.author,className:`h-8 w-8 rounded-full object-cover`}):(0,Q.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center text-xs font-medium text-muted-foreground`,children:e.author.charAt(0).toUpperCase()})}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 mb-0.5`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium truncate`,children:e.author}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n_(e.createdAt,a,o)}),e.pinned&&(0,Q.jsxs)(`span`,{className:`text-xs text-amber-600 flex items-center gap-0.5`,children:[(0,Q.jsx)($o,{className:`h-3 w-3`}),a(`detail.pinned`)]})]}),(0,Q.jsx)(`p`,{className:`text-sm whitespace-pre-wrap break-words`,children:e.text}),n&&(0,Q.jsxs)(`button`,{type:`button`,className:`mt-1 text-xs text-muted-foreground hover:text-foreground flex items-center gap-1`,onClick:()=>n(e.id),"aria-label":e.pinned?a(`detail.unpin`):a(`detail.pin`),children:[(0,Q.jsx)($o,{className:`h-3 w-3`}),e.pinned?a(`detail.unpin`):a(`detail.pin`)]})]})]},e.id))})]})]})},i_={field_change:br,create:Ka,delete:Cr,comment:Mo,status_change:Ta},a_={field_change:`bg-blue-100 text-blue-600`,create:`bg-green-100 text-green-600`,delete:`bg-red-100 text-red-600`,comment:`bg-purple-100 text-purple-600`,status_change:`bg-amber-100 text-amber-600`};function o_(e,t,n){try{let r=new Date(e),i=new Date().getTime()-r.getTime(),a=Math.floor(i/6e4);if(a<1)return t(`detail.justNow`);if(a<60)return t(`detail.minutesAgo`,{count:a});let o=Math.floor(a/60);if(o<24)return t(`detail.hoursAgo`,{count:o});let s=Math.floor(o/24);return s<7?t(`detail.daysAgo`,{count:s}):r.toLocaleDateString(n)}catch{return e}}function s_(e,t){if(e.description)return e.description;let n=t(`detail.activityEmptyValue`);return e.type===`field_change`&&e.field?t(`detail.activityFieldChanged`,{field:e.field.charAt(0).toUpperCase()+e.field.slice(1).replace(/_/g,` `),old:e.oldValue==null?n:String(e.oldValue),new:e.newValue==null?n:String(e.newValue)}):e.type===`create`?t(`detail.activityCreated`):e.type===`delete`?t(`detail.activityDeleted`):e.type===`status_change`&&e.field?t(`detail.activityStatusChanged`,{value:e.newValue==null?n:String(e.newValue)}):t(`detail.activityUpdated`)}var c_=[`all`,`field_change`,`create`,`delete`,`comment`,`status_change`];function l_(e,t){switch(e){case`field_change`:return t(`detail.fieldChangesFilter`);case`create`:return t(`detail.createsFilter`);case`delete`:return t(`detail.deletesFilter`);case`comment`:return t(`detail.comments`);case`status_change`:return t(`detail.statusChangesFilter`);default:return t(`detail.allFilter`)}}var u_=({activities:e,filterable:t=!1,defaultFilter:n=`all`,className:r})=>{let{t:i}=Yp(),a=zn(),[o,s]=$.useState(n),c=$.useMemo(()=>o===`all`?e:e.filter(e=>e.type===o),[e,o]);return(0,Q.jsxs)(rt,{className:U(``,r),children:[(0,Q.jsx)(Pt,{children:(0,Q.jsxs)(vt,{className:`flex items-center gap-2 text-base`,children:[(0,Q.jsx)(Sa,{className:`h-4 w-4`}),i(`detail.activity`),(0,Q.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`(`,c.length,`)`]})]})}),(0,Q.jsxs)(ut,{children:[t&&(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mb-4`,role:`group`,"aria-label":i(`detail.filterActivity`),children:c_.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:U(`inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors`,o===e?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-muted/80`),onClick:()=>s(e),"aria-pressed":o===e,children:[e!==`all`&&$.createElement(i_[e]||br,{className:`h-3 w-3`}),l_(e,i)]},e))}),c.length===0?(0,Q.jsx)(Ft,{title:i(`detail.noActivity`),className:`py-6`}):(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`div`,{className:`absolute left-4 top-2 bottom-2 w-px bg-border`}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:c.map(e=>{let t=i_[e.type]||br,n=a_[e.type]||`bg-gray-100 text-gray-600`;return(0,Q.jsxs)(`div`,{className:`flex gap-3 relative`,children:[(0,Q.jsx)(`div`,{className:U(`shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10`,n),children:(0,Q.jsx)(t,{className:`h-3.5 w-3.5`})}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0 pt-1`,children:[(0,Q.jsxs)(`p`,{className:`text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.user}),` `,(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:s_(e,i)})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:o_(e.timestamp,i,a)})]})]},e.id)})})]})]})]})},d_={create:`default`,update:`secondary`,delete:`destructive`,login:`outline`,logout:`outline`,config_change:`secondary`,import:`outline`};function f_(e,t){if(!e)return``;let n=e instanceof Date?e:new Date(e);return Number.isNaN(n.getTime())?String(e):n.toLocaleString(t)}var p_=[[60,`second`],[60,`minute`],[24,`hour`],[7,`day`],[4.34524,`week`],[12,`month`],[1/0,`year`]];function m_(e,t){if(!e)return``;let n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return String(e);let r=(n.getTime()-Date.now())/1e3;for(let[n,i]of p_){if(Math.abs(r)<n)try{return new Intl.RelativeTimeFormat(t,{numeric:`auto`}).format(Math.round(r),i)}catch{return f_(e,t)}r/=n}return f_(e,t)}function h_(e){if(!e)return`?`;let t=e.trim().split(/\s+/).filter(Boolean).slice(0,2);return t.length===0?`?`:t.map(e=>e.charAt(0).toUpperCase()).join(``)}function g_(e){if(!Yg(e))return`—`;if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function __({entries:e,loading:t,emptyText:n,unknownUserText:r,className:i,locale:a}){let o=zn(),s=a??o;return t?(0,Q.jsx)(`div`,{className:U(`space-y-3`,i),children:Array.from({length:4}).map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(w,{className:`h-8 w-8 rounded-full`}),(0,Q.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,Q.jsx)(w,{className:`h-4 w-1/3`}),(0,Q.jsx)(w,{className:`h-3 w-1/2`})]})]},t))}):!e||e.length===0?(0,Q.jsx)(`div`,{className:U(`flex items-center justify-center rounded-md border border-dashed py-10 text-sm text-muted-foreground`,i),children:n??`No history yet`}):(0,Q.jsx)(ie,{delayDuration:150,children:(0,Q.jsx)(`ol`,{className:U(`space-y-4`,i),children:e.map((e,t)=>{let n=(e.action??``).toLowerCase(),i=d_[n]??`outline`,a=typeof e.user_name==`string`&&e.user_name.trim()||r||`Unknown user`,o=f_(e.created_at,s),c=m_(e.created_at,s),l=typeof e.user_avatar==`string`?e.user_avatar:void 0;return(0,Q.jsxs)(`li`,{className:`flex items-start gap-3`,children:[(0,Q.jsxs)(Ve,{className:`h-8 w-8 mt-0.5 shrink-0`,children:[l?(0,Q.jsx)(Sn,{src:l,alt:a}):null,(0,Q.jsx)(un,{className:`text-[10px] font-medium`,children:h_(e.user_name)})]}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-1`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:a}),e.action&&(0,Q.jsx)(mt,{variant:i,className:`text-[10px] uppercase tracking-wide`,children:e.action}),o&&(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(G,{asChild:!0,children:(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground cursor-help`,"aria-label":o,children:c||o})}),(0,Q.jsx)(B,{children:o})]})]}),e.summary&&(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e.summary}),e.changes&&e.changes.length>0&&(n===`create`?(0,Q.jsxs)(`details`,{className:`mt-1 group`,children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer list-none text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 select-none`,children:[(0,Q.jsx)(`span`,{className:`transition-transform group-open:rotate-90`,children:`▸`}),(0,Q.jsx)(`span`,{children:e.changes.length===1?`1 field populated`:`${e.changes.length} fields populated`})]}),(0,Q.jsx)(`ul`,{className:`mt-1.5 space-y-0.5 text-xs text-muted-foreground pl-4`,children:e.changes.map(e=>(0,Q.jsxs)(`li`,{className:`leading-relaxed`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:e.label||e.field}),`: `,(0,Q.jsx)(`span`,{className:`text-foreground`,children:g_(e.to)})]},e.field))})]}):(0,Q.jsx)(`ul`,{className:`mt-1.5 space-y-0.5 text-xs text-muted-foreground`,children:e.changes.map(e=>(0,Q.jsxs)(`li`,{className:`leading-relaxed`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:e.label||e.field}),`: `,(0,Q.jsx)(`span`,{className:`line-through opacity-70`,children:g_(e.from)}),` → `,(0,Q.jsx)(`span`,{className:`text-foreground`,children:g_(e.to)})]},e.field))}))]})]},e.id??t)})})})}var v_=si;function y_(e){if(!e)return null;if(e instanceof Date)return isNaN(e.getTime())?null:e;if(typeof e==`string`||typeof e==`number`){let t=new Date(e);return isNaN(t.getTime())?null:t}return null}function b_(e){return Yg(e)?e:void 0}function x_(e,t){let n=Date.now()-e.getTime(),r=Math.max(0,Math.floor(n/1e3));if(r<60)return t(`detail.justNow`);let i=Math.floor(r/60);if(i<60)return t(`detail.minutesAgo`,{count:i});let a=Math.floor(i/60);return a<24?t(`detail.hoursAgo`,{count:a}):t(`detail.daysAgo`,{count:Math.floor(a/24)})}function S_(e,t){try{return new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(e)}catch{return e.toISOString()}}var C_=({value:e,objectSchema:t,fieldName:n})=>{if(!Yg(e))return null;let r=t?.fields?.[n],i=r?.reference||`sys_user`,a={name:n,type:r?.type||`lookup`,reference:i,...r?.reference_field&&{reference_field:r.reference_field}},o=xp(a)||a.type;if(o){let t=Np(o);if(t)return(0,Q.jsx)(`span`,{className:`inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline`,children:$.createElement(t,{value:e,field:a})})}return(0,Q.jsx)(`span`,{children:String(e)})},w_=({label:e,user:t,date:n,objectSchema:r,userField:i,t:a,locale:o})=>{if(!t&&!n)return null;let s=n?(0,Q.jsx)(ie,{delayDuration:200,children:(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(G,{asChild:!0,children:(0,Q.jsx)(`time`,{dateTime:n.toISOString(),className:`cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2`,children:x_(n,a)})}),(0,Q.jsx)(B,{side:`top`,children:S_(n,o)})]})}):null;return(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:e}),t?(0,Q.jsx)(C_,{value:t,objectSchema:r,fieldName:i}):null,t&&s?(0,Q.jsx)(`span`,{className:`text-muted-foreground/40`,children:`·`}):null,s]})},T_=({data:e,objectSchema:t,objectName:n,className:r})=>{let{t:i}=Yp(),a=zn();if(!e)return null;let o=y_(e[v_.createdAt]),s=y_(e[v_.updatedAt]),c=b_(e[v_.createdBy]),l=b_(e[v_.updatedBy]),u=!!(o||c),d=o&&s&&Math.abs(s.getTime()-o.getTime())<2e3,f=!!(s||l)&&!(d&&(c!=null&&l!=null&&String(c)===String(l)||!l));return!u&&!f?null:(0,Q.jsxs)(`div`,{className:U(`mt-6 pt-3 border-t border-border/40`,`flex flex-wrap items-center gap-x-4 gap-y-1`,`text-xs text-muted-foreground`,r),"data-testid":`record-meta-footer`,children:[u&&(0,Q.jsx)(w_,{label:i(c?`detail.createdBy`:`detail.created`),user:c,date:o,objectSchema:t,userField:v_.createdBy,t:i,locale:a}),f&&(0,Q.jsx)(w_,{label:i(l?`detail.updatedBy`:`detail.updated`),user:l,date:s,objectSchema:t,userField:v_.updatedBy,t:i,locale:a})]})},E_=new Map,D_=new Set;function O_(e){for(let t of Array.from(E_.keys())){let[,n,r]=JSON.parse(t);Oe(e,n,r)&&E_.delete(t)}for(let t of D_)for(let n of t.recordIds)Oe(e,t.object,n)&&t.staled.add(n)}O(O_);var k_;function A_(e){k_!==void 0&&k_!==e&&E_.clear(),k_=e}function j_(e,t,n=`update`,r=!0){let i=ws().userId,a=e&&t?JSON.stringify([i,e,t,n]):``,o=L(e,t),[s,c]=$.useState(()=>a&&E_.has(a)?E_.get(a):!0),l=$.useContext(ln)?.apiFetch;return $.useEffect(()=>{if(A_(i),!r||!e||!t){c(!0);return}if(E_.has(a)){c(E_.get(a));return}c(!0);let o=!1,s={object:e,recordIds:[t],staled:new Set};return D_.add(s),(async()=>{try{let r=await(l??fetch)(`/api/v1/security/explain`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({object:e,operation:n,recordId:t})});if(!r.ok)return;let i=(await r.json())?.record?.visible;if(typeof i!=`boolean`||s.staled.size>0)return;E_.set(a,i),o||c(i)}catch{}finally{D_.delete(s)}})(),()=>{o=!0}},[a,i,e,t,n,r,l,o]),s}var M_=new Set([`select`,`status`,`multiselect`,`radio`,`checkboxes`,`tags`,`user`,`image`,`avatar`,`signature`,`boolean`,`toggle`,`date`,`datetime`,`repeater`,`file`,`video`,`audio`]);function N_(e){return!M_.has(e)}function P_(e,t){let n=oa(e,t);return t===`whole`?n:Number(n.toPrecision(12))}var F_={};function I_(e,t,n,r){if(e&&typeof e==`object`){if(t.primaryField){let n=e[t.primaryField];if(n!=null&&n!==``)return String(n)}let r=xe(e,wn(n));if(r){let t=e.id??e._id;if(!(r===`Untitled`||t!=null&&r===`Record #${t}`))return r}let i=we(n?.titleFormat,e);if(i)return i}if(e&&typeof e==`object`){let t=e.id??e._id,r=A(n,e,{deriveFromRecordKeys:!1});if(!(r===`Untitled`||t!=null&&r===`Record #${t}`))return r}if(t.title)return t.title;if(e&&typeof e==`object`){let t=e.id??e._id,r=A(n,e);if(!(r===`Untitled`||t!=null&&r===`Record #${t}`))return r}if(e&&typeof e==`object`){let t=e.id??e._id;if(t!=null&&String(t).trim()!==``)return`Record #${t}`}return r}var L_=e=>(e||[]).flatMap(e=>Array.isArray(e?.fields)?e.fields:[]),R_=({section:e,index:t,children:n})=>(0,Q.jsx)(ct,{componentType:`record:details section ${e?.name??e?.group??e?.title??e?.label??`#${t+1}`}`,children:n}),z_=({schema:e,dataSource:t,className:n,onEdit:r,onDelete:i,onBack:a,inlineEdit:o=!1,discussionSlot:s,rightRail:c,objectLabel:l,onDataLoaded:u,isFavorite:d,onToggleFavorite:f})=>{let[p,m]=$.useState(e.data),[h,g]=$.useState(!e.data&&!!(e.api&&e.resourceId||t&&e.objectName&&e.resourceId)),[_,v]=$.useState(!1),y=d??_,b=it(),x=b?.editing??!1,S=b?.draft??F_,C=b?.autoFocusField??null,[T,E]=$.useState(null),[D,O]=$.useState(null),[k,A]=$.useState(!1),[j,M]=$.useState(0),ee=L(e.objectName||void 0,e.resourceId==null?void 0:String(e.resourceId)),[N,P]=$.useState(!1),{t:F}=Yp(),{currency:te}=Fn(),ne=zn(),{fieldOptionLabel:I,fieldLabel:re}=Ze(),R=ws(),z=$.useMemo(()=>{if(!R?.isLoaded||!e.objectName)return e;let t=t=>R.checkField(e.objectName,t,`read`),n=e=>e&&e.filter(e=>{let n=typeof e==`string`?e:e?.name;return!n||t(n)});return{...e,fields:n(e.fields),sections:e.sections?.map(e=>({...e,fields:n(e.fields)})),summaryFields:n(e.summaryFields)}},[e,R]),V=$.useMemo(()=>sa(p,R,e.objectName),[p,R,e.objectName]),H=$.useMemo(()=>!R?.isLoaded||!e.objectName||R.can(e.objectName,`update`),[R,e.objectName]),ae=$.useMemo(()=>!R?.isLoaded||!e.objectName||R.can(e.objectName,`delete`),[R,e.objectName]),W=e.resourceId==null?void 0:String(e.resourceId),oe=j_(e.objectName,W,`update`,H),se=j_(e.objectName,W,`delete`,ae),ce=$.useMemo(()=>Yr(D?.userActions?.edit),[D]),le=$.useMemo(()=>Yr(D?.userActions?.delete),[D]),ue=D?.fields,de=fn(ce?.visibleWhen??!0,p,{fallback:!1,warnOnError:!0,label:`builtin:edit:visibleWhen`,fields:ue}),fe=fn(le?.visibleWhen??!0,p,{fallback:!1,warnOnError:!0,label:`builtin:delete:visibleWhen`,fields:ue}),pe=fn(ce?.disabledWhen,p,{fallback:!1,warnOnError:!0,label:`builtin:edit:disabledWhen`,fields:ue}),me=fn(le?.disabledWhen,p,{fallback:!1,warnOnError:!0,label:`builtin:delete:disabledWhen`,fields:ue}),he=ce?.disabledWhen!=null&&pe,_e=le?.disabledWhen!=null&&me,q=$.useMemo(()=>({...z,showEdit:z.showEdit&&H&&oe&&de,showDelete:z.showDelete&&ae&&se&&fe}),[z,H,oe,de,ae,se,fe]);$.useEffect(()=>{p&&u&&u(p)},[p,u]);let ve=$.useMemo(()=>{if(q.summaryFields&&q.summaryFields.length>0)return[];let e=[...L_(q.sections),...q.fields||[]],t={};for(let n of e)t[n.name]||(t[n.name]=n);if(D?.fields)for(let[e,n]of Object.entries(D.fields))t[e]={...t[e]||{},...n,name:e};let n=e=>Yg(p?.[e]),r=[],i=[`status`,`stage`,`state`,`phase`].find(e=>t[e]&&n(e))||Object.keys(t).find(e=>t[e]?.type===`select`&&n(e));i&&r.push(i);let a=Object.keys(t).find(e=>(t[e]?.type===`currency`||/amount|revenue|value|total|price/i.test(e))&&n(e));a&&!r.includes(a)&&r.push(a);let o=Object.keys(t).find(e=>(t[e]?.type===`date`||t[e]?.type===`datetime`)&&/close|due|start|end|expected/i.test(e)&&n(e));return o&&!r.includes(o)&&r.push(o),r},[q.summaryFields,q.sections,q.fields,D,p]),ye=q.summaryFields&&q.summaryFields.length>0?q.summaryFields:ve,be=$.useCallback(()=>{q.resourceId&&navigator.clipboard.writeText(String(q.resourceId)).then(()=>{A(!0),setTimeout(()=>A(!1),1500)})},[q.resourceId]);$.useEffect(()=>{let e=!0;if(q.data)return m(q.data),g(!1),t?.getObjectSchema&&q.objectName&&t.getObjectSchema(q.objectName).then(t=>{e&&O(t)}).catch(()=>{}),()=>{e=!1};if(t&&q.objectName&&q.resourceId){g(!0),O(null),m(null);let n=q.objectName,r=q.resourceId,i=`${n}-`,a=[...L_(q.sections),...q.fields||[]];(t.getObjectSchema?t.getObjectSchema(n).catch(()=>null):Promise.resolve(null)).then(o=>{if(!e)return;O(o);let s=Ie(o?.fields,a),c=R?.isLoaded?s.filter(e=>R.checkField(n,e,`read`)):s,l=c.length>0?{$expand:c}:void 0,u=l?t.findOne(n,r,l):t.findOne(n,r),d=()=>{let a=String(r),o=a.startsWith(i)?a.slice(i.length):`${i}${a}`;return(l?t.findOne(n,o,l):t.findOne(n,o)).then(t=>{e&&(m(t),g(!1))}).catch(()=>{e&&(m(null),g(!1))})};return u.catch(()=>null).then(t=>{if(e){if(t){m(t),g(!1);return}return d()}})}).catch(t=>{e&&(console.error(`Failed to fetch detail data:`,t),g(!1))})}else q.api&&q.resourceId&&(g(!0),fetch(`${q.api}/${q.resourceId}`).then(e=>e.json()).then(t=>{e&&m(t?.data||t)}).catch(e=>{console.error(`Failed to fetch detail data:`,e)}).finally(()=>{e&&g(!1)}));return()=>{e=!1}},[q.api,q.resourceId,q.objectName,t,q.sections,q.fields,j,ee,R]);let xe=$.useCallback(()=>{if(a)a();else if(q.onNavigate){let e=q.backUrl||(q.objectName?`/${q.objectName}`:`/`);q.onNavigate(e,{replace:!0})}else q.backUrl?window.location.href=q.backUrl:window.history.back()},[a,q]),Se=$.useCallback(()=>{r?r():q.onNavigate&&q.editUrl?q.onNavigate(q.editUrl):q.onNavigate&&q.objectName&&q.resourceId?q.onNavigate(`/${q.objectName}/${q.resourceId}/edit`):q.editUrl&&(window.location.href=q.editUrl)},[r,q]),Ce=$.useCallback(async()=>{if(!t?.cancelPendingApproval||!q.objectName||!q.resourceId){E(F(`detail.cancelApprovalUnavailable`));return}P(!0),E(null);try{if(await t.cancelPendingApproval(String(q.objectName),String(q.resourceId)),t.findOne)try{let e=await t.findOne(String(q.objectName),String(q.resourceId));e&&m(e)}catch{}M(e=>e+1);try{window.dispatchEvent(new CustomEvent(`objectui:record-changed`,{detail:{objectName:String(q.objectName),recordId:String(q.resourceId),reason:`approval-recalled`}}))}catch{}}catch(e){let t=(e?.message||e?.error||String(e??`Cancel failed`)).replace(/^\[[^\]]+\]\s*/,``).replace(/^[A-Z][A-Z0-9_]+:\s*/,``);E(`${F(`detail.cancelApprovalFailed`)}: ${t}`)}finally{P(!1)}},[t,q.objectName,q.resourceId,F]),we=$.useCallback(()=>{let e=q.deleteConfirmation||F(`detail.deleteConfirmation`);window.confirm(e)&&(i?.(),q.onNavigate&&q.objectName&&q.onNavigate(`/${q.objectName}`,{replace:!0}))},[i,q]),Te=$.useCallback(()=>{navigator.share&&q.objectName&&q.resourceId?navigator.share({title:q.title||F(`detail.details`),text:`${q.objectName} #${q.resourceId}`,url:window.location.href}).catch(e=>{console.error(`Share failed:`,e)}):navigator.clipboard.writeText(window.location.href)},[q]),Ee=$.useCallback(()=>{let e=!y;f&&f(e),d===void 0&&v(e)},[y,d,f]),De=b?.setField,Oe=b&&b.canEdit?b.enter:void 0;$.useEffect(()=>{if(!q.recordNavigation)return;let e=q.recordNavigation,t=t=>{let n=t.target?.tagName;n===`INPUT`||n===`TEXTAREA`||t.target?.isContentEditable||(t.key===`ArrowLeft`&&e.currentIndex>0?(t.preventDefault(),e.onNavigate(e.recordIds[e.currentIndex-1])):t.key===`ArrowRight`&&e.currentIndex<e.recordIds.length-1&&(t.preventDefault(),e.onNavigate(e.recordIds[e.currentIndex+1])))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[q.recordNavigation]);let ke=$.useMemo(()=>{let e=[];return e.push({name:`sys_share`,label:F(`detail.share`),icon:`share-2`,type:`script`,onClick:Te}),q.showEdit&&e.push({name:`sys_edit_mobile`,label:F(`detail.edit`),icon:`square-pen`,type:`script`,className:`sm:hidden`,...he?{disabled:!0}:null,onClick:Se}),q.showDelete&&e.push({name:`sys_delete`,label:F(`detail.delete`),icon:`trash`,type:`script`,variant:`destructive`,tags:[`separator-before`],..._e?{disabled:!0}:null,onClick:we}),e},[F,q.showEdit,q.showDelete,he,_e,Te,Se,we]),Ae=$.useMemo(()=>{let e=q.actions??[];if(ke.length===0)return e;let t=!1,n=e.map(e=>{let n=e;if(n&&typeof n==`object`&&n.type===`action:bar`&&(!n.location||n.location===`record_header`)){t=!0;let e=Array.isArray(n.systemActions)?n.systemActions:[];return{...n,systemActions:[...e,...ke]}}return e});return t||n.push({type:`action:bar`,location:`record_header`,systemActions:ke}),n},[q.actions,ke]);return h||q.loading?(0,Q.jsxs)(`div`,{className:U(`space-y-4`,n),children:[(0,Q.jsx)(w,{className:`h-10 w-full`}),(0,Q.jsx)(w,{className:`h-64 w-full`}),(0,Q.jsx)(w,{className:`h-48 w-full`})]}):!p&&!q.data?(0,Q.jsxs)(`div`,{className:U(`flex flex-col items-center justify-center py-16 text-center`,n),children:[(0,Q.jsx)(`p`,{className:`text-lg font-semibold`,children:F(`detail.recordNotFound`)}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:F(`detail.recordNotFoundDescription`)}),(q.showBack??!0)&&(0,Q.jsxs)(J,{variant:`outline`,size:`sm`,onClick:xe,className:`mt-4 gap-2`,children:[(0,Q.jsx)(Un,{className:`h-4 w-4`}),F(`detail.goBack`)]})]}):(0,Q.jsx)(ie,{children:(0,Q.jsxs)(`div`,{className:U(`space-y-6`,n),children:[q.showHeader!==!1&&(0,Q.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:flex-wrap items-start justify-between gap-3 sm:gap-4 pb-4 border-b`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 sm:gap-3 flex-1 min-w-0 sm:min-w-64 w-full sm:w-auto`,children:[(q.showBack??!0)&&(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(G,{asChild:!0,children:(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,onClick:xe,className:`shrink-0 mt-1`,children:(0,Q.jsx)(Un,{className:`h-4 w-4`})})}),(0,Q.jsx)(B,{children:F(`detail.back`)})]}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,Q.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold truncate`,children:I_(V,q,D,F(`detail.details`))}),ye.map(e=>{let t=p?.[e];if(!Yg(t))return null;let n=L_(q.sections).concat(q.fields||[]).find(t=>t.name===e),r=D?.fields?.[e],i=n?.type||r?.type,a=re(q.objectName||``,e,n?.label||r?.label||e),o=String(t),s=null;try{if(i===`currency`){let e=Number(t);if(!Number.isNaN(e)){let t=ya({...r,...n},te);o=t?new Intl.NumberFormat(ne,{style:`currency`,currency:t,maximumFractionDigits:0}).format(e):new Intl.NumberFormat(ne,{maximumFractionDigits:0}).format(e)}}else if(i===`date`||i===`datetime`){let e=En(t);Number.isNaN(e.getTime())||(o=i===`datetime`?e.toLocaleString(ne,{dateStyle:`medium`,timeStyle:`short`}):e.toLocaleDateString(ne,{dateStyle:`medium`}))}else if(i===`percent`){let e=Number(t);if(!Number.isNaN(e)){let t={...r,...n},a=ge({type:i,scale:t.scale}),c=Fs({type:i,max:t.max});o=gf(e,c,a,ne);let l=P_(e,c);s=Math.max(0,Math.min(100,l))}}else if(i===`select`||i===`status`||i===`multiselect`){let i=n?.options||r?.options,a=String(t);if(Array.isArray(i)){let e=i.find(e=>String(e?.value??e)===String(t));e?.label&&(a=e.label)}else if(i&&typeof i==`object`){let e=i[String(t)];e?.label&&(a=e.label)}o=q.objectName?I(q.objectName,e,String(t),a):a}}catch{}let c=Bg({name:e,label:n?.label,type:i||`text`},r),l=xp(c)||i||`text`,u=o.includes(`[object Object]`),d=u&&N_(l)?Np(l):null;return u&&!d&&(o=String(zs(t)??``)),d?(0,Q.jsxs)(mt,{variant:`secondary`,className:`text-xs bg-primary/10 text-primary border-transparent hover:bg-primary/15`,"data-summary-chip":e,children:[(0,Q.jsx)(`span`,{className:`sr-only`,children:`${a}: `}),(0,Q.jsx)(d,{value:t,field:c})]},e):s===null?(0,Q.jsx)(mt,{variant:`secondary`,className:`text-xs bg-primary/10 text-primary border-transparent hover:bg-primary/15`,"aria-label":`${a}: ${o}`,"data-summary-chip":e,children:o},e):(0,Q.jsxs)(mt,{variant:`secondary`,className:`text-xs bg-primary/10 text-primary border-transparent hover:bg-primary/15 gap-1.5 pl-2 pr-2`,"aria-label":`${a}: ${o}`,"data-summary-chip":e,children:[(0,Q.jsx)(`span`,{className:`relative inline-block h-1.5 w-12 rounded-full bg-primary/20 overflow-hidden`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`absolute inset-y-0 left-0 rounded-full bg-primary`,style:{width:`${s}%`}})}),o]},e)}),(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(G,{asChild:!0,children:(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-6 w-6 shrink-0`,onClick:Ee,"aria-label":F(y?`detail.removeFromFavorites`:`detail.addToFavorites`),children:y?(0,Q.jsx)(xr,{className:`h-4 w-4 fill-yellow-400 text-yellow-400`}):(0,Q.jsx)(xr,{className:`h-4 w-4 text-muted-foreground`})})}),(0,Q.jsx)(B,{children:F(y?`detail.removeFromFavorites`:`detail.addToFavorites`)})]})]}),q.objectName&&(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground mt-1 flex items-center gap-1`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:l||q.objectName}),q.resourceId&&(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(G,{asChild:!0,children:(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground`,onClick:be,"aria-label":F(`detail.copyRecordId`,{defaultValue:`Copy record ID`}),children:k?(0,Q.jsx)(Xn,{className:`h-3 w-3 text-green-600`}):(0,Q.jsx)(nr,{className:`h-3 w-3`})})}),(0,Q.jsx)(B,{children:k?F(`detail.copied`,{defaultValue:`Copied!`}):F(`detail.copyRecordId`,{defaultValue:`Copy record ID`})})]})]})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 shrink-0 w-full sm:w-auto`,children:[q.recordNavigation&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 mr-2`,children:[(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(G,{asChild:!0,children:(0,Q.jsx)(J,{variant:`outline`,size:`icon`,className:`h-8 w-8`,disabled:q.recordNavigation.currentIndex<=0,onClick:()=>{let e=q.recordNavigation;e.currentIndex>0&&e.onNavigate(e.recordIds[e.currentIndex-1])},children:(0,Q.jsx)(Qn,{className:`h-4 w-4`})})}),(0,Q.jsx)(B,{children:F(`detail.previousRecord`)})]}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap px-1`,children:F(`detail.recordOf`,{current:q.recordNavigation.currentIndex+1,total:q.recordNavigation.recordIds.length})}),(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(G,{asChild:!0,children:(0,Q.jsx)(J,{variant:`outline`,size:`icon`,className:`h-8 w-8`,disabled:q.recordNavigation.currentIndex>=q.recordNavigation.recordIds.length-1,onClick:()=>{let e=q.recordNavigation;e.currentIndex<e.recordIds.length-1&&e.onNavigate(e.recordIds[e.currentIndex+1])},children:(0,Q.jsx)($n,{className:`h-4 w-4`})})}),(0,Q.jsx)(B,{children:F(`detail.nextRecord`)})]})]}),q.showEdit&&(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(G,{asChild:!0,children:(0,Q.jsxs)(J,{variant:`default`,disabled:he,onClick:()=>{he||Se()},className:`gap-2 hidden sm:inline-flex`,children:[(0,Q.jsx)(br,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:F(`detail.edit`)})]})}),(0,Q.jsx)(B,{children:F(`detail.editRecord`)})]}),Ae.map((e,t)=>(0,Q.jsx)(Ht,{schema:tt(e),data:p},`header-action-${t}`))]})]}),K(q.header,e=>(0,Q.jsx)(`div`,{children:(0,Q.jsx)(Ht,{schema:tt(e),data:p})})),q.highlightFields&&q.highlightFields.length>0&&(0,Q.jsx)(t_,{fields:q.highlightFields,data:p,objectName:q.objectName,objectSchema:D}),o&&q.showHeader===!1&&(()=>{let e=p?.approval_status,n=e===`pending`||e===`in_approval`,r=b?.approvalPending??!1,i=r&&!(b?.locked??!1)?!1:(b?.locked??!1)||n,a=i||r||n,o=a?b?.approvalProgress:void 0,s=!!o&&o.need>0&&o.need<=12;return!a&&!T?null:(0,Q.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[a&&(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,Q.jsxs)(`span`,{role:`status`,className:i?`inline-flex items-center gap-1 rounded-md border border-amber-300 bg-amber-50 px-2 py-1 text-xs text-amber-800`:`inline-flex items-center gap-1 rounded-md border border-sky-300 bg-sky-50 px-2 py-1 text-xs text-sky-800`,title:i?b?.lockedReason??F(`detail.lockedTooltip`):F(`detail.approvalPendingTooltip`),children:[i?(0,Q.jsx)(Co,{className:`h-3 w-3`}):(0,Q.jsx)(Qa,{className:`h-3 w-3`}),(0,Q.jsx)(`span`,{children:F(i?`detail.lockedByApproval`:`detail.approvalPendingEditable`)})]}),t?.cancelPendingApproval&&b?.approvalIsSubmitter!==!1&&(0,Q.jsxs)(J,{variant:`outline`,size:`sm`,onClick:Ce,disabled:N,className:i?`gap-2 border-amber-300 text-amber-800 hover:bg-amber-50`:`gap-2 border-sky-300 text-sky-800 hover:bg-sky-50`,title:F(i?`detail.cancelApprovalTooltip`:`detail.cancelApprovalTooltipUnlocked`),children:[(0,Q.jsx)(Er,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{children:F(N?`detail.cancelApprovalInFlight`:`detail.cancelApproval`)})]})]}),o&&(0,Q.jsxs)(`div`,{className:`flex flex-col items-end gap-1 max-w-[16rem]`,children:[(0,Q.jsxs)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":o.need,"aria-valuenow":Math.min(o.got,o.need),"aria-label":F(`detail.approvalProgressLabel`),className:`flex items-center gap-2 w-full justify-end`,children:[(0,Q.jsx)(`span`,{className:`text-[11px] text-muted-foreground whitespace-nowrap`,children:o.behavior===`per_group`?F(`detail.approvalProgressGroups`,{got:o.got,need:o.need}):F(`detail.approvalProgress`,{got:o.got,need:o.need})}),s&&(0,Q.jsx)(`span`,{className:`flex items-center gap-1 w-20 shrink-0`,children:Array.from({length:o.need}).map((e,t)=>(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:U(`h-1.5 flex-1 rounded-full`,t<o.got?`bg-emerald-500`:`bg-muted`)},t))})]}),o.groups&&o.groups.length>0&&(0,Q.jsx)(`div`,{className:`flex flex-wrap justify-end gap-1`,children:o.groups.map(e=>(0,Q.jsxs)(`span`,{title:`${e.got}/${e.need}`,className:U(`inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px]`,e.satisfied?`border-emerald-300 text-emerald-700`:`border-border text-muted-foreground`),children:[e.satisfied?(0,Q.jsx)(Xn,{className:`h-3 w-3`}):(0,Q.jsx)(tr,{className:`h-2.5 w-2.5`}),(0,Q.jsx)(`span`,{children:`${e.group} ${e.got}/${e.need}`})]},e.group))})]}),T&&(0,Q.jsx)(`div`,{role:`alert`,className:`text-xs text-destructive bg-destructive/10 border border-destructive/20 rounded-md px-2 py-1 max-w-md text-right`,children:T})]})})(),q.autoTabs&&!q.tabs?.length?(()=>{let e=!!q.activities&&q.activities.length>0,n=!!s,r=!!q.history,i=[`details`,...e?[`activity`]:[],...n?[`discussion`]:[],...r?[`history`]:[]],a=q.defaultTab,c=a&&i.includes(a)?a:`details`,l=q.onTabChange,u=(0,Q.jsxs)(`div`,{className:`space-y-3 sm:space-y-4`,children:[q.sectionGroups&&q.sectionGroups.length>0&&q.sectionGroups.map((e,n)=>(0,Q.jsx)(e_,{group:e,data:{...p,...S},objectSchema:D,objectName:q.objectName,isEditing:x,onFieldChange:De,onEnterInlineEdit:o?Oe:void 0,autoFocusField:C,dataSource:t},n)),q.sections&&q.sections.length>0&&q.sections.map((e,n)=>(0,Q.jsx)(R_,{section:e,index:n,children:(0,Q.jsx)(Qg,{section:e,data:{...p,...S},objectSchema:D,objectName:q.objectName,isEditing:x,onFieldChange:De,onEnterInlineEdit:o?Oe:void 0,autoFocusField:C,dataSource:t})},n)),q.fields&&q.fields.length>0&&!q.sections?.length&&(0,Q.jsx)(Qg,{section:{fields:q.fields,columns:q.columns},data:{...p,...S},objectSchema:D,objectName:q.objectName,isEditing:x,onFieldChange:De,onEnterInlineEdit:o?Oe:void 0,autoFocusField:C,dataSource:t}),q.comments&&(0,Q.jsx)(r_,{comments:q.comments,onAddComment:q.onAddComment})]});return!e&&!n&&!r?(0,Q.jsx)(`div`,{className:`mt-2`,children:u}):(0,Q.jsxs)(cn,{defaultValue:c,onValueChange:l,className:`w-full`,children:[(0,Q.jsxs)(Ke,{className:`w-full justify-start border-b rounded-none bg-transparent p-0`,children:[(0,Q.jsx)(hn,{value:`details`,className:`relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent`,children:F(`detail.details`)}),e&&(0,Q.jsx)(hn,{value:`activity`,className:`relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent`,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[F(`detail.activity`),(0,Q.jsx)(mt,{variant:`secondary`,className:`text-xs bg-primary/10 text-primary border-transparent`,children:q.activities.length})]})}),n&&(0,Q.jsx)(hn,{value:`discussion`,className:`relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent`,children:F(`detail.discussion`,{defaultValue:`Discussion`})}),r&&(0,Q.jsx)(hn,{value:`history`,className:`relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent`,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[F(`detail.history`,{defaultValue:`History`}),!q.history.loading&&q.history.entries.length>0&&(0,Q.jsx)(mt,{variant:`secondary`,className:`text-xs bg-primary/10 text-primary border-transparent`,children:q.history.entries.length})]})})]}),(0,Q.jsx)(yn,{value:`details`,className:`mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150`,children:u}),e&&(0,Q.jsx)(yn,{value:`activity`,className:`mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150`,children:(0,Q.jsx)(u_,{activities:q.activities})}),n&&(0,Q.jsx)(yn,{value:`discussion`,className:`mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150`,children:s}),r&&(0,Q.jsx)(yn,{value:`history`,className:`mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150`,children:(0,Q.jsx)(__,{entries:q.history.entries,loading:q.history.loading,emptyText:q.history.emptyText??F(`detail.historyEmpty`,{defaultValue:`No history yet`})})})]})})():(0,Q.jsxs)(Q.Fragment,{children:[q.sectionGroups&&q.sectionGroups.length>0&&(0,Q.jsx)(`div`,{className:`space-y-3 sm:space-y-4`,children:q.sectionGroups.map((e,n)=>(0,Q.jsx)(e_,{group:e,data:{...p,...S},objectSchema:D,objectName:q.objectName,isEditing:x,onFieldChange:De,onEnterInlineEdit:o?Oe:void 0,autoFocusField:C,dataSource:t},n))}),q.sections&&q.sections.length>0&&(0,Q.jsx)(`div`,{className:`space-y-3 sm:space-y-4`,children:q.sections.map((e,n)=>(0,Q.jsx)(R_,{section:e,index:n,children:(0,Q.jsx)(Qg,{section:e,data:{...p,...S},objectSchema:D,objectName:q.objectName,isEditing:x,onFieldChange:De,onEnterInlineEdit:o?Oe:void 0,autoFocusField:C,dataSource:t})},n))}),q.fields&&q.fields.length>0&&!q.sections?.length&&(0,Q.jsx)(Qg,{section:{fields:q.fields,columns:q.columns},data:{...p,...S},objectSchema:D,objectName:q.objectName,isEditing:x,onFieldChange:De,onEnterInlineEdit:o?Oe:void 0,autoFocusField:C,dataSource:t}),q.tabs&&q.tabs.length>0&&(0,Q.jsx)($g,{tabs:q.tabs,data:p}),q.comments&&(0,Q.jsx)(r_,{comments:q.comments,onAddComment:q.onAddComment}),q.activities&&q.activities.length>0&&(0,Q.jsx)(u_,{activities:q.activities})]}),(0,Q.jsx)(T_,{data:{...p,...S},objectSchema:D,objectName:q.objectName}),K(q.footer,e=>(0,Q.jsx)(`div`,{children:(0,Q.jsx)(Ht,{schema:tt(e),data:p})}))]})})},B_=new Set([`title`,`description`,`icon`,`fields`,`collapsible`,`defaultCollapsed`,`columns`,`showBorder`,`headerColor`,`hideEmpty`]),V_=e=>{let t={},n={};for(let[r,i]of Object.entries(e))(B_.has(r)?t:n)[r]=i;return(0,Q.jsx)(Qg,{...n,section:t})};V_.displayName=`DetailSectionNode(DetailSection)`;function H_(e){return dt(e)??dr}function U_(e,t){let n=e?.id??e?._id;if(t){let r=A(t,e),i=r===`Untitled`||n!=null&&r===`Record #${n}`;if(r&&!i)return r}return e?.full_name||e?.fullname||e?.display_name||e?.name||e?.subject||e?.title||e?.label||e?.code||e?.email||(n==null?void 0:String(n))}function W_(e){if(!e)return[];if(typeof e==`string`){let t=e.trim();return t?t.startsWith(`-`)?[{field:t.slice(1),order:`desc`}]:[{field:t,order:`asc`}]:[]}return e.filter(e=>!!e?.field)}var G_=`image`;function K_(e){return $.createElement(Dp,{value:e})}function q_(e){let t=e?.accessorKey||at(e);return t?String(t):void 0}function J_(e){return JSON.parse(e)}function Y_(e,t,n){return!t?.isLoaded||!n?e:e.filter(e=>{let r=q_(e);return!r||t.checkField(n,r,`read`)})}function X_(e,t){return t?e.filter(e=>q_(e)!==t):e}function Z_(e,t){return t.size===0?e:e.filter(e=>{let n=q_(e);return!(n&&t.has(n))})}var Q_=({action:e,onToolbarAction:t})=>{let n=e.visible,r=gn(We(n),void 0,{throwOnError:!0,label:`related-list toolbar action "${e.name}" (visible)`});if(Jt(n)&&!r)return null;let i=e.icon?H_(e.icon):null;return(0,Q.jsxs)(J,{variant:e.variant===`primary`?`default`:`outline`,size:`sm`,onClick:n=>{n.stopPropagation(),t(e)},className:`gap-1 h-9 sm:h-7 text-xs shadow-none`,"data-testid":`related-toolbar-action-${e.name}`,children:[i&&(0,Q.jsx)(i,{className:`h-3.5 w-3.5`}),e.label||e.name]})},$_=({title:e,type:t,api:n,data:r,schema:i,columns:a,className:c,dataSource:l,objectName:u,onNew:f,newDisabled:p,onViewAll:m,onRowEdit:h,onRowDelete:g,onRowClick:v,rowActions:x,onRowAction:w,toolbarActions:T,onToolbarAction:E,add:D,redactFields:O,maxColumns:k=6,pageSize:A,defaultSort:j,sortable:ee=!1,filter:N,filterable:P=!1,collapsible:F=!1,defaultCollapsed:ne=!1,referenceField:I,parentId:L,icon:re})=>{let z=r!==void 0,B=r??[],[V,H]=$.useState(B),[ie,ae]=$.useState(()=>!!n&&!z),[W,oe]=$.useState(0),[G,K]=$.useState(null),[ce,ue]=$.useState(`asc`),[de,pe]=$.useState(``),[me,he]=$.useState(null),[ge,_e]=$.useState(!1),{ready:q,def:be}=Kt(n??``,l),[xe,Se]=$.useState(ne),[Ce,we]=$.useState(!1),[Te,Ee]=$.useState(!1),[De,Oe]=$.useState(null),[ke,Ae]=$.useState(0),[je,Me]=$.useState({}),{t:Ne}=Yp(),{fieldLabel:Pe}=Ze(),Fe=ws(),Le=te(),Re=$.useMemo(()=>(T??[]).filter(e=>Le(e?.requiredPermissions)),[T,Le]),ze=A&&A>0?A:0,Be=P&&de!==``,Ve=!z&&!!n&&ze>0&&!!l&&typeof l.find==`function`&&!Be,He=Ve?W:0,Ue=Ve?G:null,We=Ve?ce:`asc`,Ge=JSON.stringify(j??null),Ke=$.useMemo(()=>W_(j),[Ge]),qe=an(),Je=Ot(N,qe),Ye=JSON.stringify(Je??null),Xe=$.useMemo(()=>lt(Je),[Ye]),Qe=Xe.ok?void 0:Xe.refusal,$e=Xe.ok?Xe.node:void 0,et=$.useMemo(()=>{let e=Array.isArray(a)?a.map(e=>typeof e==`string`?e:e?.accessorKey||at(e)).filter(e=>typeof e==`string`&&e.length>0):[],t=Ie(be?.fields,e.length>0?e:void 0).filter(e=>e!==I),r=u||n||``;return!Fe?.isLoaded||!r?t:t.filter(e=>Fe.checkField(r,e,`read`))},[a,be,I,u,n,Fe]),tt=et.join(`,`),it=$.useMemo(()=>new Set((Array.isArray(O)?O:[]).filter(e=>typeof e==`string`&&e.length>0)),[O]),ot=$.useMemo(()=>{let e=Z_(Array.isArray(a)?a:[],it);if(e.length===0)return;let t=u||n||``,r=new Set([`id`]);for(let n of Y_(X_(e,I),Fe,t)){let e=q_(n);e&&r.add(e)}for(let e of et)r.add(e);let i=be?.fields;if(i&&typeof i==`object`){let e=e=>!Fe?.isLoaded||!t||Fe.checkField(t,e,`read`),n=ha(ga({rowActionDefs:x,objectActions:be?.actions,userActions:be?.userActions}));for(let t of n){let n=y(i,t)!==void 0;(n||ca.has(t))&&(!n||e(t))&&r.add(t)}y(i,G_)!==void 0&&e(G_)&&r.add(G_)}return Array.from(r)},[a,it,I,u,n,Fe,et,be,x]),st=ot?ot.join(`,`):``;$.useEffect(()=>{z&&H(r??[])},[r,z]);let ct=$.useMemo(()=>S(be?.fields,I),[be,I]),dt=D?.picker?.object,[ft,pt]=$.useState(null);$.useEffect(()=>{if(!Ce||!dt||ft||!l?.getObjectSchema)return;let e=!1;return l.getObjectSchema(dt).then(t=>{e||pt(t)}).catch(e=>{console.warn(`[RelatedList] Failed to fetch schema for ${dt}:`,e)}),()=>{e=!0}},[Ce,dt,ft,l]);let ht=D?.picker?.labelField||`name`,gt=$.useMemo(()=>{let e=Al(ft,{displayField:ht});return e.length>0?e:void 0},[ft,ht]);$.useEffect(()=>{D&&!dt&&console.warn(`[RelatedList] "${n||u||`related list`}" declares add without add.picker.object — the Add affordance is not rendered. add.picker is required by the spec (RecordRelatedListProps.add): set add.picker.object to the object the picker should list.`)},[D,dt,n,u]),$.useEffect(()=>{let e=!1;if(Qe){ae(!1);return}if(n&&!z){if(!(I&&L!=null&&L!==``)){n&&(L==null||L===``)&&!I&&console.warn(`[RelatedList] "${n}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`),H([]),he(null),_e(!1),ae(!1);return}if(ae(!0),!q)return;let t=ve(I,L,be?.fields),r=$e===void 0?t:nt(t,$e);if(l&&typeof l.find==`function`){let t={$filter:r};if(et.length>0&&(t.$expand=et),ot&&(t.$select=ot),Ve){t.$top=ze,t.$skip=He*ze;let e=Ue?[{field:Ue,order:We}]:Ke;e.length>0&&(t.$orderby=e)}l.find(n,t).then(t=>{if(e)return;let n=Array.isArray(t),r=n?t:Array.isArray(t?.data)?t.data:[];if(H(r),Ve){let e=!n&&typeof t?.total==`number`?t.total:null;he(e),_e(!n&&typeof t?.hasMore==`boolean`?t.hasMore:r.length===ze)}else he(null),_e(!1);ae(!1)}).catch(t=>{console.error(`Failed to fetch related data:`,t),e||ae(!1)})}else if($e!==void 0)console.warn(`[RelatedList] "${n}" declares a filter but has no dataSource adapter — the raw-URL fallback cannot express it, so no rows are fetched. Pass a dataSource (RecordContext) to use a filtered related list.`),H([]),he(null),_e(!1),ae(!1);else if(ct)console.warn(`[RelatedList] "${n}" relates through the multi-value field "${I}" but has no dataSource adapter — the raw-URL fallback's \`filter[<field>]=<value>\` grammar has no membership operator, so no rows are fetched. Pass a dataSource (RecordContext) to use a related list on a multi-value relationship field.`),H([]),he(null),_e(!1),ae(!1);else{let t=new URLSearchParams({[`filter[${I}]`]:String(L)}).toString();fetch(`${n}?${t}`).then(e=>e.json()).then(t=>{if(e)return;let n=Array.isArray(t)?t:t?.data||[];H(n),he(null),_e(!1)}).catch(e=>{console.error(`Failed to fetch related data:`,e)}).finally(()=>{e||ae(!1)})}}return()=>{e=!0}},[n,z,l,I,ct,L,ke,Ve,ze,He,Ue,We,Ge,Ye,tt,st,q]),$.useEffect(()=>{Ve&&!ie&&W>0&&V.length===0&&oe(e=>Math.max(0,e-1))},[Ve,ie,V,W]),$.useEffect(()=>{oe(0)},[n,I,L,Ye]),$.useEffect(()=>{if(!n||z)return;let e=e=>{let t=e.detail||{};t.objectName&&t.objectName!==`*`&&t.objectName!==n||Ae(e=>e+1)};return window.addEventListener(`objectui:related-changed`,e),()=>window.removeEventListener(`objectui:related-changed`,e)},[n,z]),$.useEffect(()=>{if(!l?.find||!be?.fields||!V.length)return;let e=be.fields,t=[];for(let[n,r]of Object.entries(e)){if(!le(r))continue;let e=r.reference;if(!e)continue;let i=new Set;for(let e of V){let t=e?.[n];t!=null&&(typeof t==`string`&&t?i.add(t):typeof t==`number`&&i.add(String(t)))}let a=je[n]||{},o=Array.from(i).filter(e=>!(e in a));o.length>0&&t.push({fieldName:n,target:e,ids:o})}if(t.length===0)return;let n=!1;return Promise.all(t.map(({fieldName:e,target:t,ids:n})=>Promise.all([l.find(t,{$filter:{id:{$in:n}},$top:n.length}),typeof l.getObjectSchema==`function`?l.getObjectSchema(t).catch(()=>void 0):Promise.resolve(void 0)]).then(([t,n])=>{let r=Array.isArray(t)?t:t?.data||[],i={};for(let e of r){let t=e?.id||e?._id;t&&(i[String(t)]=U_(e,n)??String(t))}return{fieldName:e,map:i}}).catch(t=>(console.warn(`[RelatedList] Failed to resolve lookups for ${e}:`,t),{fieldName:e,map:{}})))).then(e=>{n||Me(t=>{let n={...t};for(let{fieldName:t,map:r}of e)n[t]={...n[t]||{},...r};return n})}),()=>{n=!0}},[l,be,V]);let[_t,yt]=$.useState(null),bt=$.useCallback(e=>{yt(e)},[]),xt=$.useCallback(async()=>{if(_t)try{await g?.(_t),Ae(e=>e+1)}catch(e){console.error(`[RelatedList] remove failed`,e)}yt(null)},[_t,g]),St=$.useCallback(async e=>{if(!D||!l||!n||I==null||L==null)return;let t=D.picker.valueField||`id`;Ee(!0),Oe(null);try{for(let r of e||[]){let e=r?.[t]??r?.id;e!=null&&(D.linkField?await l.create?.(n,{[I]:L,[D.linkField]:e}):await l.update?.(D.picker.object,String(e),{[I]:L}))}Ae(e=>e+1)}catch(e){let t=e?.body?.error??e?.error??e?.message??String(e);Oe(typeof t==`string`?t:`Failed to add`)}finally{Ee(!1),we(!1)}},[D,l,n,I,L]),Ct=$.useMemo(()=>{let e=u||n||``,t=t=>Y_(t,Fe,e),r=e=>X_(e,I),i=e=>it.size>0&&!!e&&it.has(String(e)),o=e=>Z_(e,it),c=e=>tn(e)||typeof e==`string`&&e.trim()===``,l=e=>V.length?e.filter(e=>{let t=e?.accessorKey||at(e);return!t||V.some(e=>!c(e?.[t]))}):e,d=(e,t)=>{if(!t?.type)return;let n=Np(xp({type:t.type,format:t.format})||t.type);if(!n)return;let r=t.type===`lookup`||t.type===`master_detail`,i=le(t)?je[e]:void 0,a=r&&i&&Object.keys(i).length>0?Object.entries(i).map(([e,t])=>({value:e,label:t})):void 0,o=e=>{if(t.type!==`user`||!i||typeof e!=`string`&&typeof e!=`number`)return e;let n=i[String(e)];return n?{name:n}:e},s={name:e,label:t.label||e,type:t.type,...(a||t.options)&&{options:a||t.options},...t.currency&&{currency:t.currency},...t.precision!==void 0&&{precision:t.precision},...t.scale!==void 0&&{scale:t.scale},...t.useGrouping!==void 0&&{useGrouping:t.useGrouping},...t.max!==void 0&&{max:t.max},...t.format&&{format:t.format},...t.reference&&{reference:t.reference},...t.reference_field&&{reference_field:t.reference_field}};return e=>c(e)?$.createElement(Y):$.createElement(n,{value:o(e),field:s})},f=t=>{if(typeof t!=`string`){let e=t?.accessorKey||at(t);if(!t||!e)return t;let n={};if(t.accessorKey||(n.accessorKey=e),!t.header){let e=s(t);e&&(n.header=e)}if(!t.cell&&!t.render){let t=be?.fields?.[e],r=t?d(String(e),t):void 0;r&&(n.cell=r)}return Object.keys(n).length>0?{...t,...n}:t}let n=be?.fields?.[t],r={accessorKey:t,header:n?.label||Pe(e,t,n)||t,fieldDef:n,fieldType:n?.type},i=n?d(t,n):void 0;return i&&(r.cell=i),r};if(a&&a.length>0){let e=o(a.map(f));if(e.length>0)return l(t(r(e)))}if(!be?.fields)return[];let p=Array.isArray(be.highlightFields)?be.highlightFields.filter(e=>typeof e==`string`&&e.length>0):[];if(p.length>0){let e=l(t(r(o(p.map(f)))));if(e.length>0)return e.slice(0,Math.max(1,k))}let m=e,h=new Set([`richtext`,`markdown`,`html`,`json`]),g=[`name`,`full_name`,`fullname`,`title`,`subject`,`label`,`code`,`number`],_=Object.entries(be.fields).filter(([e,t])=>!(e.startsWith(`_`)||e===`id`||e===I||t?.hidden||t?.type&&h.has(t.type)||i(e)||Fe?.isLoaded&&m&&!Fe.checkField(m,e,`read`))),v=new Set([`created_at`,`updated_at`,`created_by`,`updated_by`,`owner_id`,`organization_id`]);return _.sort(([e,t],[n,r])=>{let i=v.has(e);if(i!==v.has(n))return i?1:-1;let a=g.indexOf(e),o=g.indexOf(n),s=a>=0?a:100,c=o>=0?o:100;if(s!==c)return s-c;let l=t?.type===`select`||e.includes(`status`);return l===(r?.type===`select`||n.includes(`status`))?0:l?-1:1}),l(_.map(([e,t])=>{let n={accessorKey:e,header:Pe(m,e,t.label||e)};if(t.type){let r=d(e,t);r&&(n.cell=r)}return n})).slice(0,Math.max(1,k))},[a,be,u,n,Pe,I,V,k,je,Fe,it]),wt=ii(be),Tt=$.useCallback((e,t)=>le(t)?!0:wt?!ai(wt,e):ti(t),[wt]),Et=$.useMemo(()=>Ve?Ct.map(e=>{let t=e.accessorKey||at(e),n=t?be?.fields?.[t]:void 0;return Tt(t,n)?{...e,sortable:!1}:e}):Ct,[Ct,Ve,be,Tt]),kt=!!n&&typeof l?.getObjectSchema==`function`&&!be?.fields,At=$.useMemo(()=>{let e=Et.map(e=>{if(!e||typeof e!=`object`)return e;let t=e.accessorKey||at(e),n=t?be?.fields?.[t]:void 0,r=kt||Lg(e.type,n?.type);return kt&&typeof e.cell!=`function`?{...e,masked:!0,cell:K_}:r&&e.masked!==!0?{...e,masked:!0}:e});return e.every((e,t)=>e===Et[t])?Et:e},[Et,be,kt]),jt=$.useMemo(()=>JSON.stringify(At.flatMap(e=>{if(!e||typeof e!=`object`||e.masked===!0)return[];let t=q_(e);return t?[t]:[]})),[At]),Mt=J_(jt),Nt=$.useMemo(()=>{if(Ve||!de)return V;let e=de.toLowerCase(),t=J_(jt);return V.filter(n=>t.some(t=>{let r=n?.[t];return r!=null&&String(r).toLowerCase().includes(e)}))},[V,de,Ve,jt]),Ft=$.useMemo(()=>{if(Ve||!G||!J_(jt).includes(G))return Nt;let e=je[G],t=Nt.map(t=>({row:t,key:fe(t[G],{labels:e})}));return t.sort((e,t)=>{let n=R(e.key,t.key);return ce===`asc`?n:-n}),t.map(e=>e.row)},[Nt,G,ce,Ve,je,jt]),It=ze&&!Ve?Ft.slice(W*ze,(W+1)*ze):Ft,Lt=ze?Ve?me==null?W+(ge?2:1):Math.max(1,Math.ceil(me/ze)):Math.max(1,Math.ceil(Ft.length/ze)):1,Rt=Ve?me==null?ge:(W+1)*ze<me:W<Lt-1,zt=ze>0&&(Ve?W>0||Rt:Ft.length>ze);$.useEffect(()=>{oe(0)},[de,G,ce]);let Bt=$.useCallback(e=>{J_(jt).includes(e)&&(oe(0),G===e?ue(e=>e===`asc`?`desc`:`asc`):(K(e),ue(`asc`)))},[G,jt]),Vt=$.useMemo(()=>G?[{field:G,order:ce}]:Ke,[G,ce,Ke]),Ut=$.useCallback(e=>{let t=e[0];t&&J_(jt).includes(t.field)&&(oe(0),K(t.field),ue(t.order))},[jt]),Wt=!i&&(t===`grid`||t===`table`),Gt=Array.isArray(x)&&x.length>0,qt=!!h||!!g||Gt,Jt=M(),Yt=$.useMemo(()=>{if(i)return i;if(Jt&&(t===`grid`||t===`table`)){let e=Ct[0]?.accessorKey||at(Ct[0]),t=Ct.slice(1,4).map(e=>e.accessorKey||at(e)).filter(Boolean);return{type:`object-gallery`,data:It,objectName:n,gallery:{titleField:e||`name`,visibleFields:t,coverField:G_,cardSize:`medium`},onRowClick:v}}let e=Yr(be?.userActions?.edit),r=Yr(be?.userActions?.delete);switch(t){case`grid`:case`table`:return{type:`data-table`,data:It,columns:At,pagination:!1,pageSize:ze||10,searchable:!1,exportable:!1,manualSorting:!0,sort:Vt,onSortChange:Ut,rowActions:qt,onRowEdit:h,onRowDelete:g?bt:void 0,rowEditPredicates:e,rowDeletePredicates:r,onRowClick:v,rowActionDefs:Gt?x:void 0,onRowActionDef:Gt?w:void 0};case`list`:return{type:`data-list`,data:It};default:return{type:`div`,children:`No view configured`}}},[t,It,At,Ct,i,ze,qt,Gt,x,w,h,g,bt,v,Jt,n,be,Vt,Ut]),Xt=F?`cursor-pointer select-none`:void 0,Zt=F?()=>Se(e=>!e):void 0,Qt=H_(re),$t=Ve&&me!=null?me:V.length,en=!ie&&V.length===0&&(!Ve||W===0),nn=P;return Qe?(0,Q.jsxs)(rt,{className:U(`shadow-none border-border/60 bg-transparent`,c),children:[(0,Q.jsx)(Pt,{className:`py-3 px-4 sm:py-3 min-h-12 sm:min-h-0`,children:(0,Q.jsxs)(vt,{className:`flex items-center gap-2 text-sm font-semibold`,children:[(0,Q.jsx)(Qt,{className:`h-4 w-4 text-muted-foreground shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`truncate`,children:e})]})}),(0,Q.jsx)(ut,{className:`pt-0 pb-4 px-4`,children:(0,Q.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-amber-300 bg-amber-50 p-3 text-sm text-amber-800`,"data-testid":`related-list-malformed-filter`,children:[(0,Q.jsx)(`p`,{className:`font-medium`,"data-testid":`related-list-malformed-filter-subject`,children:Ne(`view.malformedFilter`,{subject:on(Qe)??``})}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs opacity-80`,children:Qe.message})]})})]}):(0,Q.jsxs)(rt,{className:U(`shadow-none border-border/60 bg-transparent`,en&&`bg-muted/10`,c),children:[(0,Q.jsx)(Pt,{className:U(`py-3 px-4 sm:py-3 min-h-12 sm:min-h-0`,Xt),onClick:Zt,children:(0,Q.jsxs)(vt,{className:`flex items-center justify-between gap-2 text-sm font-semibold`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[F&&(xe?(0,Q.jsx)($n,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}):(0,Q.jsx)(Zn,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`})),(0,Q.jsx)(Qt,{className:`h-4 w-4 text-muted-foreground shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:U(`truncate`,en&&`text-muted-foreground font-medium`),children:e}),(0,Q.jsx)(mt,{variant:`secondary`,className:U(`text-xs font-normal h-5 px-1.5`,$t===0&&`bg-muted text-muted-foreground`),"aria-label":`${$t} records`,children:$t}),en&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground/70 italic ml-1 truncate`,children:Ne(`detail.noRelatedRecords`)})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[E&&Re.map(e=>(0,Q.jsx)(Q_,{action:e,onToolbarAction:E},e.name)),D&&dt&&l&&(0,Q.jsxs)(J,{variant:en?`ghost`:`outline`,size:`sm`,disabled:Te,onClick:e=>{e.stopPropagation(),Oe(null),we(!0)},className:`gap-1 h-9 sm:h-7 text-xs shadow-none`,children:[(0,Q.jsx)(hr,{className:`h-3.5 w-3.5`}),D.label||Ne(`detail.add`,{defaultValue:`Add`})]}),f&&(0,Q.jsxs)(J,{variant:en?`ghost`:`outline`,size:`sm`,disabled:p,"data-testid":`related-list-new`,onClick:e=>{e.stopPropagation(),f()},className:`gap-1 h-9 sm:h-7 text-xs shadow-none`,children:[(0,Q.jsx)(hr,{className:`h-3.5 w-3.5`}),Ne(`detail.new`)]})]})]})}),!xe&&!en&&(0,Q.jsxs)(ut,{className:U(`pt-0 pb-4 px-4`),children:[nn&&(0,Q.jsx)(`div`,{className:`mb-3`,children:(0,Q.jsx)(o,{placeholder:Ne(`detail.filterPlaceholder`),value:de,onChange:e=>pe(e.target.value),className:`h-8 text-sm`})}),ee&&!Wt&&Ct&&Ct.length>0&&V.length>0&&(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-3`,children:Ct.map(e=>{let t=e.accessorKey||at(e);if(!t)return null;let n=be?.fields?.[t];if(Ve&&Tt(t,n)||!Mt.includes(t))return null;let r=e.header||e.label||t,i=G===t;return(0,Q.jsxs)(J,{variant:i?`secondary`:`ghost`,size:`sm`,className:`gap-1 h-7 text-xs`,onClick:()=>Bt(t),children:[(0,Q.jsx)(Gn,{className:`h-3 w-3`}),r,i&&(ce===`asc`?` ↑`:` ↓`)]},t)})}),ie&&V.length===0?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-6 text-muted-foreground text-sm`,children:Ne(`detail.loading`)}):(0,Q.jsx)(`div`,{className:U(ie&&`opacity-60 pointer-events-none transition-opacity`),children:(0,Q.jsx)(Ht,{schema:Yt})}),zt&&(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mt-3 pt-3 border-t`,children:[(0,Q.jsxs)(J,{variant:`outline`,size:`sm`,className:`h-7 text-xs gap-1`,disabled:W===0,onClick:()=>oe(e=>Math.max(0,e-1)),children:[(0,Q.jsx)(Qn,{className:`h-3 w-3`}),Ne(`detail.previousPage`)]}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ne(`detail.pageOf`,{current:W+1,total:Lt})}),(0,Q.jsxs)(J,{variant:`outline`,size:`sm`,className:`h-7 text-xs gap-1`,disabled:!Rt,onClick:()=>oe(e=>Rt?e+1:e),children:[Ne(`detail.nextPage`),(0,Q.jsx)($n,{className:`h-3 w-3`})]})]}),m&&!en&&zt&&(0,Q.jsx)(`div`,{className:`mt-3 pt-3 border-t flex justify-center`,children:(0,Q.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),m()},className:`text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors`,children:[Ne(`detail.viewAll`),(0,Q.jsx)(io,{className:`h-3 w-3`})]})})]}),(0,Q.jsx)(_,{open:_t!==null,onOpenChange:e=>{e||yt(null)},children:(0,Q.jsxs)(C,{children:[(0,Q.jsxs)(Dt,{children:[(0,Q.jsx)(d,{children:Ne(`detail.deleteRowTitle`,{defaultValue:`Delete record`})}),(0,Q.jsx)(b,{children:Ne(`detail.deleteRowConfirmation`)})]}),(0,Q.jsxs)(se,{children:[(0,Q.jsx)(ye,{children:Ne(`detail.cancel`,{defaultValue:`Cancel`})}),(0,Q.jsx)(mn,{onClick:xt,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:Ne(`detail.delete`,{defaultValue:`Delete`})})]})]})}),De&&(0,Q.jsx)(`div`,{className:`mx-4 mb-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,role:`alert`,children:De}),D&&dt&&l&&(0,Q.jsx)(cl,{open:Ce,onOpenChange:e=>we(e),multiple:!0,dataSource:l,objectName:dt,title:D.label||Ne(`detail.add`,{defaultValue:`Add`}),displayField:ht,columns:gt,cellRenderer:Np,fieldsMeta:ft?.fields,baseFilter:D.picker.filter,onSelect:()=>{},onSelectRecords:e=>{St(e)}})]})};function ev(e,t){if(!e||!t)return null;let n=e.fields?.[t]?.options;return!Array.isArray(n)||n.length===0?null:n.map(e=>({value:e.value,label:e.label}))}function tv(e){if(!e)return null;let t=Be(e);if(!t)return null;let n=e.fields||{},r=e=>{let t=n[e]||{};return{name:e,label:t.label||e,type:t.type||`text`,...t.options?{options:t.options}:{},...t.reference?{reference:t.reference}:{},...t.reference_field?{reference_field:t.reference_field}:{},...t.currency?{currency:t.currency}:{},...t.currencyConfig?{currencyConfig:t.currencyConfig}:{}}},i=Kp(t.reduce((e,t)=>e+t.fields.length,0));return t.map(e=>({...e.key===void 0?{}:{name:e.key,label:e.label??e.key},...e.icon?{icon:e.icon}:{},...e.description?{description:e.description}:{},...e.collapse===`none`?{}:{collapsible:!0},...e.collapse===`collapsed`?{defaultCollapsed:!0}:{},columns:i,fields:e.fields.map(r)}))}function nv(e,t){return!e||t?.label===void 0?null:`[ObjectUI] ${e} accessible name: \`aria.label\` is not read. The spec's AriaPropsSchema refuses that spelling (it is the alias of \`aria.ariaLabel\`), so this block announces its \`aria.ariaLabel\` when one is declared and its default name otherwise. Declare the name as \`aria.ariaLabel\`.`}function rv(e,t){let n=nv(e,t);(0,$.useEffect)(()=>{n&&console.warn(n)},[n])}function iv(e,{defaultRole:t,defaultLabel:n,block:r}={}){let i=zn();rv(r,e);let a=m(e,i),o=a[`aria-label`]||n,s=a[`aria-describedby`],c=a.role||t||(o||s?`region`:void 0);return{...o?{"aria-label":o}:{},...s?{"aria-describedby":s}:{},...c?{role:c}:{}}}var av=e=>at(e)??null;function ov(e){return e===void 0?void 0:Number(e)}var sv=e=>{let{"data-obj-id":t,"data-obj-type":n,style:r,...i}=e||{};return{designer:{"data-obj-id":t,"data-obj-type":n,style:r},rest:i}},cv=new Set;function lv(e,t){let n=`${e}.${t}`;cv.has(n)||(cv.add(n),console.error(`[record:details] section group "${t}" is not declared in fieldGroups on object "${e}" — the section renders nothing. Declare the group on the object, or enumerate \`fields\` on the section. (\`@objectstack/lint\` reports this as \`page-section-group-unknown\`.)`))}var uv=({schema:e={},className:t,...n})=>{let r=ft(),{designer:i}=sv(n),a=iv(e.aria),o=r?.objectName||``,s=ws(),{readableFields:c}=Ts(o),{sectionLabel:l}=Ze(),{language:u}=In(),d=gt();if(!r)return(0,Q.jsx)(`div`,{className:t,"data-record-details-placeholder":!0,...i,children:(0,Q.jsx)(`div`,{className:`text-xs text-muted-foreground italic px-3 py-2 border border-dashed rounded`,children:`record:details — bind a record to preview`})});let f=Array.isArray(e.requiredPermissions)?e.requiredPermissions:[];if(f.length>0&&!s.hasCapabilities(f))return(0,Q.jsx)(`div`,{className:t,...i,role:`status`,"aria-live":`polite`,children:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground italic`,children:`Insufficient permissions to view details.`})});let m=e.enforceFieldSecurity===!0,h=Array.isArray(e.redactFields)?e.redactFields:[],g=e=>{if(!e||!m&&h.length===0)return e;let t=e.map(av).filter(e=>!!e),n=new Set((m&&o?c(t):t).filter(e=>!h.includes(e)));return e.filter(e=>{let t=av(e);return t?n.has(t):!1})},_=r.objectSchema,v=_?.fields,y=e=>{if(!e||typeof e!=`object`||typeof e.name!=`string`||e.label!==void 0)return e;let t=v?.[e.name]?.label;if(t==null)return e;let n=Rn(t,u);return n?{...e,label:n}:e},b=e=>typeof e==`string`?y({name:e}):e&&typeof e==`object`&&!e.name&&e.field?y({...e,name:e.field}):y(e),x=e=>Array.isArray(e)?e.map(b):e,S=new Set((Array.isArray(e.hideFields)?e.hideFields:[]).map(e=>typeof e==`string`?e:av(e)).filter(e=>!!e));for(let e of d)S.add(e);let C=sa(r.data??{},s,o),w=[De(_),p(_),`name`,`full_name`,`title`,`subject`,`display_name`,`label`].filter(e=>typeof e==`string`&&e.length>0),T=wn(_);if(xe(C,T)!==void 0)S.add(T);else{let e=_?.titleFormat,t=we(e,C);if(t){let n=e=>xe(C,e)===t,r=w.find(n)??Object.keys(C).find(r=>n(r)&&we(e,{...C,[r]:void 0})!==t);r&&S.add(r)}else for(let e of w)if(xe(C,e)!==void 0){S.add(e);break}}let E=e=>!e||S.size===0?e:e.filter(e=>{let t=av(e);return!t||!S.has(t)}),D=E(x(g(e.fields))),O=Array.isArray(e.sections)?e.sections:[],k=new Map;if(O.some(e=>e&&typeof e==`object`&&typeof e.group==`string`))for(let e of tv(_)??[])typeof e.name==`string`&&k.set(e.name,e);let A=Array.isArray(e.sections)?e.sections.map(e=>{if(!e||typeof e!=`object`||typeof e.group!=`string`)return e;let t=k.get(e.group);if(!t)return lv(o,e.group),null;let{group:n,...r}=e;return{...t,...r}}).filter(e=>e!=null).map(e=>{let t=e.label,n=t==null?void 0:Rn(t,u),r=e.name&&o?l(o,e.name,n??e.name):n;return{...e,title:r,showBorder:e.showBorder??!!r,hideEmpty:e.hideEmpty??!0,fields:E(x(g(e.fields)))}}):e.sections,j=Qr(_,s?.getObjectApiOperations?.(o)),M=(e.inlineEdit??!0)&&j,ee={type:`detail-view`,objectName:r.objectName,resourceId:r.recordId,data:r.data,layout:`vertical`,columns:ov(e.columns),sections:A,fields:D,showBack:!1,showHeader:e.showHeader??!1,inlineEdit:M};return(0,Q.jsx)(`div`,{className:t,...i,...a,children:(0,Q.jsx)(z_,{schema:ee,dataSource:r.dataSource,inlineEdit:M})})},dv=e=>({toolbar:[],row:[],refused:e});function fv(e){if(!Array.isArray(e))return!1;let t=I(e,void 0);return t.kind===`ids`&&t.ids.length>0}function pv(e,t){if(!Array.isArray(e))return dv([{kind:`array`,message:"`actions` is not an array; it is a list of action ids"}]);let n=I(e,t);if(n.kind===`refused`)return dv([{kind:`array`,message:`${n.message} (on this block: action ids only)`}]);if(n.kind===`objects`)return e.length===0?dv([]):dv([{kind:`array`,message:"`actions` holds inline action objects; it is a list of action ids, each the `name` of an action declared on the related object's own `actions`"}]);let r=[],i=[],a=n.unresolved.map(({id:e})=>({kind:`unresolved`,id:e})),o=new Set;for(let e of n.actions){if(o.has(e.name))continue;o.add(e.name);let t={locations:Array.isArray(e.locations)?e.locations:void 0},n=D(t,`list_toolbar`),s=D(t,`list_item`)||D(t,`record_related`);n&&r.push(e),s&&i.push(e),!n&&!s&&a.push({kind:`unplaced`,id:String(e.name)})}return{toolbar:r,row:i,refused:a}}function mv(e,t,n){return`record:related_list — actions refused: ${e.map(e=>e.kind===`array`?e.message:e.kind===`unplaced`?`"${e.id}" declares none of list_toolbar (header), list_item (row menu) or record_related (row menu inside a record) in its locations, so this list has nowhere to draw it`:n?`"${e.id}" is not an action of "${t}"`:`"${e.id}" could not be resolved: no metadata for "${t}" was found`).join(`; `)}.`}var hv=e=>at(e)||(e&&typeof e==`object`?e.key:null)||null;function gv(e,t){let n=null;for(let r=0;r<e.length;r++){let i=e[r],a=i&&typeof i==`object`?i.label:void 0;typeof a==`object`&&a&&(n??=[...e],n[r]={...i,label:Rn(a,t)})}return n??e}var _v=e=>e?.id??e?._id??null,vv=5,yv=e=>{let{"data-obj-id":t,"data-obj-type":n,style:r,...i}=e||{};return{designer:{"data-obj-id":t,"data-obj-type":n,style:r},rest:i}},bv=({schema:e={},className:t,...n})=>{let r=ft(),{designer:i}=yv(n),a=iv(e.aria),o=Ze(),{language:s}=In(),c=e.objectName,l=c&&o.objectLabel?o.objectLabel({name:c,label:_a(c)}):c?_a(c):``,u=Rn(e.title,s)||l||`Related`,d=ws(),{readableFields:f}=Ts(c||``),p=e.relationshipValueField||`id`,m=p===`id`?r?.recordId??null:r?.data?.[p]??null,h=Zt(),g=$.useMemo(()=>c?h?.resolve({objectName:c,relationshipField:e.relationshipField,parentId:m})??null:null,[h,c,e.relationshipField,m]),_=e.actions,v=_!==void 0,y=!!c&&fv(_),{item:b,loading:x}=en(`object`,y?c:null),S=Pe(),C=$.useMemo(()=>{if(!v)return null;if(y&&x)return{toolbar:[],row:[],refused:[]};let e=Array.isArray(b?.actions)?b.actions:[],t=pv(_,e),n=e=>S(c||void 0,e);return{toolbar:t.toolbar.map(n),row:t.row.map(n),refused:t.refused}},[v,_,y,b,x,c,S]);if(!c)return(0,Q.jsx)(`div`,{className:t,...i,children:(0,Q.jsx)(`div`,{className:`text-xs text-muted-foreground italic px-3 py-2 border border-dashed rounded`,children:`record:related_list — missing objectName`})});if(d.isLoaded&&!d.can(c,`read`))return null;let w=Array.isArray(e.requiredPermissions)?e.requiredPermissions:[];if(w.length>0&&!d.hasCapabilities(w))return(0,Q.jsx)(`div`,{className:t,...i,role:`status`,"aria-live":`polite`,children:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground italic`,children:`Insufficient permissions to view related list.`})});let T=e.enforceFieldSecurity===!0,E=Array.isArray(e.redactFields)?e.redactFields:[],D=Array.isArray(e.columns)?e.columns:[],O=D;if(T||E.length>0){let e=D.map(hv).filter(e=>!!e),t=new Set((T?f(e):e).filter(e=>!E.includes(e)));O=D.filter(e=>{let n=hv(e);return n?t.has(n):!1})}let k=C?g?.onToolbarAction&&C.toolbar.length>0?C.toolbar:void 0:g?.toolbarActions,A=C?g?.onRowAction&&C.row.length>0?C.row:void 0:g?.rowActions,j=C?.refused??[];return(0,Q.jsxs)(`div`,{className:t,...i,...a,children:[j.length>0&&(0,Q.jsx)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":`record-related-list-actions-refused`,className:`mb-2 text-xs text-muted-foreground italic px-3 py-2 border border-dashed rounded`,children:mv(j,c,!!b)}),(0,Q.jsx)($_,{title:u,type:`table`,api:c,objectName:c,referenceField:e.relationshipField,parentId:m,columns:gv(O,s),redactFields:E.length>0?E:void 0,pageSize:typeof e.limit==`number`&&e.limit>0?e.limit:vv,defaultSort:e.sort,filter:e.filter,dataSource:r?.dataSource,add:e.add?{...e.add,label:Rn(e.add.label,s)||void 0}:void 0,rowActions:A,onRowAction:g?.onRowAction,toolbarActions:k,onToolbarAction:g?.onToolbarAction,onNew:g?.onCreate,newDisabled:g?.createDisabled,onRowClick:g?.onView?e=>{let t=_v(e);t!=null&&g.onView(t,e)}:void 0,onRowEdit:g?.onEdit?e=>{let t=_v(e);t!=null&&g.onEdit(t,e)}:void 0,onRowDelete:g?.onDelete?e=>{let t=_v(e);if(t!=null)return g.onDelete(t,e)}:e.add&&r?.dataSource?async e=>{let t=e?.id??e?._id;t!=null&&await r?.dataSource?.delete?.(c,String(t))}:void 0})]})},xv={columns:!0,filter:!0,sort:!0,limit:`limit`},Sv={},Cv=Qe(e=>{let t=ft();return(0,Q.jsx)(Te,{schema:e.schema??Sv,mapping:xv,dataSource:t?.dataSource,testId:`record-related-list`,errorTitle:`This related list’s data source could not be resolved`,children:t=>(0,Q.jsx)(bv,{...e,schema:t})})}),wv=e=>{let{"data-obj-id":t,"data-obj-type":n,style:r,...i}=e||{};return{designer:{"data-obj-id":t,"data-obj-type":n,style:r},rest:i}},Tv=({schema:e={},className:t,...n})=>{let r=ft(),{designer:i}=wv(n),a=iv(e.aria),o=r?.objectName||``,s=ws(),{readableFields:c}=Ts(o),l=Array.isArray(e.requiredPermissions)?e.requiredPermissions:[],u=l.length===0||s.hasCapabilities(l),d=(Array.isArray(e.fields)?e.fields:[]).map(e=>typeof e==`string`?{name:e}:{name:e?.name,label:e?.label,type:e?.type,readonly:e?.readonly===!0}).filter(e=>typeof e.name==`string`&&e.name.length>0),f=e.enforceFieldSecurity===!0,p=Array.isArray(e.redactFields)?e.redactFields:[],m=f&&o?new Set(c(d.map(e=>e.name))):null,h=d.filter(e=>!(p.includes(e.name)||m&&!m.has(e.name))),g=$.useId();return ze(g,u?h.map(e=>e.name):[]),u?(0,Q.jsx)(`div`,{className:t,...i,...a,children:(0,Q.jsx)(t_,{fields:h,data:r?.data,objectName:r?.objectName,objectSchema:r?.objectSchema,dataSource:r?.dataSource})}):(0,Q.jsx)(`div`,{className:t,...i,role:`status`,"aria-live":`polite`,children:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground italic`,children:`Insufficient permissions to view highlights.`})})},Ev=({change:e,className:t})=>{let n=e.fieldLabel??e.field.charAt(0).toUpperCase()+e.field.slice(1).replace(/_/g,` `),r=e.oldDisplayValue??(e.oldValue==null?`(empty)`:String(e.oldValue)),i=e.newDisplayValue??(e.newValue==null?`(empty)`:String(e.newValue));return(0,Q.jsxs)(`div`,{className:U(`flex items-center gap-1.5 text-sm flex-wrap`,t),children:[(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:n}),(0,Q.jsx)(`span`,{className:`text-muted-foreground line-through`,children:r}),(0,Q.jsx)(Wn,{className:`h-3 w-3 text-muted-foreground shrink-0`}),(0,Q.jsx)(`span`,{className:`text-foreground`,children:i})]})},Dv=[`👍`,`❤️`,`🎉`,`😂`,`😮`,`😢`],Ov=({reactions:e,onToggleReaction:t,emojiOptions:n=Dv,className:r})=>{let[i,a]=$.useState(!1),{t:o}=Yp(),s=$.useCallback(e=>{t?.(e),a(!1)},[t]);return(0,Q.jsxs)(`div`,{className:U(`flex items-center gap-1 flex-wrap`,r),children:[e.map(e=>{let n=o(`detail.reactionCount`,{emoji:e.emoji,count:e.count});return(0,Q.jsxs)(`button`,{type:`button`,className:U(`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs border transition-colors`,e.reacted?`bg-primary/10 border-primary/30 text-primary`:`bg-muted border-border text-muted-foreground hover:bg-muted/80`),onClick:()=>s(e.emoji),disabled:!t,"aria-label":n,children:[(0,Q.jsx)(`span`,{children:e.emoji}),(0,Q.jsx)(`span`,{children:e.count})]},e.emoji)}),t&&(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:()=>a(!i),"aria-label":o(`detail.addReaction`),children:(0,Q.jsx)(so,{className:`h-3.5 w-3.5`})}),i&&(0,Q.jsx)(`div`,{className:`absolute bottom-full mb-1 left-0 bg-popover border rounded-md shadow-md z-50 p-1.5 flex gap-1`,role:`listbox`,"aria-label":o(`detail.emojiPicker`),children:n.map(t=>(0,Q.jsx)(`button`,{type:`button`,className:`hover:bg-accent rounded p-1 text-base transition-colors`,onClick:()=>s(t),role:`option`,"aria-selected":e.some(e=>e.emoji===t&&e.reacted),children:t},t))})]})]})};function kv(e,t,n){try{let r=new Date(e),i=new Date().getTime()-r.getTime(),a=Math.floor(i/6e4);if(a<1)return t(`detail.justNow`);if(a<60)return t(`detail.minutesAgo`,{count:a});let o=Math.floor(a/60);if(o<24)return t(`detail.hoursAgo`,{count:o});let s=Math.floor(o/24);return s<7?t(`detail.daysAgo`,{count:s}):r.toLocaleDateString(n)}catch{return e}}var Av=({parentItem:e,replies:t,onAddReply:n,showReplyInput:r=!0,className:i})=>{let{t:a}=Yp(),o=zn(),[s,c]=$.useState(!1),[l,u]=$.useState(``),[d,f]=$.useState(!1),p=$.useCallback(async()=>{let t=l.trim();if(t&&n){f(!0);try{await n(e.id,t),u(``)}catch{}finally{f(!1)}}},[l,n,e.id]),m=$.useCallback(e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),p())},[p]);return t.length===0&&!r?null:(0,Q.jsxs)(`div`,{className:U(`ml-10 mt-1`,i),children:[t.length>0&&(0,Q.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors mb-1`,onClick:()=>c(!s),"aria-expanded":s,children:[s?(0,Q.jsx)(Zn,{className:`h-3 w-3`}):(0,Q.jsx)($n,{className:`h-3 w-3`}),(0,Q.jsx)(Mo,{className:`h-3 w-3`}),(0,Q.jsx)(`span`,{children:a(`detail.replyCount`,{count:t.length})})]}),s&&(0,Q.jsx)(`div`,{className:`space-y-2 border-l-2 border-border pl-3`,children:t.map(e=>(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`div`,{className:`shrink-0`,children:e.actorAvatarUrl?(0,Q.jsx)(`img`,{src:e.actorAvatarUrl,alt:e.actor,className:`h-6 w-6 rounded-full object-cover`}):(0,Q.jsx)(`div`,{className:`h-6 w-6 rounded-full bg-muted flex items-center justify-center text-[10px] font-medium text-muted-foreground`,children:e.actor.charAt(0).toUpperCase()})}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium`,children:e.actor}),(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:kv(e.createdAt,a,o)})]}),(0,Q.jsx)(`p`,{className:`text-xs whitespace-pre-wrap break-words`,children:e.body})]})]},e.id))}),r&&n&&(0,Q.jsxs)(`div`,{className:`flex gap-1.5 mt-1.5`,children:[(0,Q.jsx)(`input`,{className:`flex-1 rounded-md border border-input bg-background px-2 py-1 text-xs placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,placeholder:a(`detail.replyPlaceholder`),value:l,onChange:e=>u(e.target.value),onKeyDown:m,disabled:d}),(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-6 w-6 shrink-0`,onClick:p,disabled:!l.trim()||d,"aria-label":`Send reply`,children:(0,Q.jsx)(ns,{className:`h-3 w-3`})})]})]})},jv=({subscription:e,onToggle:t,className:n})=>{let{t:r}=Yp(),[i,a]=$.useState(!1),o=$.useCallback(async()=>{if(t){a(!0);try{await t(!e.subscribed)}finally{a(!1)}}},[t,e.subscribed]);return(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:U(`h-8 w-8`,n),onClick:o,disabled:i||!t,"aria-label":e.subscribed?r(`detail.unsubscribeAriaLabel`):r(`detail.subscribeAriaLabel`),title:e.subscribed?r(`detail.subscribedTooltip`):r(`detail.unsubscribedTooltip`),children:e.subscribed?(0,Q.jsx)(Ba,{className:`h-4 w-4 text-primary`}):(0,Q.jsx)(La,{className:`h-4 w-4 text-muted-foreground`})})};function Mv(e){let t=e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/```([\s\S]*?)```/g,`<pre class="bg-muted rounded p-2 text-xs font-mono my-1 overflow-x-auto">$1</pre>`).replace(/`([^`]+)`/g,`<code class="bg-muted rounded px-1 py-0.5 text-xs font-mono">$1</code>`).replace(/\*\*(.+?)\*\*/g,`<strong>$1</strong>`).replace(/\*(.+?)\*/g,`<em>$1</em>`).replace(/@(\w+)/g,`<span class="text-primary font-medium">@$1</span>`).replace(/^- (.+)$/gm,`<li class="ml-4 list-disc">$1</li>`).replace(/\n/g,`<br/>`);return t=t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g,e=>`<ul class="my-1">${e.replace(/<br\/>/g,``)}</ul>`),t}var Nv=({value:e,onChange:t,onSubmit:n,mentionSuggestions:r=[],placeholder:i,className:a,disabled:o=!1,extraSlot:s,canSubmitEmpty:c=!1})=>{let{t:l}=Yp(),[u,d]=$.useState(!1),[f,p]=$.useState(!1),[m,h]=$.useState(``),[g,_]=$.useState(0),v=$.useRef(null),y=$.useMemo(()=>{if(!m)return r;let e=m.toLowerCase();return r.filter(t=>t.label.toLowerCase().includes(e))},[m,r]),b=$.useCallback((n,r=``)=>{let i=v.current;if(!i)return;let a=i.selectionStart,o=i.selectionEnd,s=e.slice(a,o);t(e.slice(0,a)+n+s+r+e.slice(o)),requestAnimationFrame(()=>{i.focus();let e=a+n.length+s.length;i.setSelectionRange(e,e)})},[e,t]),x=$.useCallback(()=>b(`**`,`**`),[b]),S=$.useCallback(()=>b(`*`,`*`),[b]),C=$.useCallback(()=>b(`
|
|
21
|
-
- `,``),[b]),w=$.useCallback(()=>b("`","`"),[b]),T=$.useCallback(()=>{b(`@`,``),p(!0),h(``),_(0)},[b]),E=$.useCallback(n=>{let r=v.current;if(!r)return;let i=r.selectionStart,a=e.slice(0,i).lastIndexOf(`@`);a!==-1&&t(e.slice(0,a)+`@${n.label} `+e.slice(i)),p(!1),h(``),requestAnimationFrame(()=>r.focus())},[e,t]),D=$.useCallback(e=>{let n=e.target.value;t(n);let r=e.target.selectionStart,i=n.slice(0,r),a=i.lastIndexOf(`@`);if(a!==-1){let e=i.slice(a+1),t=a>0?i[a-1]:` `;if(/\s/.test(t)&&!/\s/.test(e)){p(!0),h(e),_(0);return}}p(!1)},[t]),O=$.useCallback(e=>{if(f&&y.length>0){if(e.key===`ArrowDown`){e.preventDefault(),_(e=>e<y.length-1?e+1:0);return}if(e.key===`ArrowUp`){e.preventDefault(),_(e=>e>0?e-1:y.length-1);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),E(y[g]);return}if(e.key===`Escape`){p(!1);return}}e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),n?.())},[f,y,g,E,n]);return(0,Q.jsxs)(`div`,{className:U(`border rounded-md`,a),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-0.5 px-2 py-1.5 border-b bg-muted/30`,children:[(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:x,disabled:o||u,title:l(`detail.bold`),children:(0,Q.jsx)(Ua,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:S,disabled:o||u,title:l(`detail.italic`),children:(0,Q.jsx)(_o,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:C,disabled:o||u,title:l(`detail.listFormat`),children:(0,Q.jsx)(bo,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:w,disabled:o||u,title:l(`detail.inlineCode`),children:(0,Q.jsx)(to,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:T,disabled:o||u,title:l(`detail.mentionSomeone`),children:(0,Q.jsx)(ja,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`div`,{className:`flex-1`}),(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>d(!u),title:l(u?`detail.edit`:`detail.preview`),children:u?(0,Q.jsx)(br,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(sr,{className:`h-3.5 w-3.5`})}),n&&(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:n,disabled:o||!c&&!e.trim(),title:l(`detail.submitComment`),children:(0,Q.jsx)(ns,{className:`h-3.5 w-3.5`})})]}),(0,Q.jsx)(`div`,{className:`relative`,children:u?(0,Q.jsx)(`div`,{className:`min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none`,dangerouslySetInnerHTML:{__html:Mv(e)}}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{ref:v,className:`w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground`,placeholder:i??l(`detail.writeComment`),value:e,onChange:D,onKeyDown:O,disabled:o}),f&&y.length>0&&(0,Q.jsx)(`div`,{className:`absolute left-2 bottom-full mb-1 w-56 bg-popover border rounded-md shadow-md z-50 max-h-40 overflow-y-auto`,children:y.map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,className:U(`w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors`,t===g&&`bg-accent`),onMouseDown:t=>{t.preventDefault(),E(e)},children:[e.avatarUrl?(0,Q.jsx)(`img`,{src:e.avatarUrl,alt:e.label,className:`h-5 w-5 rounded-full object-cover`}):(0,Q.jsx)(`div`,{className:`h-5 w-5 rounded-full bg-muted flex items-center justify-center text-[10px] font-medium`,children:e.label.charAt(0).toUpperCase()}),(0,Q.jsx)(`span`,{children:e.label})]},e.id))})]})}),s&&(0,Q.jsx)(`div`,{className:`border-t px-2 py-2 bg-muted/20`,children:s})]})};function Pv(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function Fv(e){return e.startsWith(`image/`)}function Iv(e){return Fv(e)?ur:e.includes(`pdf`)||e.includes(`document`)||e.includes(`text`)?mo:e.includes(`zip`)||e.includes(`archive`)||e.includes(`compressed`)?uo:cr}var Lv=({attachments:e,onUpload:t,onRemove:n,className:r,readOnly:i=!1})=>{let{t:a}=Yp(),[o,s]=$.useState(!1),c=$.useRef(null),l=$.useCallback(e=>{e.preventDefault(),e.stopPropagation(),s(!0)},[]),u=$.useCallback(e=>{e.preventDefault(),e.stopPropagation(),s(!1)},[]),d=$.useCallback(e=>{e.preventDefault(),e.stopPropagation(),s(!1),t&&e.dataTransfer.files.length>0&&t(e.dataTransfer.files)},[t]),f=$.useCallback(e=>{t&&e.target.files&&e.target.files.length>0&&(t(e.target.files),e.target.value=``)},[t]);return(0,Q.jsxs)(`div`,{className:U(`space-y-2`,r),children:[t&&!i&&(0,Q.jsxs)(`div`,{className:U(`border-2 border-dashed rounded-md px-4 py-3 text-center transition-colors cursor-pointer`,o?`border-primary bg-primary/5`:`border-muted-foreground/25 hover:border-muted-foreground/40`),onDragOver:l,onDragLeave:u,onDrop:d,onClick:()=>c.current?.click(),role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c.current?.click())},children:[(0,Q.jsx)(Tr,{className:`h-5 w-5 mx-auto text-muted-foreground mb-1`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`detail.dropFilesToUpload`)}),(0,Q.jsx)(`input`,{ref:c,type:`file`,multiple:!0,className:`hidden`,onChange:f})]}),e.length>0&&(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(Wo,{className:`h-3 w-3`}),(0,Q.jsx)(`span`,{children:a(`detail.attachmentCount`,{count:e.length})})]}),(0,Q.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:e.map(e=>{let t=Fv(e.type),r=Iv(e.type);return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group`,children:[t&&(e.thumbnailUrl||e.url)?(0,Q.jsx)(`img`,{src:e.thumbnailUrl||e.url,alt:e.name,className:`h-10 w-10 rounded object-cover shrink-0`}):(0,Q.jsx)(`div`,{className:`h-10 w-10 rounded bg-muted flex items-center justify-center shrink-0`,children:(0,Q.jsx)(r,{className:`h-5 w-5 text-muted-foreground`})}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.name}),(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:Pv(e.size)})]}),n&&!i&&(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity`,onClick:()=>n(e.id),title:a(`detail.removeAttachment`),children:(0,Q.jsx)(Er,{className:`h-3.5 w-3.5`})})]},e.id)})})]})]})},Rv={comment:Mo,field_change:br,task:cs,event:Jn,system:_s,email:Eo,call:Xo,note:ds,file:mo,sharing:as,record_create:Ka,record_delete:Cr,approval:Pa},zv={comment:`bg-purple-100 text-purple-600`,field_change:`bg-blue-100 text-blue-600`,task:`bg-green-100 text-green-600`,event:`bg-amber-100 text-amber-600`,system:`bg-gray-100 text-gray-600`,email:`bg-indigo-100 text-indigo-600`,call:`bg-teal-100 text-teal-600`,note:`bg-yellow-100 text-yellow-700`,file:`bg-slate-100 text-slate-600`,sharing:`bg-sky-100 text-sky-600`,record_create:`bg-emerald-100 text-emerald-600`,record_delete:`bg-red-100 text-red-600`,approval:`bg-violet-100 text-violet-600`};function Bv(e){return[{value:`all`,label:e(`detail.allActivity`)},{value:`comments_only`,label:e(`detail.commentsOnly`)},{value:`changes_only`,label:e(`detail.fieldChangesFilter`)},{value:`tasks_only`,label:e(`detail.tasksOnly`)}]}function Vv(e,t,n){try{let r=new Date(e),i=new Date().getTime()-r.getTime(),a=Math.floor(i/6e4);if(a<1)return t(`detail.justNow`);if(a<60)return t(`detail.minutesAgo`,{count:a});let o=Math.floor(a/60);if(o<24)return t(`detail.hoursAgo`,{count:o});let s=Math.floor(o/24);return s<7?t(`detail.daysAgo`,{count:s}):r.toLocaleDateString(n)}catch{return e}}function Hv(e){return e.type===`comment`}function Uv(e,t){switch(t){case`comments_only`:return e.filter(e=>e.type===`comment`);case`changes_only`:return e.filter(e=>e.type===`field_change`);case`tasks_only`:return e.filter(e=>e.type===`task`);default:return e}}var Wv=({items:e,config:t,filterMode:n,onFilterChange:r,hasMore:i=!1,onLoadMore:a,loading:o=!1,onAddComment:s,onAddReply:c,onToggleReaction:l,subscription:u,onToggleSubscription:d,collapseWhenEmpty:f=!1,mentionSuggestions:p,onUploadAttachments:m,titleLabel:h,emptyLabel:g,activityDenied:_=!1,commentsDenied:v=!1,className:y})=>{let{t:b}=Yp(),x=zn(),[S,C]=$.useState(`all`),[w,T]=$.useState(``),[D,O]=$.useState(!1),[A,j]=$.useState(!1),[M,ee]=$.useState([]),[N,P]=$.useState(!1),F=h??b(`detail.activity`),te=_||v?(0,Q.jsxs)(`div`,{role:`status`,"data-testid":`activity-access-denied`,className:`flex flex-col gap-2 py-4 text-sm text-muted-foreground`,children:[_&&(0,Q.jsxs)(`p`,{"data-denied-source":`activity`,className:`flex items-center gap-2`,children:[(0,Q.jsx)(Co,{className:`h-4 w-4 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:b(`detail.activityAccessDenied`)})]}),v&&(0,Q.jsxs)(`p`,{"data-denied-source":`comments`,className:`flex items-center gap-2`,children:[(0,Q.jsx)(Co,{className:`h-4 w-4 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:b(`detail.commentsAccessDenied`)})]})]}):null,I=n??S,L=t?.showFilterToggle!==!1,re=t?.showCommentInput!==!1&&!!s,R=t?.enableReactions??!1,z=t?.enableThreading??!1,B=t?.showSubscriptionToggle??!1,V=$.useMemo(()=>Uv(e,I),[e,I]),H=$.useMemo(()=>z?V.filter(e=>!e.parentId):V,[V,z]),ie=$.useMemo(()=>{if(!z)return new Map;let e=new Map;for(let t of V)if(t.parentId){let n=e.get(t.parentId)??[];n.push(t),e.set(t.parentId,n)}return e},[V,z]),ae=$.useCallback(e=>{r?r(e):C(e)},[r]),W=$.useCallback(async()=>{let e=w.trim();if(s&&(e||M.length!==0)){O(!0);try{await s(e,M.length>0?M:void 0),T(``),ee([])}catch{}finally{O(!1)}}},[w,M,s]),oe=$.useCallback(async e=>{if(m&&e.length!==0){P(!0);try{let t=await m(e);Array.isArray(t)&&t.length>0&&ee(e=>[...e,...t])}finally{P(!1)}}},[m]),se=$.useCallback(e=>{ee(t=>t.filter(t=>t.id!==e))},[]),G=$.useCallback(async()=>{if(a){j(!0);try{await a()}finally{j(!1)}}},[a]);return(0,Q.jsxs)(`section`,{className:U(`border-t border-border/60 pt-5`,y),"aria-label":F,children:[(0,Q.jsx)(`header`,{className:`mb-4`,children:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold leading-none tracking-tight`,children:[(0,Q.jsx)(Sa,{className:`h-4 w-4`}),F,(0,Q.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`(`,V.length,`)`]})]}),(0,Q.jsx)(`div`,{className:`flex items-center gap-1`,children:B&&u&&(0,Q.jsx)(jv,{subscription:u,onToggle:d})})]})}),(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[L&&(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Q.jsxs)(k,{value:I,onValueChange:e=>ae(e),children:[(0,Q.jsx)(E,{"aria-label":b(`detail.filterActivity`),className:`h-8 w-auto min-w-[140px] py-1 text-sm`,children:(0,Q.jsx)(ne,{})}),(0,Q.jsx)(be,{children:Bv(b).map(e=>(0,Q.jsx)(Ee,{value:e.value,children:e.label},e.value))})]})}),re&&(0,Q.jsx)(Nv,{value:w,onChange:T,onSubmit:W,mentionSuggestions:p,placeholder:b(`detail.leaveCommentPlaceholder`),disabled:D,canSubmitEmpty:M.length>0,extraSlot:m?(0,Q.jsx)(Lv,{attachments:M,onUpload:oe,onRemove:se,readOnly:D||N}):M.length>0?(0,Q.jsx)(Lv,{attachments:M,onRemove:se,readOnly:D}):void 0}),V.length>0&&te,o&&V.length===0?(0,Q.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":`activity-loading`,className:`flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground`,children:[(0,Q.jsx)(fr,{className:`h-4 w-4 animate-spin`}),(0,Q.jsx)(`span`,{children:b(`detail.loading`)})]}):(_||v)&&V.length===0?te:V.length===0?f?null:(0,Q.jsx)(Ft,{title:g??b(`detail.noActivity`),className:`py-6`}):(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`div`,{className:`absolute left-4 top-2 bottom-2 w-px bg-border`}),(0,Q.jsx)(`div`,{className:`space-y-4`,children:H.map(e=>{let t=Rv[e.type]||_s,n=zv[e.type]||`bg-gray-100 text-gray-600`,r=ie.get(e.id)??[],i=R&&l&&Hv(e)?t=>l(e.id,t):void 0;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex gap-3 relative`,children:[(0,Q.jsx)(`div`,{className:U(`shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10`,n),children:e.actorAvatarUrl?(0,Q.jsx)(`img`,{src:e.actorAvatarUrl,alt:e.actor,className:`h-8 w-8 rounded-full object-cover`}):(0,Q.jsx)(t,{className:`h-3.5 w-3.5`})}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0 pt-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 mb-0.5`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium`,children:e.actor}),e.source&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:b(`detail.via`,{source:e.source})}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Vv(e.createdAt,b,x)}),e.edited&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:b(`detail.edited`)}),e.pinned&&(0,Q.jsxs)(`span`,{className:`text-xs text-amber-600`,children:[`📌 `,b(`detail.pinned`)]})]}),e.body&&(0,Q.jsx)(`p`,{className:`text-sm whitespace-pre-wrap break-words text-muted-foreground`,children:e.body}),e.sourceObject&&e.sourceId!=null&&(0,Q.jsxs)(`a`,{href:`/objects/${e.sourceObject}/${e.sourceId}`,className:`mt-1 inline-flex items-center gap-1 text-xs text-primary hover:underline`,"data-testid":`activity-source-link`,children:[b(`detail.viewSource`),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`→`})]}),e.type===`field_change`&&e.fieldChanges&&(0,Q.jsx)(`div`,{className:`space-y-1 mt-1`,children:e.fieldChanges.map((e,t)=>(0,Q.jsx)(Ev,{change:e},t))}),R&&e.reactions&&e.reactions.length>0&&(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(Ov,{reactions:e.reactions,onToggleReaction:i})}),(!e.reactions||e.reactions.length===0)&&i&&(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(Ov,{reactions:[],onToggleReaction:i})})]})]}),z&&(e.replyCount??0)>0&&(0,Q.jsx)(Av,{parentItem:e,replies:r,onAddReply:c,showReplyInput:!!c})]},e.id)})})]}),i&&(0,Q.jsx)(`div`,{className:`text-center pt-2`,children:(0,Q.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:G,disabled:A,"aria-label":b(`detail.loadMore`),children:[A?(0,Q.jsx)(fr,{className:`h-4 w-4 animate-spin mr-1`}):(0,Q.jsx)(Zn,{className:`h-4 w-4 mr-1`}),b(`detail.loadMore`)]})})]})]})},Gv=Ut.options,Kv=Nt.options,qv={created:`field_change`,updated:`field_change`,deleted:`field_change`,assigned:`field_change`,shared:`field_change`,system:`system`,completed:`task`,scheduled:`event`,commented:void 0,mentioned:void 0,login:void 0,logout:void 0},Jv=`system`,Yv=[`comment`],Xv=[`record_create`,`record_delete`,`sharing`],Zv=new Set([...Object.values(qv).filter(e=>!!e),Jv,...Yv]),Qv=new Set([`task`]);function $v(e,t,n,r){let i=n.filter(n=>!e.has(JSON.stringify([t,n])));if(i.length!==0){for(let n of i)e.add(JSON.stringify([t,n]));console.warn(r(i))}}var ey=new Set,ty=new Set,ny=new Set;function ry(e,t){if(typeof e==`string`&&Gv.includes(e))return e;if(e!=null){let n=typeof e==`string`?`"${e}"`:typeof e;$v(ny,t,[typeof e==`string`?e:`non-string ${n}`],()=>`[${t}] ignoring an unrecognised \`filterMode\` (${n}) and opening on "all" instead — the WIDEST mode, which shows EVERY activity rather than the slice that was asked for. No declared filter mode matches it. The fallback is kept rather than passing the value through because a dropdown handed a value with no matching item renders blank (objectui#3151), so this is a diagnostic, not a refusal. Declared filter modes: ${Gv.join(`, `)}.`)}return`all`}function iy(e,t){let n=e.filter(e=>!Zv.has(e));n.length!==0&&$v(ty,t,n,e=>{let n=e=>e.map(e=>`"${e}"`).join(`, `),r=e.filter(e=>Xv.includes(e)),i=e.filter(e=>!Xv.includes(e)),a=`[${t}] \`types\` names ${e.length} declared feed item type${e.length===1?``:`s`} that NO ObjectUI producer emits, so ${e.length===1?`it selects`:`they select`} nothing: ${n(e)}. The entr${e.length===1?`y is`:`ies are`} honoured as authored — nothing is dropped or widened — but a timeline filtered to ${e.length===1?`it`:`them`} alone renders permanently empty, which is the thing that used to happen with no diagnostic at all.`;return r.length>0&&(a+=` DELIBERATELY NOT ADOPTED, a decision rather than a gap: ${n(r)} — \`created\` / \`deleted\` / \`shared\` activity is mapped to \`field_change\` on purpose, because the record page and this block have to agree about what a \`created\` row IS before either can move to the richer kind. Adopting them is a change to that shared map (ACTIVITY_TYPE_TO_FEED_TYPE, @object-ui/plugin-detail), not to one block.`),i.length>0&&(a+=` NO PRODUCER on any ObjectUI surface: ${n(i)} — @objectstack/spec declares the kind and nothing here emits it. Whether that is a gap or a decision nobody wrote down is not recorded anywhere this diagnostic can read, so it reports the measurement and stops there.`),a+=` Feed item types ObjectUI produces today: ${[...Zv].sort().join(`, `)}. If your HOST supplies the feed — \`items\` on the node, or a DiscussionContext it mounts — it may produce kinds this census cannot see, and this warning does not apply to them.`,a})}function ay(e,t){if(e==null)return;if(!Array.isArray(e)){let n=typeof e==`string`?`"${e}"`:typeof e;return $v(ey,t,[`non-array ${n}`],()=>`[${t}] ignoring an authored \`types\` that is not an array (${n}). \`types\` must be a LIST of feed item types. The timeline renders empty rather than falling back to every kind, because a filter that cannot be read is not a request to remove the filter. Declared feed item types: ${Kv.join(`, `)}.`),[]}let n=[],r=[];for(let t of e)typeof t==`string`&&Kv.includes(t)?n.push(t):r.push(typeof t==`string`?t:String(t));return r.length>0&&$v(ey,t,r,e=>`[${t}] ignoring ${e.length} unrecognised \`types\` entr${e.length===1?`y`:`ies`}: ${e.map(e=>`"${e}"`).join(`, `)}. No declared feed item type matches, so they select nothing; only the recognised entries narrow the timeline, and a list with NO recognised entry renders an EMPTY timeline rather than every kind. Declared feed item types: ${Kv.join(`, `)}.`),iy(n,t),n}function oy(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function sy(e){return oy(e)?e:20}function cy(e){if(typeof e==`number`)return String(e);if(typeof e==`string`)return JSON.stringify(e);try{let t=JSON.stringify(e);if(t!==void 0)return t}catch{}return String(e)}function ly(e,t){return t==null||oy(t)?null:`[ObjectUI] ${e} row cap: declared limit: ${cy(t)} (${Array.isArray(t)?`array`:typeof t}), which is not a positive integer number. The spec declares \`limit\` as z.number().int().positive() and refuses strings, booleans, fractions, zero and negatives, so it was ignored and this block fell back to its default row cap (20).`}function uy(e){let t=e.timestamp;return String(!t||t===`NOW()`||Number.isNaN(Date.parse(String(t)))?e.created_at??``:t)}var dy=new Set;function fy(e){$v(dy,``,[e],()=>`[record:activity] rendered a sys_activity row with type "${e}" through the generic "${Jv}" presentation: no feed item type is mapped for it. \`sys_activity.type\` is author-extensible (ruled 2026-08-24) and is not validated on write, so a producer can store a value the platform never declared — the row is shown rather than dropped. Map it in ACTIVITY_TYPE_TO_FEED_TYPE (@object-ui/plugin-detail) to give it its own presentation.`)}function py(e,t){let n=String(e?.type),r=Object.prototype.hasOwnProperty.call(qv,n);r||fy(n);let i=r?qv[n]:Jv;return i?{id:e.id,type:i,actor:e.actor_name??t,actorAvatarUrl:e.actor_avatar_url??void 0,body:e.summary??``,createdAt:uy(e),sourceObject:e.source_object??void 0,sourceId:e.source_id??void 0}:null}function my(e,t,n,r){let i=e.slice();t.unifiedTimeline===!1&&(i=i.filter(e=>e.type!==`field_change`)),t.showCompleted!==!0&&(i=i.filter(e=>!Qv.has(e.type)));let a=ay(t.types,r);if(a!==void 0){let e=new Set(a);i=i.filter(t=>e.has(t.type))}let o=i.length,s=Math.max(1,Math.floor(n)||20);return{items:o>s?i.slice(o-s):i,total:o,hasMore:o>s}}function hy(...e){let t=new Map;for(let n of e)for(let e of n)t.set(String(e.id),e);return Array.from(t.values()).sort((e,t)=>{let n=e.createdAt?Date.parse(e.createdAt):0,r=t.createdAt?Date.parse(t.createdAt):0;return(Number.isNaN(n)?0:n)-(Number.isNaN(r)?0:r)})}function gy(e){let t=T(e);return t===`forbidden`||t===`unauthorized`}var _y=e=>{let{"data-obj-id":t,"data-obj-type":n,style:r,...i}=e||{};return{designer:{"data-obj-id":t,"data-obj-type":n,style:r},rest:i}},vy=`record:activity`,yy=({schema:e={},className:t,...n})=>{let{designer:r}=_y(n),i=iv(e.aria),a=ft(),o=ue(),s=Dn(),c=e.properties??{},l=t=>e[t]??c[t],u=l(`limit`),d=sy(u),f=ly(vy,u);$.useEffect(()=>{f&&console.warn(f)},[f]);let p=ry(l(`filterMode`),vy),m=l(`types`),h=l(`showCompleted`),g=l(`unifiedTimeline`),_={types:m,filterMode:p,showFilterToggle:l(`showFilterToggle`),limit:d,showCompleted:h,unifiedTimeline:g,showCommentInput:l(`showCommentInput`),enableMentions:l(`enableMentions`),enableReactions:l(`enableReactions`),enableThreading:l(`enableThreading`),showSubscriptionToggle:l(`showSubscriptionToggle`)},v=Array.isArray(e.items)?e.items:Array.isArray(c.items)?c.items:void 0,y=e.loading??c.loading,b=a?.objectName,x=a?.data?.id??a?.data?._id??a?.recordId,S=a?.dataSource,C=v===void 0&&!o&&typeof S?.find==`function`&&!!b&&x!=null,[w,T]=$.useState(0),E=d*(w+1),[D,O]=$.useState(null),[k,A]=$.useState(!1),[j,M]=$.useState(!1),[ee,N]=$.useState(!1),P=s(`detail.systemActor`,`System`);$.useEffect(()=>{if(!C)return;let e=!1;return M(!0),Promise.resolve(S.find(`sys_activity`,{$filter:{object_name:b,record_id:x},$orderby:{timestamp:`desc`},$top:Math.max(1,E)+1})).then(t=>{if(e)return;let n=t?.data??[],r=Array.isArray(n)?n:[],i=[];for(let e of r){let t=py(e,P);t&&i.push(t)}A(r.length>Math.max(1,E)),O(hy(i)),N(!1)}).catch(t=>{e||(O([]),A(!1),N(gy(t)))}).finally(()=>{e||M(!1)}),()=>{e=!0}},[C,S,b,x,E,P]);let F=o?.items,te=$.useMemo(()=>my(v??F??D??[],{types:m,showCompleted:h,unifiedTimeline:g},E,vy),[v,F,D,m,h,g,E]),ne=te.items,I=te.hasMore||C&&k,L=y??o?.loading??(C&&D===null?!0:j),re=v===void 0?o?!!o.activityDenied:C&&ee:!1,R=v===void 0&&!!o?.commentsDenied,[z,B]=$.useState(p);$.useEffect(()=>{B(p)},[p]);let V=$.useCallback(()=>{T(e=>e+1)},[]),H=_.enableMentions!==!1;return(0,Q.jsx)(`div`,{className:t,...r,...i,children:(0,Q.jsx)(Wv,{items:ne,config:_,loading:L,filterMode:z,onFilterChange:B,hasMore:I,onLoadMore:V,onAddComment:o?.onAddComment,onAddReply:o?.onAddReply,onToggleReaction:o?.onToggleReaction,mentionSuggestions:H?o?.mentionSuggestions:void 0,onUploadAttachments:o?.onUploadAttachments,activityDenied:re,commentsDenied:R})})},by=({config:e,items:t,hasMore:n,onLoadMore:r,loading:i,onAddComment:a,onAddReply:o,onToggleReaction:s,subscription:c,onToggleSubscription:l,filterMode:u,onFilterChange:d,collapseWhenEmpty:f=!1,mentionSuggestions:p,onUploadAttachments:m,activityDenied:h,commentsDenied:g,className:_})=>{let v=e?.position??`right`,y=e?.width??`360px`,b=e?.collapsible??!0,x=f&&t.length===0||(e?.defaultCollapsed??!1),{t:S}=Yp(),[C,w]=$.useState(x),T=iv(e?.feed?.aria);return v===`right`||v===`left`?C&&b?(0,Q.jsx)(`div`,{className:U(`flex items-start pt-4`,v===`right`?`border-l`:`border-r`,_),children:(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-8 w-8 mx-1`,onClick:()=>w(!1),"aria-label":S(`detail.openDiscussion`),children:(0,Q.jsx)(Vo,{className:`h-4 w-4`})})}):(0,Q.jsxs)(`div`,{className:U(`flex flex-col overflow-hidden`,v===`right`?`border-l`:`border-r`,_),style:{width:y,minWidth:y},children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Mo,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`text-sm font-medium`,children:S(`detail.discussion`)})]}),b&&(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>w(!0),"aria-label":S(`detail.closeDiscussion`),children:(0,Q.jsx)(Er,{className:`h-3.5 w-3.5`})})]}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,Q.jsx)(`div`,{...T,children:(0,Q.jsx)(Wv,{items:t,config:e?.feed,hasMore:n,onLoadMore:r,loading:i,onAddComment:a,onAddReply:o,onToggleReaction:s,subscription:c,onToggleSubscription:l,filterMode:u,onFilterChange:d,collapseWhenEmpty:f,mentionSuggestions:p,onUploadAttachments:m,titleLabel:S(`detail.discussion`),emptyLabel:S(`detail.noCommentsYet`),activityDenied:h,commentsDenied:g,className:`border-0 shadow-none`})})})]}):(0,Q.jsx)(`div`,{className:U(``,_),children:b&&C?(0,Q.jsxs)(J,{variant:`ghost`,className:`w-full justify-start gap-2 text-muted-foreground`,onClick:()=>w(!1),"aria-label":S(`detail.showDiscussion`,{count:t.length}),children:[(0,Q.jsx)(Mo,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{children:S(`detail.showDiscussion`,{count:t.length})})]}):(0,Q.jsxs)(`div`,{children:[b&&(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,Q.jsx)(Mo,{className:`h-4 w-4`}),S(`detail.discussion`)]}),(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>w(!0),"aria-label":S(`detail.hideDiscussion`),children:(0,Q.jsx)(Ro,{className:`h-3.5 w-3.5`})})]}),(0,Q.jsx)(`div`,{...T,children:(0,Q.jsx)(Wv,{items:t,config:e?.feed,hasMore:n,onLoadMore:r,loading:i,onAddComment:a,onAddReply:o,onToggleReaction:s,subscription:c,onToggleSubscription:l,filterMode:u,onFilterChange:d,collapseWhenEmpty:f,mentionSuggestions:p,onUploadAttachments:m,titleLabel:S(`detail.discussion`),emptyLabel:S(`detail.noCommentsYet`),activityDenied:h,commentsDenied:g})})]})})},xy=e=>{let{"data-obj-id":t,"data-obj-type":n,style:r,...i}=e||{};return{designer:{"data-obj-id":t,"data-obj-type":n,style:r},rest:i}},Sy=({schema:e={},className:t,...n})=>{ft();let r=ue(),{designer:i}=xy(n),a=iv(e.aria),o={position:`bottom`,collapsible:!1,feed:{enableReactions:!0,enableThreading:!0,showCommentInput:!0},...e},s=o.feed,[c,l]=$.useState(0),u=sy(s?.limit),d=typeof e.type==`string`&&e.type?e.type:`record:chatter`,f=ly(`${d} feed`,s?.limit);$.useEffect(()=>{f&&console.warn(f)},[f]);let p=u*(c+1),m=ry(s?.filterMode,d),[h,g]=$.useState(m);$.useEffect(()=>{g(m)},[m]);let _=r?.items,v=$.useMemo(()=>my(_??[],{types:s?.types,showCompleted:s?.showCompleted,unifiedTimeline:s?.unifiedTimeline},p,d),[_,s?.types,s?.showCompleted,s?.unifiedTimeline,p,d]),y=$.useCallback(()=>{l(e=>e+1)},[l]),b=s?.enableMentions!==!1;return(0,Q.jsx)(`div`,{className:t,...i,...a,children:(0,Q.jsx)(by,{items:v.items,config:o,hasMore:v.hasMore,onLoadMore:y,loading:r?.loading,filterMode:h,onFilterChange:g,onAddComment:r?.onAddComment,onAddReply:r?.onAddReply,onToggleReaction:r?.onToggleReaction,mentionSuggestions:b?r?.mentionSuggestions:void 0,onUploadAttachments:r?.onUploadAttachments,activityDenied:r?.activityDenied,commentsDenied:r?.commentsDenied})})},Cy=e=>{let{"data-obj-id":t,"data-obj-type":n,style:r,...i}=e||{};return{designer:{"data-obj-id":t,"data-obj-type":n,style:r},rest:i}};function wy(e,t){if(!Array.isArray(e))return[];let n=null;for(let r=0;r<e.length;r++){let i=e[r],a=i?.label;typeof a==`object`&&a&&(n??=[...e],n[r]={...i,label:Rn(a,t)})}return n??e}var Ty=({schema:e={},className:t,...n})=>{let r=ft(),{translateOptions:i}=Ze(),{t:a}=Yp(),{designer:o}=Cy(n),s=iv(e.aria,{defaultRole:`list`,defaultLabel:a(`detail.pathLabel`),block:`record:path`}),{language:c}=In(),l=e.statusField,u=e.stages,d=u===void 0,f=r?.objectSchema,p=$.useMemo(()=>wy(d?ev(f,l??null):u,c),[d,u,f,l,c]),m=$.useMemo(()=>{if(p.length===0||!l||!r?.objectName)return p;let e=i(r.objectName,l,p);return Array.isArray(e)&&e.length===p.length?p.map((t,n)=>({...t,label:e[n]?.label??t.label})):p},[p,l,r?.objectName,i]),h=l&&r?.data?r.data[l]:void 0,g=/(^|[_-\s])(closed_)?(lost|failed?|cancell?ed|失败|流失|丢单|败)([_-\s]|$)/i,_=/(^|[_-\s])(closed_)?(won|success|成交|赢|完成)([_-\s]|$)/i,v=m.map(e=>{if(e.terminal)return e.terminal;let t=`${String(e.value??``)} ${String(e.label??``)}`;if(g.test(t))return`lost`;if(_.test(t))return`won`}),y=v.findIndex(e=>e===`lost`),b=y===-1?m:m.slice(0,y),x=y===-1?[]:m.slice(y),S=b.length-1,C=v.map((e,t)=>e===`won`?t===S?`won`:void 0:e),w=m.findIndex(e=>e.value===h);w<0&&(w=-1);let T=y!==-1&&w>=y;if(m.length===0){let e=d&&!!l&&f!=null;return(0,Q.jsx)(`div`,{className:t,...o,children:(0,Q.jsx)(`div`,{className:`text-xs text-muted-foreground italic px-3 py-2 border border-dashed rounded`,children:e?`record:path — no stages configured, and field "${l}" has no picklist options to derive them from`:`record:path — no stages configured`})})}let E=(e,t)=>U(`h-1.5 w-full rounded-full`,t===`lost`&&(e===`current`?`bg-destructive`:`bg-destructive/25`),t!==`lost`&&e===`current`&&`bg-primary`,t!==`lost`&&e===`completed`&&`bg-emerald-500`,t!==`lost`&&e===`upcoming`&&(t===`won`?`bg-emerald-500/30`:`bg-muted`)),D=(e,t)=>U(`block min-w-0 text-xs`,e===`current`&&(t===`lost`?`font-semibold text-destructive`:`font-semibold text-foreground`),e===`completed`&&`font-normal text-muted-foreground`,e===`upcoming`&&`font-normal text-muted-foreground`),O=(e,t,n)=>a(n===`lost`?t===`current`?`detail.pathStageLostCurrent`:`detail.pathStageLostUpcoming`:n===`won`&&t===`upcoming`?`detail.pathStageWonUpcoming`:t===`current`?`detail.pathStageCurrent`:t===`completed`?`detail.pathStageCompleted`:`detail.pathStageUpcoming`,{stage:e}),k=e=>(0,Q.jsxs)(`div`,{role:`listitem`,"data-stage-state":e.state,"data-stage-terminal":e.terminal,"aria-current":e.state===`current`?`step`:void 0,"aria-label":O(e.stage.label,e.state,e.terminal),className:U(`flex flex-col gap-1.5`,e.className),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-stage-rail":``,className:E(e.state,e.terminal)}),(0,Q.jsxs)(`span`,{className:U(D(e.state,e.terminal),e.labelClassName),children:[e.terminal===`lost`&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mr-1 opacity-70`,children:`✗`}),e.terminal!==`lost`&&e.state===`completed`&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mr-1 text-emerald-600 dark:text-emerald-400 font-semibold`,children:`✓`}),e.stage.label]})]},e.key);return(0,Q.jsxs)(`div`,{className:U(`w-full`,t),...o,children:[(0,Q.jsxs)(`div`,{className:`hidden sm:flex w-full items-start gap-2`,...s,children:[(0,Q.jsx)(`div`,{className:`flex flex-1 items-start gap-1.5`,children:b.map((e,t)=>{let n=!T&&w>=0&&t<w,r=!T&&t===w;return k({key:`${e.value}-${t}`,stage:e,state:r?`current`:n?`completed`:`upcoming`,terminal:C[t],className:`flex-1 min-w-0`,labelClassName:`text-center truncate`})})}),x.length>0&&(0,Q.jsx)(`div`,{className:`flex items-start gap-1.5 pl-2 border-l border-border/40`,children:x.map((e,t)=>{let n=y+t;return k({key:`${e.value}-lost-${t}`,stage:e,state:n===w?`current`:`upcoming`,terminal:C[n],className:`shrink-0`,labelClassName:`text-center whitespace-nowrap`})})})]}),(0,Q.jsx)(`div`,{className:`flex sm:hidden w-full items-start gap-2 overflow-x-auto pb-1 -mx-1 px-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,...s,children:m.map((e,t)=>{let n=C[t],r=n!==`lost`&&!T&&w>=0&&t<w,i=t===w;return k({key:`${e.value}-${t}-m`,stage:e,state:i?`current`:r?`completed`:`upcoming`,terminal:n,className:`shrink-0`,labelClassName:`whitespace-nowrap`})})})]})},Ey=e=>{let{"data-obj-id":t,"data-obj-type":n,style:r,...i}=e||{};return{designer:{"data-obj-id":t,"data-obj-type":n,style:r},rest:i}},Dy=Object.freeze([]),Oy=new Set;function ky(e,t,n){let r=`${e}::${t}::${n.index}::${n.message}`;Oy.has(r)||(Oy.add(r),console.error(`[record:quick_actions] ${t} refused at index ${n.index} — ${n.message}. None of the authored actions is rendered. \`actionNames\` is a list of ACTION IDS resolved from the object's own \`actions\`; an inline action object is the host's runtime channel and must not share an array with ids.`))}var Ay=({schema:e={},className:t,...n})=>{let r=ft(),{designer:i}=Ey(n),a=iv(e.aria,{defaultRole:`toolbar`,defaultLabel:`Quick actions`,block:`record:quick_actions`}),o=ws(),s=Pe(),c=Array.isArray(e.actions)?e.actions:Array.isArray(e.properties?.actions)?e.properties.actions:Dy,l=Array.isArray(e.actionNames)?e.actionNames:Array.isArray(e.properties?.actionNames)?e.properties.actionNames:Dy,u=r?.objectName||``,d=l.length>0?`actionNames`:`actions`,f=l.length>0?l:c,p=I(f,void 0),m=p.kind===`ids`&&p.ids.length>0&&!!u,{item:h}=en(`object`,m?u:null),g=I(f,Array.isArray(h?.actions)?h.actions:[]);g.kind===`refused`&&ky(u,d,g);let _=(g.kind===`refused`?[]:g.actions).map((e,t)=>s(u||void 0,e,{fallbackLabel:`Action ${t+1}`})),v=Array.isArray(e.requiredPermissions)?e.requiredPermissions:[],y=e.location||`record_header`,{getActionsForLocation:b,executeAction:x}=je({actions:_,context:{record:r?.data,recordId:r?.recordId,objectName:r?.objectName}});if(v.length>0&&!o.hasCapabilities(v))return(0,Q.jsx)(`div`,{className:t,...i,role:`status`,"aria-live":`polite`,children:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground italic`,children:`Insufficient permissions to view quick actions.`})});let S=_.length>0?b(y):[];if(S.length===0)return(0,Q.jsx)(`div`,{className:t,...i,children:(0,Q.jsx)(`div`,{className:`text-xs text-muted-foreground italic px-3 py-2 border border-dashed rounded`,children:g.kind===`refused`?`record:quick_actions — ${d} refused at index ${g.index} (see console)`:`record:quick_actions — no actions configured`})});let C=e.align||`end`,w=C===`start`?`justify-start`:C===`center`?`justify-center`:`justify-end`,T=y===`record_header`&&!e.inline;return(0,Q.jsx)(`div`,{className:U(`flex flex-wrap items-center gap-2`,T&&`-mt-12 sm:-mt-14 mb-2 relative z-10`,w,t),...a,...i,children:S.map((t,n)=>(0,Q.jsx)(jy,{action:t,record:r?.data,variant:t.variant||e.variant||`default`,size:t.size||e.size||`sm`,label:t.label||`Action ${n+1}`,onRun:async()=>{typeof t.onClick==`function`?await t.onClick():t.name&&await x(t.name)}},t.name||`qa-${n}`))})};function jy({action:e,record:t,variant:n,size:r,label:i,onRun:a}){let[o,s]=$.useState(!1),c=$.useMemo(()=>({record:t||{}}),[t]),l=gn(We(e.disabled),c),u=(Jt(e.disabled)?l:!1)||o;return(0,Q.jsxs)(J,{variant:n,size:r,disabled:u,onClick:async()=>{s(!0);try{await a()}finally{s(!1)}},children:[o&&(0,Q.jsx)(fr,{className:`mr-2 h-4 w-4 animate-spin`}),i]})}var My=e=>{let{"data-obj-id":t,"data-obj-type":n,style:r,...i}=e||{};return{designer:{"data-obj-id":t,"data-obj-type":n,style:r},rest:i}},Ny=new Set([`created`,`updated`,`assigned`,`shared`,`deleted`]),Py=50;function Fy(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function Iy(e){return Fy(e)?e:Py}function Ly(e){if(typeof e==`number`)return String(e);if(typeof e==`string`)return JSON.stringify(e);try{let t=JSON.stringify(e);if(t!==void 0)return t}catch{}return String(e)}function Ry(e){return e==null||Fy(e)?null:`[ObjectUI] record:history row cap: declared limit: ${Ly(e)} (${Array.isArray(e)?`array`:typeof e}), which is not a positive integer number. The spec declares \`limit\` as z.number().int().positive() and refuses strings, booleans, fractions, zero and negatives, so it was ignored and this block fell back to its default row cap (${Py}).`}var zy=({schema:e={},className:t,...n})=>{let{designer:r}=My(n),i=ft(),a=Array.isArray(e.entries)?e.entries:Array.isArray(e.properties?.entries)?e.properties.entries:void 0,o=e.loading??e.properties?.loading,s=e.emptyText??e.properties?.emptyText,c=e.unknownUserText??e.properties?.unknownUserText,l=e.limit??e.properties?.limit,u=Iy(l),d=Ry(l);$.useEffect(()=>{d&&console.warn(d)},[d]);let f=i?.objectName,p=i?.data?.id??i?.data?._id??i?.recordId,m=i?.dataSource,h=a===void 0&&!!m?.find&&!!f&&p!=null,[g,_]=$.useState(null),[v,y]=$.useState(!1);$.useEffect(()=>{if(!h)return;let e=!1;return y(!0),Promise.resolve(m.find(`sys_activity`,{$filter:{object_name:f,record_id:p},$orderby:{timestamp:`desc`},$top:u})).then(t=>{if(e)return;let n=(t?.data??[]).filter(e=>Ny.has(e?.type)).map(e=>{let t=e.timestamp;return(!t||t===`NOW()`||Number.isNaN(Date.parse(t)))&&(t=e.created_at),{id:e.id,created_at:t,action:e.type,user_name:e.actor_name??null,user_avatar:e.actor_avatar_url??null,summary:e.summary??null}});_(n)}).catch(()=>{e||_([])}).finally(()=>{e||y(!1)}),()=>{e=!0}},[h,m,f,p,u]);let b=a??g??[],x=o??(h&&g===null?v||!0:!1);return(0,Q.jsx)(`div`,{className:t,...r,children:(0,Q.jsx)(__,{entries:b,loading:x,emptyText:s,unknownUserText:c})})},By=e=>{let{"data-obj-id":t,"data-obj-type":n,style:r,...i}=e||{};return{designer:{"data-obj-id":t,"data-obj-type":n,style:r},rest:i}};function Vy(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function Hy(e,t){return Vy(e)?e:t}function Uy(e,t){return e==null||Vy(e)?null:`[ObjectUI] RecordReferenceRail row cap: ${typeof t==`string`&&t?`record:reference_rail entry for ${t}`:`record:reference_rail entry`} declared limit: ${String(e)}, which is not a positive integer. A row cap must be a positive integer (the spec refuses zero and negative values), so it was ignored and this entry fell back to its default preview-row cap (3).`}var Wy=e=>e.replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim(),Gy=(e,t)=>t&&e?.[t]!=null&&e[t]!==``?String(e[t]):e?.name||e?.title||e?.subject||e?.label||e?.email||e?.username||e?.code||e?.slug||e?.provider_id||e?.user_agent||e?.ip_address||e?.id||`—`,Ky=({schema:e={},className:t,...n})=>{let r=ft(),i=Ze(),{t:a}=Yp(),{designer:o}=By(n),s=mh().appName,c=Array.isArray(e.entries)?e.entries:Array.isArray(e.properties?.entries)?e.properties.entries:[],l=r?.recordId,u=r?.dataSource,[d,f]=$.useState({}),p=$.useRef(null),[m,h]=$.useState(!1),g=$.useRef(!0);$.useEffect(()=>(g.current=!0,()=>{g.current=!1}),[]);let _=$.useRef(``);$.useEffect(()=>{if(m)return;let e=p.current;if(!e||typeof IntersectionObserver>`u`){h(!0);return}let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&h(!0)},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[m]);let[v,y]=$.useState({}),b=$.useRef(new Set),x=$.useRef(new Set),C=JSON.stringify(c.map(e=>`${e.objectName}:${e.relationshipField}:${Hy(e.limit,3)}`)),T=JSON.stringify(c.map(e=>[e.objectName,e.limit??null]));$.useEffect(()=>{for(let e of c){let t=Uy(e.limit,e.objectName);if(!t)continue;let n=`${e.objectName}:${String(e.limit)}`;x.current.has(n)||(x.current.add(n),console.warn(t))}},[T]),$.useEffect(()=>{if(!m||!u?.find||!l||c.length===0)return;let e=`${l}::${C}`;if(_.current===e)return;_.current=e;let t=()=>g.current&&_.current===e;f(e=>{let t={...e};for(let n of c)t[n.objectName]={loading:!0,total:0,items:e[n.objectName]?.items||[]};return t});let n=async(e,n)=>{let r=e.objectName;try{let i=await u.find(e.objectName,{$filter:ve(e.relationshipField,l,n),$top:Hy(e.limit,3),$count:!0});if(!t())return;let a=Array.isArray(i)?i:i?.data||[],o=typeof i?.total==`number`?i.total:a.length;f(e=>({...e,[r]:{loading:!1,total:o,items:a}}))}catch(e){if(!t())return;f(t=>({...t,[r]:{loading:!1,total:0,items:[],error:String(e?.message||e)}}))}};(async()=>{let e=new Map;if(typeof u.getObjectSchema==`function`&&await Promise.all(Array.from(new Set(c.map(e=>e.objectName))).map(async t=>{try{e.set(t,(await u.getObjectSchema(t))?.fields)}catch{}})),!t())return;y(Object.fromEntries(e));for(let t of c){if(!S(e.get(t.objectName),t.relationshipField))continue;let n=`${t.objectName}.${t.relationshipField}`;b.current.has(n)||(b.current.add(n),console.warn(`[RecordReferenceRail] "${t.objectName}" relates through the multi-value field "${t.relationshipField}", so the "View All" link is suppressed for it. The console list URL's \`filter[<field>]=<value>\` grammar has no membership operator and no unrecognised suffix narrows it, so the link would open the entire child table dressed as this parent's related records. The rail's own rows are still scoped correctly.`))}let r=[...c],i=async()=>{for(;g.current;){let t=r.shift();if(!t)return;await n(t,e.get(t.objectName))}};await Promise.all(Array.from({length:Math.min(3,r.length)},()=>i()))})()},[m,u,l,C]);let[E,D]=$.useState(!1);if(c.length===0)return null;let O=e.hideEmpty!==!1,k=new Set(c.filter(e=>{let t=d[e.objectName];return O&&t&&!t.loading&&!t.error&&t.total===0}).map(e=>e.objectName)),A=c.filter(e=>E||!k.has(e.objectName)),j=c.filter(e=>k.has(e.objectName)).map(e=>e.title||(i?.objectLabel?i.objectLabel({name:e.objectName,label:Wy(e.objectName)}):Wy(e.objectName)));return(0,Q.jsxs)(`div`,{ref:p,className:U(`flex flex-col gap-3`,e.className,t),...o,children:[A.map(e=>{let t=e.objectName,n=d[t]||{loading:!0,total:0,items:[]},r=S(v[t],e.relationshipField),o=e.title||(i?.objectLabel?i.objectLabel({name:e.objectName,label:Wy(e.objectName)}):Wy(e.objectName));return(0,Q.jsxs)(rt,{className:`overflow-hidden`,children:[(0,Q.jsxs)(Pt,{className:`flex flex-row items-center justify-between gap-2 py-3 px-4 space-y-0 border-b`,children:[(0,Q.jsx)(vt,{className:`text-sm font-semibold tracking-tight truncate`,children:o}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[!n.loading&&(0,Q.jsx)(mt,{variant:`secondary`,className:`tabular-nums`,children:n.total}),s&&l&&!r&&(0,Q.jsx)(_g,{to:`/apps/${s}/${e.objectName}?filter%5B${e.relationshipField}%5D=${encodeURIComponent(String(l))}`,className:`text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors`,title:a(`detail.viewAll`,{defaultValue:`View All`}),children:a(`detail.viewAll`,{defaultValue:`View All`})})]})]}),(0,Q.jsx)(ut,{className:`p-0`,children:n.loading?(0,Q.jsxs)(`div`,{className:`space-y-1.5 p-3`,children:[(0,Q.jsx)(w,{className:`h-3.5 w-4/5`}),(0,Q.jsx)(w,{className:`h-3.5 w-3/5`}),(0,Q.jsx)(w,{className:`h-3.5 w-2/3`})]}):n.items.length===0?(0,Q.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:a(`detail.noRecords`)}):(0,Q.jsx)(`ul`,{className:`divide-y`,children:n.items.map(t=>{let n=t.id||t._id,r=Gy(t,e.displayField),i=n?`../${e.objectName}/record/${encodeURIComponent(String(n))}`:void 0;return(0,Q.jsx)(`li`,{className:`px-4 py-2`,children:i?(0,Q.jsxs)(_g,{to:i,className:`group flex items-center justify-between gap-2 text-xs hover:text-foreground text-muted-foreground transition-colors`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:r}),(0,Q.jsx)($n,{className:`h-3 w-3 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity`})]}):(0,Q.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:r})},String(n||r))})})})]},t)}),!E&&j.length>0&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>D(!0),className:`self-start inline-flex items-center gap-1.5 text-[11px] text-muted-foreground hover:text-foreground transition-colors px-2.5 py-1 rounded-md border border-dashed border-border/60 hover:border-border bg-background`,title:j.join(` · `),children:[(0,Q.jsx)(`span`,{children:a(`detail.showEmptyRelated`,{defaultValue:`+ {{count}} empty`,count:j.length})}),(0,Q.jsxs)(`span`,{className:`truncate max-w-[180px] text-muted-foreground/70`,children:[`(`,j.join(` · `),`)`]})]})]})};function qy(e){let t=Mt(e?.properties)?e.properties:{};return{...e,...t}}var Jy={info:{wrap:`border-blue-300/60 bg-blue-50 text-blue-900 dark:border-blue-700/40 dark:bg-blue-950/30 dark:text-blue-100 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-300`,icon:`Info`},warning:{wrap:`border-amber-300/60 bg-amber-50 text-amber-900 dark:border-amber-700/40 dark:bg-amber-950/30 dark:text-amber-100 [&>svg]:text-amber-600 dark:[&>svg]:text-amber-300`,icon:`AlertTriangle`},error:{wrap:`border-destructive/60 bg-destructive/10 text-destructive dark:bg-destructive/20 [&>svg]:text-destructive`,icon:`AlertCircle`},success:{wrap:`border-emerald-300/60 bg-emerald-50 text-emerald-900 dark:border-emerald-700/40 dark:bg-emerald-950/30 dark:text-emerald-100 [&>svg]:text-emerald-600 dark:[&>svg]:text-emerald-300`,icon:`circle-check`}},Yy=({schema:e={},className:t})=>{let n=qy(e),r=ft(),i=r?.data,a=r?.objectName||``,o=r?.recordId??i?.id,{language:s}=In(),c=Rn(n.title,s),l=Rn(n.body,s),u=Rn(n.action?.label,s),d=[`info`,`warning`,`error`,`success`].includes(n.severity)?n.severity:`info`,f=Jy[d],p=n.icon||f.icon,m=he(i),h=We(n.visible),g=!!i&&Object.keys(i).length>0,_=gn(g?h:void 0,m),v=$.useMemo(()=>{if(!n.dismissible)return null;let e=n.dismissKey||Rn(n.title,`en`)||d;return`os.record-alert:${a}:${o??`_`}:${e}`},[n.dismissible,n.dismissKey,n.title,d,a,o]),[y,b]=$.useState(()=>{if(!v||typeof window>`u`)return!1;try{return window.localStorage.getItem(v)===`1`}catch{return!1}}),x=n.action?.actionName,{item:S}=en(`object`,x&&a?a:null),C=$.useMemo(()=>{let e=I(x?[x]:[],Array.isArray(S?.actions)?S.actions:void 0);return e.kind===`ids`?e.actions[0]:void 0},[x,S]),w=$.useMemo(()=>C?[C]:[],[C]),{executeAction:T}=je({actions:w,context:{record:i,recordId:o,objectName:a}});return y||!g||h!==void 0&&!_?null:(0,Q.jsxs)(Ye,{className:U(`relative pr-12`,f.wrap,t),role:d===`error`?`alert`:`status`,"aria-live":d===`error`?`assertive`:`polite`,children:[(0,Q.jsx)(jt,{name:p,className:`h-4 w-4`,"aria-hidden":`true`}),c?(0,Q.jsx)(_e,{children:c}):null,l||C?(0,Q.jsxs)(vn,{children:[l?(0,Q.jsx)(`p`,{className:`mb-2 last:mb-0`,children:l}):null,C?(0,Q.jsx)(J,{size:`sm`,variant:n.action?.variant||(d===`error`?`destructive`:`default`),onClick:()=>{C?.name&&T(C.name)},children:u||C.label||C.name}):null]}):null,n.dismissible?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{if(b(!0),v)try{window.localStorage.setItem(v,`1`)}catch{}},"aria-label":`Dismiss`,className:`absolute right-3 top-3 inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground/80 hover:bg-foreground/5 hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring`,children:(0,Q.jsx)(jt,{name:`X`,className:`h-4 w-4`,"aria-hidden":`true`})}):null]})},Xy=e=>{if(e==null)return`—`;if(typeof e==`string`)return e.length>0?e:`""`;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}},Zy=(e,t)=>{if(typeof e!=`string`||e.length===0)return null;let n=/\d{4}-\d{2}-\d{2}[ T]/.test(e)?e.replace(` `,`T`):e,r=new Date(n);if(Number.isNaN(r.getTime()))return null;try{return r.toLocaleString(t)}catch{return r.toISOString()}},Qy=({open:e,conflict:t,onReload:n,onOverwrite:r,onCancel:i,busy:a=!1})=>{let{t:o}=Yp(),s=zn(),c=t?.label||t?.field||``,l=t?Xy(t.pendingValue):``,u=t?Xy(t.currentValue):``,f=t?.currentRecord??{},p=(()=>{let e=[f.updated_by_name,f.updated_by_label];for(let t of e)if(typeof t==`string`&&t.length>0)return t;let t=f.updated_by;return typeof t!=`string`||t.length===0||t.length>=16&&!/\s/.test(t)&&/^[A-Za-z0-9_-]+$/.test(t)?null:t})(),m=Zy(f.updated_at??t?.currentVersion,s),[h,g]=o(`detail.concurrentUpdateDescription`,{field:`{{field}}`}).split(`{{field}}`);return(0,Q.jsx)(_,{open:e,onOpenChange:e=>{!e&&!a&&i()},children:(0,Q.jsxs)(C,{className:`max-w-lg`,children:[(0,Q.jsx)(Dt,{children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`span`,{className:`inline-flex h-9 w-9 flex-none items-center justify-center rounded-full bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-300`,"aria-hidden":`true`,children:(0,Q.jsx)(wr,{className:`h-5 w-5`})}),(0,Q.jsxs)(`div`,{className:`flex-1`,children:[(0,Q.jsx)(d,{children:o(`detail.concurrentUpdateTitle`)}),(0,Q.jsxs)(b,{className:`mt-1`,children:[h,(0,Q.jsx)(`strong`,{className:`font-semibold`,children:c}),g]})]})]})}),(0,Q.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`rounded-md border border-amber-200/70 bg-amber-50/60 p-3 dark:border-amber-500/30 dark:bg-amber-500/10`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-amber-800 dark:text-amber-300`,children:o(`detail.concurrentUpdateYourEdit`)}),(0,Q.jsx)(`div`,{className:`mt-1 break-all font-mono text-foreground`,children:l})]}),(0,Q.jsxs)(`div`,{className:`rounded-md border border-sky-200/70 bg-sky-50/60 p-3 dark:border-sky-500/30 dark:bg-sky-500/10`,children:[(0,Q.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-sky-800 dark:text-sky-300`,children:o(`detail.concurrentUpdateCurrentValue`)}),(p||m)&&(0,Q.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[p&&(0,Q.jsx)(`span`,{children:o(`detail.concurrentUpdateUpdatedBy`,{name:p})}),p&&m&&(0,Q.jsx)(`span`,{children:` · `}),m&&(0,Q.jsx)(`span`,{children:o(`detail.concurrentUpdateUpdatedAt`,{when:m})})]})]}),(0,Q.jsx)(`div`,{className:`mt-1 break-all font-mono text-foreground`,children:u})]})]}),(0,Q.jsxs)(se,{className:`gap-2 sm:gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:i,className:U(H({variant:`ghost`}),`mt-2 sm:mt-0`),children:o(`detail.concurrentUpdateCancel`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:r,className:U(H({variant:`outline`}),`mt-2 sm:mt-0 text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive`),children:o(`detail.concurrentUpdateOverwrite`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:n,autoFocus:!0,className:U(H({variant:`default`}),`mt-2 sm:mt-0`),children:o(`detail.concurrentUpdateReload`)})]})]})})};function $y(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.code===`CONCURRENT_UPDATE`||t.name===`ConcurrentUpdateError`}function eb(e){let t=e?.message||e?.error||String(e??`Save failed`);return String(t).replace(/^\[[^\]]+\]\s*/,``).replace(/^[A-Z][A-Z0-9_]+:\s*/,``)}function tb(e,t){return z(e)||(t?[{field:t,message:pe(e)||eb(e)}]:null)}async function nb(e,t,n,r,i){if(typeof e?.update==`function`)await e.update(t,n,r,i);else if(typeof e?.updateOne==`function`)await e.updateOne(t,n,r,i);else if(typeof e?.patch==`function`)await e.patch(t,n,r,i);else throw Error(`[InlineEditSaveBar] DataSource exposes no update/updateOne/patch method; cannot persist inline edit`)}var rb=({dataSource:e,objectName:t,recordId:n,data:r,refresh:i,fieldLabelFor:a,onFieldSave:o,locked:s=!1,lockedHint:c,className:l})=>{let{t:u}=Yp(),d=it(),[f,p]=$.useState(null),[m,h]=$.useState(!1),g=$.useCallback(e=>a?.(e)||e,[a]),_=!!e&&!!t&&n!=null,v=$.useCallback((e,t)=>{if(!d)return;let n=tb(e,t);if(!n){d.setFieldErrors(null),d.setError(eb(e));return}let r=e=>a?.(e)||e;d.setFieldErrors(Object.fromEntries(n.map(e=>[e.field,e.message]))),d.setError(n.map(e=>`${r(e.field)}: ${e.message}`).join(`; `))},[d,a]),y=$.useCallback((e,t)=>{let n=Object.keys(e),r=t?.currentRecord??null;if(n.length===1){let i=n[0];return{field:i,label:a?.(i),pendingValue:e[i],currentValue:r?r[i]:void 0,currentVersion:t?.currentVersion,currentRecord:r}}let i=r?Object.fromEntries(n.map(e=>[e,r[e]])):void 0;return{field:n.join(`, `),label:u(`detail.concurrentUpdateRecordLabel`,{defaultValue:`this record`}),pendingValue:e,currentValue:i,currentVersion:t?.currentVersion,currentRecord:r}},[a,u]),b=$.useCallback(async()=>{if(!d)return;let a=d.draft,s=Object.entries(a);if(s.length===0){d.reset();return}d.setSaving(!0),d.setError(null),d.setFieldErrors(null);let c;try{if(o){for(let[e,t]of s)c=e,await o(e,t);c=void 0}else if(_){let o=typeof r?.updated_at==`string`?r.updated_at:void 0;await nb(e,t,n,a,o?{ifMatch:o}:void 0),await i?.()}d.reset()}catch(e){$y(e)&&_?p(y(a,e)):v(e,c)}finally{d.setSaving(!1)}},[d,o,_,r,e,t,n,i,y,v]),x=$.useCallback(()=>{p(null),h(!1)},[]),S=$.useCallback(async()=>{h(!0);try{await i?.()}finally{d?.reset(),x()}},[i,d,x]),C=$.useCallback(async()=>{if(!f||!_){x();return}h(!0);try{await nb(e,t,n,d?.draft??{},f.currentVersion?{ifMatch:f.currentVersion}:void 0),await i?.(),d?.reset()}catch(e){v(e)}finally{x()}},[f,_,d,e,t,n,i,x,v]),w=!!d?.editing,T=!!d?.saving,E=d?.cancel,D=!!f;return $.useEffect(()=>{if(!w)return;let e=e=>{if(e.key===`Enter`&&(e.metaKey||e.ctrlKey)){if(T||s||D)return;e.preventDefault(),b();return}if(e.key===`Escape`){if(e.defaultPrevented||T||D||document.querySelector(`[data-radix-popper-content-wrapper], [role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]`))return;e.preventDefault(),E?.()}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[w,T,s,D,b,E]),!d||!d.editing?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:U(`sticky bottom-0 z-30 mt-4 flex flex-wrap items-center justify-end gap-2 rounded-md border bg-background/95 px-3 py-2 shadow-sm backdrop-blur supports-[backdrop-filter]:bg-background/80`,l),role:`region`,"aria-label":u(`detail.editFieldsInline`),children:[d.error&&(0,Q.jsx)(`div`,{role:`alert`,className:`mr-auto max-w-md rounded-md border border-destructive/20 bg-destructive/10 px-2 py-1 text-xs text-destructive`,children:d.fieldErrors?(0,Q.jsx)(`ul`,{className:`space-y-0.5`,children:Object.entries(d.fieldErrors).map(([e,t])=>(0,Q.jsxs)(`li`,{"data-inline-field-error":e,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:g(e)}),`: `,t]},e))}):d.error}),(0,Q.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:d.cancel,disabled:d.saving,className:`gap-2`,children:[(0,Q.jsx)(Er,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{children:u(`detail.cancel`)})]}),(0,Q.jsxs)(J,{variant:`default`,size:`sm`,onClick:b,disabled:d.saving||s,className:`gap-2`,title:s?c:void 0,children:[d.saving?(0,Q.jsx)(fr,{className:`h-4 w-4 animate-spin`}):(0,Q.jsx)(Xn,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{children:d.saving?u(`detail.saving`):u(`detail.save`)})]})]}),(0,Q.jsx)(Qy,{open:!!f,conflict:f,busy:m,onCancel:x,onReload:S,onOverwrite:C})]})},ib=new Set(oi);function ab(e,t,n){let r=t?.fields??{};return(Object.keys(r).length?Object.keys(r):Object.keys(e)).filter(e=>!n.has(e)&&!e.startsWith(`__`)).filter(t=>t in e).filter(e=>!r[e]?.hidden).map(e=>{let t=r[e]||{},n=le(t);return{name:e,label:t.label,type:t.type,readonly:!!t.readonly||n,options:t.options,currency:t.currency,precision:t.precision,scale:t.scale,useGrouping:t.useGrouping,format:t.format,reference:t.reference,reference_field:t.reference_field??t.referenceField,required:t.required,validation:t.validation,placeholder:t.placeholder,description:t.description}})}function ob({record:e,objectName:t,recordId:n,dataSource:r,objectSchema:i,columns:a=2,systemFields:o=ib,onFieldSave:s,onDelete:l,onClose:u,fullPageHref:d}){let{t:f}=Yp(),p=ab(e,i,o);return(0,Q.jsxs)(c,{canEdit:!!s,children:[(0,Q.jsx)(z_,{dataSource:r,inlineEdit:!!s,schema:{type:`detail-view`,objectName:t,resourceId:String(n),data:e,showDelete:!!l,columns:a,fields:p,actions:d?[{type:`action:bar`,location:`record_header`,systemActions:[{name:`sys_open_new_tab`,label:f(`detail.openInNewTab`),icon:`external-link`,type:`script`,onClick:()=>window.open(d,`_blank`,`noopener`)}]}]:void 0},onDelete:l?async()=>{try{await l(),u?.()}catch(e){console.error(`[RecordDetailPanel] delete failed:`,e)}}:void 0}),(0,Q.jsx)(rb,{onFieldSave:s?async(e,t)=>{try{await s(e,t)}catch(e){throw console.error(`[RecordDetailPanel] inline field save failed:`,e),e}}:void 0})]})}function sb(e,t){if(typeof window>`u`)return null;let n=window.location.pathname,r=`/${e}`,i=n.indexOf(r);return`${i>=0?n.slice(0,i):n.replace(/\/$/,``)}/${e}/record/${encodeURIComponent(String(t))}`}var cb=Qe(({schema:e,dataSource:t,...n})=>{let r=Se(t);return(0,Q.jsx)(Te,{schema:e,dataSource:r,testId:`detail-view`,errorTitle:`This detail view’s data source could not be resolved`,requiresDataSource:e?.data==null&&e?.api==null&&typeof e?.objectName==`string`&&e.objectName.length>0,noDataSourceMessage:j(`detail-view`,e?.objectName),children:e=>(0,Q.jsx)(z_,{schema:e,dataSource:r,...n})})});Qt.register(`detail-view`,cb,{namespace:`plugin-detail`,label:`Detail View`,category:`Views`,icon:`FileText`,inputs:[{name:`title`,type:`string`},{name:`objectName`,type:`string`},{name:`resourceId`,type:`string`},{name:`api`,type:`string`},{name:`data`,type:`object`},{name:`layout`,type:`enum`,enum:[`vertical`,`horizontal`,`grid`]},{name:`columns`,type:`number`},{name:`sections`,type:`array`},{name:`fields`,type:`array`},{name:`tabs`,type:`array`},{name:`actions`,type:`array`},{name:`showBack`,type:`boolean`},{name:`backUrl`,type:`string`},{name:`showEdit`,type:`boolean`},{name:`editUrl`,type:`string`},{name:`showDelete`,type:`boolean`},{name:`deleteConfirmation`,type:`string`},{name:`loading`,type:`boolean`},{name:`header`,type:`object`},{name:`footer`,type:`object`}],defaultProps:{title:`Detail View`,showBack:!0,showEdit:!1,showDelete:!1,sections:[],fields:[],tabs:[]}}),Qt.register(`detail-section`,V_,{namespace:`plugin-detail`,label:`Detail Section`,category:`Detail Components`,inputs:[{name:`title`,type:`string`},{name:`description`,type:`string`},{name:`icon`,type:`string`,description:"Section header icon, drawn before the title: a Lucide icon name such as `map-pin`."},{name:`fields`,type:`array`,required:!0},{name:`collapsible`,type:`boolean`},{name:`defaultCollapsed`,type:`boolean`},{name:`columns`,type:`number`},{name:`showBorder`,type:`boolean`},{name:`headerColor`,type:`enum`,enum:Object.keys(qg),description:"Header tint, from the design system's closed palette: one of `muted`, `muted/50`, `accent`, `primary/10`, `secondary/10`, `destructive/10`. Any other value is refused — `@object-ui/types` parses this key as that same six-member enum (objectui#6594), matching @objectstack/spec's strict `record:details` section schema. Omit the key for no tint."},{name:`hideEmpty`,type:`boolean`,description:"When every field in the section is empty, `true` hides the whole section (no heading, no skeleton). Omitted or `false`, an all-empty section keeps its heading and label skeleton. Empty fields in a section that still has a filled one are not governed by this key."}]}),Qt.register(`detail`,z_,{namespace:`view`,category:`view`,label:`Detail`,icon:`FileText`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`recordId`,type:`string`},{name:`fields`,type:`array`}]}),Qt.register(`details`,uv,{namespace:`record`,skipFallback:!0,category:`record`,label:`Record Details`,icon:`FileText`,inputs:[{name:`columns`,type:`enum`,enum:[`1`,`2`,`3`,`4`],description:`Number of columns for field layout (1-4)`},{name:`sections`,type:`array`,of:`object`,description:"Field groups rendered as the detail body, in order. Every entry is an OBJECT — `{ name?, label?, columns?, fields }` — a bare section-id string is NOT accepted (the spec retired that spelling in objectstack#5611, and the renderer reads name/label/fields off each entry, so a string entry renders no fields at all). `fields` are the field names shown in this section, in order — required unless `group` supplies the members instead (the spec refuses a section carrying neither, and refuses one carrying both). `label` is the section heading; omit it for an untitled, borderless section. `name` is a stable snake_case identifier and the i18n anchor — the heading resolves through objects.<object>._sections.<name>.label, so a section without a name shows its authored label in every locale. `columns` (1-4) is THIS section's field-grid width; omit it and the renderer derives the width. Authoring `sections` at all makes it the only source of the detail body; omit it and the body falls back to the object's highlightFields. @objectstack/spec 17.3.0 declares eight more member keys on an entry, and this renderer honours all eight: `icon` (a Lucide name on the section header), `description` (sub-heading copy under the heading), `collapsible` and `defaultCollapsed` (a foldable section and its initial state), `showBorder` (force the Card wrapper on or off, overriding the heading-derived default) and `headerColor` (a header tint from the shared palette) through DetailSection, plus `group` — the ADR-0085 §5 REFERENCE form, the alternative to enumerating `fields`. `{ group: 'contact_info' }` inherits the object's `fieldGroups` entry with that key: its members (every visible field pointing at it, in declaration order) and its presentation (label, icon, description, collapse) all come from the group, so the section restates none of it and the spec refuses those keys beside `group`; `columns`, `showBorder` and `headerColor` stay yours because they are how THIS page lays the section out. A `group` naming no declared group renders nothing and is reported to the console (`@objectstack/lint` flags it as `page-section-group-unknown`). `hideEmpty` is the eighth, and it decides whether an ALL-empty section exists: it defaults to on, so a section whose fields are every one of them empty renders nothing at all — no heading, no skeleton — and `hideEmpty: false` is the spelling that keeps that heading and its label skeleton on a brand-new record. It decides ONLY the all-empty case; the empty rows of a section that still has a filled one belong to DetailSection's auto-hide heuristic plus the reader's show-empty toggle, which no authored value overrides in either polarity (objectui#7129 Q2-C), and inline-edit mode renders the section either way so its fields stay reachable. Restored under objectui#8603 (maintainer 2026-09-15) after objectui#7129 retired it on the premise, since falsified upstream, that the spec refused the key. None of the eight has a designer control yet; they are authorable in source mode only, tracked as a deferred feature."},{name:`fields`,type:`array`,of:`string`,description:`Explicit field list (overrides highlightFields)`},{name:`hideFields`,type:`array`,of:`string`,description:"Field names to omit from the body — applied to the top-level `fields` list AND to every section's `fields`. Bare field names only. Authors rarely need it: the synth pipeline fills it with the fields already shown in `record:highlights`, and hand-authored pages get the same dedup live from HighlightFieldsContext, so its purpose is suppressing a field you do not want repeated (the page H1 title field is dropped for you too). Hiding every field of a section leaves that section out entirely."},{name:`inlineEdit`,type:`boolean`,description:"Offer the per-field double-click / pencil inline-edit affordances in the detail body. On by default, and an OPT-OUT only: the value is combined with the object's own editability (system, engine-owned, append-only and better-auth objects are not user-editable unless they opened userActions.edit) and with the server's effective API operation set for the object, so `false` always wins while `true` cannot open editing the platform refuses. The edit session and the atomic Save bar are hosted by the page, so one draft spans the highlights strip and this body."},{name:`showHeader`,type:`boolean`,description:"Render the detail body's own title / follow-star / copy-id chip above the fields. Off by default because this block is normally composed under a `page:header` that already draws that chrome, and turning it on there shows the record title twice. Set it true only when this block is the whole page."},{name:`enforceFieldSecurity`,type:`boolean`,description:`Fold this block's field list through the caller's FIELD-read permissions before rendering, so a field the permission set denies leaves no empty row behind (renderer default: off). Presentation only: it re-applies the same field-read answer the server already enforced (ADR-0066 D3) and never widens access — with it off a denied field still arrives masked or stripped, and with it on the server still decides every value.`},{name:`redactFields`,type:`array`,of:`string`,description:"Field names this block never renders, whatever the permission answer (renderer default: render everything authored). Presentation only, evaluated in the browser after the record is fetched — the values are still in the page, so this is NOT a data-access control and NOT the object's `publicSharing.redactFields`, which removes them server-side. To keep a value from the caller, gate the field itself (`requiredPermissions` / `maskingRule`, ADR-0066 D3) or the permission set. Neighbours `hideFields`, which is the dedupe channel the renderer also writes to."},{name:`requiredPermissions`,type:`array`,of:`string`,description:"[ADR-0066] Capabilities the user must ALL hold — names that permission sets grant through `systemPermissions`, not object actions: `read` or `update` here is an ordinary capability name, not the object's read or edit permission. When the client has resolved the user's capabilities and any of these is missing, this block does not render its content; wherever it would otherwise render, an insufficient-permissions notice takes its place. Presentation only: it authorises nothing, and the data API still serves the same data to the same user. A client that cannot resolve the user's capabilities (no permission provider, or one that does not report `systemPermissions`) renders this block as if they were held — it fails open."}]}),Qt.register(`related_list`,Cv,{namespace:`record`,skipFallback:!0,category:`record`,label:`Related List`,icon:`List`,inputs:[{name:`objectName`,type:`string`,required:!0,description:`Related object name (e.g. "task")`},{name:`relationshipField`,type:`string`,required:!0,description:`Field on the related object pointing back to this record`},{name:`relationshipValueField`,type:`string`,description:'Which field OF THIS PARENT record `relationshipField` stores. Defaults to "id"; set it to the field a name-keyed junction points at (e.g. "name" when sys_user_position.position holds sys_position.name). The resolved value drives three things at once — the list filter, the Add-picker link value, and the pre-filled create form — so they cannot drift apart. While the parent record is still loading, a non-"id" field resolves to null and the list holds its fetch rather than querying on an empty value.'},{name:`columns`,type:`array`,of:`string`,required:!0,description:`Fields to display in the related list`},{name:`sort`,type:`array`},{name:`limit`,type:`number`,description:`Records to display initially`},{name:`filter`,type:`array`,of:`object`,description:"Additional filter criteria, as spec `ViewFilterRule` entries (`[{ field, operator, value }]`). AND-combined with the parent relationship condition, never a replacement for it: it can only narrow this record's children. Also the key a per-element `dataSource` binding's composed filter lands on."},{name:`title`,type:[`string`,`object`],description:'Heading of the list. Defaults to the related object\'s label (its translation when one is loaded, otherwise the humanized object name). Accepts either a plain string or an inline per-locale map (`{ en: "Open tasks", "zh-CN": "未完成任务" }`) — the `I18nLabel` union the contract admits on this key — and the list resolves the map against the active UI language, falling back through base language, a region-qualified sibling, `default`, then `en`, and finally to any remaining entry.'},{name:`showViewAll`,type:`boolean`},{name:`actions`,type:`array`,of:`string`,description:`Action IDs available for related records`},{name:`add`,type:`object`,description:'Adds an "Add" button that assigns EXISTING records instead of creating one — the m2m/junction case. Shape: `{ picker: { object, valueField?, labelField?, filter? }, linkField?, label? }`. `picker.object` (required) is the object whose records the dialog offers. `picker.valueField` is the field of the picked record used as the link value (default "id"); `picker.labelField` is the column shown in the picker rows (default "name", and the other columns are derived from that object\'s schema). With `linkField` set, selecting records CREATES rows in this list\'s own object as `{ [relationshipField]: parentValue, [linkField]: pickedId }` — the junction case; omit `linkField` and the picked child is RE-PARENTED instead, by setting its own `relationshipField` to this parent. `label` is the button text (default "Add", localizable inline). Setting `add` also enables generic link removal on rows when no host delete handler is wired. `picker.filter` restricts which records the dialog offers — a list of `{ field, operator, value }` rules in the same vocabulary as this list\'s own `filter`, applied as a hard constraint the user cannot widen (it never appears as an editable filter row).'},{name:`enforceFieldSecurity`,type:`boolean`,description:"Fold this list's `columns` through the caller's FIELD-read permissions on the RELATED object before rendering (renderer default: off). Presentation only: it re-applies the same field-read answer the server already enforced (ADR-0066 D3) and never widens access — the rows are fetched either way and the server still decides every value."},{name:`redactFields`,type:`array`,of:`string`,description:"Field names this list never renders, whatever the permission answer (renderer default: render every column authored or derived). Applies to the authored `columns` AND to the columns the list derives for itself when none are authored. Presentation only, evaluated in the browser after the rows are fetched — the values are still in the page, so this is NOT a data-access control and NOT the object's `publicSharing.redactFields`, which removes them server-side. To keep a value from the caller, gate the field itself (`requiredPermissions` / `maskingRule`, ADR-0066 D3) or the permission set."},{name:`requiredPermissions`,type:`array`,of:`string`,description:"[ADR-0066] Capabilities the user must ALL hold — names that permission sets grant through `systemPermissions`, not object actions: `read` or `update` here is an ordinary capability name, not the object's read or edit permission. When the client has resolved the user's capabilities and any of these is missing, this block does not render its content; wherever it would otherwise render, an insufficient-permissions notice takes its place. Presentation only: it authorises nothing, and the data API still serves the same data to the same user. A client that cannot resolve the user's capabilities (no permission provider, or one that does not report `systemPermissions`) renders this block as if they were held — it fails open."}]}),Qt.register(`highlights`,Tv,{namespace:`record`,skipFallback:!0,category:`record`,label:`Highlights Panel`,icon:`Star`,inputs:[{name:`fields`,type:`array`,required:!0,description:`Key fields to highlight (1-7), bare names or {name,label?,type?,readonly?}. Set readonly: true on an entry to render that chip read-only — it suppresses the inline-edit affordance and the HeaderHighlight editability gate enforces it. Use it for hook/automation-maintained columns that must not be hand-edited from the record header; marking the OBJECT field readonly instead would also strip the hook's own write-back.`},{name:`layout`,type:`enum`,enum:[`horizontal`,`vertical`],description:`Layout orientation for highlight fields`},{name:`enforceFieldSecurity`,type:`boolean`,description:`Fold this block's highlight chips through the caller's FIELD-read permissions before rendering, so a field the permission set denies leaves no empty chip behind (renderer default: off). Presentation only: it re-applies the same field-read answer the server already enforced (ADR-0066 D3) and never widens access — the record is fetched either way and the server still decides every value.`},{name:`redactFields`,type:`array`,of:`string`,description:"Field names this block never renders as a chip, whatever the permission answer (renderer default: render every field authored). Presentation only, evaluated in the browser after the record is fetched — the values are still in the page, so this is NOT a data-access control and NOT the object's `publicSharing.redactFields`, which removes them server-side. To keep a value from the caller, gate the field itself (`requiredPermissions` / `maskingRule`, ADR-0066 D3) or the permission set."},{name:`requiredPermissions`,type:`array`,of:`string`,description:"[ADR-0066] Capabilities the user must ALL hold — names that permission sets grant through `systemPermissions`, not object actions: `read` or `update` here is an ordinary capability name, not the object's read or edit permission. When the client has resolved the user's capabilities and any of these is missing, this block does not render its content; wherever it would otherwise render, an insufficient-permissions notice takes its place. Presentation only: it authorises nothing, and the data API still serves the same data to the same user. A client that cannot resolve the user's capabilities (no permission provider, or one that does not report `systemPermissions`) renders this block as if they were held — it fails open."}]}),Qt.register(`activity`,yy,{namespace:`record`,skipFallback:!0,category:`record`,label:`Activity Timeline`,icon:`Activity`,inputs:[{name:`types`,type:`array`,of:`string`,description:`Allow-list of feed item types to show (comment, field_change, task, event, email, call, note, file, record_create, record_delete, approval, sharing, system). Omit for all; unrecognised entries are ignored.`},{name:`filterMode`,type:`enum`,enum:[`all`,`comments_only`,`changes_only`,`tasks_only`],description:`Filter the timeline dropdown starts on. The user can still change it; an unrecognised value falls back to "all".`},{name:`showFilterToggle`,type:`boolean`,description:`Expose the activity-type filter dropdown in the panel header`},{name:`limit`,type:`number`,description:`Items per page. Also caps the scoped sys_activity read; "Load more" grows the window by this much.`},{name:`showCompleted`,type:`boolean`,description:`Include completed activities (sys_activity type "completed", which surfaces as a task item). Off by default.`},{name:`unifiedTimeline`,type:`boolean`,description:`Mix field changes and comments in one timeline (Airtable style). Off keeps the panel a discussion stream — field changes stay in record:history.`},{name:`showCommentInput`,type:`boolean`,description:`Show the composer. Requires a host discussion context to persist the comment (record detail pages provide one); without it the feed is read-only.`},{name:`enableMentions`,type:`boolean`,description:`Offer @-mention autocomplete in the composer, from the host discussion context's user list. Off withholds the suggestions.`},{name:`enableReactions`,type:`boolean`,description:`Show emoji reactions on feed items. Toggling one requires a host discussion context; without it existing reactions still render, read-only.`},{name:`enableThreading`,type:`boolean`,description:`Group replies under their parent comment. Posting a reply requires a host discussion context.`},{name:`showSubscriptionToggle`,type:`boolean`,description:`NOT IMPLEMENTED — no record-subscription backend exists yet, so this renders nothing whatever it is set to. Declared for spec parity only (objectui#3165).`}]});var lb=[{name:`position`,type:`enum`,enum:[`bottom`,`right`,`left`],description:`Where the panel docks relative to the record body`},{name:`width`,type:`string`,description:`Panel width as a CSS value (side positions only)`},{name:`collapsible`,type:`boolean`},{name:`defaultCollapsed`,type:`boolean`},{name:`feed`,type:`object`,description:`Activity-feed configuration nested inside the panel — the same shape as record:activity. The spec declares this key as RecordActivityProps (RecordChatterProps.feed), so its members are the inputs record:activity declares; see that block for what each one does.`}];Qt.register(`chatter`,Sy,{namespace:`record`,skipFallback:!0,category:`record`,label:`Chatter Feed`,icon:`MessageSquare`,inputs:lb}),Qt.register(`discussion`,Sy,{namespace:`record`,skipFallback:!0,category:`record`,label:`Discussion`,icon:`MessageSquare`,inputs:lb}),Qt.register(`path`,Ty,{namespace:`record`,skipFallback:!0,category:`record`,label:`Path / Stepper`,icon:`GitBranch`,inputs:[{name:`statusField`,type:`string`,required:!0,description:`Field representing the current status/stage`},{name:`stages`,type:`array`,of:`object`,description:`Explicit stage definitions [{ value, label }] (else derived from field metadata)`}]}),Qt.register(`quick_actions`,Ay,{namespace:`record`,skipFallback:!0,category:`record`,label:`Quick Actions`,icon:`Zap`,inputs:[{name:`actionNames`,type:`array`,of:`string`,description:`Action names to expose, in order — resolved from the actions declared on the object. With no names (and no host-supplied actions) nothing is looked up and the bar renders its empty placeholder`},{name:`requiredPermissions`,type:`array`,of:`string`,description:"[ADR-0066] Capabilities the user must ALL hold — names that permission sets grant through `systemPermissions`, not object actions: `read` or `update` here is an ordinary capability name, not the object's read or edit permission. When the client has resolved the user's capabilities and any of these is missing, this block does not render its content; wherever it would otherwise render, an insufficient-permissions notice takes its place. Presentation only: it authorises nothing, and the data API still serves the same data to the same user. A client that cannot resolve the user's capabilities (no permission provider, or one that does not report `systemPermissions`) renders this block as if they were held — it fails open."},{name:`location`,type:`enum`,enum:[...g],description:`Which declared action location this bar renders`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`]},{name:`inline`,type:`boolean`,description:`Render in the flow instead of folding into the record header`},{name:`variant`,type:`string`,description:`Passed to the Button primitive; a per-action variant overrides it`},{name:`size`,type:`string`,description:`Passed to the Button primitive; a per-action size overrides it`}]}),Qt.register(`history`,zy,{namespace:`record`,skipFallback:!0,category:`record`,label:`History Timeline`,icon:`Clock`,inputs:[{name:`limit`,type:`number`,description:`Maximum history entries to display`},{name:`emptyText`,type:`string`,description:`Copy shown when the record has no history`},{name:`unknownUserText`,type:`string`,description:`Copy substituted when an entry has no resolvable actor`}]}),Qt.register(`reference_rail`,Ky,{namespace:`record`,skipFallback:!0,category:`record`,label:`Reference Rail`,icon:`PanelRight`,inputs:[{name:`hideEmpty`,type:`boolean`,description:`Drop the rail entirely when no entries resolve`}]}),Qt.register(`alert`,Yy,{namespace:`record`,skipFallback:!0,category:`record`,label:`Alert Banner`,icon:`triangle-alert`,inputs:[{name:`severity`,type:`enum`,enum:[`info`,`warning`,`error`,`success`]},{name:`title`,type:[`string`,`object`],description:`Accepts an inline translation map ({ en, "zh-CN", … })`},{name:`body`,type:[`string`,`object`],description:`Accepts an inline translation map ({ en, "zh-CN", … })`},{name:`visible`,type:[`boolean`,`string`,`object`],description:"Gates the banner against the current record: `true`/`false`, a bare CEL expression, or the `{ dialect: 'cel', source }` envelope"},{name:`icon`,type:`string`,description:`Lucide icon name; defaults to the severity icon`},{name:`action`,type:`object`,description:`{ actionName, label?, variant? } — the action the banner offers`},{name:`dismissible`,type:`boolean`},{name:`dismissKey`,type:`string`,description:`Stable key the dismissal is remembered under`}]}),Qt.register(`permission-facet-link`,Es(Ag),{namespace:`field`,skipFallback:!0});var ub=Mn({"kanban.uncategorized":`Uncategorized`},`kanban.uncategorized`),db=$.lazy(()=>X(()=>import(`./KanbanImpl-CBVkfYnm.js`),__vite__mapDeps([0]))),fb=({schema:e,objectFields:t,onCardMove:n,quickAdd:r,onQuickAdd:i})=>{let{t:a}=ub(),o=$.useMemo(()=>Db(e.columns??[],e.data,e.groupBy,e.coverImageField,a(`kanban.uncategorized`)),[e,a]);return(0,Q.jsx)($.Suspense,{fallback:(0,Q.jsx)(w,{className:`w-full h-[600px]`}),children:(0,Q.jsx)(db,{columns:o,onCardMove:n,onCardClick:e.onCardClick,className:e.className,quickAdd:r,onQuickAdd:i,coverImageField:e.coverImageField,conditionalFormatting:e.conditionalFormatting,objectFields:t,swimlaneField:e.swimlaneField,countsAreWindowed:e.countsAreWindowed})})};function pb(e,t,n,r){if(!e||!t)return[];let i={...t,[n]:r},a=[];for(let[r,o]of Object.entries(e)){if(r===n||!o||typeof o!=`object`)continue;let e=o;if(e.requiredWhen==null||!zt(t[r]))continue;let s=xt({visibleWhen:e.visibleWhen,readonlyWhen:e.readonlyWhen,requiredWhen:e.requiredWhen},i,{required:e.required===!0,readonly:e.readonly===!0},t,void 0,`field '${r}'`);s.required&&s.visible&&!s.readonly&&Ou(e.type)&&a.push({name:r,def:{name:r,...e}})}return a}function mb({open:e,fields:t,submitting:n,onCancel:r,onSubmit:i}){let a=Dn(),[o,s]=$.useState({}),[c,l]=$.useState(!1),u=t.filter(e=>zt(o[e.name]));return(0,Q.jsx)(nn,{open:e,onOpenChange:e=>{e||r()},children:(0,Q.jsxs)(It,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(Ge,{children:[(0,Q.jsx)(Bt,{children:a(`kanban.requiredFieldsTitle`,`Complete required fields`)}),(0,Q.jsx)(Yt,{children:a(`kanban.requiredFieldsDescription`,`This move makes the fields below required. Fill them in to continue.`)})]}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-4 py-2`,children:t.map(e=>{let t=zt(o[e.name]);return(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsxs)(`span`,{className:`text-sm font-medium`,children:[e.label,(0,Q.jsx)(`span`,{className:`text-destructive ml-0.5`,"aria-hidden":`true`,children:`*`})]}),(0,Q.jsx)(ju,{field:e.def,value:o[e.name],onChange:t=>s(n=>({...n,[e.name]:t})),readonly:n,error:c&&t?a(`common.required`,`Required`):void 0}),c&&t&&(0,Q.jsx)(`span`,{className:`text-xs text-destructive`,children:a(`common.required`,`Required`)})]},e.name)})}),(0,Q.jsxs)(St,{children:[(0,Q.jsx)(J,{variant:`outline`,onClick:r,disabled:n,children:a(`common.cancel`,`Cancel`)}),(0,Q.jsx)(J,{onClick:()=>{if(u.length>0){l(!0);return}i(o)},disabled:n,children:a(`kanban.moveCard`,`Move card`)})]})]})})}var hb=(0,$.createContext)(!0);function gb(){return(0,$.useContext)(hb)}var _b={"detail.recordDetail":`Record Detail`,"detail.recordDetailWithLabel":`{{label}} Detail`};function vb(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function yb(e,t){return vb(e)?e:t}function bb(e,t){return e==null||vb(e)?null:`[ObjectUI] ObjectKanban fetch batch: ${typeof t==`string`&&t?`object-kanban on ${t}`:`object-kanban`} declared limit: ${String(e)}, which is not a positive integer. A fetch batch must be a positive integer (the spec refuses zero and negative values), so it was ignored and this board fell back to its default fetch batch (100).`}var xb=Mn(_b,`detail.recordDetail`);function Sb(e,t){if(Array.isArray(e)&&e.length>0)return e;let n=t?.highlightFields;return Array.isArray(n)?n.filter(e=>!!t?.fields?.[e]):[]}function Cb(e){if(e?.cardTitle)return e.cardTitle;if(e?.titleField)return e.titleField}var wb=({schema:e,dataSource:t,className:n,data:r,loading:i,onRowClick:a,onCardClick:o,...s})=>{let{translateOptions:c,fieldLabel:l}=Ze(),u=Dn(),{t:d}=xb(),f=Array.isArray(r),[p,m]=(0,$.useState)([]),[h,g]=(0,$.useState)(!1),_=e.objectName??``,{ready:v,def:y}=Kt(_,t),[b,x]=(0,$.useState)(f?i??!1:!1),[S,C]=(0,$.useState)(null),[w,T]=(0,$.useState)(0),E=bn(e.bind),D=ws(),[O,k]=(0,$.useState)(null),j=!(!f&&!E&&!e.data&&e.objectName&&t&&typeof t.find==`function`)||O!==null&&O.key===_;(0,$.useEffect)(()=>{if(!f&&t?.onMutation&&e.objectName)return t.onMutation(t=>{t.resource===e.objectName&&T(e=>e+1)})},[t,e.objectName,f]),(0,$.useEffect)(()=>{f&&i!==void 0&&x(i)},[i,f]),(0,$.useEffect)(()=>{let t=bb(e.limit,e.objectName);t&&console.warn(t)},[e.limit,e.objectName]);let M=JSON.stringify(e.sort??null),ee=an(),P=Ot(e.filter,ee),F=L(!f&&!E&&!e.data&&e.objectName||void 0);(0,$.useEffect)(()=>{if(f||!v)return;let n=!0,r=()=>{n&&k(e=>e!==null&&e.key===_?e:{key:_})};return e.objectName&&!E&&!e.data&&(async()=>{if(!t||typeof t.find!=`function`||!e.objectName){r();return}n&&x(!0);try{let r=Ie(y?.fields),i=D?.isLoaded?r.filter(t=>D.checkField(e.objectName,t,`read`)):r,a={$filter:P,$orderby:hi(e.sort),$top:yb(e.limit,100),...i.length>0?{$expand:i}:{}},o=$r(await t.find(e.objectName,a));n&&(m(o),g(o.length>=a.$top),C(null))}catch(e){console.error(`[ObjectKanban] Fetch error:`,e),n&&C(e)}finally{n&&x(!1),r()}})(),()=>{n=!1}},[e.objectName,_,t,E,e.data,P,M,e.limit,f,v,y,w,D,F]);let te=(f?r:void 0)||E||e.data||p,ne=h&&te===p,I=(0,$.useMemo)(()=>{if(!Array.isArray(te))return[];let t=Cb(e),n=De(y);return te.map(r=>{let i;if(t&&(i=r[t],typeof i==`string`&&(i=i.trim())),!i){let e=A(y,r),t=r.id??r._id;e===`Untitled`||t!=null&&e===`Record #${t}`||(i=e)}let a=e=>e>=1e6?`$${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e}`,o=/^[A-Za-z0-9_-]{12,32}$/,s=e=>{if(typeof e!=`string`||!o.test(e))return!1;let t=/[A-Z]/.test(e),n=/[a-z]/.test(e),r=/[0-9_-]/.test(e);return t&&n||t&&r||n&&r},u=e=>{let t=r[e];if(!tn(t)){if(typeof t==`object`){let e=t;for(let t of[`name`,`full_name`,`display_name`,`label`,`title`,`username`]){let n=e[t];if(typeof n==`string`&&n.trim())return n.trim()}return}if(typeof t!=`string`)return String(t);if(!s(t))return t}},d=[],f=Sb(e.cardFields,y),p=new Set([...t?[t]:[],...n?[n]:[],`name`,`full_name`,`title`,`subject`,`display_name`]),m=[],h=[];if(f.length>0)for(let t of f){if(p.has(t))continue;let n=y?.fields?.[t],i=r[t];if(!tn(i)){if(n?.type===`picklist`||n?.type===`multipicklist`||Array.isArray(n?.options)&&n.options.length>0){let r=n?.options?.find(e=>String(e.value).toLowerCase()===String(i).toLowerCase()),a=r?.label||String(i),o=y?.name||e.objectName,s=o?c(o,t,[{value:String(r?.value??i),label:a}])[0]?.label??a:a,l=Zf(r?.color),u=l?l.className:$f(r?.color,i);if(s===``)continue;m.push({label:s,colorClass:u,colorStyle:l?.style})}else{let r=xp(n??{type:`text`}),a=Np(r),o=(0,Q.jsx)(a,{value:i,field:n??{name:t,type:r}});h.push({field:t,label:l(y?.name||e.objectName||``,t,n?.label||t),node:o})}}}else{let e=[`amount`,`value`,`deal_value`,`expected_value`,`opportunity_value`].find(e=>typeof r[e]==`number`);e&&d.push(a(r[e]));let t=[`company`,`company_name`,`account`,`account_name`,`organization`],n;for(let e of t){let t=u(e);if(t){n=t;break}}n&&(!i||!String(i).includes(n))&&d.push(n);let o=[`owner`,`owner_name`,`assignee`,`assignee_name`],s;for(let e of o){let t=u(e);if(t){s=t;break}}s&&d.push(`@${s}`);for(let e of[`priority`,`severity`,`industry`,`rating`]){let t=r[e];if(t!=null&&t!==``){let n=(y?.fields?.[e])?.options?.find(e=>String(e.value).toLowerCase()===String(t).toLowerCase()),r=n?.label||String(t),i=Zf(n?.color),a=i?i.className:$f(n?.color,t);if(r===``)continue;if(m.push({label:r,colorClass:a,colorStyle:i?.style}),m.length>=2)break}}}let g=r.description,_=(tn(g)||typeof g==`string`&&s(g))&&d.length>0?d.join(` · `):void 0;return{...r,id:r.id||r._id,title:i||A(y,r),..._?{cardSubtitle:_}:{},...h.length>0?{cardFieldCells:h}:{},...!Array.isArray(r.badges)&&m.length>0?{badges:m}:{}}})},[te,e,y]),re=(0,$.useMemo)(()=>{let t=t=>{if(!e.objectName||!e.groupBy)return t;let n=c(e.objectName,e.groupBy,[{value:String(t.id),label:t.title}])[0];return n?.label?{...t,title:n.label}:t};if(e.columns&&e.columns.length>0){if(typeof e.columns[0]==`string`){if(!e.groupBy)return e.columns.map(e=>({id:e,title:e}))}else return e.columns.map(t)}if(e.groupBy&&y?.fields?.[e.groupBy]?.options){let t=y.fields[e.groupBy].options.map(e=>({value:e.value,label:e.label}));return(e.objectName?c(e.objectName,e.groupBy,t):t).map(e=>({id:e.value,title:e.label}))}if(e.groupBy&&I.length>0){let t=new Set(I.map(t=>t[e.groupBy]));return Array.from(t).map(e=>({id:String(e),title:String(e)}))}return[]},[e.columns,e.groupBy,e.objectName,I,y,c]),R=e.swimlaneField||e.grouping?.fields?.[0]?.field,z={...e,data:I,columns:re,className:n||e.className,...R?{swimlaneField:R}:{}},B=e.navigation??{mode:`drawer`},V=a??o;!V&&(B.mode===`drawer`||B.mode===`modal`||B.mode===`split`||B.mode);let H=Rt({navigation:B,objectName:e.objectName,onRowClick:V}),{anchorRef:ie,captureAnchor:ae}=Xe(),U=e.objectName?d(`detail.recordDetailWithLabel`,{label:e.objectName.charAt(0).toUpperCase()+e.objectName.slice(1).replace(/_/g,` `)}):d(`detail.recordDetail`),W=$.useCallback(async(n,r,i,a)=>{let o=e.groupBy,s=e.objectName;if(o&&(f||m(e=>e.map(e=>String(e.id??e._id)===String(n)?{...e,[o]:i}:e)),s&&t?.update))try{await t.update(s,String(n),{[o]:i,...a??{}}),a&&!f&&m(e=>e.map(e=>String(e.id??e._id)===String(n)?{...e,...a}:e))}catch(e){console.warn(`[ObjectKanban] Failed to persist card move`,e),Tt.error(N(e)??(Tn(e)?u(`errors.unauthorized`,`You are not authorized to perform this action.`):pe(e)??u(`table.saveFailed`,`Save failed`))),m(e=>e.map(e=>String(e.id??e._id)===String(n)?{...e,[o]:r}:e))}},[e.groupBy,e.objectName,t,f,u]),[oe,se]=(0,$.useState)(null),[G,K]=(0,$.useState)(!1),ce=$.useCallback(async(t,n,r,i)=>{let a=e.groupBy;if(!a||n===r||r===`__uncolumned__`)return;let o=(Array.isArray(te)?te:[]).find(e=>String(e?.id??e?._id)===String(t)),s=pb(y?.fields,o,a,r);if(s.length>0){se({cardId:t,fromColumnId:n,toColumnId:r,fields:s});return}await W(t,n,r)},[e.groupBy,te,y,W]),le=(0,$.useMemo)(()=>{if(!oe)return[];let t=y?.name||e.objectName||``;return oe.fields.map(e=>{let n=e.def.options,r=t&&Array.isArray(n)?c(t,e.name,n):n,i=typeof e.def.label==`string`?e.def.label:``;return{...e,def:{...e.def,...r?{options:r}:{}},label:l(t,e.name,i||e.name)}})},[oe,y,e.objectName,c,l]);if(S)return(0,Q.jsxs)(`div`,{className:`p-4 border border-destructive/50 rounded bg-destructive/10 text-destructive`,children:[`Error loading kanban data: `,S.message]});let ue=n=>{if(!H.isOverlay||!H.isOpen||!H.selectedRecord)return null;let r=e.objectName,i=H.selectedRecord,a=i.id??i._id;if(!r||a==null)return null;let o=Cb(e),s=o&&i[o]?String(i[o]):U;return(0,Q.jsx)(He,{...H,title:s,mainContent:n,popoverAnchorRef:ie,storageKey:Xt(r),legacyStorageKey:Lt(r),width:H.width??`min(960px, 60vw)`,children:()=>(0,Q.jsx)(`div`,{className:`px-6 pt-6 pb-6`,children:(0,Q.jsx)(ob,{record:i,objectName:r,recordId:a,dataSource:t,objectSchema:y,onClose:H.close,fullPageHref:sb(r,a)??void 0,onFieldSave:async(e,n)=>{t?.update&&(await t.update(r,String(a),{[e]:n}),m(t=>t.map(t=>String(t.id??t._id)===String(a)?{...t,[e]:n}:t)))},onDelete:async()=>{t?.delete&&(await t.delete(r,String(a)),m(e=>e.filter(e=>String(e.id??e._id)!==String(a))))}})})})},de=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(hb.Provider,{value:j,children:(0,Q.jsx)(fb,{objectFields:y?.fields,onCardMove:ce,schema:{...z,countsAreWindowed:ne,onCardClick:(e,t)=>{ae(t),H.handleClick(e,t)}}})}),oe&&(0,Q.jsx)(mb,{open:!0,fields:le,submitting:G,onCancel:()=>se(null),onSubmit:async e=>{let t=oe;K(!0);try{await W(t.cardId,t.fromColumnId,t.toColumnId,e)}finally{K(!1),se(null)}}})]});if(H.isOverlay&&H.mode===`split`&&H.isOpen&&H.selectedRecord){let e=ue(de);if(e)return(0,Q.jsx)(Q.Fragment,{children:e})}return(0,Q.jsxs)(Q.Fragment,{children:[de,ue()]})},Tb=`__uncolumned__`;function Eb(e,t,n,r){let i=e.filter(e=>e!==``);if(i.length===0)return;let a=e=>typeof e==`string`?JSON.stringify(e):String(e),o=n.map(e=>a(e.id)).join(`, `);for(let e of i)console.warn(`[plugin-kanban] ${t[e].length} record(s) with ${JSON.stringify(r)} = ${JSON.stringify(e)} match no lane id and are shown in the trailing "Uncategorized" lane. Lanes match the stored option value by lane id only, never by lane title (objectui#10069). Available lane ids: [${o}].`)}function Db(e,t,n,r,i){let a=e=>{if(!r)return e;let t=e[r];if(!t)return e;let n=typeof t==`string`?t:t?.url;return n?{...e,coverImage:n}:e};if(!t||!n||!Array.isArray(t))return e.map(e=>({...e,cards:(e.cards||[]).map(a)}));let o=Object.create(null);e.forEach(e=>{e.id&&(o[String(e.id).toLowerCase()]=e.id)});let s=t.reduce((e,t)=>{let r=String(t[n]??``),i=o[r.toLowerCase()]??r;return e[i]||(e[i]=[]),e[i].push(a(t)),e},Object.create(null)),c=e.map(e=>({...e,cards:[...(e.cards||[]).map(a),...s[e.id]||[]]})),l=new Set(e.map(e=>typeof e.id==`symbol`?e.id:String(e.id))),u=Object.keys(s).filter(e=>!l.has(e)),d=u.flatMap(e=>s[e]);return Eb(u,s,e,n),d.length>0&&c.push({id:Tb,title:i,cards:d}),c}var Ob={filter:!0,sort:!0,limit:`limit`},kb=Qe(({schema:e,...t})=>{let{dataSource:n}=qe()||{},r=n??void 0;return(0,Q.jsx)(Te,{schema:e,mapping:Ob,dataSource:r,testId:`object-kanban`,errorTitle:`This board’s data source could not be resolved`,children:e=>(0,Q.jsx)(wb,{schema:e,dataSource:r,...t})})});Qt.register(`object-kanban`,kb,{namespace:`plugin-kanban`,label:`Object Kanban`,category:`view`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`columns`,type:`array`},{name:`filter`,type:`array`,description:"Filter criteria in JSON-rules form, narrowing the records the board fetches. Lowered to `$filter` on the query."},{name:`limit`,type:`number`,description:"Row cap — the most records the board fetches, lowered to the query’s top-level `$top` (renderer default 100). The board renders every fetched record into a lane and offers no pagination, so this is the author’s window on the object rather than a page size. PRECEDENCE: a node-level `dataSource` binding’s own `limit` wins outright; the `pagination.pageSize` of a view that binding names fills this key only when the node leaves it unset."},{name:`groupBy`,type:`string`,description:"Record field whose value buckets cards into lanes. Its picklist options become the lanes when `columns` is absent, and a drag between lanes writes the target lane’s value back to the record. A value matching no lane lands in the trailing “Uncategorized” lane rather than disappearing."},{name:`cardTitle`,type:`string`,description:"Record field rendered as the card title. Read AHEAD of `titleField`, which is the legacy spelling of the same choice; when neither yields a value the shared record-display resolver names the card."},{name:`titleField`,type:`string`,description:"Legacy spelling of `cardTitle` — the record field rendered as the card title. `cardTitle` wins when both are authored."},{name:`swimlaneField`,type:`string`,description:"Record field that splits the board into horizontal swimlanes. When absent the board falls back to `grouping.fields[0].field`."},{name:`coverImageField`,type:`string`,description:"Record field holding a card cover image — a URL string, or a file object carrying a `url`. Any other value leaves the card without a cover."},{name:`data`,type:`array`,description:"Inline records to render instead of fetching. Authoring it SUPPRESSES the board’s own query entirely. Members are records: the board reads `id` (or `_id`) as the card identity, the `groupBy` field’s value as the lane, the card-title field, `coverImageField`, and every `cardFields` entry. Records handed down by a parent view and a `bind` expression both take priority over it."},{name:`cardFields`,type:`array`,description:"Record field NAMES rendered as cells on each card, in the order written. Members are bare names, not entry objects. An explicit list wins over the object’s `highlightFields` role; unlike that fallback it is NOT filtered against the object definition, so a name the object no longer declares simply renders no cell. An empty array reads as omitted."},{name:`grouping`,type:`object`,description:"Only `grouping.fields[0].field` is read, and only as the FALLBACK for `swimlaneField`: it names the record field that splits the board into horizontal swimlanes when no `swimlaneField` is authored. An explicit `swimlaneField` wins. Every other position inside `grouping`, later `fields` entries included, is inert on this board."},{name:`conditionalFormatting`,type:`array`,description:"Per-card style rules, each `{ condition, style }` — a CEL `condition` over the card’s own `record.*` and a CSS `style` map, the rule a list view declares. The first matching rule styles that card alone. A rule comparing a relation field sees the stored foreign key rather than the expanded record. The native `{ field, operator, value }` rule and a colour written beside `condition` instead of inside `style` are retired and refused by name (objectui#11522)."},{name:`navigation`,type:`object`,description:"What a card click opens — the `{ mode, size, openNewTab, preventNavigation }` block a list view declares. With the key ABSENT a click opens the record in a drawer. `mode` is an overlay (`drawer`, `modal`, `split`, `popover`), `new_window`, `page` or `none`, and a block written without `mode` takes the spec’s `page` default. `page` opens the record page through the record navigator the host publishes (the console publishes one on its custom pages, record pages and list views); under a host that publishes none, such as an embedded renderer, there is no record page to open and the click opens nothing. `openNewTab: true` opens the record page in a new tab and outranks every mode except `none`, `preventNavigation: true` opens nothing, and `size` sets the overlay width. A click handler from a parent view outranks the whole key."}]});var Ab=new Set([`bar`,`column`,`horizontal-bar`,`line`,`area`,`pie`,`donut`,`funnel`,`radar`,`scatter`,`treemap`,`sankey`,`combo`]),jb=new Set([`gauge`,`solid-gauge`,`metric`,`kpi`,`bullet`]),Mb=new Set([`table`,`pivot`]),Nb=new Set([...Ab,...jb,...Mb]),Pb=new Map([[`chart:bar`,`bar`]]),Fb=`plugin-charts:`;function Ib(e){if(!e)return;let t=e.startsWith(Fb)?e.slice(14):e;return Pb.get(t)}var Lb=e=>!!e&&typeof e==`object`&&!Array.isArray(e),Rb=e=>typeof e==`string`&&e?e:void 0,zb=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0;function Bb(e,t){if(typeof e==`string`||Lb(e))return Rn(e,t)||void 0}function Vb(e,t){if(!Lb(e))return;let n={},r=Rb(e.field);r&&(n.field=r);let i=Rb(e.format);i&&(n.format=i);let a=zb(e.min);a!==void 0&&(n.min=a);let o=zb(e.max);o!==void 0&&(n.max=o);let s=zb(e.stepSize);s!==void 0&&s>0&&(n.stepSize=s),typeof e.showGridLines==`boolean`&&(n.showGridLines=e.showGridLines),typeof e.logarithmic==`boolean`&&(n.logarithmic=e.logarithmic);let c=Rb(e.position);(c===`left`||c===`right`||c===`top`||c===`bottom`)&&(n.position=c);let l=Bb(e.title,t);return l&&(n.title=l),n}function Hb(e,t){if(!Lb(e)){let t=Rb(e);return t?{dataKey:t}:void 0}let n=Rb(e.dataKey)??Rb(e.name);if(!n)return;let r={dataKey:n},i=Bb(e.label,t);i&&(r.label=i);let a=Rb(e.chartType)??Rb(e.type);(a===`bar`||a===`line`||a===`area`)&&(r.chartType=a);let o=Rb(e.variant);(o===`comparison`||o===`current`||o===`primary`)&&(r.variant=o);let s=zb(e.opacity);s!==void 0&&(r.opacity=s);let c=Rb(e.dashArray);c&&(r.dashArray=c);let l=Rb(e.stack);l&&(r.stack=l);let u=Rb(e.yAxis);(u===`left`||u===`right`)&&(r.yAxis=u);let d=Rb(e.color);return d&&(r.color=d),r}function Ub(e,t){let n=t===`horizontal-bar`,r=t===`scatter`?1:2,i=(e??[]).slice(0,r),a=[],o=e=>n?e===`bottom`?`left`:e===`top`?`right`:void 0:e===`left`||e===`right`?e:void 0,s=e=>e===`left`?`right`:`left`,c=i.map(e=>o(e.position)),l=[];if(i.length===1)l.push(c[0]??`left`);else if(i.length===2){let[e,t]=c;e&&t?l.push(e,e===t?s(e):t):e?l.push(e,s(e)):t?l.push(s(t),t):l.push(`left`,`right`)}i.forEach((e,t)=>{e.position&&(c[t]?c[t]!==l[t]&&a.push({index:t,position:e.position,reason:`taken`,drawn:l[t]}):a.push({index:t,position:e.position,reason:`side`,drawn:l[t]}))});let u=r===1?l[0]:`right`,d={slotOf:l,notes:a,undrawn:(e??[]).slice(i.length).map((e,t)=>({index:i.length+t,boundTo:u}))};return l.forEach((e,t)=>{d[e]=t}),d}function Wb(e,t){if(!Lb(e))return{};let n={},r=Rb(e.type),i=Rb(e.chartType)??Rb(e.specType)??(r&&Nb.has(r)?r:void 0)??Ib(r);i&&(n.chartType=i);let a=e.xAxis,o=Vb(a,t);o&&Object.keys(o).some(e=>e!==`field`)&&(n.xAxis=o);let s=Rb(e.xAxisKey)??o?.field??Rb(a);s&&(n.xAxisKey=s);let c=(Array.isArray(e.yAxis)?e.yAxis:e.yAxis===void 0?[]:[e.yAxis]).map(e=>Vb(e,t)??(Rb(e)?{field:Rb(e)}:void 0)).filter(e=>!!e);c.length&&(n.yAxes=c);let l=(Array.isArray(e.series)?e.series:Array.isArray(e.categories)?e.categories:void 0)?.map(e=>Hb(e,t)).filter(e=>!!e);if(!l?.length){let e=Ub(c,i),t=[...e.slotOf,...e.undrawn.map(e=>e.boundTo)],n=c.map((e,n)=>({a:e,slot:t[n],i:n})).filter(({a:e})=>e.field).map(({a:e,slot:t,i:n})=>({dataKey:e.field,...e.title?{label:e.title}:{},...t===`right`||n>0?{yAxis:t}:{}}));n.length&&(l=n)}l?.length&&(n.series=l),typeof e.showLegend==`boolean`&&(n.showLegend=e.showLegend),typeof e.showDataLabels==`boolean`&&(n.showDataLabels=e.showDataLabels);let u=Bb(e.title,t);u&&(n.title=u);let d=Bb(e.subtitle,t);d&&(n.subtitle=d);let f=Bb(e.description,t);f&&(n.description=f);let p=zb(e.height);return p!==void 0&&p>0&&(n.height=p),Array.isArray(e.annotations)&&e.annotations.length&&(n.annotations=e.annotations.filter(Lb)),Lb(e.interaction)&&(n.interaction=e.interaction),n}function Gb(e){if(e===`bar`||e===`column`)return`bar`;if(e===`line`)return`line`;if(e===`area`)return`area`}function Kb(e,t){if(e===`combo`)return`combo`;let n=Gb(e);if(!n||!t||t.length<2)return e;let r=t.map(e=>e.chartType??n);return new Set(r).size>1?`combo`:e}function qb(e,t){if(!e)return;let n=e.includes(`%`),r=/^([$£€¥₹])/.exec(e),i=e.includes(`,`),a=/\.(0+)/.exec(e)?.[1].length??0,o={$:`USD`,"£":`GBP`,"€":`EUR`,"¥":`CNY`,"₹":`INR`};if(!n&&!r&&!i&&a===0)return;let s={minimumFractionDigits:a,maximumFractionDigits:a,useGrouping:i};return n?s.style=`percent`:r&&(s.style=`currency`,s.currency=o[r[1]]??`USD`),e=>{let n=typeof e==`number`?e:Number(e);if(!Number.isFinite(n))return e==null?``:String(e);try{return new Intl.NumberFormat(t,s).format(n)}catch{return String(n)}}}var Jb=200;function Yb(e,t){let n=e?.stepSize;if(!n||n<=0)return;let r=t.filter(e=>Number.isFinite(e)),i=r.length?Math.min(...r):void 0,a=r.length?Math.max(...r):void 0,o=e.min??Math.min(0,i??0),s=e.max??a;if(s===void 0||!Number.isFinite(o)||!Number.isFinite(s)||s<o)return;let c=Math.floor(o/n)*n,l=e.max===void 0?Math.ceil(s/n)*n:e.max,u=Math.floor((l-c)/n+1e-9)+1;if(u<1||u>Jb)return;let d=[];for(let e=0;e<u;e++)d.push(Number((c+e*n).toPrecision(12)));return e.max!==void 0&&d[d.length-1]<e.max&&d.push(e.max),d}function Xb(e){if(!e)return;let{min:t,max:n}=e;if(t!==void 0||n!==void 0)return[t??`auto`,n??`auto`]}var Zb=$.lazy(()=>X(()=>import(`./ChartImpl-07YoXw1-.js`),[])),Qb=$.lazy(()=>X(()=>import(`./AdvancedChartImpl-Cbz0k4EW.js`),[])),$b=({schema:e})=>(0,Q.jsx)($.Suspense,{fallback:(0,Q.jsx)(w,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,Q.jsx)(Zb,{data:e.data,dataKey:e.dataKey,xAxisKey:e.xAxisKey,height:e.height,className:e.className,color:e.color})}),ex=({schema:e,onChartClick:t})=>{let{language:n}=In(),r=$.useMemo(()=>{let t=Wb(e,n),r=Array.isArray(e.series)?e.series:void 0,i=t.series??r,a=e.xAxisKey??t.xAxisKey,o=e.config;if(!o&&i){let t=e.colors||[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`],n={};i.forEach((e,r)=>{n[e.dataKey]={label:e.label||e.dataKey,color:e.color||t[r%t.length]}}),o=n}return{chartType:e.chartType??t.chartType,data:Array.isArray(e.data)?e.data:[],config:o,xAxisKey:a,series:i,className:e.className,spec:t}},[e,n]);return(0,Q.jsx)($.Suspense,{fallback:(0,Q.jsx)(w,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,Q.jsx)(Qb,{chartType:r.chartType,data:r.data,config:r.config,xAxisKey:r.xAxisKey,series:r.series,className:r.className,colors:Array.isArray(e.colors)?e.colors:void 0,categoryColors:e.categoryColors,categoryOrder:e.categoryOrder,isAnimationActive:e.isAnimationActive,onChartClick:t,xAxis:r.spec.xAxis,yAxes:r.spec.yAxes,showLegend:r.spec.showLegend,showDataLabels:r.spec.showDataLabels,title:r.spec.title,subtitle:r.spec.subtitle,description:r.spec.description,height:r.spec.height??e.height,annotations:r.spec.annotations,interaction:r.spec.interaction})})};function tx(e){return ta(e,e.function||`count`)}var nx=[`aggregate.groupBy`,`xAxisKey`,`xAxis.field`];function rx(e){let t=e?.aggregate?.groupBy;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t.field;return typeof e==`string`&&e?e:void 0}return typeof t==`string`&&t?t:Wb(e).xAxisKey}var ix=`__comparison`;function ax(e){let t=e?.groupBy;return t&&typeof t==`object`&&!Array.isArray(t)?t.alias||t.field:typeof t==`string`?t:void 0}function ox(e,t){let{field:n,function:r,groupBy:i}=t,a=tx(t),o={};for(let t of e){let e=String(t[i]??`Unknown`);o[e]||(o[e]=[]),o[e].push(t)}return Object.entries(o).map(([e,t])=>{let o=n?t.map(e=>Number(e[n])||0):[],s;switch(r){case`count`:s=t.length;break;case`avg`:s=o.length>0?o.reduce((e,t)=>e+t,0)/o.length:0;break;case`min`:s=o.length>0?Math.min(...o):0;break;case`max`:s=o.length>0?Math.max(...o):0;break;default:s=o.reduce((e,t)=>e+t,0)}return{[i]:e,[a]:s}})}async function sx(e,t,n,r,i){if(!e.length||!t)return e;let a=i||((e,t)=>t),o=`__raw_${t}`,s=n?.fields?.[t];if(!s){let n=/^\d{4}-\d{2}-\d{2}/;return e.map(e=>{let r=e[t],i=String(r??``),s=n.test(i)?i:_a(i);return{...e,[t]:a(i,s),[o]:r}})}let c=s.type;if(c===`select`||c===`picklist`||c===`dropdown`){let n=s.options||[];if(n.length===0)return e.map(e=>{let n=e[t],r=String(n??``),i=_a(r);return{...e,[t]:a(r,i),[o]:n}});let r={};for(let e of n)typeof e==`string`?r[e]=e:e&&typeof e==`object`&&(r[String(e.value)]=e.label||String(e.value));return e.map(e=>{let n=e[t],i=String(n??``),s=r[i]||_a(i);return{...e,[t]:a(i,s),[o]:n}})}if(c===`lookup`||c===`master_detail`){let n=s.reference;if(!n||!r||typeof r.find!=`function`)return e.map(e=>({...e,[o]:e[t]}));let i=[...new Set(e.map(e=>e[t]).filter(e=>e!=null))];if(i.length===0)return e.map(e=>({...e,[o]:e[t]}));let a=s.id_field||`id`;try{let c=$r(await r.find(n,{$filter:{[a]:{$in:i}},$top:i.length})),l=s.displayField||s.reference_field||`name`,u={};for(let e of c){let t=String(e[a]??e.id??e._id??``),n=e[l]||e.name||e.label||e.title||t;t&&(u[t]=String(n))}return e.map(e=>{let n=e[t],r=String(n??``);return{...e,[t]:u[r]||r,[o]:n}})}catch(n){return console.warn(`[ObjectChart] Failed to resolve lookup labels:`,n),e.map(e=>({...e,[o]:e[t]}))}}if(c===`date`||c===`datetime`||c===`date_time`||c===`timestamp`||c===`time`)return e.map(e=>({...e,[o]:e[t]}));let l=/^\d{4}-\d{2}-\d{2}/;return e.map(e=>{let n=e[t],r=String(n??``);return{...e,[t]:l.test(r)?r:_a(r),[o]:n}})}var cx=e=>{let{schema:t}=e,n=e.onSegmentClick,r=(0,$.useContext)(ln),i=e.dataSource||r?.dataSource,a=r?.apiFetch,o=bn(t.bind),{fieldOptionLabel:s}=Ze(),[c,l]=(0,$.useState)([]),[d,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(void 0),[g,_]=(0,$.useState)(()=>!(Array.isArray(t.data)&&t.data.length>0)&&(!!t.objectName||!!t.dataset)),[v,y]=(0,$.useState)(null),[b,x]=(0,$.useState)(null),[S,C]=(0,$.useState)(null),{openRecordList:w}=Le(),T=Dn(),{t:E,language:D}=In(),O=(0,$.useMemo)(()=>Wb(t,D).chartType,[t,D]),k=(0,$.useMemo)(()=>t.aggregate?JSON.stringify(t.aggregate):``,[t.aggregate]),A=(0,$.useMemo)(()=>t.filter?JSON.stringify(t.filter):``,[t.filter]),j=(0,$.useMemo)(()=>t.compareTo?JSON.stringify(t.compareTo):``,[t.compareTo]),M=(0,$.useMemo)(()=>t.dataset?JSON.stringify({d:t.dataset,dim:t.dimensions??[],val:t.values??[]}):``,[t.dataset,t.dimensions,t.values]);(0,$.useEffect)(()=>{let e=!1;return(async()=>{try{let n=a??fetch,r={headers:{accept:`application/json`},credentials:`include`},i=t.objectName,o,s=null;if(i)o=rx(t);else if(t.dataset){let e=Array.isArray(t.dimensions)&&t.dimensions.length?t.dimensions[0]:void 0,a=await(await n(`/api/v1/meta/dataset/${encodeURIComponent(t.dataset)}`,r)).json().catch(()=>null);s=a?.item??a?.data??a,i=s?.object,o=((s?.dimensions||[]).find(t=>t?.name===e)??(s?.dimensions||[])[0])?.field??e}if(!i||!o){e||C(null);return}let c=async e=>{let t=await(await n(`/api/v1/meta/object/${encodeURIComponent(e)}`,r)).json().catch(()=>null);return t?.item??t?.data??t},l={};if(t.dataset&&Array.isArray(t.dimensions))for(let e of t.dimensions)l[e]=(s?.dimensions||[]).find(t=>t?.name===e)?.field??e;let u=await ea(c,i,[o,...Object.values(l)]);e||C({metaByPath:u,colorPath:o,fieldByDim:t.dataset&&Array.isArray(t.dimensions)?l:null})}catch{e||C(null)}})(),()=>{e=!0}},[t.objectName,t.dataset,M,k,t.xAxisKey,a]);let{fieldOptionColors:ee,dimensionLabels:N}=(0,$.useMemo)(()=>{if(!S)return{fieldOptionColors:null,dimensionLabels:null};let{metaByPath:e,colorPath:t,fieldByDim:n}=S,r=Ki(e[t]?.options,Qi(e[t],s)),i=$i(e,n?Object.entries(n).map(([e,t])=>({dim:e,path:t})):null,s);return{fieldOptionColors:Ui(r),dimensionLabels:i}},[S,s]),P=(0,$.useCallback)(async(e,n)=>{if(t.aggregate&&typeof e.aggregate==`function`){let r=t.aggregate.groupBy;if(na(r)){let i=await e.aggregate(t.objectName,ra(t.aggregate,r,n));return Array.isArray(i)?i:[]}let i=await e.aggregate(t.objectName,{field:t.aggregate.field,function:t.aggregate.function,groupBy:r,filter:n});return Array.isArray(i)?i:[]}if(typeof e.find==`function`){let r=$r(await e.find(t.objectName,{$filter:n})),i=ax(t.aggregate);return t.aggregate&&i&&r.length>0&&(r=ox(r,{...t.aggregate,groupBy:i})),r}return[]},[t.objectName,k]),F=an(),te=(0,$.useCallback)(async(e,n)=>{if(!e||!t.objectName&&!t.dataset){n.current&&_(!1);return}n.current&&(_(!0),y(null));try{if(t.dataset&&typeof e.queryDataset==`function`){let r=u(t.filter,F),i=await e.queryDataset(t.dataset,{dimensions:Array.isArray(t.dimensions)?t.dimensions:[],measures:Array.isArray(t.values)?t.values:[],...r?{runtimeFilter:r}:{}});n.current&&(l(Array.isArray(i?.rows)?i.rows:[]),p(Array.isArray(i?.fields)?i.fields:null),h(typeof i?.object==`string`&&i.object?i.object:void 0));return}let r=u(t.filter,F),i=t.compareTo,a=!!i&&!aa(O),o=a?Et(Ti(t.filter,i),F):null,[c,d]=await Promise.all([P(e,r),o?P(e,o):Promise.resolve([])]),f=c,m=ax(t.aggregate)||t.xAxisKey;if(a&&d.length>0&&t.aggregate){let e=t.aggregate.field,n=t.aggregate.function,r=tx(t.aggregate),i=t=>{if(t==null)return null;if(e){let r=`${e}_${n}`;if(r in t)return Number(t[r]);if(n===`count`&&`${e}_count`in t)return Number(t[`${e}_count`])}return r in t?Number(t[r]):`value`in t?Number(t.value):`count`in t?Number(t.count):null},a=`${r}${ix}`,o=m;if(o&&f.some(e=>e[o]!=null)&&d.some(e=>e[o]!=null)){let e=new Map;for(let t of d){let n=String(t[o]??``);e.set(n,i(t))}f=f.map(t=>{let n=String(t[o]??``),r=e.get(n);return r==null?t:{...t,[a]:r}});let t=new Set(f.map(e=>String(e[o]??``)));for(let e of d){let n=String(e[o]??``);t.has(n)||f.push({[o]:n,[a]:i(e)})}}else{let e=Math.max(f.length,d.length),t=[];for(let n=0;n<e;n++){let e=f[n]||{},r=d[n];t.push(r?{...e,[a]:i(r)}:e)}f=t}}if(m&&t.objectName&&typeof e.getObjectSchema==`function`){let n=t.objectName;try{let t=await e.getObjectSchema(n);f=await sx(f,m,t,e,(e,t)=>s(n,m,e,t))}catch{}}n.current&&l(f)}catch(e){console.error(`[ObjectChart] Fetch error:`,e),n.current&&y(e instanceof Error?e.message:`Failed to load chart data`)}finally{n.current&&_(!1)}},[t.objectName,M,k,A,j,t.xAxisKey,O,P,F,s]),ne=!!(t.objectName||t.dataset)&&!o&&!t.data,I=L(ne?t.dataset?m:t.objectName:void 0);(0,$.useEffect)(()=>{let e={current:!0};return ne?te(i,e):e.current&&_(!1),()=>{e.current=!1}},[t.objectName,M,i,o,t.data,A,k,j,te,I]);let R=o||t.data||c,z=Array.isArray(R)?R:[],B=t.drillDown,V=ax(t.aggregate)||t.xAxisKey,H=(0,$.useMemo)(()=>{if(!V)return new Map;let e=new Map,t=`__raw_${V}`;for(let n of z){let r=n?.[V];if(r==null)continue;let i=t in(n||{})?n[t]:r;e.set(String(r),i)}return e},[z,V]),ie=(0,$.useMemo)(()=>{if(b)try{return{ok:!0,filter:Si(t.filter,yi(B,b,{groupByField:V}))}}catch(e){if(!(e instanceof kt))throw e;return{ok:!1,refusal:e}}},[b,B,V,A]),ae=ie?.ok?ie.filter:void 0,U=ie?.ok===!1,W=ie?.ok===!1?ie.refusal.message:void 0;(0,$.useEffect)(()=>{W&&console.warn(`[ObjectChart] drill-down refused — the drilled list cannot be scoped: ${W}`)},[W]);let oe=!n&&!!b&&!U&&!!t.objectName&&B?.target===`navigate`&&!!w;(0,$.useEffect)(()=>{oe&&(w(t.objectName,ae),x(null))},[oe]);let se=t.compareTo,G=t.aggregate?tx(t.aggregate):void 0,K=G?`${G}${ix}`:void 0,ce=!!se&&!aa(O)&&!!K&&z.some(e=>e[K]!=null),le=(0,$.useMemo)(()=>{let e=Array.isArray(t.series)?t.series:null;if(!ce)return e;let n=e||[{dataKey:G}],r={vsLastWeek:`Previous week`,vsLastMonth:`Previous month`,vsLastQuarter:`Previous quarter`,vsLastYear:`Previous year`,vsYesterday:`Yesterday`,vsPreviousPeriod:`Previous period`}[Ei(se,t.filter)]||`Previous period`;return[...n.map(e=>({...e,variant:e.variant||`current`})),{dataKey:K,label:r,variant:`comparison`}]},[ce,t.series,G,K,t.filter,se]),ue=t.dataset?Vi(Hi(z,N),t.dimensions,t.values,d,{nullCategoryLabel:T(`chart.nullCategory`,`(None)`),builtinAggregateLabels:va(T)}):null,fe=!!o||Array.isArray(t.data),pe=!!t.objectName&&!t.dataset&&!fe,me=pe&&!Wb(t,D).xAxisKey?ax(t.aggregate):void 0,he=ue?{...t,data:ue.data,xAxisKey:ue.xAxisKey,series:ue.series}:{...t,data:z,...me?{xAxisKey:me}:{},...le?{series:le}:{}},ge=t.colors&&!Array.isArray(t.colors)&&typeof t.colors==`object`?t.colors:null,_e=Array.isArray(t.colors)?t.colors:void 0,q=ee||ge?{...ee||{},...ge||{}}:void 0,ve={...he,colors:_e,...q?{categoryColors:q}:{}};if(pe&&!rx(t))return(0,Q.jsxs)(`div`,{className:`p-4 text-destructive `+(t.className||``),"data-testid":`chart-missing-category-axis`,role:`alert`,children:[T(`chart.unconfigured.noCategoryAxis`,`Chart category axis required — an object-bound chart will not invent one. Declare one of:`),` `,nx.map((e,t)=>(0,Q.jsxs)($.Fragment,{children:[t>0?`, `:``,(0,Q.jsx)(`code`,{className:`font-mono`,children:e})]},e))]});if(g&&z.length===0)return(0,Q.jsxs)(`div`,{className:`p-2 `+(t.className||``),"data-testid":`chart-loading`,role:`status`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,Q.jsx)(`span`,{className:`sr-only`,children:`Loading chart data…`}),(0,Q.jsx)(yt,{className:`h-full`})]});if(v)return(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 p-4 `+(t.className||``),"data-testid":`chart-error`,role:`alert`,children:[(0,Q.jsx)(er,{className:`h-6 w-6 text-destructive opacity-60`}),(0,Q.jsx)(`p`,{className:`text-xs text-destructive font-medium`,children:`Failed to load chart data`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground max-w-xs text-center`,children:v})]});if(!i&&t.objectName&&z.length===0)return(0,Q.jsxs)(`div`,{className:`flex items-center justify-center text-muted-foreground text-sm p-4 `+(t.className||``),"data-testid":`chart-no-datasource`,children:[`No data source available for “`,t.objectName,`”`]});if((t.objectName||t.dataset)&&!o&&!t.data&&z.length===0)return(0,Q.jsx)(Ft,{role:`status`,"data-testid":`chart-empty-state`,className:`h-full w-full gap-2 p-4 [&>h3]:text-sm [&>h3]:font-medium [&>p]:text-xs `+(t.className||``),icon:(0,Q.jsx)(dr,{className:`h-5 w-5 text-muted-foreground/70`}),iconWrapperClassName:`flex size-9 items-center justify-center rounded-lg bg-muted`,title:T(`dashboard.empty.title`,`No data yet`),description:T(`dashboard.empty.message`,`This widget loaded successfully and its query returned no records yet.`),children:(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground/80`,"data-testid":`chart-empty-source`,children:[(0,Q.jsx)(`span`,{children:T(`dashboard.empty.sourceLabel`,`Source:`)}),` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:t.dataset||t.objectName})]})});let ye=xi(B)?e=>{let t=e.category,n=t!=null&&H.has(String(t))?H.get(String(t)):t;x({...e,category:n,categoryLabel:t,scope:`cell`})}:void 0,be=n??ye,xe=!n&&b&&!U&&t.objectName&&!oe?(()=>{let e=ae??{},n=bi(B,b,Rn(t.title,D)||`Details`),r=B?.target??`drawer`,a={type:`object-data-table`,objectName:t.objectName,filter:e,pagination:!0,pageSize:B?.maxRows,columns:B?.columns?.map(e=>({accessorKey:e,header:e})),drillDown:{enabled:!0,mode:`record`,target:`dialog`}},o=(0,Q.jsx)(`div`,{className:`overflow-auto`,"data-testid":`chart-drill-body`,children:(0,Q.jsx)(Ht,{schema:a,dataSource:i})}),s=w&&t.objectName?(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`drill-open-in-list`,onClick:()=>{w(t.objectName,e),x(null)},children:[T(`dashboard.openInList`,`Open in list`),(0,Q.jsx)(Oa,{className:`ml-1 h-3.5 w-3.5`})]}):null;return r===`dialog`?(0,Q.jsx)(nn,{open:!0,onOpenChange:e=>!e&&x(null),children:(0,Q.jsxs)(It,{className:`max-w-4xl`,children:[(0,Q.jsxs)(Ge,{className:`flex-row items-center justify-between gap-4 pr-8`,children:[(0,Q.jsx)(Bt,{children:n}),s]}),o]})}):(0,Q.jsx)(re,{open:!0,onOpenChange:e=>!e&&x(null),children:(0,Q.jsxs)(de,{side:`right`,className:`w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col`,children:[(0,Q.jsxs)(Cn,{className:`flex-row items-center justify-between gap-4 pr-8`,children:[(0,Q.jsx)(f,{children:n}),s]}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-hidden mt-2`,children:o})]})})})():null;return(0,Q.jsxs)(`div`,{className:`relative h-full`,children:[(0,Q.jsx)(qt,{active:g&&z.length>0,ariaLabel:E(`chart.refreshing`)}),(0,Q.jsx)(ex,{...e,schema:ve,onChartClick:be}),xe]})},lx={filter:!0},ux=Qe(e=>(0,Q.jsx)(Te,{schema:e.schema,mapping:lx,dataSource:e.dataSource,testId:`object-chart`,errorTitle:`This chart’s data source could not be resolved`,children:t=>(0,Q.jsx)(cx,{...e,schema:t})}));Qt.register(`object-chart`,ux,{namespace:`plugin-charts`,label:`Object Chart`,category:`view`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`data`,type:`array`,description:`Optional static data`},{name:`filter`,type:`array`},{name:`aggregate`,type:`object`,description:`Aggregation config: { field, function, groupBy }`},{name:`drillDown`,type:`object`,description:`Segment drill config: { enabled?, filter?, title?, target?: 'drawer' | 'dialog', columns?, maxRows? }. Present = on; {} is enough. Clicking a segment opens the underlying records filtered by the clicked category.`}]}),Qt.register(`bar-chart`,$b,{namespace:`plugin-charts`,label:`Bar Chart`,category:`plugin`,inputs:[{name:`data`,type:`array`,required:!0},{name:`dataKey`,type:`string`},{name:`xAxisKey`,type:`string`},{name:`height`,type:`number`},{name:`color`,type:`color`}],defaultProps:{data:[{name:`Jan`,value:400},{name:`Feb`,value:300},{name:`Mar`,value:600},{name:`Apr`,value:800},{name:`May`,value:500}],dataKey:`value`,xAxisKey:`name`,height:400,color:`#8884d8`}}),Qt.register(`chart`,ux,{namespace:`view`,category:`view`,label:`Chart`,skipFallback:!0,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`type`,type:`string`},{name:`categoryField`,type:`string`},{name:`valueField`,type:`string`}]}),Qt.register(`chart`,ex,{namespace:`plugin-charts`,label:`Chart`,category:`plugin`,inputs:[{name:`chartType`,type:`enum`,enum:[{label:`Bar`,value:`bar`},{label:`Line`,value:`line`},{label:`Area`,value:`area`},{label:`Pie`,value:`pie`},{label:`Donut`,value:`donut`},{label:`Radar`,value:`radar`},{label:`Scatter`,value:`scatter`}]},{name:`data`,type:`code`,required:!0},{name:`config`,type:`code`},{name:`xAxisKey`,type:`string`},{name:`series`,type:`code`,required:!0},{name:`className`,type:`string`}],defaultProps:{chartType:`bar`,data:[{name:`Jan`,sales:400,revenue:240},{name:`Feb`,sales:300,revenue:139},{name:`Mar`,sales:600,revenue:380},{name:`Apr`,sales:800,revenue:430},{name:`May`,sales:500,revenue:220}],config:{sales:{label:`Sales`,color:`#8884d8`},revenue:{label:`Revenue`,color:`#82ca9d`}},xAxisKey:`name`,series:[{dataKey:`sales`},{dataKey:`revenue`}]}}),Qt.register(`chart:bar`,ex,{namespace:`plugin-charts`,label:`Bar Chart (Alias)`,category:`plugin`});var dx=e=>e?ht(e):null,fx=({item:e,currentPath:t,isSidebarOpen:n,onNavigate:r,level:i=0})=>{let a=t===e.path,o=e.children?.some(e=>e.path===t),[s,c]=$.useState(o),l=dx(e.icon);return $.useEffect(()=>{o&&c(!0)},[o]),e.children&&e.children.length>0?(0,Q.jsxs)($t,{open:s,onOpenChange:c,className:`w-full`,children:[(0,Q.jsxs)(At,{className:`flex w-full items-center justify-between py-2 text-sm font-medium rounded-md transition-colors text-muted-foreground hover:bg-muted hover:text-foreground ${n?`px-3`:`justify-center px-2 cursor-pointer`}`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center overflow-hidden`,children:[l&&(0,Q.jsx)(l,{className:`h-4 w-4 shrink-0 ${n?`mr-3`:``}`}),(0,Q.jsx)(`span`,{className:`whitespace-nowrap overflow-hidden transition-all duration-300 ${n?`opacity-100 w-auto`:`opacity-0 w-0 hidden`}`,children:e.label})]}),n&&(0,Q.jsx)(Zn,{className:`h-4 w-4 transition-transform ${s?`rotate-180`:``}`})]}),(0,Q.jsx)($e,{className:`space-y-1 overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down`,children:n&&e.children.map((e,a)=>(0,Q.jsx)(fx,{item:e,currentPath:t,isSidebarOpen:n,onNavigate:r,level:i+1},a))})]}):(0,Q.jsxs)(`a`,{href:e.path||`#`,onClick:t=>e.path&&r(t,e.path),title:n?void 0:e.label,className:`flex items-center py-2 text-sm font-medium rounded-md transition-colors ${a?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`} ${n?`px-3`:`justify-center px-2`} ${i>0&&n?`pl-10`:``}`,children:[l&&(0,Q.jsx)(l,{className:`h-4 w-4 shrink-0 ${n?`mr-3`:``} ${a?`text-primary-foreground`:`text-muted-foreground group-hover:text-foreground`}`}),(0,Q.jsx)(`span`,{className:`whitespace-nowrap overflow-hidden transition-all duration-300 ${n?`opacity-100 w-auto`:`opacity-0 w-0 hidden`}`,children:e.label})]})},px=({app:e,children:t,currentPath:n,onNavigate:r})=>{let i=e.layout||`sidebar`,[a,o]=$.useState(!0),[s,c]=$.useState(`light`);$.useEffect(()=>{let e=localStorage.getItem(`theme`)===`dark`||!(`theme`in localStorage)&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;c(e?`dark`:`light`)},[]),$.useEffect(()=>{s===`dark`?(document.documentElement.classList.add(`dark`),localStorage.setItem(`theme`,`dark`)):(document.documentElement.classList.remove(`dark`),localStorage.setItem(`theme`,`light`))},[s]);let l=()=>{c(e=>e===`dark`?`light`:`dark`)},u=(e,t)=>{e.preventDefault(),r?r(t):window.location.href=t};if(i===`empty`)return(0,Q.jsx)(`main`,{className:e.className,children:t});let d=e.branding?.logo,f=dx(e.icon);return(0,Q.jsxs)(`div`,{className:`flex min-h-screen w-full bg-background ${e.className||``}`,children:[i===`sidebar`&&(0,Q.jsxs)(`aside`,{className:`
|
|
22
|
-
shrink-0 border-r bg-background hidden md:flex flex-col h-screen sticky top-0 z-30 transition-all duration-300 ease-in-out
|
|
23
|
-
${a?`w-64`:`w-[70px]`}
|
|
24
|
-
`,children:[(0,Q.jsxs)(`div`,{className:`h-14 flex items-center border-b font-semibold text-lg tracking-tight transition-all ${a?`px-6`:`justify-center px-0`}`,children:[d?(0,Q.jsx)(`img`,{src:d,alt:e.title,className:`h-6 w-auto`}):f?(0,Q.jsx)(f,{className:`h-6 w-6`}):(0,Q.jsx)(qn,{className:`h-6 w-6`}),(0,Q.jsx)(`span`,{className:`ml-2 whitespace-nowrap overflow-hidden transition-all duration-300 ${a?`opacity-100 w-auto`:`opacity-0 w-0 hidden`}`,children:e.title||e.name||`Object UI`})]}),(0,Q.jsx)(`nav`,{className:`flex-1 p-2 space-y-1 overflow-y-auto overflow-x-hidden`,children:e.menu?.map((e,t)=>(0,Q.jsx)(fx,{item:e,currentPath:n,isSidebarOpen:a,onNavigate:u},t))})]}),(0,Q.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:[(0,Q.jsxs)(`header`,{className:`h-14 flex items-center justify-between px-4 md:px-6 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border-b z-20 sticky top-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>o(!a),className:`p-2 -ml-2 text-muted-foreground hover:bg-muted hover:text-foreground rounded-md transition-colors`,children:(0,Q.jsx)(ko,{className:`h-5 w-5`})}),(0,Q.jsxs)(`div`,{className:`relative hidden md:block w-96`,children:[(0,Q.jsx)(vr,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground`}),(0,Q.jsx)(`input`,{type:`text`,placeholder:`Search...`,className:`w-full h-9 pl-9 pr-4 rounded-md border border-input bg-background text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:l,className:`p-2 text-muted-foreground hover:text-foreground transition-colors rounded-md hover:bg-muted`,title:`Switch to ${s===`dark`?`light`:`dark`} mode`,children:s===`dark`?(0,Q.jsx)(ms,{className:`h-5 w-5`}):(0,Q.jsx)(Fo,{className:`h-5 w-5`})}),(0,Q.jsxs)(`button`,{type:`button`,className:`relative p-2 text-muted-foreground hover:text-foreground transition-colors`,children:[(0,Q.jsx)(Ba,{className:`h-5 w-5`}),(0,Q.jsx)(`span`,{className:`absolute top-1.5 right-1.5 h-2 w-2 bg-red-600 rounded-full border-2 border-background`})]})]})]}),(0,Q.jsx)(`main`,{className:`flex-1 overflow-auto p-4 md:p-8 scroll-smooth`,children:(0,Q.jsx)(`div`,{className:`mx-auto max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500`,children:t})})]})]})},mx=class{appGlob=Object.assign({});pagesGlob=Object.assign({});rootGlob=Object.assign({});async loadAppConfig(){let e=`../app-data/app.json`;if(this.appGlob[e]){let t=await this.appGlob[e]();return t.default||t}return null}async loadPage(e){let t=e.replace(/^\//,``)||`index`;return await this.tryLoad(`../app-data/pages/${t}.json`)?await this.loadKey(`../app-data/pages/${t}.json`):await this.tryLoad(`../app-data/pages/${t}/index.json`)?await this.loadKey(`../app-data/pages/${t}/index.json`):t===`index`&&await this.tryLoad(`../app-data/index.json`)?await this.loadKey(`../app-data/index.json`):null}async tryLoad(e){return!!(this.pagesGlob[e]||this.rootGlob[e])}async loadKey(e){let t=this.pagesGlob[e]||this.rootGlob[e];if(!t)return null;let n=await t();return n.default||n}},hx=class{baseUrl;constructor(e=`/api`){this.baseUrl=e}async loadAppConfig(){try{let e=await fetch(`${this.baseUrl}/app.json`);return e.ok?await e.json():null}catch{return null}}async loadPage(e){try{let t=e===`/`?`/index`:e,n=await fetch(`${this.baseUrl}/pages${t}.json`);return n.ok?await n.json():null}catch{return null}}};function gx(e,t){if(!t||t===`?`)return e;let n=e.indexOf(`#`),r=n===-1?``:e.slice(n),i=n===-1?e:e.slice(0,n),a=i.indexOf(`?`);if(a===-1)return`${i}${t.startsWith(`?`)?t:`?${t}`}${r}`;let o=new URLSearchParams(i.slice(a+1)),s=new Set(o.keys());for(let[e,n]of new URLSearchParams(t))s.has(e)||o.append(e,n);let c=o.toString();return`${i.slice(0,a)}${c?`?${c}`:``}${r}`}function _x(){let[e,t]=(0,$.useState)(null),[n,r]=(0,$.useState)(null),[i,a]=(0,$.useState)(window.location.pathname),[o,s]=(0,$.useState)(null),[c,l]=(0,$.useState)(!0),u=(0,$.useMemo)(()=>{let e=new URLSearchParams(window.location.search).get(`api`);return e?new hx(e):new mx},[]);(0,$.useEffect)(()=>{(async()=>{try{let e=await u.loadAppConfig();e&&t(e)}catch(e){console.error(`Error loading app config`,e)}})()},[u]);let d=(0,$.useCallback)(e=>{window.history.pushState({},``,gx(e,window.location.search)),a(e),window.scrollTo(0,0)},[]);if((0,$.useEffect)(()=>{let e=()=>a(window.location.pathname);return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,$.useEffect)(()=>{(async()=>{l(!0),s(null);try{let e=await u.loadPage(i);e?r(e):(s(`Page not found: ${i}`),r(null))}catch(e){console.error(e),s(`Failed to load page.`)}finally{l(!1)}})()},[i,u]),!e&&c)return(0,Q.jsxs)(`div`,{className:`flex h-screen items-center justify-center text-slate-400`,children:[(0,Q.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-slate-200 border-t-slate-600 mr-2`}),`Loading App...`]});let f;return f=c?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-slate-400 min-h-[50vh]`,children:[(0,Q.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-slate-200 border-t-slate-600 mr-2`}),`Loading Page...`]}):o||!n?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full p-12 text-red-600`,children:[(0,Q.jsx)(`h1`,{className:`text-2xl font-bold`,children:`404`}),(0,Q.jsx)(`p`,{className:`mt-2 text-slate-600`,children:o||`Page not found`}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>d(`/`),className:`mt-4 text-blue-600 hover:underline`,children:`Go Home`})]}):(0,Q.jsx)(Ht,{schema:n}),e?(0,Q.jsx)(px,{app:e,currentPath:i,onNavigate:d,children:f}):(0,Q.jsx)(`div`,{className:`object-ui-app`,children:f})}vs.createRoot(document.getElementById(`root`)).render((0,Q.jsx)($.StrictMode,{children:(0,Q.jsx)(_x,{})}));export{fo as A,Fa as B,No as C,xo as D,wo as E,Xa as F,ba as G,ka as H,qa as I,Wi as K,Wa as L,ao as M,no as N,vo as O,$a as P,Va as R,Io as S,Do as T,Ea as U,Ma as V,Ca as W,Zo as _,Xb as a,Ho as b,Ub as c,hs as d,fs as f,es as g,rs as h,Gb as i,co as j,ho as k,Yb as l,os as m,jb as n,Kb as o,ls as p,Pi as q,Mb as r,qb as s,Ab as t,gb as u,Jo as v,Ao as w,zo as x,Go as y,Ra as z};
|