@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.
Files changed (53) hide show
  1. package/CHANGELOG.md +285 -0
  2. package/dist/assets/AdvancedChartImpl-PhZEnfsm.js +15 -0
  3. package/dist/assets/DatePickerField-DaUsI9YX.js +1 -0
  4. package/dist/assets/KanbanImpl-CVbnhntu.js +5 -0
  5. package/dist/assets/RegistryRefField-BBaXjRP0.js +1 -0
  6. package/dist/assets/ar-CnrvoISn.js +6 -0
  7. package/dist/assets/calendar-days-DDMVQ3ae.js +1 -0
  8. package/dist/assets/currency-Cl9ypka7.js +1 -0
  9. package/dist/assets/de-B12FmC0E.js +6 -0
  10. package/dist/assets/es-D2maTLF_.js +6 -0
  11. package/dist/assets/fr-NNM2FcU7.js +6 -0
  12. package/dist/assets/index-DFcMwITB.css +2 -0
  13. package/dist/assets/index-p98lzmz1.js +24 -0
  14. package/dist/assets/ja-D5J713KV.js +6 -0
  15. package/dist/assets/ko-C4rPOAji.js +6 -0
  16. package/dist/assets/lock-EVpnRX1f.js +1 -0
  17. package/dist/assets/number-format-DmDAHe_V.js +1 -0
  18. package/dist/assets/numberBadInput-CS8mDcT0.js +1 -0
  19. package/dist/assets/pencil-CZComqRM.js +1 -0
  20. package/dist/assets/pt-BjxxUc-x.js +6 -0
  21. package/dist/assets/ru-DeOkF7oF.js +6 -0
  22. package/dist/assets/sigma-CFlQ_mlO.js +1 -0
  23. package/dist/assets/src-BsbBN4hR.js +202 -0
  24. package/dist/assets/toDomProps-xVeX7COf.js +1 -0
  25. package/dist/assets/{toHostGroupProps-BH7JIO6T.js → toHostGroupProps-t1JEgvEe.js} +1 -1
  26. package/dist/assets/useCascadingOptions-B4v3GyIv.js +1 -0
  27. package/dist/assets/useDisplayLocale-AnZcfoq7.js +1 -0
  28. package/dist/assets/useFieldTranslation-xZl7XDc9.js +1 -0
  29. package/dist/assets/zh-CVILgvJZ.js +6 -0
  30. package/dist/index.html +2 -2
  31. package/package.json +8 -8
  32. package/dist/assets/AdvancedChartImpl-Cbz0k4EW.js +0 -15
  33. package/dist/assets/KanbanImpl-CBVkfYnm.js +0 -5
  34. package/dist/assets/ar-CYJHHPHB.js +0 -4
  35. package/dist/assets/calendar-days-C3we_i39.js +0 -1
  36. package/dist/assets/cog-BmLzMGc1.js +0 -1
  37. package/dist/assets/de-BKqMiXjL.js +0 -4
  38. package/dist/assets/es-WqKorF87.js +0 -4
  39. package/dist/assets/fr-_c3qhjnD.js +0 -4
  40. package/dist/assets/index-DGZ5sbIm.css +0 -2
  41. package/dist/assets/index-yPIFleR8.js +0 -24
  42. package/dist/assets/ja-B1W4DIAx.js +0 -4
  43. package/dist/assets/ko-CQXwaA77.js +0 -4
  44. package/dist/assets/pt-CS2YylQ0.js +0 -4
  45. package/dist/assets/ru-DQ8CiS1i.js +0 -4
  46. package/dist/assets/sigma-DUL8CyLc.js +0 -1
  47. package/dist/assets/src-6YkZO2yB.js +0 -192
  48. package/dist/assets/toDomProps-BYsZW0J2.js +0 -1
  49. package/dist/assets/upload-error-message-oz88n6bD.js +0 -1
  50. package/dist/assets/useCascadingOptions-z9aPSr6f.js +0 -1
  51. package/dist/assets/useDisplayLocale-BGw3UToo.js +0 -1
  52. package/dist/assets/useFieldTranslation-VcmV4bnt.js +0 -1
  53. package/dist/assets/zh-CvYWw7xk.js +0 -4
@@ -0,0 +1,24 @@
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,Ar as d,At as f,B as p,Bn as m,Br as h,Bt as g,C as _,Cn as v,Cr as y,Ct as b,D as x,Dn as S,Dr as C,Dt as w,E as T,En as E,Er as D,Et as O,F as k,Fn as ee,Fr as A,Ft as j,G as M,Gn as N,Gt as P,H as F,Hn as I,Hr as L,Ht as te,I as ne,In as R,Ir as z,It as B,J as V,Jt as re,K as ie,Kt as ae,L as H,Ln as oe,Lr as se,Lt as U,M as ce,Mn as le,Mr as W,Mt as ue,N as de,Nn as G,Nr as fe,Nt as pe,O as me,On as K,Or as he,Ot as ge,P as q,Pn as J,Pr as _e,Pt as ve,Q as ye,Qn as Y,Qt as be,R as xe,Rn as Se,Rr as Ce,Rt as we,S as Te,Sn as Ee,Sr as De,St as Oe,T as ke,Tn as Ae,Tr as je,Tt as Me,U as Ne,Un as Pe,Ur as Fe,Ut as Ie,V as Le,Vn as Re,Vr as ze,Vt as Be,W as Ve,Wn as He,Wr as Ue,Wt as We,X as Ge,Xn as Ke,Xt as qe,Y as Je,Yn as Ye,Yt as Xe,Z as Ze,Zn as Qe,Zt as $e,_ as et,_n as tt,_r as nt,_t as rt,a as it,an as at,ar as ot,at as st,b as ct,bn as lt,br as ut,bt as dt,c as ft,cn as pt,cr as mt,ct as ht,d as X,dn as gt,dr as _t,dt as vt,en as yt,er as bt,et as xt,f as St,fn as Ct,fr as wt,ft as Tt,g as Et,gn as Dt,gr as Ot,h as kt,hn as At,hr as jt,ht as Mt,i as Nt,in as Pt,ir as Ft,it as It,j as Lt,jn as Rt,jr as zt,jt as Bt,k as Vt,kn as Ht,kr as Ut,kt as Wt,l as Gt,ln as Kt,lr as qt,lt as Jt,m as Yt,mn as Xt,mr as Zt,mt as Qt,n as $t,nn as en,nr as tn,nt as nn,o as rn,or as an,ot as on,p as sn,pn as cn,pt as ln,q as un,qn as dn,qt as fn,r as pn,rn as mn,rr as hn,rt as gn,s as _n,sr as vn,st as yn,tn as bn,tr as xn,tt as Sn,u as Cn,un as wn,ur as Tn,ut as En,v as Dn,vn as On,vt as kn,w as An,wn as jn,wr as Mn,wt as Nn,x as Pn,xn as Fn,xr as In,xt as Ln,y as Rn,yn as zn,yr as Bn,z as Vn,zn as Hn,zr as Un,zt as Wn}from"./src-BsbBN4hR.js";import{_ as Gn,a as Kn,c as qn,d as Jn,f as Yn,h as Xn,i as Zn,l as Qn,m as $n,n as er,o as tr,p as nr,r as rr,s as Z,t as ir,u as ar}from"./useDisplayLocale-AnZcfoq7.js";import{t as or}from"./currency-Cl9ypka7.js";import{t as sr}from"./createLucideIcon--xDTGZXf.js";import{t as cr}from"./arrow-down-1mq0hSmg.js";import{t as lr}from"./arrow-left-BXaV2k39.js";import{t as ur}from"./arrow-right-Ct0Gffoh.js";import{t as dr}from"./arrow-up-down-CI6lKUYI.js";import{t as fr}from"./arrow-up-Bl-41W93.js";import{t as pr}from"./box-C6EfSIlr.js";import{t as mr}from"./calendar-C49E94Ac.js";import{t as hr}from"./camera-CJo23d6_.js";import{t as gr}from"./check-CPShAWmX.js";import{t as _r}from"./chevron-down-DU5bzHCG.js";import{t as vr}from"./chevron-left-CQGBxU3t.js";import{t as yr}from"./chevron-right-CLxrUMAo.js";import{t as br}from"./circle-alert-Be3uBFFY.js";import{t as xr}from"./circle-BnRq1q9n.js";import{t as Sr}from"./copy-BuxGMWGx.js";import{t as Cr}from"./crop-CrWNtGgi.js";import{t as wr}from"./crosshair-Cp-l20E4.js";import{t as Tr}from"./eraser-CxN5D9MH.js";import{t as Er}from"./eye-off-Bp-sJa49.js";import{t as Dr}from"./eye-D5x_7qBQ.js";import{t as Or}from"./file-jnEmRXz-.js";import{t as kr}from"./grip-vertical-CvhugeFd.js";import{t as Ar}from"./image-BjkFtEXU.js";import{t as jr}from"./inbox-BBA9E6Va.js";import{t as Mr}from"./loader-circle-BOLp6p5h.js";import{t as Nr}from"./lock-EVpnRX1f.js";import{t as Pr}from"./map-pin-C_iRGDSb.js";import{t as Fr}from"./maximize-2-CncaanPf.js";import{t as Ir}from"./pencil-CZComqRM.js";import{t as Lr}from"./plus-C74ekJZJ.js";import{t as Rr}from"./qr-code-CJ-h19_G.js";import{t as zr}from"./rotate-cw-Cgup1CCS.js";import{t as Br}from"./search-BnRsQVCj.js";import{t as Vr}from"./sliders-horizontal-DqBDrbfP.js";import{t as Hr}from"./square-pen-DmSyN40K.js";import{t as Ur}from"./star-DsTSDvK0.js";import{t as Wr}from"./table-properties-Da79shwS.js";import{t as Gr}from"./trash-BdqsAFor.js";import{t as Kr}from"./triangle-alert-C82p5Abr.js";import{t as qr}from"./upload-avt7VUnl.js";import{t as Jr}from"./x-9fDeAP-2.js";import{n as Yr,t as Xr}from"./currency-CjzeK1pa.js";import{a as Zr,i as Qr,n as $r,r as ei,t as ti}from"./number-format-DmDAHe_V.js";import{t as ni}from"./useFieldTranslation-xZl7XDc9.js";import{t as ri}from"./toDomProps-xVeX7COf.js";import{n as ii,r as ai,t as oi}from"./numberBadInput-CS8mDcT0.js";import{n as si,t as ci}from"./toHostGroupProps-t1JEgvEe.js";import{n as li,t as ui}from"./useCascadingOptions-B4v3GyIv.js";var di=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&&A(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&&A(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,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function A(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,A(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}}}})),fi=t(((e,t)=>{t.exports=di()})),pi=t((e=>{var t=fi(),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`),ee=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?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?M(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return M(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,I={pending:!1,data:null,method:null,action:null},L=[],te=-1;function ne(e){return{current:e}}function R(e){0>te||(e.current=L[te],L[te]=null,te--)}function z(e,t){te++,L[te]=e.current,e.current=t}var B=ne(null),V=ne(null),re=ne(null),ie=ne(null);function ae(e,t){switch(z(re,t),z(V,e),z(B,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}}R(B),z(B,e)}function H(){R(B),R(V),R(re)}function oe(e){e.memoizedState!==null&&z(ie,e);var t=B.current,n=Hd(t,e.type);t!==n&&(z(V,e),z(B,n))}function se(e){V.current===e&&(R(B),R(V)),ie.current===e&&(R(ie),Qf._currentValue=I)}var U,ce;function le(e){if(U===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);U=t&&t[1]||``,ce=-1<e.stack.indexOf(`
3
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
+ `+U+e+ce}var W=!1;function ue(e,t){if(!e||W)return``;W=!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{W=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?le(n):``}function de(e,t){switch(e.tag){case 26:case 27:case 5:return le(e.type);case 16:return le(`Lazy`);case 13:return e.child!==t&&t!==null?le(`Suspense Fallback`):le(`Suspense`);case 19:return le(`SuspenseList`);case 0:case 15:return ue(e.type,!1);case 11:return ue(e.type.render,!1);case 1:return ue(e.type,!0);case 31:return le(`Activity`);default:return``}}function G(e){try{var t=``,n=null;do t+=de(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
+ Error generating stack: `+e.message+`
9
+ `+e.stack}}var fe=Object.prototype.hasOwnProperty,pe=t.unstable_scheduleCallback,me=t.unstable_cancelCallback,K=t.unstable_shouldYield,he=t.unstable_requestPaint,ge=t.unstable_now,q=t.unstable_getCurrentPriorityLevel,J=t.unstable_ImmediatePriority,_e=t.unstable_UserBlockingPriority,ve=t.unstable_NormalPriority,ye=t.unstable_LowPriority,Y=t.unstable_IdlePriority,be=t.log,xe=t.unstable_setDisableYieldValue,Se=null,Ce=null;function we(e){if(typeof be==`function`&&xe(e),Ce&&typeof Ce.setStrictMode==`function`)try{Ce.setStrictMode(Se,e)}catch{}}var Te=Math.clz32?Math.clz32:Oe,Ee=Math.log,De=Math.LN2;function Oe(e){return e>>>=0,e===0?32:31-(Ee(e)/De|0)|0}var ke=256,Ae=262144,je=4194304;function Me(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 Ne(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=Me(n))):i=Me(o):i=Me(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Me(n))):i=Me(o)):i=Me(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 Pe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Fe(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 Ie(){var e=je;return je<<=1,!(je&62914560)&&(je=4194304),e}function Le(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Re(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ze(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-Te(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&&Be(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Be(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Te(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ve(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Te(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function He(e,t){var n=t&-t;return n=n&42?1:Ue(n),(n&(e.suspendedLanes|t))===0?n:0}function Ue(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 We(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Ge(){var e=F.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function Ke(e,t){var n=F.p;try{return F.p=e,t()}finally{F.p=n}}var qe=Math.random().toString(36).slice(2),Je=`__reactFiber$`+qe,Ye=`__reactProps$`+qe,Xe=`__reactContainer$`+qe,Ze=`__reactEvents$`+qe,Qe=`__reactListeners$`+qe,$e=`__reactHandles$`+qe,et=`__reactResources$`+qe,tt=`__reactMarker$`+qe;function nt(e){delete e[Je],delete e[Ye],delete e[Ze],delete e[Qe],delete e[$e]}function rt(e){var t=e[Je];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Xe]||n[Je]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[Je])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function it(e){if(e=e[Je]||e[Xe]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function at(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function ot(e){var t=e[et];return t||=e[et]={hoistableStyles:new Map,hoistableScripts:new Map},t}function st(e){e[tt]=!0}var ct=new Set,lt={};function ut(e,t){dt(e,t),dt(e+`Capture`,t)}function dt(e,t){for(lt[e]=t,e=0;e<t.length;e++)ct.add(t[e])}var ft=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]*$`),pt={},mt={};function ht(e){return fe.call(mt,e)?!0:fe.call(pt,e)?!1:ft.test(e)?mt[e]=!0:(pt[e]=!0,!1)}function X(e,t,n){if(ht(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 gt(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 _t(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 vt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function yt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function bt(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 xt(e){if(!e._valueTracker){var t=yt(e)?`checked`:`value`;e._valueTracker=bt(e,t,``+e[t])}}function St(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=yt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Ct(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 wt=/[\n"\\]/g;function Tt(e){return e.replace(wt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Et(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=``+vt(t)):e.value!==``+vt(t)&&(e.value=``+vt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Ot(e,o,vt(n)):Ot(e,o,vt(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=``+vt(s):e.removeAttribute(`name`)}function Dt(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)){xt(e);return}n=n==null?``:``+vt(n),t=t==null?n:``+vt(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),xt(e)}function Ot(e,t,n){t===`number`&&Ct(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function kt(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=``+vt(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 At(e,t,n){if(t!=null&&(t=``+vt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+vt(n)}function jt(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=vt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),xt(e)}function Mt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Nt=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 Pt(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||Nt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Ft(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&&Pt(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&Pt(e,a,t[a])}function It(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 Lt=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`]]),Rt=/^[\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 zt(e){return Rt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Bt(){}var Vt=null;function Ht(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ut=null,Wt=null;function Gt(e){var t=it(e);if(t&&(e=t.stateNode)){var n=e[Ye]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Et(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="`+Tt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[Ye]||null;if(!i)throw Error(o(90));Et(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&&St(r)}break a;case`textarea`:At(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&kt(e,!!n.multiple,t,!1)}}}var Kt=!1;function qt(e,t,n){if(Kt)return e(t,n);Kt=!0;try{return e(t)}finally{if(Kt=!1,(Ut!==null||Wt!==null)&&(_u(),Ut&&(t=Ut,e=Wt,Wt=Ut=null,Gt(t),e)))for(t=0;t<e.length;t++)Gt(e[t])}}function Jt(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Ye]||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 Yt=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),Xt=!1;if(Yt)try{var Zt={};Object.defineProperty(Zt,"passive",{get:function(){Xt=!0}}),window.addEventListener(`test`,Zt,Zt),window.removeEventListener(`test`,Zt,Zt)}catch{Xt=!1}var Qt=null,$t=null,en=null;function tn(){if(en)return en;var e,t=$t,n=t.length,r,i=`value`in Qt?Qt.value:Qt.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 en=i.slice(e,1<r?1-r:void 0)}function nn(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 rn(){return!0}function an(){return!1}function on(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)?rn:an,this.isPropagationStopped=an,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=rn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=rn)},persist:function(){},isPersistent:rn}),t}var sn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cn=on(sn),ln=m({},sn,{view:0,detail:0}),un=on(ln),dn,fn,pn,mn=m({},ln,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tn,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!==pn&&(pn&&e.type===`mousemove`?(dn=e.screenX-pn.screenX,fn=e.screenY-pn.screenY):fn=dn=0,pn=e),dn)},movementY:function(e){return`movementY`in e?e.movementY:fn}}),hn=on(mn),gn=on(m({},mn,{dataTransfer:0})),_n=on(m({},ln,{relatedTarget:0})),vn=on(m({},sn,{animationName:0,elapsedTime:0,pseudoElement:0})),yn=on(m({},sn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),bn=on(m({},sn,{data:0})),xn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Sn={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`},Cn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function wn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Cn[e])?!!t[e]:!1}function Tn(){return wn}var En=on(m({},ln,{key:function(e){if(e.key){var t=xn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=nn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Sn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tn,charCode:function(e){return e.type===`keypress`?nn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?nn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Dn=on(m({},mn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),On=on(m({},ln,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tn})),kn=on(m({},sn,{propertyName:0,elapsedTime:0,pseudoElement:0})),An=on(m({},mn,{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})),jn=on(m({},sn,{newState:0,oldState:0})),Mn=[9,13,27,32],Nn=Yt&&`CompositionEvent`in window,Pn=null;Yt&&`documentMode`in document&&(Pn=document.documentMode);var Fn=Yt&&`TextEvent`in window&&!Pn,In=Yt&&(!Nn||Pn&&8<Pn&&11>=Pn),Ln=` `,Rn=!1;function zn(e,t){switch(e){case`keyup`:return Mn.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?(Rn=!0,Ln):null;case`textInput`:return e=t.data,e===Ln&&Rn?null:e;default:return null}}function Un(e,t){if(Vn)return e===`compositionend`||!Nn&&zn(e,t)?(e=tn(),en=$t=Qt=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 In&&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){Ut?Wt?Wt.push(r):Wt=[r]:Ut=r,t=Td(t,`onChange`),0<t.length&&(n=new cn(`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(St(at(e)))return e}function Zn(e,t){if(e===`change`)return t}var Qn=!1;if(Yt){var $n;if(Yt){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,Ht(e)),qt(Yn,t)}}function Z(e,t,n){e===`focusin`?(nr(),qn=t,Jn=n,qn.attachEvent(`onpropertychange`,rr)):e===`focusout`&&nr()}function ir(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Xn(Jn)}function ar(e,t){if(e===`click`)return Xn(t)}function or(e,t){if(e===`input`||e===`change`)return Xn(t)}function sr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var cr=typeof Object.is==`function`?Object.is:sr;function lr(e,t){if(cr(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(!fe.call(t,i)||!cr(e[i],t[i]))return!1}return!0}function ur(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function dr(e,t){var n=ur(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=ur(n)}}function fr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?fr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function pr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ct(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=Ct(e.document)}return t}function mr(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 hr=Yt&&`documentMode`in document&&11>=document.documentMode,gr=null,_r=null,vr=null,yr=!1;function br(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;yr||gr==null||gr!==Ct(r)||(r=gr,`selectionStart`in r&&mr(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}),vr&&lr(vr,r)||(vr=r,r=Td(_r,`onSelect`),0<r.length&&(t=new cn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=gr)))}function xr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Sr={animationend:xr(`Animation`,`AnimationEnd`),animationiteration:xr(`Animation`,`AnimationIteration`),animationstart:xr(`Animation`,`AnimationStart`),transitionrun:xr(`Transition`,`TransitionRun`),transitionstart:xr(`Transition`,`TransitionStart`),transitioncancel:xr(`Transition`,`TransitionCancel`),transitionend:xr(`Transition`,`TransitionEnd`)},Cr={},wr={};Yt&&(wr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Sr.animationend.animation,delete Sr.animationiteration.animation,delete Sr.animationstart.animation),`TransitionEvent`in window||delete Sr.transitionend.transition);function Tr(e){if(Cr[e])return Cr[e];if(!Sr[e])return e;var t=Sr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in wr)return Cr[e]=t[n];return e}var Er=Tr(`animationend`),Dr=Tr(`animationiteration`),Or=Tr(`animationstart`),kr=Tr(`transitionrun`),Ar=Tr(`transitionstart`),jr=Tr(`transitioncancel`),Mr=Tr(`transitionend`),Nr=new Map,Pr=`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(` `);Pr.push(`scrollEnd`);function Fr(e,t){Nr.set(e,t),ut(t,[e])}var Ir=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)},Lr=[],Rr=0,zr=0;function Br(){for(var e=Rr,t=zr=Rr=0;t<e;){var n=Lr[t];Lr[t++]=null;var r=Lr[t];Lr[t++]=null;var i=Lr[t];Lr[t++]=null;var a=Lr[t];if(Lr[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){Lr[Rr++]=e,Lr[Rr++]=t,Lr[Rr++]=n,Lr[Rr++]=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),Gr(e)}function Ur(e,t){return Vr(e,null,null,t),Gr(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-Te(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Gr(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 Kr={};function qr(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 Jr(e,t,n,r){return new qr(e,t,n,r)}function Yr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xr(e,t){var n=e.alternate;return n===null?(n=Jr(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 Zr(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 Qr(e,t,n,r,i,a){var s=0;if(r=e,typeof e==`function`)Yr(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,B.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case O:return e=Jr(31,n,t,i),e.elementType=O,e.lanes=a,e;case v:return $r(n.children,i,a,t);case y:s=8,i|=24;break;case b:return e=Jr(12,n,t,i|2),e.elementType=b,e.lanes=a,e;case w:return e=Jr(13,n,t,i),e.elementType=w,e.lanes=a,e;case T:return e=Jr(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=Jr(s,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function $r(e,t,n,r){return e=Jr(7,e,r,t),e.lanes=n,e}function ei(e,t,n){return e=Jr(6,e,null,t),e.lanes=n,e}function ti(e){var t=Jr(18,null,null,0);return t.stateNode=e,t}function ni(e,t,n){return t=Jr(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ri=new WeakMap;function ii(e,t){if(typeof e==`object`&&e){var n=ri.get(e);return n===void 0?(t={value:e,source:t,stack:G(t)},ri.set(e,t),t):n}return{value:e,source:t,stack:G(t)}}var ai=[],oi=0,si=null,ci=0,li=[],ui=0,di=null,pi=1,mi=``;function hi(e,t){ai[oi++]=ci,ai[oi++]=si,si=e,ci=t}function gi(e,t,n){li[ui++]=pi,li[ui++]=mi,li[ui++]=di,di=e;var r=pi;e=mi;var i=32-Te(r)-1;r&=~(1<<i),n+=1;var a=32-Te(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,pi=1<<32-Te(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===si;)si=ai[--oi],ai[oi]=null,ci=ai[--oi],ai[oi]=null;for(;e===di;)di=li[--ui],li[ui]=null,mi=li[--ui],li[ui]=null,pi=li[--ui],li[ui]=null}function yi(e,t){li[ui++]=pi,li[ui++]=mi,li[ui++]=di,pi=t.id,mi=t.overflow,di=e}var bi=null,xi=null,Si=!1,Ci=null,wi=!1,Ti=Error(o(519));function Ei(e){throw Mi(ii(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[Je]=e,t[Ye]=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),Dt(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),jt(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=Bt),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=ne(null),Pi=null,Fi=null;function Ii(e,t,n){z(Ni,t._currentValue),t._currentValue=n}function Li(e){e._currentValue=Ni.current,R(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;cr(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===ie.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(!cr(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=ne(null);function sa(){var e=oa.current;return e===null?Ml.pooledCache:e}function ca(e,t){t===null?z(oa,oa.current):z(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(Bt,Bt),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(Bt,Bt);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=Xr(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=ei(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=Qr(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=ni(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=$r(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=ei(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case g:return n=Qr(t.type,t.key,t.props,null,e.mode,n),Ca(n,t),n.return=e,n;case _:return t=ni(t,e.mode,n),t.return=e,t;case D:return t=ga(t),f(e,t,n)}if(N(t)||A(t))return t=$r(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)||A(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)||A(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=$r(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=Qr(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=ni(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(A(a)){if(l=A(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=ei(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=Jr(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=Gr(e),Wr(e,null,n),t}return Vr(e,r,t,n),Gr(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,Ve(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=ne(null),Va=ne(0);function Ha(e,t){e=Bl,z(Va,e),z(Ba,t),Bl=e|t.baseLanes}function Ua(){z(Va,Bl),z(Ba,Ba.current)}function Wa(){Bl=Va.current,R(Ba),R(Va)}var Ga=ne(null),Ka=null;function qa(e){var t=e.alternate;z(Qa,Qa.current&1),z(Ga,e),Ka===null&&(t===null||Ba.current!==null||t.memoizedState!==null)&&(Ka=e)}function Ja(e){z(Qa,Qa.current),z(Ga,e),Ka===null&&(Ka=e)}function Ya(e){e.tag===22?(z(Qa,Qa.current),z(Ga,e),Ka===null&&(Ka=e)):Xa(e)}function Xa(){z(Qa,Qa.current),z(Ga,Ga.current)}function Za(e){R(Ga),Ka===e&&(Ka=null),R(Qa)}var Qa=ne(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(!cr(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?js:Ms,oo=!1,a=n(r,i),oo=!1,ao&&(a=go(t,n,r,i)),ho(e),a}function ho(e){P.H=As;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=Ns,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?js:Ms),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,!cr(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);cr(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=!cr((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!cr(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){we(!0);try{n()}finally{we(!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(Ds(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=ws.bind(null,to,r),r.dispatch=n,r=Lo(!1),a=Es.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){we(!0);try{e()}finally{we(!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 cr(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),cr(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,Es(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ts(e,t,ia(c,r),uu(e)):Ts(e,t,r,uu(e))}catch(n){Ts(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,I,n===null?hs:function(){return vs(e),n(r)})}function _s(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Do,lastRenderedState:I},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),Ts(e,t.next.queue,{},uu())}function ys(){return Ui(Qf)}function bs(){return So().memoizedState}function xs(){return So().memoizedState}function Ss(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 Cs(e,t,n){var r=uu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ds(e)?Os(t,n):(n=Hr(e,t,n,r),n!==null&&(fu(n,e,r),ks(n,t,r)))}function ws(e,t,n){Ts(e,t,n,uu())}function Ts(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ds(e))Os(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,cr(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),ks(n,t,r),!0}return!1}function Es(e,t,n,r){if(r={lane:2,revertLane:ld(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ds(e)){if(t)throw Error(o(479))}else t=Hr(e,n,r,2),t!==null&&fu(t,e,2)}function Ds(e){var t=e.alternate;return e===to||t!==null&&t===to}function Os(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 ks(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ve(e,n)}}var As={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};As.useEffectEvent=fo;var js={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){we(!0);try{e()}finally{we(!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){we(!0);try{n(t)}finally{we(!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=Cs.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=ws.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-Te(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:ys,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=Es.bind(null,to,!0,n),n.dispatch=t,[e,t]},useMemoCache:Eo,useCacheRefresh:function(){return xo().memoizedState=Ss.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)}}},Ms={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:bs,useHostTransitionStatus:ys,useFormState:qo,useActionState:qo,useOptimistic:function(e,t){return Ro(So(),no,e,t)},useMemoCache:Eo,useCacheRefresh:xs};Ms.useEffectEvent=is;var Ns={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:bs,useHostTransitionStatus:ys,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:xs};Ns.useEffectEvent=is;function Ps(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 Fs={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 Is(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?!lr(n,r)||!lr(i,a):!0}function Ls(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&&Fs.enqueueReplaceState(t,t.state,null)}function Rs(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 zs(e){Ir(e)}function Bs(e){console.error(e)}function Vs(e){Ir(e)}function Hs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Q(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 $(e,t,n){return n=ja(n),n.tag=3,n.payload={element:null},n.callback=function(){Hs(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(){Q(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Q(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(ii(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=ii(r,n),i=$(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(ii(e,n)))),!1;var a=Error(o(520),{cause:r});if(a=ii(a,n),ql===null?ql=[a]:ql.push(a),Vl!==4&&(Vl=2),t===null)return!0;r=ii(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=$(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`&&!Yr(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Zs(e,t,a,r,i)):(e=Qr(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?lr:n,n(o,r)&&e.ref===t.ref)return yc(e,t,i)}return t.flags|=1,e=Xr(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(lr(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:di===null?null:{id:pi,overflow:mi},retryLane:536870912,hydrationErrors:null},n=ti(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=He(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=Xr(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=Kr,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=Fs,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):Kr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ps(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&&Fs.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=Rs(n,s);a.props=c;var l=a.context,u=n.contextType;o=Kr,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)&&Ls(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`&&(Ps(t,n,d,r),l=t.memoizedState),(c=Oa||Is(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=Rs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Kr,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)&&Ls(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`&&(Ps(t,n,s,r),p=t.memoizedState),(u=Oa||Is(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:di===null?null:{id:pi,overflow:mi},retryLane:536870912,hydrationErrors:null},n=ti(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=$r(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=$r(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=He(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=Xr(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=$r(c,i,n,null),c.flags|=2):c=Xr(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=Xr(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=Jr(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,z(Qa,o),Js(e,t,r,n),r=Si?ci: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=Xr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Xr(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:ae(t,t.stateNode.containerInfo),Ii(t,Yi,e.memoizedState.cache),Ai();break;case 27:case 5:oe(t);break;case 4:ae(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),z(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,ci,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`)Yr(e)?(r=Rs(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=M(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=Rs(r,t.pendingProps),sc(e,t,r,i,n);case 3:a:{if(ae(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=ii(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(re.current).createElement(n),r[Je]=t,r[Ye]=e,Pd(r,n,e),st(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return oe(t),e===null&&Si&&(r=t.stateNode=ff(t.type,t.pendingProps,re.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)),oe(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 ae(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:Ie(),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),H(),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(se(t),n=re.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=B.current,ki(t)?Di(t,e):(e=ff(i,r,n),t.stateNode=e,Cc(t))}return Oc(t),null;case 5:if(se(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=B.current,ki(t))Di(t,a);else{var s=Bd(re.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[Je]=t,a[Ye]=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=re.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[Je]=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[Je]=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[Je]=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[Je]=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 H(),e===null&&xd(t.stateNode.containerInfo),Oc(t),null;case 10:return Li(t.type),Oc(t),null;case 19:if(R(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;)Zr(n,e),n=n.sibling;return z(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,z(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&&R(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),H(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return se(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 R(Qa),null;case 4:return H(),null;case 10:return Li(t.type),null;case 22:case 23:return Za(t),Wa(),e!==null&&R(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),H();break;case 26:case 27:case 5:se(t);break;case 4:H();break;case 31:t.memoizedState!==null&&Za(t);break;case 13:Za(t);break;case 19:R(Qa);break;case 10:Li(t.type);break;case 22:case 23:Za(t),Wa(),e!==null&&R(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=Rs(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[Ye]=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=Bt));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[Je]=e,t[Ye]=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=pr(e),mr(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=Rs(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=Rs(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&&nt(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(Ce&&typeof Ce.onCommitFiberUnmount==`function`)try{Ce.onCommitFiberUnmount(Se,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[tt]||a[Je]||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[Je]=e,st(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[Je]=e,st(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{Mt(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&&(Mt(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?Ge():ld()}function du(){if(Gl===0){if(!(Pl&536870912)||Si){var e=Ae;Ae<<=1,!(Ae&3932160)&&(Ae=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)),Re(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||Pe(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),Ne(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:Bt},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(!cr(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-Te(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Be(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=Xr(e.current,null),Pl=t,Fl=0,Il=null,Ll=!1,Rl=Pe(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-Te(r),a=1<<i;t|=e[i],r&=~a}return Bl=t,Br(),n}function bu(e,t){to=null,P.H=As,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,Hs(e,ii(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=As,e===null?As: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=Pe(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&&!K();)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=Zr(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,Hs(e,ii(n,e.current)),Nl=null;return}}catch(t){if(i!==null)throw Nl=i,t;Vl=1,Hs(e,ii(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,ze(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(ve,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=pr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&fr(s.ownerDocument.documentElement,s)){if(c!==null&&mr(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 _=dr(s,h),v=dr(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),We(n),t=t.stateNode,Ce&&typeof Ce.onCommitFiberRoot==`function`)try{Ce.onCommitFiberRoot(Se,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=We(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),Ce&&typeof Ce.onPostCommitFiberRoot==`function`)try{Ce.onPostCommitFiberRoot(Se,a)}catch{}return!0}finally{F.p=i,P.T=r,Ru(e,t)}}function Vu(e,t,n){t=ii(n,t),t=$(e.stateNode,t,2),e=Ma(e,t,2),e!==null&&(Re(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=ii(n,e),n=Us(2),r=Ma(t,n,2),r!==null&&(Ws(n,r,t,e),Re(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=Ie()),e=Ur(e,t),e!==null&&(Re(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 pe(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-Te(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=Ne(r,r===Ml?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Pe(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-Te(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Fe(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ml,n=Pl,n=Ne(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&&me(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Pe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&me(r),We(n)){case 2:case 8:n=_e;break;case 32:n=ve;break;case 268435456:n=Y;break;default:n=ve}return r=od.bind(null,e),n=pe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&me(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=Ne(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?pe(J,rd):id()})}function ld(){if(ed===0){var e=ea;e===0&&(e=ke,ke<<=1,!(ke&261888)&&(ke=256)),ed=e}return ed}function ud(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:zt(``+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[Ye]||null).action),o=r.submitter;o&&(t=(t=o[Ye]||null)?ud(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new cn(`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<Pr.length;pd++){var md=Pr[pd];Fr(md.toLowerCase(),`on`+(md[0].toUpperCase()+md.slice(1)))}Fr(Er,`onAnimationEnd`),Fr(Dr,`onAnimationIteration`),Fr(Or,`onAnimationStart`),Fr(`dblclick`,`onDoubleClick`),Fr(`focusin`,`onFocus`),Fr(`focusout`,`onBlur`),Fr(kr,`onTransitionRun`),Fr(Ar,`onTransitionStart`),Fr(jr,`onTransitionCancel`),Fr(Mr,`onTransitionEnd`),dt(`onMouseEnter`,[`mouseout`,`mouseover`]),dt(`onMouseLeave`,[`mouseout`,`mouseover`]),dt(`onPointerEnter`,[`pointerout`,`pointerover`]),dt(`onPointerLeave`,[`pointerout`,`pointerover`]),ut(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),ut(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),ut(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),ut(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),ut(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),ut(`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){Ir(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){Ir(e)}i.currentTarget=null,a=c}}}}function vd(e,t){var n=t[Ze];n===void 0&&(n=t[Ze]=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,ct.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,!Xt||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=rt(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}qt(function(){var r=a,i=Ht(n),o=[];a:{var s=Nr.get(e);if(s!==void 0){var l=cn,u=e;switch(e){case`keypress`:if(nn(n)===0)break a;case`keydown`:case`keyup`:l=En;break;case`focusin`:u=`focus`,l=_n;break;case`focusout`:u=`blur`,l=_n;break;case`beforeblur`:case`afterblur`:l=_n;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=hn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=gn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=On;break;case Er:case Dr:case Or:l=vn;break;case Mr:l=kn;break;case`scroll`:case`scrollend`:l=un;break;case`wheel`:l=An;break;case`copy`:case`cut`:case`paste`:l=yn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Dn;break;case`toggle`:case`beforetoggle`:l=jn}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=Jt(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!==Vt&&(u=n.relatedTarget||n.fromElement)&&(rt(u)||u[Xe]))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?rt(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=hn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Dn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?s:at(l),h=u==null?s:at(u),s=new d(g,m+`leave`,l,n,i),s.target=f,s.relatedTarget=h,g=null,rt(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?at(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=or;else{v=ir;var y=Z}}else l=s.nodeName,!l||l.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&It(r.elementType)&&(v=Zn):v=ar;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&&Ot(s,`number`,s.value)}switch(y=r?at(r):window,e){case`focusin`:(Gn(y)||y.contentEditable===`true`)&&(gr=y,_r=r,vr=null);break;case`focusout`:vr=_r=gr=null;break;case`mousedown`:yr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:yr=!1,br(o,n,i);break;case`selectionchange`:if(hr)break;case`keydown`:case`keyup`:br(o,n,i)}var b;if(Nn)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&&(In&&n.locale!==`ko`&&(Vn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Vn&&(b=tn()):(Qt=i,$t=`value`in Qt?Qt.value:Qt.textContent,Vn=!0)),y=Td(r,x),0<y.length&&(x=new bn(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=Bn(n),b!==null&&(x.data=b)))),(b=Fn?Hn(e,n):Un(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new bn(`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=Jt(e,n),i!=null&&r.unshift(wd(e,i,a)),i=Jt(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=Jt(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=Jt(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===``||Mt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Mt(e,``+r);break;case`className`:gt(e,`class`,r);break;case`tabIndex`:gt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:gt(e,n,r);break;case`style`:Ft(e,r,a);break;case`data`:if(t!==`object`){gt(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=zt(``+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=zt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Bt);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=zt(``+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),X(e,`popover`,r);break;case`xlinkActuate`:_t(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:_t(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:_t(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:_t(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:_t(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:_t(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:_t(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:_t(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:_t(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:X(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=Lt.get(n)||n,X(e,n,r))}}function Nd(e,t,n,r,i,a){switch(n){case`style`:Ft(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`?Mt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Mt(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=Bt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!lt.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[Ye]||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,``):X(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)}}Dt(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&&kt(e,!!r,n,!0):kt(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)}jt(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(It(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)}}Et(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?kt(e,!!n,n?[]:``,!1):kt(e,!!n,t,!0)):kt(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)}At(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(It(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[tt]||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),nt(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[tt])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]);nt(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=it(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=Tt(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),st(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="`+Tt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Tt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Tt(n.imageSizes)+`"]`)):i+=`[href="`+Tt(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),st(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="`+Tt(r)+`"][href="`+Tt(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),st(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=ot(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`);st(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=ot(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`),st(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=ot(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`),st(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=re.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=ot(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=ot(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=ot(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="`+Tt(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),st(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Tt(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~="`+Tt(n.href)+`"]`);if(r)return t.instance=r,st(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`),st(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,st(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),st(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,st(i),i):(r=n,(i=mf.get(a))&&(r=m({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),st(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[tt]||a[Je]||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,st(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),st(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:I,_currentValue2:I,_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=Le(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Le(0),this.hiddenUpdates=Le(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=Jr(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=Kr,e):Kr}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=Ue(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=it(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Me(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Te(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=Ht(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=rt(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(q()){case J:return 2;case _e:return 8;case ve:case ye:return 32;case Y: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=it(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=rt(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,Ke(e.priority,function(){op(n)});return}}else if(t===31){if(t=u(n),t!==null){e.blockedOn=t,Ke(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);Vt=r,n.target.dispatchEvent(r),Vt=null}else return t=it(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=it(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[Ye]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Ye]||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[Xe]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ge();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{Se=zp.inject(Rp),Ce=zp}catch{}}e.createRoot=function(e,t){if(!s(e))throw Error(o(299));var n=!1,r=``,i=zs,a=Bs,c=Vs;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[Xe]=t.current,xd(e),new Fp(t)}})),mi=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=pi()})),hi={min_rows:`minRows`,max_rows:`maxRows`,allow_add:`allowAdd`,allow_delete:`allowDelete`,allow_reorder:`allowReorder`,total_field:`totalField`,add_label:`addLabel`,sort_field:`sortField`},gi=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(`.`)),_i={createdAt:`created_at`,createdBy:`created_by`,updatedAt:`updated_at`,updatedBy:`updated_by`};new Set(Object.values(_i));function vi(e,t){return t?.system===!0||gi.has(e)}function yi(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 bi(e){return yi(e,!1).predicates}var xi={create:`create`,import:`import`,edit:`update`,delete:`delete`,exportCsv:`export`};function Si(e,t){let n=Ce({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(xi))n[t]&&!e.has(r)&&(n[t]=!1)}return n}var Ci={createFormFields:{crud:`create`,grant:`create`,field:`create`},editFormFields:{crud:`edit`,grant:`update`,field:`write`},recordEdit:{crud:`edit`,grant:`update`,field:`write`},recordDelete:{crud:`delete`,grant:`delete`},listNew:{crud:`create`,grant:`create`},listImport:{crud:`import`,grant:`create`,field:`create`},importTemplate:{crud:null,grant:`create`},listInlineEdit:{crud:`edit`,grant:`update`,field:`write`},listBulkDelete:{crud:`delete`,grant:`delete`},rowEdit:{crud:`edit`,grant:`update`},rowDelete:{crud:`delete`,grant:`delete`},gridAddRow:{crud:`create`,grant:`create`},relatedNew:{crud:`create`,grant:`create`},relatedRowEdit:{crud:`edit`,grant:`update`},relatedRowDelete:{crud:`delete`,grant:`delete`},declarationClone:{crud:`create`,grant:`create`},lookupCreateNew:{crud:`create`,grant:`create`},attachmentUpload:{crud:null,grant:`create`},attachmentDelete:{crud:null,grant:`delete`},feedComment:{crud:`create`,grant:`create`},feedReactionAdd:{crud:`create`,grant:`create`},feedReactionRemove:{crud:`delete`,grant:`delete`},feedReactionColumn:{crud:`edit`,grant:`update`},feedCommentEdit:{crud:`edit`,grant:`update`},feedCommentDelete:{crud:`delete`,grant:`delete`},calendarQuickCreate:{crud:`create`,grant:`create`},calendarReschedule:{crud:`edit`,grant:`update`},kanbanCardMove:{crud:`edit`,grant:`update`}},wi={create:`createPredicates`,import:`importPredicates`,edit:`editPredicates`,delete:`deletePredicates`};function Ti(e,{objectSchema:t,objectName:n,perms:r}={}){let i=Ci[e],a;if(i.crud!==null){let e=Si(t,n?r?.getObjectApiOperations?.(n):void 0);if(!e[i.crud])return{allowed:!1};a=e[wi[i.crud]]}return n&&r&&!r.can(n,i.grant)?{allowed:!1}:a?{allowed:!0,predicates:a}:{allowed:!0}}function Ei(e,t,n,r){return!t?.isLoaded||t.checkField(n,r,Ci[e].field)}function Di(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 Oi=fe;function ki(e){return!!e&&typeof e==`object`&&Oi.has(e.type)}var Ai=Symbol.for(`objectui.objectSortability`);function ji(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 Mi(e){if(!e||typeof e!=`object`)return;let t=e[Ai];if(!t||typeof t!=`object`)return;let n=t.fields;if(n&&typeof n==`object`&&!Array.isArray(n))return t}function Ni(e,t){if(typeof t!=`string`||t.length===0)return!1;let n=e.fields?.[t];return ji(n)?.sortable===!0}var Pi=`[{ field: 'name', order: 'desc' }]`,Fi=new Set;function Ii(e,t){return`${e}\n${t}`}function Li(e){let t=Ii(`scalar`,e);Fi.has(t)||(Fi.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: ${Pi} — 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 Ri(e){let t=Ii(`entry`,e);Fi.has(t)||(Fi.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: ${Pi} — 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 zi(e){if(e){if(typeof e==`string`){Li(e);return}if(Array.isArray(e)){let t=[];for(let n of e){if(typeof n==`string`){let e=n;e!==``&&Ri(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 Bi(e){let t=zi(e);if(!t)return;let n={};for(let e of t)n[e.field]=e.order;return n}function Vi(e,t,n={}){if(!e||e.dueLike!==!0)return!1;let r=e.settledWhen;return r!=null&&dn(r,t,{fallback:!1,scope:n.scope,fields:n.fields,label:`${e.name??`field`}.settledWhen`})}var Hi=/\$\{event\.([a-zA-Z0-9_]+)\}/g;function Ui(e,t){return typeof e!=`string`||e.indexOf("${event.")===-1?e:e.replace(Hi,(e,n)=>{let r=t[n];return r==null?``:String(r)})}function Wi(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 Ui(e,t)}if(Array.isArray(e))return e.map(e=>Wi(e,t));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))n[r]=Wi(i,t);return n}return e}function Gi(e,t,n={}){if(e?.filter)return Wi(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 Ki(e,t,n=`Details`){if(e?.title){let n=Ui(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 qi(e){return e?e.enabled!==!1:!1}function Ji(e,t){let n=C(e,t);try{return z(n)}catch(e){throw e?.code===`INVALID_FILTER`?new je(e.message):e}}var Yi={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 Xi(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=>Xi(e,t));if(typeof e==`object`){let n={};for(let r of Object.keys(e))n[r]=Xi(e[r],t);return n}return e}function Zi(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 Pe(e,t)}let r=Xi(e,Yi);return Pe(r,n)}function Qi(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 $i=e=>e==null?null:String(e),ea=e=>JSON.stringify(e),ta=[`count`,`sum`,`avg`,`min`,`max`,`count_distinct`],na=[`count`,`count_distinct`];function ra(e){return typeof e==`string`&&na.includes(e)}function ia(e){return typeof e==`string`&&ta.includes(e)}function aa(e,t){let n=e.builtinAggregate;if(ia(n)){let e=t?.[n];if(typeof e==`string`&&e!==``)return e}return e.label??e.name}function oa(e){return ea([$i(e)])}var sa=`__bucketId`;function ca(e){if(!e||typeof e!=`object`)return;let t=e[sa];return typeof t==`string`&&t!==``?t:void 0}function la(e,t){return ua(e,t)&&e[t]==null}function ua(e,t){return!!e&&typeof e==`object`&&t in e}function da(e){return e==null?``:String(e)}function fa(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 pa(e,t,n){let r=e=>la(e,t)?n:e[t],i=fa(e.filter(e=>ua(e,t)).map(e=>({id:oa(e[t]),display:da(r(e))}))),a=!1,o=e.map(e=>{if(!ua(e,t))return e;let o=la(e,t),s=i.has(da(r(e)));return!o&&!s?e:(a=!0,{...e,...o?{[t]:n}:{},...s?{[sa]:oa(e[t])}:{}})});return a?o:e}function ma(e,t,n,r){let i=new Map;for(let r of e){if(!ua(r,t))continue;let e=oa(r[t]);i.has(e)||i.set(e,{id:e,label:la(r,t)?n:String(r[t])})}let a=Array.from(i.values()),o=fa(a.map(({id:e,label:t})=>({id:e,display:t}))),s=new Set([r,sa]),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 ha(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?aa(t,i?.builtinAggregateLabels):e},l=e=>{let t=(r??[]).find(t=>t.name===e)?.aggregate;return typeof t==`string`?{aggregate:t}:{}};if(a.length>=2&&o.length===1){let e=a[0],t=a[1],n=o[0],r=i?.nullCategoryLabel??`(None)`,c=ma(s,t,r,e),u=new Map(c.map(({id:e,dataKey:t})=>[e,t])),d=new Map;for(let i of s){let a=i[e],o=oa(a),s=d.get(o);s||d.set(o,s={}),ua(i,e)&&!ua(s,e)&&(s[e]=la(i,e)?r:a);let c=ua(i,t)?u.get(oa(i[t])):void 0;c!==void 0&&(s[c]=i[n])}let f=fa(Array.from(d.entries()).map(([t,n])=>({id:t,display:da(n[e])})));return{data:Array.from(d.entries()).map(([t,n])=>f.has(da(n[e]))?{...n,[sa]:t}:n),xAxisKey:e,series:c.map(({dataKey:e,label:t})=>({dataKey:e,label:t,...l(n)}))}}let u=a[0];return{data:u?pa(s,u,i?.nullCategoryLabel??`(None)`):s,xAxisKey:u,series:o.map(e=>({dataKey:e,label:c(e),...l(e)}))}}function ga(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 _a(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 va(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 ya(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 ba(e,t){if(!t||!Array.isArray(e)||e.length===0)return e;let n=!1,r=e.map(e=>{let r=ya(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 xa(e,t){if(!Array.isArray(e)||e.length===0)return null;let n={},r={};for(let i of e){let e=ya(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 Sa=new Set([`lookup`,`master_detail`,`masterdetail`,`master-detail`]);function Ca(e){let t=e?.fields;return t&&typeof t==`object`&&!Array.isArray(t)?t:null}function wa(e){if(!e||typeof e!=`object`)return;let t=e,n=typeof t.type==`string`?t.type.toLowerCase():``;if(!Sa.has(n))return;let r=t.reference;return typeof r==`string`&&r?r:void 0}async function Ta(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=wa(Ca(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=Ca(i)?.[l];u?.options!==void 0&&(r[t]={object:a,field:l,options:u.options})}return r}function Ea(e,t){let n=e?.object;if(!n||!t)return;let r=e.field;return(e,i)=>t(n,r,e,i)}function Da(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=xa(t?.options,Ea(t,n));o&&(r[i]=o)}return Object.keys(r).length>0?r:null}async function Oa(e,t,n){return Ta(await e(t),n,e)}function ka(e,t){return Fe(e)??t}function Aa(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function ja(e,t,n){let r=e.function,i={function:r,alias:ka(e,r||`count`)};return r!==`count`&&e.field&&(i.field=e.field),{groupBy:[t],aggregations:[i],where:n}}var Ma=new Set([`pie`,`donut`,`funnel`,`scatter`]);function Na(e){return typeof e==`string`&&Ma.has(e)}function Pa(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 Fa(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 Ia=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,Ra=/^[A-Za-z_][A-Za-z0-9_]*$/,za=/\{([a-z_][a-z0-9_]*)\}/gi;function Ba(e){if(!e||typeof e!=`object`)return;let t=e;if(t.defaultFromRow)return t.field??t.name}function Va(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 Ha(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 Ua(e){let t=[],n=new Set;for(let r of e){let e=Ha(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 Wa(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`&&Ra.test(n.recordIdField)&&t.push(`record.${n.recordIdField}`),Array.isArray(n.params))for(let e of n.params){let n=Ba(e);typeof n==`string`&&Ra.test(n)&&t.push(`record.${n}`)}if(typeof n.target==`string`){za.lastIndex=0;for(let e=za.exec(n.target);e;e=za.exec(n.target))t.push(`record.${e[1]}`)}if(n.undoable)for(let e of Va(n))typeof e==`string`&&Ra.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 Ga(e){return e.replace(/[_-]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Ka(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`)}}var qa=n({__iconData:()=>Ja,default:()=>Ya}),Ja={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`}]]};Ja.node;var Ya=sr(Ja),Xa=n({__iconData:()=>Za,default:()=>Qa}),Za={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`}]]};Za.node;var Qa=sr(Za),$a=n({__iconData:()=>eo,default:()=>to}),eo={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};eo.node;var to=sr(eo),no=n({__iconData:()=>ro,default:()=>io}),ro={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`}]]};ro.node;var io=sr(ro),ao=n({__iconData:()=>oo,default:()=>so}),oo={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`]};oo.node;var so=sr(oo),co=n({__iconData:()=>lo,default:()=>uo}),lo={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`}]]};lo.node;var uo=sr(lo),fo=n({__iconData:()=>po,default:()=>mo}),po={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`}]]};po.node;var mo=sr(po),ho=n({__iconData:()=>go,default:()=>_o}),go={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`}]]};go.node;var _o=sr(go),vo=n({__iconData:()=>yo,default:()=>bo}),yo={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`]};yo.node;var bo=sr(yo),xo=n({__iconData:()=>So,default:()=>Co}),So={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`]};So.node;var Co=sr(So),wo=n({__iconData:()=>To,default:()=>Eo}),To={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};To.node;var Eo=sr(To),Do=n({__iconData:()=>Oo,default:()=>ko}),Oo={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`}]]};Oo.node;var ko=sr(Oo),Ao=n({__iconData:()=>jo,default:()=>Mo}),jo={name:`cog`,size:24,node:[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]};jo.node;var Mo=sr(jo),No=n({__iconData:()=>Po,default:()=>Fo}),Po={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`}]]};Po.node;var Fo=sr(Po),Io=n({__iconData:()=>Lo,default:()=>Ro}),Lo={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`]};Lo.node;var Ro=sr(Lo),zo=n({__iconData:()=>Bo,default:()=>Vo}),Bo={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`}]]};Bo.node;var Vo=sr(Bo),Ho=n({__iconData:()=>Uo,default:()=>Wo}),Uo={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`}]]};Uo.node;var Wo=sr(Uo),Go=n({__iconData:()=>Ko,default:()=>qo}),Ko={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`}]]};Ko.node;var qo=sr(Ko),Jo=n({__iconData:()=>Yo,default:()=>Xo}),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 Xo=sr(Yo),Zo=n({__iconData:()=>Qo,default:()=>$o}),Qo={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`}]]};Qo.node;var $o=sr(Qo),es=n({__iconData:()=>ts,default:()=>ns}),ts={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};ts.node;var ns=sr(ts),rs=n({__iconData:()=>is,default:()=>as}),is={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`}]]};is.node;var as=sr(is),os=n({__iconData:()=>ss,default:()=>cs}),ss={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`}]]};ss.node;var cs=sr(ss),ls=n({__iconData:()=>us,default:()=>ds}),us={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`}]]};us.node;var ds=sr(us),fs=n({__iconData:()=>ps,default:()=>ms}),ps={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`}]]};ps.node;var ms=sr(ps),hs=n({__iconData:()=>gs,default:()=>_s}),gs={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`}]]};gs.node;var _s=sr(gs),vs=n({__iconData:()=>ys,default:()=>bs}),ys={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`}]]};ys.node;var bs=sr(ys),xs=n({__iconData:()=>Ss,default:()=>Cs}),Ss={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`}]]};Ss.node;var Cs=sr(Ss),ws=n({__iconData:()=>Ts,default:()=>Es}),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 Es=sr(Ts),Ds=n({__iconData:()=>Os,default:()=>ks}),Os={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`}]]};Os.node;var ks=sr(Os),As=n({__iconData:()=>js,default:()=>Ms}),js={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`]};js.node;var Ms=sr(js),Ns=n({__iconData:()=>Ps,default:()=>Fs}),Ps={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`}]]};Ps.node;var Fs=sr(Ps),Is=n({__iconData:()=>Ls,default:()=>Rs}),Ls={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`}]]};Ls.node;var Rs=sr(Ls),zs=n({__iconData:()=>Bs,default:()=>Vs}),Bs={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`}]]};Bs.node;var Vs=sr(Bs),Hs=e(mi(),1),Q=a(),$=e(r(),1),Us=(0,$.createContext)(null);Us.displayName=`PermissionContext`;var Ws=Object.freeze([]),Gs=Object.freeze({check:()=>({allowed:!0}),checkField:()=>!0,getFieldPermissions:()=>[],getRowFilter:()=>void 0,getObjectApiOperations:()=>void 0,roles:Ws,userId:null,systemPermissions:void 0,hasCapabilities:()=>!0,isLoaded:!1,can:()=>!0,cannot:()=>!1}),Ks=new WeakMap;function qs(e){let t=Ks.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 Ks.set(e,n),n}function Js(){let e=(0,$.useContext)(Us);return e?qs(e):Gs}function Ys(e){let{checkField:t,getFieldPermissions:n}=Js(),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 Xs(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 Zs(e){return e.postalCode??e.zipCode}function Qs(e){return e==null?``:String(e).trim()}var $s=new Set([`zh`,`ja`,`ko`]);function ec(e){return(e||``).split(/[-_]/)[0].toLowerCase()}function tc(e,t){let n=Qs(e.street),r=Qs(e.city),i=Qs(e.state),a=Qs(Zs(e)),o=Qs(e.country);return $s.has(ec(t))?[o,[a,i].filter(Boolean).join(` `),r,n].filter(Boolean).join(`, `):[n,r,[i,a].filter(Boolean).join(` `),o].filter(Boolean).join(`, `)}function nc(){let{t:e}=ni();return t=>e(t?`common.yes`:`common.no`)}function rc({value:e}){let t=nc();return(0,Q.jsx)(Q.Fragment,{children:t(e)})}function ic({images:e,index:t,open:n,onOpenChange:r,onIndexChange:i}){let{t:a}=tr(),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)(It,{open:n,onOpenChange:r,children:(0,Q.jsxs)(st,{className:`max-w-[92vw] sm:max-w-4xl ${Et} p-0 bg-transparent border-0 shadow-none`,onKeyDown:l,children:[(0,Q.jsx)(Jt,{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)(vr,{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)(yr,{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 ac(e){return zt.safeParse(e).success}function oc(e){return ac(e)?e.id:e}function sc(e){if(A(e))return e;if(e&&typeof e==`object`){let t=e,n=t.file_id??t.id;if(typeof n==`string`&&n)return n}}var cc=`/api/v1/storage`;function lc(e){return`${cc}/files/${encodeURIComponent(e)}`}function uc(e){if(/^data:/i.test(e))return;let t=(e.split(/[?#]/)[0]??e).split(`/`).filter(Boolean).pop();if(!t)return e;try{return decodeURIComponent(t)}catch(e){if(e instanceof URIError)return t;throw e}}function dc(e,t=`File`){if(e==null)return{name:t,raw:e};if(typeof e==`string`)return A(e)?{id:e,name:t,url:lc(e),raw:e}:{url:e,name:uc(e)??t,raw:e};if(typeof e==`object`){if(ac(e))return{id:e.id,name:t,url:lc(e.id),metadataRefused:!0,raw:e};let n=e,r=e=>typeof e==`string`&&e?e:void 0,i=sc(n),a=r(n.url)??(i?lc(i):void 0);return{id:i,name:r(n.name)??r(n.original_name)??(r(n.url)?uc(r(n.url)):void 0)??t,url:a,size:typeof n.size==`number`?n.size:void 0,mimeType:r(n.mimeType)??r(n.mime_type),raw:e}}return{name:t,raw:e}}function fc(e,t=`File`){return e==null?[]:(Array.isArray(e)?e:[e]).filter(e=>e!=null).map(e=>dc(e,t))}function pc(e){return(e.mimeType??``).startsWith(`image/`)}var mc=class extends Error{code=`UPLOAD_INCOMPLETE`;fileName;constructor(e){super(`upload of "${e}" did not complete: the upload adapter returned no sys_file id (meta.fileId), so nothing was submitted`),this.name=`UploadIncompleteError`,this.fileName=e}};function hc(e,t){let n=e.meta?.fileId;if(A(n))return n;throw new mc(t??e.name)}function gc(e,t){return{id:A(e.meta?.fileId)?e.meta.fileId:void 0,name:e.name||t||`File`,url:e.url,size:e.size,mimeType:e.mimeType,raw:e}}function _c(e,t){return Object.keys(t).length===0?e:e.map(e=>{let n=e.id?t[e.id]:void 0;return n?e.raw&&typeof e.raw==`object`&&typeof e.raw.url==`string`&&e.raw.url?e:{...n,raw:e.raw}:e})}function vc(){let{t:e}=tr();return{label:e(`fields.file.restricted`,{defaultValue:`Restricted file`}),hint:e(`fields.file.restrictedHint`,{defaultValue:`You do not have access to the details of this file`})}}function yc({view:e,className:t,compact:n=!1,icon:r=!0}){let{label:i,hint:a}=vc(),o=e.url?.trim(),s=(0,Q.jsxs)(Q.Fragment,{children:[(r||n)&&(0,Q.jsx)(Nr,{className:`size-3 shrink-0`,"aria-hidden":`true`}),!n&&(0,Q.jsx)(`span`,{className:`truncate`,children:i})]}),c=U(`inline-flex min-w-0 max-w-full items-center gap-1 align-middle text-muted-foreground`,t);return o?(0,Q.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,title:a,onClick:e=>e.stopPropagation(),"data-slot":`file-restricted`,"aria-label":n?i:void 0,className:U(c,`hover:text-foreground hover:underline`),children:s}):(0,Q.jsx)(`span`,{className:c,title:a,"data-slot":`file-restricted`,...n?{role:`img`,"aria-label":i}:{},children:s})}function bc({view:e,fallback:t,className:n,icon:r=!0}){if(e.metadataRefused)return(0,Q.jsx)(yc,{view:e,className:n,icon:r});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)(Or,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:a})]})}function xc(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 Sc=$.lazy(()=>Z(()=>import(`./MarkdownContent-DHtoj-cP.js`),[]));function Cc(e){let t=xc(e);if(t!=null&&t!==``)return String(t)}function wc({value:e}){let t=Cc(e);return t===void 0?(0,Q.jsx)(X,{}):(0,Q.jsx)($.Suspense,{fallback:(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.slice(0,80)}),children:(0,Q.jsx)(Sc,{value:t})})}function Tc(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 Ec({value:e}){let t=Cc(e);return t===void 0?(0,Q.jsx)(X,{}):(0,Q.jsx)(`div`,{className:`prose prose-sm max-w-none dark:prose-invert break-words`,dangerouslySetInnerHTML:{__html:Tc(t)}})}var Dc={markdown:wc,html:Ec,richtext:Ec};Object.keys(Dc);function Oc(e){return Dc[e]}var kc;function Ac(e){kc=e}function jc(){return kc}var Mc={select:`field:multiselect`},Nc=`field:`;function Pc(e,t){return t?.multiple&&Mc[e]?Mc[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]||(an(e)?`${Nc}${e}`:`field:text`)}var Fc=[`error`,`onUploadingChange`,`dataSource`,`dependentValues`,`dependsOn`,`dependsOnLabels`,`emptyHint`,`onSelectRecord`,`onCreateNew`];function Ic(e){let t=new Set(Fc),n={};for(let r of Object.keys(e))t.has(r)&&(n[r]=e[r]);return n}var Lc=n({TextField:()=>Rc});function Rc({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=n;if(r)return(0,Q.jsx)(`span`,{className:`text-sm`,children:e||(0,Q.jsx)(X,{})});let s=o?.rows,c=ri(a),l=o?.maxLength;return s&&s>1?(0,Q.jsx)(ct,{...c,value:e||``,onChange:e=>t(e.target.value),placeholder:o?.placeholder,maxLength:l,disabled:r||c.disabled,"aria-invalid":!!i}):(0,Q.jsx)(nn,{...c,type:o?.type===`password`?`password`:`text`,value:e||``,onChange:e=>t(e.target.value),placeholder:o?.placeholder,maxLength:l,disabled:r||c.disabled,"aria-invalid":!!i})}function zc(e){return(0,Q.jsx)(kt,{...e})}var Bc=n({TextAreaField:()=>Vc});function Vc({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)(X,{})});let d=o?.rows||4,f=!!o?.mobile_fullscreen,p=ri(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)(ct,{...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)(Yt,{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)(zc,{value:e??``,onCommit:t,label:o?.label,testIdPrefix:`textarea`,disabled:m,error:i,footer:e=>s?(0,Q.jsx)(Yt,{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)(ct,{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`})})]})}var Hc=n({NumberField:()=>Uc});function Uc({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let{refusal:o,readBadInput:s}=ai(`1234`),c=ir();if(r)return e==null?(0,Q.jsx)(X,{}):(0,Q.jsx)(`span`,{className:`text-sm`,children:typeof e==`number`?ei(e,n,c):e});let l=n,u=l?.scale,d=typeof l?.step==`number`?l.step:typeof u==`number`?10**-u:`any`,f=ri(a),p=e=>{s(e.target),f.onBlur?.(e)};return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(nn,{...f,type:`number`,value:e??``,onChange:e=>{s(e.target);let n=e.target.value;t(n===``?null:Number(n))},onBlur:p,placeholder:l?.placeholder,disabled:r||f.disabled,className:U(o?oi:``,f.className),min:typeof l?.min==`number`?l.min:void 0,max:typeof l?.max==`number`?l.max:void 0,step:d,"aria-invalid":!!i||!!o}),(0,Q.jsx)(ii,{refusal:o})]})}var Wc=n({CurrencyField:()=>Gc});function Gc({value:e,onChange:t,field:n,readonly:r,error:i,className:a,...o}){let s=n,{currency:c}=er(),l=ir(),u=or(s,c),d=ti(u),{refusal:f,readBadInput:p}=ai(`1234.56`);if(r)return e==null?(0,Q.jsx)(X,{}):(0,Q.jsx)(`span`,{className:`text-sm font-medium tabular-nums`,children:$r(Number(e),u,l)});let m=ri(o),h=e=>{p(e.target);let n=parseFloat(e.target.value);isNaN(n)||t(parseFloat(n.toFixed(d))),m.onBlur?.(e)},g=u?Yr(u,l):``;return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[g&&(0,Q.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500`,children:g}),(0,Q.jsx)(nn,{...m,type:`number`,value:e??``,onChange:e=>{p(e.target),t(e.target.value===``?null:parseFloat(e.target.value))},onBlur:h,placeholder:s?.placeholder||`0.00`,disabled:r||o.disabled,className:U(g?`pl-8`:``,f?oi:``,a),min:typeof s?.min==`number`?s.min:void 0,max:typeof s?.max==`number`?s.max:void 0,step:(10**-d).toFixed(d),"aria-invalid":!!i||!!f})]}),(0,Q.jsx)(ii,{refusal:f})]})}var Kc=n({PercentField:()=>Jc}),qc=e=>{if(!Number.isFinite(e))return e;let[t,n]=String(e).split(`e`);return Number(`${t}e${n?Number(n)-2:-2}`)};function Jc({value:e,onChange:t,field:n,readonly:r,error:i,className:a,...o}){let s=n,c=Un({type:`percent`,scale:s?.scale}),{refusal:l,readBadInput:u}=ai(`12.5`),d=ir(),{t:f}=ni(),p=typeof s?.max==`number`?s.max:void 0,m=se({type:`percent`,max:p})===`whole`,h=e=>m?e:e*100,g=e=>m?e:qc(e),_=m?p:100;if(r)return e==null?(0,Q.jsx)(X,{}):(0,Q.jsx)(`span`,{className:`text-sm font-medium tabular-nums`,children:Qr(h(e),c,d)});let v=e==null?``:h(e),y=e==null?0:h(e),b=e=>{if(u(e.target),e.target.value===``){t(null);return}let n=parseFloat(e.target.value);t(isNaN(n)?null:g(n))},x=ri(o),S=e=>{u(e.target),x.onBlur?.(e)},C=e=>{if(r||o.disabled)return;if(!Array.isArray(e)||e.length===0){t(null);return}let n=e[0];t(typeof n==`number`?g(n):null)},w=10**-c;return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(nn,{...x,type:`number`,value:v,onChange:b,onBlur:S,placeholder:s?.placeholder||`0`,disabled:r||o.disabled,className:U(`pr-8`,l?oi:``,a),step:(10**-c).toFixed(c),"aria-invalid":!!i||!!l}),(0,Q.jsx)(`span`,{className:`absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500`,children:`%`})]}),(0,Q.jsx)(ii,{refusal:l}),(0,Q.jsx)(de,{value:[y],onValueChange:C,min:0,max:_,step:w,disabled:r||o.disabled,className:`w-full`,"aria-label":f(`fields.percent.slider`),"data-testid":`percent-slider`})]})}var Yc=n({SliderField:()=>Xc});function Xc({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=n,s=o?.min??0,c=o?.max??100,l=o?.step??1;if(r)return(0,Q.jsxs)(`div`,{...si(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:u,disabled:d,className:f,...p}=ri(a);return(0,Q.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Q.jsx)(de,{name:u,value:[e??s],onValueChange:e=>t(e[0]),min:s,max:c,step:l,disabled:r||a.disabled,className:a.className,thumbProps:{...p,"aria-invalid":!!i}}),(0,Q.jsx)(`span`,{className:`text-sm font-medium w-12 text-right`,children:e??s})]})}var Zc=n({RatingField:()=>Qc});function Qc({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`,{...si(o,`instead-of-the-inputs`),className:U(`flex items-center gap-1`,i),children:[Array.from({length:s},(e,t)=>(0,Q.jsx)(Ur,{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}=ri(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)(Ur,{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 $c=n({BooleanField:()=>el});function el({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=n,s=o?.widget,c=(0,$.useId)(),l=nc(),u=a.id,d=u||o?.name||c,f=o?.label||`Checkbox`,p=!u;if(r)return typeof e==`boolean`?(0,Q.jsx)(`span`,{className:`text-sm`,children:l(e)}):(0,Q.jsx)(X,{});let m=ri(a);return s===`checkbox`?(0,Q.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,Q.jsx)(ln,{...m,id:d,checked:!!e,onCheckedChange:e=>t(!!e),disabled:r||m.disabled,"aria-invalid":!!i}),p&&(0,Q.jsx)(gn,{htmlFor:d,className:`sr-only`,children:f})]}):(0,Q.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,Q.jsx)(Lt,{...m,id:d,checked:!!e,onCheckedChange:t,disabled:r||m.disabled,"aria-invalid":!!i}),p&&(0,Q.jsx)(gn,{htmlFor:d,className:`sr-only`,children:f})]})}var tl=n({MultiSelectField:()=>nl});function nl({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}=ui(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=si(u,`instead-of-the-inputs`);if(r)return p.length===0?(0,Q.jsx)(X,{...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)(dt,{variant:`outline`,children:t?N(t):e},e)})});if(g.length===0)return(0,Q.jsx)(li,{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}=ri(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:N(e)},t)})]})}var rl=n({SelectField:()=>il});function il(e){return e.field?.multiple?(0,Q.jsx)(nl,{...e}):(0,Q.jsx)(al,{...e})}function al({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}=ni(),p=l.name||u?.name||l.id||``,m=n?.dependsOn??o,{options:h,gated:g,dependsOnFields:_}=ui(d,m,a);if((0,$.useEffect)(()=>{r||d.length!==0&&(g||e!=null&&e!==``&&(He(e,h)||t?.(null)))},[h,g]),r){let t=d.find(t=>t.value===e),n=t?N(t):e;return n?(0,Q.jsx)(`span`,{className:`text-sm`,children:n}):(0,Q.jsx)(X,{})}if(h.length===0)return(0,Q.jsx)(li,{emptyHint:s,gated:g,dependsOnFields:_,testId:p?`select-empty-${p}`:void 0,className:`h-9`,hostControlProps:ci(l)});let{name:v,disabled:y,...b}=ri(l);return(0,Q.jsxs)(M,{name:v,value:e===null||e===void 0&&typeof t==`function`?``:e,onValueChange:t,disabled:r||l.disabled,children:[(0,Q.jsx)(V,{...b,"data-testid":p?`select-trigger-${p}`:void 0,"aria-invalid":!!i,children:(0,Q.jsx)(Je,{placeholder:u?.placeholder||f(`common.selectOption`)})}),(0,Q.jsx)(ie,{position:`popper`,children:h.map(e=>(0,Q.jsx)(un,{value:e.value,"data-testid":`select-option-${e.value}`,children:N(e)},e.value))})]})}var ol=n({RadioField:()=>sl});function sl({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}=ui(f,h,a);(0,$.useEffect)(()=>{r||f.length!==0&&(_||e!=null&&e!==``&&(He(e,g)||t?.(null)))},[g,_]);let y=si(u,`instead-of-the-inputs`);if(r){if(e==null||e===``)return(0,Q.jsx)(X,{...y});let t=f.find(t=>t.value===e);return(0,Q.jsx)(`span`,{...y,className:`text-sm`,children:t?N(t):String(e)})}return g.length===0?(0,Q.jsx)(li,{emptyHint:s,gated:_,dependsOnFields:v,testId:m?`radio-empty-${m}`:void 0,className:`min-h-9`,hostGroupProps:y}):(0,Q.jsx)(Ze,{...ri(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)(ye,{value:t,id:n,"data-testid":`radio-option-${t}`}),(0,Q.jsx)(gn,{htmlFor:n,className:`font-normal`,children:N(e)})]},t)})})}var cl=n({CheckboxesField:()=>ll});function ll({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}=ui(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=si(u,`instead-of-the-inputs`);if(r)return p.length===0?(0,Q.jsx)(X,{...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)(dt,{variant:`outline`,children:t?N(t):e},e)})});if(_.length===0)return(0,Q.jsx)(li,{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}=ri(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)(ln,{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)(gn,{htmlFor:n,className:`font-normal`,children:N(e)})]},t)})})}var ul=n({TagsField:()=>dl});function dl({value:e,onChange:t,field:n,readonly:r,className:i,error:a,...o}){let s=Array.isArray(e)?e:e==null?[]:[e],[c,l]=$.useState(``),{t:u}=ni();if(r)return s.length===0?(0,Q.jsx)(X,{}):(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:s.map(e=>(0,Q.jsx)(dt,{variant:`secondary`,children:e},e))});let d=e=>{let n=e.trim();n&&!s.includes(n)&&(t([...s,n]),l(``))},f=e=>t(s.filter(t=>t!==e)),p=ri(o),m=e=>{d(c),p.onBlur?.(e)},h=e=>{e.key===`Enter`||e.key===`,`?(e.preventDefault(),d(c)):e.key===`Backspace`&&c===``&&s.length>0&&f(s[s.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:[s.map(e=>(0,Q.jsxs)(dt,{variant:`secondary`,className:`gap-1`,children:[e,(0,Q.jsx)(`button`,{type:`button`,onClick:()=>f(e),className:`ml-0.5 rounded-full text-muted-foreground hover:text-foreground`,"aria-label":`Remove ${e}`,children:`×`})]},e)),(0,Q.jsx)(nn,{...p,value:c,onChange:e=>l(e.target.value),onKeyDown:h,onBlur:m,disabled:o.disabled,placeholder:s.length===0?n?.placeholder||u(`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 fl(e){if(!(e.disabled||e.readOnly))try{e.showPicker?.()}catch{}}var pl=n({TimeField:()=>ml});function ml({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)(X,{})});let o=ri(a);return(0,Q.jsx)(nn,{...o,type:`time`,value:e||``,onChange:e=>t(e.target.value),onClick:e=>{fl(e.currentTarget),o.onClick?.(e)},disabled:r||o.disabled,"aria-invalid":!!i})}var hl=n({EmailField:()=>gl});function gl({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=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)(X,{});let s=ri(a);return(0,Q.jsx)(nn,{...s,type:`email`,value:e||``,onChange:e=>t(e.target.value),placeholder:o?.placeholder||`email@example.com`,disabled:r||s.disabled,"aria-invalid":!!i})}var _l=n({PhoneField:()=>vl});function vl({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=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)(X,{});let s=ri(a);return(0,Q.jsx)(nn,{...s,type:`tel`,value:e||``,onChange:e=>t(e.target.value),placeholder:o?.placeholder||`(555) 123-4567`,disabled:r||s.disabled,"aria-invalid":!!i})}var yl=n({UrlField:()=>bl});function bl({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=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)(X,{});let s=ri(a);return(0,Q.jsx)(nn,{...s,type:`url`,value:e||``,onChange:e=>t(e.target.value),placeholder:o?.placeholder||`https://example.com`,disabled:r||s.disabled,"aria-invalid":!!i})}function xl(e){return e==null?!1:Array.isArray(e)?e.length>0:typeof e==`object`&&Object.keys(e).length>0}function Sl(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)(``),[w,T]=(0,$.useState)(null),E=(0,$.useRef)(null),D=(0,$.useRef)(0),O=(0,$.useCallback)(()=>{E.current&&=(clearTimeout(E.current),null)},[]),k=(0,$.useMemo)(()=>xl(o)?JSON.stringify(o):``,[o]),ee=(0,$.useMemo)(()=>s?.length?s.join(`,`):``,[s]),A=(0,$.useMemo)(()=>c?.length?c.join(`,`):``,[c]),j=!!r&&!!t&&typeof t.find==`function`&&!!n,M=(0,$.useCallback)(async(e,r,l)=>{if(!j||!t||!n)return;let u=++D.current,f=()=>D.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}),xl(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),C(e)}catch(t){if(!f())return;h(t instanceof Error?t.message:String(t)),d([]),C(e)}finally{f()&&p(!1)}},[j,t,n,i,a,k,ee,A]);(0,$.useEffect)(()=>{j&&M(b,v,w)},[j,v,w,M]);let N=(0,$.useCallback)(()=>{D.current+=1,O(),p(!1),d([]),h(null),x(``),C(``),y(1),T(null)},[O]);(0,$.useEffect)(()=>{j||N()},[j,N]),(0,$.useEffect)(()=>()=>O(),[M,v,w,O]);let P=(0,$.useCallback)(e=>{x(e),y(1),O(),E.current=setTimeout(()=>{M(e,1,w)},l)},[M,w,l,O]),F=(0,$.useCallback)(e=>{y(e)},[]),I=(0,$.useCallback)(e=>{T(t=>t&&t.field===e?{field:e,direction:t.direction===`asc`?`desc`:`asc`}:{field:e,direction:`asc`}),y(1)},[]),L=(0,$.useCallback)(e=>{T(e),y(1)},[]),te=(0,$.useCallback)(()=>{M(b,v,w)},[M,b,v,w]);return{records:u,loading:f,error:m,total:g,totalPages:Math.max(1,Math.ceil(g/Math.max(1,i))),page:v,search:b,answeredSearch:S,sort:w,setPage:F,setSearch:P,toggleSort:I,setSort:L,reset:N,refetch:te}}function Cl(e){if(!e||typeof e!=`object`)return;let t=e,n=t.fields;if(!n||typeof n!=`object`)return;let r=Array.isArray(n)?n.map(e=>[e?.name,e]):Object.entries(n),i={};for(let[e,t]of r)typeof e==`string`&&t&&typeof t==`object`&&t.internal!==!0&&(i[e]=t);let a=Array.isArray(t.searchableFields)?t.searchableFields.filter(e=>typeof e==`string`):void 0;return h({fields:i,searchableFields:a}).allowed.length>0}function wl(e){return typeof e==`string`?{field:e}:e}function Tl(e){return e.replace(/_/g,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/\b\w/g,e=>e.toUpperCase())}function El(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 Dl(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=El(e,n,a.field,r);c&&(s.options=c),i[a.field]=s}return i}function Ol(e,t,n){let{descriptors:r,cellRenderer:i,objectSchema:a,titleField:o,displayField:s,displayLocale:c}=n;if(a&&t.field===s){let t=xn(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?Yn(l.$date,void 0,{locale:c}):l.name||l.label?String(l.name||l.label):JSON.stringify(l):typeof l==`boolean`?(0,Q.jsx)(rc,{value:l}):String(l)}var kl=10,Al=60,jl=5,Ml=[`sm:max-w-xl`,`sm:max-w-xl`,`sm:max-w-2xl`,`sm:max-w-3xl`,`sm:max-w-3xl lg:max-w-4xl`],Nl=`sm:max-w-3xl lg:max-w-5xl`,Pl=3;function Fl(e,t){return Ml[(t?Math.max(e,Pl):e)-1]??Nl}var Il=new Set([`email`,`url`,`phone`,`file`,`video`,`audio`]),Ll=`text`;function Rl(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 zl(e){return e==null?void 0:String(e)}function Bl(e,t){let n=e?.find(e=>String(e.value)===t);return n?n.value:t}function Vl(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 Hl({children:e}){let t=cn();return t?(0,Q.jsx)(Ct,{value:{...t,recordHref:void 0,openRecord:void 0},children:e}):(0,Q.jsx)(Q.Fragment,{children:e})}function Ul({open:e,onOpenChange:t,title:n=`Select Record`,multiple:r=!1,dataSource:i,objectName:a,columns:o,displayField:s,objectSchema:c,idField:u=`id`,pageSize:d=kl,value:f,onSelect:p,onSelectRecords:m,lookupFilters:h,baseFilter:g,cellRenderer:_,fieldsMeta:y,filterColumns:b,renderFilterBar:S,renderGrid:w}){let E=s??`name`,{t:D}=ni(),{translateOptions:O}=v(),k=ir(),[ee,A]=(0,$.useState)(new Set),N=(0,$.useRef)(new Map),[P,F]=(0,$.useState)(-1),I=(0,$.useRef)(null),[L,te]=(0,$.useState)(!1),[ne,R]=(0,$.useState)({}),[z,B]=(0,$.useState)({}),re=(0,$.useRef)(null),[ae,H]=(0,$.useState)(``),oe=(0,$.useMemo)(()=>o&&o.length>0?o.map(wl):[{field:E,label:Tl(E)}],[o,E]),se=(0,$.useMemo)(()=>Dl(oe,y,a,O),[oe,y,a,O]),ce=Js(),le=(0,$.useMemo)(()=>{let e=oe.filter(e=>e.field!==u);if(e.length===0)return[];let t=mt(y,e);return ce.isLoaded?t.filter(e=>ce.checkField(a,e,`read`)):t},[y,oe,u,ce,a]),W=(0,$.useMemo)(()=>{if(!ce.isLoaded)return oe;let e=oe.filter(e=>e.field===u||ce.checkField(a,e.field,`read`));return e.length>0?e:[{field:u,label:Tl(u)}]},[oe,ce,a,u]),ue=(0,$.useMemo)(()=>{if(b&&b.length>0)return b;if(h&&h.length>0)return h.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:Tl(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}})}:{}}})},[b,h]),de=(0,$.useMemo)(()=>{if(ue)return ue.map(e=>{if(e.type!==`select`||e.options&&e.options.length>0)return e;let t=El(y?.[e.field],a,e.field,O);return t?{...e,options:t}:e})},[ue,y,a,O]),G=(0,$.useMemo)(()=>{let e=h?.length?Rl(h):{},t=de?.length?Vl(ne,de):{},n=Array.isArray(g)?g:void 0,r=n?void 0:g,i={...e,...t,...r??{}},a=Object.keys(i).length>0?i:void 0;if(!n)return{ok:!0,node:a};let o=he(a);if(!o.ok)return o;let s=he(n);return s.ok?{ok:!0,node:C(o.node,s.node)}:s},[h,de,ne,g]),fe=G.ok?void 0:G.refusal,pe=Sl({dataSource:i,objectName:a,enabled:e&&G.ok,pageSize:d,paginate:!0,filter:G.ok?G.node:void 0,expand:le}),{records:K,loading:ge}=pe,q=fe?fe.message:pe.error,J=pe.total,_e=pe.totalPages,ve=pe.search,ye=pe.page,Y=pe.sort?.field??null,be=pe.sort?.direction??`asc`,Se=pe.setPage,Ce=pe.toggleSort,we=pe.setSearch,Te=Cl(c)!==!1;(0,$.useEffect)(()=>{e||(F(-1),te(!1),R({}),B({}),H(``),A(new Set(r&&Array.isArray(f)?f:[])),N.current.clear())},[e]),(0,$.useEffect)(()=>{e&&r&&A(new Set(Array.isArray(f)?f:[]))},[e,r,f]),(0,$.useEffect)(()=>{F(-1)},[K]);let Ee=(0,$.useCallback)(e=>e[u]??e.id??e._id,[u]),De=(0,$.useCallback)(e=>{let t=Ee(e);return r?ee.has(t):f===t},[r,f,ee,Ee]),Oe=(0,$.useCallback)(e=>{let n=Ee(e),i=Ye(e,y);r?A(e=>{let t=new Set(e);return t.has(n)?(t.delete(n),N.current.delete(n)):(t.add(n),N.current.set(n,i)),t}):(p(n),m?.([i]),t(!1))},[r,Ee,y,p,m,t]),Ae=(0,$.useCallback)(()=>{let e=K.map(e=>({rid:Ee(e),selected:Ye(e,y)}));A(t=>{let n=new Set(t),r=e.length>0&&e.every(({rid:e})=>n.has(e));for(let{rid:t,selected:i}of e)r?(n.delete(t),N.current.delete(t)):n.has(t)||(n.add(t),N.current.set(t,i));return n})},[K,Ee,y]),je=(0,$.useCallback)(()=>{let e=Array.from(ee);p(e);let n=e.map(e=>N.current.get(e)).filter(Boolean);m?.(n),t(!1)},[ee,p,m,t]),Me=(0,$.useCallback)(()=>{Se(Math.max(1,ye-1))},[Se,ye]),Ne=(0,$.useCallback)(()=>{Se(Math.min(_e,ye+1))},[Se,ye,_e]),Pe=(0,$.useCallback)(e=>{if(e.key!==`Enter`)return;let t=parseInt(ae,10);!isNaN(t)&&t>=1&&t<=_e&&Se(t),H(``)},[ae,_e]),Fe=(0,$.useCallback)(e=>{K.length!==0&&(e.key===`ArrowDown`?(e.preventDefault(),F(e=>Math.min(e+1,K.length-1))):e.key===`ArrowUp`?(e.preventDefault(),F(e=>Math.max(e-1,0))):(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P>=0&&P<K.length&&Oe(K[P])))},[K,P,Oe]);(0,$.useEffect)(()=>{if(P>=0&&I.current){let e=I.current.querySelector(`[data-row-index="${P}"]`);e&&typeof e.scrollIntoView==`function`&&e.scrollIntoView({block:`nearest`})}},[P]);let Ie=(0,$.useCallback)((e,t)=>Ol(c&&t.field===E?Fa(Ye(e,y),ce,a,[u]):e,t,{descriptors:se,cellRenderer:_?e=>_(Il.has(e)?Ll:e):void 0,objectSchema:c,titleField:s,displayField:E,displayLocale:k}),[_,c,s,E,y,se,k,ce,a,u]),Le=(0,$.useCallback)(e=>Y===e?be===`asc`?(0,Q.jsx)(fr,{className:`ml-1 size-3`}):(0,Q.jsx)(cr,{className:`ml-1 size-3`}):(0,Q.jsx)(dr,{className:`ml-1 size-3 opacity-40`}),[Y,be]),Re=(0,$.useCallback)((e,t,n)=>{e.preventDefault(),e.stopPropagation(),re.current={field:t,startX:e.clientX,startWidth:n};let r=e=>{if(!re.current)return;let t=e.clientX-re.current.startX,n=Math.max(Al,re.current.startWidth+t);B(e=>({...e,[re.current.field]:n}))},i=()=>{re.current=null,document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[]),ze=(0,$.useCallback)((e,t)=>{R(n=>({...n,[e]:t})),Se(1)},[]),Be=(0,$.useCallback)(()=>{R({}),Se(1)},[]),Ve=(0,$.useMemo)(()=>Object.values(ne).filter(e=>e!=null&&e!==``).length,[ne]),He=(0,$.useCallback)(e=>{let t=ne[e.field],n=e.label||Tl(e.field);switch(e.type){case`select`:return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(gn,{className:`text-xs text-muted-foreground`,children:n}),(0,Q.jsxs)(M,{value:zl(t)??``,onValueChange:t=>ze(e.field,Bl(e.options,t)),children:[(0,Q.jsx)(V,{className:`h-8 text-xs`,children:(0,Q.jsx)(Je,{placeholder:D(`lookup.filterPlaceholder`,{label:n})})}),(0,Q.jsx)(ie,{children:e.options?.map(e=>(0,Q.jsx)(un,{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)(gn,{className:`text-xs text-muted-foreground`,children:n}),(0,Q.jsx)(nn,{type:`number`,className:`h-8 text-xs`,value:t??``,placeholder:D(`lookup.filterPlaceholder`,{label:n}),onChange:t=>{let n=t.target.value;ze(e.field,n===``?``:Number(n))}})]});case`date`:return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(gn,{className:`text-xs text-muted-foreground`,children:n}),(0,Q.jsx)(nn,{type:`date`,className:`h-8 text-xs`,value:t??``,onChange:t=>ze(e.field,t.target.value)})]});case`boolean`:return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(gn,{className:`text-xs text-muted-foreground`,children:n}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 h-8`,children:[(0,Q.jsx)(ln,{checked:!!t,onCheckedChange:t=>ze(e.field,!!t)}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:D(`lookup.yes`)})]})]});default:return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(gn,{className:`text-xs text-muted-foreground`,children:n}),(0,Q.jsx)(nn,{className:`h-8 text-xs`,value:t??``,placeholder:D(`lookup.filterPlaceholder`,{label:n}),onChange:t=>ze(e.field,t.target.value)})]})}},[ne,ze]),Ue=(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`,[]),We=r&&K.length>0&&K.every(e=>ee.has(Ee(e))),Ge=!w&&!q&&J>0;return(0,Q.jsx)(It,{open:e,onOpenChange:t,children:(0,Q.jsxs)(st,{className:U(`w-[95vw] max-h-[85vh] sm:max-h-[80vh] flex flex-col`,Et,Fl(W.length,r)),"data-testid":`record-picker-dialog`,children:[(0,Q.jsx)(ht,{children:(0,Q.jsxs)(Jt,{children:[n,r&&(0,Q.jsx)(`span`,{className:`sr-only`,children:` (multiple selection)`})]})}),Te&&(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(Br,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground`}),(0,Q.jsx)(nn,{placeholder:D(`table.search`),value:ve,onChange:e=>we(e.target.value),className:`pl-9 pr-9`,"data-testid":`record-picker-search`}),ge&&(0,Q.jsx)(Mr,{className:`absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground`,"data-testid":`record-picker-loading-indicator`})]}),de&&de.length>0&&(0,Q.jsx)(`div`,{children:S?(0,Q.jsx)(`div`,{"data-testid":`record-picker-filter-bar`,children:S({filterColumns:de,values:ne,onChange:ze,onClear:Be,activeCount:Ve})}):(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:Ve>0?`secondary`:`outline`,size:`sm`,className:`gap-1.5 shrink-0`,onClick:()=>te(e=>!e),children:[(0,Q.jsx)(Vr,{className:`size-3.5`}),D(`lookup.filters`),Ve>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:Ve})]}),Ve>0&&(0,Q.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`gap-1 text-xs`,onClick:Be,children:[(0,Q.jsx)(Jr,{className:`size-3`}),D(`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:de.map(e=>(0,Q.jsx)(`div`,{children:He(e)},e.field))})]})}),q&&(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-4`,role:`alert`,children:[(0,Q.jsx)(br,{className:`size-5 text-destructive`}),(0,Q.jsx)(`p`,{className:`text-sm text-destructive`,children:q}),fe?null:(0,Q.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>pe.refetch(),type:`button`,children:D(`lookup.retry`)})]}),w?(0,Q.jsx)(`div`,{className:`flex-1 min-h-0`,"data-testid":`record-picker-grid-slot`,children:w({columns:W,records:K,loading:ge,totalCount:J,currentPage:ye,pageSize:d,sortField:Y,sortDirection:be,onSort:Ce,onPageChange:Se,onRowClick:Oe,isSelected:De,multiple:r,idField:u,cellRenderer:_})}):(0,Q.jsxs)(Q.Fragment,{children:[ge&&K.length===0&&!q&&(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)(ke,{children:[(0,Q.jsx)(Vt,{children:(0,Q.jsxs)(l,{className:`bg-muted/40`,children:[r&&(0,Q.jsx)(me,{className:`w-10`,children:(0,Q.jsx)(xe,{className:`size-4 rounded`})}),W.map(e=>(0,Q.jsx)(me,{children:(0,Q.jsx)(xe,{className:`h-4 w-20`})},e.field))]})}),(0,Q.jsx)(T,{children:Array.from({length:jl},(e,t)=>(0,Q.jsxs)(l,{children:[r&&(0,Q.jsx)(x,{className:`w-10`,children:(0,Q.jsx)(xe,{className:`size-4 rounded`})}),W.map(e=>(0,Q.jsx)(x,{children:(0,Q.jsx)(xe,{className:`h-4 w-full`})},e.field))]},t))})]})}),!ge&&!q&&K.length===0&&(0,Q.jsx)(`div`,{className:`py-8 text-center`,children:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:D(`lookup.noRecords`)})}),!q&&K.length>0&&(0,Q.jsxs)(`div`,{className:`relative flex-1 overflow-auto min-h-0 border rounded-md`,"aria-busy":ge||void 0,"data-state":ge?`loading`:`idle`,tabIndex:0,onKeyDown:Fe,role:`grid`,"aria-label":D(`console.commandPalette.records`),children:[ge&&(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)(Mr,{className:`size-6 animate-spin text-muted-foreground`})}),(0,Q.jsx)(Hl,{children:(0,Q.jsxs)(ke,{style:Object.keys(z).length>0?{tableLayout:`fixed`}:void 0,children:[(0,Q.jsx)(Vt,{className:`sticky top-0 z-[5] bg-muted/50 [&_tr]:border-b`,"data-testid":`record-picker-sticky-header`,children:(0,Q.jsxs)(l,{children:[r&&(0,Q.jsx)(me,{className:`w-10`,children:(0,Q.jsx)(ln,{checked:We,onCheckedChange:Ae,onKeyDown:e=>e.stopPropagation(),"aria-label":D(`table.selectAllRows`,{defaultValue:`Select all rows`}),"data-testid":`record-picker-select-page`})}),W.map(e=>{let t=z[e.field],n=t?{width:`${t}px`,minWidth:`${t}px`}:e.width?{width:e.width}:void 0;return(0,Q.jsxs)(me,{style:n,className:`cursor-pointer select-none relative group text-xs font-semibold uppercase tracking-wider`,onClick:()=>Ce(e.field),"aria-sort":Y===e.field?be===`asc`?`ascending`:`descending`:`none`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center`,children:[e.label||Tl(e.field),Le(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();Re(t,e.field,n?.width??100)},onClick:e=>e.stopPropagation(),"data-testid":`resize-handle-${e.field}`})]},e.field)})]})}),(0,Q.jsx)(T,{ref:I,children:K.map((e,t)=>{let n=Ee(e),i=De(e),a=t===P;return(0,Q.jsxs)(l,{"data-row-index":t,className:U(`cursor-pointer transition-colors`,Ue(i,t),a&&`ring-2 ring-primary ring-inset`),onClick:()=>Oe(e),"data-testid":`record-row-${n}`,"aria-selected":i,children:[r&&(0,Q.jsx)(x,{className:`w-10 py-2.5`,children:(0,Q.jsx)(ln,{checked:i,tabIndex:-1,onClick:e=>e.stopPropagation(),onCheckedChange:()=>Oe(e),"aria-label":D(`table.selectRow`,{defaultValue:`Select row`}),"data-testid":`record-picker-row-checkbox-${n}`})}),W.map(t=>(0,Q.jsx)(x,{className:`py-2.5`,"data-lookup-cell":t.field,children:Ie(e,t)},t.field))]},n??t)})})]})})]})]}),(Ge||r)&&(0,Q.jsxs)(yn,{className:`gap-2 sm:flex-wrap sm:items-center sm:justify-between sm:space-x-0`,"data-testid":`record-picker-footer`,children:[Ge&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 text-sm text-muted-foreground`,"data-testid":`record-picker-pagination`,children:[(0,Q.jsxs)(`span`,{children:[D(`lookup.recordCount`,{count:J}),_e>1&&` · ${D(`lookup.pageOf`,{current:ye,total:_e})}`]}),_e>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:ye<=1,type:`button`,"aria-label":D(`lookup.prevPage`),children:(0,Q.jsx)(vr,{className:`size-4`})}),(0,Q.jsx)(nn,{className:`h-7 w-12 text-center text-xs px-1`,placeholder:String(ye),value:ae,onChange:e=>H(e.target.value),onKeyDown:Pe,"aria-label":D(`lookup.jumpToPage`),"data-testid":`record-picker-page-jump`}),(0,Q.jsx)(j,{variant:`outline`,size:`icon`,className:`size-7`,onClick:Ne,disabled:ye>=_e,type:`button`,"aria-label":D(`lookup.nextPage`),children:(0,Q.jsx)(yr,{className:`size-4`})})]})]}),r&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 sm:ml-auto`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,"data-testid":`record-picker-selected-count`,children:D(`table.selected`,{count:ee.size})}),(0,Q.jsx)(j,{variant:`outline`,type:`button`,onClick:()=>t(!1),children:D(`common.cancel`)}),(0,Q.jsx)(j,{type:`button`,onClick:je,disabled:ee.size===0,"data-testid":`record-picker-confirm`,children:D(`common.confirm`)})]})]})]})})}function Wl(e,t){if(e&&t)return t.includes(`.`)?t.split(`.`).reduce((e,t)=>e==null?e:e[t],e):e[t]}function Gl(e=`name`){return[e,`name`,`username`,`label`]}function Kl(e,t=`name`){if(e==null)return``;if(typeof e!=`object`)return String(e);let n=typeof t==`string`?Gl(t):t;for(let t of n)if(e[t]!=null)return String(e[t]);return``}function ql(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 Jl(e,t){return!e||!t||t.length===0?``:t.map(t=>Wl(e,t)).filter(e=>e!=null&&e!==``).map(e=>String(e)).join(` · `)}function Yl(e,t=`image`){let n=e&&t?Wl(e,t):void 0;return n?String(n):void 0}function Xl(e,t=`id`){return!e||typeof e!=`object`?e:e[t]??e.id??e._id}function Zl(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 Ql({text:e,query:t}){let n=t?Zl(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 $l({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=Kl(e,n??t),d=Jl(e,r),f=Yl(e,i),p=ql(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)(Ln,{className:`size-9 shrink-0`,children:[f&&(0,Q.jsx)(b,{src:f,alt:u}),(0,Q.jsx)(Oe,{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)(Ql,{text:u,query:s}):`—`}),d&&(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:(0,Q.jsx)(Ql,{text:d,query:s})})]}),a&&(0,Q.jsx)(gr,{className:`size-4 shrink-0 text-primary`,"aria-hidden":!0})]})}function eu({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=Xl(e,a),s=Kl(e,r??n),c=Yl(e,i),l=ql(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)(Ln,{className:`size-6 shrink-0`,children:[c&&(0,Q.jsx)(b,{src:c,alt:s}),(0,Q.jsx)(Oe,{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)(Jr,{className:`size-3.5`,"aria-hidden":!0})})]},String(o))})})]})}var tu=`objectui:lookup:recent:`,nu=5;function ru(){try{return typeof localStorage<`u`?localStorage:null}catch{return null}}function iu(e){let t=ru();if(!e||!t)return[];try{let n=t.getItem(tu+e);if(!n)return[];let r=JSON.parse(n);return Array.isArray(r)?r.slice(0,nu):[]}catch{return[]}}function au(e,t){let n=ru();if(e&&t!=null&&t!==``&&n)try{let r=[t,...iu(e).filter(e=>e!==t)].slice(0,nu);n.setItem(tu+e,JSON.stringify(r))}catch{}}var ou=25,su=6;function cu({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:f,pageSize:m=ou,lookupFilters:h,baseFilter:g,value:_,onSelect:v,onSelectRecords:y,inline:b=!1,trigger:x}){let{t:S}=ni(),w=Vn(),T=(0,$.useMemo)(()=>{let e={...h?.length?Rl(h):{},...g??{}};return Object.keys(e).length>0?e:void 0},[h,g]),E=Js(),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]),ee=(0,$.useMemo)(()=>Gl(s).filter(e=>!E.isLoaded||E.checkField(a,e.split(`.`)[0],`read`)),[s,E,a]),A=Sl({dataSource:i,objectName:a,enabled:e,pageSize:m,filter:T,expand:D,searchFields:f}),M=(0,$.useMemo)(()=>e?iu(a):[],[e,a]),N=(0,$.useMemo)(()=>r?Array.isArray(_)?_:[]:_!=null&&_!==``?[_]:[],[r,_]),P=Sl({dataSource:i,objectName:a,enabled:e&&N.length>0,pageSize:Math.max(1,N.length),filter:{[c]:{$in:N}},expand:D}),I=(0,$.useMemo)(()=>{let e={[c]:{$in:M}};if(!T)return{ok:!0,node:e};let t=he(T);return t.ok?{ok:!0,node:C(t.node,e)}:t},[T,c,M]),L=I.ok?void 0:I.refusal,te=Sl({dataSource:i,objectName:a,enabled:e&&M.length>0&&I.ok,pageSize:Math.max(1,M.length),filter:I.ok?I.node:void 0,expand:D}),ne=(0,$.useMemo)(()=>{let e=new Map;for(let t of P.records)e.set(String(Xl(t,c)),t);return e},[P.records,c]),[R,z]=(0,$.useState)([]),B=(0,$.useRef)(!1),V=(0,$.useRef)(!1);(0,$.useEffect)(()=>{e||(B.current=!1,V.current=!1,z([]))},[e]),(0,$.useEffect)(()=>{if(!e||B.current)return;if(N.length===0){B.current=!0;return}if(P.loading){V.current=!0;return}if(!V.current)return;let t=N.map(e=>ne.get(String(e))).filter(Boolean);z(t),B.current=!0},[e,N,P.loading,ne]);let re=(0,$.useMemo)(()=>new Set(R.map(e=>String(Xl(e,c)))),[R,c]),ie=(0,$.useCallback)((e,n)=>{v(r?e:e[0]??null),y?.(n),e.forEach(e=>au(a,e)),t(!1)},[r,a,v,y,t]),ae=(0,$.useCallback)(e=>{v(e.map(e=>Xl(e,c))),y?.(e)},[v,y,c]),H=(0,$.useCallback)(e=>{let t=Xl(e,c);if(!r){ie([t],[e]);return}let n=String(t),i=R.some(e=>String(Xl(e,c))===n),o=i?R.filter(e=>String(Xl(e,c))!==n):[...R,e];z(o),b&&(i||au(a,t),ae(o))},[r,c,ie,R,b,a,ae]),oe=(0,$.useCallback)(e=>{let t=String(e),n=R.filter(e=>String(Xl(e,c))!==t);z(n),b&&ae(n)},[c,R,b,ae]),se=(0,$.useCallback)(()=>{ie(R.map(e=>Xl(e,c)),R)},[ie,R,c]),ce=A.search.trim().length>0,le=(0,$.useMemo)(()=>{if(ce)return[];let e=new Map(te.records.map(e=>[String(Xl(e,c)),e]));return M.map(t=>e.get(String(t))).filter(Boolean)},[ce,M,te.records,c]),W=(0,$.useMemo)(()=>{if(ce)return A.records;let e=new Set(M.map(String));return A.records.filter(t=>!e.has(String(Xl(t,c))))},[ce,A.records,M,c]),ue=(0,$.useMemo)(()=>[...le,...W],[le,W]),[de,G]=(0,$.useState)(-1),fe=(0,$.useMemo)(()=>A.records.map(e=>String(Xl(e,c))).join(`\0`),[A.records,c]),pe=`${A.search}\u0000${fe}`,[me,K]=(0,$.useState)(pe);me!==pe&&(K(pe),G(-1)),(0,$.useEffect)(()=>{G(e=>e>=ue.length?ue.length-1:e)},[ue.length]);let ge=(0,$.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),G(e=>ue.length?Math.min(ue.length-1,e+1):-1)):e.key===`ArrowUp`?(e.preventDefault(),G(e=>Math.max(0,e-1))):e.key===`Enter`?de>=0&&de<ue.length&&(e.preventDefault(),H(ue[de])):e.key===`Backspace`&&A.search.length===0&&r&&R.length>0&&oe(Xl(R[R.length-1],c))},[ue,de,H,A.search,r,R,oe,c]),q=A.error??L?.message??null,J=A.loading&&!q&&A.records.length===0&&le.length===0,_e=A.loading&&!J,ve=!A.loading&&!q&&W.length===0&&le.length===0,ye=(e,t)=>{let n=Xl(e,c);return(0,Q.jsx)($l,{record:e,displayField:s,nameFields:ee,subtitleFields:O,avatarField:k,selected:re.has(String(n)),active:t===de,highlightQuery:A.search,onSelect:H},String(n))},Y=n||S(`lookup.selectRecord`),be=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(Br,{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)(nn,{autoFocus:!w,value:A.search,onChange:e=>A.setSearch(e.target.value),onKeyDown:ge,placeholder:S(`table.search`),className:`px-8`,role:`combobox`,"aria-expanded":!0,"aria-controls":`people-picker-list`,"data-testid":`people-picker-search`}),A.loading&&(0,Q.jsx)(Mr,{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)(Ge,{className:`min-h-0 flex-1`,"data-testid":`people-picker-list`,children:(0,Q.jsx)(`div`,{id:`people-picker-list`,role:`listbox`,"aria-busy":A.loading,className:U(`flex flex-col gap-0.5 pr-2 transition-opacity`,_e&&`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)(br,{className:`size-5 text-destructive`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`max-w-xs`,children:q}),A.error?(0,Q.jsx)(j,{type:`button`,variant:`outline`,size:`sm`,onClick:A.refetch,children:S(`lookup.retry`)}):null]}):J?Array.from({length:su}).map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 px-2 py-1.5`,children:[(0,Q.jsx)(xe,{className:`size-9 shrink-0 rounded-full`}),(0,Q.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Q.jsx)(xe,{className:`h-3 w-1/3`}),(0,Q.jsx)(xe,{className:`h-2.5 w-1/2`})]})]},t)):(0,Q.jsxs)(Q.Fragment,{children:[le.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`)}),le.map((e,t)=>ye(e,t)),W.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:[`· `,A.total]})]})]}),W.map((e,t)=>ye(e,le.length+t)),ve&&(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)(eu,{records:R,onRemove:oe,onClear:()=>z([]),clearLabel:S(`lookup.clear`),displayField:s,nameFields:ee,avatarField:k,idField:c,label:S(`table.selected`,{count:R.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:se,children:S(`common.confirm`)})]})]})]});return b?w?(0,Q.jsxs)(p,{open:e,onOpenChange:t,children:[(0,Q.jsx)(Ve,{asChild:!0,children:x}),(0,Q.jsxs)(Le,{side:`bottom`,className:`flex h-[85vh] flex-col gap-3`,"data-testid":`people-picker-sheet`,children:[(0,Q.jsx)(F,{className:`text-left`,children:(0,Q.jsx)(Ne,{children:Y})}),be]})]}):(0,Q.jsxs)(o,{open:e,onOpenChange:t,children:[(0,Q.jsx)(Sn,{asChild:!0,children:x}),(0,Q.jsx)(xt,{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:be})]}):w?(0,Q.jsx)(p,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Le,{side:`bottom`,className:`flex h-[85vh] flex-col gap-3`,"data-testid":`people-picker-sheet`,children:[(0,Q.jsx)(F,{className:`text-left`,children:(0,Q.jsx)(Ne,{children:Y})}),be]})}):(0,Q.jsx)(It,{open:e,onOpenChange:t,children:(0,Q.jsxs)(st,{className:`flex max-h-[80vh] flex-col gap-3 sm:max-w-lg`,"data-testid":`people-picker-dialog`,children:[(0,Q.jsx)(ht,{children:(0,Q.jsx)(Jt,{children:Y})}),be]})})}var lu=new Set([`json`,`object`,`grid`,`html`,`richtext`,`markdown`,`code`,`image`,`file`,`avatar`,`vector`,`location`,`geometry`,`textarea`,`secret`,`password`,`encrypted`]);function uu(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function du(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:uu([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)||uu([t,...Object.keys(r).filter(e=>{if(e===t)return!1;let n=i(e);return!(vi(e,n)||n.hidden||n.type&&lu.has(n.type))})]).slice(0,n).map(a)}var fu=n({LookupField:()=>Eu}),pu=50,mu=u,hu=/^(sys_|cloud_|ai_)/,gu=new Set([`user`,`users`]);function _u(e){return!!e&&!hu.test(e)&&!gu.has(e)}var vu=`name`;function yu(e,t,n,r,i,a,o){let s=bu(e,n),c=Fa(e,a,o,[n]),l;if(i){let n=xn(i,c,{titleField:t}),r=e?.id??e?._id;n===`Untitled`||r!=null&&n===`Record #${r}`||(l=n)}let u=l??c[t??vu]??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 bu(e,t){return e[t]??e.id??e._id??e.externalId}function xu(e,t,n){let r=new Map(e.map(e=>[bu(e,n),e]));for(let e of t)r.set(bu(e,n),e);return Array.from(r.values())}function Su(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 Cu(e){return{text:`text`,number:`number`,currency:`number`,percent:`number`,select:`select`,status:`select`,date:`date`,datetime:`date`,boolean:`boolean`}[e]}function wu(e){let t=Array.from(e.children);for(let e of t)e.hidden=!1;for(let n=t.length-1;n>=0&&e.scrollWidth>e.clientWidth;--n)t[n].hidden=!0}function Tu({children:e}){let t=(0,$.useRef)(null);return $.useLayoutEffect(()=>{t.current&&wu(t.current)}),$.useLayoutEffect(()=>{let e=t.current;if(!e||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(()=>wu(e));return n.observe(e),()=>n.disconnect()},[]),(0,Q.jsx)(`span`,{ref:t,className:`flex min-w-0 items-center gap-1 overflow-hidden text-xs text-muted-foreground`,"data-testid":`lookup-option-preview`,children:e})}function Eu({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let[s,c]=(0,$.useState)(!1),{t:l}=ni(),{translateOptions:u}=v(),d=ir(),f=$.useId(),[p,m]=(0,$.useState)(null),[h,g]=(0,$.useState)([]),[_,y]=(0,$.useState)([]),[x,S]=(0,$.useState)(()=>new Set),[w,T]=(0,$.useState)(-1),E=(0,$.useRef)(null),D=n,O=D?.field,k=O&&typeof O==`object`&&(`reference`in O||`type`in O)?O:D,ee=k,A=k?.options||[],M=k?.multiple||!1,N=k?.displayField||k?.reference_field||void 0,P=N||vu,F=k?.descriptionField,I=ee?.idField||`id`,L=k?.reference,te=k?.allowCreate,ne=te==null?_u(L):!!te,R=k?.lookupColumns,z=k?.lookupPageSize,B=k?.lookupFilters,V=ee?.picker,re=ee?.subtitle,ie=k?.avatar_field??k?.avatarField??`image`,ae=k,H=(0,$.useMemo)(()=>{let e=ae?.dependsOn;return!e||!Array.isArray(e)?[]:e.map(e=>typeof e==`string`?{field:e,param:e}:{field:e.field,param:e.param??e.field})},[ae?.dependsOn]),oe=a.dependsOnLabels,se=(0,$.useMemo)(()=>H.map(e=>oe?.[e.field]||e.field).join(l(`validation.formInvalidJoiner`)),[H,oe,l]),ce=a.dependentValues,le=(0,$.useContext)(mu)?.dataSource??null,W=a.dataSource??D?.dataSource??k?.dataSource??le,ue=(0,$.useMemo)(()=>ce??{},[ce]),de=(0,$.useMemo)(()=>H.length!==0&&H.some(({field:e})=>{let t=ue[e];return t==null||t===``||Array.isArray(t)&&t.length===0}),[H,ue]),G=W!=null&&typeof W.find==`function`&&!!L,[fe,pe]=(0,$.useState)(null);(0,$.useEffect)(()=>{if(!W||!L)return;let e=W.getObjectSchema;if(typeof e!=`function`)return;let t=!0;return Promise.resolve(e.call(W,L)).then(e=>{t&&pe(e)}).catch(()=>{}),()=>{t=!1}},[W,L]);let me=(0,$.useMemo)(()=>{if(R&&R.length>0)return R;let e=du(fe,{displayField:P});return e.length>0?e:void 0},[R,fe,P]),K=(0,$.useMemo)(()=>{if(F)return F;let e=me?.find(e=>(typeof e==`string`?e:e.field)!==P);if(e)return typeof e==`string`?e:e.field},[F,me,P]),he=(0,$.useMemo)(()=>{let e=[],t=new Set([P]);F&&(e.push({field:F}),t.add(F));for(let n of me??[]){let r=wl(n);t.has(r.field)||(t.add(r.field),e.push(r))}return e},[F,me,P]),ge=(0,$.useMemo)(()=>Dl(he,fe?.fields,L??``,u),[he,fe,L,u]),q=Js(),J=(0,$.useMemo)(()=>{if(he.length===0)return[];let e=mt(fe?.fields,he);return!q.isLoaded||!L?e:e.filter(e=>q.checkField(L,e,`read`))},[fe,he,q,L]),_e=(0,$.useMemo)(()=>he.filter(e=>!q.isLoaded||!L||e.field===I||q.checkField(L,e.field,`read`)),[he,q,L,I]),ve=(0,$.useMemo)(()=>{if(!me)return;let e=[];for(let t of me)if(typeof t==`object`&&t.type){let n=Cu(t.type);n&&e.push({field:t.field,label:t.label,type:n})}return e.length>0?e:void 0},[me]),ye=a.onCreateNew??D?.onCreateNew,[Y,be]=(0,$.useState)(!1),xe=(0,$.useMemo)(()=>{let e={};for(let{field:t,param:n}of H){let r=ue[t];r!=null&&r!==``&&(e[n]=typeof r==`number`?r:String(r))}return Object.keys(e).length>0?e:void 0},[H,ue]),Se=(0,$.useMemo)(()=>{let e={...B&&B.length>0?Rl(B):{},...xe??{}};return Object.keys(e).length>0?e:void 0},[xe,B]),Ce=Sl({dataSource:W,objectName:L,enabled:s&&G&&!de,pageSize:pu,filter:Se,expand:J}),we=Ce.search,Te=Ce.loading,Ee=Ce.total,De=Ce.error??p,ke=(0,$.useMemo)(()=>Ce.records.map(e=>yu(Ye(e,fe?.fields),N,I,K,fe,q,L)),[Ce.records,N,I,K,fe,q,L]),Ae=G?ke:A,je=(0,$.useMemo)(()=>{if(G||!we)return Ae;let e=we.toLowerCase();return Ae.filter(t=>t.label.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e))},[G,Ae,we]);(0,$.useEffect)(()=>{s||T(-1)},[s]);let Me=Cl(fe)!==!1,Ne=(0,$.useCallback)(e=>{T(-1),Ce.setSearch(e)},[Ce.setSearch]);(0,$.useEffect)(()=>{if(!G||!W||!L)return;let t=(M?Array.isArray(e)?e:[]:e!=null&&e!==``?[e]:[]).filter(e=>e!=null&&e!==``&&typeof e!=`object`&&!Su(e));if(!t.length)return;let n=t.filter(e=>!Ie(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`&&I===`id`){let n=await W.findOne(L,t);n&&e.push(n)}else{let n=await W.find(L,{$filter:{[I]:t},$top:1}),r=n?.data??n??[];r[0]&&e.push(r[0])}}else{let t=[];for(let e=0;e<n.length;e+=pu)t.push(n.slice(e,e+pu));let r=await Promise.all(t.map(e=>W.find(L,{$filter:{[I]:{$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&&y(t=>xu(t,e,I))}catch{}finally{r||S(e=>{let t=new Set(e);for(let e of n)t.add(String(e));return t})}})(),()=>{r=!0}},[e,G,L,I,M]);let[Pe,Fe]=(0,$.useMemo)(()=>{let e=e=>yu(e,N,I,K,fe,q,L);return[h.map(e),_.map(e)]},[h,_,N,I,K,fe,q,L]),Ie=(0,$.useCallback)(e=>A.find(t=>t.value===e)??ke.find(t=>t.value===e)??Pe.find(t=>t.value===e)??Fe.find(t=>t.value===e),[A,ke,Pe,Fe]),Le=(0,$.useCallback)(e=>{let t=String(e);return A.find(e=>String(e.value)===t)??ke.find(e=>String(e.value)===t)??Pe.find(e=>String(e.value)===t)??Fe.find(e=>String(e.value)===t)},[A,ke,Pe,Fe]),Re=(0,$.useCallback)(e=>{let t=typeof e==`object`&&e?e:Su(e);return t?t[I]??t.id??t._id??t.externalId:e},[I]),ze=(0,$.useMemo)(()=>M?Array.isArray(e)?e.map(Re):[]:Re(e),[M,e,Re]),Be=(0,$.useCallback)(e=>{if(e==null||e===``)return;let t=typeof e==`object`?e:Su(e);return t?yu(t,N,I,K,fe,q,L):Ie(e)??Le(e)},[Ie,Le,N,I,K,fe,q,L]),Ve=(0,$.useMemo)(()=>G?(M?Array.isArray(e)?e:[]:e!=null&&e!==``?[e]:[]).some(e=>e!=null&&e!==``&&typeof e!=`object`&&!Su(e)&&!Ie(e)&&!Le(e)&&!x.has(String(e))):!1,[G,M,e,Ie,Le,x]),He=M?(Array.isArray(e)?e:[]).filter(e=>e!=null&&e!==``).length:+(e!=null&&e!==``),Ue=M?(Array.isArray(e)?e:[]).map(Be).filter(Boolean):e?[Be(e)].filter(Boolean):[],We=a.onSelectRecord,Ge=(0,$.useCallback)((n,r)=>{if(r&&n&&n.value!=null&&g(e=>xu(e,[r],I)),M){let r=(Array.isArray(e)?e:[]).map(Re);r.includes(n.value)?t(r.filter(e=>e!==n.value)):(L&&au(L,n.value),t([...r,n.value]))}else L&&au(L,n.value),We?We(n):t(n.value),c(!1)},[M,e,t,We,L,Re,I]),Ke=n=>{t(M?(Array.isArray(e)?e:[]).map(Re).filter(e=>e!==n):null)},qe=(0,$.useCallback)(e=>{L&&e.forEach(e=>au(L,bu(e,I))),g(e)},[I,L]),[Je,Xe]=(0,$.useState)([]),Ze=J.join(`,`);(0,$.useEffect)(()=>{if(!s||!G||!W||!L||we)return;if(de){Xe([]);return}let e=iu(L);if(!e.length){Xe([]);return}let t=!1;return(async()=>{try{let n={[I]:{$in:e}},r=await W.find(L,{$filter:Se?C(Se,n):n,$top:e.length,...J.length>0?{$expand:J}:{}}),i=r?.data??r??[],a=new Map;if(Array.isArray(i))for(let e of i){let t=Ye(e,fe?.fields),n=t?.[I]??t?.id??t?._id;n!=null&&a.set(String(n),e)}let o=e.map(e=>a.get(String(e))).filter(Boolean);t||Xe(o)}catch{t||Xe([])}})(),()=>{t=!0}},[s,G,L,we,de,Se,I,Ze]);let Qe=(0,$.useMemo)(()=>Je.map(e=>yu(Ye(e,fe?.fields),N,I,K,fe,q,L)),[Je,N,I,K,fe,q,L]),$e=(0,$.useMemo)(()=>{let e=new Map;for(let t of[...Je,...Ce.records]){let n=Ye(t,fe?.fields),r=n?.[I]??n?.id??n?._id??n?.externalId;r!=null&&!e.has(String(r))&&e.set(String(r),t)}return e},[Je,Ce.records,fe,I]),et=(0,$.useCallback)(e=>{let t=$e.get(String(e.value));Ge(e,t?Ye(t,fe?.fields):void 0)},[$e,fe,Ge]),tt=!we&&G?Qe.length:0,nt=(0,$.useMemo)(()=>{if(we||!G||Qe.length===0)return je;let e=new Set(Qe.map(e=>e.value));return[...Qe,...je.filter(t=>!e.has(t.value))]},[we,G,Qe,je]),rt=!G||Ce.answeredSearch===we,it=we&&rt&&nt.length>0?0:-1,at=JSON.stringify(nt.map(e=>e.value));(0,$.useEffect)(()=>{T(it)},[at,it]);let[ot,st]=(0,$.useState)(!1),{execute:ct}=pt(),lt=Kt(),ut=Ti(`lookupCreateNew`,{objectSchema:fe,objectName:L,perms:q}).allowed,ft=!!ye||ne&&ut&&(lt||G),ht=(0,$.useCallback)(async e=>{let t=(e||``).trim();if(ye){ye(t),c(!1);return}if(ne&&ut&&L){if(m(null),lt){c(!1),await new Promise(e=>setTimeout(e,0));let e=await ct({type:`modal`,modal:{objectName:L,mode:`create`}});if(e?.success&&e.data){let t=yu(e.data,N,I,K,fe,q,L);Ge(t,e.data);return}if(!(e?.success&&e.modal))return}if(W&&t){st(!0);try{let e=await W.create(L,{[P]:t}),n=yu(e,N,I,K,fe,q,L);Ge(n,e)}catch(e){m(e instanceof Error?e.message:String(e))}finally{st(!1)}}}},[ye,ne,ut,L,lt,ct,W,P,N,I,K,fe,Ge,q]),gt=(0,$.useCallback)(e=>{let t=$e.get(String(e.value)),n=t?{...e,...t}:e,r=_e.filter(e=>{let t=n[e.field];return t!=null&&t!==``});if(r.length===0)return null;let i=jc(),a=i?.(`select`);return r.map((e,t)=>{let r=ge[e.field]?.type,o=!!a&&!!r&&i?.(r)===a,s=(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 whitespace-nowrap`,children:[t>0&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`opacity-60`,children:`·`}),(0,Q.jsx)(`span`,{className:`opacity-70`,children:`${e.label||Tl(e.field)}:`})]}),c=Ol(n,e,{descriptors:ge,cellRenderer:i,displayLocale:d});return o?(0,Q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[s,(0,Q.jsx)(`span`,{"data-lookup-preview":e.field,children:c})]},e.field):(0,Q.jsxs)(`span`,{className:`grid grid-cols-[auto_minmax(0,max-content)] items-center gap-1`,children:[s,(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,"data-lookup-preview":e.field,children:c})]},e.field)})},[$e,_e,ge,d]),_t=(0,$.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),T(e=>e<nt.length-1?e+1:e)):e.key===`ArrowUp`?(e.preventDefault(),T(e=>e>0?e-1:0)):e.key===`Enter`&&(e.preventDefault(),w>=0&&w<nt.length&&et(nt[w]))},[nt,w,et]);if((0,$.useEffect)(()=>{w>=0&&E.current&&E.current.querySelector(`[data-lookup-index="${w}"]`)?.scrollIntoView({block:`nearest`})},[w]),r)return Ue.length?M?(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Ue.map((e,t)=>(0,Q.jsx)(dt,{variant:`outline`,children:e?.label||e?.[P]},t))}):(0,Q.jsx)(`span`,{className:`text-sm`,children:Ue[0]?.label||Ue[0]?.[P]}):Ve?(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)(Mr,{className:`size-3.5 animate-spin`}),M?l(`table.selected`,{count:He}):l(`lookup.loading`)]}):(0,Q.jsx)(X,{});let vt=!!a.compact,yt=Ue[0]?.label||Ue[0]?.[P],bt=!M&&Ue.length>0,St=e=>{let t=Fa(e,q,L,[I]),n=t?.[ie]||t?.image;return n?String(n):void 0},Ct=V===`search`&&bt?St(Ue[0]):void 0,{name:wt,...Tt}=ri(a),Et=(0,Q.jsxs)(j,{...Tt,variant:`outline`,className:U(`min-w-0 max-w-full flex-1 justify-start text-left font-normal`,vt&&`h-8 rounded-none border-0 bg-transparent px-2 shadow-none focus-visible:ring-1 focus-visible:ring-ring/60`),type:`button`,disabled:de||a.disabled,"data-testid":de?`lookup-trigger-gated`:a.name||D?.name?`lookup-trigger-${a.name||D.name}`:`lookup-trigger`,title:de?l(`lookup.selectFirst`,{fields:se}):void 0,"aria-invalid":!!i,children:[Ve?(0,Q.jsx)(Mr,{className:U(`size-4 shrink-0 animate-spin text-muted-foreground`,vt?`mr-1.5`:`mr-2`),"data-testid":`lookup-hydrating`}):V===`search`&&bt&&!de?(0,Q.jsxs)(Ln,{className:U(`size-5 shrink-0`,vt?`mr-1.5`:`mr-2`),children:[Ct&&(0,Q.jsx)(b,{src:Ct,alt:``}),(0,Q.jsx)(Oe,{className:`text-[9px]`,children:ql(String(yt||``))})]}):(0,Q.jsx)(Br,{className:U(`size-4 shrink-0 text-muted-foreground`,vt?`mr-1.5`:`mr-2`)}),(0,Q.jsx)(`span`,{className:U(`truncate`,Ue.length===0&&!Ve&&`text-muted-foreground`),title:!de&&!Ve&&bt?String(yt??``):void 0,children:de?l(`lookup.selectFirst`,{fields:se}):Ve?M?l(`table.selected`,{count:He}):l(`lookup.loading`):Ue.length===0?D?.placeholder||l(`common.select`):M?l(`table.selected`,{count:Ue.length}):yt})]}),Dt=!a.disabled,Ot=bt&&!vt&&Dt?(0,Q.jsx)(j,{variant:`ghost`,size:`icon`,className:`shrink-0 text-muted-foreground hover:text-destructive`,type:`button`,onClick:()=>Ke(Ue[0]?.value),"aria-label":l(`lookup.remove`,{label:yt}),"data-testid":`lookup-clear`,children:(0,Q.jsx)(Jr,{className:`size-4`})}):null;return(0,Q.jsxs)(`div`,{className:vt?``:`space-y-2`,children:[M&&Ue.length>0&&!vt&&(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Ue.map((e,t)=>{let n=e?.label||e?.[P];if(V===`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)(Ln,{className:`size-6 shrink-0`,children:[r&&(0,Q.jsx)(b,{src:r,alt:String(n||``)}),(0,Q.jsx)(Oe,{className:`text-[10px]`,children:ql(String(n||``))})]}),(0,Q.jsx)(`span`,{className:`max-w-[10rem] truncate`,children:n}),Dt&&(0,Q.jsx)(`button`,{onClick:()=>Ke(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)(Jr,{className:`size-3`})})]},t)}return(0,Q.jsxs)(dt,{variant:`outline`,className:`gap-1`,children:[n,Dt&&(0,Q.jsx)(`button`,{onClick:()=>Ke(e?.value),className:`ml-1 hover:text-destructive`,type:`button`,"aria-label":l(`lookup.remove`,{label:n}),children:(0,Q.jsx)(Jr,{className:`size-3`})})]},t)})}),V===`search`&&G&&W&&L?(0,Q.jsxs)(`div`,{className:M?`contents`:`flex items-center gap-1.5`,children:[(0,Q.jsx)(cu,{inline:!0,trigger:Et,open:Y,onOpenChange:be,title:D?.label||l(`common.select`),multiple:M,dataSource:W,objectName:L,displayField:P,idField:I,subtitleFields:re,avatarField:ie,pageSize:z,value:ze,onSelect:t,onSelectRecords:qe,lookupFilters:B,baseFilter:xe}),Ot]}):(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsxs)(o,{open:s,onOpenChange:e=>{de||c(e)},children:[(0,Q.jsx)(Sn,{asChild:!0,children:Et}),(0,Q.jsxs)(xt,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,children:[Me&&(0,Q.jsx)(`div`,{className:`p-2`,children:(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(Br,{className:`absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground`}),(0,Q.jsx)(nn,{placeholder:l(`table.search`),value:we,onChange:e=>Ne(e.target.value),onKeyDown:_t,className:`w-full pl-9 h-8 text-sm`,role:`combobox`,"aria-autocomplete":`list`,"aria-controls":f,"aria-expanded":s,"aria-activedescendant":w>=0?`${f}-opt-${w}`:void 0}),Te&&(0,Q.jsx)(Mr,{className:`absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground`,"data-testid":`lookup-loading`})]})}),De&&(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-4 px-2`,role:`alert`,children:[(0,Q.jsx)(br,{className:`size-5 text-destructive`}),(0,Q.jsx)(`p`,{className:`text-sm text-destructive`,children:De}),(0,Q.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>Ce.refetch(),type:`button`,children:l(`lookup.retry`)})]}),Te&&je.length===0&&!De&&(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6`,role:`status`,"aria-live":`polite`,children:[(0,Q.jsx)(Mr,{className:`size-6 animate-spin text-muted-foreground`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l(`lookup.loading`)})]}),!De&&!(Te&&je.length===0)&&(0,Q.jsx)(`div`,{ref:E,className:`max-h-64 overflow-y-auto px-1 pb-1`,role:`listbox`,id:f,children:nt.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`)}),ft&&(0,Q.jsxs)(j,{variant:`ghost`,size:`sm`,className:`mt-2 gap-1`,type:`button`,disabled:ot,onClick:()=>ht(we),children:[ot?(0,Q.jsx)(Mr,{className:`size-4 animate-spin`}):(0,Q.jsx)(Lr,{className:`size-4`}),we?l(`lookup.createNamed`,{name:we}):l(`lookup.createNew`)]})]}):(0,Q.jsxs)(Q.Fragment,{children:[nt.map((t,n)=>{let r=M?(Array.isArray(e)?e:[]).map(Re).includes(t.value):Re(e)===t.value,i=n===w,a=tt>0&&n===0,o=tt>0&&n===tt;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:()=>et(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=gt(t);return e?(0,Q.jsx)(Tu,{children:e}):null})()]}),r&&(0,Q.jsx)(dt,{variant:`default`,className:`ml-2 shrink-0`,children:l(`lookup.selectedBadge`)})]})]},t.value)}),G&&Ee>je.length&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground text-center py-2`,children:l(`lookup.showingResults`,{shown:je.length,total:Ee})}),G&&Ee>je.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),be(!0)},"data-testid":`show-all-results`,children:[(0,Q.jsx)(Wr,{className:`size-3.5`}),l(`lookup.showAllResults`,{count:Ee})]}),ft&&(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:()=>ht(we),children:[ot?(0,Q.jsx)(Mr,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(Lr,{className:`size-3.5`}),we?l(`lookup.createNamed`,{name:we}):l(`lookup.createNew`)]})]})})]})]}),Ot,G&&V!==`search`&&(0,Q.jsx)(j,{variant:`outline`,size:`icon`,className:`shrink-0`,type:`button`,disabled:de||a.disabled,onClick:()=>be(!0),"aria-label":l(`lookup.browseAll`),title:de?l(`lookup.selectFirst`,{fields:se}):l(`lookup.browseAll`),"data-testid":`browse-all-records`,children:(0,Q.jsx)(Wr,{className:`size-4`})})]}),G&&W&&L&&V!==`search`&&(0,Q.jsx)(Ul,{open:Y,onOpenChange:be,title:D?.label||l(`common.select`),multiple:M,dataSource:W,objectName:L,columns:me,displayField:N,objectSchema:fe,idField:I,pageSize:z,value:ze,onSelect:t,onSelectRecords:qe,lookupFilters:B,baseFilter:xe,cellRenderer:jc(),fieldsMeta:fe?.fields,filterColumns:ve})]})}var Du=n({UserField:()=>ku});function Ou(e){let t=Array.isArray(e)?e:[];return t.some(e=>e?.field===`banned`)?t:[...t,{field:`banned`,operator:`ne`,value:!0}]}function ku(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:Ou(r?.lookupFilters)},a=n?{...t,field:i}:i;return(0,Q.jsx)(Eu,{...e,field:a})}var Au=n({ColorField:()=>ju});function ju({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=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)(X,{})})]}):(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)(nn,{...ri(a),type:`text`,value:e||``,onChange:e=>t(e.target.value),placeholder:o?.placeholder||`#000000`,disabled:r||a.disabled,className:a.className,pattern:`^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$`,"aria-invalid":!!i})]})}var Mu=n({AddressField:()=>Nu});function Nu({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=e||{},{id:s,"aria-labelledby":c,...l}=ri(a),u=si(a,`instead-of-the-inputs`),d=si(a,`above-the-inputs`),f=(0,$.useId)(),p=e=>`${f}-${e}`,{t:m}=ni(),h=ir(),g=Zs(o),_=(e,n)=>{let r={...o};delete r.zipCode,t({...r,...g?{postalCode:g}:null,[e]:n})};if(r){let e=tc(o,h);return e?(0,Q.jsx)(`span`,{...u,className:`text-sm`,children:e}):(0,Q.jsx)(X,{...u})}return(0,Q.jsxs)(`div`,{className:`space-y-3`,...d,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(gn,{htmlFor:p(`street`),className:`text-xs`,children:m(`fields.address.street`)}),(0,Q.jsx)(nn,{...l,id:p(`street`),type:`text`,value:o.street||``,onChange:e=>_(`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)(gn,{htmlFor:p(`city`),className:`text-xs`,children:m(`fields.address.city`)}),(0,Q.jsx)(nn,{id:p(`city`),type:`text`,value:o.city||``,onChange:e=>_(`city`,e.target.value),disabled:r||a.disabled,"aria-invalid":!!i})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(gn,{htmlFor:p(`state`),className:`text-xs`,children:m(`fields.address.state`)}),(0,Q.jsx)(nn,{id:p(`state`),type:`text`,value:o.state||``,onChange:e=>_(`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)(gn,{htmlFor:p(`postalCode`),className:`text-xs`,children:m(`fields.address.postalCode`)}),(0,Q.jsx)(nn,{id:p(`postalCode`),type:`text`,value:g||``,onChange:e=>_(`postalCode`,e.target.value),disabled:r||a.disabled,"aria-invalid":!!i})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(gn,{htmlFor:p(`country`),className:`text-xs`,children:m(`fields.address.country`)}),(0,Q.jsx)(nn,{id:p(`country`),type:`text`,value:o.country||``,onChange:e=>_(`country`,e.target.value),disabled:r||a.disabled,"aria-invalid":!!i})]})]})]})}var Pu=n({LocationField:()=>Yu});function Fu(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let{lat:t,lng:n}=e;return Iu(t)&&Iu(n)}function Iu(e){return typeof e==`number`&&Number.isFinite(e)}function Lu(e){return W.safeParse(e).success}function Ru(e,t,n){let r={lat:e,lng:t};return Fu(n)?(Iu(n.altitude)&&(r.altitude=n.altitude),Iu(n.accuracy)&&(r.accuracy=n.accuracy),r):r}function zu(e){return Fu(e)?`${e.lat}, ${e.lng}`:``}var Bu=/^[+-]?(?:Infinity|(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)$/,Vu=[`latitude`,`longitude`];function Hu(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=Vu.map((e,n)=>({label:e,text:t[n]})).filter(e=>!Bu.test(e.text));return i.length>0?{kind:`residue`,residue:i}:{kind:`pair`,lat:n,lng:r}}function Uu(e,t){let n=Hu(e);return n.kind===`cleared`?!Fu(t):n.kind===`pair`&&Fu(t)&&t.lat===n.lat&&t.lng===n.lng}function Wu(e){return e(`fields.location.refusedFormat`)}function Gu(e,t){let n=W.safeParse(t);return n.success?``:e(`fields.location.refusedRange`,{detail:n.error.issues.map(e=>`${e.path.join(`.`)||`value`}: ${e.message}`).join(`; `)})}function Ku(e,t){let[n,r]=t.map(t=>({name:qu(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 qu(e,t){return e(t===`latitude`?`fields.location.latitude`:`fields.location.longitude`)}function Ju(e){return Vu.map(t=>qu(e,t)).join(`, `)}function Yu({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=n,[s,c]=(0,$.useState)(()=>zu(e)),[l,u]=(0,$.useState)(null),{t:d}=ni(),f=(0,$.useRef)(e);if((0,$.useEffect)(()=>{Object.is(f.current,e)||(f.current=e,!l&&(Uu(s,e)||c(zu(e))))},[e,s,l]),r)return(0,Q.jsx)(`span`,{className:`text-sm`,children:zu(e)||(0,Q.jsx)(X,{})});let p=n=>{let r=n.target.value;c(r);let i=Hu(r);if(i.kind===`cleared`){u(null),t(null);return}if(i.kind===`unparsable`){u(Wu(d));return}if(i.kind===`residue`){u(Ku(d,i.residue));return}let a=Ru(i.lat,i.lng,e);if(Lu(a)){u(null),t(a);return}u(Gu(d,a))};return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(nn,{...ri(a),type:`text`,value:s,onChange:p,placeholder:o?.placeholder||Ju(d),disabled:r||a.disabled,className:U(l?`border-red-500 focus-visible:ring-red-500`:``,a.className),"aria-invalid":!!i||!!l}),l&&(0,Q.jsx)(`p`,{className:`text-xs text-red-500`,children:l})]})}var Xu=n({GeolocationField:()=>$u}),Zu=e=>typeof e==`number`&&!Number.isNaN(e),Qu=e=>Zu(e.latitude)&&Zu(e.longitude);function $u({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let[o,s]=$.useState(!1),c=ai(`30.2741`),l=ai(`120.1551`),u=e||{},{id:d,"aria-labelledby":f,...p}=ri(a),m=si(a,`instead-of-the-inputs`),h=si(a,`above-the-inputs`),g=(0,$.useId)(),_=e=>`${g}-${e}`,v=(e,n)=>{t({...u,[e]:n?Number(n):null})},y=e=>{c.readBadInput(e.target),p.onBlur?.(e)},b=()=>{if(!navigator.geolocation){console.error(`Geolocation is not supported by this browser`);return}s(!0),navigator.geolocation.getCurrentPosition(e=>{t({latitude:e.coords.latitude,longitude:e.coords.longitude,accuracy:e.coords.accuracy}),s(!1)},e=>{console.error(`Error getting location:`,e.message),s(!1)},{enableHighAccuracy:!0,timeout:5e3,maximumAge:0})},x=e=>Qu(e)?`${e.latitude.toFixed(6)}, ${e.longitude.toFixed(6)}`:``,S=()=>{if(!Qu(u))return;let e=`https://www.google.com/maps?q=${u.latitude},${u.longitude}`;window.open(e,`_blank`)};if(r){let e=x(u);return(0,Q.jsxs)(`div`,{...m,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)(X,{}),Qu(u)&&(0,Q.jsx)(j,{type:`button`,variant:`link`,size:`sm`,onClick:S,className:`p-0 h-auto`,children:`View on map`})]})}return(0,Q.jsxs)(`div`,{className:`space-y-3`,...h,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(j,{type:`button`,variant:`outline`,size:`sm`,onClick:b,disabled:r||o,children:[(0,Q.jsx)(wr,{className:`w-4 h-4 mr-2`}),o?`Getting location...`:`Use Current Location`]}),Qu(u)&&(0,Q.jsxs)(j,{type:`button`,variant:`link`,size:`sm`,onClick:S,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)(gn,{htmlFor:_(`latitude`),className:`text-xs`,children:`Latitude`}),(0,Q.jsx)(nn,{...p,id:_(`latitude`),type:`number`,value:u.latitude??``,onChange:e=>{c.readBadInput(e.target),v(`latitude`,e.target.value)},onBlur:y,placeholder:`37.7749`,disabled:r||a.disabled,step:`any`,className:U(c.refusal?oi:``,a.className),"aria-invalid":!!i||!!c.refusal}),(0,Q.jsx)(ii,{refusal:c.refusal})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(gn,{htmlFor:_(`longitude`),className:`text-xs`,children:`Longitude`}),(0,Q.jsx)(nn,{id:_(`longitude`),type:`number`,value:u.longitude??``,onChange:e=>{l.readBadInput(e.target),v(`longitude`,e.target.value)},onBlur:e=>l.readBadInput(e.target),placeholder:`-122.4194`,disabled:r||a.disabled,step:`any`,className:l.refusal?oi:void 0,"aria-invalid":!!i||!!l.refusal}),(0,Q.jsx)(ii,{refusal:l.refusal})]})]}),Zu(u.accuracy)&&(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Accuracy: ±`,u.accuracy.toFixed(0),`m`]})]})}var ed=n({CodeField:()=>td});function td({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)(X,{})})}):(0,Q.jsx)(ct,{...ri(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 nd=n({ObjectField:()=>ad});function rd(e){return e==null?``:JSON.stringify(e,null,2)}function id(e,t){if(!e.trim())return t==null;try{return JSON.stringify(JSON.parse(e))===JSON.stringify(t)}catch{return!1}}function ad({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=n,[s,c]=(0,$.useState)(()=>rd(e)),[l,u]=(0,$.useState)(null),{t:d}=ni(),f=(0,$.useRef)(null),p=(0,$.useRef)(e);if((0,$.useEffect)(()=>{Object.is(p.current,e)||(p.current=e,!l&&(id(s,e)||c(rd(e))))},[e,s,l]),(0,$.useEffect)(()=>{f.current?.setCustomValidity(l??``)},[l]),r)return wt(e)&&!Array.isArray(e)?(0,Q.jsx)(X,{}):(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)(ct,{...ri(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 od=n({QRCodeField:()=>sd});function sd({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let[o,s]=$.useState(!1),c=n,l=e=>`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(e)}`,u=()=>{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)(X,{})}),e&&(0,Q.jsxs)(j,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>s(!o),children:[(0,Q.jsx)(Rr,{className:`w-4 h-4 mr-2`}),o?`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)(nn,{...ri(a),type:`text`,value:e||``,onChange:e=>t(e.target.value),placeholder:c?.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:u,children:(0,Q.jsx)(Sr,{className:`w-4 h-4`})}),(0,Q.jsx)(j,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>s(!o),children:(0,Q.jsx)(Rr,{className:`w-4 h-4`})})]})]}),o&&e&&(0,Q.jsx)(`div`,{className:`border rounded p-4 bg-white flex justify-center`,children:(0,Q.jsx)(`img`,{src:l(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 cd=$.lazy(()=>Z(()=>import(`./DatePickerField-DaUsI9YX.js`).then(e=>({default:e.DatePickerField})),__vite__mapDeps([0]))),ld=$.lazy(()=>Z(()=>import(`./DatePickerField-DaUsI9YX.js`).then(e=>({default:e.DateTimePickerField})),__vite__mapDeps([0]))),ud=new Set([cd,ld]),dd={text:Rc,textarea:Vc,number:Uc,currency:Gc,percent:Jc,slider:Xc,progress:Xc,rating:Qc,boolean:el,toggle:el,select:il,status:il,multiselect:nl,radio:sl,checkboxes:ll,tags:dl,date:cd,datetime:ld,time:ml,email:gl,phone:vl,url:bl,lookup:Eu,master_detail:Eu,user:ku,color:ju,address:Nu,location:Yu,geolocation:$u,code:td,json:ad,qrcode:sd},fd=new Set([`formula`,`summary`,`auto_number`,`file`,`image`,`avatar`,`signature`,`markdown`,`html`,`richtext`,`password`,`secret`,`object`,`grid`,`vector`,`object-ref`,`filter-condition`,`recipient-picker`,`position-ref`,`permission-ref`]);function pd(e){return e in dd||fd.has(e)?e:Pc(e).replace(/^field:/,``)}function md(e){return!e||ot(e)?!1:pd(e)in dd}function hd(e){return e?ot(e)?!0:fd.has(pd(e)):!1}var gd=new Set([`lookup`,`master_detail`,`user`]);function _d(e){let{field:t,value:n,onChange:r,readonly:i}=e;if(t?.type&&ot(t.type))return an(t.type),null;let a=t?.type?pd(t.type):void 0,o=a?dd[a]:void 0;if(!o)return null;let s=a&&gd.has(a)?{compact:!0}:{},c=(0,Q.jsx)(o,{...ri(e),...Ic(e),field:t,value:n,onChange:r,readonly:i,...s});return ud.has(o)?(0,Q.jsx)($.Suspense,{fallback:(0,Q.jsx)(`div`,{"aria-busy":`true`,"data-testid":`field-edit-widget-loading`,className:`h-9 w-full rounded-md border border-input bg-muted/40`}),children:c}):c}function vd({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=ir(),{t:s}=ni(),c=$.useId();if(r)return!e||isNaN(Gn(e).getTime())?(0,Q.jsx)(X,{}):(0,Q.jsx)(`span`,{className:`text-sm`,children:Yn(e,void 0,{locale:o})});let l=ri(a),u=Qn(e),d=u?[l[`aria-describedby`],c].filter(Boolean).join(` `):l[`aria-describedby`],f=(0,Q.jsx)(nn,{...l,type:`date`,value:u?``:ar(e),onChange:e=>t(e.target.value),onClick:e=>{fl(e.currentTarget),l.onClick?.(e)},disabled:r||l.disabled,"aria-invalid":!!i||u,"aria-describedby":d});return u?(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[f,(0,Q.jsx)(`p`,{id:c,className:`text-xs text-destructive`,"data-testid":`date-impossible-day`,children:s(`fields.date.impossibleDay`,{value:String(e)})})]}):f}function yd({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let o=ir(),{t:s}=ni(),c=$.useId();if(r)return e?(0,Q.jsx)(`span`,{className:`text-sm`,children:nr(e,{locale:o})}):(0,Q.jsx)(X,{});let l=ri(a),u=Qn(e),d=u?[l[`aria-describedby`],c].filter(Boolean).join(` `):l[`aria-describedby`],f=(0,Q.jsx)(nn,{...l,type:`datetime-local`,value:Jn(e),onChange:e=>t(qn(e.target.value)),onClick:e=>{fl(e.currentTarget),l.onClick?.(e)},disabled:r||l.disabled,"aria-invalid":!!i||u,"aria-describedby":d});return u?(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[f,(0,Q.jsx)(`p`,{id:c,className:`text-xs text-destructive`,"data-testid":`datetime-impossible-day`,children:s(`fields.dateTime.impossibleDay`,{value:String(e)})})]}):f}var bd=n({PasswordField:()=>xd});function xd({value:e,onChange:t,field:n,readonly:r,className:i,...a}){let[o,s]=(0,$.useState)(!1),c=n;if(r)return wt(xc(e))?(0,Q.jsx)(X,{}):(0,Q.jsx)(`span`,{className:`text-sm`,children:`••••••••`});let l=ri(a);return(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(nn,{...l,type:o?`text`:`password`,value:e||``,onChange:e=>t(e.target.value),placeholder:c?.placeholder,disabled:r||l.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:()=>s(!o),tabIndex:-1,children:o?(0,Q.jsx)(Er,{className:`size-4 text-gray-500`}):(0,Q.jsx)(Dr,{className:`size-4 text-gray-500`})})]})}var Sd=n({RichTextField:()=>Td});function Cd({value:e,onChange:t,placeholder:n,rows:r,disabled:i,error:a,className:o,fullHeight:s,autoFocus:c,textareaTestId:l,overlay:u,counter:d,maxLength:f,describedBy:p,domProps:m,editorAria:h}){return(0,Q.jsx)(`div`,{className:U(s&&`flex flex-col h-full`),children:(0,Q.jsxs)(`div`,{className:U(`relative`,s&&`flex-1 min-h-0`),children:[(0,Q.jsx)(ct,{autoFocus:c,"data-testid":l,...m,value:e||``,onChange:e=>t(e.target.value),placeholder:n,disabled:i,rows:s?void 0:r,maxLength:f,className:U(`font-mono`,s?`text-base h-full min-h-full resize-none`:`text-sm`,o),"aria-invalid":!!a,"aria-describedby":p,...h}),d,u]})})}function wd(e){let t=e?.type,n=typeof t==`string`?t:``;return n.startsWith(`field:`)?n.slice(6):n}function Td({value:e,onChange:t,field:n,readonly:r,error:i,...a}){let{t:o}=tr(),s=(0,$.useId)(),c=`${s}-charcount`,l=`${s}-fullscreen-charcount`;if(r){let t=Oc(wd(n));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)(X,{})})}let u=n,d=u?.rows||8,f=u?.maxLength,p=!!u?.mobile_fullscreen,m=ri(a),h=!!m.disabled,g=[m[`aria-describedby`],f?c:void 0].filter(Boolean).join(` `)||void 0,_=u?.placeholder||o(`fields.richText.placeholder`,{defaultValue:`Enter text…`});return(0,Q.jsx)(Cd,{value:e,onChange:t,placeholder:_,rows:d,disabled:r||h,error:i,className:m.className,maxLength:f,describedBy:g,domProps:m,counter:f?(0,Q.jsx)(Yt,{length:(e||``).length,maxLength:f,descriptionId:c,announceNearLimit:!0,className:`absolute bottom-2 right-2 text-xs text-gray-400`,testId:`richtext-character-count`}):null,overlay:p&&(0,Q.jsx)(zc,{value:e??``,onCommit:t,label:u?.label,testIdPrefix:`richtext`,disabled:h,error:i,footer:e=>f?(0,Q.jsx)(Yt,{length:e.length,maxLength:f,descriptionId:l,announceNearLimit:!1,className:`text-xs text-muted-foreground self-center`,testId:`richtext-fullscreen-character-count`}):null,children:(e,t,n,r)=>(0,Q.jsx)(Cd,{value:e,onChange:t,placeholder:_,disabled:n,autoFocus:!0,fullHeight:!0,maxLength:f,describedBy:f?l:void 0,textareaTestId:`richtext-fullscreen-input`,editorAria:r})})})}function Ed(e,t){return t?`${t} (${e})`:e}var Dd=n({ObjectRefField:()=>Od,default:()=>Od});function Od({value:e,onChange:t,readonly:n,className:r,error:i,...a}){let o=$.useContext(u),{t:s}=ni(),c=a.dataSource??o?.dataSource??null,l=a.disabled,[d,f]=$.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||f(t)}catch{e||f([])}})(),()=>{e=!0}},[c]);let p=$.useMemo(()=>{let t=(d??[]).map(e=>({value:e.name,label:Ed(e.name,e.label)}));return e&&!t.some(t=>t.value===e)&&t.unshift({value:e,label:e}),t.sort((e,t)=>e.label.localeCompare(t.label))},[d,e]);if(n){if(!e)return(0,Q.jsx)(X,{});let t=p.find(t=>t.value===e)?.label??e;return(0,Q.jsx)(`span`,{className:r,children:t})}let{name:m,...h}=ri(a);return(0,Q.jsx)(sn,{...h,options:p,value:e??``,onValueChange:e=>t(e),placeholder:s(d===null?`fields.objectRef.loading`:`fields.objectRef.placeholder`),searchPlaceholder:s(`fields.objectRef.search`),emptyText:s(d===null?`common.loading`:`fields.objectRef.empty`),disabled:l,className:U(`w-full`,r),"aria-invalid":!!i})}var kd=n({FILTER_CONDITION_EXTRA_OPERATORS:()=>jd,FilterConditionField:()=>Yd,condToMongo:()=>Vd,default:()=>Yd,isMatchAllCriteria:()=>qd,kvToCondition:()=>Gd}),Ad={id:`root`,logic:`and`,conditions:[]},jd=[`exists`,`notExists`],Md=new Set([`object`,`vector`,`file`,`image`,`avatar`,`signature`,`richtext`,`html`,`markdown`,`location`,`grid`,`json`,`code`]);function Nd(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&&Md.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 Pd(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 Fd=new Set([`contains`,`icontains`,`not_contains`,`starts_with`,`ends_with`]);function Id(e){return e==null||e===``}function Ld(e){return Array.isArray(e)?e:typeof e==`string`?e.split(`,`).map(e=>e.trim()).filter(Boolean):e==null?[]:[e]}function Rd(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zd(e){if(!Rd(e))return null;let t=Object.entries(e);if(t.length!==1||t[0][0].startsWith(`$`))return null;let[n,r]=t[0];if(!Rd(r))return null;let i=Object.entries(r);return i.length===1?[n,i[0][0],i[0][1]]:null}function Bd(e){if(!Array.isArray(e)||e.length!==2)return null;let t=zd(e[0]),n=zd(e[1]);if(!t||!n||t[0]!==n[0])return null;let[r,i,a]=t;return i===`$in`&&Ud(a,[``])&&n[1]===`$null`&&n[2]===!0?r:null}function Vd(e,t){let{field:n,operator:r,value:i}=e||{};if(!n||Fd.has(r)&&Id(i))return null;let a=t(n),o=Pd(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 Id(e)||Id(t)?null:{[n]:{$gte:Pd(e,a),$lte:Pd(t,a)}}}case`in`:return{[n]:{$in:Ld(i).map(e=>Pd(e,a))}};case`not_in`:return{[n]:{$nin:Ld(i).map(e=>Pd(e,a))}};default:return{[n]:o}}}function Hd(e,t){let n=(e?.conditions??[]).map(e=>Vd(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 Ud(e,t){return Array.isArray(e)&&e.length===t.length&&e.every((e,n)=>e===t[n])}function Wd(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 Gd(e,t,n){if(e.startsWith(`$`)){let r=e===`$or`?Bd(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 Ud(a,[null,``])?{id:r,field:e,operator:`is_empty`,value:``}:{id:r,field:e,operator:`in`,value:a};case`$nin`:return Ud(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&&Ud(t.$nin,[``])&&t.$null===!1?{id:r,field:e,operator:`is_not_empty`,value:``}:null}function Kd(e){if(e==null)return{...Ad,conditions:[]};if(typeof e!=`object`||Array.isArray(e))return null;let t=Object.entries(e);if(t.length===0)return{...Ad,conditions:[]};if(t.length===1&&(e.$or||e.$and)&&!Gd(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=Gd(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=Gd(e,i,r++);if(!t)return null;n.push(t)}return{id:`root`,logic:`and`,conditions:n}}function qd(e){if(e==null)return!0;if(Array.isArray(e))return e.every(qd);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(qd))continue;return!1}if(e===`$or`){if(!Array.isArray(n)||n.length===0||n.some(qd))continue;return!1}return!1}return!0}function Jd(e){if(e==null||e===``)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return``}}function Yd({value:e,onChange:t,readonly:n,className:r,error:i,...a}){let o=$.useContext(u),{t:s}=ni(),c=a.dataSource??o?.dataSource??null,l=a.dependentValues??{},d=String(l.object_name??``),[f,p]=$.useState(null);$.useEffect(()=>{if(p(null),!c||!d||typeof c.getObjectSchema!=`function`)return;let e=!1;return(async()=>{try{let t=await c.getObjectSchema(d);e||p(Nd(t))}catch{e||p([])}})(),()=>{e=!0}},[c,d]);let m=$.useMemo(()=>Jd(e),[e]),h=$.useMemo(()=>{if(!m.trim())return{mongo:{},ok:!0};try{return{mongo:JSON.parse(m),ok:!0}}catch{return{mongo:null,ok:!1}}},[m]),g=$.useMemo(()=>h.ok?Kd(h.mongo):null,[h]),_=$.useMemo(()=>h.ok&&qd(h.mongo),[h]),v=h.ok&&g!==null,[y,b]=$.useState(!v);$.useEffect(()=>{v||b(!0)},[v]);let x=$.useMemo(()=>{let e=new Map((f??[]).map(e=>[e.value,e.type]));return t=>e.get(t)},[f]),[S,C]=$.useState(()=>g??Ad),w=h.ok?Wd(h.mongo):null,T=Wd(Hd(S,x));return $.useEffect(()=>{g!==null&&w!==null&&w!==T&&C(g)},[g,w,T]),d?n?m.trim()?(0,Q.jsx)(`pre`,{className:U(`overflow-x-auto rounded bg-muted/40 p-2 text-xs`,r),children:m}):(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:[y?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{...ri(a),className:`min-h-[96px] w-full rounded border bg-background px-2 py-1 font-mono text-xs`,value:m,placeholder:`{ "type": "customer", "is_active": true }`,onChange:e=>t(e.target.value),"aria-invalid":!!i||!h.ok}),!h.ok&&(0,Q.jsx)(`span`,{className:`text-xs text-destructive`,children:s(`fields.filterCondition.invalidJson`)})]}):(0,Q.jsx)(St,{fields:f??[],value:S,onChange:e=>{C(e);let n=Hd(e,x);t(n==null?``:JSON.stringify(n))},extraOperators:jd}),_&&(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:()=>b(e=>!e),disabled:!v&&!y,title:v?void 0:s(`fields.filterCondition.jsonOnly`),children:s(y?`fields.filterCondition.useVisualBuilder`:`fields.filterCondition.editAsJson`)})]}):(0,Q.jsx)(`p`,{className:U(`text-sm text-muted-foreground`,r),children:s(`fields.filterCondition.selectObjectFirst`)})}var Xd={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`}},Zd={position:{type:`position`,storeField:`name`,labelFields:[`label`,`name`],placeholderKey:`fields.recipient.selectPosition`}};function Qd(e,t){let n=t;for(let t of e??[`name`])if(n?.[t])return String(n[t]);return String(n?.id??``)}var $d=n({RecipientPickerField:()=>nf,default:()=>nf,deriveUserFields:()=>tf,fieldHoldsUsers:()=>ef});function ef(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 tf(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&&ef(t)&&r.push({name:String(e),label:t.label?String(t.label):String(e)});return r}function nf({value:e,onChange:t,readonly:n,className:r,error:i,...a}){let o=$.useContext(u),{t:s}=ni(),c=a.dataSource??o?.dataSource??null,l=a.disabled,d=a.dependentValues??{},f=String(d.recipient_type??``),p=Xd[f],m=$.useContext(Pt),h=m?Zd[f]:void 0,g=p??h,_=String(d.object_name??``),v=f===`field`&&!!c&&typeof c.getObjectSchema==`function`,[y,b]=$.useState(null),[x,S]=$.useState(null),C=$.useRef(``);$.useEffect(()=>{C.current&&f&&C.current!==f&&e&&t(``),C.current=f},[f]),$.useEffect(()=>{if(b(null),!c||!p||typeof c.find!=`function`)return;let e=!1;return(async()=>{try{let t=await c.find(p.object,{$top:500,$orderby:{name:`asc`}}),n=t?.data??t?.records??(Array.isArray(t)?t:[]);e||b(Array.isArray(n)?n:[])}catch{e||b([])}})(),()=>{e=!0}},[c,p?.object]);let w=$.useRef(m);w.current=m;let T=h?.type;$.useEffect(()=>{let e=w.current;if(!T||!e)return;b(null);let t=!1;return e.ensureType(T).then(e=>{if(t)return;let n=(Array.isArray(e)?e:[]).filter(e=>typeof e?.name==`string`&&e.name);b([...n].sort((e,t)=>String(e.name).localeCompare(String(t.name))))}).catch(()=>{t||b([])}),()=>{t=!0}},[T]),$.useEffect(()=>{if(S(null),!v||!_)return;let e=!1;return(async()=>{try{let t=await c.getObjectSchema(_);e||S(tf(t))}catch{e||S([])}})(),()=>{e=!0}},[c,_,v]);let E=e=>Qd(g?.labelFields,e),D=e=>String(e?.[g?.storeField??`id`]??``),O=$.useMemo(()=>{let t=(y??[]).map(e=>({value:D(e),label:E(e)})).filter(e=>e.value);return e&&!t.some(t=>t.value===e)&&t.unshift({value:e,label:e}),t},[y,e,g]),k=$.useMemo(()=>(x??[]).map(e=>({value:e.name,label:e.label})),[x]),{name:ee,...A}=ri(a);if(!f)return(0,Q.jsx)(`p`,{className:U(`text-sm text-muted-foreground`,r),children:s(`fields.recipient.selectTypeFirst`)});if(v){if(!_)return(0,Q.jsx)(`p`,{className:U(`text-sm text-muted-foreground`,r),children:s(`fields.filterCondition.selectObjectFirst`)});let a=e&&!k.some(t=>t.value===e)?[{value:e,label:s(`fields.recipient.fieldNotUserTyped`,{name:e})},...k]:k;return n?e?(0,Q.jsx)(`span`,{className:r,children:a.find(t=>t.value===e)?.label??e}):(0,Q.jsx)(X,{}):(0,Q.jsx)(sn,{...A,options:a,value:e??``,onValueChange:e=>t(e),placeholder:s(x===null?`fields.recipient.loading`:`fields.recipient.selectField`),searchPlaceholder:s(`fields.recipient.search`),emptyText:s(x===null?`fields.recipient.loading`:`fields.recipient.noUserFields`),disabled:l,className:U(`w-full`,r),"aria-invalid":!!i})}return g?n?e?(0,Q.jsx)(`span`,{className:r,children:O.find(t=>t.value===e)?.label??e}):(0,Q.jsx)(X,{}):(0,Q.jsx)(sn,{...A,options:O,value:e??``,onValueChange:e=>t(e),placeholder:s(y===null?`fields.recipient.loading`:g.placeholderKey??`fields.recipient.select`),searchPlaceholder:s(`fields.recipient.search`),emptyText:s(y===null?`fields.recipient.loading`:`fields.recipient.empty`),disabled:l,className:U(`w-full`,r),"aria-invalid":!!i}):(0,Q.jsx)(`input`,{...ri(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})}(0,$.createContext)(null),(0,$.createContext)(null),(0,$.createContext)(null);var rf=(0,$.createContext)(null);function af(){return{name:`object-url`,async upload(e){let t=e,n=`name`in t&&t.name||`upload`;return{url:URL.createObjectURL(e),name:n,size:e.size,mimeType:e.type||`application/octet-stream`}}}}function of(){let e=(0,$.useContext)(rf),t=(0,$.useMemo)(()=>{let e=af();return{upload:(t,n)=>e.upload(t,n),adapter:e}},[]);return e??t}var sf=$.createContext(null);function cf(e){let t=$.useContext(sf),n=$.useId(),r=$.useRef(t);r.current=t,$.useEffect(()=>{r.current?.report(n,e)},[e,n]),$.useEffect(()=>()=>{r.current?.report(n,!1)},[n])}var lf=0,uf=()=>{};function df(){let e=$.useContext(sf),t=$.useRef(e);return t.current=e,$.useCallback(()=>{let e=t.current;if(!e)return uf;lf+=1;let n=`upload-hold:${lf}`;e.report(n,!0);let r=!1;return()=>{r||(r=!0,e.report(n,!1))}},[])}function ff(e,t){let n=(0,$.useRef)(t);n.current=t,(0,$.useEffect)(()=>{n.current?.(e)},[e]),cf(e)}var pf=1048576;function mf(e,t,n){if(!n||t.size<=n)return null;let r=(n/pf).toFixed(1);return e(`fields.file.exceedsMaxSize`,{defaultValue:`"${t.name}" exceeds max size (${r} MB)`,name:t.name,max:r})}function hf(e,t,n){return n instanceof mc?e(`fields.file.uploadIncomplete`,{defaultValue:`Upload of "${t}" did not complete: no file id was returned, so nothing was saved`,name:t}):e(`fields.file.uploadFailed`,{defaultValue:`Failed to upload "${t}": ${n.message}`,name:t,error:n.message})}var gf=n({FileCell:()=>yf,FileField:()=>vf});function _f(e){let{files:t,multiple:n,maxSize:r,onChange:i,holdScope:a}=e,{upload:o}=of(),{t:s}=tr(),[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=mf(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=hc(t,e.name);return{result:t,originalName:e.name,value:n}}catch(t){return c.push(hf(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=gc(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.map(oc),...a]:a[0])}finally{f?.(),p(!1),d({})}},[t,n,i,r,o,s,a]),errors:c,uploading:f,uploadProgress:u,recent:m}}function vf({value:e,onChange:t,field:n,readonly:r,onUploadingChange:i,error:a,...o}){let{t:s}=tr(),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}=_f({files:b,multiple:d,maxSize:p,onChange:t,holdScope:df()}),E=_c(fc(e,s(`fields.file.fileFallback`,{defaultValue:`File`})),T);ff(C,i);let D=(0,$.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),y(!0)},[]),O=(0,$.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),y(!1)},[]),k=(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=si(o,`instead-of-the-inputs`);return e?(0,Q.jsx)(`div`,{...t,className:`flex flex-wrap gap-2`,children:E.map((e,t)=>(0,Q.jsx)(bc,{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)(X,{...t})}let ee=e=>{x(Array.from(e.target.files||[]))},A=e=>{if(d){let n=b.filter((t,n)=>n!==e).map(oc);t(n.length>0?n:null)}else t(null)},{name:M,...N}=ri(o);return(0,Q.jsxs)(`div`,{className:o.className,children:[(0,Q.jsx)(`input`,{ref:c,type:`file`,multiple:d,accept:f,onChange:ee,className:`hidden`}),_&&(0,Q.jsx)(`input`,{ref:l,type:`file`,accept:`image/*`,capture:_,onChange:ee,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:D,onDragLeave:O,onDrop:k,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)(qr,{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)(hr,{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)(Mr,{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))}),E.length>0&&(0,Q.jsx)(`div`,{className:`space-y-1`,children:E.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:[e.metadataRefused?(0,Q.jsx)(Nr,{className:`size-4 text-muted-foreground shrink-0`,"aria-hidden":`true`}):pc(e)&&e.url?(0,Q.jsx)(`img`,{src:e.url,alt:e.name,className:`size-8 object-cover rounded shrink-0`}):pc(e)?(0,Q.jsx)(Ar,{className:`size-4 text-muted-foreground shrink-0`}):(0,Q.jsx)(Or,{className:`size-4 text-muted-foreground shrink-0`}),(0,Q.jsx)(bc,{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(),A(t)},className:`h-6 w-6 p-0`,children:(0,Q.jsx)(Jr,{className:`size-3`})})]},t))})]})]})}function yf({value:e,onChange:t,disabled:n,multiple:r,accept:i,maxSize:a,error:o,"aria-label":s,"data-cell":c}){let{t:l}=tr(),u=(0,$.useRef)(null),d=e?Array.isArray(e)?e:[e]:[],{processFiles:f,errors:p,uploading:m,recent:h}=_f({files:d,multiple:!!r,maxSize:a,onChange:t}),g=_c(fc(e,l(`fields.file.fileFallback`,{defaultValue:`File`})),h),_=vc(),v=e=>e.metadataRefused?_.label:e.name,y=e=>{if(r){let n=d.filter((t,n)=>n!==e).map(oc);t(n.length>0?n:null)}else t(null)},b=!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`}),g.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.metadataRefused?_.hint:e.name,"data-testid":`file-cell-chip`,children:[e.metadataRefused?(0,Q.jsx)(Nr,{className:`size-3 shrink-0 text-muted-foreground`,"aria-hidden":`true`}):pc(e)&&e.url?(0,Q.jsx)(`img`,{src:e.url,alt:e.name,className:`size-5 shrink-0 rounded object-cover`}):(0,Q.jsx)(Or,{className:`size-3 shrink-0 text-muted-foreground`}),(0,Q.jsx)(bc,{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 ${v(e)}`,name:v(e)}),onClick:()=>y(t),children:(0,Q.jsx)(Jr,{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)(Mr,{className:`size-3.5 animate-spin`})}),b&&(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)(qr,{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 bf=n({ImageField:()=>Sf}),xf=(0,$.lazy)(()=>Z(()=>Promise.resolve().then(()=>Cf).then(e=>({default:e.ImageCropperDialog})),void 0));function Sf({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:_}=of(),{t:v}=tr(),[y,b]=(0,$.useState)(!1),[x,S]=(0,$.useState)([]),[C,w]=(0,$.useState)({});ff(y,i);let T=df(),E=e?Array.isArray(e)?e:[e]:[],D=_c(fc(e,``),C),O=(0,$.useCallback)((e,t)=>{let n=gc(e,t);n.id&&w(e=>({...e,[n.id]:n}))},[]),k=(0,$.useCallback)(async(e,n)=>{if(!p)return;let r=mf(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=hc(r,n);if(O(r,n),l){let e=E.map(oc);e[p.index]=i,t(e)}else t(i)}catch(e){S([hf(v,n,e)])}finally{i(),b(!1),m(null)}},[p,E,l,t,_,O,d,v,T]),ee=(0,$.useCallback)(e=>{let t=D[e];t?.url&&!t.metadataRefused&&m({index:e,src:t.url,name:t.name||`image-${e}.png`})},[D]),A=D.filter(e=>e.url&&!e.metadataRefused).map(e=>({url:e.url,name:e.name})),M=D.some(e=>e.metadataRefused);if(r){if(!e||A.length===0&&!M)return(0,Q.jsx)(X,{});let t=-1;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:D.map((e,n)=>{if(e.metadataRefused)return(0,Q.jsx)(yc,{view:e,compact:!0,className:`size-20 justify-center rounded-md border border-border bg-muted`},n);if(!e.url)return null;let r=++t,i=A[r];return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>g(r),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:i.name||v(`fields.image.imageAlt`,{index:r+1})}),children:[(0,Q.jsx)(`img`,{src:i.url,alt:i.name||v(`fields.image.imageAlt`,{index:r+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`})]},n)})}),h!==null&&(0,Q.jsx)(ic,{images:A,index:h,open:!0,onOpenChange:e=>!e&&g(null),onIndexChange:g})]})}let N=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=mf(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=hc(t,e.name);return O(t,e.name),n}catch(t){return a.push(hf(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.map(oc),...n]:n[0])}finally{o(),b(!1)}},P=e=>{if(l){let n=E.filter((t,n)=>n!==e).map(oc);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:N,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:[e.metadataRefused?(0,Q.jsx)(yc,{view:e,compact:!0,className:`size-20 justify-center rounded-md border border-gray-200 bg-muted`}):(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&&!e.metadataRefused&&(0,Q.jsx)(j,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>ee(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)(Cr,{className:`size-3`})}),(0,Q.jsx)(j,{type:`button`,variant:`destructive`,size:`sm`,onClick:()=>P(t),className:`h-6 w-6 p-0`,"aria-label":v(`fields.image.remove`,{index:t+1}),children:(0,Q.jsx)(Jr,{className:`size-3`})})]})]},t))}),(0,Q.jsxs)(j,{...ri(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)(Mr,{className:`size-4 mr-2 animate-spin`}):(0,Q.jsx)(Ar,{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)(xf,{open:!0,onOpenChange:e=>!e&&m(null),src:p.src,outputName:p.name,onConfirm:k})})]})}var Cf=n({ImageCropperDialog:()=>wf}),wf=({open:e,onOpenChange:t,src:n,outputType:r=`image/png`,outputName:i=`cropped.png`,onConfirm:a})=>{let{t:o}=ni(),s=(0,$.useRef)(null),c=(0,$.useRef)(null),[l,u]=(0,$.useState)(0),[d,f]=(0,$.useState)({x:0,y:0,width:100,height:100}),[p,m]=(0,$.useState)(null),[h,g]=(0,$.useState)(!1);(0,$.useEffect)(()=>{if(!e||!n)return;g(!1);let t=new Image;t.crossOrigin=`anonymous`,t.onload=()=>{c.current=t;let e=t.naturalWidth*.8,n=t.naturalHeight*.8;f({x:(t.naturalWidth-e)/2,y:(t.naturalHeight-n)/2,width:e,height:n}),u(0),g(!0)},t.onerror=()=>g(!1),t.src=n},[e,n]),(0,$.useEffect)(()=>{if(!h||!c.current||!s.current)return;let e=c.current,t=s.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(l*Math.PI/180);let a=l%180==0?480:i,o=l%180==0?i:480;n.drawImage(e,-a/2,-o/2,a,o),n.restore();let u=d.x*r,f=d.y*r,p=d.width*r,m=d.height*r;n.fillStyle=`rgba(0,0,0,0.45)`,n.fillRect(0,0,480,f),n.fillRect(0,f+m,480,i-f-m),n.fillRect(0,f,u,m),n.fillRect(u+p,f,480-u-p,m),n.strokeStyle=`#3b82f6`,n.lineWidth=2,n.strokeRect(u,f,p,m)},[h,d,l]);let _=(0,$.useCallback)(e=>{if(!c.current||!s.current)return;let t=s.current.getBoundingClientRect(),n=c.current.naturalWidth/t.width;m({ox:(e.clientX-t.left)*n,oy:(e.clientY-t.top)*n,cx:d.x,cy:d.y}),e.target.setPointerCapture(e.pointerId)},[d]),v=(0,$.useCallback)(e=>{if(!p||!c.current||!s.current)return;let t=s.current.getBoundingClientRect(),n=c.current.naturalWidth/t.width,r=(e.clientX-t.left)*n-p.ox,i=(e.clientY-t.top)*n-p.oy,a=Math.max(0,Math.min(p.cx+r,c.current.naturalWidth-d.width)),o=Math.max(0,Math.min(p.cy+i,c.current.naturalHeight-d.height));f(e=>({...e,x:a,y:o}))},[p,d.width,d.height]),y=(0,$.useCallback)(()=>m(null),[]),b=(0,$.useCallback)(()=>u(e=>(e+90)%360),[]),x=(0,$.useCallback)(async()=>{if(!c.current)return;let e=c.current,n=document.createElement(`canvas`),o=d.width,s=d.height;n.width=l%180==0?o:s,n.height=l%180==0?s:o;let u=n.getContext(`2d`);if(!u)return;u.save(),u.translate(n.width/2,n.height/2),u.rotate(l*Math.PI/180),u.drawImage(e,d.x,d.y,o,s,-o/2,-s/2,o,s),u.restore();let f=await new Promise(e=>n.toBlob(e,r));f&&(a(f,i),t(!1))},[d,l,i,r,a,t]);return(0,Q.jsx)(It,{open:e,onOpenChange:t,children:(0,Q.jsxs)(st,{className:`max-w-xl`,children:[(0,Q.jsxs)(ht,{children:[(0,Q.jsx)(Jt,{children:`Crop & rotate image`}),(0,Q.jsx)(on,{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:[h?(0,Q.jsx)(`canvas`,{ref:s,"data-testid":`image-cropper-canvas`,role:`img`,"aria-label":o(`fields.image.cropPreview`),className:`border rounded-md cursor-move touch-none max-w-full`,onPointerDown:_,onPointerMove:v,onPointerUp:y,onPointerCancel:y}):(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(d.width),` × `,Math.round(d.height),` px`]}),(0,Q.jsxs)(`span`,{children:[`Rotation: `,l,`°`]})]})]}),(0,Q.jsxs)(yn,{className:`flex justify-between sm:justify-between`,children:[(0,Q.jsxs)(j,{type:`button`,variant:`outline`,onClick:b,"data-testid":`image-cropper-rotate`,children:[(0,Q.jsx)(zr,{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:x,disabled:!h,"data-testid":`image-cropper-confirm`,children:[(0,Q.jsx)(Cr,{className:`size-4 mr-2`}),`Apply crop`]})]})]})]})})},Tf=n({FormulaField:()=>Ef});function Ef({value:e,field:t,...n}){let r=ir(),i=nc(),a=xc(e);if(wt(a))return(0,Q.jsx)(X,{className:n.className});let o=t?.returnType??(typeof e==`number`?`number`:`text`),s=`text-sm ${n.className||``}`;if(o===`number`){if(typeof a==`string`&&a.trim()===``)return(0,Q.jsx)(X,{className:n.className});let e=Number(a),i=isNaN(e)?String(a):ei(e,t,r);return(0,Q.jsx)(`span`,{className:s,children:i})}if(o===`currency`){if(typeof a==`string`&&a.trim()===``)return(0,Q.jsx)(X,{className:n.className});let e=Number(a);return isNaN(e)?(0,Q.jsx)(`span`,{className:s,children:String(a)}):(0,Q.jsx)(Gc,{value:e,onChange:n.onChange,field:t,readonly:!0})}return o===`boolean`?typeof e==`boolean`?(0,Q.jsx)(`span`,{className:s,children:i(e)}):(0,Q.jsx)(X,{className:n.className}):o===`date`?!a||isNaN(Gn(a).getTime())?(0,Q.jsx)(X,{className:n.className}):(0,Q.jsx)(`span`,{className:s,children:Yn(a,void 0,{locale:r})}):(0,Q.jsx)(`span`,{className:s,children:String(a)})}var Df=n({SummaryField:()=>Of});function Of({value:e,field:t,...n}){let r=ir(),i=xc(e);if(wt(i))return(0,Q.jsx)(X,{className:n.className});let a=typeof e==`number`&&!isNaN(e)?ei(e,t,r):String(i);return(0,Q.jsx)(`span`,{className:`text-sm font-medium tabular-nums text-gray-700 ${n.className||``}`,children:a})}var kf=n({AutoNumberField:()=>Af});function Af({value:e,field:t,...n}){return e==null?(0,Q.jsx)(X,{className:n.className}):(0,Q.jsx)(`span`,{className:`text-sm font-mono text-gray-700 ${n.className||``}`,children:String(e)})}var jf=n({VectorField:()=>Mf});function Mf({value:e,field:t,...n}){let r=t?.dimensions||(Array.isArray(e)?e.length:0);if(!e||!Array.isArray(e))return(0,Q.jsx)(X,{});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 Nf=n({GridField:()=>rp,computeRow:()=>Gf,evalArith:()=>Bf,lookupAutofillPatch:()=>Vf,sumColumn:()=>Qf}),Pf=e=>e===`number`||e===`currency`,Ff={text:160,select:132,lookup:168,number:104,currency:116,date:150,datetime:200,time:116,file:168},If=e=>e.width??Ff[e.type??`text`]??132;function Lf(e){if(e.width)return{width:e.width,minWidth:e.width};if((e.type??`text`)===`text`)return{minWidth:180};let t=Ff[e.type??`text`]??132;return{width:t,minWidth:t}}function Rf(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 zf(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 Bf(e,t){let n=Rf(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=zf(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 Vf(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 Hf(e){return or(void 0,e)}function Uf(e){return e?Xr(e):void 0}function Wf(e,t){return e.type===`currency`?Uf(Hf(t)):e.scale}function Gf(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=Bf(e.expr,i);if(t===null){i[e.name]=null;continue}let r=Wf(e,n);i[e.name]=r==null?t:Number(t.toFixed(r))}return i}var Kf=e=>e===`date`||e===`datetime`||e===`time`;function qf(e,t,n){let r=String(t);if(e===`time`)return r;if(e===`date`){let e=ar(t);if(!e)return r;let i=Gn(e);return Number.isNaN(i.getTime())?r:Yn(i,void 0,{locale:n})}if(Number.isNaN(Gn(t instanceof Date?t:r).getTime()))return r;let i=t instanceof Date?t:new Date(r);return nr(i,{style:`compact`,locale:n})}function Jf(e,t,n){return e.prefix?e.prefix:t?Yr(t,n):``}function Yf(e,t,n,r){let i=Uf(n),a=i===void 0?{}:{minimumFractionDigits:i,maximumFractionDigits:i};if(e.prefix||!n)return`${Jf(e,n,r)}${m(t,{locale:r,...a})}`;try{return m(t,{locale:r,currency:n,...a})}catch{return`${n} ${t.toFixed(i)}`}}function Xf(e,t,n,r,i){if(t==null||t===``)return`—`;if(Kf(e.type))return qf(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 r.count(e.length);let n=e[0];return typeof n==`string`?n:n?.name||n?.original_name||r.nameless}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(Pf(e.type)){let r=Number(t);if(Number.isFinite(r))return e.type===`currency`?Yf(e,r,i,n):r.toLocaleString(n)}return Array.isArray(t)?t.join(`, `):String(t)}function Zf(e,t){if(Pf(e)){if(t===``||t==null)return null;let e=Number(t);return Number.isNaN(e)?t:e}return e===`datetime`?qn(t):t}function Qf(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 $f(e){if(typeof e!=`object`||!e)return[];let t=e;return Object.keys(hi).filter(e=>t[e]!==void 0)}function ep(e,t){return`[object-ui] ${typeof e==`string`&&e?`Grid field \`${e}\``:`This grid field`} carries retired snake_case key(s): ${t.map(e=>`\`${e}\` → \`${hi[e]}\``).join(`, `)}. The grid's field-level keys are camelCase since objectui#11610 and it reads no snake_case spelling, so the grid is not drawn until each key is renamed; the values stay the same.`}var tp=new Set;function np({message:e,keys:t}){return $.useEffect(()=>{tp.has(e)||(tp.add(e),console.error(e))},[e]),(0,Q.jsx)(`div`,{role:`alert`,"data-testid":`grid-field-retired-keys`,"data-retired-keys":t.join(` `),className:`rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:e})}function rp(e){let t=$f(e.field);if(t.length>0){let n=ep(e.field?.name,t);return(0,Q.jsx)(np,{message:n,keys:t})}return(0,Q.jsx)(ip,{...e})}function ip({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=ir(),{t:_}=ni(),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={count:e=>_(`detail.fileCount`,{count:e,defaultValue:`{{count}} files`}),nameless:_(`fields.file.fileFallback`,{defaultValue:`File`})},T=(e,t,n,r)=>Xf(e,t,n,w,r),E=$.useId(),{currency:D}=er(),O=Hf(D),k=(0,$.useCallback)((e,t)=>{if(!e.readonlyWhen&&!e.requiredWhen)return{readonly:!1,required:!!e.required};let n=Ot({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]),ee=l===`list`&&!r,[A,N]=$.useState(()=>new Set),P=p.filter(e=>e.defaultHidden&&!e.required),F=p.filter(e=>!e.defaultHidden||e.required||A.has(e.name)),I=(0,$.useCallback)(e=>{N(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),L=f.allowAdd!==!1&&!r&&!i,te=f.allowDelete!==!1&&!r&&!i,ne=L,R=typeof c==`function`&&!r,z=f.minRows??0,B=f.maxRows,re=f.totalField,ae=f.sortField,H=f.allowReorder!==!1&&!r&&!i,oe=(0,$.useCallback)((e,n=!0)=>{t?.(ae&&n?e.map((e,t)=>({...e,[ae]:t})):e)},[t,ae]),se=(0,$.useCallback)(()=>{let e={};for(let t of F)e[t.name]=null;return e},[F]),ce=(0,$.useCallback)((e,t)=>{if(e>=m.length){if(B!=null&&m.length>=B)return;oe([...m,Gf(F,{...se(),...t},D)]);return}oe(m.map((n,r)=>r===e?Gf(F,{...n,...t},D):n),!1)},[m,F,B,se,oe,D]),le=(0,$.useCallback)((e,t,n)=>ce(e,{[t]:n}),[ce]),W=(0,$.useCallback)((e,t,n)=>{ce(e,Vf(F,t,n))},[F,ce]),ue=(0,$.useCallback)((e,t,n)=>le(e,t,n),[le]),de=(0,$.useCallback)((e,t,n)=>{le(e,t.name,Zf(t.type,n))},[le]),G=(0,$.useCallback)(()=>{B!=null&&m.length>=B||oe([...m,se()])},[m,se,B,oe]),fe=(0,$.useRef)(null),pe=(0,$.useCallback)((e,t)=>{let n=fe.current?.querySelector(`[data-cell="${e}-${t}"]`);n&&(n.focus(),n instanceof HTMLInputElement&&n.select())},[]),me=(0,$.useCallback)((e,t,n)=>{e.key===`ArrowDown`||e.key===`Enter`?(e.preventDefault(),pe(t+1,n)):e.key===`ArrowUp`&&(e.preventDefault(),t>0&&pe(t-1,n))},[pe]),K=(0,$.useCallback)(e=>{m.length<=z||oe(m.filter((t,n)=>n!==e))},[m,z,oe]),he=(0,$.useCallback)(e=>{if(B!=null&&m.length>=B)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}),oe(o)},[m,B,oe]),ge=(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),oe(n)},[m,oe]),q=(0,$.useRef)(null),J=R||te||ne,_e=(+!!R+ +!!ne+ +!!te)*34+12,ve=!!re,ye=ve?Qf(m,re):0,Y=ve?Math.max(0,F.findIndex(e=>e.name===re)):-1,be=P.length>0?(0,Q.jsxs)(o,{children:[(0,Q.jsx)(Sn,{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)(Vr,{className:`h-3.5 w-3.5`}),_(`table.columns`,{defaultValue:`Columns`}),A.size>0&&(0,Q.jsxs)(`span`,{className:`rounded-full bg-primary/10 px-1.5 text-[10px] font-medium text-primary`,children:[`+`,A.size]})]})}),(0,Q.jsxs)(xt,{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:P.map(e=>{let t=`col-toggle-${e.name}`;return(0,Q.jsxs)(gn,{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)(ln,{id:t,checked:A.has(e.name),onCheckedChange:()=>I(e.name)}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.label||e.name})]},e.name)})})]})]}):null;if(r)return(0,Q.jsxs)(`div`,{...si(d,`instead-of-the-inputs`),className:U(`space-y-2`,a),children:[be&&(0,Q.jsx)(`div`,{className:`flex justify-end`,children:be}),(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:`#`}),F.map(e=>(0,Q.jsx)(`th`,{style:{minWidth:If(e)},className:U(`px-3 py-2 text-xs font-medium text-muted-foreground whitespace-nowrap`,Pf(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:F.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}),F.map(t=>(0,Q.jsx)(`td`,{className:U(`px-3 py-2 text-foreground`,Pf(t.type)&&`text-right tabular-nums`),children:t.type===`lookup`&&e[t.name]!=null&&e[t.name]!==``?(0,Q.jsx)(Eu,{value:e[t.name],onChange:()=>{},readonly:!0,field:{reference:t.reference,displayField:t.displayField,idField:t.idField}}):T(t,e[t.name],g,O)},t.name))]},t))}),ve&&(0,Q.jsx)(`tfoot`,{className:`border-t border-border bg-muted/40`,children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`td`,{colSpan:1+Y,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:ye.toLocaleString(g)}),F.length-Y-1>0&&(0,Q.jsx)(`td`,{colSpan:F.length-Y-1})]})})]})})]});let xe=!ee&&L&&(B==null||m.length<B),Se=xe?[...m,se()]:m,Ce=!!s&&m.length===0,we=(e,t,n,r,a=!1)=>{let o=r?.[e.name],s=i||k(e,r).readonly;if(ee)return e.type===`lookup`&&o!=null&&o!==``?(0,Q.jsx)(Eu,{value:o,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`,Pf(e.type)&&`tabular-nums`,(o==null||o===``)&&`text-muted-foreground`),children:T(e,o,g,O)});if(e.computed)return(0,Q.jsx)(`span`,{className:U(`block px-2 text-sm tabular-nums`,Pf(e.type)?`text-right`:`text-left`,o==null||o===``?`text-muted-foreground`:`text-foreground`),title:_(`fields.grid.computed`,{defaultValue:`Computed`}),"data-computed":e.name,children:T(e,o,g,O)});if(e.type===`lookup`)return(0,Q.jsx)(Eu,{value:o,onChange:t=>ue(n,e.name,t),onSelectRecord:t=>W(n,e,t),compact:!0,field:{reference:e.reference,displayField:e.displayField,idField:e.idField,multiple:e.multiple,options:e.options,placeholder:`—`},disabled:s,error:a?C(e):void 0});if(e.type===`file`)return(0,Q.jsx)(yf,{value:o,onChange:t=>ue(n,e.name,t),multiple:e.multiple,accept:Array.isArray(e.accept)&&e.accept.length>0?e.accept.join(`,`):void 0,disabled:s,"aria-label":e.label||e.name,"data-cell":`${n}-${t}`,error:a?C(e):void 0});if(e.type===`select`)return(0,Q.jsxs)(M,{value:o==null?``:String(o),onValueChange:t=>de(n,e,t),disabled:s,children:[(0,Q.jsx)(V,{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)(Je,{placeholder:`—`})}),(0,Q.jsx)(ie,{children:(e.options||[]).map(e=>(0,Q.jsx)(un,{value:e.value,children:e.label},e.value))})]});let c=e.type===`currency`?Jf(e,O,g):``,l=(e.type===`date`||e.type===`datetime`)&&Qn(o),u=l?`${E}-impossible-${n}-${t}`:void 0;return(0,Q.jsxs)(`div`,{className:`relative`,children:[c&&(0,Q.jsx)(`span`,{className:`pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-xs text-muted-foreground`,children:c}),(0,Q.jsx)(nn,{"data-cell":`${n}-${t}`,"aria-invalid":a||l||void 0,"aria-describedby":u,onKeyDown:e=>me(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`,c&&`pl-6`,Pf(e.type)&&`text-right tabular-nums`),type:e.type===`date`?`date`:e.type===`datetime`?`datetime-local`:e.type===`time`?`time`:Pf(e.type)?`number`:`text`,step:Pf(e.type)?e.step??`any`:void 0,"aria-label":e.label||e.name,value:e.type===`date`?l?``:ar(o):e.type===`datetime`?Jn(o):o==null?``:String(o),onChange:t=>de(n,e,t.target.value),disabled:s}),l&&(0,Q.jsx)(`p`,{id:u,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(o)})})]})},{"aria-invalid":Te,name:Ee,...De}=ri(d),Oe=De[`aria-labelledby`]!=null;return(0,Q.jsxs)(`div`,{...De,role:Oe?`group`:void 0,className:U(`space-y-2`,a),"data-testid":`line-items`,children:[be&&(0,Q.jsx)(`div`,{className:`flex justify-end`,children:be}),(0,Q.jsx)(`div`,{className:`border border-border rounded-lg overflow-x-auto`,children:(0,Q.jsxs)(`table`,{ref:fe,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`,H?`w-14`:`w-10`),children:`#`}),F.map(e=>(0,Q.jsxs)(`th`,{className:U(`px-2 py-2 text-xs font-medium text-muted-foreground whitespace-nowrap`,Pf(e.type)?`text-right`:`text-left`),style:Lf(e),children:[e.label||e.name,e.required&&!e.computed&&(0,Q.jsx)(`span`,{className:`text-destructive`,children:` *`})]},e.name)),J&&(0,Q.jsx)(`th`,{style:{width:_e}})]})}),(0,Q.jsx)(`tbody`,{className:`divide-y divide-border`,children:ee&&m.length===0?(0,Q.jsx)(`tr`,{children:(0,Q.jsx)(`td`,{colSpan:F.length+ +!!J+1,className:`px-3 py-6 text-center text-muted-foreground`,children:_(`fields.grid.noItemsAddHint`,{label:f.addLabel||_(`detail.add`,{defaultValue:`Add`}),defaultValue:`No items yet — click “{{label}}” to begin.`})})}):Se.map((e,t)=>{let n=xe&&t===m.length,r=H&&!n&&!ee;return(0,Q.jsxs)(`tr`,{className:U(`group`,!n&&`hover:bg-muted/30`),...H&&!n?{onDragOver:e=>{q.current!=null&&e.preventDefault()},onDrop:e=>{e.preventDefault(),q.current!=null&&(ge(q.current,t),q.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:()=>{q.current=t},onDragEnd:()=>{q.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)(kr,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`span`,{className:U(n&&`opacity-30`),children:t+1})]})}),F.map((r,i)=>{let a=k(r,e).required,o=(!n||Ce)&&!ee&&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`,ee&&`px-2 py-1.5`,o&&`bg-destructive/5 ring-1 ring-inset ring-destructive/50`),children:we(r,i,t,e,o)},r.name)}),J&&(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&&R&&(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)(Fr,{className:`h-3.5 w-3.5`})}),!n&&ne&&(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:()=>he(t),disabled:i||B!=null&&m.length>=B,children:(0,Q.jsx)(Sr,{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:()=>K(t),disabled:i||m.length<=z,children:(0,Q.jsx)(Gr,{className:`h-4 w-4`})})]})})]},t)})}),ve&&(0,Q.jsx)(`tfoot`,{className:`border-t border-border bg-muted/40`,children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`td`,{colSpan:1+Y,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:ye.toLocaleString(g)}),F.length-Y-1+ +!!J>0&&(0,Q.jsx)(`td`,{colSpan:F.length-Y-1+ +!!J})]})})]})}),L&&(0,Q.jsxs)(j,{type:`button`,variant:`outline`,size:`sm`,onClick:ee&&u?u:G,disabled:B!=null&&m.length>=B,"data-testid":`line-items-add`,children:[(0,Q.jsx)(Lr,{className:`mr-1.5 h-4 w-4`}),f.addLabel||_(`fields.grid.addLine`,{defaultValue:`Add line`})]})]})}var ap=n({AvatarField:()=>op});function op({value:e,onChange:t,field:n,readonly:r,onUploadingChange:i,error:a,...o}){let[s,c]=$.useState(!1),l=$.useRef(null),{upload:u}=of(),{t:d}=tr(),[f,p]=$.useState(!1),[m,h]=$.useState(null),[g,_]=$.useState({});ff(f,i);let v=df(),y=n,x=_c(fc(e,``),g)[0],S=!!x?.metadataRefused,C=S?void 0:x?.url,w=vc(),T=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=hc(e,n.name),i=gc(e,n.name);i.id&&_(e=>({...e,[i.id]:i})),t(r)}catch(e){h(hf(d,n.name,e))}finally{r(),p(!1)}},E=()=>{t(``)},D=S?(0,Q.jsx)(Oe,{title:w.hint,"data-slot":`file-restricted`,children:(0,Q.jsx)(Nr,{className:`size-5 text-muted-foreground`,role:`img`,"aria-label":w.label})}):(0,Q.jsx)(Oe,{children:(y?.defaultName||y?.label||`User`).split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2)});return r?(0,Q.jsxs)(Ln,{className:`w-16 h-16`,children:[C&&(0,Q.jsx)(b,{src:C,alt:y?.label}),D]}):(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)(Ln,{className:`w-16 h-16`,children:[C&&(0,Q.jsx)(b,{src:C,alt:y?.label}),D]}),!r&&s&&e&&(0,Q.jsx)(`button`,{type:`button`,onClick:E,className:`absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90`,children:(0,Q.jsx)(Jr,{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:T,className:`hidden`}),(0,Q.jsx)(j,{...ri(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)(Mr,{className:`w-4 h-4 mr-2 animate-spin`}),d(`fields.image.uploading`,{defaultValue:`Uploading…`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(qr,{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 sp=n({SignatureField:()=>cp});function cp({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=si(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)(Tr,{className:`w-4 h-4 mr-2`}),`Clear`]})]})]})}var lp=new Map;function up(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 dp=new Map;async function fp(e,t){let n=()=>{let e=dp.get(t);return e?.state===`ok`?e.schema:void 0},r=dp.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=>{dp.set(t,{state:`ok`,schema:e})}).catch(()=>{dp.set(t,{state:`err`})});return dp.set(t,{state:`pending`,promise:a}),await a,n()}function pp(e){let t=$.useContext(u)?.dataSource,[,n]=$.useState(0),r=!!e&&!!t&&typeof t.getObjectSchema==`function`;if($.useEffect(()=>{if(!r)return;let i=dp.get(e);if(i&&i.state!==`pending`)return;let a=!0;return fp(t,e).then(()=>{a&&n(e=>e+1)}),()=>{a=!1}},[r,e,t]),!r)return;let i=dp.get(e);return i?.state===`ok`?i.schema:void 0}function mp(e,t,n,r,i){if(!e||typeof e!=`object`)return;let a=Fa(e,r,i);if(t){let e=xn(t,a,{titleField:n}),r=a.id??a._id;if(!(e===`Untitled`||r!=null&&e===`Record #${r}`)&&e)return e}return up(a,n)}function hp(e,t,n,r){let i=$.useContext(u)?.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=lp.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):Di(await i.find(e,{$filter:{id:t},$top:1}))[0];let r=await fp(i,e);lp.set(s,{state:`ok`,record:n,schema:r})}catch{lp.set(s,{state:`err`})}a(e=>e+1)})();lp.set(s,{state:`pending`,promise:r})},[s,o,e,t,i]),!o)return;let c=lp.get(s);return c?.state===`ok`?mp(c.record,c.schema,n,r,e):void 0}function gp(){let{t:e}=tr();return(t,n)=>{let r=e(t);return!r||r===t?n:r}}function _p(){let{t:e}=tr();return e}function vp(e){return wt(e)||typeof e==`string`&&e.trim()===``}function yp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date)}function bp(e,t,n=0,r){let i=Pa(e,t);return Qr(i,n,r)}function xp({text:e,className:t}){return(0,Q.jsx)(`span`,{className:U(`block max-w-full truncate`,t),title:e,children:e})}function Sp({value:e}){let t=xc(e);return wt(t)?(0,Q.jsx)(X,{}):(0,Q.jsx)(xp,{text:String(t)})}function Cp({value:e,field:t}){let n=ir(),r=xc(e);if(vp(r))return(0,Q.jsx)(X,{});let i=Number(r),a=isNaN(i)?String(r):ei(i,t,n);return(0,Q.jsx)(`span`,{className:`tabular-nums`,children:a})}function wp({value:e,field:t}){let n=xc(e);if(vp(n))return(0,Q.jsx)(X,{});let r=Number(n);if(!Number.isFinite(r))return(0,Q.jsx)(`span`,{className:`tabular-nums`,children:String(n)});let i=t?.max,a=typeof i==`number`&&i>0?Math.floor(i):5,o=Math.max(0,Math.min(a,Math.round(r)));return(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,title:`${r} / ${a}`,children:[Array.from({length:a},(e,t)=>(0,Q.jsx)(Ur,{"aria-hidden":`true`,className:U(`h-3.5 w-3.5 shrink-0`,t<o?`fill-yellow-400 text-yellow-400`:`text-muted-foreground/40`)},t)),(0,Q.jsx)(`span`,{className:`sr-only`,children:`${r} / ${a}`})]})}function Tp({value:e,field:t}){let{currency:n}=er(),r=ir(),i=xc(e);if(vp(i))return(0,Q.jsx)(X,{});let a=or(t,n),o=Number(i),s=isNaN(o)?String(i):$r(o,a,r);return(0,Q.jsx)(`span`,{className:`tabular-nums font-medium whitespace-nowrap`,children:s})}function Ep({value:e,field:t}){let n=ir(),r=$.useId(),i=xc(e);if(vp(i))return(0,Q.jsx)(X,{});let a=t,o=Un({type:a.type,scale:a.scale}),s=Number(i);if(isNaN(s))return(0,Q.jsx)(`span`,{className:`tabular-nums whitespace-nowrap`,children:String(i)});let c=Zr(a),l=Pa(s,c),u=bp(s,c,o,n),d=Math.max(0,Math.min(100,l));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-labelledby":r,"aria-valuenow":d,"aria-valuemin":0,"aria-valuemax":100,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-all`,style:{width:`${d}%`}})}),(0,Q.jsx)(`span`,{id:r,className:`shrink-0 tabular-nums whitespace-nowrap`,children:u})]})}var Dp=new Set([`active`,`is_active`,`enabled`,`is_enabled`,`verified`,`is_verified`]);function Op({value:e,field:t}){let{t:n}=ni();if(typeof e!=`boolean`)return(0,Q.jsx)(`span`,{className:`flex items-center justify-center`,children:(0,Q.jsx)(X,{})});let r=t?.name?.toLowerCase()||``,i=r===`completed`||r===`is_completed`||r===`done`||r===`is_done`,a=t?.label||Ga(t?.name||``);return i?(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":n(`fields.boolean.completed`),"data-testid":`completion-indicator`,children:(0,Q.jsx)(gr,{className:`size-3 text-white`})}):(0,Q.jsx)(`div`,{className:`size-5 rounded-full border-2 border-muted-foreground/30`,role:`img`,"aria-label":n(`fields.boolean.notCompleted`),"data-testid":`completion-indicator`})}):Dp.has(r)&&e===!1?(0,Q.jsx)(dt,{variant:`destructive`,className:`text-xs`,"data-testid":`boolean-warning-badge`,children:n(`fields.boolean.offBadge`,{label:a})}):(0,Q.jsx)(`div`,{className:`flex items-center justify-start`,children:(0,Q.jsx)(ln,{checked:e,disabled:!0,"aria-label":a,className:`pointer-events-none`})})}function kp(e,t){return t!==!0&&e?.dueLike===!0}function Ap(e,t){if(!t)return!1;let n=new Date;return n.setHours(0,0,0,0),e<n}function jp({value:e,field:t,deadlineSettled:n}){let r=ir(),i=_p();if(!e)return(0,Q.jsx)(X,{});let a=xc(e);if(vp(a))return(0,Q.jsx)(X,{});let o=a==null?null:Gn(a);if(o===null||isNaN(o.getTime()))return(0,Q.jsx)(X,{});let s=new Date(a),c=t.format||`relative`,l=kp(t,n),u=Yn(a,c,{dueLike:l,locale:r,t:i}),d=Ap(o,l);return(0,Q.jsx)(`span`,{className:`tabular-nums${d?` text-red-600`:``}`,title:s.toISOString(),children:u})}function Mp({value:e,field:t,deadlineSettled:n}){let r=ir(),i=_p();if(!e)return(0,Q.jsx)(X,{});let a=xc(e),o=a==null?null:Gn(a);if(o===null||isNaN(o.getTime()))return(0,Q.jsx)(X,{});let s=new Date(a),c=t?.format||`compact`,l=c===`short`?`compact`:c,u=kp(t,n),d=`tabular-nums text-sm whitespace-nowrap${Ap(s,u)?` text-red-600`:``}`;if(l===`relative`)return(0,Q.jsx)(`span`,{className:d,children:Xn(s,{dueLike:u,locale:r,t:i})});if(l===`compact`){let e=$n(s,{locale:r});if(e)return(0,Q.jsxs)(`span`,{className:d,children:[(0,Q.jsx)(`span`,{children:e.date}),` `,(0,Q.jsx)(`span`,{className:`ml-1 text-muted-foreground`,children:e.time})]})}return(0,Q.jsx)(`span`,{className:d,children:nr(s,{style:l,locale:r,t:i})})}var Np={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`},Pp={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`},Fp={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`},Ip=[`blue`,`green`,`purple`,`orange`,`pink`,`indigo`,`yellow`,`red`];function Lp(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n);return Ip[Math.abs(t)%Ip.length]}function Rp(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 zp(e){if(e){if(Pp[e])return e;if(e.charAt(0)===`#`)return Rp(e)}}var Bp=4.5,Vp=1.9,Hp={r:255,g:255,b:255},Up={r:10,g:10,b:10},Wp=(e,t,n)=>Math.min(n,Math.max(t,e));function Gp(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 Kp({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 qp(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 Jp=({r:e,g:t,b:n})=>`#`+[e,t,n].map(e=>Wp(Math.round(e),0,255).toString(16).padStart(2,`0`)).join(``);function Yp({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 Xp(e,t){let n=Yp(e),r=Yp(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Zp(e,t,n,r,i){let a,o=1/0;for(let s=0;s<=100;s++){let c=s/100,l=qp(e,t,c);if(Xp(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 Xp(s,r)>=Xp(c,r)?s:c}function Qp(e){let t=Gp(e);if(!t)return;let{h:n,s:r,l:i}=Kp(t),a=Wp(r,.18,.92),o=.95-.32*(1-i),s=qp(n,a*(.55+.25*(1-i)),o),c=qp(n,a*.62,Wp(o-.14,0,1)),l=Zp(n,a,i,s,Bp),u=.1+.3*i,d=qp(n,a*.6,u),f=qp(n,a*.55,Wp(u+.12,0,1)),p=Zp(n,a,i,d,Bp);return{bg:Jp(s),fg:Jp(l),border:Jp(c),bgDark:Jp(d),fgDark:Jp(p),borderDark:Jp(f),dot:Jp(Zp(n,a,i,Hp,Vp)),dotDark:Jp(Zp(n,a,i,Up,Vp))}}var $p=`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)]`,em=`bg-[color:var(--os-dot-bg)] dark:bg-[color:var(--os-dot-bg-dark)]`;function tm(e){if(!e||e.charAt(0)!==`#`)return;let t=Qp(e);if(t)return{className:$p,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 nm(e){if(!e||e.charAt(0)!==`#`)return;let t=Qp(e);if(t)return{className:em,style:{"--os-dot-bg":t.dot,"--os-dot-bg-dark":t.dotDark}}}function rm(e,t){let n=zp(e);if(n&&Pp[n])return Pp[n];if(t==null||t===``)return`bg-muted text-muted-foreground border-border`;let r=String(t).toLowerCase().replace(/[\s-]/g,`_`),i=Np[r];return i&&Pp[i]?Pp[i]:Pp[Lp(r)]}function im({value:e,field:t}){let n=t,r=n.options||[],i=n.appearance===`dot`?`dot`:`badge`;if(wt(e))return(0,Q.jsx)(X,{});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||(yp(e)?String(xc(e)):Ga(String(e)));if(i===`dot`){let i=nm(n?.color),a=zp(n?.color)||Np[String(e).toLowerCase().replace(/[\s-]/g,`_`)]||Lp(String(e).toLowerCase().replace(/[\s-]/g,`_`)),o=i?i.className:Fp[a]||Fp.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=tm(n?.color),s=o?o.className:rm(n?.color,e);return(0,Q.jsx)(dt,{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 am({value:e}){let t=gp(),[n,r]=$.useState(!1);if(!e)return(0,Q.jsx)(X,{});let i=xc(e);if(vp(i))return(0,Q.jsx)(X,{});let a=String(i);return yp(e)?(0,Q.jsx)(xp,{text:a}):(0,Q.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1 group/email`,children:[(0,Q.jsx)(j,{variant:`link`,className:`block min-w-0 truncate 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:`shrink-0 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)(gr,{className:`h-3 w-3 text-green-600`}):(0,Q.jsx)(Sr,{className:`h-3 w-3 text-muted-foreground`})})]})}function om({value:e}){if(!e)return(0,Q.jsx)(X,{});let t=xc(e);if(vp(t))return(0,Q.jsx)(X,{});let n=String(t);return yp(e)?(0,Q.jsx)(xp,{text:n}):(0,Q.jsx)(j,{variant:`link`,className:`inline-block max-w-full truncate align-top 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 sm({value:e}){let t=gp(),[n,r]=$.useState(!1);if(!e)return(0,Q.jsx)(X,{});let i=xc(e);if(vp(i))return(0,Q.jsx)(X,{});let a=String(i);return yp(e)?(0,Q.jsx)(xp,{text:a}):(0,Q.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1 group/phone`,children:[(0,Q.jsxs)(`a`,{href:`tel:${a}`,className:`inline-flex min-w-0 items-center gap-1 text-blue-600 hover:text-blue-800`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(bs,{className:`h-3 w-3 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:a})]}),(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 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)(gr,{className:`h-3 w-3 text-green-600`}):(0,Q.jsx)(Sr,{className:`h-3 w-3 text-muted-foreground`})})]})}function cm({value:e,field:t}){let n=_p();if(!e)return(0,Q.jsx)(X,{});t.multiple;let r=n?.(`fields.file.fileFallback`),i=!r||r===`fields.file.fileFallback`?`File`:r,a=(e,t)=>(0,Q.jsx)(bc,{view:e,className:`text-sm`,fallback:(0,Q.jsx)(xp,{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=fc(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 yp(e)&&Object.keys(e).length===0?(0,Q.jsx)(X,{}):a(dc(e,i))}function lm(e){return fc(e,``).filter(e=>e.url&&!e.metadataRefused).map(e=>({url:e.url,name:e.name||void 0}))}function um({value:e}){let{t}=tr(),[n,r]=$.useState(null),i=$.useMemo(()=>lm(e),[e]),a=$.useMemo(()=>fc(e,``).filter(e=>e.metadataRefused),[e]);if(!e||i.length===0&&a.length===0)return(0,Q.jsx)(X,{});let o=a.length>0&&(0,Q.jsx)(`span`,{className:`inline-flex items-center gap-1 align-middle`,children:a.map((e,t)=>(0,Q.jsx)(yc,{view:e,compact:!0,className:`size-8 justify-center rounded-md border bg-muted`},t))});if(i.length===0)return(0,Q.jsx)(Q.Fragment,{children:o});let s=(e,n)=>n||t(`fields.image.imageAlt`,{index:e+1}),c=e=>t=>{t.stopPropagation(),r(e)},l=i.length>1,u=n!==null&&(0,Q.jsx)(ic,{images:i,index:n,open:!0,onOpenChange:e=>!e&&r(null),onIndexChange:r});return l?(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:s(t,e.name),onClick:c(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:c(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]})]}),o,u]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`img`,{src:i[0].url,alt:s(0,i[0].name),onClick:c(0),className:`size-10 cursor-zoom-in rounded-md object-cover transition-transform hover:scale-105`}),o,u]})}function dm(e){return lm(e.value).length>0?(0,Q.jsx)(um,{...e}):(0,Q.jsx)(Sp,{...e})}function fm(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 pm({objectName:e,recordId:t,className:n,children:r}){let i=cn(),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 mm=3;function hm({value:e,field:t}){let n=t.reference,r=t.displayField||t.reference_field||void 0,i=pp(n),a=Js(),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=hp(n,o,r,a);if(wt(e))return(0,Q.jsx)(X,{});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=mp(s,i,r,a,n)||String(s.externalId??s.id??s._id??``),o=fm(s))}catch{}if(e)return(0,Q.jsx)(pm,{objectName:n,recordId:o,children:(0,Q.jsx)(xp,{text:e})})}}if(!Array.isArray(e)&&typeof e==`object`){let t=e,o=mp(t,i,r,a,n)||String(t.id||t._id||``);if(o)return(0,Q.jsx)(pm,{objectName:n,recordId:fm(t),children:(0,Q.jsx)(xp,{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:mp(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,mm),s=e.slice(mm);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)(pm,{objectName:n,recordId:fm(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)(vm,{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=mp(e,i,r,a,n)||String(e.id||e._id||`[Object]`);return(0,Q.jsx)(pm,{objectName:n,recordId:fm(e),children:(0,Q.jsx)(xp,{text:t})})}let{text:u,unresolved:d}=l(e);return(0,Q.jsx)(pm,{objectName:n,recordId:fm(e),children:d?(0,Q.jsx)(vm,{value:u}):(0,Q.jsx)(xp,{text:u})})}function gm({value:e,field:t}){let n=ir(),r=nc(),i=xc(e);if(wt(i))return(0,Q.jsx)(X,{});let a=(t&&`returnType`in t?t.returnType:void 0)??(typeof e==`number`?`number`:`text`);return a===`number`?(0,Q.jsx)(Cp,{value:e,field:t}):a===`currency`?(0,Q.jsx)(Tp,{value:e,field:t}):a===`boolean`?typeof e==`boolean`?(0,Q.jsx)(`span`,{children:r(e)}):(0,Q.jsx)(X,{}):a===`date`?!i||isNaN(Gn(i).getTime())?(0,Q.jsx)(X,{}):(0,Q.jsx)(`span`,{className:`tabular-nums`,children:Yn(i,void 0,{locale:n})}):(0,Q.jsx)(Sp,{value:e,field:t})}function _m({value:e,className:t}){let n=_p(),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)(ym,{raw:r,hint:a,className:t})}function vm({value:e,className:t}){let n=_p(),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)(ym,{raw:r,hint:a,className:t})}function ym({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)(Co,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e})]})}function bm({value:e,field:t}){let n=Js(),r=t?.reference||`sys_user`;if(wt(e)||!e)return(0,Q.jsx)(X,{});if(typeof e!=`object`)return(0,Q.jsx)(_m,{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)(_m,{value:e,className:`text-sm`},t);let i=Fa(e,n,r);if(yp(i)&&Object.keys(i).length===0)return(0,Q.jsx)(xp,{text:String(xc(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)(Ln,{className:`size-8 border-2 border-white`,title:a,children:[i.image&&(0,Q.jsx)(b,{src:i.image,alt:a}),(0,Q.jsx)(Oe,{className:`bg-blue-500 text-white text-xs`,children:o})]},t)}),e.length>3&&(0,Q.jsx)(Ln,{className:`size-8 border-2 border-white`,children:(0,Q.jsxs)(Oe,{className:`bg-gray-200 text-gray-600 text-xs`,children:[`+`,e.length-3]})})]});let i=Fa(e,n,r);if(Object.keys(i).length===0)return(0,Q.jsx)(xp,{text:String(xc(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)(Ln,{className:`size-8`,children:[i.image&&(0,Q.jsx)(b,{src:i.image,alt:a}),(0,Q.jsx)(Oe,{className:`bg-blue-500 text-white text-xs`,children:o})]}),(0,Q.jsx)(xp,{text:String(a)})]})}var xm=new Map;function Sm(e,t){xm.set(e,t)}var Cm=`record_pointer_card`;function wm(e,t,n){if(!e||!t||e.type!==`text`)return null;let r=e.referenceVia;if(typeof r!=`string`||r===``)return null;let i=t[e.name],a=t[r];if(typeof i!=`string`||i.trim()===``||typeof a!=`string`||a.trim()===``)return null;let o=Tm(e.referenceDeletedWhen,t,n);return o===null?{objectName:a,recordId:i}:{objectName:a,recordId:i,deletedLabel:o}}function Tm(e,t,n){if(!e||typeof e.field!=`string`||typeof e.value!=`string`||t[e.field]!==e.value)return null;let r=n?.(e.field)?.find(t=>t?.value===e.value)?.label;return typeof r==`string`&&r.trim()!==``?r:null}function Em(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.objectName==`string`&&typeof t.recordId==`string`}function Dm({value:e,field:t}){let n=Em(e)?e.deletedLabel??e.recordId:e;return(0,Q.jsx)(Sp,{value:n,field:t})}var Om={phone:`phone`,tel:`phone`,telephone:`phone`,email:`email`,url:`url`,uri:`url`,link:`url`,currency:`currency`,money:`currency`,percent:`percent`,percentage:`percent`},km=new Set([`text`,`textarea`,`string`,`longtext`,``]),Am=new Set([`object-ref`,`recipient-picker`]);function jm(e){if(!e)return`text`;if(typeof e==`string`)return e;let t=(e.type||``).toLowerCase(),n=e.widget;if(typeof n==`string`&&Am.has(n)&&km.has(t))return n;let r=e.format,i=typeof r==`string`?r.toLowerCase():``;return i&&Om[i]&&km.has(t)?Om[i]:e.type||`text`}function Mm(e){if(typeof e!=`object`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function Nm({value:e}){if(wt(e)&&!Array.isArray(e))return(0,Q.jsx)(X,{});let t=Mm(e);return(0,Q.jsx)(xp,{text:t,className:`font-mono text-xs text-gray-600`})}var Pm={name:``,type:`number`},Fm=` · `;function Im(e){return e.map(e=>`group`in e?`${e.label} (${Im(e.group)})`:`${e.label} ${e.face.text}`).join(Fm)}function Lm(e){return e.map((e,t)=>(0,Q.jsxs)(`div`,{className:`inline`,children:[(0,Q.jsxs)(`dt`,{className:U(`inline`,`group`in e?`font-medium`:`text-muted-foreground`),children:[t>0&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`font-normal text-muted-foreground`,children:Fm}),e.label]}),` `,(0,Q.jsx)(`dd`,{className:`inline`,children:`group`in e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`(`}),(0,Q.jsx)(`dl`,{className:`inline`,children:Lm(e.group)}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`)`})]}):e.face.node})]},e.key))}function Rm({value:e,field:t,groupEntries:n}){let r=ir(),i=nc();if(wt(e)&&!Array.isArray(e))return(0,Q.jsx)(X,{});if(!yp(e)||Object.keys(e).length===0)return(0,Q.jsx)(Nm,{value:e,field:t});let a=e=>{if(wt(e)&&!Array.isArray(e))return{node:(0,Q.jsx)(X,{}),text:`—`};if(typeof e==`boolean`){let t=i(e);return{node:t,text:t}}if(typeof e==`number`&&Number.isFinite(e)){let t=ei(e,Pm,r);return{node:(0,Q.jsx)(`span`,{className:`tabular-nums`,children:t}),text:t}}if(Array.isArray(e)||yp(e)){let t=Mm(e);return{node:(0,Q.jsx)(`span`,{className:`font-mono`,children:t}),text:t}}let t=String(xc(e));return{node:t,text:t}},o=e=>Object.entries(e).map(([e,t])=>({key:e,label:Ga(e),face:a(t)})),s=Object.entries(e).map(([e,t])=>n&&yp(t)&&Object.keys(t).length>0?{key:e,label:Ga(e),group:o(t)}:{key:e,label:Ga(e),face:a(t)});return(0,Q.jsx)(`dl`,{className:`block max-w-full truncate`,title:Im(s),children:Lm(s)})}function zm(e){return(0,Q.jsx)(Rm,{...e,groupEntries:!1})}function Bm(e){return(0,Q.jsx)(Rm,{...e,groupEntries:!0})}function Vm({value:e}){if(wt(e))return(0,Q.jsx)(X,{});if(yp(e)){let t=xc(e);return vp(t)?(0,Q.jsx)(X,{}):(0,Q.jsx)(xp,{text:String(t)})}let t=String(e);return vp(t)?(0,Q.jsx)(X,{}):(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 Hm({value:e}){if(wt(e)&&!Array.isArray(e))return(0,Q.jsx)(X,{});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)(Nm,{value:e,field:{}})}function Um({value:e}){let t=ir();if(wt(e)&&!Array.isArray(e))return(0,Q.jsx)(X,{});if(typeof e==`string`)return(0,Q.jsx)(xp,{text:e,className:`text-sm`});if(typeof e==`object`&&!Array.isArray(e)){let n=tc(e,t);if(n)return(0,Q.jsx)(xp,{text:n,className:`text-sm`});if(Object.keys(e).length===0)return(0,Q.jsx)(X,{})}return(0,Q.jsx)(Nm,{value:e,field:{}})}function Wm({value:e}){let t=_p(),n=Array.isArray(e)?e.length:0;if(n===0)return(0,Q.jsx)(X,{});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 Gm({value:e}){return wt(xc(e))?(0,Q.jsx)(X,{}):(0,Q.jsx)(`span`,{children:`••••••`})}var Km=new Set([`password`,`secret`]);function qm(e){if(!e)return!1;let t=Xm(),n=xm.has(e)?xm.get(e):t[e];return n===Gm?!0:Km.has(e)?!Object.values(t).some(e=>e===n):!1}function Jm({value:e}){return wt(e)?(0,Q.jsx)(X,{}):(0,Q.jsx)(`span`,{className:`text-gray-500 italic`,children:`[Vector]`})}function Ym({value:e}){return wt(e)?(0,Q.jsx)(X,{}):(0,Q.jsx)(`span`,{className:`text-gray-500 italic`,children:`[Grid]`})}function Xm(){return{text:Sp,textarea:Sp,...Dc,code:Sp,qrcode:Sp,number:Cp,currency:Tp,percent:Ep,progress:Ep,slider:Cp,rating:wp,boolean:Op,toggle:Op,date:jp,datetime:Mp,time:Sp,select:im,status:im,multiselect:im,radio:im,checkboxes:im,tags:im,lookup:hm,master_detail:hm,tree:hm,email:am,url:om,phone:sm,file:cm,video:cm,audio:cm,image:um,avatar:um,signature:dm,formula:gm,summary:gm,auto_number:Sp,user:bm,...Object.fromEntries([...Km].map(e=>[e,Gm])),location:Hm,geolocation:Hm,address:Um,color:Vm,json:Nm,object:Nm,composite:zm,record:Bm,repeater:Wm,vector:Jm,grid:Ym}}function Zm(e){return xm.has(e)?xm.get(e):(an(e),Xm()[e]||Sp)}Sm(`lookup`,hm),Sm(`master_detail`,hm),Sm(`select`,im),Sm(`status`,im),Sm(`user`,bm),Sm(Cm,Dm),Sm(`object-ref`,Sp),Sm(`recipient-picker`,Sp),Ac(Zm);var Qm={text:()=>Z(()=>Promise.resolve().then(()=>Lc).then(e=>({default:e.TextField})),void 0),textarea:()=>Z(()=>Promise.resolve().then(()=>Bc).then(e=>({default:e.TextAreaField})),void 0),number:()=>Z(()=>Promise.resolve().then(()=>Hc).then(e=>({default:e.NumberField})),void 0),boolean:()=>Z(()=>Promise.resolve().then(()=>$c).then(e=>({default:e.BooleanField})),void 0),select:()=>Z(()=>Promise.resolve().then(()=>rl).then(e=>({default:e.SelectField})),void 0),date:()=>Z(()=>import(`./DatePickerField-DaUsI9YX.js`).then(e=>({default:e.DatePickerField})),__vite__mapDeps([0])),datetime:()=>Z(()=>import(`./DatePickerField-DaUsI9YX.js`).then(e=>({default:e.DateTimePickerField})),__vite__mapDeps([0])),time:()=>Z(()=>Promise.resolve().then(()=>pl).then(e=>({default:e.TimeField})),void 0),email:()=>Z(()=>Promise.resolve().then(()=>hl).then(e=>({default:e.EmailField})),void 0),phone:()=>Z(()=>Promise.resolve().then(()=>_l).then(e=>({default:e.PhoneField})),void 0),url:()=>Z(()=>Promise.resolve().then(()=>yl).then(e=>({default:e.UrlField})),void 0),multiselect:()=>Z(()=>Promise.resolve().then(()=>tl).then(e=>({default:e.MultiSelectField})),void 0),radio:()=>Z(()=>Promise.resolve().then(()=>ol).then(e=>({default:e.RadioField})),void 0),checkboxes:()=>Z(()=>Promise.resolve().then(()=>cl).then(e=>({default:e.CheckboxesField})),void 0),tags:()=>Z(()=>Promise.resolve().then(()=>ul).then(e=>({default:e.TagsField})),void 0),currency:()=>Z(()=>Promise.resolve().then(()=>Wc).then(e=>({default:e.CurrencyField})),void 0),percent:()=>Z(()=>Promise.resolve().then(()=>Kc).then(e=>({default:e.PercentField})),void 0),password:()=>Z(()=>Promise.resolve().then(()=>bd).then(e=>({default:e.PasswordField})),void 0),markdown:()=>Z(()=>Promise.resolve().then(()=>Sd).then(e=>({default:e.RichTextField})),void 0),html:()=>Z(()=>Promise.resolve().then(()=>Sd).then(e=>({default:e.RichTextField})),void 0),richtext:()=>Z(()=>Promise.resolve().then(()=>Sd).then(e=>({default:e.RichTextField})),void 0),lookup:()=>Z(()=>Promise.resolve().then(()=>fu).then(e=>({default:e.LookupField})),void 0),master_detail:()=>Z(()=>Promise.resolve().then(()=>fu).then(e=>({default:e.LookupField})),void 0),file:()=>Z(()=>Promise.resolve().then(()=>gf).then(e=>({default:e.FileField})),void 0),image:()=>Z(()=>Promise.resolve().then(()=>bf).then(e=>({default:e.ImageField})),void 0),location:()=>Z(()=>Promise.resolve().then(()=>Pu).then(e=>({default:e.LocationField})),void 0),formula:()=>Z(()=>Promise.resolve().then(()=>Tf).then(e=>({default:e.FormulaField})),void 0),summary:()=>Z(()=>Promise.resolve().then(()=>Df).then(e=>({default:e.SummaryField})),void 0),auto_number:()=>Z(()=>Promise.resolve().then(()=>kf).then(e=>({default:e.AutoNumberField})),void 0),user:()=>Z(()=>Promise.resolve().then(()=>Du).then(e=>({default:e.UserField})),void 0),object:()=>Z(()=>Promise.resolve().then(()=>nd).then(e=>({default:e.ObjectField})),void 0),vector:()=>Z(()=>Promise.resolve().then(()=>jf).then(e=>({default:e.VectorField})),void 0),grid:()=>Z(()=>Promise.resolve().then(()=>Nf).then(e=>({default:e.GridField})),void 0),color:()=>Z(()=>Promise.resolve().then(()=>Au).then(e=>({default:e.ColorField})),void 0),slider:()=>Z(()=>Promise.resolve().then(()=>Yc).then(e=>({default:e.SliderField})),void 0),rating:()=>Z(()=>Promise.resolve().then(()=>Zc).then(e=>({default:e.RatingField})),void 0),code:()=>Z(()=>Promise.resolve().then(()=>ed).then(e=>({default:e.CodeField})),void 0),avatar:()=>Z(()=>Promise.resolve().then(()=>ap).then(e=>({default:e.AvatarField})),void 0),address:()=>Z(()=>Promise.resolve().then(()=>Mu).then(e=>({default:e.AddressField})),void 0),geolocation:()=>Z(()=>Promise.resolve().then(()=>Xu).then(e=>({default:e.GeolocationField})),void 0),signature:()=>Z(()=>Promise.resolve().then(()=>sp).then(e=>({default:e.SignatureField})),void 0),qrcode:()=>Z(()=>Promise.resolve().then(()=>od).then(e=>({default:e.QRCodeField})),void 0),"object-ref":()=>Z(()=>Promise.resolve().then(()=>Dd).then(e=>({default:e.ObjectRefField})),void 0),"filter-condition":()=>Z(()=>Promise.resolve().then(()=>kd).then(e=>({default:e.FilterConditionField})),void 0),"recipient-picker":()=>Z(()=>Promise.resolve().then(()=>$d).then(e=>({default:e.RecipientPickerField})),void 0),"position-ref":()=>Z(()=>import(`./RegistryRefField-BBaXjRP0.js`).then(e=>({default:e.PositionRefField})),__vite__mapDeps([0])),"permission-ref":()=>Z(()=>import(`./RegistryRefField-BBaXjRP0.js`).then(e=>({default:e.PermissionRefField})),__vite__mapDeps([0]))},$m=Qm,eh=Object.freeze(Object.keys(Qm)),th=new Set(`text.html.image.avatar.grid.textarea.select.email.password.slider.markdown.code.time.address.object-ref.filter-condition.recipient-picker.position-ref.permission-ref.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(`.`)),nh={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`,"position-ref":`control`,"permission-ref":`control`};function rh(e){let t=$m[e];if(!t){console.warn(`Unknown field type: ${e}`);return}let n=$.lazy(t),r=nh[e];De.register(e,Xs(n),{namespace:`field`,skipFallback:th.has(e),...r===`control`?null:{labelling:r}})}var ih=e=>{let t=e?.retiredFieldType??e?.field?.type??e?.schema?.type??e?.type??`unknown`,n=Ft[t]??`[object-ui] Field type \`${t}\` was retired.`;return $.useEffect(()=>{an(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})},ah=new Map;function oh(e){let t=ah.get(e);if(!t){let n=t=>(0,Q.jsx)(ih,{...t,retiredFieldType:e});n.displayName=`RetiredFieldTombstone(${e})`,t=n,ah.set(e,t)}return t}function sh(){Object.keys(Qm).forEach(e=>{rh(e)}),Object.keys(Ft).forEach(e=>{De.register(e,oh(e),{namespace:`field`,skipFallback:!0})})}sh();var ch=new Set([`textarea`,`markdown`,`html`,`grid`,`richtext`,`field:textarea`,`field:markdown`,`field:html`,`field:grid`,`field:richtext`]);function lh(e){return ch.has(e)}function uh(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 dh(e,t){return t<=1?e:e.map(e=>e.span===void 0&&e.type&&lh(e.type)?{...e,span:t}:e)}function fh(e,t,n){if(t!==void 0)return{fields:dh(e,t),columns:t};let r=uh(e.length,n);return{fields:dh(e,r),columns:r}}var ph=Zn({"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.editComment":`Edit comment`,"detail.deleteComment":`Delete comment`,"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`),mh=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`]),hh=new Set([`formula`,`summary`,`rollup`,`autonumber`,`auto_number`]);function gh(e,t){return hh.has(e)||hh.has(t)}var _h=new Set([`image`,`avatar`,`signature`,`file`,`video`,`audio`,`markdown`]);function vh(e,t){return yh(e)||yh(t)}function yh(e){return typeof e!=`string`||_h.has(e)?!1:hd(e)}function bh(e,t){return xh(e)||xh(t)}function xh(e){return typeof e==`string`&&qm(e)}var Sh=`options.currency.currencyConfig.precision.scale.useGrouping.min.max.step.format.widget.dueLike.settledWhen.multiple.reference_field.displayField.descriptionField.idField.allowCreate.lookupColumns.lookupPageSize.lookupFilters.picker.subtitle.avatar_field.avatarField.depends_on.dependsOn`.split(`.`),Ch=[`dueLike`,`settledWhen`];function wh(e,t){let n={...e};for(let e of Ch)delete n[e];if(!t)return n;!n.type&&t.type&&(n.type=t.type);for(let e of Sh){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 Th=`inline-plain-text-input`,Eh=new Set([`text`,`email`,`phone`,`url`]);function Dh(e){return e?eh.includes(e)||Pc(e)!==`field:text`:!1}function Oh(e){let t=e?.type;return!t||Eh.has(t)?!0:t===`select`&&!e.multiple}var kh=({field:e,value:t,onChange:n,dataSource:r,autoFocus:i,error:a,dependentValues:o})=>{let s=e.type;if(typeof s==`string`&&Ft[s])return(0,Q.jsx)(ih,{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)(il,{field:{...e,multiple:!0},value:Array.isArray(t)?t:t==null||t===``?[]:[t],onChange:e=>n(e),error:a,dependentValues:o}):(0,Q.jsx)(il,{field:e,value:t==null?``:String(t),onChange:e=>n(e),error:a,dependentValues:o});if(s===`boolean`)return(0,Q.jsx)(el,{field:e,value:!!t,onChange:e=>n(e),error:a});if(s===`image`)return(0,Q.jsx)(Sf,{field:e,value:t,onChange:e=>n(e),error:a});if(s===`avatar`)return(0,Q.jsx)(op,{field:e,value:t,onChange:e=>n(e),error:a});if(s===`signature`)return(0,Q.jsx)(cp,{field:e,value:t,onChange:e=>n(e),error:a});if(s===`file`||s===`video`||s===`audio`)return(0,Q.jsx)(vf,{field:e,value:t,onChange:e=>n(e),error:a});if(s===`markdown`||s===`textarea`)return(0,Q.jsx)(Vc,{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&&!hh.has(s);if(l||u)return(0,Q.jsx)(l?ku:Eu,{field:e,value:t,onChange:e=>n(e),dataSource:r,error:a,dependentValues:o});if(s===`number`)return(0,Q.jsx)(Uc,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a});if(s===`currency`)return(0,Q.jsx)(Gc,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a});if(s===`percent`)return(0,Q.jsx)(Jc,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a});if(s===`address`)return(0,Q.jsx)(Nu,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a});if(s===`location`)return(0,Q.jsx)(Yu,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a});if(s===`geolocation`)return(0,Q.jsx)($u,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a});if(!Oh(e)&&Dh(s)&&md(s))return(0,Q.jsx)(_d,{field:e,value:t,onChange:e=>n(e),autoFocus:i,error:a,dependentValues:o});let d=t==null?``:String(typeof t==`object`?xc(t)??``:t);return(0,Q.jsx)(`input`,{type:`text`,"data-testid":Th,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:d,onChange:e=>n(e.target.value)})},Ah=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`}),jh=Ah;function Mh(e){if(!e)return;let t=e.trim();if(t)return t.startsWith(`bg-`)?t:Object.prototype.hasOwnProperty.call(Ah,t)?Ah[t]:void 0}function Nh(e){return wt(e)?!1:typeof e==`object`&&e?!0:tn({value:e},`value`)!==void 0}var Ph=({name:e})=>/^[a-z0-9][a-z0-9-]*$/i.test(e)?(0,Q.jsx)(et,{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 Fh(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 Ih=()=>{};function Lh(e){return e.target===e.currentTarget?e.key===`Enter`||e.key===` `:!1}var Rh=({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=be()!==null,m=!p&&d,[h,g]=$.useState(null),[_,y]=$.useState(void 0),[b,x]=$.useState(!1),{t:S}=ph(),C=nc(),{fieldLabel:w,translateOptions:T}=v(),E=mn()?.fieldErrors??null,D=Js(),O=ee(),A=$.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(()=>{g(e),setTimeout(()=>g(null),2e3)})},[]),M=$.useCallback(e=>!Nh(t?.[e.name]??e.value),[t]),N=$.useMemo(()=>e.fields.filter(M).length,[e.fields,M]),P=Vn(),F=P?3:4,I=P?.2:.25,L=e.fields.length-N,te=!p&&!a&&e.fields.length>=F&&N/e.fields.length>=I&&L>0,R=e.fields.length>0&&L===0,z=e.hideEmpty===!0&&R&&!a,B=!b&&(te||z)?e.fields.filter(e=>!M(e)):e.fields,{fields:V,columns:re}=fh(B,e.columns),ie=Math.min(re,Math.max(1,B.length)),ae=e=>{let n=t?.[e.name]??e.value;if(e.render)return(0,Q.jsx)(On,{schema:Dt(e.render),data:{...t,value:n}});let u=Fh(e.span,ie),d=r?.fields?.[e.name],f=wh(e,d);i&&Array.isArray(f.options)&&f.options.length>0&&(f.options=T(i,e.name,f.options));let p=gh(e.type,d?.type),m=e.readonly===!0||d?.readonly===!0,g=mh.has(e.name),_=vh(e.type,d?.type),v=bh(e.type,d?.type),y=!i||Ei(`recordEdit`,D,i,e.name),b=!m&&!p&&!g&&!_&&y,x=b&&!!s,ee=(()=>{if(!Nh(n))return(0,Q.jsx)(X,{className:`pointer-events-auto`,title:S(`detail.noValue`,{defaultValue:`No value`})});let a=wm({name:e.name,type:f.type,referenceVia:d?.referenceVia,referenceDeletedWhen:d?.referenceDeletedWhen},t,e=>{let t=r?.fields?.[e]?.options;return i&&Array.isArray(t)&&t.length>0?T(i,e,t):t});if(a){let e=Zm(Cm);return(0,Q.jsx)(e,{value:a,field:f})}let o=jm(f)||e.type;if(o===`textarea`)return(0,Q.jsx)(Vc,{field:f,value:String(xc(n)),onChange:Ih,readonly:!0});if(o){let e=Zm(o);if(e===Op&&!b&&typeof n==`boolean`)return C(n);if(e)return(0,Q.jsx)(e,{value:n,field:f,deadlineSettled:Vi(f,t,{scope:O,fields:r?.fields})})}return String(n)})(),M=Nh(n)&&!v,N=M&&!x,F=h===e.name,I=w(i||``,e.name,e.label||e.name);return P&&!(a&&b)?(0,Q.jsxs)(`div`,{className:U(`flex items-baseline justify-between gap-4 py-2.5 min-h-[44px] group`,M&&`cursor-pointer active:bg-muted/40 transition-colors`),onClick:M?()=>A(e.name,n):void 0,onKeyDown:M?t=>{Lh(t)&&(t.preventDefault(),A(e.name,n))}:void 0,role:M?`button`:void 0,tabIndex:M?0:void 0,children:[(0,Q.jsx)(`span`,{className:`text-[15px] text-muted-foreground shrink-0`,children:I}),(0,Q.jsx)(`span`,{className:`text-[15px] text-foreground text-right break-words min-w-0 leading-snug`,children:ee})]},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:w(i||``,e.name,e.label||e.name)}),a&&b?(0,Q.jsxs)(`div`,{className:`min-h-[44px] sm:min-h-0`,children:[(0,Q.jsx)(kh,{field:f,value:n,onChange:t=>o?.(e.name,t),dataSource:l,autoFocus:c===e.name,error:E?.[e.name],dependentValues:t}),E?.[e.name]&&(0,Q.jsx)(`p`,{role:`alert`,"data-inline-field-hint":e.name,className:`mt-1 text-xs text-destructive`,children:E[e.name]})]}):(0,Q.jsxs)(`div`,{className:U(`flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md`,N&&`cursor-pointer active:bg-muted/60 transition-colors`,x&&`cursor-pointer hover:bg-muted/40 transition-colors -mx-1.5 px-1.5`),onClick:N?()=>A(e.name,n):void 0,onDoubleClick:x?()=>s?.(e.name):void 0,onKeyDown:N?t=>{Lh(t)&&(t.preventDefault(),A(e.name,n))}:void 0,role:N?`button`:void 0,tabIndex:N?0:void 0,title:x?S(`detail.editInlineHint`):void 0,children:[(0,Q.jsx)(`div`,{className:`text-sm flex-1 min-w-0 break-words py-1`,children:ee}),x?(0,Q.jsx)(ne,{children:(0,Q.jsxs)(q,{children:[(0,Q.jsx)(H,{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":S(`detail.editInlineHint`),onClick:t=>{t.stopPropagation(),s?.(e.name)},children:(0,Q.jsx)(Ir,{className:`h-3 w-3`})})}),(0,Q.jsx)(k,{children:S(`detail.editInlineHint`)})]})}):M?(0,Q.jsx)(ne,{children:(0,Q.jsxs)(q,{children:[(0,Q.jsx)(H,{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":S(`detail.copyToClipboard`),onClick:t=>{t.stopPropagation(),A(e.name,n)},children:F?(0,Q.jsx)(gr,{className:`h-3 w-3 text-green-600`}):(0,Q.jsx)(Sr,{className:`h-3 w-3`})})}),(0,Q.jsx)(k,{children:S(F?`detail.copied`:`detail.copyToClipboard`)})]})}):null]})]},e.name)},oe=u?.enabled===!0,se=u?.batchSize??20;if($.useEffect(()=>{if(!oe){y(void 0);return}if(V.length<=se){y(void 0);return}y(se);let e=setTimeout(()=>y(void 0),100);return()=>clearTimeout(e)},[oe,V.length,se]),B.length===0&&N===e.fields.length)return null;let ce=_===void 0?V:V.slice(0,_),le=N>0&&te,W=(0,Q.jsxs)(Q.Fragment,{children:[P?(0,Q.jsx)(`div`,{className:`flex flex-col divide-y divide-border/60`,children:ce.map(ae)}):(0,Q.jsx)(`div`,{className:U(`grid gap-3 sm:gap-4`,ie===1?`grid-cols-1`:ie===2?`grid-cols-1 md:grid-cols-2`:ie===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:ce.map(ae)}),le&&(0,Q.jsx)(`div`,{className:`mt-3 -ml-2`,children:(0,Q.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>x(e=>!e),className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,children:[b?(0,Q.jsx)(Er,{className:`h-3.5 w-3.5 mr-1.5`}):(0,Q.jsx)(Dr,{className:`h-3.5 w-3.5 mr-1.5`}),b?S(`detail.hideEmptyFields`,{defaultValue:`Hide empty fields`}):S(`detail.showEmptyFields`,{count:N,defaultValue:`Show {{count}} empty fields`})]})})]});return!e.title&&!e.collapsible&&e.showBorder===!1?(0,Q.jsx)(`div`,{className:U(n),children:W}):!e.collapsible||p?(0,Q.jsxs)(Qt,{className:U(e.showBorder===!1?`border-none shadow-none`:``,n),children:[e.title&&(0,Q.jsxs)(rt,{className:U(`py-3 px-4 sm:py-4 sm:px-6`,Mh(e.headerColor)),children:[(0,Q.jsx)(kn,{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)(Ph,{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)(Mt,{className:`pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5`,children:W})]}):(0,Q.jsx)(En,{open:!m,onOpenChange:e=>f(!e),className:n,children:(0,Q.jsxs)(Qt,{className:U(e.showBorder===!1?`border-none shadow-none`:``),children:[(0,Q.jsxs)(rt,{className:U(`relative py-3 px-4 sm:py-4 sm:px-6 cursor-pointer hover:bg-muted/50 transition-colors`,Mh(e.headerColor)),children:[(0,Q.jsx)(kn,{className:`text-base font-semibold tracking-tight`,children:(0,Q.jsx)(Tt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between text-left rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 after:absolute after:inset-0`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.icon&&(0,Q.jsx)(Ph,{name:e.icon}),(0,Q.jsx)(`span`,{children:e.title})]}),(0,Q.jsx)(`span`,{className:`flex items-center gap-2`,children:m?(0,Q.jsx)(yr,{className:`h-4 w-4 text-muted-foreground`,"aria-hidden":!0}):(0,Q.jsx)(_r,{className:`h-4 w-4 text-muted-foreground`,"aria-hidden":!0})})]})})}),e.description&&!m&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:e.description})]}),(0,Q.jsx)(vt,{children:(0,Q.jsx)(Mt,{className:`pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5`,children:W})})]})})},zh=({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)(Pn,{value:r,onValueChange:i,className:n,children:[(0,Q.jsx)(_,{className:`w-full justify-start border-b rounded-none bg-transparent p-0`,children:a.map(e=>(0,Q.jsx)(An,{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)(dt,{variant:`secondary`,className:`ml-1`,children:e.badge})]})},e.key))}),a.map(e=>(0,Q.jsx)(Te,{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)(On,{schema:Dt(e),data:t},n))}):(0,Q.jsx)(On,{schema:Dt(e.content),data:t})})},e.key))]})},Bh=({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)(Rh,{section:e,data:t,objectSchema:r,objectName:i,isEditing:a,onFieldChange:o,onEnterInlineEdit:s,autoFocusField:c,dataSource:l},n))});return u?(0,Q.jsxs)(En,{open:!d,onOpenChange:e=>f(!e),className:n,children:[(0,Q.jsx)(Tt,{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)(yr,{className:`h-4 w-4 text-muted-foreground shrink-0`}):(0,Q.jsx)(_r,{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)(vt,{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]})},Vh=({fields:e,data:t,className:n,objectName:r,objectSchema:i,dataSource:a})=>{let{fieldLabel:o}=v(),{t:s}=ph(),c=nc(),l=mn(),u=l?.editing??!1,d=l?.canEdit??!1,f=Js(),p=ee(),m=l?.draft,h=$.useMemo(()=>t&&m?{...t,...m}:t,[t,m]);if(!e.length||!t)return null;let g=u?e:e.filter(e=>{let n=t?.[e.name];return n!=null&&n!==``});return g.length===0?null:(0,Q.jsx)(ne,{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`,`sm:-ml-[calc(var(--spacing)*5+1px)]`,`sm:[clip-path:inset(-100vmax_-100vmax_-100vmax_calc(var(--spacing)*3.5+1px))]`),children:g.map(e=>{let n=t[e.name],m=i?.fields?.[e.name],g=e.type||m?.type,_=wh({name:e.name,label:e.label,type:g||`text`},m),v=h?h[e.name]:n,y=gh(e.type,m?.type),b=e.readonly===!0||m?.readonly===!0,x=mh.has(e.name),S=vh(e.type,m?.type),C=!r||Ei(`recordEdit`,f,r,e.name),w=d&&!y&&!b&&!x&&!S&&C,T=u&&w,E=jm(_)||g||`text`,D=Zm(E),O=g===`number`||g===`integer`||g===`currency`||g===`percent`||g===`decimal`,ee=E===`email`||E===`url`||E===`phone`||E===`textarea`||!!g&&vn.has(g),A=g===`boolean`,M=!Nh(v);return(0,Q.jsxs)(`div`,{className:U(`group flex flex-col gap-1 px-5 border-l border-border/60`,`grow max-w-max`,ee||T?`basis-[16rem] min-w-[min(16rem,100%)]`:`basis-[9rem] min-w-[min(9rem,100%)]`,`max-sm:basis-full max-sm:max-w-full max-sm:border-l-0 max-sm:px-0`),children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:o(r||``,e.name,e.label)}),T?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(kh,{field:_,value:v,onChange:t=>l.setField(e.name,t),dataSource:a,autoFocus:l.autoFocusField===e.name,error:l.fieldErrors?.[e.name],dependentValues:h}),l.fieldErrors?.[e.name]&&(0,Q.jsx)(`p`,{role:`alert`,"data-inline-field-hint":e.name,className:`mt-1 text-xs text-destructive`,children:l.fieldErrors[e.name]})]}):(0,Q.jsxs)(`div`,{className:U(`flex items-start justify-between gap-1`,w&&`cursor-pointer rounded-md -mx-1.5 px-1.5 hover:bg-muted/40 transition-colors`),onDoubleClick:w?()=>l.enter(e.name):void 0,title:w?s(`detail.editInlineHint`):void 0,children:[(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:A?v?(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)(gr,{className:`h-3 w-3`,"aria-hidden":!0}),c(!0)]}):(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)(Jr,{className:`h-3 w-3`,"aria-hidden":!0}),c(!1)]}):M?(0,Q.jsx)(X,{className:`block`}):(0,Q.jsx)(`span`,{title:(Array.isArray(_.options)?_.options.find(e=>e?.value===v)?.label:void 0)??(typeof v==`string`||typeof v==`number`?String(v):void 0),className:U(`block min-w-0 truncate text-sm font-semibold`,O&&`tabular-nums tracking-tight`),children:(0,Q.jsx)(D,{value:v,field:_,deadlineSettled:Vi(_,h,{scope:p,fields:i?.fields})})})}),w&&(0,Q.jsxs)(q,{children:[(0,Q.jsx)(H,{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(),l.enter(e.name)},children:(0,Q.jsx)(Ir,{className:`h-3 w-3`})})}),(0,Q.jsx)(k,{children:s(`detail.editInlineHint`)})]})]})]},e.name)})})})})};function Hh(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 Uh=({comments:e,onAddComment:t,onTogglePin:n,searchable:r=!1,className:i})=>{let{t:a}=ph(),o=ir(),[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)(Qt,{className:U(``,i),children:[(0,Q.jsx)(rt,{children:(0,Q.jsxs)(kn,{className:`flex items-center gap-2 text-base`,children:[(0,Q.jsx)(as,{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)(Mt,{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)(Br,{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)(Jr,{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)(Es,{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:Hh(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)(Cs,{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)(Cs,{className:`h-3 w-3`}),e.pinned?a(`detail.unpin`):a(`detail.pin`)]})]})]},e.id))})]})]})},Wh={field_change:Hr,create:bo,delete:Gr,comment:as,status_change:Qa},Gh={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 Kh(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 qh(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 Jh=[`all`,`field_change`,`create`,`delete`,`comment`,`status_change`];function Yh(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 Xh=({activities:e,filterable:t=!1,defaultFilter:n=`all`,className:r})=>{let{t:i}=ph(),a=ir(),[o,s]=$.useState(n),c=$.useMemo(()=>o===`all`?e:e.filter(e=>e.type===o),[e,o]);return(0,Q.jsxs)(Qt,{className:U(``,r),children:[(0,Q.jsx)(rt,{children:(0,Q.jsxs)(kn,{className:`flex items-center gap-2 text-base`,children:[(0,Q.jsx)(Ya,{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)(Mt,{children:[t&&(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mb-4`,role:`group`,"aria-label":i(`detail.filterActivity`),children:Jh.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(Wh[e]||Hr,{className:`h-3 w-3`}),Yh(e,i)]},e))}),c.length===0?(0,Q.jsx)(Nt,{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=Wh[e.type]||Hr,n=Gh[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:qh(e,i)})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:Kh(e.timestamp,i,a)})]})]},e.id)})})]})]})]})},Zh={create:`default`,update:`secondary`,delete:`destructive`,login:`outline`,logout:`outline`,config_change:`secondary`,import:`outline`};function Qh(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 $h=[[60,`second`],[60,`minute`],[24,`hour`],[7,`day`],[4.34524,`week`],[12,`month`],[1/0,`year`]];function eg(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 $h){if(Math.abs(r)<n)try{return new Intl.RelativeTimeFormat(t,{numeric:`auto`}).format(Math.round(r),i)}catch{return Qh(e,t)}r/=n}return Qh(e,t)}function tg(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 ng(e){if(!Nh(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 rg({entries:e,loading:t,emptyText:n,unknownUserText:r,className:i,locale:a}){let o=ir(),s=a??o,c=Kn()(`detail.systemActor`,`System`);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)(xe,{className:`h-8 w-8 rounded-full`}),(0,Q.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,Q.jsx)(xe,{className:`h-4 w-1/3`}),(0,Q.jsx)(xe,{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)(ne,{delayDuration:150,children:(0,Q.jsx)(`ol`,{className:U(`space-y-4`,i),children:e.map((e,t)=>{let n=(e.action??``).toLowerCase(),i=Zh[n]??`outline`,a=typeof e.user_name==`string`&&e.user_name.trim()||``,o=!a&&(e.user_id==null||e.user_id===``),l=a||(o?c:r||`Unknown user`),u=Qh(e.created_at,s),d=eg(e.created_at,s),f=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)(Ln,{className:`h-8 w-8 mt-0.5 shrink-0`,children:[f?(0,Q.jsx)(b,{src:f,alt:l}):null,(0,Q.jsx)(Oe,{className:`text-[10px] font-medium`,children:o?(0,Q.jsx)(Mo,{className:`h-4 w-4 text-muted-foreground`,"aria-hidden":`true`,"data-testid":`history-system-actor-glyph`}):tg(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:l}),e.action&&(0,Q.jsx)(dt,{variant:i,className:`text-[10px] uppercase tracking-wide`,children:e.action}),u&&(0,Q.jsxs)(q,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground cursor-help`,"aria-label":u,children:d||u})}),(0,Q.jsx)(k,{children:u})]})]}),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:ng(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:ng(e.from)}),` → `,(0,Q.jsx)(`span`,{className:`text-foreground`,children:ng(e.to)})]},e.field))}))]})]},e.id??t)})})})}var ig=_i;function ag(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 og(e){return Nh(e)?e:void 0}function sg(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 cg(e,t){try{return new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(e)}catch{return e.toISOString()}}var lg=({value:e,objectSchema:t,fieldName:n})=>{if(!Nh(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=jm(a)||a.type;if(o){let t=Zm(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)})},ug=({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)(ne,{delayDuration:200,children:(0,Q.jsxs)(q,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsx)(`time`,{dateTime:n.toISOString(),className:`cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2`,children:sg(n,a)})}),(0,Q.jsx)(k,{side:`top`,children:cg(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)(lg,{value:t,objectSchema:r,fieldName:i}):null,t&&s?(0,Q.jsx)(`span`,{className:`text-muted-foreground/40`,children:`·`}):null,s]})},dg=({data:e,objectSchema:t,objectName:n,className:r})=>{let{t:i}=ph(),a=ir();if(!e)return null;let o=ag(e[ig.createdAt]),s=ag(e[ig.updatedAt]),c=og(e[ig.createdBy]),l=og(e[ig.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)(ug,{label:i(c?`detail.createdBy`:`detail.created`),user:c,date:o,objectSchema:t,userField:ig.createdBy,t:i,locale:a}),f&&(0,Q.jsx)(ug,{label:i(l?`detail.updatedBy`:`detail.updated`),user:l,date:s,objectSchema:t,userField:ig.updatedBy,t:i,locale:a})]})},fg=$.createContext(!1),pg=new Map,mg=new Set,hg=new Map;function gg(e){for(let t of Array.from(pg.keys())){let[,n,r]=JSON.parse(t);P(e,n,r)&&pg.delete(t)}for(let t of mg)for(let n of t.recordIds)P(e,t.object,n)&&t.staled.add(n);for(let[e,t]of Array.from(hg))t.probe.staled.size>0&&hg.delete(e)}ae(gg);var _g;function vg(e){_g!==void 0&&_g!==e&&(pg.clear(),hg.clear()),_g=e}function yg(e,t,n,r,i){let a=hg.get(e);if(a)return a.answer;let o={object:t,recordIds:[n],staled:new Set};mg.add(o);let s=(async()=>{try{let a=await(i??fetch)(`/api/v1/security/explain`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({object:t,operation:r,recordId:n})});if(!a.ok)return;let s=(await a.json())?.record?.visible;return typeof s!=`boolean`||o.staled.size>0?void 0:(pg.set(e,s),s)}catch{return}finally{mg.delete(o)}})(),c={probe:o,answer:s};hg.set(e,c);let l=()=>{hg.get(e)===c&&hg.delete(e)};return s.then(l,l),s}function bg(e,t,n=`update`,r=!0){let i=Js().userId,a=e&&t?JSON.stringify([i,e,t,n]):``,o=fn(e,t),[s,c]=$.useState(()=>a&&pg.has(a)?pg.get(a):!0),l=$.useContext(u)?.apiFetch;return $.useEffect(()=>{if(vg(i),!r||!e||!t){c(!0);return}if(pg.has(a)){c(pg.get(a));return}c(!0);let o=!1;return yg(a,e,t,n,l).then(e=>{e!==void 0&&!o&&c(e)}),()=>{o=!0}},[a,i,e,t,n,r,l,o]),s}var xg=new Set([`select`,`status`,`multiselect`,`radio`,`checkboxes`,`tags`,`user`,`image`,`avatar`,`signature`,`boolean`,`toggle`,`date`,`datetime`,`repeater`,`file`,`video`,`audio`]);function Sg(e){return!xg.has(e)}function Cg(e,t){let n=Pa(e,t);return t===`whole`?n:Number(n.toPrecision(12))}var wg={};function Tg(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=tn(e,Y(n));if(r){let t=e.id??e._id;if(!(r===`Untitled`||t!=null&&r===`Record #${t}`))return r}let i=bt(n?.titleFormat,e);if(i)return i}if(e&&typeof e==`object`){let t=e.id??e._id,r=xn(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=xn(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 Eg=e=>(e||[]).flatMap(e=>Array.isArray(e?.fields)?e.fields:[]),Dg=({section:e,index:t,children:n})=>(0,Q.jsx)(tt,{componentType:`record:details section ${e?.name??e?.group??e?.title??e?.label??`#${t+1}`}`,children:n}),Og=({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,recordFromHost:p=!1})=>{let[m,h]=$.useState(e.data),[g,y]=$.useState(!e.data&&(p&&e.resourceId!=null||!!(e.api&&e.resourceId||t&&e.objectName&&e.resourceId))),[b,x]=$.useState(!1),S=d??b,C=mn(),w=$.useContext(fg),T=be()!==null,E=C?.editing??!1,D=C?.draft??wg,O=C?.autoFocusField??null,[ee,A]=$.useState(null),[M,N]=$.useState(null),[P,F]=$.useState(!1),[I,L]=$.useState(0),te=fn(e.objectName||void 0,e.resourceId==null?void 0:String(e.resourceId)),[z,B]=$.useState(!1),{t:V}=ph(),{currency:re}=er(),ie=ir(),{fieldOptionLabel:ae,fieldLabel:oe}=v(),se=Js(),ce=$.useMemo(()=>{if(!se?.isLoaded||!e.objectName)return e;let t=t=>se.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,se]),le=$.useMemo(()=>Fa(m,se,e.objectName),[m,se,e.objectName]),W=$.useMemo(()=>Ti(`recordEdit`,{objectSchema:null,objectName:e.objectName,perms:se}).allowed,[se,e.objectName]),ue=$.useMemo(()=>Ti(`recordDelete`,{objectSchema:null,objectName:e.objectName,perms:se}).allowed,[se,e.objectName]),de=e.resourceId==null?void 0:String(e.resourceId),G=bg(e.objectName,de,`update`,W&&!!ce.showEdit),fe=bg(e.objectName,de,`delete`,ue&&!!ce.showDelete),pe=$.useMemo(()=>bi(M?.userActions?.edit),[M]),me=$.useMemo(()=>bi(M?.userActions?.delete),[M]),K=M?.fields,he=R(pe?.visibleWhen??!0,m,{fallback:!1,warnOnError:!0,label:`builtin:edit:visibleWhen`,fields:K}),ge=R(me?.visibleWhen??!0,m,{fallback:!1,warnOnError:!0,label:`builtin:delete:visibleWhen`,fields:K}),J=R(pe?.disabledWhen,m,{fallback:!1,warnOnError:!0,label:`builtin:edit:disabledWhen`,fields:K}),_e=R(me?.disabledWhen,m,{fallback:!1,warnOnError:!0,label:`builtin:delete:disabledWhen`,fields:K}),ve=pe?.disabledWhen!=null&&J,ye=me?.disabledWhen!=null&&_e,Y=$.useMemo(()=>({...ce,showEdit:ce.showEdit&&W&&G&&he,showDelete:ce.showDelete&&ue&&fe&&ge}),[ce,W,G,he,ue,fe,ge]);$.useEffect(()=>{m&&u&&u(m)},[m,u]);let Se=$.useMemo(()=>{if(Y.summaryFields&&Y.summaryFields.length>0)return[];let e=[...Eg(Y.sections),...Y.fields||[]],t={};for(let n of e)t[n.name]||(t[n.name]=n);if(M?.fields)for(let[e,n]of Object.entries(M.fields))t[e]={...t[e]||{},...n,name:e};let n=e=>Nh(m?.[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},[Y.summaryFields,Y.sections,Y.fields,M,m]),Ce=Y.summaryFields&&Y.summaryFields.length>0?Y.summaryFields:Se,Ee=$.useCallback(()=>{Y.resourceId&&navigator.clipboard.writeText(String(Y.resourceId)).then(()=>{F(!0),setTimeout(()=>F(!1),1500)})},[Y.resourceId]),De=p&&!!Y.data;$.useEffect(()=>{let e=!0;if(Y.data)return h(Y.data),y(!1),t?.getObjectSchema&&Y.objectName&&t.getObjectSchema(Y.objectName).then(t=>{e&&N(t)}).catch(()=>{}),()=>{e=!1};if(p&&Y.resourceId!=null)return y(!0),()=>{e=!1};if(t&&Y.objectName&&Y.resourceId){y(!0),N(null),h(null);let n=Y.objectName,r=Y.resourceId,i=`${n}-`,a=[...Eg(Y.sections),...Y.fields||[]];(t.getObjectSchema?t.getObjectSchema(n).catch(()=>null):Promise.resolve(null)).then(o=>{if(!e)return;N(o);let s=mt(o?.fields,a),c=se?.isLoaded?s.filter(e=>se.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&&(h(t),y(!1))}).catch(()=>{e&&(h(null),y(!1))})};return u.catch(()=>null).then(t=>{if(e){if(t){h(t),y(!1);return}return d()}})}).catch(t=>{e&&(console.error(`Failed to fetch detail data:`,t),y(!1))})}else Y.api&&Y.resourceId&&(y(!0),fetch(`${Y.api}/${Y.resourceId}`).then(e=>e.json()).then(t=>{e&&h(t?.data||t)}).catch(e=>{console.error(`Failed to fetch detail data:`,e)}).finally(()=>{e&&y(!1)}));return()=>{e=!1}},[Y.api,Y.resourceId,Y.objectName,t,Y.sections,Y.fields,I,te,se,p,De]);let Oe=$.useCallback(()=>{if(a)a();else if(Y.onNavigate){let e=Y.backUrl||(Y.objectName?`/${Y.objectName}`:`/`);Y.onNavigate(e,{replace:!0})}else Y.backUrl?window.location.href=Y.backUrl:window.history.back()},[a,Y]),ke=$.useCallback(()=>{r?r():Y.onNavigate&&Y.editUrl?Y.onNavigate(Y.editUrl):Y.onNavigate&&Y.objectName&&Y.resourceId?Y.onNavigate(`/${Y.objectName}/${Y.resourceId}/edit`):Y.editUrl&&(window.location.href=Y.editUrl)},[r,Y]),Ae=$.useCallback(async()=>{if(!t?.cancelPendingApproval||!Y.objectName||!Y.resourceId){A(V(`detail.cancelApprovalUnavailable`));return}B(!0),A(null);try{if(await t.cancelPendingApproval(String(Y.objectName),String(Y.resourceId)),t.findOne)try{let e=await t.findOne(String(Y.objectName),String(Y.resourceId));e&&h(e)}catch{}L(e=>e+1);try{window.dispatchEvent(new CustomEvent(`objectui:record-changed`,{detail:{objectName:String(Y.objectName),recordId:String(Y.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*/,``);A(`${V(`detail.cancelApprovalFailed`)}: ${t}`)}finally{B(!1)}},[t,Y.objectName,Y.resourceId,V]),je=$.useCallback(()=>{let e=Y.deleteConfirmation||V(`detail.deleteConfirmation`);window.confirm(e)&&(i?.(),Y.onNavigate&&Y.objectName&&Y.onNavigate(`/${Y.objectName}`,{replace:!0}))},[i,Y]),Me=$.useCallback(()=>{navigator.share&&Y.objectName&&Y.resourceId?navigator.share({title:Y.title||V(`detail.details`),text:`${Y.objectName} #${Y.resourceId}`,url:window.location.href}).catch(e=>{console.error(`Share failed:`,e)}):navigator.clipboard.writeText(window.location.href)},[Y]),Ne=$.useCallback(()=>{let e=!S;f&&f(e),d===void 0&&x(e)},[S,d,f]),Pe=C?.setField,Fe=C&&C.canEdit?C.enter:void 0;$.useEffect(()=>{if(!Y.recordNavigation)return;let e=Y.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)},[Y.recordNavigation]);let Ie=$.useMemo(()=>{let e=[];return e.push({name:`sys_share`,label:V(`detail.share`),icon:`share-2`,type:`script`,onClick:Me}),Y.showEdit&&e.push({name:`sys_edit_mobile`,label:V(`detail.edit`),icon:`square-pen`,type:`script`,className:`sm:hidden`,...ve?{disabled:!0}:null,onClick:ke}),Y.showDelete&&e.push({name:`sys_delete`,label:V(`detail.delete`),icon:`trash`,type:`script`,variant:`destructive`,tags:[`separator-before`],...ye?{disabled:!0}:null,onClick:je}),e},[V,Y.showEdit,Y.showDelete,ve,ye,Me,ke,je]),Le=$.useMemo(()=>{let e=Y.actions??[];if(Ie.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,...Ie]}}return e});return t||n.push({type:`action:bar`,location:`record_header`,systemActions:Ie}),n},[Y.actions,Ie]);return g||Y.loading?(0,Q.jsxs)(`div`,{className:U(`space-y-4`,n),children:[(0,Q.jsx)(xe,{className:`h-10 w-full`}),(0,Q.jsx)(xe,{className:`h-64 w-full`}),(0,Q.jsx)(xe,{className:`h-48 w-full`})]}):!m&&!Y.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:V(`detail.recordNotFound`)}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:V(`detail.recordNotFoundDescription`)}),(Y.showBack??!0)&&(0,Q.jsxs)(j,{variant:`outline`,size:`sm`,onClick:Oe,className:`mt-4 gap-2`,children:[(0,Q.jsx)(lr,{className:`h-4 w-4`}),V(`detail.goBack`)]})]}):(0,Q.jsx)(ne,{children:(0,Q.jsxs)(`div`,{className:U(`space-y-6`,n),children:[Y.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:[(Y.showBack??!0)&&(0,Q.jsxs)(q,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsx)(j,{variant:`ghost`,size:`icon`,onClick:Oe,className:`shrink-0 mt-1`,children:(0,Q.jsx)(lr,{className:`h-4 w-4`})})}),(0,Q.jsx)(k,{children:V(`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:Tg(le,Y,M,V(`detail.details`))}),Ce.map(e=>{let t=m?.[e];if(!Nh(t))return null;let n=Eg(Y.sections).concat(Y.fields||[]).find(t=>t.name===e),r=M?.fields?.[e],i=n?.type||r?.type,a=oe(Y.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=or({...r,...n},re);o=t?new Intl.NumberFormat(ie,{style:`currency`,currency:t,maximumFractionDigits:0}).format(e):new Intl.NumberFormat(ie,{maximumFractionDigits:0}).format(e)}}else if(i===`date`||i===`datetime`){let e=Gn(t);Number.isNaN(e.getTime())||(o=i===`datetime`?e.toLocaleString(ie,{dateStyle:`medium`,timeStyle:`short`}):e.toLocaleDateString(ie,{dateStyle:`medium`}))}else if(i===`percent`){let e=Number(t);if(!Number.isNaN(e)){let t={...r,...n},a=Un({type:i,scale:t.scale}),c=Zr({type:i,max:t.max});o=bp(e,c,a,ie);let l=Cg(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=Y.objectName?ae(Y.objectName,e,String(t),a):a}}catch{}let c=wh({name:e,label:n?.label,type:i||`text`},r),l=jm(c)||i||`text`,u=o.includes(`[object Object]`),d=u&&Sg(l)?Zm(l):null;return u&&!d&&(o=String(xc(t)??``)),d?(0,Q.jsxs)(dt,{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)(dt,{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)(dt,{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)(q,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsx)(j,{variant:`ghost`,size:`icon`,className:`h-6 w-6 shrink-0`,onClick:Ne,"aria-label":V(S?`detail.removeFromFavorites`:`detail.addToFavorites`),children:S?(0,Q.jsx)(Ur,{className:`h-4 w-4 fill-yellow-400 text-yellow-400`}):(0,Q.jsx)(Ur,{className:`h-4 w-4 text-muted-foreground`})})}),(0,Q.jsx)(k,{children:V(S?`detail.removeFromFavorites`:`detail.addToFavorites`)})]})]}),Y.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||Y.objectName}),Y.resourceId&&(0,Q.jsxs)(q,{children:[(0,Q.jsx)(H,{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:Ee,"aria-label":V(`detail.copyRecordId`,{defaultValue:`Copy record ID`}),children:P?(0,Q.jsx)(gr,{className:`h-3 w-3 text-green-600`}):(0,Q.jsx)(Sr,{className:`h-3 w-3`})})}),(0,Q.jsx)(k,{children:P?V(`detail.copied`,{defaultValue:`Copied!`}):V(`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:[Y.recordNavigation&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 mr-2`,children:[(0,Q.jsxs)(q,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsx)(j,{variant:`outline`,size:`icon`,className:`h-8 w-8`,disabled:Y.recordNavigation.currentIndex<=0,onClick:()=>{let e=Y.recordNavigation;e.currentIndex>0&&e.onNavigate(e.recordIds[e.currentIndex-1])},children:(0,Q.jsx)(vr,{className:`h-4 w-4`})})}),(0,Q.jsx)(k,{children:V(`detail.previousRecord`)})]}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap px-1`,children:V(`detail.recordOf`,{current:Y.recordNavigation.currentIndex+1,total:Y.recordNavigation.recordIds.length})}),(0,Q.jsxs)(q,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsx)(j,{variant:`outline`,size:`icon`,className:`h-8 w-8`,disabled:Y.recordNavigation.currentIndex>=Y.recordNavigation.recordIds.length-1,onClick:()=>{let e=Y.recordNavigation;e.currentIndex<e.recordIds.length-1&&e.onNavigate(e.recordIds[e.currentIndex+1])},children:(0,Q.jsx)(yr,{className:`h-4 w-4`})})}),(0,Q.jsx)(k,{children:V(`detail.nextRecord`)})]})]}),Y.showEdit&&(0,Q.jsxs)(q,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsxs)(j,{variant:`default`,disabled:ve,onClick:()=>{ve||ke()},className:`gap-2 hidden sm:inline-flex`,children:[(0,Q.jsx)(Hr,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:V(`detail.edit`)})]})}),(0,Q.jsx)(k,{children:V(`detail.editRecord`)})]}),Le.map((e,t)=>(0,Q.jsx)(On,{schema:Dt(e),data:m},`header-action-${t}`))]})]}),we(Y.header,e=>(0,Q.jsx)(`div`,{children:(0,Q.jsx)(On,{schema:Dt(e),data:m})})),Y.highlightFields&&Y.highlightFields.length>0&&(0,Q.jsx)(Vh,{fields:Y.highlightFields,data:m,objectName:Y.objectName,objectSchema:M}),o&&Y.showHeader===!1&&!T&&(()=>{let e=C?.locked??!1,n=C?.approvalPending??!1,{pending:r,locked:i}=en({readAnswered:C?.approvalReadAnswered===!0,openApproval:n||e?{locked:e}:null,recordStatus:m?.approval_status}),a=r?C?.approvalProgress:void 0,o=!!a&&a.need>0&&a.need<=12;return!r&&!ee?null:(0,Q.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[r&&(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?C?.lockedReason??V(`detail.lockedTooltip`):V(`detail.approvalPendingTooltip`),children:[i?(0,Q.jsx)(Nr,{className:`h-3 w-3`}):(0,Q.jsx)(Eo,{className:`h-3 w-3`}),(0,Q.jsx)(`span`,{children:V(i?`detail.lockedByApproval`:`detail.approvalPendingEditable`)})]}),t?.cancelPendingApproval&&C?.approvalIsSubmitter!==!1&&(0,Q.jsxs)(j,{variant:`outline`,size:`sm`,onClick:Ae,disabled:z,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:V(i?`detail.cancelApprovalTooltip`:`detail.cancelApprovalTooltipUnlocked`),children:[(0,Q.jsx)(Jr,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{children:V(z?`detail.cancelApprovalInFlight`:`detail.cancelApproval`)})]})]}),a&&(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":a.need,"aria-valuenow":Math.min(a.got,a.need),"aria-label":V(`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:a.behavior===`per_group`?V(`detail.approvalProgressGroups`,{got:a.got,need:a.need}):V(`detail.approvalProgress`,{got:a.got,need:a.need})}),o&&(0,Q.jsx)(`span`,{className:`flex items-center gap-1 w-20 shrink-0`,children:Array.from({length:a.need}).map((e,t)=>(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:U(`h-1.5 flex-1 rounded-full`,t<a.got?`bg-emerald-500`:`bg-muted`)},t))})]}),a.groups&&a.groups.length>0&&(0,Q.jsx)(`div`,{className:`flex flex-wrap justify-end gap-1`,children:a.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)(gr,{className:`h-3 w-3`}):(0,Q.jsx)(xr,{className:`h-2.5 w-2.5`}),(0,Q.jsx)(`span`,{children:`${e.group} ${e.got}/${e.need}`})]},e.group))})]}),ee&&(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:ee})]})})(),Y.autoTabs&&!Y.tabs?.length?(()=>{let e=!!Y.activities&&Y.activities.length>0,n=!!s,r=!!Y.history,i=[`details`,...e?[`activity`]:[],...n?[`discussion`]:[],...r?[`history`]:[]],a=Y.defaultTab,c=a&&i.includes(a)?a:`details`,l=Y.onTabChange,u=(0,Q.jsxs)(`div`,{className:`space-y-3 sm:space-y-4`,children:[Y.sectionGroups&&Y.sectionGroups.length>0&&Y.sectionGroups.map((e,n)=>(0,Q.jsx)(Bh,{group:e,data:{...m,...D},objectSchema:M,objectName:Y.objectName,isEditing:E,onFieldChange:Pe,onEnterInlineEdit:o?Fe:void 0,autoFocusField:O,dataSource:t},n)),Y.sections&&Y.sections.length>0&&Y.sections.map((e,n)=>(0,Q.jsx)(Dg,{section:e,index:n,children:(0,Q.jsx)(Rh,{section:e,data:{...m,...D},objectSchema:M,objectName:Y.objectName,isEditing:E,onFieldChange:Pe,onEnterInlineEdit:o?Fe:void 0,autoFocusField:O,dataSource:t})},n)),Y.fields&&Y.fields.length>0&&!Y.sections?.length&&(0,Q.jsx)(Rh,{section:{fields:Y.fields,columns:Y.columns},data:{...m,...D},objectSchema:M,objectName:Y.objectName,isEditing:E,onFieldChange:Pe,onEnterInlineEdit:o?Fe:void 0,autoFocusField:O,dataSource:t}),Y.comments&&(0,Q.jsx)(Uh,{comments:Y.comments,onAddComment:Y.onAddComment})]});return!e&&!n&&!r?(0,Q.jsx)(`div`,{className:`mt-2`,children:u}):(0,Q.jsxs)(Pn,{defaultValue:c,onValueChange:l,className:`w-full`,children:[(0,Q.jsxs)(_,{className:`w-full justify-start border-b rounded-none bg-transparent p-0`,children:[(0,Q.jsx)(An,{value:`details`,className:`relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent`,children:V(`detail.details`)}),e&&(0,Q.jsx)(An,{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:[V(`detail.activity`),(0,Q.jsx)(dt,{variant:`secondary`,className:`text-xs bg-primary/10 text-primary border-transparent`,children:Y.activities.length})]})}),n&&(0,Q.jsx)(An,{value:`discussion`,className:`relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent`,children:V(`detail.discussion`,{defaultValue:`Discussion`})}),r&&(0,Q.jsx)(An,{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:[V(`detail.history`,{defaultValue:`History`}),!Y.history.loading&&Y.history.entries.length>0&&(0,Q.jsx)(dt,{variant:`secondary`,className:`text-xs bg-primary/10 text-primary border-transparent`,children:Y.history.entries.length})]})})]}),(0,Q.jsx)(Te,{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)(Te,{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)(Xh,{activities:Y.activities})}),n&&(0,Q.jsx)(Te,{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)(Te,{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)(rg,{entries:Y.history.entries,loading:Y.history.loading,emptyText:Y.history.emptyText??V(`detail.historyEmpty`,{defaultValue:`No history yet`})})})]})})():(0,Q.jsxs)(Q.Fragment,{children:[Y.sectionGroups&&Y.sectionGroups.length>0&&(0,Q.jsx)(`div`,{className:`space-y-3 sm:space-y-4`,children:Y.sectionGroups.map((e,n)=>(0,Q.jsx)(Bh,{group:e,data:{...m,...D},objectSchema:M,objectName:Y.objectName,isEditing:E,onFieldChange:Pe,onEnterInlineEdit:o?Fe:void 0,autoFocusField:O,dataSource:t},n))}),Y.sections&&Y.sections.length>0&&(0,Q.jsx)(`div`,{className:`space-y-3 sm:space-y-4`,children:Y.sections.map((e,n)=>(0,Q.jsx)(Dg,{section:e,index:n,children:(0,Q.jsx)(Rh,{section:e,data:{...m,...D},objectSchema:M,objectName:Y.objectName,isEditing:E,onFieldChange:Pe,onEnterInlineEdit:o?Fe:void 0,autoFocusField:O,dataSource:t})},n))}),Y.fields&&Y.fields.length>0&&!Y.sections?.length&&(0,Q.jsx)(Rh,{section:{fields:Y.fields,columns:Y.columns},data:{...m,...D},objectSchema:M,objectName:Y.objectName,isEditing:E,onFieldChange:Pe,onEnterInlineEdit:o?Fe:void 0,autoFocusField:O,dataSource:t}),Y.tabs&&Y.tabs.length>0&&(0,Q.jsx)(zh,{tabs:Y.tabs,data:m}),Y.comments&&(0,Q.jsx)(Uh,{comments:Y.comments,onAddComment:Y.onAddComment}),Y.activities&&Y.activities.length>0&&(0,Q.jsx)(Xh,{activities:Y.activities})]}),!w&&(0,Q.jsx)(dg,{data:{...m,...D},objectSchema:M,objectName:Y.objectName}),we(Y.footer,e=>(0,Q.jsx)(`div`,{children:(0,Q.jsx)(On,{schema:Dt(e),data:m})}))]})})},kg=new Set([`title`,`description`,`icon`,`fields`,`collapsible`,`defaultCollapsed`,`columns`,`showBorder`,`headerColor`,`hideEmpty`]),Ag=e=>{let t={},n={};for(let[r,i]of Object.entries(e))(kg.has(r)?t:n)[r]=i;return(0,Q.jsx)(Rh,{...n,section:t})};Ag.displayName=`DetailSectionNode(DetailSection)`;function jg(e){return Rn(e)??jr}function Mg(e,t){let n=e?.id??e?._id;if(t){let r=xn(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 Ng(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 Pg=`image`;function Fg(e){return $.createElement(Gm,{value:e})}function Ig(e){let t=e?.accessorKey||_t(e);return t?String(t):void 0}function Lg(e){return JSON.parse(e)}function Rg(e,t,n){return!t?.isLoaded||!n?e:e.filter(e=>{let r=Ig(e);return!r||t.checkField(n,r,`read`)})}function zg(e,t){return t?e.filter(e=>Ig(e)!==t):e}function Bg(e,t){return t.size===0?e:e.filter(e=>{let n=Ig(e);return!(n&&t.has(n))})}var Vg=({action:e,onToolbarAction:t})=>{let n=e.visible,r=G(nt(n),void 0,{throwOnError:!0,label:`related-list toolbar action "${e.name}" (visible)`});if(Zt(n)&&!r)return null;let i=e.icon?jg(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]})},Hg=({title:e,type:t,api:n,data:r,schema:i,columns:a,className:o,dataSource:s,objectName:c,onNew:l,newDisabled:u,onViewAll:d,onRowEdit:p,onRowDelete:m,onRowClick:h,rowActions:g,onRowAction:_,toolbarActions:y,onToolbarAction:b,add:x,redactFields:S,maxColumns:T=6,pageSize:E,defaultSort:O,sortable:k=!1,filter:A,filterable:M=!1,collapsible:N=!1,defaultCollapsed:P=!1,referenceField:F,parentId:I,icon:L})=>{let te=r!==void 0,ne=r??[],[R,z]=$.useState(ne),[B,V]=$.useState(()=>!!n&&!te),[ie,ae]=$.useState(0),[H,se]=$.useState(null),[ce,le]=$.useState(`asc`),[W,de]=$.useState(``),[G,fe]=$.useState(null),[me,K]=$.useState(!1),{ready:q,def:J}=re(n??``,s),_e=ee(),[ye,Y]=$.useState(P),[be,xe]=$.useState(!1),[Ce,we]=$.useState(!1),[Te,Ee]=$.useState(null),[De,Oe]=$.useState(0),[ke,Ae]=$.useState({}),{t:je}=ph(),{fieldLabel:Me}=v(),Ne=Js(),Pe=Xe(),Fe=$.useMemo(()=>(y??[]).filter(e=>Pe(e?.requiredPermissions)),[y,Pe]),Ie=E&&E>0?E:0,Le=M&&W!==``,Re=!te&&!!n&&Ie>0&&!!s&&typeof s.find==`function`&&!Le,ze=Re?ie:0,Be=Re?H:null,Ve=Re?ce:`asc`,He=JSON.stringify(O??null),Ue=$.useMemo(()=>Ng(O),[He]),We=At(),Ge=Xt(A,We),qe=JSON.stringify(Ge??null),Je=$.useMemo(()=>he(Ge),[qe]),Ye=Je.ok?void 0:Je.refusal,Ze=Je.ok?Je.node:void 0,$e=$.useMemo(()=>{let e=Array.isArray(a)?a.map(e=>typeof e==`string`?e:e?.accessorKey||_t(e)).filter(e=>typeof e==`string`&&e.length>0):[],t=mt(J?.fields,e.length>0?e:void 0).filter(e=>e!==F),r=c||n||``;return!Ne?.isLoaded||!r?t:t.filter(e=>Ne.checkField(r,e,`read`))},[a,J,F,c,n,Ne]),et=$e.join(`,`),tt=$.useMemo(()=>new Set((Array.isArray(S)?S:[]).filter(e=>typeof e==`string`&&e.length>0)),[S]),nt=$.useMemo(()=>{let e=Bg(Array.isArray(a)?a:[],tt);if(e.length===0)return;let t=c||n||``,r=new Set([`id`]),i=[];for(let n of Rg(zg(e,F),Ne,t)){let e=Ig(n);e&&(r.add(e),i.push(e))}for(let e of $e)r.add(e);let o=J?.fields;if(o&&typeof o==`object`){let e=e=>!Ne?.isLoaded||!t||Ne.checkField(t,e,`read`),n=i.map(e=>Hn(o,e)).filter(e=>e?.dueLike===!0&&e.settledWhen!=null).map(e=>e.settledWhen),a=Ua([...Wa({rowActionDefs:g,objectActions:J?.actions,userActions:J?.userActions}),...n]);for(let t of a){let n=Hn(o,t)!==void 0;(n||Ia.has(t))&&(!n||e(t))&&r.add(t)}Hn(o,Pg)!==void 0&&e(Pg)&&r.add(Pg)}return Array.from(r)},[a,tt,F,c,n,Ne,$e,J,g]),it=nt?nt.join(`,`):``;$.useEffect(()=>{te&&z(r??[])},[r,te]);let at=$.useMemo(()=>Se(J?.fields,F),[J,F]),ot=x?.picker?.object,[st,ct]=$.useState(null);$.useEffect(()=>{if(!be||!ot||st||!s?.getObjectSchema)return;let e=!1;return s.getObjectSchema(ot).then(t=>{e||ct(t)}).catch(e=>{console.warn(`[RelatedList] Failed to fetch schema for ${ot}:`,e)}),()=>{e=!0}},[be,ot,st,s]);let lt=x?.picker?.labelField||`name`,ut=$.useMemo(()=>{let e=du(st,{displayField:lt});return e.length>0?e:void 0},[st,lt]);$.useEffect(()=>{x&&!ot&&console.warn(`[RelatedList] "${n||c||`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.`)},[x,ot,n,c]),$.useEffect(()=>{let e=!1;if(Ye){V(!1);return}if(n&&!te){if(!(F&&I!=null&&I!==``)){n&&(I==null||I===``)&&!F&&console.warn(`[RelatedList] "${n}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`),z([]),fe(null),K(!1),V(!1);return}if(V(!0),!q)return;let t=oe(F,I,J?.fields),r=Ze===void 0?t:C(t,Ze);if(s&&typeof s.find==`function`){let t={$filter:r};if($e.length>0&&(t.$expand=$e),nt&&(t.$select=nt),Re){t.$top=Ie,t.$skip=ze*Ie;let e=Be?[{field:Be,order:Ve}]:Ue;e.length>0&&(t.$orderby=e)}s.find(n,t).then(t=>{if(e)return;let n=Array.isArray(t),r=n?t:Array.isArray(t?.data)?t.data:[];if(z(r),Re){let e=!n&&typeof t?.total==`number`?t.total:null;fe(e),K(!n&&typeof t?.hasMore==`boolean`?t.hasMore:r.length===Ie)}else fe(null),K(!1);V(!1)}).catch(t=>{console.error(`Failed to fetch related data:`,t),e||V(!1)})}else if(Ze!==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.`),z([]),fe(null),K(!1),V(!1);else if(at)console.warn(`[RelatedList] "${n}" relates through the multi-value field "${F}" 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.`),z([]),fe(null),K(!1),V(!1);else{let t=new URLSearchParams({[`filter[${F}]`]:String(I)}).toString();fetch(`${n}?${t}`).then(e=>e.json()).then(t=>{if(e)return;let n=Array.isArray(t)?t:t?.data||[];z(n),fe(null),K(!1)}).catch(e=>{console.error(`Failed to fetch related data:`,e)}).finally(()=>{e||V(!1)})}}return()=>{e=!0}},[n,te,s,F,at,I,De,Re,Ie,ze,Be,Ve,He,qe,et,it,q]),$.useEffect(()=>{Re&&!B&&ie>0&&R.length===0&&ae(e=>Math.max(0,e-1))},[Re,B,R,ie]),$.useEffect(()=>{ae(0)},[n,F,I,qe]),$.useEffect(()=>{if(!n||te)return;let e=e=>{let t=e.detail||{};t.objectName&&t.objectName!==`*`&&t.objectName!==n||Oe(e=>e+1)};return window.addEventListener(`objectui:related-changed`,e),()=>window.removeEventListener(`objectui:related-changed`,e)},[n,te]),$.useEffect(()=>{if(!s?.find||!J?.fields||!R.length)return;let e=J.fields,t=[];for(let[n,r]of Object.entries(e)){if(!qt(r))continue;let e=r.reference;if(!e)continue;let i=new Set;for(let e of R){let t=e?.[n];t!=null&&(typeof t==`string`&&t?i.add(t):typeof t==`number`&&i.add(String(t)))}let a=ke[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([s.find(t,{$filter:{id:{$in:n}},$top:n.length}),typeof s.getObjectSchema==`function`?s.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)]=Mg(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||Ae(t=>{let n={...t};for(let{fieldName:t,map:r}of e)n[t]={...n[t]||{},...r};return n})}),()=>{n=!0}},[s,J,R]);let[ft,pt]=$.useState(null),ht=$.useCallback(e=>{pt(e)},[]),gt=$.useCallback(async()=>{if(ft)try{await m?.(ft),Oe(e=>e+1)}catch(e){console.error(`[RelatedList] remove failed`,e)}pt(null)},[ft,m]),vt=x?x.linkField?Ti(`relatedNew`,{objectSchema:J,objectName:n,perms:Ne}).allowed:Ti(`relatedRowEdit`,{objectSchema:x.picker?.object===n?J:null,objectName:x.picker?.object,perms:Ne}).allowed:!1,yt=$.useCallback(async e=>{if(!x||!s||!n||F==null||I==null)return;let t=x.picker.valueField||`id`;we(!0),Ee(null);try{for(let r of e||[]){let e=r?.[t]??r?.id;e!=null&&(x.linkField?await s.create?.(n,{[F]:I,[x.linkField]:e}):await s.update?.(x.picker.object,String(e),{[F]:I}))}Oe(e=>e+1)}catch(e){let t=e?.body?.error??e?.error??e?.message??String(e);Ee(typeof t==`string`?t:`Failed to add`)}finally{we(!1),xe(!1)}},[x,s,n,F,I]),bt=$.useMemo(()=>{let e=c||n||``,t=t=>Rg(t,Ne,e),r=e=>zg(e,F),i=e=>tt.size>0&&!!e&&tt.has(String(e)),o=e=>Bg(e,tt),s=e=>wt(e)||typeof e==`string`&&e.trim()===``,l=e=>R.length?e.filter(e=>{let t=e?.accessorKey||_t(e);return!t||R.some(e=>!s(e?.[t]))}):e,u=(e,t)=>{if(!t?.type)return;let n=Zm(jm({type:t.type,format:t.format})||t.type);if(!n)return;let r=t.type===`lookup`||t.type===`master_detail`,i=qt(t)?ke[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},c={name:e,label:t.label||e,type:t.type,...(a||t.options)&&{options:a||t.options},...t.currency&&{currency:t.currency},...t.currencyConfig&&{currencyConfig:t.currencyConfig},...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.dueLike!==void 0&&{dueLike:t.dueLike},...t.reference&&{reference:t.reference},...t.reference_field&&{reference_field:t.reference_field}};return(e,r)=>s(e)?$.createElement(X):$.createElement(n,{value:o(e),field:c,deadlineSettled:Vi(t,r,{scope:_e,fields:J?.fields})})},d=t=>{if(typeof t!=`string`){let e=t?.accessorKey||_t(t);if(!t||!e)return t;let n={};if(t.accessorKey||(n.accessorKey=e),!t.header){let e=Tn(t);e&&(n.header=e)}if(!t.cell&&!t.render){let t=J?.fields?.[e],r=t?u(String(e),t):void 0;r&&(n.cell=r)}return Object.keys(n).length>0?{...t,...n}:t}let n=J?.fields?.[t],r={accessorKey:t,header:n?.label||Me(e,t,n)||t,fieldDef:n,fieldType:n?.type},i=n?u(t,n):void 0;return i&&(r.cell=i),r};if(a&&a.length>0){let e=o(a.map(d));if(e.length>0)return l(t(r(e)))}if(!J?.fields)return[];let f=Array.isArray(J.highlightFields)?J.highlightFields.filter(e=>typeof e==`string`&&e.length>0):[];if(f.length>0){let e=l(t(r(o(f.map(d)))));if(e.length>0)return e.slice(0,Math.max(1,T))}let p=e,m=new Set([`richtext`,`markdown`,`html`,`json`]),h=[`name`,`full_name`,`fullname`,`title`,`subject`,`label`,`code`,`number`],g=Object.entries(J.fields).filter(([e,t])=>!(e.startsWith(`_`)||e===`id`||e===F||t?.hidden||t?.type&&m.has(t.type)||i(e)||Ne?.isLoaded&&p&&!Ne.checkField(p,e,`read`))),_=new Set([`created_at`,`updated_at`,`created_by`,`updated_by`,`owner_id`,`organization_id`]);return g.sort(([e,t],[n,r])=>{let i=_.has(e);if(i!==_.has(n))return i?1:-1;let a=h.indexOf(e),o=h.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(g.map(([e,t])=>{let n={accessorKey:e,header:Me(p,e,t.label||e)};if(t.type){let r=u(e,t);r&&(n.cell=r)}return n})).slice(0,Math.max(1,T))},[a,J,c,n,Me,F,R,T,ke,Ne,tt,_e]),xt=Mi(J),St=$.useCallback((e,t)=>qt(t)?!0:xt?!Ni(xt,e):ki(t),[xt]),Ct=$.useMemo(()=>Re?bt.map(e=>{let t=e.accessorKey||_t(e),n=t?J?.fields?.[t]:void 0;return St(t,n)?{...e,sortable:!1}:e}):bt,[bt,Re,J,St]),Tt=!!n&&typeof s?.getObjectSchema==`function`&&!J?.fields,Et=$.useMemo(()=>{let e=Ct.map(e=>{if(!e||typeof e!=`object`)return e;let t=e.accessorKey||_t(e),n=t?J?.fields?.[t]:void 0,r=Tt||bh(e.type,n?.type);return Tt&&typeof e.cell!=`function`?{...e,masked:!0,cell:Fg}:r&&e.masked!==!0?{...e,masked:!0}:e});return e.every((e,t)=>e===Ct[t])?Ct:e},[Ct,J,Tt]),Dt=$.useMemo(()=>JSON.stringify(Et.flatMap(e=>{if(!e||typeof e!=`object`||e.masked===!0)return[];let t=Ig(e);return t?[t]:[]})),[Et]),Ot=Lg(Dt),kt=$.useMemo(()=>{if(Re||!W)return R;let e=W.toLowerCase(),t=Lg(Dt);return R.filter(n=>t.some(t=>{let r=n?.[t];return r!=null&&String(r).toLowerCase().includes(e)}))},[R,W,Re,Dt]),jt=$.useMemo(()=>{if(Re||!H||!Lg(Dt).includes(H))return kt;let e=ke[H],t=kt.map(t=>({row:t,key:Qe(t[H],{labels:e})}));return t.sort((e,t)=>{let n=Ke(e.key,t.key);return ce===`asc`?n:-n}),t.map(e=>e.row)},[kt,H,ce,Re,ke,Dt]),Nt=Ie&&!Re?jt.slice(ie*Ie,(ie+1)*Ie):jt,Pt=Ie?Re?G==null?ie+(me?2:1):Math.max(1,Math.ceil(G/Ie)):Math.max(1,Math.ceil(jt.length/Ie)):1,Ft=Re?G==null?me:(ie+1)*Ie<G:ie<Pt-1,It=Ie>0&&(Re?ie>0||Ft:jt.length>Ie);$.useEffect(()=>{ae(0)},[W,H,ce]);let Lt=$.useCallback(e=>{Lg(Dt).includes(e)&&(ae(0),H===e?le(e=>e===`asc`?`desc`:`asc`):(se(e),le(`asc`)))},[H,Dt]),Rt=$.useMemo(()=>H?[{field:H,order:ce}]:Ue,[H,ce,Ue]),zt=$.useCallback(e=>{let t=e[0];t&&Lg(Dt).includes(t.field)&&(ae(0),se(t.field),le(t.order))},[Dt]),Vt=!i&&(t===`grid`||t===`table`),Ht=Array.isArray(g)&&g.length>0,Ut=!!p||!!m||Ht,Gt=Vn(),Kt=$.useMemo(()=>{if(i)return i;if(Gt&&(t===`grid`||t===`table`)){let e=bt[0]?.accessorKey||_t(bt[0]),t=bt.slice(1,4).map(e=>e.accessorKey||_t(e)).filter(Boolean);return{type:`object-gallery`,data:Nt,objectName:n,gallery:{titleField:e||`name`,visibleFields:t,coverField:Pg,cardSize:`medium`},onRowClick:h}}let e=bi(J?.userActions?.edit),r=bi(J?.userActions?.delete);switch(t){case`grid`:case`table`:return{type:`data-table`,data:Nt,columns:Et,pagination:!1,pageSize:Ie||10,searchable:!1,exportable:!1,manualSorting:!0,sort:Rt,onSortChange:zt,rowActions:Ut,onRowEdit:p,onRowDelete:m?ht:void 0,rowEditPredicates:e,rowDeletePredicates:r,onRowClick:h,rowActionDefs:Ht?g:void 0,onRowActionDef:Ht?_:void 0};case`list`:return{type:`data-list`,data:Nt};default:return{type:`div`,children:`No view configured`}}},[t,Nt,Et,bt,i,Ie,Ut,Ht,g,_,p,m,ht,h,Gt,n,J,Rt,zt]),Jt=N?`cursor-pointer select-none`:void 0,Yt=N?()=>Y(e=>!e):void 0,Zt=jg(L),$t=Re&&G!=null?G:R.length,en=!B&&R.length===0&&(!Re||ie===0),tn=M;return Ye?(0,Q.jsxs)(Qt,{className:U(`shadow-none border-border/60 bg-transparent`,o),children:[(0,Q.jsx)(rt,{className:`py-3 px-4 sm:py-3 min-h-12 sm:min-h-0`,children:(0,Q.jsxs)(kn,{className:`flex items-center gap-2 text-sm font-semibold`,children:[(0,Q.jsx)(Zt,{className:`h-4 w-4 text-muted-foreground shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`truncate`,children:e})]})}),(0,Q.jsx)(Mt,{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:je(`view.malformedFilter`,{subject:D(Ye)??``})}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs opacity-80`,children:Ye.message})]})})]}):(0,Q.jsxs)(Qt,{className:U(`shadow-none border-border/60 bg-transparent`,en&&`bg-muted/10`,o),children:[(0,Q.jsx)(rt,{className:U(`py-3 px-4 sm:py-3 min-h-12 sm:min-h-0`,Jt),onClick:Yt,children:(0,Q.jsxs)(kn,{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:[N&&(ye?(0,Q.jsx)(yr,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}):(0,Q.jsx)(_r,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`})),(0,Q.jsx)(Zt,{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)(dt,{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:je(`detail.noRelatedRecords`)})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[b&&Fe.map(e=>(0,Q.jsx)(Vg,{action:e,onToolbarAction:b},e.name)),x&&ot&&s&&vt&&(0,Q.jsxs)(j,{variant:en?`ghost`:`outline`,size:`sm`,disabled:Ce,onClick:e=>{e.stopPropagation(),Ee(null),xe(!0)},className:`gap-1 h-9 sm:h-7 text-xs shadow-none`,children:[(0,Q.jsx)(Lr,{className:`h-3.5 w-3.5`}),x.label||je(`detail.add`,{defaultValue:`Add`})]}),l&&(0,Q.jsxs)(j,{variant:en?`ghost`:`outline`,size:`sm`,disabled:u,"data-testid":`related-list-new`,onClick:e=>{e.stopPropagation(),l()},className:`gap-1 h-9 sm:h-7 text-xs shadow-none`,children:[(0,Q.jsx)(Lr,{className:`h-3.5 w-3.5`}),je(`detail.new`)]})]})]})}),!ye&&!en&&(0,Q.jsxs)(Mt,{className:U(`pt-0 pb-4 px-4`),children:[tn&&(0,Q.jsx)(`div`,{className:`mb-3`,children:(0,Q.jsx)(nn,{placeholder:je(`detail.filterPlaceholder`),value:W,onChange:e=>de(e.target.value),className:`h-8 text-sm`})}),k&&!Vt&&bt&&bt.length>0&&R.length>0&&(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-3`,children:bt.map(e=>{let t=e.accessorKey||_t(e);if(!t)return null;let n=J?.fields?.[t];if(Re&&St(t,n)||!Ot.includes(t))return null;let r=e.header||e.label||t,i=H===t;return(0,Q.jsxs)(j,{variant:i?`secondary`:`ghost`,size:`sm`,className:`gap-1 h-7 text-xs`,onClick:()=>Lt(t),children:[(0,Q.jsx)(dr,{className:`h-3 w-3`}),r,i&&(ce===`asc`?` ↑`:` ↓`)]},t)})}),B&&R.length===0?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-6 text-muted-foreground text-sm`,children:je(`detail.loading`)}):(0,Q.jsx)(`div`,{className:U(B&&`opacity-60 pointer-events-none transition-opacity`),children:(0,Q.jsx)(On,{schema:Kt})}),It&&(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:ie===0,onClick:()=>ae(e=>Math.max(0,e-1)),children:[(0,Q.jsx)(vr,{className:`h-3 w-3`}),je(`detail.previousPage`)]}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:je(`detail.pageOf`,{current:ie+1,total:Pt})}),(0,Q.jsxs)(j,{variant:`outline`,size:`sm`,className:`h-7 text-xs gap-1`,disabled:!Ft,onClick:()=>ae(e=>Ft?e+1:e),children:[je(`detail.nextPage`),(0,Q.jsx)(yr,{className:`h-3 w-3`})]})]}),d&&!en&&(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(),d()},className:`text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors`,children:[je(`detail.viewAll`),(0,Q.jsx)(Fo,{className:`h-3 w-3`})]})})]}),(0,Q.jsx)(w,{open:ft!==null,onOpenChange:e=>{e||pt(null)},children:(0,Q.jsxs)(f,{children:[(0,Q.jsxs)(pe,{children:[(0,Q.jsx)(ve,{children:je(`detail.deleteRowTitle`,{defaultValue:`Delete record`})}),(0,Q.jsx)(Bt,{children:je(`detail.deleteRowConfirmation`)})]}),(0,Q.jsxs)(ue,{children:[(0,Q.jsx)(Wt,{children:je(`detail.cancel`,{defaultValue:`Cancel`})}),(0,Q.jsx)(ge,{onClick:gt,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:je(`detail.delete`,{defaultValue:`Delete`})})]})]})}),Te&&(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:Te}),x&&ot&&s&&vt&&(0,Q.jsx)(Ul,{open:be,onOpenChange:e=>xe(e),multiple:!0,dataSource:s,objectName:ot,title:x.label||je(`detail.add`,{defaultValue:`Add`}),displayField:lt,columns:ut,cellRenderer:Zm,fieldsMeta:st?.fields,baseFilter:x.picker.filter,onSelect:()=>{},onSelectRecords:e=>{yt(e)}})]})};function Ug(e){return e===`won`||e===`lost`?e:void 0}function Wg(e,t){if(!e||!t)return null;let n=e.fields?.[t]?.options;return!Array.isArray(n)||n.length===0?null:n.map(e=>{let t=Ug(e.kind);return t?{value:e.value,label:e.label,terminal:t}:{value:e.value,label:e.label}})}function Gg(e,t){if(!e||!t)return null;let n=e.fields?.[t]?.options;if(!Array.isArray(n))return null;let r=new Map;for(let e of n)e?.kind!==void 0&&r.set(e.value,e.kind);return r.size>0?r:null}function Kg(e){if(!e)return null;let t=_e(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=uh(t.reduce((e,t)=>e+t.fields.length,0));return t.map(e=>({...e.key===void 0?{}:{key:e.key},...e.visibleWhen===void 0?{}:{visibleWhen:e.visibleWhen},section:{...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 qg(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 Jg(e,t){let n=qg(e,t);(0,$.useEffect)(()=>{n&&console.warn(n)},[n])}function Yg(e,{defaultRole:t,defaultLabel:n,block:r}={}){let i=ir();Jg(r,e);let a=We(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 Xg={filter:!0,sort:!0},Zg={};function Qg(e){return Mn(e?.dataSource)}function $g(e,t){let n=e_(t),r=r=>{let i=Qg(r.schema);return(0,Q.jsx)(lt,{schema:r.schema??Zg,mapping:Xg,testId:n,requiresDataSource:i,noDataSourceMessage:i?Fn(t,r.schema.dataSource?.object):void 0,children:t=>(0,Q.jsx)(t_,{schema:r.schema,bound:t,testId:n,children:(0,Q.jsx)(e,{...r})})})};return r.displayName=`RecordBinding(${t})`,y(r)}function e_(e){return e.replace(/[:_]/g,`-`)}function t_({schema:e,bound:t,testId:n,children:r}){if(!Qg(e))return(0,Q.jsx)(Q.Fragment,{children:r});let i=t??Zg,a=typeof i.objectName==`string`?i.objectName:``,o=n_(e);return(0,Q.jsx)(u_,{object:a,filter:i.filter,sort:i.sort,testId:n,absent:o?(0,Q.jsx)(r_,{emptyState:o,testId:n}):void 0,children:r})}function n_(e){let t=e?.emptyState;return typeof t==`object`&&t&&!Array.isArray(t)?t:void 0}function r_({emptyState:e,testId:t}){let n=ir(),{t:r}=ph(),i=Ue(e.title,n),a=Ue(e.message,n),o=Rn(e.icon);return(0,Q.jsx)(Nt,{"data-testid":`${t}-empty-state`,icon:o?(0,Q.jsx)(o,{className:`size-5 text-muted-foreground`}):void 0,title:i||r(`detail.recordNotFound`),description:a||void 0,action:e.link?(0,Q.jsx)(pn,{link:e.link,displayLocale:n}):void 0})}function i_({binding:e,blockKey:t,testId:n,errorTitle:r,absent:i,children:a}){let o=$.useMemo(()=>({dataSource:e}),[e]);return Mn(e)?(0,Q.jsx)(lt,{schema:o,mapping:Xg,testId:n,errorTitle:r,requiresDataSource:!0,noDataSourceMessage:Fn(t,e.object),children:e=>{let{objectName:t,filter:o,sort:s}=e;return(0,Q.jsx)(u_,{object:typeof t==`string`?t:``,filter:o,sort:s,testId:n,absent:i,errorTitle:r,children:a})}}):(0,Q.jsx)(Q.Fragment,{children:a})}var a_=new WeakMap;function o_(e,t,n){let r=Fa(e,t,n);if(r===e||!e||typeof e!=`object`)return r;let i=JSON.stringify(Object.keys(r)),a=a_.get(e);return a&&a.kept===i?a.row:(a_.set(e,{kept:i,row:r}),r)}var s_=e=>{let t=e?.data??e,n=Array.isArray(t)?t[0]:void 0;return n&&typeof n==`object`&&!Array.isArray(n)?n:void 0},c_=e=>{let t=e?.id??e?._id;return typeof t==`string`||typeof t==`number`?t:void 0},l_=(e,t)=>e===t||e!==void 0&&t!==void 0&&JSON.stringify(e)===JSON.stringify(t);function u_({object:e,filter:t,sort:n,testId:r,absent:i,errorTitle:a,children:o}){let s=Ee(),c=Js(),l=Xt(t,At()),u=l===void 0?``:JSON.stringify(l),d=n===void 0?``:JSON.stringify(n),f=typeof s?.getObjectSchema==`function`,[p,m]=$.useState(null);$.useEffect(()=>{if(!f||!s)return;let t=!1;return Promise.resolve().then(()=>s.getObjectSchema(e)).then(n=>{t||m({object:e,schema:n})},()=>{t||m({object:e,schema:void 0})}),()=>{t=!0}},[f,s,e]);let h=!f||p?.object===e,g=p?.object===e?p.schema:void 0,_=mt(g?.fields),v=JSON.stringify(c?.isLoaded?_.filter(t=>c.checkField(e,t,`read`)):_),y=JSON.stringify([e,u,d,v]),b=fn(s?e:void 0),[x,S]=$.useState(null);$.useEffect(()=>{if(!s||!h)return;let t=!1,n=JSON.parse(v),r={$top:1};return u&&(r.$filter=JSON.parse(u)),d&&(r.$orderby=JSON.parse(d)),n.length>0&&(r.$expand=n),Promise.resolve().then(()=>s.find(e,r)).then(e=>{if(t)return;let n=s_(e);S(e=>e&&e.key===y&&e.status===`loaded`&&l_(e.row,n)?e:{key:y,status:`loaded`,row:n})},e=>{t||S(Wn(e)===`forbidden`?{key:y,status:`loaded`,row:void 0}:{key:y,status:`failed`,error:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},[s,e,h,y,u,d,v,b]);let C=x?.key===y?x:null;if(s&&!C)return(0,Q.jsx)(`div`,{"data-testid":`${r}-loading-record`,"aria-busy":`true`,className:`space-y-2`,children:(0,Q.jsx)(xe,{className:`h-8 w-full`})});if(C?.status===`failed`)return(0,Q.jsx)(zn,{testId:r,title:a,message:C.error});let w=C?.status===`loaded`?C.row:void 0;return i!==void 0&&w===void 0?(0,Q.jsx)(Q.Fragment,{children:i}):(0,Q.jsx)(E,{objectName:e,recordId:c_(w),data:w===void 0?void 0:o_(w,c,e),objectSchema:g,dataSource:s,children:(0,Q.jsx)(Ae,{children:(0,Q.jsx)(bn,{canEdit:!1,children:o})})})}var d_=e=>_t(e)??null;function f_(e){return e===void 0?void 0:Number(e)}var p_=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}},m_=new Set;function h_(e,t){let n=`${e}.${t}`;m_.has(n)||(m_.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\`.)`))}function g_(e){return Nh(e)?Array.isArray(e)?e.length:1:0}function __(e,t){return e.replace(new RegExp(L.source,`g`),String(t))}function v_(e,t){let n={};if(t&&typeof t==`object`&&!Array.isArray(t))for(let e of Object.keys(t))n[e]=null;let r=Ye(e??{},t);for(let e of Object.keys(r))r[e]!==void 0&&(n[e]=r[e]);return n}function y_(e,t,n,r){return jt(e,t,!1,t,n,{context:`visibleWhen of ${r} — fail-closed, the group is hidden`})}function b_(e,t,n){if(!n)return{fields:e,sections:t};let r=new Map;for(let[e,t]of Object.entries(n)){let i=t?.referenceVia;typeof i==`string`&&i!==``&&i!==e&&n[i]!=null&&r.set(e,i)}if(r.size===0)return{fields:e,sections:t};let i=e=>{let t=e&&typeof e==`object`?e.fields:void 0;return Array.isArray(t)?t:void 0},a=[];if(Array.isArray(e)&&a.push(e),Array.isArray(t))for(let e of t){let t=i(e);t&&a.push(t)}let o=new Set;for(let e of a)for(let t of e){let e=d_(t);e&&o.add(e)}let s=new Set;for(let[e,t]of r)o.has(e)&&s.add(t);if(s.size===0)return{fields:e,sections:t};let c=e=>e.filter(e=>{let t=d_(e);return!(t&&s.has(t))});return{fields:Array.isArray(e)?c(e):e,sections:Array.isArray(t)?t.map(e=>{let t=i(e);return t?{...e,fields:c(t)}:e}):t}}var x_=$g(({schema:e={},className:t,...n})=>{let r=K(),{designer:i}=p_(n),a=Yg(e.aria),o=r?.objectName||``,c=Js(),{readableFields:l}=Ys(o),{sectionLabel:u}=v(),{language:d}=tr(),f=ee(),p=S(),m=be()!==null;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 h=Array.isArray(e.requiredPermissions)?e.requiredPermissions:[];if(h.length>0&&!c.hasCapabilities(h))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 g=e.enforceFieldSecurity===!0,_=Array.isArray(e.redactFields)?e.redactFields:[],y=e=>{if(!e||!g&&_.length===0)return e;let t=e.map(d_).filter(e=>!!e),n=new Set((g&&o?l(t):t).filter(e=>!_.includes(e)));return e.filter(e=>{let t=d_(e);return t?n.has(t):!1})},b=r.objectSchema,x=b?.fields,C=e=>{if(!e||typeof e!=`object`||typeof e.name!=`string`||e.label!==void 0)return e;let t=x?.[e.name]?.label;if(t==null)return e;let n=rr(t,d);return n?{...e,label:n}:e},w=e=>typeof e==`string`?C({name:e}):e&&typeof e==`object`&&!e.name&&e.field?C({...e,name:e.field}):C(e),T=e=>Array.isArray(e)?e.map(w):e,E=new Set((Array.isArray(e.hideFields)?e.hideFields:[]).map(e=>typeof e==`string`?e:d_(e)).filter(e=>!!e));for(let e of p)E.add(e);let D=Fa(r.data??{},c,o),O=[hn(b),s(b),`name`,`full_name`,`title`,`subject`,`display_name`,`label`].filter(e=>typeof e==`string`&&e.length>0),k=Y(b);if(!m){if(tn(D,k)!==void 0)E.add(k);else{let e=b?.titleFormat,t=bt(e,D);if(t){let n=e=>tn(D,e)===t,r=O.find(n)??Object.keys(D).find(r=>n(r)&&bt(e,{...D,[r]:void 0})!==t);r&&E.add(r)}else for(let e of O)if(tn(D,e)!==void 0){E.add(e);break}}}let A=e=>!e||E.size===0?e:e.filter(e=>{let t=d_(e);return!t||!E.has(t)}),j=A(T(y(e.sections===void 0&&e.fields===void 0?Array.isArray(b?.highlightFields)?b.highlightFields:void 0:e.fields))),M=Array.isArray(e.sections)?e.sections:[],N=new Map;if(M.some(e=>e&&typeof e==`object`&&typeof e.group==`string`))for(let e of Kg(b)??[])typeof e.key==`string`&&N.set(e.key,e);let P,F=b_(j,Array.isArray(e.sections)?e.sections.map(e=>{if(!e||typeof e!=`object`||typeof e.group!=`string`)return e;let t=N.get(e.group);if(!t)return h_(o,e.group),null;if(t.visibleWhen!=null&&(P??=v_(r.data,x),!y_(t.visibleWhen,P,f,`group '${e.group}' of record:details on object '${o}'`)))return null;let{group:n,...i}=e;return{...t.section,...i}}).filter(e=>e!=null).map(e=>{let t=e.label,n=t==null?void 0:rr(t,d),r=e.name&&o?u(o,e.name,n??e.name):n,i=e.count?.field,a=typeof i==`string`&&typeof r==`string`?__(r,g_(D?.[i])):r;return{...e,title:a,showBorder:e.showBorder??!!r,hideEmpty:e.hideEmpty??!0,fields:A(T(y(e.fields)))}}):e.sections,x),I=Ti(`recordEdit`,{objectSchema:b,objectName:o,perms:c}).allowed,L=(e.inlineEdit??!0)&&I,te={type:`detail-view`,objectName:r.objectName,resourceId:r.recordId,data:r.data,layout:`vertical`,columns:f_(e.columns),sections:F.sections,fields:F.fields,showBack:!1,showHeader:e.showHeader??!1,inlineEdit:L},ne=!Mn(e.dataSource);return(0,Q.jsx)(`div`,{className:t,...i,...a,children:(0,Q.jsx)(fg.Provider,{value:ne,children:(0,Q.jsx)(Og,{schema:te,dataSource:r.dataSource,inlineEdit:L,recordFromHost:!0})})})},`record:details`),S_=e=>({toolbar:[],row:[],refused:e});function C_(e){if(!Array.isArray(e))return!1;let t=ut(e,void 0);return t.kind===`ids`&&t.ids.length>0}function w_(e,t){if(!Array.isArray(e))return S_([{kind:`array`,message:"`actions` is not an array; it is a list of action ids"}]);let n=ut(e,t);if(n.kind===`refused`)return S_([{kind:`array`,message:`${n.message} (on this block: action ids only)`}]);if(n.kind===`objects`)return e.length===0?S_([]):S_([{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=Bn(t,`list_toolbar`),s=Bn(t,`list_item`)||Bn(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 T_(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 E_=e=>_t(e)||(e&&typeof e==`object`?e.key:null)||null;function D_(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:rr(a,t)})}return n??e}var O_=e=>e?.id??e?._id??null,k_=5,A_=`manage_metadata`,j_=()=>!1,M_=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}},N_=({schema:e={},className:t,...n})=>{let r=K(),{designer:i}=M_(n),a=Yg(e.aria),o=v(),{language:s}=tr(),c=e.objectName,l=c&&`objectPluralLabel`in o?o.objectPluralLabel({name:c,label:Ga(c)}):c?Ga(c):``,u=rr(e.title,s)||l||`Related`,d=Js(),{readableFields:f}=Ys(c||``),p=e.relationshipValueField||`id`,m=p===`id`?r?.recordId??null:r?.data?.[p]??null,h=cn(),g=$.useMemo(()=>c?h?.resolve({objectName:c,relationshipField:e.relationshipField,parentId:m})??null:null,[h,c,e.relationshipField,m]),_=e.actions,y=_!==void 0,b=!!c&&C_(_),x=!!c&&!!e.add&&!!r?.dataSource&&!g?.onDelete,{item:S,loading:C}=at(`object`,b||x?c:null),w=x&&!C&&Ti(`relatedRowDelete`,{objectSchema:S,objectName:c,perms:d}).allowed,T=qe(),E=$.useMemo(()=>{if(!y)return null;if(b&&C)return{toolbar:[],row:[],refused:[]};let e=Array.isArray(S?.actions)?S.actions:[],t=w_(_,e),n=e=>T(c||void 0,e);return{toolbar:t.toolbar.map(n),row:t.row.map(n),refused:t.refused}},[y,_,b,S,C,c,T]);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 D=Array.isArray(e.requiredPermissions)?e.requiredPermissions:[];if(D.length>0&&!d.hasCapabilities(D))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 O=e.enforceFieldSecurity===!0,k=Array.isArray(e.redactFields)?e.redactFields:[],ee=Array.isArray(e.columns)?e.columns:[],A=ee;if(O||k.length>0){let e=ee.map(E_).filter(e=>!!e),t=new Set((O?f(e):e).filter(e=>!k.includes(e)));A=ee.filter(e=>{let n=E_(e);return n?t.has(n):!1})}let j=E?g?.onToolbarAction&&E.toolbar.length>0?E.toolbar:void 0:g?.toolbarActions,M=E?g?.onRowAction&&E.row.length>0?E.row:void 0:g?.rowActions,N=E?.refused??[],P=E?[...g?.onToolbarAction?[]:E.toolbar,...g?.onRowAction?[]:E.row].map(e=>String(e.name)).filter((e,t,n)=>n.indexOf(e)===t):[],F=j_()||d.hasCapabilities([A_]),I=N.length>0&&F,L=P.length>0&&F,te=e.showViewAll===!1?void 0:g?.onViewAll;return(0,Q.jsxs)(`div`,{className:t,...i,...a,children:[I&&(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:T_(N,c,!!S)}),L&&(0,Q.jsx)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":`record-related-list-actions-unserved`,className:`mb-2 text-xs text-muted-foreground italic px-3 py-2 border border-dashed rounded`,children:`record:related_list — actions not drawn: ${P.map(e=>`"${e}"`).join(`, `)}. `+(m==null||m===``?"This list has no parent record in scope, so nothing can run its actions: bind the parent with `parentDataSource`, or place the list on a record page.":`No host on this page offers an executor for them.`)}),(0,Q.jsx)(Hg,{title:u,type:`table`,api:c,objectName:c,referenceField:e.relationshipField,parentId:m,columns:D_(A,s),redactFields:k.length>0?k:void 0,pageSize:typeof e.limit==`number`&&e.limit>0?e.limit:k_,defaultSort:e.sort,filter:e.filter,dataSource:r?.dataSource,add:e.add?{...e.add,label:rr(e.add.label,s)||void 0}:void 0,rowActions:M,onRowAction:g?.onRowAction,toolbarActions:j,onToolbarAction:g?.onToolbarAction,onNew:g?.onCreate,newDisabled:g?.createDisabled,onViewAll:te,onRowClick:g?.onView?e=>{let t=O_(e);t!=null&&g.onView(t,e)}:void 0,onRowEdit:g?.onEdit?e=>{let t=O_(e);t!=null&&g.onEdit(t,e)}:void 0,onRowDelete:g?.onDelete?e=>{let t=O_(e);if(t!=null)return g.onDelete(t,e)}:w?async e=>{let t=e?.id??e?._id;t!=null&&await r?.dataSource?.delete?.(c,String(t))}:void 0})]})},P_={columns:!0,filter:!0,sort:!0,limit:`limit`},F_={},I_=e=>{let t=K(),{t:n}=tr();return(0,Q.jsx)(lt,{schema:e.schema??F_,mapping:P_,dataSource:t?.dataSource,testId:`record-related-list`,errorTitle:n(`element.relatedList.sourceUnresolved`,{defaultValue:`This related list’s data source could not be resolved`}),children:t=>(0,Q.jsx)(N_,{...e,schema:t})})},L_=({object:e,className:t,designer:n})=>(0,Q.jsx)(`div`,{className:t,...n,children:(0,Q.jsx)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":`record-related-list-parent-absent`,className:`text-sm text-muted-foreground px-3 py-2 border border-dashed rounded`,children:`No “${typeof e==`string`?e:`parent`}” record matches this related list’s parent binding, so there is no parent record to list related records for.`})}),R_=y(e=>{let{schema:t,className:n,...r}=e,i=t?.parentDataSource,{t:a}=tr();return(0,Q.jsx)(i_,{binding:i,blockKey:`record:related_list`,testId:`record-related-list-parent`,errorTitle:a(`element.relatedList.parentUnreadable`,{defaultValue:`This related list’s parent record could not be read`}),absent:(0,Q.jsx)(L_,{object:i?.object,className:n,designer:M_(r).designer}),children:(0,Q.jsx)(I_,{...e})})}),z_=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}},B_=$g(({schema:e={},className:t,...n})=>{let r=K(),{designer:i}=z_(n),a=Yg(e.aria),o=r?.objectName||``,s=Js(),{readableFields:c}=Ys(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 Ht(g,u?h.map(e=>e.name):[]),u?(0,Q.jsx)(`div`,{className:t,...i,...a,children:(0,Q.jsx)(Vh,{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.`})})},`record:highlights`),V_=({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)(ur,{className:`h-3 w-3 text-muted-foreground shrink-0`}),(0,Q.jsx)(`span`,{className:`text-foreground`,children:i})]})},H_=[`👍`,`❤️`,`🎉`,`😂`,`😮`,`😢`],U_=({reactions:e,onToggleReaction:t,emojiOptions:n=H_,className:r})=>{let[i,a]=$.useState(!1),{t:o}=ph(),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)(Ro,{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 W_(e){return e.type===`comment`&&e.authoredByViewer===!0}var G_=({item:e,onEditComment:t,onDeleteComment:n,bodyClassName:r})=>{let{t:i}=ph(),a=W_(e),o=a?t:void 0,s=a?n:void 0,[c,l]=$.useState(null),[u,d]=$.useState(!1),[f,p]=$.useState(!1),m=c!==null&&!!o,h=c?.trim()??``,g=h!==``&&h!==(e.body??``).trim(),_=async()=>{if(o&&g){d(!0);try{await o(e.id,h),l(null)}catch{}finally{d(!1)}}},v=async()=>{if(s){p(!0);try{await s(e.id)}catch{}finally{p(!1)}}};return m?(0,Q.jsxs)(`div`,{className:`mt-1 space-y-1.5`,"data-testid":`comment-editor`,children:[(0,Q.jsx)(ct,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),l(null)):e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),_())},"aria-label":i(`detail.editComment`),disabled:u,autoFocus:!0,className:`min-h-[60px] text-sm`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(j,{size:`sm`,onClick:()=>void _(),disabled:u||!g,children:i(`detail.save`)}),(0,Q.jsx)(j,{size:`sm`,variant:`ghost`,onClick:()=>l(null),disabled:u,children:i(`detail.cancel`)})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[e.body&&(0,Q.jsx)(`p`,{className:r,children:e.body}),(o||s)&&(0,Q.jsxs)(`div`,{className:`mt-1 flex items-center gap-0.5`,children:[o&&(0,Q.jsx)(j,{variant:`ghost`,size:`icon`,className:`h-6 w-6 text-muted-foreground`,onClick:()=>l(e.body??``),"aria-label":i(`detail.editComment`),children:(0,Q.jsx)(Ir,{className:`h-3 w-3`})}),s&&(0,Q.jsx)(j,{variant:`ghost`,size:`icon`,className:`h-6 w-6 text-muted-foreground`,onClick:()=>void v(),disabled:f,"aria-label":i(`detail.deleteComment`),children:(0,Q.jsx)(Gr,{className:`h-3 w-3`})})]})]})};function K_(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 q_=({parentItem:e,replies:t,onAddReply:n,showReplyInput:r=!0,onEditComment:i,onDeleteComment:a,className:o})=>{let{t:s}=ph(),c=ir(),[l,u]=$.useState(!1),[d,f]=$.useState(``),[p,m]=$.useState(!1),h=$.useCallback(async()=>{let t=d.trim();if(t&&n){m(!0);try{await n(e.id,t),f(``)}catch{}finally{m(!1)}}},[d,n,e.id]),g=$.useCallback(e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),h())},[h]);return t.length===0&&!r?null:(0,Q.jsxs)(`div`,{className:U(`ml-10 mt-1`,o),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:()=>u(!l),"aria-expanded":l,children:[l?(0,Q.jsx)(_r,{className:`h-3 w-3`}):(0,Q.jsx)(yr,{className:`h-3 w-3`}),(0,Q.jsx)(as,{className:`h-3 w-3`}),(0,Q.jsx)(`span`,{children:s(`detail.replyCount`,{count:t.length})})]}),l&&(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:K_(e.createdAt,s,c)}),e.edited&&(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground italic`,children:s(`detail.edited`)})]}),(0,Q.jsx)(G_,{item:e,onEditComment:i,onDeleteComment:a,bodyClassName:`text-xs whitespace-pre-wrap break-words`})]})]},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:s(`detail.replyPlaceholder`),value:d,onChange:e=>f(e.target.value),onKeyDown:g,disabled:p}),(0,Q.jsx)(j,{variant:`ghost`,size:`icon`,className:`h-6 w-6 shrink-0`,onClick:h,disabled:!d.trim()||p,"aria-label":`Send reply`,children:(0,Q.jsx)(Es,{className:`h-3 w-3`})})]})]})},J_=({subscription:e,onToggle:t,className:n})=>{let{t:r}=ph(),[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)(mo,{className:`h-4 w-4 text-primary`}):(0,Q.jsx)(uo,{className:`h-4 w-4 text-muted-foreground`})})};function Y_(e){let t=e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).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 X_=({value:e,onChange:t,onSubmit:n,mentionSuggestions:r=[],placeholder:i,className:a,disabled:o=!1,extraSlot:s,canSubmitEmpty:c=!1})=>{let{t:l}=ph(),[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(`
19
+ - `,``),[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)(_o,{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)(qo,{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)(Xo,{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)(ko,{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)(io,{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)(Hr,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(Dr,{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)(Es,{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:Y_(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 Z_(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function Q_(e){return e.startsWith(`image/`)}function $_(e){return Q_(e)?Ar:e.includes(`pdf`)||e.includes(`document`)||e.includes(`text`)?Wo:e.includes(`zip`)||e.includes(`archive`)||e.includes(`compressed`)?Vo:Or}var ev=({attachments:e,onUpload:t,onRemove:n,className:r,readOnly:i=!1})=>{let{t:a}=ph(),[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)(qr,{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)(_s,{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=Q_(e.type),r=$_(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:Z_(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)(Jr,{className:`h-3.5 w-3.5`})})]},e.id)})})]})]})},tv={comment:as,field_change:Hr,task:Ms,event:mr,system:Vs,email:$o,call:bs,note:Fs,file:Wo,sharing:ks,record_create:bo,record_delete:Gr,approval:so},nv={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 rv(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 iv(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 av(e){return e.type===`comment`}function ov(e){return e.type===`comment`}var sv=[];function cv(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 lv=({items:e,config:t,filterMode:n,onFilterChange:r,hasMore:i=!1,onLoadMore:a,loading:o=!1,onAddComment:s,onAddReply:c,onToggleReaction:l,onEditComment:u,onDeleteComment:d,subscription:f,onToggleSubscription:p,collapseWhenEmpty:m=!1,mentionSuggestions:h,onUploadAttachments:g,titleLabel:_,emptyLabel:v,activityDenied:y=!1,commentsDenied:b=!1,className:x})=>{let{t:S}=ph(),C=ir(),[w,T]=$.useState(`all`),[E,D]=$.useState(``),[O,k]=$.useState(!1),[ee,A]=$.useState(!1),[N,P]=$.useState([]),[F,I]=$.useState(!1),L=_??S(`detail.activity`),te=y||b?(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:[y&&(0,Q.jsxs)(`p`,{"data-denied-source":`activity`,className:`flex items-center gap-2`,children:[(0,Q.jsx)(Nr,{className:`h-4 w-4 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:S(`detail.activityAccessDenied`)})]}),b&&(0,Q.jsxs)(`p`,{"data-denied-source":`comments`,className:`flex items-center gap-2`,children:[(0,Q.jsx)(Nr,{className:`h-4 w-4 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:S(`detail.commentsAccessDenied`)})]})]}):null,ne=n??w,R=t?.showFilterToggle!==!1,z=t?.showCommentInput!==!1&&!!s,B=t?.enableReactions??!1,re=t?.enableThreading??!1,ae=t?.showSubscriptionToggle??!1,H=$.useMemo(()=>cv(e,ne),[e,ne]),oe=$.useMemo(()=>{if(!re)return H;let t=new Set(e.map(e=>e.id));return H.filter(e=>!e.parentId||!t.has(e.parentId))},[H,e,re]),se=$.useMemo(()=>{if(!re)return new Map;let e=new Map;for(let t of H)if(t.parentId){let n=e.get(t.parentId)??[];n.push(t),e.set(t.parentId,n)}return e},[H,re]),ce=$.useCallback(e=>{r?r(e):T(e)},[r]),le=$.useCallback(async()=>{let e=E.trim();if(s&&(e||N.length!==0)){k(!0);try{await s(e,N.length>0?N:void 0),D(``),P([])}catch{}finally{k(!1)}}},[E,N,s]),W=$.useCallback(async e=>{if(g&&e.length!==0){I(!0);try{let t=await g(e);Array.isArray(t)&&t.length>0&&P(e=>[...e,...t])}finally{I(!1)}}},[g]),ue=$.useCallback(e=>{P(t=>t.filter(t=>t.id!==e))},[]),de=$.useCallback(async()=>{if(a){A(!0);try{await a()}finally{A(!1)}}},[a]);return(0,Q.jsxs)(`section`,{className:U(`border-t border-border/60 pt-5`,x),"aria-label":L,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)(Ya,{className:`h-4 w-4`}),L,(0,Q.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`(`,H.length,`)`]})]}),(0,Q.jsx)(`div`,{className:`flex items-center gap-1`,children:ae&&f&&(0,Q.jsx)(J_,{subscription:f,onToggle:p})})]})}),(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[R&&(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Q.jsxs)(M,{value:ne,onValueChange:e=>ce(e),children:[(0,Q.jsx)(V,{"aria-label":S(`detail.filterActivity`),className:`h-8 w-auto min-w-[140px] py-1 text-sm`,children:(0,Q.jsx)(Je,{})}),(0,Q.jsx)(ie,{children:rv(S).map(e=>(0,Q.jsx)(un,{value:e.value,children:e.label},e.value))})]})}),z&&(0,Q.jsx)(X_,{value:E,onChange:D,onSubmit:le,mentionSuggestions:h,placeholder:S(`detail.leaveCommentPlaceholder`),disabled:O,canSubmitEmpty:N.length>0,extraSlot:g?(0,Q.jsx)(ev,{attachments:N,onUpload:W,onRemove:ue,readOnly:O||F}):N.length>0?(0,Q.jsx)(ev,{attachments:N,onRemove:ue,readOnly:O}):void 0}),H.length>0&&te,o&&H.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)(Mr,{className:`h-4 w-4 animate-spin`}),(0,Q.jsx)(`span`,{children:S(`detail.loading`)})]}):(y||b)&&H.length===0?te:H.length===0?m?null:(0,Q.jsx)(Nt,{title:v??S(`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:oe.map(e=>{let t=tv[e.type]||Vs,n=nv[e.type]||`bg-gray-100 text-gray-600`,r=(e.replyCount??0)>0?se.get(e.id)??sv:sv,i=!!c&&ov(e),a=B&&l&&av(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:S(`detail.via`,{source:e.source})}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:iv(e.createdAt,S,C)}),e.edited&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:S(`detail.edited`)}),e.pinned&&(0,Q.jsxs)(`span`,{className:`text-xs text-amber-600`,children:[`📌 `,S(`detail.pinned`)]})]}),(0,Q.jsx)(G_,{item:e,onEditComment:u,onDeleteComment:d,bodyClassName:`text-sm whitespace-pre-wrap break-words text-muted-foreground`}),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:[S(`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)(V_,{change:e},t))}),B&&e.reactions&&e.reactions.length>0&&(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(U_,{reactions:e.reactions,onToggleReaction:a})}),(!e.reactions||e.reactions.length===0)&&a&&(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(U_,{reactions:[],onToggleReaction:a})})]})]}),re&&(r.length>0||i)&&(0,Q.jsx)(q_,{parentItem:e,replies:r,onAddReply:c,showReplyInput:i,onEditComment:u,onDeleteComment:d})]},e.id)})})]}),i&&(0,Q.jsx)(`div`,{className:`text-center pt-2`,children:(0,Q.jsxs)(j,{variant:`ghost`,size:`sm`,onClick:de,disabled:ee,"aria-label":S(`detail.loadMore`),children:[ee?(0,Q.jsx)(Mr,{className:`h-4 w-4 animate-spin mr-1`}):(0,Q.jsx)(_r,{className:`h-4 w-4 mr-1`}),S(`detail.loadMore`)]})})]})]})},uv=Ut.options,dv=d.options,fv={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},pv=`system`,mv=`milestone`,hv=`system`,gv=[`comment`],_v=[`record_create`,`record_delete`,`sharing`],vv=new Set([...Object.values(fv).filter(e=>!!e),pv,hv,...gv]),yv=new Set([`task`]);function bv(e){return!!e.sourceObject&&e.sourceId!=null}function xv(e){let t=e?.metadata;if(typeof t!=`string`)return!1;let n;try{n=JSON.parse(t)}catch{return!1}return typeof n==`object`&&!!n&&!Array.isArray(n)&&n.kind===mv}function Sv(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 Cv=new Set,wv=new Set,Tv=new Set;function Ev(e,t){if(typeof e==`string`&&uv.includes(e))return e;if(e!=null){let n=typeof e==`string`?`"${e}"`:typeof e;Sv(Tv,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: ${uv.join(`, `)}.`)}return`all`}function Dv(e,t){let n=e.filter(e=>!vv.has(e));n.length!==0&&Sv(wv,t,n,e=>{let n=e=>e.map(e=>`"${e}"`).join(`, `),r=e.filter(e=>_v.includes(e)),i=e.filter(e=>!_v.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: ${[...vv].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 Ov(e,t){if(e==null)return;if(!Array.isArray(e)){let n=typeof e==`string`?`"${e}"`:typeof e;return Sv(Cv,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: ${dv.join(`, `)}.`),[]}let n=[],r=[];for(let t of e)typeof t==`string`&&dv.includes(t)?n.push(t):r.push(typeof t==`string`?t:String(t));return r.length>0&&Sv(Cv,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: ${dv.join(`, `)}.`),Dv(n,t),n}function kv(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function Av(e){return kv(e)?e:20}function jv(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 Mv(e,t){return t==null||kv(t)?null:`[ObjectUI] ${e} row cap: declared limit: ${jv(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 Nv(e){let t=e.timestamp;return String(!t||t===`NOW()`||Number.isNaN(Date.parse(String(t)))?e.created_at??``:t)}var Pv=new Set;function Fv(e){Sv(Pv,``,[e],()=>`[record:activity] rendered a sys_activity row with type "${e}" through the generic "${pv}" 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 Iv(e){let t=e?.actor_name;if(typeof t==`string`&&t.trim())return t.trim();let n=e?.actor_id;if(n&&typeof n==`object`){let e=n.name;if(typeof e==`string`&&e.trim())return e.trim()}return null}function Lv(e,t){let n=String(e?.type),r=Object.prototype.hasOwnProperty.call(fv,n);r||Fv(n);let i=r?fv[n]:pv;if(!i)return null;let a=yv.has(i)&&xv(e)?hv:i;return{id:e.id,type:a,actor:Iv(e)??t,actorAvatarUrl:e.actor_avatar_url??void 0,body:e.summary??``,createdAt:Nv(e),sourceObject:e.source_object??void 0,sourceId:e.source_id??void 0}}function Rv(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=>!yv.has(e.type)||bv(e)));let a=Ov(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 zv(...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 Bv(e){let t=Wn(e);return t===`forbidden`||t===`unauthorized`}var Vv=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}},Hv=`record:activity`,Uv=({schema:e={},className:t,...n})=>{let{designer:r}=Vv(n),i=Yg(e.aria),a=K(),o=yt(),s=Kn(),c=e.properties??{},l=t=>e[t]??c[t],u=l(`limit`),d=Av(u),f=Mv(Hv,u);$.useEffect(()=>{f&&console.warn(f)},[f]);let p=Ev(l(`filterMode`),Hv),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,ee]=$.useState(!1),[A,j]=$.useState(!1),[M,N]=$.useState(!1),P=s(`detail.systemActor`,`System`);$.useEffect(()=>{if(!C)return;let e=!1;return j(!0),Promise.resolve(S.find(`sys_activity`,{$filter:{object_name:b,record_id:x},$orderby:{timestamp:`desc`},$top:Math.max(1,E)+1,$expand:[`actor_id`]})).then(t=>{if(e)return;let n=t?.data??[],r=Array.isArray(n)?n:[],i=[];for(let e of r){let t=Lv(e,P);t&&i.push(t)}ee(r.length>Math.max(1,E)),O(zv(i)),N(!1)}).catch(t=>{e||(O([]),ee(!1),N(Bv(t)))}).finally(()=>{e||j(!1)}),()=>{e=!0}},[C,S,b,x,E,P]);let F=o?.items,I=$.useMemo(()=>Rv(v??F??D??[],{types:m,showCompleted:h,unifiedTimeline:g},E,Hv),[v,F,D,m,h,g,E]),L=I.items,te=I.hasMore||C&&k,ne=y??o?.loading??(C&&D===null?!0:A),R=v===void 0?o?!!o.activityDenied:C&&M:!1,z=v===void 0&&!!o?.commentsDenied,[B,V]=$.useState(p);$.useEffect(()=>{V(p)},[p]);let re=$.useCallback(()=>{T(e=>e+1)},[]),ie=_.enableMentions!==!1;return(0,Q.jsx)(`div`,{className:t,...r,...i,children:(0,Q.jsx)(lv,{items:L,config:_,loading:ne,filterMode:B,onFilterChange:V,hasMore:te,onLoadMore:re,onAddComment:o?.onAddComment,onAddReply:o?.onAddReply,onToggleReaction:o?.onToggleReaction,onEditComment:o?.onEditComment,onDeleteComment:o?.onDeleteComment,mentionSuggestions:ie?o?.mentionSuggestions:void 0,onUploadAttachments:o?.onUploadAttachments,activityDenied:R,commentsDenied:z})})},Wv=({config:e,items:t,hasMore:n,onLoadMore:r,loading:i,onAddComment:a,onAddReply:o,onToggleReaction:s,onEditComment:c,onDeleteComment:l,subscription:u,onToggleSubscription:d,filterMode:f,onFilterChange:p,collapseWhenEmpty:m=!1,mentionSuggestions:h,onUploadAttachments:g,activityDenied:_,commentsDenied:v,className:y})=>{let b=e?.position??`right`,x=e?.width??`360px`,S=e?.collapsible??!0,C=m&&t.length===0||(e?.defaultCollapsed??!1),{t:w}=ph(),[T,E]=$.useState(C),D=Yg(e?.feed?.aria);return b===`right`||b===`left`?T&&S?(0,Q.jsx)(`div`,{className:U(`flex items-start pt-4`,b===`right`?`border-l`:`border-r`,y),children:(0,Q.jsx)(j,{variant:`ghost`,size:`icon`,className:`h-8 w-8 mx-1`,onClick:()=>E(!1),"aria-label":w(`detail.openDiscussion`),children:(0,Q.jsx)(ms,{className:`h-4 w-4`})})}):(0,Q.jsxs)(`div`,{className:U(`flex flex-col overflow-hidden`,b===`right`?`border-l`:`border-r`,y),style:{width:x,minWidth:x},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)(as,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`text-sm font-medium`,children:w(`detail.discussion`)})]}),S&&(0,Q.jsx)(j,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>E(!0),"aria-label":w(`detail.closeDiscussion`),children:(0,Q.jsx)(Jr,{className:`h-3.5 w-3.5`})})]}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,Q.jsx)(`div`,{...D,children:(0,Q.jsx)(lv,{items:t,config:e?.feed,hasMore:n,onLoadMore:r,loading:i,onAddComment:a,onAddReply:o,onToggleReaction:s,onEditComment:c,onDeleteComment:l,subscription:u,onToggleSubscription:d,filterMode:f,onFilterChange:p,collapseWhenEmpty:m,mentionSuggestions:h,onUploadAttachments:g,titleLabel:w(`detail.discussion`),emptyLabel:w(`detail.noCommentsYet`),activityDenied:_,commentsDenied:v,className:`border-0 shadow-none`})})})]}):(0,Q.jsx)(`div`,{className:U(``,y),children:S&&T?(0,Q.jsxs)(j,{variant:`ghost`,className:`w-full justify-start gap-2 text-muted-foreground`,onClick:()=>E(!1),"aria-label":w(`detail.showDiscussion`,{count:t.length}),children:[(0,Q.jsx)(as,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{children:w(`detail.showDiscussion`,{count:t.length})})]}):(0,Q.jsxs)(`div`,{children:[S&&(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)(as,{className:`h-4 w-4`}),w(`detail.discussion`)]}),(0,Q.jsx)(j,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>E(!0),"aria-label":w(`detail.hideDiscussion`),children:(0,Q.jsx)(ds,{className:`h-3.5 w-3.5`})})]}),(0,Q.jsx)(`div`,{...D,children:(0,Q.jsx)(lv,{items:t,config:e?.feed,hasMore:n,onLoadMore:r,loading:i,onAddComment:a,onAddReply:o,onToggleReaction:s,onEditComment:c,onDeleteComment:l,subscription:u,onToggleSubscription:d,filterMode:f,onFilterChange:p,collapseWhenEmpty:m,mentionSuggestions:h,onUploadAttachments:g,titleLabel:w(`detail.discussion`),emptyLabel:w(`detail.noCommentsYet`),activityDenied:_,commentsDenied:v})})]})})},Gv=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}},Kv=({schema:e={},className:t,...n})=>{K();let r=yt(),{designer:i}=Gv(n),a=Yg(e.aria),o={position:`bottom`,collapsible:!1,feed:{enableReactions:!0,enableThreading:!0,showCommentInput:!0},...e},s=o.feed,[c,l]=$.useState(0),u=Av(s?.limit),d=typeof e.type==`string`&&e.type?e.type:`record:chatter`,f=Mv(`${d} feed`,s?.limit);$.useEffect(()=>{f&&console.warn(f)},[f]);let p=u*(c+1),m=Ev(s?.filterMode,d),[h,g]=$.useState(m);$.useEffect(()=>{g(m)},[m]);let _=r?.items,v=$.useMemo(()=>Rv(_??[],{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)(Wv,{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,onEditComment:r?.onEditComment,onDeleteComment:r?.onDeleteComment,mentionSuggestions:b?r?.mentionSuggestions:void 0,onUploadAttachments:r?.onUploadAttachments,activityDenied:r?.activityDenied,commentsDenied:r?.commentsDenied})})},qv=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 Jv(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:rr(a,t)})}return n??e}var Yv=({schema:e={},className:t,...n})=>{let r=K(),{translateOptions:i}=v(),{t:a}=ph(),{designer:o}=qv(n),s=Yg(e.aria,{defaultRole:`list`,defaultLabel:a(`detail.pathLabel`),block:`record:path`}),{language:c}=tr(),l=e.statusField,u=e.stages,d=u===void 0,f=r?.objectSchema,p=$.useMemo(()=>Jv(d?Wg(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=$.useMemo(()=>Gg(f,l??null),[f,l]),_=/(^|[_-\s])(closed_)?(lost|failed?|cancell?ed|失败|流失|丢单|败)([_-\s]|$)/i,y=/(^|[_-\s])(closed_)?(won|success|成交|赢|完成)([_-\s]|$)/i,b=m.map(e=>{if(e.terminal)return e.terminal;let t=g?.get(e.value);if(t!==void 0)return Ug(t);let n=`${String(e.value??``)} ${String(e.label??``)}`;if(_.test(n))return`lost`;if(y.test(n))return`won`}),x=b.findIndex(e=>e===`lost`),S=x===-1?m:m.slice(0,x),C=x===-1?[]:m.slice(x),w=S.length-1,T=b.map((e,t)=>e===`won`?t===w?`won`:void 0:e),E=m.findIndex(e=>e.value===h);E<0&&(E=-1);let D=x!==-1&&E>=x;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 O=(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`)),k=(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`),ee=(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}),A=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":ee(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:O(e.state,e.terminal)}),(0,Q.jsxs)(`span`,{className:U(k(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:S.map((e,t)=>{let n=!D&&E>=0&&t<E,r=!D&&t===E;return A({key:`${e.value}-${t}`,stage:e,state:r?`current`:n?`completed`:`upcoming`,terminal:T[t],className:`flex-1 min-w-0`,labelClassName:`text-center truncate`})})}),C.length>0&&(0,Q.jsx)(`div`,{className:`flex items-start gap-1.5 pl-2 border-l border-border/40`,children:C.map((e,t)=>{let n=x+t;return A({key:`${e.value}-lost-${t}`,stage:e,state:n===E?`current`:`upcoming`,terminal:T[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=T[t],r=n!==`lost`&&!D&&E>=0&&t<E,i=t===E;return A({key:`${e.value}-${t}-m`,stage:e,state:i?`current`:r?`completed`:`upcoming`,terminal:n,className:`shrink-0`,labelClassName:`whitespace-nowrap`})})})]})},Xv=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}},Zv={primary:`default`,secondary:`secondary`,danger:`destructive`,ghost:`ghost`,link:`link`},Qv=Object.freeze([]),$v=new Set;function ey(e,t,n){let r=`${e}::${t}::${n.index}::${n.message}`;$v.has(r)||($v.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 ty=({schema:e={},className:t,...n})=>{let r=K(),{designer:i}=Xv(n),a=Yg(e.aria,{defaultRole:`toolbar`,defaultLabel:`Quick actions`,block:`record:quick_actions`}),o=Js(),s=wn(),c=qe(),l=Array.isArray(e.actions)?e.actions:Array.isArray(e.properties?.actions)?e.properties.actions:Qv,u=Array.isArray(e.actionNames)?e.actionNames:Array.isArray(e.properties?.actionNames)?e.properties.actionNames:Qv,d=r?.objectName||``,f=r!=null&&r.recordId==null,p=u.length>0?`actionNames`:`actions`,m=u.length>0?u:l,h=ut(m,void 0),g=h.kind===`ids`&&h.ids.length>0&&!!d,{item:_}=at(`object`,g?d:null),v=ut(m,Array.isArray(_?.actions)?_.actions:[]);v.kind===`refused`&&ey(d,p,v);let y=(v.kind===`refused`?[]:v.actions).map((e,t)=>c(d||void 0,e,{fallbackLabel:`Action ${t+1}`})),b=Array.isArray(e.requiredPermissions)?e.requiredPermissions:[],x=e.location||`record_header`,{getActionsForLocation:S,executeAction:C}=$e({actions:y,context:{record:r?.data,recordId:r?.recordId,objectName:r?.objectName}});if(b.length>0&&!o.hasCapabilities(b))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 w=y.length>0&&!f?S(x):[];if(w.length===0)return!s||v.kind!==`refused`&&y.length>0?null:(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:v.kind===`refused`?`record:quick_actions — ${p} refused at index ${v.index} (see console)`:`record:quick_actions — no actions configured`})});let T=e.align||`end`,E=T===`start`?`justify-start`:T===`center`?`justify-center`:`justify-end`,D=x===`record_header`&&!e.inline;return(0,Q.jsx)(`div`,{className:U(`flex flex-wrap items-center gap-2`,D&&`-mt-12 sm:-mt-14 mb-2 relative z-10`,E,t),...a,...i,children:w.map((t,n)=>(0,Q.jsx)(ny,{action:t,record:r?.data,variant:t.variant?Zv[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 C(t.name)}},t.name||`qa-${n}`))})};function ny({action:e,record:t,variant:n,size:r,label:i,onRun:a}){let[o,s]=$.useState(!1),c=$.useMemo(()=>({record:t||{}}),[t]),l=G(nt(e.disabled),c),u=Kn(),d=$.useId(),f=Zt(e.disabled)?l:!1,p=f||o,m=f?u(`actions.notAvailableForRecord`,`Not available for this record`):void 0,h=Rn(e.icon),g=(0,Q.jsxs)(j,{variant:n,size:r,disabled:p,"aria-describedby":m?d:void 0,onClick:async()=>{s(!0);try{await a()}finally{s(!1)}},children:[o&&(0,Q.jsx)(Mr,{className:`mr-2 h-4 w-4 animate-spin`}),!o&&h&&(0,Q.jsx)(h,{className:`mr-2 h-4 w-4`}),i]});return m?(0,Q.jsx)(ne,{delayDuration:200,children:(0,Q.jsxs)(q,{children:[(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsxs)(`span`,{tabIndex:0,"aria-describedby":d,"data-disabled-reason":``,className:`inline-flex rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:[g,(0,Q.jsx)(`span`,{id:d,className:`sr-only`,children:m})]})}),(0,Q.jsx)(k,{children:m})]})}):g}var ry=$g(ty,`record:quick_actions`),iy=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 ay(e){let t=e?.actor_id;if(typeof t==`string`||typeof t==`number`)return t;if(t&&typeof t==`object`){let e=t.id;if(typeof e==`string`||typeof e==`number`)return e}return null}var oy=new Set([`created`,`updated`,`assigned`,`shared`,`deleted`]),sy=50;function cy(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function ly(e){return cy(e)?e:sy}function uy(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 dy(e){return e==null||cy(e)?null:`[ObjectUI] record:history row cap: declared limit: ${uy(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 (${sy}).`}var fy=({schema:e={},className:t,...n})=>{let{designer:r}=iy(n),i=K(),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=ly(l),d=dy(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,$expand:[`actor_id`]})).then(t=>{if(e)return;let n=(t?.data??[]).filter(e=>oy.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_id:ay(e),user_name:Iv(e),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)(rg,{entries:b,loading:x,emptyText:s,unknownUserText:c})})},py=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,my=/^[\\/]{2}/;function hy(e,t){return t+e.replace(/\\/g,`/`)}function gy(e,t){if(e===!1||e==null)throw Error(t)}function _y(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function vy({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 yy(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 by(e,t,n=`/`){return xy(e,t,n,!1)}function xy(e,t,n,r,i){let a=By((typeof t==`string`?yy(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Sy(e),s=null,c=zy(a);for(let e=0;s==null&&e<o.length;++e)s=Fy(o[e],c,r);return s}function Sy(e){let t=Cy(e);return Ty(t),t}function Cy(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;gy(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=Jy([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(gy(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Cy(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:Ny(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Ry(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 wy(e.path))a(e,t,!0,n)}),t}function wy(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=wy(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 Ty(e){e.sort((e,t)=>e.score===t.score?Py(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Ey=/^:[\w-]+$/,Dy=3,Oy=2,ky=1,Ay=10,jy=-2,My=e=>e===`*`;function Ny(e,t){let n=e.split(`/`),r=n.length;return n.some(My)&&(r+=jy),t&&(r+=Oy),n.filter(e=>!My(e)).reduce((e,t)=>e+(Ey.test(t)?Dy:t===``?ky:Ay),r)}function Py(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 Fy(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?Ly(u,l,s.matcher,s.compiledParams):Iy(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=Iy({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:Jy([a,d.pathname]),pathnameBase:Xy(Jy([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=Jy([a,d.pathnameBase]))}return o}function Iy(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Ry(e.path,e.caseSensitive,e.end);return Ly(e,t,n,r)}function Ly(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 Ry(e,t=!1,n=!0){_y(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 zy(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return _y(!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 By(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 Vy(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?yy(e):e,a;return n?(n=qy(n),a=n.startsWith(`/`)?Hy(n.substring(1),`/`):Hy(n,t)):a=t,{pathname:a,search:Zy(r),hash:Qy(i)}}function Hy(e,t){let n=Yy(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Uy(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 Wy(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Gy(e){let t=Wy(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Ky(e,t,n,r=!1){let i;typeof e==`string`?i=yy(e):(i={...e},gy(!i.pathname||!i.pathname.includes(`?`),Uy(`?`,`pathname`,`search`,i)),gy(!i.pathname||!i.pathname.includes(`#`),Uy(`#`,`pathname`,`hash`,i)),gy(!i.search||!i.search.includes(`#`),Uy(`#`,`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=Vy(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var qy=e=>e.replace(/[\\/]{2,}/g,`/`),Jy=e=>qy(e.join(`/`)),Yy=e=>e.replace(/\/+$/,``),Xy=e=>Yy(e).replace(/^\/*/,`/`),Zy=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Qy=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,$y=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 eb(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function tb(e){return Jy(e.map(e=>e.route.path).filter(Boolean))||`/`}var nb=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function rb(e,t){let n=e;if(typeof n!=`string`||!py.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(nb)try{let e=new URL(window.location.href),r=my.test(n)?new URL(hy(n,e.protocol)):new URL(n),a=By(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{_y(!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 ib=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(ib);var ab=[`GET`,...ib];new Set(ab);var ob=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function sb(e){try{return ob.includes(new URL(e).protocol)}catch{return!1}}var cb=$.createContext(null);cb.displayName=`DataRouter`;var lb=$.createContext(null);lb.displayName=`DataRouterState`;var ub=$.createContext(!1);function db(){return $.useContext(ub)}var fb=$.createContext({isTransitioning:!1});fb.displayName=`ViewTransition`;var pb=$.createContext(new Map);pb.displayName=`Fetchers`;var mb=$.createContext(null);mb.displayName=`Await`;var hb=$.createContext(null);hb.displayName=`Navigation`;var gb=$.createContext(null);gb.displayName=`Location`;var _b=$.createContext({outlet:null,matches:[],isDataRoute:!1});_b.displayName=`Route`;var vb=$.createContext(null);vb.displayName=`RouteError`;var yb=`REACT_ROUTER_ERROR`,bb=`REDIRECT`,xb=`ROUTE_ERROR_RESPONSE`;function Sb(e){if(e.startsWith(`${yb}:${bb}:{`))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 Cb(e){if(e.startsWith(`${yb}:${xb}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new $y(t.status,t.statusText,t.data)}catch{}}function wb(e,{relative:t}={}){gy(Tb(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=$.useContext(hb),{hash:i,pathname:a,search:o}=Mb(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Jy([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Tb(){return $.useContext(gb)!=null}function Eb(){return gy(Tb(),`useLocation() may be used only in the context of a <Router> component.`),$.useContext(gb).location}var Db=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Ob(e){$.useContext(hb).static||$.useLayoutEffect(e)}function kb(){let{isDataRoute:e}=$.useContext(_b);return e?Jb():Ab()}function Ab(){gy(Tb(),`useNavigate() may be used only in the context of a <Router> component.`);let e=$.useContext(cb),{basename:t,navigator:n}=$.useContext(hb),{matches:r}=$.useContext(_b),{pathname:i}=Eb(),a=JSON.stringify(Gy(r)),o=$.useRef(!1);return Ob(()=>{o.current=!0}),$.useCallback((r,s={})=>{if(_y(o.current,Db),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Ky(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Jy([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}$.createContext(null);function jb(){let{matches:e}=$.useContext(_b);return e[e.length-1]?.params??{}}function Mb(e,{relative:t}={}){let{matches:n}=$.useContext(_b),{pathname:r}=Eb(),i=JSON.stringify(Gy(n));return $.useMemo(()=>Ky(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Nb(e,t,n){gy(Tb(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=$.useContext(hb),{matches:i}=$.useContext(_b),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||``;Xb(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.
20
+
21
+ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=Eb(),d;if(t){let e=typeof t==`string`?yy(t):t;gy(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})):by(e,{pathname:p});_y(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),_y(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=Bb(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Jy([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Jy([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(gb.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function Pb(){let e=qb(),t=eb(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 Fb=$.createElement(Pb,null),Ib=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=Cb(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:$.createElement(_b.Provider,{value:this.props.routeContext},$.createElement(vb.Provider,{value:e,children:this.props.component}));return this.context?$.createElement(Rb,{error:e},t):t}};Ib.contextType=ub;var Lb=new WeakMap;function Rb({children:e,error:t}){let{basename:n}=$.useContext(hb);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Sb(t.digest);if(e){let r=Lb.get(t);if(r)throw r;let i=rb(e.location,n),a=i.absoluteURL||i.to;if(sb(a))throw Error(`Invalid redirect location`);if(nb&&!Lb.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 Lb.set(t,n),n}}return $.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function zb({routeContext:e,match:t,children:n}){let r=$.useContext(cb);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),$.createElement(_b.Provider,{value:e},n)}function Bb(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);gy(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:tb(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||Fb,o&&(s<0&&c===0?(Xb(`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(zb,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?$.createElement(Ib,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Vb(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Hb(e){let t=$.useContext(cb);return gy(t,Vb(e)),t}function Ub(e){let t=$.useContext(lb);return gy(t,Vb(e)),t}function Wb(e){let t=$.useContext(_b);return gy(t,Vb(e)),t}function Gb(e){let t=Wb(e),n=t.matches[t.matches.length-1];return gy(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Kb(){return Gb(`useRouteId`)}function qb(){let e=$.useContext(vb),t=Ub(`useRouteError`),n=Gb(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Jb(){let{router:e}=Hb(`useNavigate`),t=Gb(`useNavigate`),n=$.useRef(!1);return Ob(()=>{n.current=!0}),$.useCallback(async(r,i={})=>{_y(n.current,Db),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Yb={};function Xb(e,t,n){!t&&!Yb[e]&&(Yb[e]=!0,_y(!1,n))}$.memo(Zb);function Zb({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Nb(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}$.Component;var Qb=`get`,$b=`application/x-www-form-urlencoded`;function ex(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function tx(e){return ex(e)&&e.tagName.toLowerCase()===`button`}function nx(e){return ex(e)&&e.tagName.toLowerCase()===`form`}function rx(e){return ex(e)&&e.tagName.toLowerCase()===`input`}function ix(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ax(e,t){return e.button===0&&(!t||t===`_self`)&&!ix(e)}var ox=null;function sx(){if(ox===null)try{new FormData(document.createElement(`form`),0),ox=!1}catch{ox=!0}return ox}var cx=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function lx(e){return e!=null&&!cx.has(e)?(_y(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${$b}"`),null):e}function ux(e,t){let n,r,i,a,o;if(nx(e)){let o=e.getAttribute(`action`);r=o?By(o,t):null,n=e.getAttribute(`method`)||Qb,i=lx(e.getAttribute(`enctype`))||$b,a=new FormData(e)}else if(tx(e)||rx(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?By(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Qb,i=lx(e.getAttribute(`formenctype`))||lx(o.getAttribute(`enctype`))||$b,a=new FormData(o,e),!sx()){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(ex(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Qb,r=null,i=$b,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 dx(e,t){if(e===!1||e==null)throw Error(t)}function fx(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&&By(i.pathname,t)===`/`?`${Yy(t)}/_root.${r}`:`${Yy(i.pathname)}.${r}`,i}async function px(e,t){if(e.id in t)return t[e.id];try{let n=await Z(()=>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 mx(e){return e!=null&&typeof e.page==`string`}function hx(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 gx(e,t,n){return xx((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await px(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(hx).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function _x(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 vx(e,t,{includeHydrateFallback:n}={}){return yx(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 yx(e){return[...new Set(e)]}function bx(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function xx(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!mx(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(bx(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Sx(){let e=$.useContext(cb);return dx(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Cx(){let e=$.useContext(lb);return dx(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var wx=$.createContext(void 0);wx.displayName=`FrameworkContext`;function Tx(){let e=$.useContext(wx);return dx(e,`You must render this element inside a <HydratedRouter> element`),e}function Ex(e,t){let n=$.useContext(wx),[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:Dx(s,p),onBlur:Dx(c,m),onMouseEnter:Dx(l,p),onMouseLeave:Dx(u,m),onTouchStart:Dx(d,p)}]:[a,f,{}]:[!1,f,{}]}function Dx(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ox({page:e,...t}){let n=db(),{nonce:r}=Tx(),{router:i}=Sx(),a=$.useMemo(()=>by(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?$.createElement(Ax,{page:e,matches:a,...t}):$.createElement(jx,{page:e,matches:a,...t})):null}function kx(e){let{manifest:t,routeModules:n}=Tx(),[r,i]=$.useState([]);return $.useEffect(()=>{let r=!1;return gx(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Ax({page:e,matches:t,...n}){let r=Eb(),{future:i}=Tx(),{basename:a}=Sx(),o=$.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=fx(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 jx({page:e,matches:t,...n}){let r=Eb(),{future:i,manifest:a,routeModules:o}=Tx(),{basename:s}=Sx(),{loaderData:c,matches:l}=Cx(),u=$.useMemo(()=>_x(e,t,l,a,r,`data`),[e,t,l,a,r]),d=$.useMemo(()=>_x(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=fx(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(()=>vx(d,a),[d,a]),m=kx(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 Mx(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}$.Component;var Nx=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Nx&&(window.__reactRouterVersion=`7.18.2`)}catch{}var Px=$.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(hb),v=typeof l==`string`&&py.test(l),y=rb(l,h);l=y.to;let b=wb(l,{relative:r}),x=Eb(),S=null;if(o){let e=Ky(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Jy([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=Ex(n,p),E=zx(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:Mx(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?$.createElement($.Fragment,null,k,$.createElement(Ox,{page:b})):k});Px.displayName=`Link`;var Fx=$.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=Mb(a,{relative:c.relative}),d=Eb(),f=$.useContext(lb),{navigator:p,basename:m}=$.useContext(hb),h=f!=null&&Wx(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=By(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(Px,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});Fx.displayName=`NavLink`;var Ix=$.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Qb,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=$.useContext(hb),g=Hx(),_=Ux(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&py.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})});Ix.displayName=`Form`;function Lx(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Rx(e){let t=$.useContext(cb);return gy(t,Lx(e)),t}function zx(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=kb(),d=Eb(),f=Mb(e,{relative:o});return $.useCallback(p=>{if(ax(p,t)){p.preventDefault();let t=n===void 0?vy(d)===vy(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 Bx=0,Vx=()=>`__${String(++Bx)}__`;function Hx(){let{router:e}=Rx(`useSubmit`),{basename:t}=$.useContext(hb),n=Kb(),r=e.fetch,i=e.navigate;return $.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=ux(e,t);if(a.navigate===!1){let e=a.fetcherKey||Vx();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 Ux(e,{relative:t}={}){let{basename:n}=$.useContext(hb),r=$.useContext(_b);gy(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Mb(e||`.`,{relative:t})},o=Eb();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:Jy([n,a.pathname])),vy(a)}function Wx(e,{relative:t}={}){let n=$.useContext(fb);gy(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Rx(`useViewTransitionState`),i=Mb(e,{relative:t});if(!n.isTransitioning)return!1;let a=By(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=By(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Iy(i.pathname,o)!=null||Iy(i.pathname,a)!=null}var Gx=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 Kx(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function qx(e,t){return Kx(e)?e:t}function Jx(e,t){return e==null||Kx(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).`}function Yx(e,t){for(let[n,r,i]of JSON.parse(e))$t.claimRows(n,r,t,i)}function Xx(e,t){for(let[n,r]of JSON.parse(e))$t.releaseRows(n,r,t)}var Zx=e=>e.replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim(),Qx=(e,t,n)=>t&&e?.[t]!=null&&e[t]!==``?String(e[t]):tn(e,n)||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||`—`,$x=({schema:e={},className:t,...n})=>{let r=K(),i=v(),{t:a}=ph(),{designer:o}=Gx(n),s=jb().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(``),y=$.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[b,x]=$.useState({}),[S,C]=$.useState({}),w=$.useRef(new Set),T=$.useRef(new Set),E=JSON.stringify(c.map(e=>`${e.objectName}:${e.relationshipField}:${qx(e.limit,3)}`)),D=JSON.stringify(c.map(e=>[e.objectName,e.limit??null])),O=!!u?.find&&!!l,k=O?JSON.stringify(c.map(e=>[e.objectName,e.relationshipField,qx(e.limit,3)])):`[]`;O&&Yx(k,String(l)),$.useEffect(()=>{if(!l)return;let e=String(l);return Yx(k,e),()=>Xx(k,e)},[k,l]),$.useEffect(()=>{for(let e of c){let t=Jx(e.limit,e.objectName);if(!t)continue;let n=`${e.objectName}:${String(e.limit)}`;T.current.has(n)||(T.current.add(n),console.warn(t))}},[D]);let ee=r?.objectName,A=JSON.stringify(c.map(e=>e.objectName)),[j,M]=$.useState(0);$.useEffect(()=>{let e=JSON.parse(A);return ae(t=>{(ee&&l&&P(t,ee,String(l))||e.some(e=>P(t,e)))&&M(e=>e+1)})},[ee,l,A]),$.useEffect(()=>{if(!m||!u?.find||!l||c.length===0)return;let e=`${l}::${E}`,t=`${e}::${j}`;if(_.current===t)return;let n=y.current===e;_.current=t,y.current=e;let r=()=>g.current&&_.current===t;n||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 i=async(e,t)=>{let i=e.objectName,a=qx(e.limit,3);try{let o,s;if(n||j>0){let n=await u.find(e.objectName,{$filter:oe(e.relationshipField,l,t),$top:a,$count:!0});s=Array.isArray(n)?n:n?.data||[],o=typeof n?.total==`number`?n.total:s.length}else{let n=await $t.fetchRows((e,t)=>u.find(e,t),e.objectName,e.relationshipField,String(l),a,t);s=n.rows,o=n.total}if(!r())return;f(e=>({...e,[i]:{loading:!1,total:o,items:s}}))}catch(e){if(!r())return;f(t=>({...t,[i]:{loading:!1,total:0,items:[],error:String(e?.message||e)}}))}};(async()=>{let e=new Map,t=new Map;if(typeof u.getObjectSchema==`function`&&await Promise.all(Array.from(new Set(c.map(e=>e.objectName))).map(async n=>{try{let r=await u.getObjectSchema(n);e.set(n,r?.fields);let i=Y(r);typeof i==`string`&&i!==``&&t.set(n,i)}catch{}})),!r())return;x(Object.fromEntries(e)),C(Object.fromEntries(t));for(let t of c){if(!Se(e.get(t.objectName),t.relationshipField))continue;let n=`${t.objectName}.${t.relationshipField}`;w.current.has(n)||(w.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 n=[...c],a=async()=>{for(;g.current;){let t=n.shift();if(!t)return;await i(t,e.get(t.objectName))}};await Promise.all(Array.from({length:Math.min(3,n.length)},()=>a()))})()},[m,u,l,E,j]);let[N,F]=$.useState(!1);if(c.length===0)return null;let I=e.hideEmpty!==!1,L=new Set(c.filter(e=>{let t=d[e.objectName];return I&&t&&!t.loading&&!t.error&&t.total===0}).map(e=>e.objectName)),te=c.filter(e=>N||!L.has(e.objectName)),ne=c.filter(e=>L.has(e.objectName)).map(e=>e.title||(i?.objectPluralLabel?i.objectPluralLabel({name:e.objectName,label:Zx(e.objectName)}):Zx(e.objectName)));return(0,Q.jsxs)(`div`,{ref:p,className:U(`flex flex-col gap-3`,e.className,t),...o,children:[te.map(e=>{let t=e.objectName,n=d[t]||{loading:!0,total:0,items:[]},r=Se(b[t],e.relationshipField),o=e.title||(i?.objectPluralLabel?i.objectPluralLabel({name:e.objectName,label:Zx(e.objectName)}):Zx(e.objectName));return(0,Q.jsxs)(Qt,{className:`overflow-hidden`,children:[(0,Q.jsxs)(rt,{className:`flex flex-row items-center justify-between gap-2 py-3 px-4 space-y-0 border-b`,children:[(0,Q.jsx)(kn,{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)(dt,{variant:`secondary`,className:`tabular-nums`,children:n.total}),s&&l&&!r&&(0,Q.jsx)(Px,{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)(Mt,{className:`p-0`,children:n.loading?(0,Q.jsxs)(`div`,{className:`space-y-1.5 p-3`,children:[(0,Q.jsx)(xe,{className:`h-3.5 w-4/5`}),(0,Q.jsx)(xe,{className:`h-3.5 w-3/5`}),(0,Q.jsx)(xe,{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(n=>{let r=n.id||n._id,i=Qx(n,e.displayField,S[t]),a=r?`../${e.objectName}/record/${encodeURIComponent(String(r))}`:void 0;return(0,Q.jsx)(`li`,{className:`px-4 py-2`,children:a?(0,Q.jsxs)(Px,{to:a,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:i}),(0,Q.jsx)(yr,{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:i})},String(r||i))})})})]},t)}),!N&&ne.length>0&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>F(!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:ne.join(` · `),children:[(0,Q.jsx)(`span`,{children:a(`detail.showEmptyRelated`,{defaultValue:`+ {{count}} empty`,count:ne.length})}),(0,Q.jsxs)(`span`,{className:`truncate max-w-[180px] text-muted-foreground/70`,children:[`(`,ne.join(` · `),`)`]})]})]})};function eS(e){let t=jn(e?.properties)?e.properties:{};return{...e,...t}}var tS={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`}},nS=({schema:e={},className:t})=>{let n=eS(e),r=K(),i=r?.data,a=r?.objectName||``,o=r?.recordId??i?.id,{language:s,t:c}=tr(),l=rr(n.title,s),u=rr(n.body,s),d=rr(n.action?.label,s),f=[`info`,`warning`,`error`,`success`].includes(n.severity)?n.severity:`info`,p=tS[f],m=n.icon||p.icon,h=J(i),g=nt(n.visible),_=!!i&&Object.keys(i).length>0,v=G(_?g:void 0,h),y=$.useMemo(()=>{if(!n.dismissible)return null;let e=n.dismissKey||rr(n.title,`en`)||f;return`os.record-alert:${a}:${o??`_`}:${e}`},[n.dismissible,n.dismissKey,n.title,f,a,o]),[b,x]=$.useState(()=>{if(!y||typeof window>`u`)return!1;try{return window.localStorage.getItem(y)===`1`}catch{return!1}}),S=n.action?.actionName,{item:C}=at(`object`,S&&a?a:null),w=$.useMemo(()=>{let e=ut(S?[S]:[],Array.isArray(C?.actions)?C.actions:void 0);return e.kind===`ids`?e.actions[0]:void 0},[S,C]),T=$.useMemo(()=>w?[w]:[],[w]),{executeAction:E}=$e({actions:T,context:{record:i,recordId:o,objectName:a}});return b||!_||g!==void 0&&!v?null:(0,Q.jsxs)(Nn,{className:U(`relative pr-12`,p.wrap,t),role:f===`error`?`alert`:`status`,"aria-live":f===`error`?`assertive`:`polite`,children:[(0,Q.jsx)(et,{name:m,className:`h-4 w-4`,"aria-hidden":`true`}),l?(0,Q.jsx)(O,{children:l}):null,u||w?(0,Q.jsxs)(Me,{children:[u?(0,Q.jsx)(`p`,{className:`mb-2 last:mb-0`,children:u}):null,w?(0,Q.jsx)(j,{size:`sm`,variant:n.action?.variant||(f===`error`?`destructive`:`default`),onClick:()=>{w?.name&&E(w.name)},children:d||w.label||w.name}):null]}):null,n.dismissible?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{if(x(!0),y)try{window.localStorage.setItem(y,`1`)}catch{}},"aria-label":c(`home.recoveryReminder.dismiss`,{defaultValue:`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)(et,{name:`X`,className:`h-4 w-4`,"aria-hidden":`true`})}):null]})},rS=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)}},iS=(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()}},aS=({open:e,conflict:t,onReload:n,onOverwrite:r,onCancel:i,busy:a=!1})=>{let{t:o}=ph(),s=ir(),c=t?.label||t?.field||``,l=t?rS(t.pendingValue):``,u=t?rS(t.currentValue):``,d=t?.currentRecord??{},p=(()=>{let e=[d.updated_by_name,d.updated_by_label];for(let t of e)if(typeof t==`string`&&t.length>0)return t;let t=d.updated_by;return typeof t!=`string`||t.length===0||t.length>=16&&!/\s/.test(t)&&/^[A-Za-z0-9_-]+$/.test(t)?null:t})(),m=iS(d.updated_at??t?.currentVersion,s),[h,g]=o(`detail.concurrentUpdateDescription`,{field:`{{field}}`}).split(`{{field}}`);return(0,Q.jsx)(w,{open:e,onOpenChange:e=>{!e&&!a&&i()},children:(0,Q.jsxs)(f,{className:`max-w-lg`,children:[(0,Q.jsx)(pe,{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)(Kr,{className:`h-5 w-5`})}),(0,Q.jsxs)(`div`,{className:`flex-1`,children:[(0,Q.jsx)(ve,{children:o(`detail.concurrentUpdateTitle`)}),(0,Q.jsxs)(Bt,{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)(ue,{className:`gap-2 sm:gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:i,className:U(B({variant:`ghost`}),`mt-2 sm:mt-0`),children:o(`detail.concurrentUpdateCancel`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:r,className:U(B({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(B({variant:`default`}),`mt-2 sm:mt-0`),children:o(`detail.concurrentUpdateReload`)})]})]})})};function oS(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.code===`CONCURRENT_UPDATE`||t.name===`ConcurrentUpdateError`}function sS(e){let t=e?.message||e?.error||String(e??`Save failed`);return String(t).replace(/^\[[^\]]+\]\s*/,``).replace(/^[A-Z][A-Z0-9_]+:\s*/,``)}function cS(e,t){return Be(e)||(t?[{field:t,message:te(e)||sS(e)}]:null)}async function lS(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 uS=({dataSource:e,objectName:t,recordId:n,data:r,refresh:i,fieldLabelFor:a,onFieldSave:o,locked:s=!1,lockedHint:c,className:l})=>{let{t:u}=ph(),d=mn(),[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=cS(e,t);if(!n){d.setFieldErrors(null),d.setError(sS(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 lS(e,t,n,a,o?{ifMatch:o}:void 0),await i?.()}d.reset()}catch(e){oS(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 lS(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`),"data-fab-yield":``,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)(Jr,{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)(Mr,{className:`h-4 w-4 animate-spin`}):(0,Q.jsx)(gr,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{children:d.saving?u(`detail.saving`):u(`detail.save`)})]})]}),(0,Q.jsx)(aS,{open:!!f,conflict:f,busy:m,onCancel:x,onReload:S,onOverwrite:C})]})},dS=new Set(gi);function fS(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=qt(t);return{name:e,label:t.label,type:t.type,readonly:!!t.readonly||n,options:t.options,currency:t.currency,currencyConfig:t.currencyConfig,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 pS({record:e,objectName:t,recordId:n,dataSource:r,objectSchema:i,columns:a=2,systemFields:o=dS,onFieldSave:s,onDelete:c,onClose:l,fullPageHref:u}){let{t:d}=ph(),f=fS(e,i,o),p=Ti(`recordEdit`,{objectSchema:i,objectName:t,perms:Js()}).allowed?s:void 0;return(0,Q.jsxs)(bn,{canEdit:!!p,children:[(0,Q.jsx)(Og,{dataSource:r,inlineEdit:!!p,schema:{type:`detail-view`,objectName:t,resourceId:String(n),data:e,showDelete:!!c,columns:a,fields:f,actions:u?[{type:`action:bar`,location:`record_header`,systemActions:[{name:`sys_open_new_tab`,label:d(`detail.openInNewTab`),icon:`external-link`,type:`script`,onClick:()=>window.open(u,`_blank`,`noopener`)}]}]:void 0},onDelete:c?async()=>{try{await c(),l?.()}catch(e){console.error(`[RecordDetailPanel] delete failed:`,e)}}:void 0}),(0,Q.jsx)(uS,{onFieldSave:p?async(e,t)=>{try{await p(e,t)}catch(e){throw console.error(`[RecordDetailPanel] inline field save failed:`,e),e}}:void 0})]})}function mS(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 hS=y(({schema:e,dataSource:t,...n})=>{let r=Ee(t),{t:i}=tr();return(0,Q.jsx)(lt,{schema:e,dataSource:r,testId:`detail-view`,errorTitle:i(`element.detailView.sourceUnresolved`,{defaultValue:`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:Fn(`detail-view`,e?.objectName),children:e=>(0,Q.jsx)(Og,{schema:e,dataSource:r,...n})})});De.register(`detail-view`,hS,{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:[]}}),De.register(`detail-section`,Ag,{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(jh),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."}]}),De.register(`detail`,Og,{namespace:`view`,category:`view`,label:`Detail`,icon:`FileText`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`recordId`,type:`string`},{name:`fields`,type:`array`}]});var gS={name:`emptyState`,type:`object`,description:"What this block draws in its place when its `dataSource` binding answers no row, `{ title, message, icon, link }` — the list view's own empty-state shape: a Lucide `icon` name, a `title` (default: \"Record not found\"), a `message` (default: none) and one `link: { label, url }` the user follows (default: none), opened as a `url` action opens it. `title`, `message` and the link's `label` each accept a plain string or an inline per-locale map, resolved against the display locale. Drawn then and only then — never on a block with no `dataSource` (it reads the record page's record instead), never while the bound read is loading, and never in place of the error a failed read shows; a read the server refuses as forbidden reads as no row, so it is drawn for that too. Leave it out and a binding with no row keeps the block's own placeholder."};De.register(`details`,x_,{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), its presentation (label, icon, description, collapse) and its `visibleWhen` all come from the group, so the section restates none of it — the predicate is evaluated against the bound record exactly as the entry form evaluates it, and a group it hides renders nothing (a `visibleWhen` written on a section itself is refused by the spec and not read: gate the group and reference 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. @objectstack/spec 18 declares a ninth, `count` (`{ field }`): the renderer fills the heading's `{{ count }}` hole with how many values that multi-value field holds on the current record — `{ name: 'tagging', label: '{{ count }} tags', count: { field: 'tags' }, fields: ['tags'] }` reads `3 tags` when three are selected. An absent or empty value counts 0; `count` changes only the heading, never whether the section renders, so with `hideEmpty` on an all-empty section is still absent. The hole is filled after the heading is translated, so each locale of an inline label map and a translated objects.<object>._sections.<name>.label write the same `{{ count }}`. The spec refuses `count` beside `group`, on a section with no `label`, and on a label with no hole; a heading on a section without `count` prints as written. Like the eight, `count` has no designer control yet."},{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."},gS]}),De.register(`related_list`,R_,{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 the junction column holds the machine name of the parent record). 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:`parentDataSource`,type:`object`,description:"The PARENT record this related list hangs off, bound by a query of its own: an object binding `{ object, view?, filter?, sort?, limit? }`, the shape `dataSource` takes. The FIRST row of the bound set by its `sort` is the parent (declare `limit: 1`; `objectui validate` warns without it), and `relationshipValueField` is read on that row. When no row answers, the list draws a notice saying so in its place, never an empty list. Without this key, the parent is the record page's record. The node-level `dataSource` on this block is the CHILD rows the list draws, and it is never read as the parent."},{name:`columns`,type:`array`,of:`string`,description:"Fields to display in the related list. Optional: without it, a `dataSource` binding that names a view supplies that view's columns, and with neither the list derives its columns from the related object (its `highlightFields`, otherwise its listable fields). Authored columns win over both."},{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."}]}),De.register(`highlights`,B_,{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."},gS]}),De.register(`activity`,Uv,{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. A milestone row (metadata.kind "milestone") is not a completed activity and shows either way. A logged interaction, a task item that points at its source record through source_object / source_id (a logged call, meeting or email), also shows either way.`},{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 _S=[{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.`}];De.register(`chatter`,Kv,{namespace:`record`,skipFallback:!0,category:`record`,label:`Chatter Feed`,icon:`MessageSquare`,inputs:_S}),De.register(`discussion`,Kv,{namespace:`record`,skipFallback:!0,category:`record`,label:`Discussion`,icon:`MessageSquare`,inputs:_S}),De.register(`path`,Yv,{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)`}]}),De.register(`quick_actions`,ry,{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: the bar renders its empty placeholder on a design / preview surface and nothing at runtime`},{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:[...ze],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`},gS]}),De.register(`history`,fy,{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`}]}),De.register(`reference_rail`,$x,{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`}]}),De.register(`alert`,nS,{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`}]});var vS=Zn({"kanban.uncategorized":`Uncategorized`},`kanban.uncategorized`),yS=$.lazy(()=>Z(()=>import(`./KanbanImpl-CVbnhntu.js`),__vite__mapDeps([0]))),bS=({schema:e,objectFields:t,onCardMove:n,cardsMovable:r,quickAdd:i,onQuickAdd:a})=>{let{t:o}=vS(),s=$.useMemo(()=>ZS(e.columns??[],e.data,e.groupBy,e.coverImageField,o(`kanban.uncategorized`)),[e,o]);return(0,Q.jsx)($.Suspense,{fallback:(0,Q.jsx)(xe,{className:`w-full h-[600px]`}),children:(0,Q.jsx)(yS,{columns:s,onCardMove:n,cardsMovable:r,onCardClick:e.onCardClick,className:e.className,quickAdd:i,onQuickAdd:a,coverImageField:e.coverImageField,conditionalFormatting:e.conditionalFormatting,objectFields:t,swimlaneField:e.swimlaneField,countsAreWindowed:e.countsAreWindowed})})};function xS(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||!In(t[r]))continue;let s=Ot({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&&md(e.type)&&a.push({name:r,def:{name:r,...e}})}return a}function SS({open:e,fields:t,submitting:n,onCancel:r,onSubmit:i}){let a=Kn(),[o,s]=$.useState({}),[c,l]=$.useState(!1),u=t.filter(e=>In(o[e.name]));return(0,Q.jsx)(It,{open:e,onOpenChange:e=>{e||r()},children:(0,Q.jsxs)(st,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(ht,{children:[(0,Q.jsx)(Jt,{children:a(`kanban.requiredFieldsTitle`,`Complete required fields`)}),(0,Q.jsx)(on,{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=In(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)(_d,{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)(yn,{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 CS=(0,$.createContext)(!0);function wS(){return(0,$.useContext)(CS)}var TS=(0,$.createContext)(null);function ES(){return(0,$.useContext)(TS)}function DS(e){let[t,n]=String(e).split(`e`),r=t.indexOf(`.`),i=r===-1?0:t.length-r-1;return Math.min(Math.max(i-(n?Number(n):0),0),20)}function OS(e,t){let n=0,r=0;for(let i of e){let e=i[t];if(wt(e))continue;let a=typeof e==`number`?e:typeof e==`string`?Number(e):NaN;if(!Number.isFinite(a))return null;n+=a,r=Math.max(r,DS(a))}return r===0?n:Number(n.toFixed(r))}var kS=(0,$.createContext)(null);function AS(){return(0,$.useContext)(kS)}function jS(e,t,n){return C(e,[t,`=`,n])}function MS(e,t,n){return C(e,[`or`,[t,`nin`,[...n]],[t,`is_null`]])}function NS(e,t,n){let r=Di(e),i=e&&typeof e==`object`?e.total:void 0,a=typeof i==`number`&&Number.isFinite(i)?i:null,o=t+r.length;return{rows:r,page:{total:a,loaded:o,hasMore:a===null?r.length>=n:o<a,loading:!1}}}function PS(e,t){return e.total===null?{count:t,atLeast:e.hasMore}:{count:Math.max(t,e.total+(t-e.loaded)),atLeast:!1}}function FS(e,t,n){if(!e||typeof e!=`object`||Array.isArray(e))return;let r=Fa(e,t,n),i=r.name??r.username,a=typeof i==`string`?i.trim():``;if(!a)return;let o=typeof r.image==`string`&&r.image?r.image:void 0;return o?{name:a,image:o}:{name:a}}function IS(e){return e.split(/\s+/).filter(Boolean).map(e=>e[0]).join(``).toUpperCase().slice(0,2)}var LS={"detail.recordDetail":`Record Detail`,"detail.recordDetailWithLabel":`{{label}} Detail`},RS={kind:`moved`};function zS(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function BS(e,t){return zS(e)?e:t}function VS(e,t){return e==null||zS(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 HS=Zn(LS,`detail.recordDetail`);function US(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 WS(e){if(e?.cardTitle)return e.cardTitle;if(e?.titleField)return e.titleField}var GS=({schema:e,dataSource:t,className:n,data:r,loading:i,onRowClick:a,onCardClick:o,lanePaging:s,ownerField:c,...l})=>{let u=e,{translateOptions:d,fieldLabel:f}=v(),p=Kn(),{t:m}=HS(),h=Array.isArray(r),[_,y]=(0,$.useState)([]),[b,x]=(0,$.useState)(!1),S=u.objectName??``,{ready:C,def:w}=re(S,t),[T,E]=(0,$.useState)(h?i??!1:!1),[D,O]=(0,$.useState)(null),[k,A]=(0,$.useState)(0),j=Rt(u.bind),M=Js(),[N,P]=(0,$.useState)(null),F=!(!h&&!j&&!u.data&&u.objectName&&t&&typeof t.find==`function`)||N!==null&&N.key===S;(0,$.useEffect)(()=>{if(!h&&t?.onMutation&&u.objectName)return t.onMutation(e=>{e.resource===u.objectName&&A(e=>e+1)})},[t,u.objectName,h]),(0,$.useEffect)(()=>{h&&i!==void 0&&E(i)},[i,h]),(0,$.useEffect)(()=>{let e=VS(u.limit,u.objectName);e&&console.warn(e)},[u.limit,u.objectName]);let I=JSON.stringify(u.sort??null),L=At(),ne=Xt(u.filter,L),R=fn(!h&&!j&&!u.data&&u.objectName||void 0),z=s!==void 0,B=JSON.stringify(s?.search?{$search:s.search,...s.searchFields&&s.searchFields.length>0?{$searchFields:[...s.searchFields]}:{}}:{}),V=z?String(s?.reloadKey??``):``,ie=(0,$.useMemo)(()=>{if(!z||!u.groupBy||u.swimlaneField||u.grouping?.fields?.[0]?.field)return null;let e=e=>e!=null&&e!==``,t=Array.isArray(u.columns)&&u.columns.length>0&&typeof u.columns[0]==`object`?u.columns.map(e=>e?.id).filter(e):[],n=w?.fields?.[u.groupBy]?.options,r=t.length>0?t:Array.isArray(n)?n.map(e=>e?.value).filter(e):[];return r.length>0?JSON.stringify(r):null},[z,u.groupBy,u.swimlaneField,u.grouping,u.columns,w]),[ae,H]=(0,$.useState)(null),oe=$.useRef(ae);oe.current=ae;let se=$.useRef(null),U=$.useRef(0),le=JSON.stringify(ne??null),W=JSON.stringify([S,u.groupBy??null,ie,le,I,B]);(0,$.useEffect)(()=>{if(h||!C)return;let e=!0,n=()=>{e&&P(e=>e!==null&&e.key===S?e:{key:S})};return u.objectName&&!j&&!u.data&&(async()=>{if(!t||typeof t.find!=`function`||!u.objectName){n();return}e&&E(!0);try{let n=mt(w?.fields),r=M?.isLoaded?n.filter(e=>M.checkField(u.objectName,e,`read`)):n,i=JSON.parse(B);if(ie!==null&&u.groupBy){let n=u.objectName,a=u.groupBy,o=JSON.parse(ie),s=++U.current,c=se.current?.question===W?oe.current:null,l={$orderby:Bi(u.sort),...r.length>0?{$expand:r}:{},...i,$count:!0},d=[...o.map(e=>({key:String(e),filter:jS(ne,a,e)})),{key:YS,filter:MS(ne,a,o)}],f=await Promise.all(d.map(async e=>{let r=c?.[e.key]?.loaded??0,i=Math.max(50,Math.ceil(r/50)*50);return{lane:e,...NS(await t.find(n,{...l,$filter:e.filter,$top:i}),0,i)}}));if(!e||s!==U.current)return;let p=new Set,m=[],h={};for(let e of f){h[e.lane.key]=e.page;for(let t of e.rows){let e=String(t?.id??t?._id);p.has(e)||(p.add(e),m.push(t))}}se.current={generation:s,question:W,objectName:n,params:l,filters:Object.fromEntries(d.map(e=>[e.key,e.filter]))},oe.current=h,y(m),H(h),x(!1),O(null);return}se.current=null,H(null);let a={$filter:ne,$orderby:Bi(u.sort),$top:BS(u.limit,100),...r.length>0?{$expand:r}:{},...i},o=Di(await t.find(u.objectName,a));e&&(y(o),x(o.length>=a.$top),O(null))}catch(t){console.error(`[ObjectKanban] Fetch error:`,t),e&&O(t)}finally{e&&E(!1),n()}})(),()=>{e=!1}},[u.objectName,S,t,j,u.data,ne,I,u.limit,h,C,w,k,M,R,ie,W,B,V]);let ue=$.useCallback(e=>{let n=se.current,r=oe.current?.[e],i=n?.filters[e];if(!n||!r||!r.hasMore||r.loading||i===void 0||!t||typeof t.find!=`function`)return;let{generation:a}=n,o=t=>H(n=>n&&{...n,[e]:t});o({...r,loading:!0}),t.find(n.objectName,{...n.params,$filter:i,$top:50,$skip:r.loaded}).then(e=>{if(se.current?.generation!==a)return;let t=NS(e,r.loaded,50);y(e=>{let n=new Set(e.map(e=>String(e?.id??e?._id)));return[...e,...t.rows.filter(e=>!n.has(String(e?.id??e?._id)))]}),o(t.page)}).catch(e=>{se.current?.generation===a&&(console.error(`[ObjectKanban] Load more failed:`,e),o({...r,loading:!1}))})},[t]),de=(0,$.useMemo)(()=>ae?{pages:ae,loadMore:ue}:null,[ae,ue]),G=(h?r:void 0)||j||u.data||_,fe=b&&G===_,pe=!!c&&!(M?.isLoaded&&u.objectName&&!M.checkField(u.objectName,c,`read`)),me=c?w?.fields?.[c]?.reference:void 0,K=typeof me==`string`&&me?me:`sys_user`,he=ee(),ge=(0,$.useMemo)(()=>{if(!Array.isArray(G))return[];let e=WS(u),t=hn(w);return G.map(n=>{let r;if(e&&(r=n[e],typeof r==`string`&&(r=r.trim())),!r){let e=xn(w,n),t=n.id??n._id;e===`Untitled`||t!=null&&e===`Record #${t}`||(r=e)}let i=e=>e>=1e6?`$${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e}`,a=/^[A-Za-z0-9_-]{12,32}$/,o=e=>{if(typeof e!=`string`||!a.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},s=e=>{let t=n[e];if(!wt(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(!o(t))return t}},l=[],p=US(u.cardFields,w),m=new Set([...e?[e]:[],...t?[t]:[],`name`,`full_name`,`title`,`subject`,`display_name`]),h=[],g=[];if(p.length>0)for(let e of p){if(m.has(e))continue;let t=w?.fields?.[e],r=n[e];if(!wt(r)){if(t?.type===`picklist`||t?.type===`multipicklist`||Array.isArray(t?.options)&&t.options.length>0){let n=t?.options?.find(e=>String(e.value).toLowerCase()===String(r).toLowerCase()),i=n?.label||String(r),a=w?.name||u.objectName,o=a?d(a,e,[{value:String(n?.value??r),label:i}])[0]?.label??i:i,s=tm(n?.color),c=s?s.className:rm(n?.color,r);if(o===``)continue;h.push({label:o,colorClass:c,colorStyle:s?.style})}else{let i=jm(t??{type:`text`}),a=Zm(i),o=(0,Q.jsx)(a,{value:r,field:t??{name:e,type:i},deadlineSettled:Vi(t,n,{scope:he,fields:w?.fields})});g.push({field:e,label:f(w?.name||u.objectName||``,e,t?.label||e),node:o})}}}else{let e=[`amount`,`value`,`deal_value`,`expected_value`,`opportunity_value`].find(e=>typeof n[e]==`number`);e&&l.push(i(n[e]));let t=[`company`,`company_name`,`account`,`account_name`,`organization`],a;for(let e of t){let t=s(e);if(t){a=t;break}}a&&(!r||!String(r).includes(a))&&l.push(a);let o=[`owner`,`owner_name`,`assignee`,`assignee_name`],c;for(let e of o){let t=s(e);if(t){c=t;break}}c&&l.push(`@${c}`);for(let e of[`priority`,`severity`,`industry`,`rating`]){let t=n[e];if(t!=null&&t!==``){let n=(w?.fields?.[e])?.options?.find(e=>String(e.value).toLowerCase()===String(t).toLowerCase()),r=n?.label||String(t),i=tm(n?.color),a=i?i.className:rm(n?.color,t);if(r===``)continue;if(h.push({label:r,colorClass:a,colorStyle:i?.style}),h.length>=2)break}}}let _=n.description,v=(wt(_)||typeof _==`string`&&o(_))&&l.length>0?l.join(` · `):void 0,y=pe&&c?FS(n[c],M,K):void 0;return{...n,id:n.id||n._id,title:r||xn(w,n),...v?{cardSubtitle:v}:{},...g.length>0?{cardFieldCells:g}:{},...!Array.isArray(n.badges)&&h.length>0?{badges:h}:{},...y?{cardOwner:y}:{}}})},[G,u,w,c,pe,K,M,he]),q=(0,$.useMemo)(()=>{let e=e=>{if(!u.objectName||!u.groupBy)return e;let t=d(u.objectName,u.groupBy,[{value:String(e.id),label:e.title}])[0];return t?.label?{...e,title:t.label}:e};if(u.columns&&u.columns.length>0){if(typeof u.columns[0]==`string`){if(!u.groupBy)return u.columns.map(e=>({id:e,title:e}))}else return u.columns.map(e)}if(u.groupBy&&w?.fields?.[u.groupBy]?.options){let e=w.fields[u.groupBy].options.map(e=>({value:e.value,label:e.label}));return(u.objectName?d(u.objectName,u.groupBy,e):e).map(e=>({id:e.value,title:e.label}))}if(u.groupBy&&ge.length>0){let e=new Set(ge.map(e=>e[u.groupBy]));return Array.from(e).map(e=>({id:String(e),title:String(e)}))}return[]},[u.columns,u.groupBy,u.objectName,ge,w,d]),J=typeof u.summarizeField==`string`&&u.summarizeField!==``?u.summarizeField:void 0,_e=(0,$.useMemo)(()=>{if(!J||!C)return null;let e=w?.fields?.[J];if(w?.fields&&!e||e&&M?.isLoaded&&u.objectName&&!M.checkField(u.objectName,J,`read`))return null;let t=jm(e??{type:`number`}),n=Zm(t),r=e??{name:J,type:t};return{field:J,label:f(w?.name||u.objectName||``,J,e?.label||J),renderTotal:e=>(0,Q.jsx)(n,{value:e,field:r})}},[J,C,w,u.objectName,M,f]),ve=u.swimlaneField||u.grouping?.fields?.[0]?.field,ye={...u,data:ge,columns:q,className:n||u.className,...ve?{swimlaneField:ve}:{}},Y=u.navigation??{mode:`drawer`},be=a??o;!be&&(Y.mode===`drawer`||Y.mode===`modal`||Y.mode===`split`||Y.mode);let xe=gt({navigation:Y,objectName:u.objectName,onRowClick:be}),{anchorRef:Se,captureAnchor:Ce}=Cn(),we=u.objectName?m(`detail.recordDetailWithLabel`,{label:u.objectName.charAt(0).toUpperCase()+u.objectName.slice(1).replace(/_/g,` `)}):m(`detail.recordDetail`),Te=$.useCallback(async(e,n,r,i)=>{let a=u.groupBy,o=u.objectName;if(!a||(h||y(t=>t.map(t=>String(t.id??t._id)===String(e)?{...t,[a]:r}:t)),!o||!t?.update))return RS;try{return await t.update(o,String(e),{[a]:r,...i??{}}),i&&!h&&y(t=>t.map(t=>String(t.id??t._id)===String(e)?{...t,...i}:t)),RS}catch(t){console.warn(`[ObjectKanban] Failed to persist card move`,t);let r=g(t)??(Ie(t)?p(`errors.unauthorized`,`You are not authorized to perform this action.`):te(t)??p(`table.saveFailed`,`Save failed`));return ce.error(r),y(t=>t.map(t=>String(t.id??t._id)===String(e)?{...t,[a]:n}:t)),{kind:`refused`,message:r}}},[u.groupBy,u.objectName,t,h,p]),[Ee,De]=(0,$.useState)(null),[Oe,ke]=(0,$.useState)(!1),Ae=Ti(`kanbanCardMove`,{objectSchema:w,objectName:u.objectName,perms:M}).allowed,je=$.useCallback(async(e,t,n,r)=>{let i=u.groupBy;if(!i||t===n||n===`__uncolumned__`)return RS;let a=(Array.isArray(G)?G:[]).find(t=>String(t?.id??t?._id)===String(e)),o=xS(w?.fields,a,i,n);return o.length>0?(De({cardId:e,fromColumnId:t,toColumnId:n,fields:o}),{kind:`deferred`}):Te(e,t,n)},[u.groupBy,G,w,Te]),Me=(0,$.useMemo)(()=>{if(!Ee)return[];let e=w?.name||u.objectName||``;return Ee.fields.map(t=>{let n=t.def.options,r=e&&Array.isArray(n)?d(e,t.name,n):n,i=typeof t.def.label==`string`?t.def.label:``;return{...t,def:{...t.def,...r?{options:r}:{}},label:f(e,t.name,i||t.name)}})},[Ee,w,u.objectName,d,f]);if(D)return(0,Q.jsxs)(`div`,{className:`p-4 border border-destructive/50 rounded bg-destructive/10 text-destructive`,children:[`Error loading kanban data: `,D.message]});let Ne=e=>{if(!xe.isOverlay||!xe.isOpen||!xe.selectedRecord)return null;let n=u.objectName,r=xe.selectedRecord,i=r.id??r._id;if(!n||i==null)return null;let a=WS(u),o=a&&r[a]?String(r[a]):we;return(0,Q.jsx)(_n,{...xe,title:o,mainContent:e,popoverAnchorRef:Se,storageKey:Gt(n),legacyStorageKey:ft(n),width:xe.width??`min(960px, 60vw)`,children:()=>(0,Q.jsx)(`div`,{className:`px-6 pt-6 pb-6`,children:(0,Q.jsx)(pS,{record:r,objectName:n,recordId:i,dataSource:t,objectSchema:w,onClose:xe.close,fullPageHref:mS(n,i)??void 0,onFieldSave:async(e,r)=>{t?.update&&(await t.update(n,String(i),{[e]:r}),y(t=>t.map(t=>String(t.id??t._id)===String(i)?{...t,[e]:r}:t)))},onDelete:async()=>{t?.delete&&(await t.delete(n,String(i)),y(e=>e.filter(e=>String(e.id??e._id)!==String(i))))}})})})},Pe=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(CS.Provider,{value:F,children:(0,Q.jsx)(TS.Provider,{value:_e,children:(0,Q.jsx)(kS.Provider,{value:de,children:(0,Q.jsx)(bS,{objectFields:w?.fields,onCardMove:Ae?je:void 0,cardsMovable:Ae,schema:{...ye,countsAreWindowed:fe,onCardClick:(e,t)=>{Ce(t),xe.handleClick(e,t)}}})})})}),Ee&&(0,Q.jsx)(SS,{open:!0,fields:Me,submitting:Oe,onCancel:()=>De(null),onSubmit:async e=>{let t=Ee;ke(!0);try{await Te(t.cardId,t.fromColumnId,t.toColumnId,e)}finally{ke(!1),De(null)}}})]});if(xe.isOverlay&&xe.mode===`split`&&xe.isOpen&&xe.selectedRecord){let e=Ne(Pe);if(e)return(0,Q.jsx)(Q.Fragment,{children:e})}return(0,Q.jsxs)(Q.Fragment,{children:[Pe,Ne()]})},KS=(...e)=>e.filter(Boolean).join(` `),qS=`outside`,JS=$.forwardRef(({id:e,value:t,options:n,onPick:r,className:i},a)=>{let o=String(t??``),s=n.findIndex(e=>e.value===o);return(0,Q.jsxs)(M,{value:s===-1?qS:String(s),onValueChange:e=>{let t=n[Number(e)];t&&r(t.value)},children:[(0,Q.jsx)(V,{ref:a,id:e,className:KS(i,`px-2 py-1`),onKeyDown:e=>{e.key===`Enter`&&e.preventDefault()},children:(0,Q.jsx)(Je,{})}),(0,Q.jsxs)(ie,{onKeyDown:e=>e.stopPropagation(),children:[s===-1&&(0,Q.jsx)(un,{value:qS,children:o}),n.map((e,t)=>(0,Q.jsx)(un,{value:String(t),children:e.label},`${t}:${e.value}`))]})]})});JS.displayName=`QuickAddPicker`;var YS=`__uncolumned__`;function XS(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 ZS(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 XS(u,s,e,n),d.length>0&&c.push({id:YS,title:i,cards:d}),c}var QS={filter:!0,sort:!0,limit:`limit`},$S=e=>Array.isArray(e)&&e.some(e=>Array.isArray(e?.cards)),eC=y(({schema:e,...t})=>{let{dataSource:n}=le()||{},r=n??void 0,{t:i}=tr();return(0,Q.jsx)(lt,{schema:e,mapping:QS,dataSource:r,testId:`object-kanban`,errorTitle:i(`element.board.sourceUnresolved`,{defaultValue:`This board’s data source could not be resolved`}),requiresObject:e?.data==null&&e?.bind==null&&!Array.isArray(t.data)&&!$S(e?.columns),children:e=>(0,Q.jsx)(GS,{schema:e,dataSource:r,...t})})});De.register(`object-kanban`,eC,{namespace:`plugin-kanban`,label:`Object Kanban`,category:`view`,inputs:[{name:`objectName`,type:`string`,description:"Object this board lists. Not required: the node's `dataSource` binding can name the object instead, and `dataSource.object` lands on this key, outranking an authored value. With neither, and no rows from `data`, `bind` or a parent view, the board shows a hint naming this key instead of an empty board."},{name:`columns`,type:`array`},{name:`filter`,type:`array`,description:"Base query filter — the `ViewFilterRule` array `[{ field, operator, value }, ...]`, 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 tC=new Set([`bar`,`column`,`horizontal-bar`,`line`,`area`,`pie`,`donut`,`funnel`,`radar`,`scatter`,`treemap`,`sankey`,`combo`]),nC=new Set([`gauge`,`solid-gauge`,`metric`,`kpi`,`bullet`]),rC=new Set([`table`,`pivot`]),iC=new Set([...tC,...nC,...rC]),aC=new Map([[`chart:bar`,`bar`]]),oC=`plugin-charts:`;function sC(e){if(!e)return;let t=e.startsWith(oC)?e.slice(14):e;return aC.get(t)}function cC(e){return e.length>0&&e.every(e=>ra(e.aggregate))}var lC=e=>!!e&&typeof e==`object`&&!Array.isArray(e),uC=e=>typeof e==`string`&&e?e:void 0,dC=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0;function fC(e,t){if(typeof e==`string`||lC(e))return rr(e,t)||void 0}function pC(e,t){if(!lC(e))return;let n={},r=uC(e.field);r&&(n.field=r);let i=uC(e.format);i&&(n.format=i);let a=dC(e.min);a!==void 0&&(n.min=a);let o=dC(e.max);o!==void 0&&(n.max=o);let s=dC(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=uC(e.position);(c===`left`||c===`right`||c===`top`||c===`bottom`)&&(n.position=c);let l=fC(e.title,t);return l&&(n.title=l),n}function mC(e,t){if(!lC(e)){let t=uC(e);return t?{dataKey:t}:void 0}let n=uC(e.dataKey)??uC(e.name);if(!n)return;let r={dataKey:n},i=fC(e.label,t);i&&(r.label=i);let a=uC(e.chartType)??uC(e.type);(a===`bar`||a===`line`||a===`area`)&&(r.chartType=a);let o=uC(e.variant);(o===`comparison`||o===`current`||o===`primary`)&&(r.variant=o);let s=dC(e.opacity);s!==void 0&&(r.opacity=s);let c=uC(e.dashArray);c&&(r.dashArray=c);let l=uC(e.stack);l&&(r.stack=l);let u=uC(e.yAxis);(u===`left`||u===`right`)&&(r.yAxis=u);let d=uC(e.color);d&&(r.color=d);let f=uC(e.aggregate);return f&&(r.aggregate=f),r}function hC(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 gC(e,t){if(!lC(e))return{};let n={},r=uC(e.type),i=uC(e.chartType)??uC(e.specType)??(r&&iC.has(r)?r:void 0)??sC(r);i&&(n.chartType=i);let a=e.xAxis,o=pC(a,t);o&&Object.keys(o).some(e=>e!==`field`)&&(n.xAxis=o);let s=uC(e.xAxisKey)??o?.field??uC(a);s&&(n.xAxisKey=s);let c=(Array.isArray(e.yAxis)?e.yAxis:e.yAxis===void 0?[]:[e.yAxis]).map(e=>pC(e,t)??(uC(e)?{field:uC(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=>mC(e,t)).filter(e=>!!e);if(!l?.length){let e=hC(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=fC(e.title,t);u&&(n.title=u);let d=fC(e.subtitle,t);d&&(n.subtitle=d);let f=fC(e.description,t);f&&(n.description=f);let p=dC(e.height);return p!==void 0&&p>0&&(n.height=p),Array.isArray(e.annotations)&&e.annotations.length&&(n.annotations=e.annotations.filter(lC)),lC(e.interaction)&&(n.interaction=e.interaction),n}function _C(e){if(e===`bar`||e===`column`)return`bar`;if(e===`line`)return`line`;if(e===`area`)return`area`}function vC(e,t){if(e===`combo`)return`combo`;let n=_C(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 yC(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 bC=200;function xC(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>bC)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 SC(e){if(!e)return;let{min:t,max:n}=e;if(t!==void 0||n!==void 0)return[t??`auto`,n??`auto`]}var CC=$.lazy(()=>Z(()=>import(`./ChartImpl-07YoXw1-.js`),[])),wC=$.lazy(()=>Z(()=>import(`./AdvancedChartImpl-PhZEnfsm.js`),[])),TC=({schema:e})=>(0,Q.jsx)($.Suspense,{fallback:(0,Q.jsx)(xe,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,Q.jsx)(CC,{data:e.data,dataKey:e.dataKey,xAxisKey:e.xAxisKey,height:e.height,className:e.className,color:e.color})}),EC=({schema:e,onChartClick:t})=>{let{language:n}=tr(),r=$.useMemo(()=>{let t=gC(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)(xe,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,Q.jsx)(wC,{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 DC(e){return ka(e,e.function||`count`)}var OC=[`aggregate.groupBy`,`xAxisKey`,`xAxis.field`];function kC(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:gC(e).xAxisKey}var AC=`__comparison`;function jC(e){let t=e?.groupBy;return t&&typeof t==`object`&&!Array.isArray(t)?t.alias||t.field:typeof t==`string`?t:void 0}function MC(e,t){let{field:n,function:r,groupBy:i}=t,a=DC(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 NC(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:Ga(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=Ga(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]||Ga(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=Di(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:Ga(r),[o]:n}})}var PC=e=>{let{schema:t}=e,n=e.onSegmentClick,r=(0,$.useContext)(u),i=e.dataSource||r?.dataSource,a=r?.apiFetch,o=Rt(t.bind),{fieldOptionLabel:s}=v(),[l,d]=(0,$.useState)([]),[f,m]=(0,$.useState)(null),[h,g]=(0,$.useState)(void 0),[_,y]=(0,$.useState)(()=>!(Array.isArray(t.data)&&t.data.length>0)&&(!!t.objectName||!!t.dataset)),[b,x]=(0,$.useState)(null),[S,C]=(0,$.useState)(null),[w,T]=(0,$.useState)(null),{openRecordList:E}=c(),D=Kn(),{t:O,language:k}=tr(),ee=(0,$.useMemo)(()=>gC(t,k).chartType,[t,k]),A=(0,$.useMemo)(()=>t.aggregate?JSON.stringify(t.aggregate):``,[t.aggregate]),M=(0,$.useMemo)(()=>t.filter?JSON.stringify(t.filter):``,[t.filter]),N=(0,$.useMemo)(()=>t.compareTo?JSON.stringify(t.compareTo):``,[t.compareTo]),P=(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`},o=t.objectName,s,c=null;if(o)s=kC(t);else if(t.dataset){let e=Array.isArray(t.dimensions)&&t.dimensions.length?t.dimensions[0]:void 0,i=await(await n(`/api/v1/meta/dataset/${encodeURIComponent(t.dataset)}`,r)).json().catch(()=>null);c=i?.item??i?.data??i,o=c?.object,s=((c?.dimensions||[]).find(t=>t?.name===e)??(c?.dimensions||[])[0])?.field??e}if(!o||!s){e||T(null);return}let l=typeof i?.getObjectSchema==`function`?e=>i.getObjectSchema(e):async e=>{let t=await(await n(`/api/v1/meta/object/${encodeURIComponent(e)}`,r)).json().catch(()=>null);return t?.item??t?.data??t},u={};if(t.dataset&&Array.isArray(t.dimensions))for(let e of t.dimensions)u[e]=(c?.dimensions||[]).find(t=>t?.name===e)?.field??e;let d=await Oa(l,o,[s,...Object.values(u)]);e||T({metaByPath:d,colorPath:s,fieldByDim:t.dataset&&Array.isArray(t.dimensions)?u:null})}catch{e||T(null)}})(),()=>{e=!0}},[t.objectName,t.dataset,P,A,t.xAxisKey,a,i]);let{fieldOptionColors:L,dimensionLabels:te}=(0,$.useMemo)(()=>{if(!w)return{fieldOptionColors:null,dimensionLabels:null};let{metaByPath:e,colorPath:t,fieldByDim:n}=w,r=ba(e[t]?.options,Ea(e[t],s)),i=Da(e,n?Object.entries(n).map(([e,t])=>({dim:e,path:t})):null,s);return{fieldOptionColors:_a(r),dimensionLabels:i}},[w,s]),ne=(0,$.useCallback)(async(e,n)=>{if(t.aggregate&&typeof e.aggregate==`function`){let r=t.aggregate.groupBy;if(Aa(r)){let i=await e.aggregate(t.objectName,ja(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=Di(await e.find(t.objectName,{$filter:n})),i=jC(t.aggregate);return t.aggregate&&i&&r.length>0&&(r=MC(r,{...t.aggregate,groupBy:i})),r}return[]},[t.objectName,A]),R=At(),z=(0,$.useCallback)(async(e,n)=>{if(!e||!t.objectName&&!t.dataset){n.current&&y(!1);return}n.current&&(y(!0),x(null));try{if(t.dataset&&typeof e.queryDataset==`function`){let r=I(t.filter,R),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&&(d(Array.isArray(i?.rows)?i.rows:[]),m(Array.isArray(i?.fields)?i.fields:null),g(typeof i?.object==`string`&&i.object?i.object:void 0));return}let r=I(t.filter,R),i=t.compareTo,a=!!i&&!Na(ee),o=a?Re(Zi(t.filter,i),R):null,[c,l]=await Promise.all([ne(e,r),o?ne(e,o):Promise.resolve([])]),u=c,f=jC(t.aggregate)||t.xAxisKey;if(a&&l.length>0&&t.aggregate){let e=t.aggregate.field,n=t.aggregate.function,r=DC(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}${AC}`,o=f;if(o&&u.some(e=>e[o]!=null)&&l.some(e=>e[o]!=null)){let e=new Map;for(let t of l){let n=String(t[o]??``);e.set(n,i(t))}u=u.map(t=>{let n=String(t[o]??``),r=e.get(n);return r==null?t:{...t,[a]:r}});let t=new Set(u.map(e=>String(e[o]??``)));for(let e of l){let n=String(e[o]??``);t.has(n)||u.push({[o]:n,[a]:i(e)})}}else{let e=Math.max(u.length,l.length),t=[];for(let n=0;n<e;n++){let e=u[n]||{},r=l[n];t.push(r?{...e,[a]:i(r)}:e)}u=t}}if(f&&t.objectName&&typeof e.getObjectSchema==`function`){let n=t.objectName;try{let t=await e.getObjectSchema(n);u=await NC(u,f,t,e,(e,t)=>s(n,f,e,t))}catch{}}n.current&&d(u)}catch(e){console.error(`[ObjectChart] Fetch error:`,e),n.current&&x(e instanceof Error?e.message:`Failed to load chart data`)}finally{n.current&&y(!1)}},[t.objectName,P,A,M,N,t.xAxisKey,ee,ne,R,s]),B=!!o||Array.isArray(t.data),V=!!t.objectName&&!t.dataset&&!B,re=V&&!kC(t),ie=!!(t.objectName||t.dataset)&&!o&&!t.data&&!re,ae=fn(ie?t.dataset?h:t.objectName:void 0);(0,$.useEffect)(()=>{let e={current:!0};return ie?z(i,e):e.current&&y(!1),()=>{e.current=!1}},[t.objectName,P,i,o,t.data,M,A,N,z,ae,ie]);let H=o||t.data||l,oe=Array.isArray(H)?H:[],se=t.drillDown,U=jC(t.aggregate)||t.xAxisKey,ce=(0,$.useMemo)(()=>{if(!U)return new Map;let e=new Map,t=`__raw_${U}`;for(let n of oe){let r=n?.[U];if(r==null)continue;let i=t in(n||{})?n[t]:r;e.set(String(r),i)}return e},[oe,U]),le=(0,$.useMemo)(()=>{if(S)try{return{ok:!0,filter:Ji(t.filter,Gi(se,S,{groupByField:U}))}}catch(e){if(!(e instanceof je))throw e;return{ok:!1,refusal:e}}},[S,se,U,M]),W=le?.ok?le.filter:void 0,ue=le?.ok===!1,de=le?.ok===!1?le.refusal.message:void 0;(0,$.useEffect)(()=>{de&&console.warn(`[ObjectChart] drill-down refused — the drilled list cannot be scoped: ${de}`)},[de]);let G=!n&&!!S&&!ue&&!!t.objectName&&se?.target===`navigate`&&!!E;(0,$.useEffect)(()=>{G&&(E(t.objectName,W),C(null))},[G]);let fe=t.compareTo,pe=t.aggregate?DC(t.aggregate):void 0,me=pe?`${pe}${AC}`:void 0,K=!!fe&&!Na(ee)&&!!me&&oe.some(e=>e[me]!=null),he=(0,$.useMemo)(()=>{let e=Array.isArray(t.series)?t.series:null;if(!K)return e;let n=e||[{dataKey:pe}],r={vsLastWeek:`Previous week`,vsLastMonth:`Previous month`,vsLastQuarter:`Previous quarter`,vsLastYear:`Previous year`,vsYesterday:`Yesterday`,vsPreviousPeriod:`Previous period`}[Qi(fe,t.filter)]||`Previous period`;return[...n.map(e=>({...e,variant:e.variant||`current`})),{dataKey:me,label:r,variant:`comparison`}]},[K,t.series,pe,me,t.filter,fe]),ge=t.dataset?ha(ga(oe,te),t.dimensions,t.values,f,{nullCategoryLabel:D(`chart.nullCategory`,`(None)`),builtinAggregateLabels:Ka(D)}):null,q=V&&!gC(t,k).xAxisKey?jC(t.aggregate):void 0,J=ge?{...t,data:ge.data,xAxisKey:ge.xAxisKey,series:ge.series}:{...t,data:oe,...q?{xAxisKey:q}:{},...he?{series:he}:{}},_e=t.colors&&!Array.isArray(t.colors)&&typeof t.colors==`object`?t.colors:null,ve=Array.isArray(t.colors)?t.colors:void 0,ye=L||_e?{...L||{},..._e||{}}:void 0,Y={...J,colors:ve,...ye?{categoryColors:ye}:{}};if(re)return(0,Q.jsxs)(`div`,{className:`p-4 text-destructive `+(t.className||``),"data-testid":`chart-missing-category-axis`,role:`alert`,children:[D(`chart.unconfigured.noCategoryAxis`,`Chart category axis required — an object-bound chart will not invent one. Declare one of:`),` `,OC.map((e,t)=>(0,Q.jsxs)($.Fragment,{children:[t>0?`, `:``,(0,Q.jsx)(`code`,{className:`font-mono`,children:e})]},e))]});if(_&&oe.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)(rn,{className:`h-full`})]});if(b)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)(br,{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:b})]});if(!i&&t.objectName&&oe.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&&oe.length===0)return(0,Q.jsx)(Nt,{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)(jr,{className:`h-5 w-5 text-muted-foreground/70`}),iconWrapperClassName:`flex size-9 items-center justify-center rounded-lg bg-muted`,title:D(`dashboard.empty.title`,`No data yet`),description:D(`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:D(`dashboard.empty.sourceLabel`,`Source:`)}),` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:t.dataset||t.objectName})]})});let be=qi(se)?e=>{let t=e.category,n=t!=null&&ce.has(String(t))?ce.get(String(t)):t;C({...e,category:n,categoryLabel:t,scope:`cell`})}:void 0,xe=n??be,Se=!n&&S&&!ue&&t.objectName&&!G?(()=>{let e=W??{},n=Ki(se,S,rr(t.title,k)||`Details`),r=se?.target??`drawer`,a={type:`object-data-table`,objectName:t.objectName,filter:e,pagination:!0,pageSize:se?.maxRows,columns:se?.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)(On,{schema:a,dataSource:i})}),s=E&&t.objectName?(0,Q.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`drill-open-in-list`,onClick:()=>{E(t.objectName,e),C(null)},children:[D(`dashboard.openInList`,`Open in list`),(0,Q.jsx)(to,{className:`ml-1 h-3.5 w-3.5`})]}):null;return r===`dialog`?(0,Q.jsx)(It,{open:!0,onOpenChange:e=>!e&&C(null),children:(0,Q.jsxs)(st,{className:`max-w-4xl`,children:[(0,Q.jsxs)(ht,{className:`flex-row items-center justify-between gap-4 pr-8`,children:[(0,Q.jsx)(Jt,{children:n}),s]}),o]})}):(0,Q.jsx)(p,{open:!0,onOpenChange:e=>!e&&C(null),children:(0,Q.jsxs)(Le,{side:`right`,className:`w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col`,children:[(0,Q.jsxs)(F,{className:`flex-row items-center justify-between gap-4 pr-8`,children:[(0,Q.jsx)(Ne,{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)(it,{active:_&&oe.length>0,ariaLabel:O(`chart.refreshing`)}),(0,Q.jsx)(EC,{...e,schema:Y,onChartClick:xe}),Se]})},FC={filter:!0},IC=e=>e.data==null&&e.bind==null&&Reflect.get(e,`dataset`)==null,LC=y(e=>{let{t}=tr();return(0,Q.jsx)(lt,{schema:e.schema,mapping:FC,dataSource:e.dataSource,testId:`object-chart`,errorTitle:t(`element.chart.sourceUnresolved`,{defaultValue:`This chart’s data source could not be resolved`}),requiresObject:IC(e.schema),children:t=>(0,Q.jsx)(PC,{...e,schema:t})})});De.register(`object-chart`,LC,{namespace:`plugin-charts`,label:`Object Chart`,category:`view`,inputs:[{name:`objectName`,type:`string`,description:"Object this chart aggregates. Not required: the node's `dataSource` binding can name the object instead, and `dataSource.object` lands on this key, outranking an authored value. With neither, and no inline `data`, the chart shows a hint naming this key instead of an empty frame."},{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.`}]}),De.register(`bar-chart`,TC,{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`}}),De.register(`chart`,LC,{namespace:`view`,category:`view`,label:`Chart`,skipFallback:!0,inputs:[{name:`objectName`,type:`string`,description:"Object this chart aggregates. Not required: the node's `dataSource` binding can name the object instead, and `dataSource.object` lands on this key, outranking an authored value. With neither, and no inline `data`, the chart shows a hint naming this key instead of an empty frame."},{name:`type`,type:`string`},{name:`categoryField`,type:`string`},{name:`valueField`,type:`string`}]}),De.register(`chart`,EC,{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`}]}}),De.register(`chart:bar`,EC,{namespace:`plugin-charts`,label:`Bar Chart (Alias)`,category:`plugin`});var RC=e=>e?Dn(e):null,zC=({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=RC(e.icon);return $.useEffect(()=>{o&&c(!0)},[o]),e.children&&e.children.length>0?(0,Q.jsxs)(En,{open:s,onOpenChange:c,className:`w-full`,children:[(0,Q.jsxs)(Tt,{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)(_r,{className:`h-4 w-4 transition-transform ${s?`rotate-180`:``}`})]}),(0,Q.jsx)(vt,{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)(zC,{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})]})},BC=({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=RC(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)(pr,{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)(zC,{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)(ns,{className:`h-5 w-5`})}),(0,Q.jsxs)(`div`,{className:`relative hidden md:block w-96`,children:[(0,Q.jsx)(Br,{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)(Rs,{className:`h-5 w-5`}):(0,Q.jsx)(cs,{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)(mo,{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})})]})]})},VC=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}},HC=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 UC(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 WC(){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 HC(e):new VC},[]);(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({},``,UC(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)(On,{schema:n}),e?(0,Q.jsx)(BC,{app:e,currentPath:i,onNavigate:d,children:f}):(0,Q.jsx)(`div`,{className:`object-ui-app`,children:f})}Hs.createRoot(document.getElementById(`root`)).render((0,Q.jsx)($.StrictMode,{children:(0,Q.jsx)(WC,{})}));export{va as $,os as A,Ao as B,Ds as C,hs as D,vs as E,Go as F,ho as G,wo as H,Ho as I,ao as J,fo as K,zo as L,es as M,Zo as N,fs as O,Jo as P,qa as Q,Io as R,As as S,xs as T,xo as U,Do as V,vo as W,$a as X,no as Y,Xa as Z,yd as _,SC as a,Is as b,hC as c,IS as d,ca as et,PS as f,wS as g,ES as h,_C as i,rs as j,ls as k,cC as l,OS as m,nC as n,vC as o,AS as p,co as q,rC as r,yC as s,tC as t,xC as u,vd as v,ws as w,Ns as x,zs as y,No as z};