PageSourceSearch

https://hormonexperten.de/_next/static/chunks/557a940c-bb0dfaa52a2b24f3.js

js hormonexperten.de collected 2026-10-07 05:05:13 UTC 759,342 bytes, 48 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a10d69-c813-7073-b111-5e69f8a48042")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2841],{68692:(e,t,n)=>{let a,l,r;n.r(t),n.d(t,{APIKeyGenerationModal:()=>gL,Account:()=>me,ActionsProvider:()=>ma,AnimateHeight:()=>l2,AppHeader:()=>m_,ArrayField:()=>hW,AuthProvider:()=>aw,Banner:()=>ti,BlockSelector:()=>rb,BlocksDrawer:()=>rv,BlocksField:()=>rk,BrowseByFolderButton:()=>bL,BulkUploadDrawer:()=>hx,BulkUploadProvider:()=>h_,Button:()=>tN,CalendarIcon:()=>d.m,Card:()=>mN,CheckIcon:()=>lW,CheckboxField:()=>lX,CheckboxInput:()=>lY,ChevronIcon:()=>to,ClientFunctionProvider:()=>vw,CloseMenuIcon:()=>ml,CodeBlockIcon:()=>vs,CodeEditor:()=>c.l,CodeEditorLazy:()=>r$,CodeField:()=>rP,Collapsible:()=>l7,CollapsibleField:()=>rA,Combobox:()=>bR,ConfigProvider:()=>c.b,ConfirmPasswordField:()=>hK,ConfirmationModal:()=>ag,CopyIcon:()=>tR,CopyLocaleData:()=>mD,CopyToClipboard:()=>pK,DateCell:()=>c2,DateCondition:()=>f$,DatePicker:()=>d.n,DateTimeField:()=>s3,DefaultBlockImage:()=>rp,DefaultBrowseByFolderView:()=>yv,DefaultCell:()=>dr,DefaultCollectionFolderView:()=>yu,DefaultEditView:()=>y0,DefaultListView:()=>v3,DeleteMany:()=>mz,DocumentControls:()=>gp,DocumentEventsProvider:()=>dU,DocumentFields:()=>u7,DocumentIcon:()=>bO,DocumentInfoProvider:()=>lT,DocumentLocked:()=>f6,DocumentTakeOver:()=>f1,DragHandleIcon:()=>l3,DraggableSortable:()=>nt,DraggableSortableItem:()=>ne,Drawer:()=>au,DrawerContentContainer:()=>pc,DrawerToggler:()=>ad,Dropzone:()=>uR,EditDepthProvider:()=>ns,EditIcon:()=>ts,EditMany:()=>gT,EditUpload:()=>pV,EmailAndUsernameFields:()=>vY,EmailField:()=>s2,EntityVisibilityProvider:()=>vT,ErrorIcon:()=>vm,ErrorPill:()=>na,ExternalLinkIcon:()=>m4,FieldContext:()=>lM,FieldDescription:()=>nr,FieldDiffContainer:()=>y2,FieldDiffLabel:()=>y1,FieldError:()=>ni,FieldLabel:()=>aD,FieldPathContext:()=>lF,File:()=>c6,FileDetails:()=>pZ,FolderFileTable:()=>bX,FolderIcon:()=>u9,FolderProvider:()=>pt,FolderTypeField:()=>bF,Form:()=>ub,FormLoadingOverlayToggle:()=>cT,FormSubmit:()=>pi,FullscreenModal:()=>gR,GearIcon:()=>vu,GenerateConfirmation:()=>gL,GridViewIcon:()=>vh,GroupByHeader:()=>bm,GroupByPageControls:()=>bC,GroupField:()=>ct,Gutter:()=>ai,Hamburger:()=>mo,HiddenField:()=>cn,HydrateAuthProvider:()=>gO,InfoIcon:()=>vg,ItemCardGrid:()=>b5,ItemsDrawer:()=>vr,JSONField:()=>dC,JoinField:()=>dj,LeaveWithoutSaving:()=>fX,LineIcon:()=>lK,Link:()=>tl,LinkIcon:()=>tc,ListControls:()=>gZ,ListDrawerContextProvider:()=>cr,ListHeader:()=>bh,ListQueryProvider:()=>cp,ListSelection:()=>g7,ListViewIcon:()=>vf,LivePreviewProvider:()=>vN,LivePreviewWindow:()=>yI,LoadingOverlay:()=>cE,LoadingOverlayToggle:()=>cD,LocaleProvider:()=>a_,Locked:()=>m6,LogOutIcon:()=>bP,Logout:()=>bE,MenuIcon:()=>mr,MinimizeMaximizeIcon:()=>vd,Modal:()=>nq,MoreIcon:()=>tA,MoveDocToFolder:()=>pP,MoveDocToFolderButton:()=>pD,MoveFolderIcon:()=>vp,NavContext:()=>mp,NavGroup:()=>bT,NavProvider:()=>mm,NavToggler:()=>mb,NullifyLocaleField:()=>lZ,NumberCondition:()=>fN,NumberField:()=>dS,OperationProvider:()=>lR,OrderableTable:()=>fs,PageConfigProvider:()=>c.d,PageControls:()=>bw,PageControlsComponent:()=>bx,Pagination:()=>dg,ParamsProvider:()=>vL,PasswordField:()=>hG,PayloadIcon:()=>mv,PerPage:()=>bv,Pill:()=>ra,PillSelector:()=>cx,PlusIcon:()=>td,PointField:()=>d_,Popup:()=>tC,PopupList:()=>tp,PreferencesProvider:()=>lC,PreviewButton:()=>m8,PreviewSizes:()=>p3,ProgressBar:()=>vE,PublishButton:()=>ga,PublishMany:()=>g0,QueryPresetsAccessCell:()=>fu,QueryPresetsColumnField:()=>f_,QueryPresetsColumnsCell:()=>fc,QueryPresetsGroupByCell:()=>fC,QueryPresetsGroupByField:()=>fY,QueryPresetsWhereCell:()=>fd,QueryPresetsWhereField:()=>fq,RadioGroupField:()=>dE,ReactSelect:()=>sZ,RelationshipCondition:()=>fR,RelationshipField:()=>d8,RelationshipInput:()=>d4,RelationshipProvider:()=>cY,RelationshipTable:()=>dy,RenderCustomComponent:()=>em,RenderDefaultCell:()=>
1dd,RenderFields:()=>hU,RenderTitle:()=>b9,RichTextField:()=>d7,RootProvider:()=>vQ,RouteCacheProvider:()=>pl,RouteTransitionProvider:()=>e7,RowField:()=>d9,RowLabel:()=>eq,RowLabelProvider:()=>eV,SaveButton:()=>gi,SaveDraftButton:()=>go,ScrollInfoProvider:()=>vB,SearchFilter:()=>gQ,SearchIcon:()=>rh,SearchParamsProvider:()=>vq,SectionTitle:()=>rw,Select:()=>sZ,SelectAll:()=>vX,SelectCondition:()=>fL,SelectField:()=>un,SelectInput:()=>ue,SelectMany:()=>v0,SelectRow:()=>vJ,SelectionProvider:()=>mF,ServerFunctionsContext:()=>ch,ServerFunctionsProvider:()=>cm,SetDocumentStepNav:()=>yG,SetDocumentTitle:()=>yX,SetStepNav:()=>mj,ShimmerEffect:()=>c.f,SlugField:()=>vi,SortColumn:()=>vt,SortHeader:()=>fn,SortRow:()=>fl,Spinner:()=>bN,StaggeredShimmers:()=>c.g,StickyToolbar:()=>bj,SuccessIcon:()=>vb,SwapIcon:()=>tu,TabComponent:()=>uy,Table:()=>m9,TableColumnsProvider:()=>cv,TabsField:()=>uw,TabsProvider:()=>s8,TextCondition:()=>fO,TextField:()=>u_,TextInput:()=>uC,TextareaField:()=>uN,TextareaInput:()=>u$,ThemeProvider:()=>c.i,Thumbnail:()=>c8,TimezonePicker:()=>s0,Tooltip:()=>tk,Translation:()=>pu,TranslationProvider:()=>d.c,UIField:()=>uP,UnpublishButton:()=>gd,UnpublishMany:()=>g4,Upload:()=>p7,UploadEditsProvider:()=>l_,UploadField:()=>hI,UploadHandlersProvider:()=>us,UploadInput:()=>hM,ViewDescription:()=>f5,WarningIcon:()=>vv,WatchChildErrors:()=>rD,WatchCondition:()=>lz,WindowInfoProvider:()=>vU,XIcon:()=>d.a,allFieldComponents:()=>hZ,defaultTheme:()=>c.h,documentDrawerBaseClass:()=>cI,escapeDiffHTML:()=>gy,fieldBaseClass:()=>lH,fieldComponents:()=>hX,fieldReducer:()=>um,formatDrawerSlug:()=>ac,formatTimeToNow:()=>lf,getHTMLDiffComponents:()=>gj,isFieldRTL:()=>lq,parseSearchParams:()=>co,toast:()=>e3,unescapeDiffHTML:()=>gx,useActions:()=>mn,useAddClientFunction:()=>vj,useAllFormFields:()=>ez,useAuth:()=>aj,useBulkUpload:()=>h$,useBulkUploadDrawerSlug:()=>hN,useCellProps:()=>dc,useClickOutside:()=>g_,useClickOutsideContext:()=>gk,useClientFunctions:()=>vC,useCollapsible:()=>l4,useConfig:()=>c.c,useControllableState:()=>c.a,useDebounce:()=>cW,useDebouncedCallback:()=>dI,useDebouncedEffect:()=>ui,useDelay:()=>c.e,useDelayedRender:()=>cC,useDocumentDrawer:()=>cV,useDocumentDrawerContext:()=>cO,useDocumentEvents:()=>dV,useDocumentForm:()=>eA,useDocumentInfo:()=>lE,useDocumentTitle:()=>ly,useDraggableSortable:()=>t9,useDrawerSlug:()=>ao,useEditDepth:()=>nc,useEffectEvent:()=>tv,useEntityVisibility:()=>vA,useField:()=>lI,useFieldPath:()=>lO,useFolder:()=>pn,useForm:()=>
1eT,useFormBackgroundProcessing:()=>eO,useFormFields:()=>eB,useFormInitializing:()=>eI,useFormModified:()=>eM,useFormProcessing:()=>eF,useFormSubmitted:()=>eL,useHotkey:()=>h3,useIntersect:()=>tS,useListDrawer:()=>dO,useListDrawerContext:()=>ci,useListQuery:()=>cc,useListRelationships:()=>cG,useLivePreviewContext:()=>mH,useLocale:()=>aN,useModal:()=>nN,useNav:()=>mh,useOperation:()=>lL,useParams:()=>vF,usePayloadAPI:()=>h4,usePreferences:()=>lS,useQueue:()=>dB,useResize:()=>h8,useRouteCache:()=>pr,useRouteTransition:()=>te,useRowLabel:()=>eH,useScrollInfo:()=>vM,useSearchParams:()=>vW,useSelection:()=>mO,useServerFunctions:()=>cf,useStepNav:()=>my,useTableColumns:()=>cb,useTheme:()=>c.j,useThrottledEffect:()=>aR,useTranslation:()=>d.d,useUploadControls:()=>uT,useUploadEdits:()=>l$,useUploadHandlers:()=>uc,useUseTitleField:()=>h7,useWatchForm:()=>eR,useWindowInfo:()=>vV,withCondition:()=>lU});var i,o=n(59947),s=n(77418),c=n(9231),d=n(54759),u=n(41004),p=n(31835),h=n(62625),f=n(60664),m=n(25325),g=n(66173),b=n(78796),v=n(63984),y=n(62496),x=n(19214),w=n(189),j=n(8451),C=n(95393),S=n(44612),k=n(85717),_=n(36501),$=n(55439),N=n(18104),P=n(59467),E=n(33503),D=n(14530),T=n(46076),A=n(23954),R=n(64261),L=n(89531),F=n(61983),O=n(13762),M=n(94759),I=n(13899),B=n(46745),z=n(94223),U=n(66116),V=n(44309),H=n(90148),q=n(29749),W=n(29110);n(86134);var K=n(29529),Q=n(44671),Y=n(80772),G=n(58727),X=n(63922),Z=n(27956),J=n(80005),ee=n(38833),et=n(61196),en=n(21051),ea=n(67443).hp,el=(0,u.c)(e=>{function t(e,t){var n=e.length;for(e.push(t);0<n;){var a=n-1>>>1,r=e[a];if(0<l(r,t))e[a]=t,e[n]=r,n=a;else break}}function n(e){return 0===e.length?null:e[0]}function a(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;for(var a=0,r=e.length,i=r>>>1;a<i;){var o=2*(a+1)-1,s=e[o],c=o+1,d=e[c];if(0>l(s,n))c<r&&0>l(d,s)?(e[a]=d,e[c]=n,a=c):(e[a]=s,e[o]=n,a=o);else if(c<r&&0>l(d,n))e[a]=d,e[c]=n,a=c;else break}}return t}function l(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now?(s=performance,e.unstable_now=function(){return s.now()}):(d=(c=Date).now(),e.unstable_now=function(){return c.now()-d});var r,i,o,s,c,d,u=[],p=[],h=1,f=null,m=3,g=!1,b=!1,v=!1,y="function"==typeof setTimeout?setTimeout:null,x="function"==typeof clearTimeout?clearTimeout:null,w="u">typeof setImmediate?setImmediate:null;function j(e){for(var l=n(p);null!==l;){if(null===l.callback)a(p);else if(l.startTime<=e)a(p),l.sortIndex=l.expirationTime,t(u,l);else break;l=n(p)}}function C(e){if(v=!1,j(e),!b)if(null!==n(u))b=!0,E();else{var t=n(p);null!==t&&D(C,t.startTime-e)}}var S=!1,k=-1,_=5,$=-1;function N(){return!(e.unstable_now()-$<_)}function P(){if(S){var t=e.unstable_now();$=t;var l=!0;try{e:{b=!1,v&&(v=!1,x(k),k=-1),g=!0;var i=m;try{t:{for(j(t),f=n(u);null!==f&&!(f.expirationTime>t&&N());){var o=f.callback;if("function"==typeof o){f.callback=null,m=f.priorityLevel;var s=o(f.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof s){f.callback=s,j(t),l=!0;break t}f===n(u)&&a(u),j(t)}else a(u);f=n(u)}if(null!==f)l=!0;else{var c=n(p);null!==c&&D(C,c.startTime-t),l=!1}}break e}finally{f=null,m=i,g=!1}}}finally{l?r():S=!1}}}function E(){S||(S=!0,r())}function D(t,n){k=y(function(){t(e.unstable_now())},n)}"function"==typeof w?r=function(){w(P)}:"u">typeof MessageChannel?(o=(i=new MessageChannel).port2,i.port1.onmessage=P,r=function(){o.postMessage(null)}):r=function(){y(P,0)},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_continueExecution=function(){b||g||(b=!0,E())},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"):_=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(e){switch(m){case 1:case 2:case 3:var t=3;break;default:t=m}var n=m;m=t;try{return e()}finally{m=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=m;m=e;try{return t()}finally{m=n}},e.unstable_scheduleCallback=function(a,l,r){var i=e.unstable_now();switch(r="object"==typeof r&&null!==r&&"number"==typeof(r=r.delay)&&0<r?i+r:i,a){case 1:var o=-1;break;case 2:o=250;break;case 5:o=0x3fffffff;break;case 4:o=1e4;break;default:o=5e3}return o=r+o,a={id:h++,callback:l,priorityLevel:a,startTime:r,expirationTime:o,sortIndex:-1},r>i?(a.sortIndex=r,t(p,a),null===n(u)&&a===n(p)&&(v?(x(k),k=-1):v=!0,D(C,r-i))):(a.sortIndex=o,t(u,a),b||g||(b=!0,E())),a},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}}),er=(0,u.c)((e,t)=>{t.exports=el()}),ei=(0,u.c)((e,t)=>{var n=Math.floor(0xffffff*Math.random()),a=u.index=parseInt(0xffffff*Math.random(),10),l=(typeof en>"u"||"number"!=typeof en.pid?Math.floor(1e5*Math.random()):en.pid)%65535,r=(()=>{try{return _Buffer}catch{try{return ea}catch{return null}}})(),i=function(e){return!!(null!=e&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e))},o=[];for(s=0;s<256;s++)o[s]=(s<=15?"0":"")+s.toString(16);var s,c=RegExp("^[0-9a-fA-F]{24}$"),d=[];for(s=0;s<10;)d[48+s]=s++;for(;s<16;)d[55+s]=d[87+s]=s++;function u(e){if(!(this instanceof u))return new u(e);
1if(e&&(e instanceof u||"ObjectID"===e._bsontype))return e;if(this._bsontype="ObjectID",null==e||"number"==typeof e){this.id=this.generate(e);return}var t=u.isValid(e);if(!t&&null!=e)throw Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(t&&"string"==typeof e&&24===e.length)return u.createFromHexString(e);if(null!=e&&12===e.length)this.id=e;else{if(null!=e&&"function"==typeof e.toHexString)return e;throw Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters")}}t.exports=u,u.default=u,u.createFromTime=function(e){var t;return new u((8===(t=(t=e=parseInt(e,10)%0xffffffff).toString(16)).length?t:"00000000".substring(t.length,8)+t)+"0000000000000000")},u.createFromHexString=function(e){if(typeof e>"u"||null!=e&&24!==e.length)throw Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");for(var t="",n=0;n<24;)t+=String.fromCharCode(d[e.charCodeAt(n++)]<<4|d[e.charCodeAt(n++)]);return new u(t)},u.isValid=function(e){return null!=e&&("number"==typeof e||("string"==typeof e?12===e.length||24===e.length&&c.test(e):e instanceof u||(i(e)?u.isValid(e.toString("hex")):"function"==typeof e.toHexString&&!!r&&(e.id instanceof r||"string"==typeof e.id)&&(12===e.id.length||24===e.id.length&&c.test(e.id)))))},u.prototype={constructor:u,toHexString:function(){if(!this.id||!this.id.length)throw Error("invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is ["+JSON.stringify(this.id)+"]");if(24===this.id.length)return this.id;if(i(this.id))return this.id.toString("hex");for(var e="",t=0;t<this.id.length;t++)e+=o[this.id.charCodeAt(t)];return e},equals:function(e){return e instanceof u?this.toString()===e.toString():"string"==typeof e&&u.isValid(e)&&12===e.length&&i(this.id)?e===this.id.toString("binary"):"string"==typeof e&&u.isValid(e)&&24===e.length?e.toLowerCase()===this.toHexString():"string"==typeof e&&u.isValid(e)&&12===e.length?e===this.id:null!=e&&(e instanceof u||!!e.toHexString)&&e.toHexString()===this.toHexString()},getTimestamp:function(){var e,t=new Date;return e=i(this.id)?this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24:this.id.charCodeAt(3)|this.id.charCodeAt(2)<<8|this.id.charCodeAt(1)<<16|this.id.charCodeAt(0)<<24,t.setTime(1e3*Math.floor(e)),t},generate:function(e){"number"!=typeof e&&(e=~~(Date.now()/1e3)),e=parseInt(e,10)%0xffffffff;var t=a=(a+1)%0xffffff;return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e,n>>16&255,n>>8&255,255&n,l>>8&255,255&l,t>>16&255,t>>8&255,255&t)}};var p=Symbol&&Symbol.for&&Symbol.for("nodejs.util.inspect.custom")||"inspect";u.prototype[p]=function(){return"ObjectID("+this+")"},u.prototype.toJSON=u.prototype.toHexString,u.prototype.toString=u.prototype.toHexString}),eo=(0,u.c)(e=>{var t="function"==typeof Symbol&&Symbol.for,n=t?Symbol.for("react.element"):60103,a=t?Symbol.for("react.portal"):60106,l=t?Symbol.for("react.fragment"):60107,r=t?Symbol.for("react.strict_mode"):60108,i=t?Symbol.for("react.profiler"):60114,o=t?Symbol.for("react.provider"):60109,s=t?Symbol.for("react.context"):60110,c=t?Symbol.for("react.async_mode"):60111,d=t?Symbol.for("react.concurrent_mode"):60111,u=t?Symbol.for("react.forward_ref"):60112,p=t?Symbol.for("react.suspense"):60113,h=t?Symbol.for("react.suspense_list"):60120,f=t?Symbol.for("react.memo"):60115,m=t?Symbol.for("react.lazy"):60116,g=t?Symbol.for("react.block"):60121,b=t?Symbol.for("react.fundamental"):60117,v=t?Symbol.for("react.responder"):60118,y=t?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case c:case d:case l:case i:case r:case p:return e;default:switch(e=e&&e.$$typeof){case s:case u:case m:case f:case o:return e;default:return t}}case a:return t}}}function w(e){return x(e)===d}e.AsyncMode=c,e.ConcurrentMode=d,e.ContextConsumer=s,e.ContextProvider=o,e.Element=n,e.ForwardRef=u,e.Fragment=l,e.Lazy=m,e.Memo=f,e.Portal=a,e.Profiler=i,e.StrictMode=r,e.Suspense=p,e.isAsyncMode=function(e){return w(e)||x(e)===c},e.isConcurrentMode=w,e.isContextConsumer=function(e){return x(e)===s},e.isContextProvider=function(e){return x(e)===o},e.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},e.isForwardRef=function(e){return x(e)===u},e.isFragment=function(e){return x(e)===l},e.isLazy=function(e){return x(e)===m},e.isMemo=function(e){return x(e)===f},e.isPortal=function(e){return x(e)===a},e.isProfiler=function(e){return x(e)===i},e.isStrictMode=function(e){return x(e)===r},e.isSuspense=function(e){return x(e)===p},e.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===l||e===d||e===i||e===r||e===p||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===f||e.$$typeof===o||e.$$typeof===s||e.$$typeof===u||e.$$typeof===b||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=x}),es=(0,u.c)((e,t)=>{t.exports=eo()}),ec=(0,u.c)((e,t)=>{var n=es(),a={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},l={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};function o(e){return n.isMemo(e)?r:i[e.$$typeof]||a}i[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i[n.Memo]=r;var s=Object.defineProperty,c=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,u=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,h=Object.prototype;
1t.exports=function e(t,n,a){if("string"!=typeof n){if(h){var r=p(n);r&&r!==h&&e(t,r,a)}var i=c(n);d&&(i=i.concat(d(n)));for(var f=o(t),m=o(n),g=0;g<i.length;++g){var b=i[g];if(!l[b]&&!(a&&a[b])&&!(m&&m[b])&&!(f&&f[b])){var v=u(n,b);try{s(t,b,v)}catch{}}}}return t}}),ed=(0,u.c)((e,t)=>{function n(e){return void 0===e}function a(e){return e===Object(e)}function l(e){return Array.isArray(e)}function r(e,t){return t?a(e)&&!n(e.uri):a(e)&&"number"==typeof e.size&&"string"==typeof e.type&&"function"==typeof e.slice}function i(e){return!n(e)&&e}t.exports={serialize:function e(t,o,s,c){o=o||{},s=s||new FormData,o.indices=i(o.indices),o.nullsAsUndefineds=i(o.nullsAsUndefineds),o.booleansAsIntegers=i(o.booleansAsIntegers),o.allowEmptyArrays=i(o.allowEmptyArrays),o.noAttributesWithArrayNotation=i(o.noAttributesWithArrayNotation),o.noFilesWithArrayNotation=i(o.noFilesWithArrayNotation),o.dotsForObjectNotation=i(o.dotsForObjectNotation);let d="function"==typeof s.getParts;return n(t)||(null===t?o.nullsAsUndefineds||s.append(c,""):"boolean"==typeof t?o.booleansAsIntegers?s.append(c,+!!t):s.append(c,t):l(t)?t.length?t.forEach((t,n)=>{var l;let i=c+"["+(o.indices?n:"")+"]";(o.noAttributesWithArrayNotation||o.noFilesWithArrayNotation&&r(l=t,d)&&"string"==typeof l.name&&(a(l.lastModifiedDate)||"number"==typeof l.lastModified))&&(i=c),e(t,o,s,i)}):o.allowEmptyArrays&&s.append(o.noAttributesWithArrayNotation?c:c+"[]",""):t instanceof Date?s.append(c,t.toISOString()):a(t)&&!r(t,d)?Object.keys(t).forEach(n=>{let a=t[n];if(l(a))for(;n.length>2&&n.lastIndexOf("[]")===n.length-2;)n=n.substring(0,n.length-2);let r=c?o.dotsForObjectNotation?c+"."+n:c+"["+n+"]":n;e(a,o,s,r)}):s.append(c,t)),s}}}),eu=(0,u.c)((e,t)=>{var n,a;n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t.exports=a={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 0xff00ff&a.rotl(e,8)|0xff00ff00&a.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=a.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,a=0;n<e.length;n++,a+=8)t[a>>>5]|=e[n]<<24-a%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var t=[],a=0;a<e.length;a+=3)for(var l=e[a]<<16|e[a+1]<<8|e[a+2],r=0;r<4;r++)8*a+6*r<=8*e.length?t.push(n.charAt(l>>>6*(3-r)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/ig,"");for(var t=[],a=0,l=0;a<e.length;l=++a%4)0!=l&&t.push((n.indexOf(e.charAt(a-1))&Math.pow(2,-2*l+8)-1)<<2*l|n.indexOf(e.charAt(a))>>>6-2*l);return t}}}),ep=(0,u.c)((e,t)=>{var n={utf8:{stringToBytes:function(e){return n.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(n.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}};t.exports=n}),eh=(0,u.c)((e,t)=>{function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}t.exports=function(e){var t;return null!=e&&(n(e)||"function"==typeof(t=e).readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))||!!e._isBuffer)}}),ef=(0,u.c)((e,t)=>{var n,a,l,r,i;n=eu(),a=ep().utf8,l=eh(),r=ep().bin,(i=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?r.stringToBytes(e):a.stringToBytes(e):l(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var o=n.bytesToWords(e),s=8*e.length,c=0x67452301,d=-0x10325477,u=-0x67452302,p=0x10325476,h=0;h<o.length;h++)o[h]=(o[h]<<8|o[h]>>>
124)&0xff00ff|(o[h]<<24|o[h]>>>8)&0xff00ff00;o[s>>>5]|=128<<s%32,o[(s+64>>>9<<4)+14]=s;for(var f=i._ff,m=i._gg,g=i._hh,b=i._ii,h=0;h<o.length;h+=16){var v=c,y=d,x=u,w=p;c=f(c,d,u,p,o[h+0],7,-0x28955b88),p=f(p,c,d,u,o[h+1],12,-0x173848aa),u=f(u,p,c,d,o[h+2],17,0x242070db),d=f(d,u,p,c,o[h+3],22,-0x3e423112),c=f(c,d,u,p,o[h+4],7,-0xa83f051),p=f(p,c,d,u,o[h+5],12,0x4787c62a),u=f(u,p,c,d,o[h+6],17,-0x57cfb9ed),d=f(d,u,p,c,o[h+7],22,-0x2b96aff),c=f(c,d,u,p,o[h+8],7,0x698098d8),p=f(p,c,d,u,o[h+9],12,-0x74bb0851),u=f(u,p,c,d,o[h+10],17,-42063),d=f(d,u,p,c,o[h+11],22,-0x76a32842),c=f(c,d,u,p,o[h+12],7,0x6b901122),p=f(p,c,d,u,o[h+13],12,-0x2678e6d),u=f(u,p,c,d,o[h+14],17,-0x5986bc72),d=f(d,u,p,c,o[h+15],22,0x49b40821),c=m(c,d,u,p,o[h+1],5,-0x9e1da9e),p=m(p,c,d,u,o[h+6],9,-0x3fbf4cc0),u=m(u,p,c,d,o[h+11],14,0x265e5a51),d=m(d,u,p,c,o[h+0],20,-0x16493856),c=m(c,d,u,p,o[h+5],5,-0x29d0efa3),p=m(p,c,d,u,o[h+10],9,0x2441453),u=m(u,p,c,d,o[h+15],14,-0x275e197f),d=m(d,u,p,c,o[h+4],20,-0x182c0438),c=m(c,d,u,p,o[h+9],5,0x21e1cde6),p=m(p,c,d,u,o[h+14],9,-0x3cc8f82a),u=m(u,p,c,d,o[h+3],14,-0xb2af279),d=m(d,u,p,c,o[h+8],20,0x455a14ed),c=m(c,d,u,p,o[h+13],5,-0x561c16fb),p=m(p,c,d,u,o[h+2],9,-0x3105c08),u=m(u,p,c,d,o[h+7],14,0x676f02d9),d=m(d,u,p,c,o[h+12],20,-0x72d5b376),c=g(c,d,u,p,o[h+5],4,-378558),p=g(p,c,d,u,o[h+8],11,-0x788e097f),u=g(u,p,c,d,o[h+11],16,0x6d9d6122),d=g(d,u,p,c,o[h+14],23,-0x21ac7f4),c=g(c,d,u,p,o[h+1],4,-0x5b4115bc),p=g(p,c,d,u,o[h+4],11,0x4bdecfa9),u=g(u,p,c,d,o[h+7],16,-0x944b4a0),d=g(d,u,p,c,o[h+10],23,-0x41404390),c=g(c,d,u,p,o[h+13],4,0x289b7ec6),p=g(p,c,d,u,o[h+0],11,-0x155ed806),u=g(u,p,c,d,o[h+3],16,-0x2b10cf7b),d=g(d,u,p,c,o[h+6],23,0x4881d05),c=g(c,d,u,p,o[h+9],4,-0x262b2fc7),p=g(p,c,d,u,o[h+12],11,-0x1924661b),u=g(u,p,c,d,o[h+15],16,0x1fa27cf8),d=g(d,u,p,c,o[h+2],23,-0x3b53a99b),c=b(c,d,u,p,o[h+0],6,-0xbd6ddbc),p=b(p,c,d,u,o[h+7],10,0x432aff97),u=b(u,p,c,d,o[h+14],15,-0x546bdc59),d=b(d,u,p,c,o[h+5],21,-0x36c5fc7),c=b(c,d,u,p,o[h+12],6,0x655b59c3),p=b(p,c,d,u,o[h+3],10,-0x70f3336e),u=b(u,p,c,d,o[h+10],15,-1051523),d=b(d,u,p,c,o[h+1],21,-0x7a7ba22f),c=b(c,d,u,p,o[h+8],6,0x6fa87e4f),p=b(p,c,d,u,o[h+15],10,-0x1d31920),u=b(u,p,c,d,o[h+6],15,-0x5cfebcec),d=b(d,u,p,c,o[h+13],21,0x4e0811a1),c=b(c,d,u,p,o[h+4],6,-0x8ac817e),p=b(p,c,d,u,o[h+11],10,-0x42c50dcb),u=b(u,p,c,d,o[h+2],15,0x2ad7d2bb),d=b(d,u,p,c,o[h+9],21,-0x14792c6f),c=c+v>>>0,d=d+y>>>0,u=u+x>>>0,p=p+w>>>0}return n.endian([c,d,u,p])})._ff=function(e,t,n,a,l,r,i){var o=e+(t&n|~t&a)+(l>>>0)+i;return(o<<r|o>>>32-r)+t},i._gg=function(e,t,n,a,l,r,i){var o=e+(t&a|n&~a)+(l>>>0)+i;return(o<<r|o>>>32-r)+t},i._hh=function(e,t,n,a,l,r,i){var o=e+(t^n^a)+(l>>>0)+i;return(o<<r|o>>>32-r)+t},i._ii=function(e,t,n,a,l,r,i){var o=e+(n^(t|~a))+(l>>>0)+i;return(o<<r|o>>>32-r)+t},i._blocksize=16,i._digestsize=16,t.exports=function(e,t){if(null==e)throw Error("Illegal argument "+e);var a=n.wordsToBytes(i(e,t));return t&&t.asBytes?a:t&&t.asString?r.bytesToString(a):n.bytesToHex(a)}});function em({CustomComponent:e,Fallback:t}){return void 0!==e?e:t}var eg=(0,u.e)(er(),1),eb=Symbol(),ev=Symbol(),ey=typeof window>"u"||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?o.useEffect:o.useLayoutEffect,ex=eg.unstable_runWithPriority?e=>{try{(0,eg.unstable_runWithPriority)(eg.unstable_NormalPriority,e)}catch(t){if("Not implemented."===t.message)e();else throw t}}:e=>e(),ew=e=>e;function ej(e,t){let{v:{current:n},n:{current:a},l:l}=(0,o.useContext)(e)[eb],r=t(n),[i,s]=(0,o.useReducer)((e,l)=>{if(!l)return[n,r];if("p"in l)throw l.p;if(l.n===a)return Object.is(e[1],r)?e:[n,r];try{if("v"in l){if(Object.is(e[0],l.v))return e;let n=t(l.v);return Object.is(e[1],n)?e:[l.v,n]}}catch{}return[...e]},[n,r]);return Object.is(i[1],r)||s(),ey(()=>(l.add(s),()=>{l.delete(s)}),[l]),i[1]}var eC=(0,o.createContext)({}),eS=(0,o.createContext)({}),ek=(0,o.createContext)({}),e_=(0,o.createContext)(!1),e$=(0,o.createContext)(!1),eN=(0,o.createContext)(!1),eP=(0,o.createContext)(!1),eE=(0,o.createContext)(!1),eD=(nG=[{},()=>null],(a=(0,o.createContext)({[eb]:{v:{current:nG},n:{current:-1},l:new Set,u:e=>e()}}))[ev]=a.Provider,l=a.Provider,a.Provider=({value:e,children:t})=>{let n=(0,o.useRef)(e),a=(0,o.useRef)(0),[r,i]=(0,o.useState)(null);r&&(r(e),i(null));let s=(0,o.useRef)();if(!s.current){let e=new Set;s.current={[eb]:{v:n,n:a,l:e,u:(t,n)=>{a.current+=1;let l={n:a.current};n?.suspense&&(l.n*=-1,l.p=new Promise(e=>{i(()=>t=>{l.v=t,delete l.p,e(t)})}
1)),e.forEach(e=>e(l)),t()}}}}return ey(()=>{n.current=e,a.current+=1,ex(()=>{s.current[eb].l.forEach(t=>{t({n:a.current,v:e})})})},[e]),(0,o.createElement)(l,{value:s.current},t)},delete a.Consumer,a),eT=()=>(0,o.use)(eC),eA=()=>(0,o.use)(eS),eR=()=>(0,o.use)(ek),eL=()=>(0,o.use)(e_),eF=()=>(0,o.use)(e$),eO=()=>(0,o.use)(eN),eM=()=>(0,o.use)(eP),eI=()=>(0,o.use)(eE),eB=e=>ej(eD,e),ez=()=>ej(eD,ew),eU=o.createContext({data:{},path:"",rowNumber:void 0}),eV=({children:e,path:t,rowNumber:n})=>{let{getDataByPath:a,getSiblingData:l}=eR(),r=l(t),i=a(t)||r,s=o.useMemo(()=>({data:i,path:t,rowNumber:n}),[i,t,n]);return(0,p.jsx)(eU,{value:s,children:e})},eH=()=>o.use(eU),eq=e=>{let{className:t,CustomComponent:n,label:a,path:l,rowNumber:r}=e;return(0,p.jsx)(eV,{path:l,rowNumber:r,children:(0,p.jsx)(em,{CustomComponent:n,Fallback:"string"==typeof a?(0,p.jsx)("span",{className:["row-label",t].filter(Boolean).join(" "),style:{pointerEvents:"none"},children:a}):a})})},eW=Array(12).fill(0),eK=({visible:e,className:t})=>o.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},o.createElement("div",{className:"sonner-spinner"},eW.map((e,t)=>o.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`})))),eQ=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},o.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),eY=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},o.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),eG=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},o.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),eX=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},o.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),eZ=o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},o.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),eJ=1,e0=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...a}=e,l="number"==typeof e?.id||(null==(t=e.id)?void 0:t.length)>0?e.id:eJ++,r=this.toasts.find(e=>e.id===l),i=void 0===e.dismissible||e.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),r?this.toasts=this.toasts.map(t=>t.id===l?(this.publish({...t,...e,id:l,title:n}),{...t,...e,id:l,dismissible:i,title:n}):t):this.addToast({title:n,...a,dismissible:i,id:l}),l},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>
1this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{let n;if(!t)return;void 0!==t.loading&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));let a=e instanceof Promise?e:e(),l=void 0!==n,r,i=a.then(async e=>{if(r=["resolve",e],o.isValidElement(e))l=!1,this.create({id:n,type:"default",message:e});else if(e1(e)&&!e.ok){l=!1;let a="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,r="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description;this.create({id:n,type:"error",message:a,description:r})}else if(void 0!==t.success){l=!1;let a="function"==typeof t.success?await t.success(e):t.success,r="function"==typeof t.description?await t.description(e):t.description;this.create({id:n,type:"success",message:a,description:r})}}).catch(async e=>{if(r=["reject",e],void 0!==t.error){l=!1;let a="function"==typeof t.error?await t.error(e):t.error,r="function"==typeof t.description?await t.description(e):t.description;this.create({id:n,type:"error",message:a,description:r})}}).finally(()=>{var e;l&&(this.dismiss(n),n=void 0),null==(e=t.finally)||e.call(t)}),s=()=>new Promise((e,t)=>i.then(()=>"reject"===r[0]?t(r[1]):e(r[1])).catch(t));return"string"!=typeof n&&"number"!=typeof n?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||eJ++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},e1=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,e3=Object.assign((e,t)=>{let n=t?.id||eJ++;return e0.addToast({title:e,...t,id:n}),n},{success:e0.success,info:e0.info,warning:e0.warning,error:e0.error,custom:e0.custom,message:e0.message,promise:e0.promise,dismiss:e0.dismiss,loading:e0.loading},{getHistory:()=>e0.toasts,getToasts:()=>e0.getActiveToasts()});function e2(e){return void 0!==e.label}function e6(...e){return e.filter(Boolean).join(" ")}!function(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===t&&n.firstChild?n.insertBefore(a,n.firstChild):n.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
1left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
1:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);
1--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
2`);var e5=e=>{var t,n,a,l,r,i,s,c,d,u,p,h,f,m;let{invert:g,toast:b,unstyled:v,interacting:y,setHeights:x,visibleToasts:w,heights:j,index:C,toasts:S,expanded:k,removeToast:_,defaultRichColors:$,closeButton:N,style:P,cancelButtonStyle:E,actionButtonStyle:D,className:T="",descriptionClassName:A="",duration:R,position:L,gap:F,loadingIcon:O,expandByDefault:M,classNames:I,icons:B,closeButtonAriaLabel:z="Close toast",pauseWhenPageIsHidden:U}=e,[V,H]=o.useState(null),[q,W]=o.useState(null),[K,Q]=o.useState(!1),[Y,G]=o.useState(!1),[X,Z]=o.useState(!1),[J,ee]=o.useState(!1),[et,en]=o.useState(!1),[ea,el]=o.useState(0),[er,ei]=o.useState(0),eo=o.useRef(b.duration||R||4e3),es=o.useRef(null),ec=o.useRef(null),ed=0===C,eu=C+1<=w,ep=b.type,eh=!1!==b.dismissible,ef=b.className||"",em=b.de
2scriptionClassName||"",eg=o.useMemo(()=>j.findIndex(e=>e.toastId===b.id)||0,[j,b.id]),eb=o.useMemo(()=>{var e;return null!=(e=b.closeButton)?e:N},[b.closeButton,N]),ev=o.useMemo(()=>b.duration||R||4e3,[b.duration,R]),ey=o.useRef(0),ex=o.useRef(0),ew=o.useRef(0),ej=o.useRef(null),[eC,eS]=L.split("-"),ek=o.useMemo(()=>j.reduce((e,t,n)=>n>=eg?e:e+t.height,0),[j,eg]),e_=(()=>{let[e,t]=o.useState(document.hidden);return o.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),e})(),e$=b.invert||g,eN="loading"===ep;ex.current=o.useMemo(()=>eg*F+ek,[eg,ek]),o.useEffect(()=>{eo.current=ev},[ev]),o.useEffect(()=>{Q(!0)},[]),o.useEffect(()=>{let e=ec.current;if(e){let t=e.getBoundingClientRect().height;return ei(t),x(e=>[{toastId:b.id,height:t,position:b.position},...e]),()=>x(e=>e.filter(e=>e.toastId!==b.id))}},[x,b.id]),o.useLayoutEffect(()=>{if(!K)return;let e=ec.current,t=e.style.height;e.style.height="auto";let n=e.getBoundingClientRect().height;e.style.height=t,ei(n),x(e=>e.find(e=>e.toastId===b.id)?e.map(e=>e.toastId===b.id?{...e,height:n}:e):[{toastId:b.id,height:n,position:b.position},...e])},[K,b.title,b.description,x,b.id]);let eP=o.useCallback(()=>{G(!0),el(ex.current),x(e=>e.filter(e=>e.toastId!==b.id)),setTimeout(()=>{_(b)},200)},[b,_,x,ex]);return o.useEffect(()=>{let e;if((!b.promise||"loading"!==ep)&&b.duration!==1/0&&"loading"!==b.type)return k||y||U&&e_?(()=>{if(ew.current<ey.current){let e=new Date().getTime()-ey.current;eo.current=eo.current-e}ew.current=new Date().getTime()})():eo.current!==1/0&&(ey.current=new Date().getTime(),e=setTimeout(()=>{var e;null==(e=b.onAutoClose)||e.call(b,b),eP()},eo.current)),()=>clearTimeout(e)},[k,y,b,ep,U,e_,eP]),o.useEffect(()=>{b.delete&&eP()},[eP,b.delete]),o.createElement("li",{tabIndex:0,ref:ec,className:e6(T,ef,I?.toast,null==(t=b?.classNames)?void 0:t.toast,I?.default,I?.[ep],null==(n=b?.classNames)?void 0:n[ep]),"data-sonner-toast":"","data-rich-colors":null!=(a=b.richColors)?a:$,"data-styled":!(b.jsx||b.unstyled||v),"data-mounted":K,"data-promise":!!b.promise,"data-swiped":et,"data-removed":Y,"data-visible":eu,"data-y-position":eC,"data-x-position":eS,"data-index":C,"data-front":ed,"data-swiping":X,"data-dismissible":eh,"data-type":ep,"data-invert":e$,"data-swipe-out":J,"data-swipe-direction":q,"data-expanded":!!(k||M&&K),style:{"--index":C,"--toasts-before":C,"--z-index":S.length-C,"--offset":`${Y?ea:ex.current}px`,"--initial-height":M?"auto":`${er}px`,...P,...b.style},onDragEnd:()=>{Z(!1),H(null),ej.current=null},onPointerDown:e=>{eN||!eh||(es.current=new Date,el(ex.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(Z(!0),ej.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,n,a;if(J||!eh)return;ej.current=null;let l=Number((null==(e=ec.current)?void 0:e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),r=Number((null==(t=ec.current)?void 0:t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),i=new Date().getTime()-(null==(n=es.current)?void 0:n.getTime()),o="x"===V?l:r,s=Math.abs(o)/i;if(Math.abs(o)>=20||s>.11){el(ex.current),null==(a=b.onDismiss)||a.call(b,b),W("x"===V?l>0?"right":"left":r>0?"down":"up"),eP(),ee(!0),en(!1);return}Z(!1),H(null)},onPointerMove:t=>{var n,a,l,r;if(!ej.current||!eh||(null==(n=window.getSelection())?void 0:n.toString().length)>0)return;let i=t.clientY-ej.current.y,o=t.clientX-ej.current.x,s=null!=(a=e.swipeDirections)?a:function(e){let[t,n]=e.split("-"),a=[];return t&&a.push(t),n&&a.push(n),a}(L);!V&&(Math.abs(o)>1||Math.abs(i)>1)&&H(Math.abs(o)>Math.abs(i)?"x":"y");let c={x:0,y:0};"y"===V?(s.includes("top")||s.includes("bottom"))&&(s.includes("top")&&i<0||s.includes("bottom")&&i>0)&&(c.y=i):"x"===V&&(s.includes("left")||s.includes("right"))&&(s.includes("left")&&o<0||s.includes("right")&&o>0)&&(c.x=o),(Math.abs(c.x)>0||Math.abs(c.y)>0)&&en(!0),null==(l=ec.current)||l.style.setProperty("--swipe-amount-x",`${c.x}px`),null==(r=ec.current)||r.style.setProperty("--swipe-amount-y",`${c.y}px`)}},eb&&!b.jsx?o.createElement("button",{"aria-label":z,"data-disabled":eN,"data-close-button":!0,onClick:eN||!eh?()=>{}:()=>{var e;eP(),null==(e=b.onDismiss)||e.call(b,b)},className:e6(I?.closeButton,null==(l=b?.classNames)?void 0:l.closeButton)},null!=(r=B?.close)?r:eZ):null,b.jsx||(0,o.isValidElement)(b.title)?b.jsx?b.jsx:"function"==typeof b.title?b.title():b.title:o.createElement(o.Fragment,null,ep||b.icon||b.promise?o.createElement("div",{"data-icon":"",className:e6(I?.icon,null==(i=b?.classNames)?void 0:i.icon)},b.promise||"loading"===b.type&&!b.icon?b.icon||(null!=B&&B.loading?o.createElement("div",{className:e6(I?.loader,null==(h=b?.classNames)?void 0:h.loader,"sonner-loader"),"data-visible":"loading"===ep},B.loading):O?o.createElement("div",{className:e6(I?.loader,null==(f=b?.classNames)?void 0:f.loader,"sonner-loader"),"data-visible":"loading"===ep}
2,O):o.createElement(eK,{className:e6(I?.loader,null==(m=b?.classNames)?void 0:m.loader),visible:"loading"===ep})):null,"loading"!==b.type?b.icon||B?.[ep]||(e=>{switch(e){case"success":return eQ;case"info":return eG;case"warning":return eY;case"error":return eX;default:return null}})(ep):null):null,o.createElement("div",{"data-content":"",className:e6(I?.content,null==(s=b?.classNames)?void 0:s.content)},o.createElement("div",{"data-title":"",className:e6(I?.title,null==(c=b?.classNames)?void 0:c.title)},"function"==typeof b.title?b.title():b.title),b.description?o.createElement("div",{"data-description":"",className:e6(A,em,I?.description,null==(d=b?.classNames)?void 0:d.description)},"function"==typeof b.description?b.description():b.description):null),(0,o.isValidElement)(b.cancel)?b.cancel:b.cancel&&e2(b.cancel)?o.createElement("button",{"data-button":!0,"data-cancel":!0,style:b.cancelButtonStyle||E,onClick:e=>{var t,n;e2(b.cancel)&&eh&&(null==(n=(t=b.cancel).onClick)||n.call(t,e),eP())},className:e6(I?.cancelButton,null==(u=b?.classNames)?void 0:u.cancelButton)},b.cancel.label):null,(0,o.isValidElement)(b.action)?b.action:b.action&&e2(b.action)?o.createElement("button",{"data-button":!0,"data-action":!0,style:b.actionButtonStyle||D,onClick:e=>{var t,n;e2(b.action)&&(null==(n=(t=b.action).onClick)||n.call(t,e),e.defaultPrevented||eP())},className:e6(I?.actionButton,null==(p=b?.classNames)?void 0:p.actionButton)},b.action.label):null))};function e4(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}var e8=(0,o.forwardRef)(function(e,t){let{invert:n,position:a="bottom-right",hotkey:l=["altKey","KeyT"],expand:r,closeButton:i,className:c,offset:d,mobileOffset:u,theme:p="light",richColors:h,duration:f,style:m,visibleToasts:g=3,toastOptions:b,dir:v=e4(),gap:y=14,loadingIcon:x,icons:w,containerAriaLabel:j="Notifications",pauseWhenPageIsHidden:C}=e,[S,k]=o.useState([]),_=o.useMemo(()=>Array.from(new Set([a].concat(S.filter(e=>e.position).map(e=>e.position)))),[S,a]),[$,N]=o.useState([]),[P,E]=o.useState(!1),[D,T]=o.useState(!1),[A,R]=o.useState("system"!==p?p:"u">typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),L=o.useRef(null),F=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),O=o.useRef(null),M=o.useRef(!1),I=o.useCallback(e=>{k(t=>{var n;return null!=(n=t.find(t=>t.id===e.id))&&n.delete||e0.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return o.useEffect(()=>e0.subscribe(e=>{e.dismiss?k(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t)):setTimeout(()=>{s.flushSync(()=>{k(t=>{let n=t.findIndex(t=>t.id===e.id);return -1!==n?[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]:[e,...t]})})})}),[]),o.useEffect(()=>{if("system"!==p)return void R(p);if("system"===p&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?R("dark"):R("light")),typeof window>"u")return;let e=window.matchMedia("(prefers-color-scheme: dark)");try{e.addEventListener("change",({matches:e})=>{R(e?"dark":"light")})}catch{e.addListener(({matches:e})=>{try{R(e?"dark":"light")}catch(e){console.error(e)}})}},[p]),o.useEffect(()=>{S.length<=1&&E(!1)},[S]),o.useEffect(()=>{let e=e=>{var t,n;l.every(t=>e[t]||e.code===t)&&(E(!0),null==(t=L.current)||t.focus()),"Escape"===e.code&&(document.activeElement===L.current||null!=(n=L.current)&&n.contains(document.activeElement))&&E(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[l]),o.useEffect(()=>{if(L.current)return()=>{O.current&&(O.current.focus({preventScroll:!0}),O.current=null,M.current=!1)}},[L.current]),o.createElement("section",{ref:t,"aria-label":`${j} ${F}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},_.map((t,a)=>{var l;let s,[p,j]=t.split("-");return S.length?o.createElement("ol",{key:t,dir:"auto"===v?e4():v,tabIndex:-1,ref:L,className:c,"data-sonner-toaster":!0,"data-theme":A,"data-y-position":p,"data-lifted":P&&S.length>1&&!r,"data-x-position":j,style:{"--front-toast-height":`${(null==(l=$[0])?void 0:l.height)||0}px`,"--width":"356px","--gap":`${y}px`,...m,...(s={},[d,u].forEach((e,t)=>{let n=1===t,a=n?"--mobile-offset":"--offset",l=n?"16px":"32px";function r(e){["top","right","bottom","left"].forEach(t=>{s[`${a}-${t}`]="number"==typeof e?`${e}px`:e})}"number"==typeof e||"string"==typeof e?r(e):"object"==typeof e?["top","right","bottom","left"].forEach(t=>{void 0===e[t]?s[`${a}-${t}`]=l:s[`${a}-${t}`]="number"==typeof e[t]?`${e[t]}px`:e[t]}):r(l)}),s)},onBlur:e=>{M.current&&!e.currentTarget.contains(e.relatedTarget)&&(M.current=!1,O.current&&(O.current.focus({preventScroll:!0}),O.current=null))},onFocus:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||M.current||(M.current=!0,O.current=e.relatedTarget)},onMouseEnter:()=>E(!0),onMouseMove:()=>E(!0),onMouseLeave:()=>{D||E(!1)},onDragEnd:()=>E(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||T(!0)},onPointerUp:()=>T(!1)},S.filter(e=>!e.position&&0===a||e.position===t).map((a,l)=>{var s,c;return o.createElement(e5,{key:a.id,icons:w,index:l,toast:a,defaultRichColors:h,duration:null!=(s=b?.duration)?s:f,className:b?.className,descriptionClassName:b?.descriptionClassName,invert:n,visibleToasts:g,closeButton:null!=(c=b?.closeButton)?c:i,interacting:D,position:t,style:b?.style,unstyled:b?.unstyled,classNames:b?.classNames,cancelButtonStyle:b?.cancelButtonStyle,actionButtonStyle:b?.actionButtonStyle,removeToast:I,toasts:S.filter(e=>e.position==a.position),heights:$.filter(e=>e.position==a.position),setHeights:N,expandByDefault:r,gap:y,loadingIcon:x,expanded:P,pauseWhenPageIsHidden:C,swipeDirections:e.swipeDirections})})):null}))}),e7=e=>{let t,n=(0,g.c)(11),{children:a}=e,[l,r]=(0,o.useOptimistic)(!1),[i,s]=o.useState(0),c=(0,o.useRef)(i),d=(0,o.useRef)(null),u;n[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{d.current=setInterval(()=>
2{let e=c.current+(.93-c.current)*Math.random()*.2*Math.pow(Math.log(1+(1-c.current)*.75),.75);s(e),c.current=e},250)},n[0]=u):u=n[0];let h=u,f,m;n[1]!==l?(f=()=>{s(0),c.current=0,l?h():d.current&&clearInterval(d.current)},m=[l,h],n[1]=l,n[2]=f,n[3]=m):(f=n[2],m=n[3]),(0,o.useEffect)(f,m),n[4]!==r?(t=e=>{(0,o.startTransition)(()=>{r(!0),"function"==typeof e&&e()})},n[4]=r,n[5]=t):t=n[5];let b=t,v;return n[6]!==a||n[7]!==l||n[8]!==b||n[9]!==i?(v=(0,p.jsx)(e9,{value:{isTransitioning:l,startRouteTransition:b,transitionProgress:i},children:a}),n[6]=a,n[7]=l,n[8]=b,n[9]=i,n[10]=v):v=n[10],v},e9=o.createContext({isTransitioning:!1,startRouteTransition:e=>{"function"==typeof e&&e()},transitionProgress:0}),te=()=>o.use(e9),tt=/https?|ftp|gopher|file/;function tn(e){return"string"!=typeof e&&("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}var ta="default"in f?f.default:f,tl=({children:e,href:t,onClick:n,preventDefault:a=!0,ref:l,replace:r,scroll:i,...o})=>{let s=(0,m.useRouter)(),{startRouteTransition:c}=te();return(0,p.jsx)(ta,{href:t,onClick:e=>{let l;if((l=e.currentTarget.getAttribute("target"))&&"_self"!==l||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which)return;n&&n(e),a&&e.preventDefault();let o="string"==typeof t?t:function(e){var t;let n,{auth:a}=e,{hostname:l}=e,r=e.protocol||"",i=e.pathname||"",o=e.hash||"",s=e.query||"",c=!1;a=a?encodeURIComponent(a).replace(/%3A/i,":")+"@":"",e.host?c=a+e.host:l&&(c=a+(~l.indexOf(":")?`[${l}]`:l),e.port&&(c+=":"+e.port)),s&&"object"==typeof s&&(s=String((t=s,n=new URLSearchParams,Object.entries(t).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>n.append(e,tn(t))):n.set(e,tn(t))}),n)));let d=e.search||s&&`?${s}`||"";return r&&!r.endsWith(":")&&(r+=":"),e.slashes||(!r||tt.test(r))&&!1!==c?(c="//"+(c||""),i&&"/"!==i[0]&&(i="/"+i)):c||(c=""),o&&"#"!==o[0]&&(o="#"+o),d&&"?"!==d[0]&&(d="?"+d),i=i.replace(/[?#]/g,encodeURIComponent),d=d.replace("#","%23"),`${r}${c}${i}${d}${o}`}(t);c(()=>{r?s.replace(o,{scroll:i}):s.push(o,{scroll:i})})},ref:l,...o,children:e})},tr="banner",ti=({type:e="default",alignIcon:t="right",children:n,className:a,icon:l,onClick:r,to:i})=>{let s=[tr,`${tr}--type-${e}`,a&&a,i&&`${tr}--has-link`,(i||r)&&`${tr}--has-action`,l&&`${tr}--has-icon`,l&&`${tr}--align-icon-${t}`].filter(Boolean).join(" "),c="div";return r&&!i&&(c="button"),i&&(c=tl),(0,p.jsxs)(c,{className:s,href:i||null,onClick:r,children:[l&&"left"===t&&(0,p.jsx)(o.Fragment,{children:l}),(0,p.jsx)("span",{className:`${tr}__content`,children:n}),l&&"right"===t&&(0,p.jsx)(o.Fragment,{children:l})]})},to=({ariaLabel:e,className:t,direction:n,size:a})=>(0,p.jsx)("svg",{"aria-label":e,className:["icon icon--chevron",t,a&&`icon--size-${a}`].filter(Boolean).join(" "),height:"100%",style:{transform:"left"===n?"rotate(90deg)":"right"===n?"rotate(-90deg)":"up"===n?"rotate(180deg)":void 0},viewBox:"0 0 20 20",width:"100%",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M14 8L10 12L6 8",strokeLinecap:"square"})}),ts=({className:e})=>(0,p.jsx)("svg",{className:[e,"icon icon--edit"].filter(Boolean).join(" "),viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M9.68531 4.62938H5.2634C4.92833 4.62938 4.60698 4.76248 4.37004 4.99942C4.13311 5.23635 4 5.5577 4 5.89278V14.7366C4 15.0717 4.13311 15.393 4.37004 15.63C4.60698 15.8669 4.92833 16 5.2634 16H14.1072C14.4423 16 14.7636 15.8669 15.0006 15.63C15.2375 15.393 15.3706 15.0717 15.3706 14.7366V10.3147M13.7124 4.39249C13.9637 4.14118 14.3046 4 14.66 4C15.0154 4 15.3562 4.14118 15.6075 4.39249C15.8588 4.6438 16 4.98464 16 5.34004C16 5.69544 15.8588 6.03629 15.6075 6.28759L9.91399 11.9817C9.76399 12.1316 9.57868 12.2413 9.37515 12.3008L7.56027 12.8314C7.50591 12.8472 7.44829 12.8482 7.39344 12.8341C7.33859 12.8201 7.28853 12.7915 7.24849 12.7515C7.20845 12.7115 7.17991 12.6614 7.16586 12.6066C7.15181 12.5517 7.15276 12.4941 7.16861 12.4397L7.69924 10.6249C7.75896 10.4215 7.86888 10.2364 8.01888 10.0866L13.7124 4.39249Z",strokeLinecap:"square"})}),tc=()=>(0,p.jsx)("svg",{"aria-hidden":"true",className:"graphic link icon icon--link",fill:"none",focu
2sable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M7.99999 13.3333H6.66666C5.78261 13.3333 4.93476 12.9821 4.30964 12.357C3.68452 11.7319 3.33333 10.884 3.33333 9.99999C3.33333 9.11593 3.68452 8.26809 4.30964 7.64297C4.93476 7.01785 5.78261 6.66666 6.66666 6.66666H7.99999M12 6.66666H13.3333C14.2174 6.66666 15.0652 7.01785 15.6904 7.64297C16.3155 8.26809 16.6667 9.11593 16.6667 9.99999C16.6667 10.884 16.3155 11.7319 15.6904 12.357C15.0652 12.9821 14.2174 13.3333 13.3333 13.3333H12M7.33333 9.99999H12.6667",strokeLinecap:"square"})}),td=()=>(0,p.jsx)("svg",{className:"icon icon--plus",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M5.33333 9.99998H14.6667M9.99999 5.33331V14.6666",strokeLinecap:"square"})}),tu=()=>(0,p.jsx)("svg",{className:"icon icon--swap",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M7.33334 4L4.66667 6.66667M4.66667 6.66667L7.33334 9.33333M4.66667 6.66667H15.3333M12.6667 16L15.3333 13.3333M15.3333 13.3333L12.6667 10.6667M15.3333 13.3333H4.66667",strokeLinecap:"square"})}),tp={};(0,u.d)(tp,{Button:()=>tb,ButtonGroup:()=>tg,Divider:()=>th,GroupLabel:()=>tf});var th=()=>(0,p.jsx)("hr",{className:"popup-divider"}),tf=({label:e})=>(0,p.jsx)("p",{className:"popup-list-group-label",children:e}),tm="popup-button-list",tg=({buttonSize:e="default",children:t,className:n,textAlign:a="left"})=>{let l=[tm,n,`${tm}__text-align--${a}`,`${tm}__button-size--${e}`].filter(Boolean).join(" ");return(0,p.jsx)("div",{className:l,children:t})},tb=({id:e,active:t,children:n,className:a,disabled:l,href:r,onClick:i})=>{let o=[`${tm}__button`,l&&`${tm}__disabled`,t&&`${tm}__button--selected`,a].filter(Boolean).join(" ");if(!l){if(r)return(0,p.jsx)(tl,{className:o,href:r,id:e,onClick:e=>{i&&i(e)},prefetch:!1,children:n});if(i)return(0,p.jsx)("button",{className:o,id:e,onClick:e=>{i&&i(e)},type:"button",children:n})}return(0,p.jsx)("div",{className:o,id:e,children:n})},tv="function"==typeof o.useEffectEvent?o.useEffectEvent:e=>{let t=(0,o.useRef)(e);return(0,o.useInsertionEffect)(()=>{t.current=e},[e]),(0,o.useCallback)((...e)=>(0,t.current)(...e),[])},ty="popup-button",tx=e=>{let{active:t,button:n,buttonType:a,className:l,disabled:r,noBackground:i,setActive:o,size:s}=e,c=[ty,l,`${ty}--${a}`,!i&&`${ty}--background`,s&&`${ty}--size-${s}`,r&&`${ty}--disabled`].filter(Boolean).join(" "),d=()=>{o(!t,!1)},u=e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),o(!t,!0))};return"none"===a?null:"custom"===a?(0,p.jsx)("div",{className:c,onClick:d,onKeyDown:u,role:"button",tabIndex:0,children:n}):(0,p.jsx)("button",{className:c,disabled:r,onClick:d,onKeyDown:u,tabIndex:0,type:"button",children:n})},tw="popup",tj=["a[href]","button:not(:disabled)",'input:not(:disabled):not([type="hidden"])',"select:not(:disabled)","textarea:not(:disabled)","[tabindex]",'[contenteditable]:not([contenteditable="false"])',"audio[controls]","video[controls]","summary"].map(e=>`${e}:not([tabindex="-1"])`).join(", "),tC=e=>{let{id:t,button:n,buttonClassName:a,buttonSize:l,buttonType:r="default",caret:i=!0,children:c,className:d,disabled:u,forceOpen:h,horizontalAlign:f="left",initActive:m=!1,noBackground:g,onToggleClose:b,onToggleOpen:v,portalClassName:y,render:x,showOnHover:w=!1,showScrollbar:j=!1,size:C="medium",verticalAlign:S="bottom"}=e,k=(0,o.useRef)(null),_=(0,o.useRef)(null),$=(0,o.useRef)(!1),[N,P]=(0,o.useState)(!1),[E,D]=(0,o.useState)(m),[T,A]=(0,o.useState)("top"===S);(0,o.useEffect)(()=>{P(!0)},[]);let R=(0,o.useCallback)((e,t=!1)=>{e?($.current=t,v?.(!0)):b?.(),D(e)},[b,v]),L=tv(()=>{let e=_.current,t=k.current;if(!e||!t)return;let n=e.getBoundingClientRect(),a=t.getBoundingClientRect(),l,r="top"===S;"bottom"===S?(l=n.bottom+window.scrollY+10,n.bottom+a.height+10>window.innerHeight&&(l=n.top+window.scrollY-a.height-10,r=!0)):(l=n.top+window.scrollY-a.height-10,n.top-a.height-10<0&&(l=n.bottom+window.scrollY+10,r=!1)),A(r);let i="right"===f?n.right-a.width:"center"===f?n.left+n.width/2-a.width/2:n.left;i=Math.max(10,Math.min(i,window.innerWidth-a.width-10));let o=Math.max(12,Math.min(n.left+n.width/2-i,a.width-12)),s=`${Math.round(l)}px`,c=`${Math.round(i+window.scrollX)}px`,d=`${Math.round(o)}px`;t.style.top!==s&&(t.style.top=s),t.style.left!==c&&(t.style.left=c),t.style.getPropertyValue("--caret-left")!==d&&t.style.setProperty("--caret-left",d)}),F=tv(e=>{let t=!k.current?.contains(e.target),n=!_.current?.contains(e.target);t&&n&&R(!1)}),O=tv(e=>{let t=k.current;
2if(!(!t||!E)){if("Escape"===e.key){e.preventDefault(),R(!1),_.current?.querySelector('button, [tabindex="0"]')?.focus();return}if("Tab"===e.key||"ArrowDown"===e.key||"ArrowUp"===e.key){let n=Array.from(t.querySelectorAll(tj));if(0===n.length)return;e.preventDefault();let a=n.findIndex(e=>e===document.activeElement),l="ArrowUp"===e.key||"Tab"===e.key&&e.shiftKey,r;r=-1===a?l?n.length-1:0:l?0===a?n.length-1:a-1:a===n.length-1?0:a+1,n[r].focus()}}}),M=tv(e=>{let t=e.target;if(t.closest("[data-popup-prevent-close]"))return;let n=t.closest('button, a[href], [role="button"], [role="menuitem"]');n&&k.current?.contains(n)&&R(!1)});(0,o.useEffect)(()=>{if(!E)return;let e=k.current;if(e)return L(),$.current&&requestAnimationFrame(()=>{e.querySelector(tj)?.focus()}),window.addEventListener("resize",L),window.addEventListener("scroll",L,{capture:!0,passive:!0}),document.addEventListener("mousedown",F),document.addEventListener("keydown",O),e.addEventListener("click",M),()=>{window.removeEventListener("resize",L),window.removeEventListener("scroll",L,{capture:!0}),document.removeEventListener("mousedown",F),document.removeEventListener("keydown",O),e.removeEventListener("click",M)}},[E]),(0,o.useEffect)(()=>{void 0!==h&&R(h)},[h,R]);let I=(0,p.jsx)(tx,{active:E,button:n,buttonType:r,className:a,disabled:u,noBackground:g,setActive:R,size:l});return(0,p.jsxs)("div",{className:[tw,d].filter(Boolean).join(" "),id:t,children:[(0,p.jsx)("div",{className:`${tw}__trigger-wrap`,ref:_,children:w?(0,p.jsx)("div",{className:`${tw}__on-hover-watch`,onMouseEnter:()=>R(!0),onMouseLeave:()=>R(!1),role:"button",tabIndex:0,children:I}):I}),N?(0,s.createPortal)((0,p.jsxs)("div",{className:E?[`${tw}__content`,`${tw}--size-${C}`,T?`${tw}--v-top`:`${tw}--v-bottom`,y].filter(Boolean).join(" "):`${tw}__hidden-content`,"data-popup-id":t||void 0,ref:k,children:[(0,p.jsxs)("div",{className:`${tw}__scroll-container${j?` ${tw}__scroll-container--show-scrollbar`:""}`,children:[x?.({close:()=>R(!1)}),c]}),i&&(0,p.jsx)("div",{className:`${tw}__caret`})]}),document.body):null]})},tS=(e,t)=>{let n,a=(0,g.c)(8),{root:l,rootMargin:r,threshold:i}=void 0===e?{}:e,[s,c]=(0,o.useState)(),[d,u]=(0,o.useState)(null),p=(0,o.useRef)("u">typeof window&&"IntersectionObserver"in window&&!t?new window.IntersectionObserver(e=>{let[t]=e;return c(t)},{root:void 0===l?null:l,rootMargin:void 0===r?"0px":r,threshold:void 0===i?0:i}):null),h,f;return a[0]!==t||a[1]!==d?(h=()=>{if(t)return;let{current:e}=p;return e.disconnect(),d&&e.observe(d),()=>e.disconnect()},f=[d,t],a[0]=t,a[1]=d,a[2]=h,a[3]=f):(h=a[2],f=a[3]),(0,o.useEffect)(h,f),a[4]!==s||a[5]!==d||a[6]!==u?(n=[u,s,d],a[4]=s,a[5]=d,a[6]=u,a[7]=n):n=a[7],n},tk=e=>{let{alignCaret:t="center",boundingRef:n,children:a,className:l,delay:r=350,position:i,show:s=!0,staticPositioning:c=!1}=e,[d,u]=o.useState(s),[h,f]=o.useState("top"),[m,g]=tS({root:n?.current||null,rootMargin:"-145px 0px 0px 100px",threshold:0},c);return(0,o.useEffect)(()=>{let e;return r&&s?e=setTimeout(()=>{u(s)},r):u(s),()=>{e&&clearTimeout(e)}},[s,r]),(0,o.useEffect)(()=>{c||f(g?.isIntersecting?"top":"bottom")},[g,c]),(0,p.jsxs)(o.Fragment,{children:[!c&&(0,p.jsx)("aside",{"aria-hidden":"true",className:["tooltip",l,`tooltip--caret-${t}
2`,"tooltip--position-top"].filter(Boolean).join(" "),ref:m,style:{opacity:"0"},children:(0,p.jsx)("div",{className:"tooltip-content",children:a})}),(0,p.jsx)("aside",{className:["tooltip",l,d&&"tooltip--show",`tooltip--caret-${t}`,`tooltip--position-${i||h}`].filter(Boolean).join(" "),title:"string"==typeof a?a:"",children:(0,p.jsx)("div",{className:"tooltip-content",children:a})})]})},t_={chevron:to,edit:ts,link:tc,plus:td,swap:tu,x:d.a},t$=({children:e,icon:t,showTooltip:n,tooltip:a})=>{let l=t_[t];return(0,p.jsxs)(o.Fragment,{children:[a&&(0,p.jsx)(tk,{className:"btn__tooltip",show:n,children:a}),(0,p.jsxs)("span",{className:"btn__content",children:[e&&(0,p.jsx)("span",{className:"btn__label",children:e}),t&&(0,p.jsxs)("span",{className:"btn__icon",children:[(0,o.isValidElement)(t)&&t,l&&(0,p.jsx)(l,{})]})]})]})},tN=e=>{let{id:t,type:n="button","aria-label":a,buttonStyle:l="primary",children:r,className:i,disabled:s,el:c="button",enableSubMenu:d,extraButtonProps:u={},icon:h,iconPosition:f="right",iconStyle:m="without-border",margin:g=!0,newTab:b,onClick:v,onMouseDown:y,ref:x,round:w,size:j="medium",SubMenuPopupContent:C,to:S,tooltip:k,url:_}=e,[$,N]=o.useState(!1),P=["btn",i&&i,h&&"btn--icon",m&&`btn--icon-style-${m}`,h&&!r&&"btn--icon-only",j&&`btn--size-${j}`,h&&f&&`btn--icon-position-${f}`,k&&"btn--has-tooltip",!C&&"btn--withoutPopup",!g&&"btn--no-margin"].filter(Boolean).join(" "),E=[l&&`btn--style-${l}`,s&&"btn--disabled",w&&"btn--round",C?"btn--withPopup":"btn--withoutPopup"].filter(Boolean).join(" "),D={id:t,type:n,"aria-disabled":s,"aria-label":a,className:C?P:[P,E].join(" "),disabled:s,onClick:s?void 0:function(e){N(!1),"submit"!==n&&v&&e.preventDefault(),v&&v(e)},onMouseDown:s?void 0:y,onPointerEnter:k?()=>N(!0):void 0,onPointerLeave:k?()=>N(!1):void 0,rel:b?"noopener noreferrer":void 0,target:b?"_blank":void 0,title:a,...u},T;switch(c){case"anchor":T=(0,p.jsx)("a",{...D,href:s?void 0:_,ref:x,children:(0,p.jsx)(t$,{icon:h,showTooltip:$,tooltip:k,children:r})});break;case"link":s&&(T=(0,p.jsx)("div",{...D,children:(0,p.jsx)(t$,{icon:h,showTooltip:$,tooltip:k,children:r})})),T=(0,p.jsx)(tl,{...D,href:S||_,prefetch:!1,children:(0,p.jsx)(t$,{icon:h,showTooltip:$,tooltip:k,children:r})});break;default:T=(0,p.jsx)(c,{ref:x,...D,children:(0,p.jsx)(t$,{icon:h,showTooltip:$,tooltip:k,children:r})})}return C?(0,p.jsxs)("div",{className:E,children:[T,(0,p.jsx)(tC,{button:(0,p.jsx)(to,{}),buttonSize:j,className:s&&!d?"btn--popup-disabled":"",disabled:s&&!d,horizontalAlign:"right",id:`${t}-popup`,noBackground:!0,render:({close:e})=>C({close:()=>e()}),size:"large",verticalAlign:"bottom"})]}):T};function tP({fieldsFromClipboard:e,fieldsFromConfig:t}){return!!t&&e.length===t?.length&&e.every((e,n)=>{let a=t[n];if(e.type!==a.type||(0,b.Z7)(e)&&(0,b.Z7)(a)&&e.name!==a.name)return!1;let l=(0,b.sd)(a),r=(0,b.sd)(e);return r===l&&(!r||!l||tP({fieldsFromClipboard:e.fields,fieldsFromConfig:a.fields}))})}var tE="_payloadClipboard";function tD(e){let{getDataToCopy:t,t:n,...a}=e,l={data:t(),...a};try{return localStorage.setItem(tE,JSON.stringify(l)),!0}catch{return n("error:unableToCopy")}}function tT({onPaste:e,path:t,t:n,...a}){let l;try{let e=localStorage.getItem(tE);if(!e)return n("error:invalidClipboardData");l=JSON.parse(e)}catch{return n("error:invalidClipboardData")}return!function({data:e,path:t,...n}){return!(typeof e>"u")&&!!t&&!!n.type&&("blocks"===n.type?function({blocksFromClipboard:e,blocksFromConfig:t}){let n=new Map(t?.map(e=>[e.slug,e]));if(!n.size)return!1;let a=new Set;for(let t of e){let e=t.slug;if(!a.has(e)){let l=n.get(e);if(!l||!tP({fieldsFromClipboard:t.fields,fieldsFromConfig:l.fields}))return!1;a.add(e)}}return!0}({blocksFromClipboard:n.blocks,blocksFromConfig:n.schemaBlocks}):tP({fieldsFromClipboard:n.fields,fieldsFromConfig:n.schemaFields}))}({...l,...a,fieldPath:t})?n("error:invalidClipboardData"):(e(l),!0)}var tA=({className:e})=>(0,p.jsxs)("svg",{className:["icon icon--more",e].filter(Boolean).join(" "),viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:[(0,p.jsx)("path",{className:"fill",d:"M10 10.6666C10.3682 10.6666 10.6667 10.3682 10.6667 9.99998C10.6667 9.63179 10.3682 9.33331 10 9.33331C9.63182 9.33331 9.33334 9.63179 9.33334 9.99998C9.33334 10.3682 9.63182 10.6666 10 10.6666Z",strokeLinecap:"square"}),(0,p.jsx)("path",{className:"fill",d:"M14.6667 10.6666C15.0349 10.6666 15.3333 10.3682 15.3333 9.99998C15.3333 9.63179 15.0349 9.33331 14.6667 9.33331C14.2985 9.33331 14 9.63179 14 9.99998C14 10.3682 14.2985 10.6666 14.6667 10.6666Z",strokeLinecap:"square"}),(0,p.jsx)("path",{className:"fill",d:"M5.33334 10.6666C5.70153 10.6666 6.00001 10.3682 6.00001 9.99998C6.00001 9.63179 5.70153 9.33331 5.33334 9.33331C4.96515 9.33331 4.66667 9.63179 4.66667 9.99998C4.66667 10.3682 4.96515 10.6666 5.33334 10.6666Z",strokeLinecap:"square"})]}),tR=()=>(0,p.jsx)("svg",{className:"icon icon--copy",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M4.66666 12.6667C3.93333 12.6667 3.33333 12.0667 3.33333 11.3333V4.66668C3.33333 3.93334 3.93333 3.33334 4.66666 3.33334H11.3333C12.0667 3.33334 12.6667 3.93334 12.6667 4.66668M8.66666 7.33334H15.3333C16.0697 7.33334 16.6667 7.9303 
216.6667 8.66668V15.3333C16.6667 16.0697 16.0697 16.6667 15.3333 16.6667H8.66666C7.93028 16.6667 7.33333 16.0697 7.33333 15.3333V8.66668C7.33333 7.9303 7.93028 7.33334 8.66666 7.33334Z",strokeLinecap:"square"})}),tL=e=>{let t=(0,g.c)(4),{isPaste:n,isRow:a}=e,{t:l}=(0,d.d)(),r;if(t[0]!==n||t[1]!==a||t[2]!==l){let e=l("general:copyField");!a&&n?e=l("general:pasteField"):a&&!n?e=l("general:copyRow"):a&&n&&(e=l("general:pasteRow")),r=(0,p.jsxs)(o.Fragment,{children:[n?(0,p.jsx)(ts,{}):(0,p.jsx)(tR,{})," ",e]}),t[0]=n,t[1]=a,t[2]=l,t[3]=r}else r=t[3];return r},tF=({allowCopy:e,allowPaste:t,className:n,copyClassName:a,disabled:l,isRow:r,onPaste:i,pasteClassName:s,path:c,...u})=>{let{t:h}=(0,d.d)(),f=["clipboard-action__popup",n].filter(Boolean).join(" "),m=(0,o.useCallback)(()=>{let e=tD({path:c,t:h,...u});"string"==typeof e?e3.error(e):e3.success(h("general:copied"))},[h,u,c]),g=(0,o.useCallback)(()=>{let e=tT("array"===u.type?{onPaste:i,path:c,schemaFields:u.fields,t:h}:{onPaste:i,path:c,schemaBlocks:u.blocks,t:h});"string"==typeof e&&e3.error(e)},[i,u,c,h]);return t||e?(0,p.jsx)(tC,{button:(0,p.jsx)(tA,{}),className:f,disabled:l,horizontalAlign:"center",render:({close:n})=>(0,p.jsxs)(tp.ButtonGroup,{children:[(0,p.jsx)(tp.Button,{className:a,disabled:!e,onClick:()=>{m(),n()},children:(0,p.jsx)(tL,{isRow:r})}),(0,p.jsx)(tp.Button,{className:s,disabled:!t,onClick:()=>{g(),n()},children:(0,p.jsx)(tL,{isPaste:!0,isRow:r})})]}),size:"large",verticalAlign:"bottom"}):null},tO=(0,u.e)(ei(),1),tM="default"in tO.default?tO.default.default:tO.default;function tI(e,t){return e===t||e.startsWith(`${t}.`)}function tB({formState:e,path:t,rowIndex:n}){let a={},l="number"!=typeof n?t:`${t}.${n}`;for(let t in e){if(!tI(t,l))continue;let{customComponents:n,validate:r,...i}=e[t];Array.isArray(i.rows)&&(i.rows=i.rows.map(e=>{if(!e||"object"!=typeof e)return e;let{customComponents:t,...n}=e;return n})),a[t]=i}return a}function tz({dataFromClipboard:e,formState:t,path:n,rowIndex:a}){let l,{type:r,data:i,path:o,rowIndex:s}=e,c="number"!=typeof s,d="number"!=typeof a,u=!c&&d,p="array"===r,h;if(h=c&&d?o:c?`${o}.${a}`:`${o}.${s}`,l=d?u?`${n}.0`:n:`${n}.${a}`,u){let e=`${n}.0`,a=i[`${h}.id`]?.value,l=t[n].rows?.length;for(let r in t[n].rows=[{...l&&p?t[n].rows[0]:{},id:a,isLoading:!1,lastRenderedPath:e}],t[n].value=1,t[n].initialValue=1,t[n].disableFormData=!0,t)r!==n&&!tI(r,e)&&tI(r,n)&&delete t[r]}let f=new Map;for(let e in i){if(!d&&e===`${h}.id`||!tI(e,h))continue;let n=e.replace(h,l),a=p?t[n]?.customComponents:void 0,r=p?t[n]?.validate:void 0;if(e.endsWith(".id")&&i[e]?.value){let l=i[e].value;if("string"==typeof l&&tM.isValid(l)){let l=new tM().toHexString();f.set(e,l),t[n]={customComponents:a,validate:r,...i[e],initialValue:l,value:l};continue}}t[n]={customComponents:a,validate:r,...i[e]}}for(let[e,n]of f){let a=e.replace(`${h}.`,"").split(".");if(a.length>=2){let e=parseInt(a[a.length-2],10),r=a.slice(0,a.length-2).join("."),i=r?`${l}.${r}`:l;if(t[i]&&Array.isArray(t[i].rows)){let a=t[i].rows;!isNaN(e)&&a[e]&&(a[e].id=n)}}else if(1===a.length&&"id"===a[0]){let e=l.split("."),a=e[e.length-1],r=isNaN(parseInt(a,10))?0:parseInt(a,10),i=isNaN(parseInt(a,10))?l:e.slice(0,-1).join(".");if(t[i]&&Array.isArray(t[i].rows)){let e=t[i].rows;e[r]&&(e[r].id=n)}}}return t}function tU(e){var t,n;let a;return e?"[object Window]"===(a=Object.prototype.toString.call(e))||"[object global]"===a?e:"nodeType"in e&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}var tV="u">typeof window&&"u">typeof window.document&&"u">typeof window.document.createElement?o.useLayoutEffect:o.useEffect,tH={},tq=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return n.reduce((e,t)=>{for(let[n,a]of Object.entries(t)){let t=e[n];null!=t&&(e[n]=t+-1*a)}return e},{...e})},tW=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[tW.Translate.toString(e),tW.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:a}=e;return t+" "+n+"ms "+a}}});function tK(e,t,n){let a=e.slice();return a.splice(n<0?a.length+n:n,0,a.splice(t,1)[0]),a}function tQ(e){return null!==e&&e>=0}var tY=e=>{let{rects:t,activeIndex:n,overIndex:a,index:l}=e,r=tK(t,a,n),i=t[l],o=r[l];return o&&i?{x:o.left-i.left,y:o.top-i.top,scaleX:o.width/i.width,scaleY:o.height/i.height}:null}
2,tG="Sortable",tX=o.createContext({activeIndex:-1,containerId:tG,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:tY,disabled:{draggable:!1,droppable:!1}});function tZ(e){let{children:t,id:n,items:a,strategy:l=tY,disabled:r=!1}=e,{active:i,dragOverlay:s,droppableRects:c,over:d,measureDroppableContainers:u}=(0,v.fF)(),p=(0,o.useMemo)(()=>{if(n)return n;let e=null==tH[tG]?0:tH[tG]+1;return tH[tG]=e,tG+"-"+e},[tG,n]),h=null!==s.rect,f=(0,o.useMemo)(()=>a.map(e=>"object"==typeof e&&"id"in e?e.id:e),[a]),m=null!=i,g=i?f.indexOf(i.id):-1,b=d?f.indexOf(d.id):-1,y=(0,o.useRef)(f),x=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(f,y.current),w=-1!==b&&-1===g||x,j="boolean"==typeof r?{draggable:r,droppable:r}:r;tV(()=>{x&&m&&u(f)},[x,f,m,u]),(0,o.useEffect)(()=>{y.current=f},[f]);let C=(0,o.useMemo)(()=>({activeIndex:g,containerId:p,disabled:j,disableTransforms:w,items:f,overIndex:b,useDragOverlay:h,sortedRects:f.reduce((e,t,n)=>{let a=c.get(t);return a&&(e[n]=a),e},Array(f.length)),strategy:l}),[g,p,j.draggable,j.droppable,w,f,b,c,h,l]);return o.createElement(tX.Provider,{value:C},t)}var tJ=e=>{let{id:t,items:n,activeIndex:a,overIndex:l}=e;return tK(n,a,l).indexOf(t)},t0=e=>{let{containerId:t,isSorting:n,wasDragging:a,index:l,items:r,newIndex:i,previousItems:o,previousContainerId:s,transition:c}=e;return!!c&&!!a&&(o===r||l!==i)&&(!!n||i!==l&&t===s)},t1={duration:200,easing:"ease"},t3="transform",t2=tW.Transition.toString({property:t3,duration:0,easing:"linear"}),t6={roleDescription:"sortable"};function t5(e){if(!e)return!1;let t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}var t4=[v.vL.Down,v.vL.Right,v.vL.Up,v.vL.Left],t8=(e,t)=>{let{context:{active:n,collisionRect:a,droppableRects:l,droppableContainers:r,over:i,scrollableAncestors:o}}=t;if(t4.includes(e.code)){if(e.preventDefault(),!n||!a)return;let t=[];r.getEnabled().forEach(n=>{if(!n||null!=n&&n.disabled)return;let r=l.get(n.id);if(r)switch(e.code){case v.vL.Down:a.top<r.top&&t.push(n);break;case v.vL.Up:a.top>r.top&&t.push(n);break;case v.vL.Left:a.left>r.left&&t.push(n);break;case v.vL.Right:a.left<r.left&&t.push(n)}});let d=(0,v.y$)({active:n,collisionRect:a,droppableRects:l,droppableContainers:t,pointerCoordinates:null}),u=(0,v.Vy)(d,"id");if(u===i?.id&&d.length>1&&(u=d[1].id),null!=u){let e=r.get(n.id),t=r.get(u),i=t?l.get(t.id):null,d=t?.node.current;if(d&&i&&e&&t){var s,c;let n=(0,v.sl)(d).some((e,t)=>o[t]!==e),l=t7(e,t),r=(s=e,c=t,!!t5(s)&&!!t5(c)&&!!t7(s,c)&&s.data.current.sortable.index<c.data.current.sortable.index),u=n||!l?{x:0,y:0}:{x:r?a.width-i.width:0,y:r?a.height-i.height:0},p={x:i.left,y:i.top};return u.x&&u.y?p:tq(p,u)}}}};function t7(e,t){return!!t5(e)&&!!t5(t)&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}var t9=e=>{let t,n,a=(0,g.c)(17),{id:l,disabled:r}=e,i;a[0]===Symbol.for("react.memo_cache_sentinel")?(i={duration:250,easing:"cubic-bezier(0, 0.2, 0.2, 1)"},a[0]=i):i=a[0],a[1]!==r||a[2]!==l?(t={id:l,disabled:r,transition:i},a[1]=r,a[2]=l,a[3]=t):t=a[3];let{attributes:s,isDragging:c,listeners:d,setNodeRef:u,transform:p,transition:h}=function(e){var t,n,a,l;let{animateLayoutChanges:r=t0,attributes:i,disabled:s,data:c,getNewIndex:d=tJ,id:u,strategy:p,resizeObserverConfig:h,transition:f=t1}=e,{items:m,containerId:g,activeIndex:b,disabled:y,disableTransforms:x,sortedRects:w,overIndex:j,useDragOverlay:C,strategy:S}=(0,o.useContext)(tX),k=(t=s,n=y,"boolean"==typeof t?{draggable:t,droppable:!1}:{draggable:null!=(a=t?.draggable)?a:n.draggable,droppable:null!=(l=t?.droppable)?l:n.droppable}),_=m.indexOf(u),$=(0,o.useMemo)(()=>({sortable:{containerId:g,index:_,items:m},...c}),[g,c,_,m]),N=(0,o.useMemo)(()=>m.slice(m.indexOf(u)),[m,u]),{rect:P,node:E,isOver:D,setNodeRef:T}=(0,v.zM)({id:u,data:$,disabled:k.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...h}}),{active:A,activatorEvent:R,activeNodeRect:L,attributes:F,setNodeRef:O,listeners:M,isDragging:I,over:B,setActivatorNodeRef:z,transform:U}=(0,v.PM)({id:u,data:$,attributes:{...t6,...i},disabled:k.draggable}),V=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,o.useMemo)(()=>e=>{t.forEach(t=>t(e))},t)}(T,O),H=!!A,q=H&&!x&&tQ(b)&&tQ(j),W=!C&&I,K=q?(W&&q?U:null)??(p??S)({rects:w,activeNodeRect:L,activeIndex:b,overIndex:j,index:_}):null,Q=tQ(b)&&tQ(j)?d({id:u,items:m,activeIndex:b,overIndex:j}):_,Y=A?.id,G=(0,o.useRef)({activeId:Y,items:m,newIndex:Q,containerId:g}),X=m!==G.current.items,Z=r({active:A,containerId:g,isDragging:I,isSorting:H,id:u,index:_,items:m,newIndex:G.current.newIndex,previousItems:G.current.items,previousContainerId:G.current.containerId,transition:f,wasDragging:null!=G.current.activeId}),J=function(e){let{disabled:t,index:n,node:a,rect:l}=e,[r,i]=(0,o.useState)(null),s=(0,o.useRef)(n);return tV(()=>
2{if(!t&&n!==s.current&&a.current){let e=l.current;if(e){let t=(0,v.Sj)(a.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&i(n)}}n!==s.current&&(s.current=n)},[t,n,a,l]),(0,o.useEffect)(()=>{r&&i(null)},[r]),r}({disabled:!Z,index:_,node:E,rect:P});return(0,o.useEffect)(()=>{H&&G.current.newIndex!==Q&&(G.current.newIndex=Q),g!==G.current.containerId&&(G.current.containerId=g),m!==G.current.items&&(G.current.items=m)},[H,Q,g,m]),(0,o.useEffect)(()=>{if(Y===G.current.activeId)return;if(null!=Y&&null==G.current.activeId){G.current.activeId=Y;return}let e=setTimeout(()=>{G.current.activeId=Y},50);return()=>clearTimeout(e)},[Y]),{active:A,activeIndex:b,attributes:F,data:$,rect:P,index:_,newIndex:Q,items:m,isOver:D,isSorting:H,isDragging:I,listeners:M,node:E,overIndex:j,over:B,setNodeRef:V,setActivatorNodeRef:z,setDroppableNodeRef:T,setDraggableNodeRef:O,transform:J??K,transition:J||X&&G.current.newIndex===_?t2:!(W&&!function(e){if(!e)return!1;let{KeyboardEvent:t}=tU(e.target);return t&&e instanceof t}(R)||!f)&&(H||Z)?tW.Transition.toString({...f,property:t3}):void 0}}(t),f=c?"grabbing":"grab",m;a[4]!==f||a[5]!==h?(m={cursor:f,transition:h},a[4]=f,a[5]=h,a[6]=m):m=a[6],a[7]!==s||a[8]!==m?(n={...s,style:m},a[7]=s,a[8]=m,a[9]=n):n=a[9];let b=p&&`translate3d(${p.x}px, ${p.y}px, 0)`,y;return a[10]!==c||a[11]!==d||a[12]!==u||a[13]!==n||a[14]!==b||a[15]!==h?(y={attributes:n,isDragging:c,listeners:d,setNodeRef:u,transform:b,transition:h},a[10]=c,a[11]=d,a[12]=u,a[13]=n,a[14]=b,a[15]=h,a[16]=y):y=a[16],y},ne=e=>{let t=(0,g.c)(12),{id:n,children:a,disabled:l}=e,r;t[0]!==l||t[1]!==n?(r={id:n,disabled:l},t[0]=l,t[1]=n,t[2]=r):r=t[2];let{attributes:i,isDragging:s,listeners:c,setNodeRef:d,transform:u,transition:h}=t9(r),f=s?"grabbing":"grab",m;return t[3]!==i||t[4]!==a||t[5]!==s||t[6]!==c||t[7]!==d||t[8]!==f||t[9]!==u||t[10]!==h?(m=(0,p.jsx)(o.Fragment,{children:a({attributes:{...i,style:{cursor:f}},isDragging:s,listeners:c,setNodeRef:d,transform:u,transition:h})}),t[3]=i,t[4]=a,t[5]=s,t[6]=c,t[7]=d,t[8]=f,t[9]=u,t[10]=h,t[11]=m):m=t[11],m},nt=e=>{let t,n,a=(0,g.c)(20),{children:l,className:r,ids:i,onDragEnd:s,onDragStart:c}=e,d=(0,o.useId)(),u=(0,o.useId)(),h;a[0]!==d?(h={id:d},a[0]=d,a[1]=h):h=a[1];let{setNodeRef:f}=(0,v.zM)(h),m;a[2]===Symbol.for("react.memo_cache_sentinel")?(m={activationConstraint:{distance:5}},a[2]=m):m=a[2],a[3]===Symbol.for("react.memo_cache_sentinel")?(t={activationConstraint:{delay:200,tolerance:5}},a[3]=t):t=a[3],a[4]===Symbol.for("react.memo_cache_sentinel")?(n={coordinateGetter:t8},a[4]=n):n=a[4];let b=(0,v.FR)((0,v.MS)(v.cA,m),(0,v.MS)(v.IG,t),(0,v.MS)(v.uN,n)),y;a[5]!==i||a[6]!==s?(y=e=>{let{active:t,over:n}=e;e.activatorEvent.stopPropagation(),t&&n&&"function"==typeof s&&s({event:e,moveFromIndex:i.findIndex(e=>e===t.id),moveToIndex:i.findIndex(e=>e===n.id)})},a[5]=i,a[6]=s,a[7]=y):y=a[7];let x=y,w;a[8]!==c?(w=e=>{let{active:t}=e;t&&"function"==typeof c&&c({id:t.id,event:e})},a[8]=c,a[9]=w):w=a[9];let j=w,C;return a[10]!==l||a[11]!==r||a[12]!==d||a[13]!==x||a[14]!==j||a[15]!==i||a[16]!==b||a[17]!==f||a[18]!==u?(C=(0,p.jsx)(v.Mp,{collisionDetection:v.fp,id:d,onDragEnd:x,onDragStart:j,sensors:b,children:(0,p.jsx)(tZ,{id:u,items:i,children:(0,p.jsx)("div",{className:r,ref:f,children:l})})}),a[10]=l,a[11]=r,a[12]=d,a[13]=x,a[14]=j,a[15]=i,a[16]=b,a[17]=f,a[18]=u,a[19]=C):C=a[19],C},nn="error-pill",na=e=>{let{className:t,count:n,i18n:a,withMessage:l}=e,r=[nn,!l&&n<99&&`${nn}--fixed-width`,t&&t].filter(Boolean).join(" ");return 0===n?null:(0,p.jsx)("div",{className:r,children:(0,p.jsxs)("div",{className:`${nn}__content`,children:[(0,p.jsx)("span",{className:`${nn}__count`,children:n}),l&&` ${n>1?a.t("general:errors"):a.t("general:error")}`]})})},nl="field-description",nr=e=>{let t=(0,g.c)(8),{className:n,description:a,marginPlacement:l,path:r}=e,{i18n:i}=(0,d.d)();if(a){let e=`field-description-${r?.replace(/\./g,"__")}`,o=l&&`${nl}--margin-${l}`,s;t[0]!==n||t[1]!==e||t[2]!==o?(s=[nl,n,e,o].filter(Boolean),t[0]=n,t[1]=e,t[2]=o,t[3]=s):s=t[3];let c=s.join(" "),d;return t[4]!==a||t[5]!==i||t[6]!==c?(d=(0,p.jsx)("div",{className:c,children:(0,h.s)(a,i)}),t[4]=a,t[5]=i,t[6]=c,t[7]=d):d=t[7],d}return null},ni=e=>{let t=(0,g.c)(8),{alignCaret:n,message:a,path:l,showError:r}=e,i=void 0===n?"right":n,o=eL(),s;t[0]!==l?(s=e=>{let[t]=e;return t&&t?.[l]||null},t[0]=l,t[1]=s):s=t[1];let c=eB(s),d;if(t[2]!==i||t[3]!==c||t[4]!==o||t[5]!==a||t[6]!==r){d=Symbol.for("react.early_return_sentinel");e:{let{errorMessage:e,valid:t}=c||{},n=a||e;if((r||o&&!1===t)&&n?.length){d=(0,p.jsx)(tk,{alignCaret:i,className:"field-error",delay:0,staticPositioning:!0,children:n});break e}}t[2]=i,t[3]=c,t[4]=o,t[5]=a,t[6]=r,t[7]=d}else d=t[7];return d!==Symbol.for("react.early_return_sentinel")?d:null},no=(0,o.createContext)(0),ns=e=>{let t=(0,g.c)(3),{children:n}=e,a=nc()+1,l;return t[0]!==n||t[1]!==a?(l=(0,p.jsx)(no,{value:a,children:n}),t[0]=n,t[1]=a,t[2]=l):l=t[2],l},nc=()=>(0,o.use)(no),nd=(e,t)=>e?.locales&&0!==e.locales.length?e.locales.find(e=>e?.code===t):null;function nu(){return(nu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(null,arguments)}function np(e,t){if(null==e)return{};var n={};for(var a in e)if(({}).hasOwnProperty.call(e,a)){if(-1!==t.indexOf(a))continue;n[a]=e[a]}return n}
2function nh(e,t){return(nh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function nf(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,nh(e,t)}function nm(e,t){return e.replace(RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var ng=o.createContext(null),nb=function(e){return e.scrollTop},nv="unmounted",ny="exited",nx="entering",nw="entered",nj="exiting",nC=function(e){function t(t,n){var a,l=e.call(this,t,n)||this,r=n&&!n.isMounting?t.enter:t.appear;return l.appearStatus=null,t.in?r?(a=ny,l.appearStatus=nx):a=nw:a=t.unmountOnExit||t.mountOnEnter?nv:ny,l.state={status:a},l.nextCallback=null,l}nf(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===nv?{status:ny}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==nx&&n!==nw&&(t=nx):(n===nx||n===nw)&&(t=nj)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,a=this.props.timeout;return e=t=n=a,null!=a&&"number"!=typeof a&&(e=a.exit,t=a.enter,n=void 0!==a.appear?a.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t)if(this.cancelNextCallback(),t===nx){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:s.findDOMNode(this);n&&nb(n)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===ny&&this.setState({status:nv})},n.performEnter=function(e){var t=this,n=this.props.enter,a=this.context?this.context.isMounting:e,l=this.props.nodeRef?[a]:[s.findDOMNode(this),a],r=l[0],i=l[1],o=this.getTimeouts(),c=a?o.appear:o.enter;(e||n)&&1?(this.props.onEnter(r,i),this.safeSetState({status:nx},function(){t.props.onEntering(r,i),t.onTransitionEnd(c,function(){t.safeSetState({status:nw},function(){t.props.onEntered(r,i)})})})):this.safeSetState({status:nw},function(){t.props.onEntered(r)})},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),a=this.props.nodeRef?void 0:s.findDOMNode(this);t?(this.props.onExit(a),this.safeSetState({status:nj},function(){e.props.onExiting(a),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:ny},function(){e.props.onExited(a)})})})):this.safeSetState({status:ny},function(){e.props.onExited(a)})},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(a){n&&(n=!1,t.nextCallback=null,e(a))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:s.findDOMNode(this),a=null==e&&!this.props.addEndListener;if(!n||a)return void setTimeout(this.nextCallback,0);if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],r=l[0],i=l[1];this.props.addEndListener(r,i)}null!=e&&setTimeout(this.nextCallback,e)},n.render=function(){var e=this.state.status;if(e===nv)return null;var t=this.props,n=t.children,a=(t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef,np(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return o.createElement(ng.Provider,{value:null},"function"==typeof n?n(e,a):o.cloneElement(o.Children.only(n),a))},t}(o.Component);function nS(){}nC.contextType=ng,nC.propTypes={},nC.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:nS,onEntering:nS,onEntered:nS,onExit:nS,onExiting:nS,onExited:nS},nC.UNMOUNTED=nv,nC.EXITED=ny,nC.ENTERING=nx,nC.ENTERED=nw,nC.EXITING=nj;var nk=function(e,t){return e&&t&&t.split(" ").forEach(function(t){e.classList?e.classList.remove(t):"string"==typeof e.className?e.className=nm(e.className,t):e.setAttribute("class",nm(e.className&&e.className.baseVal||"",t))})},n_=function(e){function t(){for(var t,n=arguments.length,a=Array(n),l=0;l<n;l++)a[l]=arguments[l];
2return(t=e.call.apply(e,[this].concat(a))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,n){var a=t.resolveArguments(e,n),l=a[0],r=a[1];t.removeClasses(l,"exit"),t.addClass(l,r?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(e,n)},t.onEntering=function(e,n){var a=t.resolveArguments(e,n),l=a[0],r=a[1];t.addClass(l,r?"appear":"enter","active"),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var a=t.resolveArguments(e,n),l=a[0],r=a[1]?"appear":"enter";t.removeClasses(l,r),t.addClass(l,r,"done"),t.props.onEntered&&t.props.onEntered(e,n)},t.onExit=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"appear"),t.removeClasses(n,"enter"),t.addClass(n,"exit","base"),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var n=t.resolveArguments(e)[0];t.addClass(n,"exit","active"),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"exit"),t.addClass(n,"exit","done"),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,n){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,n]},t.getClassNames=function(e){var n=t.props.classNames,a="string"==typeof n,l=a&&n?n+"-":"",r=a?""+l+e:n[e],i=a?r+"-active":n[e+"Active"],o=a?r+"-done":n[e+"Done"];return{baseClassName:r,activeClassName:i,doneClassName:o}},t}nf(t,e);var n=t.prototype;return n.addClass=function(e,t,n){var a,l=this.getClassNames(t)[n+"ClassName"],r=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===n&&r&&(l+=" "+r),"active"===n&&e&&nb(e),l&&(this.appliedClasses[t][n]=l,a=l,e&&a&&a.split(" ").forEach(function(t){e.classList?e.classList.add(t):(e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" "))||("string"==typeof e.className?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],a=n.base,l=n.active,r=n.done;this.appliedClasses[t]={},a&&nk(e,a),l&&nk(e,l),r&&nk(e,r)},n.render=function(){var e=this.props,t=(e.classNames,np(e,["classNames"]));return o.createElement(nC,nu({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(o.Component);n_.defaultProps={classNames:""},n_.propTypes={};var n$=(0,o.createContext)({}),nN=()=>(0,o.useContext)(n$),nP=e=>e?{appear:`${e}--appear`,appearActive:`${e}--appearActive`,appearDone:`${e}--appearDone`,enter:`${e}--enter`,enterActive:`${e}--enterActive`,enterDone:`${e}--enterDone`,exit:`${e}--exit`,exitActive:`${e}--exitActive`,exitDone:`${e}--exitDone`}:{};function nE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function nD(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nE(Object(n),!0).forEach(function(t){var a,l,r;a=e,l=t,r=n[t],(l=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=typeof a)return a;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(l))in a?Object.defineProperty(a,l,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[l]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nE(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}(0,d.j)();var nT=function(e,t){if(e.length>0){var n=e[e.length-1];n!==t&&n.pause()}var a=e.indexOf(t);-1===a||e.splice(a,1),e.push(t)},nA=function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()},nR=function(e){return e?.key==="Tab"||e?.keyCode===9},nL=function(e){return nR(e)&&!e.shiftKey},nF=function(e){return nR(e)&&e.shiftKey},nO=function(e){return setTimeout(e,0)},nM=function(e,t){var n=-1;return e.every(function(e,a){return!t(e)||(n=a,!1)}),n},nI=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return"function"==typeof e?e.apply(void 0,n):e},nB=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},nz=[],nU=function(e,t){var n,a=t?.document||document,l=t?.trapStack||nz,r=nD({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:nL,isKeyBackward:nF},t),i={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o=function(e,t,n){return e&&void 0!==e[t]?e[t]:r[n||t]},s=function(e,t){var n="function"==typeof t?.composedPath?t.composedPath():void 0;return i.containerGroups.findIndex(function(t){var a=t.container,l=t.tabbableNodes;return a.contains(e)||n?.includes(a)||l.find(function(t){return t===e})})},c=function(e){var t=r[e];if("function"==typeof t){for(var n=arguments.length,l=Array(n>1?n-1:0),i=1;i<n;i++)l[i-1]=arguments[i];t=t.apply(void 0,l)}if(!0===t&&(t=void 0),!t){if(void 0===t||!1===t)return t;throw Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var o=t;if("string"==typeof t&&!(o=a.querySelector(t)))throw Error("`".concat(e,"` as selector refers to no known node"));return o},u=function(){var e=c("initialFocus");if(!1===e)return!1;if(void 0===e||!(0,d.i)(e,r.tabbableOptions))if(s(a.activeElement)>=0)e=a.activeElement;else{var t=i.tabbableGroups[0];e=t&&t.firstTabbableNode||c("fallbackFocus")}if(!e)throw Error("Your focus-trap needs to have at least one focusable element");return e},p=function(){if(i.containerGroups=i.containers.map(function(e){var t=(0,d.f)(e,r.tabbableOptions),n=(0,d.g)(e,r.tabbableOptions),a=t.length>0?t[0]:void 0,l=t.length>0?t[t.length-1]:void 0,i=n.find(function(e){return(0,d.h)(e)}),o=n.slice().reverse().find(function(e){return(0,d.h)(e)}),s=!!t.find(function(e){return(0,d.e)(e)>0});return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:s,firstTabbableNode:a,lastTabbableNode:l,firstDomTabbableNode:i,lastDomTabbableNode:o,nextTabbableNode:function(e){var a=!(arguments.length>1)||void 0===arguments[1]||arguments[1],l=t.indexOf(e);return l<0?a?n.slice(n.indexOf(e)+1).find(function(e){return(0,d.h)(e)}):n.slice(0,n.indexOf(e)).reverse().find(function(e){return(0,d.h)(e)}):t[l+(a?1:-1)]}}}),i.tabbableGroups=i.containerGroups.filter(function(e){return e.tabbableNodes.length>0}),i.tabbableGroups.length<=0&&!c("fallbackFocus"))throw Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(i.containerGroups.find(function(e){return e.posTabIndexesFound}
2)&&i.containerGroups.length>1)throw Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},h=function e(t){var n=t.activeElement;if(n)return n.shadowRoot&&null!==n.shadowRoot.activeElement?e(n.shadowRoot):n},f=function e(t){if(!1!==t&&t!==h(document)){if(!t||!t.focus)return void e(u());t.focus({preventScroll:!!r.preventScroll}),i.mostRecentlyFocusedNode=t,t.tagName&&"input"===t.tagName.toLowerCase()&&"function"==typeof t.select&&t.select()}},m=function(e){var t=c("setReturnFocus",e);return t||!1!==t&&e},g=function(e){var t=e.target,n=e.event,a=e.isBackward,l=void 0!==a&&a;t=t||nB(n),p();var o=null;if(i.tabbableGroups.length>0){var u=s(t,n),h=u>=0?i.containerGroups[u]:void 0;if(u<0)o=l?i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:i.tabbableGroups[0].firstTabbableNode;else if(l){var f=nM(i.tabbableGroups,function(e){var n=e.firstTabbableNode;return t===n});if(f<0&&(h.container===t||(0,d.i)(t,r.tabbableOptions)&&!(0,d.h)(t,r.tabbableOptions)&&!h.nextTabbableNode(t,!1))&&(f=u),f>=0){var m=0===f?i.tabbableGroups.length-1:f-1,g=i.tabbableGroups[m];o=(0,d.e)(t)>=0?g.lastTabbableNode:g.lastDomTabbableNode}else nR(n)||(o=h.nextTabbableNode(t,!1))}else{var b=nM(i.tabbableGroups,function(e){var n=e.lastTabbableNode;return t===n});if(b<0&&(h.container===t||(0,d.i)(t,r.tabbableOptions)&&!(0,d.h)(t,r.tabbableOptions)&&!h.nextTabbableNode(t))&&(b=u),b>=0){var v=b===i.tabbableGroups.length-1?0:b+1,y=i.tabbableGroups[v];o=(0,d.e)(t)>=0?y.firstTabbableNode:y.firstDomTabbableNode}else nR(n)||(o=h.nextTabbableNode(t))}}else o=c("fallbackFocus");return o},b=function(e){if(!(s(nB(e),e)>=0)){if(nI(r.clickOutsideDeactivates,e))return void n.deactivate({returnFocus:r.returnFocusOnDeactivate});nI(r.allowOutsideClick,e)||e.preventDefault()}},v=function(e){var t=nB(e),n=s(t,e)>=0;if(n||t instanceof Document)n&&(i.mostRecentlyFocusedNode=t);else{e.stopImmediatePropagation();var a,l=!0;if(i.mostRecentlyFocusedNode)if((0,d.e)(i.mostRecentlyFocusedNode)>0){var o=s(i.mostRecentlyFocusedNode),c=i.containerGroups[o].tabbableNodes;if(c.length>0){var p=c.findIndex(function(e){return e===i.mostRecentlyFocusedNode});p>=0&&(r.isKeyForward(i.recentNavEvent)?p+1<c.length&&(a=c[p+1],l=!1):p-1>=0&&(a=c[p-1],l=!1))}}else i.containerGroups.some(function(e){return e.tabbableNodes.some(function(e){return(0,d.e)(e)>0})})||(l=!1);else l=!1;l&&(a=g({target:i.mostRecentlyFocusedNode,isBackward:r.isKeyBackward(i.recentNavEvent)})),f(a||i.mostRecentlyFocusedNode||u())}i.recentNavEvent=void 0},y=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i.recentNavEvent=e;var n=g({event:e,isBackward:t});n&&(nR(e)&&e.preventDefault(),f(n))},x=function(e){if((e?.key==="Escape"||e?.key==="Esc"||e?.keyCode===27)&&!1!==nI(r.escapeDeactivates,e)){e.preventDefault(),n.deactivate();return}(r.isKeyForward(e)||r.isKeyBackward(e))&&y(e,r.isKeyBackward(e))},w=function(e){s(nB(e),e)>=0||nI(r.clickOutsideDeactivates,e)||nI(r.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},j=function(){if(i.active)return nT(l,n),i.delayInitialFocusTimer=r.delayInitialFocus?nO(function(){f(u())}):f(u()),a.addEventListener("focusin",v,!0),a.addEventListener("mousedown",b,{capture:!0,passive:!1}),a.addEventListener("touchstart",b,{capture:!0,passive:!1}),a.addEventListener("click",w,{capture:!0,passive:!1}),a.addEventListener("keydown",x,{capture:!0,passive:!1}),n},C=function(){if(i.active)return a.removeEventListener("focusin",v,!0),a.removeEventListener("mousedown",b,!0),a.removeEventListener("touchstart",b,!0),a.removeEventListener("click",w,!0),a.removeEventListener("keydown",x,!0),n},S="u">typeof window&&"MutationObserver"in window?new MutationObserver(function(e){e.some(function(e){return Array.from(e.removedNodes).some(function(e){return e===i.mostRecentlyFocusedNode})})&&f(u())}):void 0,k=function(){S&&(S.disconnect(),i.active&&!i.paused&&i.containers.map(function(e){S.observe(e,{subtree:!0,childList:!0})}))};return(n={get active(){return i.active},get paused(){return i.paused},activate:function(e){if(i.active)return this;var t=o(e,"onActivate"),n=o(e,"onPostActivate"),l=o(e,"checkCanFocusTrap");l||p(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=a.activeElement,t?.();var r=function(){l&&p(),j(),k(),n?.()};return l?l(i.containers.concat()).then(r,r):r(),this},deactivate:function(e){if(!i.active)return this;var t=nD({onDeactivate:r.onDeactivate,onPostDeactivate:r.onPostDeactivate,checkCanReturnFocus:r.checkCanReturnFocus},e);clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,C(),i.active=!1,i.paused=!1,k(),nA(l,n);var a=o(t,"onDeactivate"),s=o(t,"onPostDeactivate"),c=o(t,"checkCanReturnFocus"),d=o(t,"returnFocus","returnFocusOnDeactivate");a?.();var u=function(){nO(function(){d&&f(m(i.nodeFocusedBeforeActivation)),s?.()})};return d&&c?c(m(i.nodeFocusedBeforeActivation)).then(u,u):u(),this},pause:function(e){if(i.paused||!i.active)return this;var t=o(e,"onPause"),n=o(e,"onPostPause");
2return i.paused=!0,t?.(),C(),k(),n?.(),this},unpause:function(e){if(!i.paused||!i.active)return this;var t=o(e,"onUnpause"),n=o(e,"onPostUnpause");return i.paused=!1,t?.(),p(),j(),k(),n?.(),this},updateContainerElements:function(e){return i.containers=[].concat(e).filter(Boolean).map(function(e){return"string"==typeof e?a.querySelector(e):e}),i.active&&p(),k(),this}}).updateContainerElements(e),n},nV=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var l=0,a=Object.getOwnPropertySymbols(e);l<a.length;l++)0>t.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(n[a[l]]=e[a[l]]);return n},nH="modal-item",nq=(r=e=>{let{children:t}=e;return t?"function"==typeof t?(0,p.jsx)(o.Fragment,{children:t(e)}):(0,p.jsx)(o.Fragment,{children:t}):null},e=>{let t=nN(),n=(0,o.useRef)(null),[a,l]=(0,o.useState)(!1),i=(0,o.useRef)(!1),[c,d]=(0,o.useState)(null),{modalState:u,classPrefix:h,containerRef:f,transTime:m,setCloseOnBlur:g,setBodyScrollLock:b,openModal:v}=t,{className:y,htmlElement:x="dialog",slug:w="",closeOnBlur:j=!0,lockBodyScroll:C=!0,classPrefix:S,onEnter:k,onEntering:_,onEntered:$,onExit:N,onExiting:P,onExited:E,openOnInit:D,trapFocus:T=!0,focusTrapOptions:A={}}=e,R=nV(e,["className","htmlElement","slug","closeOnBlur","lockBodyScroll","classPrefix","onEnter","onEntering","onEntered","onExit","onExiting","onExited","openOnInit","trapFocus","focusTrapOptions"]),L=S||h,F=u[w]&&u[w].isOpen;(0,o.useEffect)(()=>{if(T){let e=n.current;!1===i.current&&e&&(d(nU(e,Object.assign(Object.assign({},A),{fallbackFocus:A?.fallbackFocus||e,allowOutsideClick:!("u">typeof A.allowOutsideClick)||A.allowOutsideClick}))),i.current=!0)}},[T,a,A]),(0,o.useEffect)(()=>
2{l(!0)},[]),(0,o.useEffect)(()=>(c&&(F?c.activate():c.deactivate()),()=>{c&&c.deactivate()}),[F,c]),(0,o.useEffect)(()=>{F&&g(j)},[F,j,g]),(0,o.useEffect)(()=>{let e=n.current;return e&&b(!!(F&&C),e),()=>{e&&b(!1,e)}},[F,C,b]);let[O,M]=(0,o.useState)(F);if((0,o.useEffect)(()=>{F?M(F):setTimeout(()=>M(!1),m)},[F,m]),(0,o.useEffect)(()=>{D&&v(w)},[w,D,v]),f.current){let a=L?`${L}__${nH}`:nH,l=[a,`${a}--slug-${w}`,y].filter(Boolean).join(" "),i=Object.assign({role:"dialog"!==x?"dialog":void 0,open:"dialog"===x?O||F:void 0,"aria-modal":!0,"aria-label":R["aria-labelledby"]?void 0:w},R);return s.createPortal((0,p.jsx)(n_,{nodeRef:n,timeout:m,in:F,classNames:nP(a),appear:!0,onEnter:k,onEntering:_,onEntered:$,onExit:N,onExiting:P,onExited:E,children:(0,p.jsx)(x,Object.assign({ref:n,id:R?.id||w,className:l},i,{children:(0,p.jsx)(r,Object.assign({},e,{isOpen:F,modal:t}))}))}),f.current)}return null}),nW=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var l=0,a=Object.getOwnPropertySymbols(e);l<a.length;l++)0>t.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(n[a[l]]=e[a[l]]);return n},nK="modal-container",nQ=e=>{let{oneModalIsOpen:t,classPrefix:n,transTime:a,setContainerRef:l,containerRef:r,closeAllModals:i,closeOnBlur:o}=nN(),{className:s,htmlElement:c="div",children:d,onClick:u}=e,h=nW(e,["className","htmlElement","children","onClick"]),f=n?`${n}__${nK}`:nK,m=[f,s].filter(Boolean).join(" "),g=Object.assign(Object.assign({},h),{onClick:e=>{o&&i(),"function"==typeof u&&u(e)}});return(0,p.jsx)(n_,{nodeRef:r,in:t,timeout:a,classNames:nP(f),appear:!0,children:(0,p.jsx)(c,Object.assign({className:m,ref:l},g,{children:d&&d}))})},nY=!1;"u">typeof window&&(nX={get passive(){nY=!0}},window.addEventListener("testPassive",null,nX),window.removeEventListener("testPassive",null,nX));var nG,nX,nZ="u">typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),nJ=[],n0=!1,n1=-1,n3=void 0,n2=void 0,n6=void 0,n5=function(e){return nJ.some(function(t){return!!(t.options.allowTouchMove&&t.options.allowTouchMove(e))})},n4=function(e){var t=e||window.event;return!!n5(t.target)||t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1)},n8=function(e){if(void 0===n6){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;if(t&&n>0){var a=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);n6=document.body.style.paddingRight,document.body.style.paddingRight=a+n+"px"}}void 0===n3&&(n3=document.body.style.overflow,document.body.style.overflow="hidden")},n7=function(){void 0!==n6&&(document.body.style.paddingRight=n6,n6=void 0),void 0!==n3&&(document.body.style.overflow=n3,n3=void 0)},n9=function(){if(void 0!==n2){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=n2.position,document.body.style.top=n2.top,document.body.style.left=n2.left,window.scrollTo(t,e),n2=void 0}},ae=function(e,t){var n=e.targetTouches[0].clientY-n1;return!n5(e.target)&&(t&&0===t.scrollTop&&n>0||t&&t.scrollHeight-t.scrollTop<=t.clientHeight&&n<0?n4(e):(e.stopPropagation(),!0))},at=function(e,t){e?!nJ.some(function(t){return t.targetElement===e}
2)&&(nJ=[].concat(function(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}(nJ),[{targetElement:e,options:t||{}}]),nZ?window.requestAnimationFrame(function(){if(void 0===n2){n2={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,t=e.scrollY,n=e.scrollX,a=e.innerHeight;document.body.style.position="fixed",document.body.style.top=-t,document.body.style.left=-n,setTimeout(function(){return window.requestAnimationFrame(function(){var e=a-window.innerHeight;e&&t>=a&&(document.body.style.top=-(t+e))})},300)}}):n8(t),nZ&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(n1=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&ae(t,e)},n0||(document.addEventListener("touchmove",n4,nY?{passive:!1}:void 0),n0=!0))):console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.")},an=function(e){e?(nJ=nJ.filter(function(t){return t.targetElement!==e}),nZ&&(e.ontouchstart=null,e.ontouchmove=null,n0&&0===nJ.length&&(document.removeEventListener("touchmove",n4,nY?{passive:!1}:void 0),n0=!1)),nZ?n9():n7()):console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.")},aa=(e,t)=>{let n=Object.assign({},e),{type:a,payload:l}=t;switch(a){case"UPDATE_MODAL":{let{slug:e}=l;e&&(n[e]=Object.assign(Object.assign({},n[e]),l));break}case"OPEN_MODAL":{let{slug:e}=l;e&&(e in n&&n[e].isOpen||(n[e]=Object.assign(Object.assign({},n[e]),{slug:e,openedOn:Date.now(),isOpen:!0})));break}case"TOGGLE_MODAL":{let{slug:e}=l;if(e){let t=e in n&&n[e].isOpen;n[e]=Object.assign(Object.assign({},n[e]),{slug:e,openedOn:t?void 0:Date.now(),isOpen:!t})}break}case"CLOSE_MODAL":{let{slug:e}=l;e&&(n[e]=Object.assign(Object.assign({},n[e]),{slug:e,openedOn:void 0,isOpen:!1}));break}case"REMOVE_MODAL":{let{slug:e}=l;e&&e in n&&delete n[e];break}case"CLOSE_LATEST_MODAL":{let e=Object.keys(n).reduce((e,t)=>{let a=n[t];return a.isOpen&&"number"==typeof a.openedOn&&(!e||"number"==typeof e.openedOn&&a.openedOn>e.openedOn)?a:e},void 0);e&&(n[e.slug]=Object.assign(Object.assign({},n[e.slug]),{isOpen:!1,openedOn:void 0}));break}case"CLOSE_ALL_MODALS":n=Object.entries(n).reduce((e,[t,n])=>(e[t]=Object.assign(Object.assign({},n),{isOpen:!1,openedOn:void 0}),e),{})}return n},al=e=>{let{classPrefix:t,minifyCSS:n=!0,generateCSS:a=!0,zIndex:l=9999,handleParamChange:r,children:i,transTime:s=250}=e,c=(0,o.useRef)(null),[d,u]=(0,o.useReducer)(aa,{},()=>(()=>{let e=(()=>{if("u">typeof window)return new URLSearchParams(window.location.search)})(),t=[];if(e){let n=e.get("modal");n&&(t=n.includes(",")?n.split(","):[n])}return t})().reduce((e,t)=>(e[t]={slug:t,isOpen:!0,openedOn:Date.now()},e),{})),[h,f]=(0,o.useState)(!1),[m,g]=(0,o.useState)(!1),[b,v]=(0,o.useState)(!1),[y,x]=(0,o.useState)(""),w=(0,o.useRef)(!1),j=(0,o.useCallback)(e=>{27===e.keyCode&&u({type:"CLOSE_LATEST_MODAL"})},[]);(0,o.useEffect)(()=>(w.current||(document.addEventListener("keydown",e=>j(e),!1),w.current=!0),()=>{w.current&&document.removeEventListener("keydown",e=>j(e),!1)}),[j]),(0,o.useEffect)(()=>{if(a){let e="";e=(({classPrefix:e,zIndex:t})=>{let n=e?`${e}__`:"";return`
3    .${n}${nK} {
4      top: 0;
5      right: 0;
6      bottom: 0;
7      left: 0;
8      position: fixed;
9      pointer-events: none;
10      visibility: hidden;
11      z-index: -1;
12    }
13
14    .${n}${nK}--appear,
15    .${n}${nK}--appearDone,
16    .${n}${nK}--enter,
17    .${n}${nK}--enterDone,
18    .${n}${nK}--exit {
19      pointer-events: all;
20      visibility: visible;
21      z-index: ${t};
22    }
23
24    .${n}${nH} {
25      position: absolute;
26      visibility: hidden;
27    }
28
29    .${n}${nH}--appear,
30    .${n}${nH}--appearDone,
31    .${n}${nH}--enter,
32    .${n}${nH}--enterDone,
33    .${n}${nH}--exit {
34      visibility: visible;
35    }
36  `})({classPrefix:t,zIndex:l}),n&&(e=e.replace(/\n/g,"").replace(/\s\s+/g," ")),x(e)}},[a,n,l,t]),(0,o.useEffect)(()=>{if("function"==typeof r&&r(d),"boolean"==typeof r&&r){let e=Object.keys(d).filter(e=>d[e].isOpen),t=new URLSearchParams;for(let n of e)t.append("modal",n);let n=t.toString()?`?${t}`:"",a=`${window.location.pathname}${n}`;window.history.pushState({},"",a)}},[d,r]),(0,o.useEffect)(()=>{f(Object.keys(d).some(e=>d[e].isOpen))},[d]);let C=(0,o.useCallback)((e,t)=>{t&&(e?(at(t),v(!0)):(an(t),v(!1)))},[]),S=(0,o.useCallback)(e=>{c.current=e},[]),k=(0,o.useCallback)(e=>{u({type:"OPEN_MODAL",payload:{slug:e}})},[]),_=(0,o.useCallback)(e=>{u({type:"CLOSE_MODAL",payload:{slug:e}})},[]),$=(0,o.useCallback)(()=>{u({type:"CLOSE_ALL_MODALS"})},[]),N=(0,o.useCallback)(e=>{u({type:"TOGGLE_MODAL",payload:{slug:e}})},[]),P=(0,o.useCallback)(e=>d[e]&&d[e].isOpen,[d]),E=Object.assign({},e);return delete E.children,(0,p.jsxs)(o.Fragment,{children:[a&&(0,p.jsx)("style",{dangerouslySetInnerHTML:{__html:y}}),(0,p.jsx)(n$.Provider,{value:Object.assign(Object.assign({},E),{transTime:s,containerRef:c,modalState:d,oneModalIsOpen:h,isModalOpen:P,closeOnBlur:m,bodyScrollIsLocked:b,classPrefix:t,closeAllModals:$,setCloseOnBlur:g,openModal:k,closeModal:_,toggleModal:N,setBodyScrollLock:C,setContainerRef:S}),children:i})]})}
36,ar="gutter",ai=e=>{let{children:t,className:n,left:a=!0,negativeLeft:l=!1,negativeRight:r=!1,ref:i,right:o=!0}=e,s=a&&!l,c=o&&!r;return(0,p.jsx)("div",{className:[ar,s&&`${ar}--left`,c&&`${ar}--right`,l&&`${ar}--negative-left`,r&&`${ar}--negative-right`,n].filter(Boolean).join(" "),ref:i,children:t})},ao=e=>{let t=(0,g.c)(3),n=(0,o.useId)(),a=nc(),l=`${e}-${n}`,r;return t[0]!==a||t[1]!==l?(r=ac({slug:l,depth:a}),t[0]=a,t[1]=l,t[2]=r):r=t[2],r},as="drawer",ac=({slug:e,depth:t})=>`drawer_${t}_${e}`,ad=e=>{let t=(0,g.c)(4),{slug:n,children:a,className:l,disabled:r,onClick:i,...o}=e,{openModal:s}=nN(),c;return t[0]!==i||t[1]!==s||t[2]!==n?(c=e=>{s(n),"function"==typeof i&&i(e)},t[0]=i,t[1]=s,t[2]=n,t[3]=c):c=t[3],(0,p.jsx)("button",{className:l,disabled:r,onClick:c,type:"button",...o,children:a})},au=e=>{let t=(0,g.c)(22),{slug:n,children:a,className:l,gutter:r,Header:i,hoverTitle:s,title:c}=e,u=void 0===r||r,{t:h}=(0,d.d)(),{closeModal:f,modalState:m}=nN(),b=af(),v=!!m[n]?.isOpen,[y,x]=(0,o.useState)(v),w,j;if(t[0]!==v?(w=()=>{x(v)},j=[v],t[0]=v,t[1]=w,t[2]=j):(w=t[1],j=t[2]),(0,o.useLayoutEffect)(w,j),v){let e=y&&`${as}--is-open`,r=b>1&&`${as}--nested`,o;t[3]!==l||t[4]!==e||t[5]!==r?(o=[l,as,e,r].filter(Boolean),t[3]=l,t[4]=e,t[5]=r,t[6]=o):o=t[6];let m=o.join(" "),g=100+b,v;if(t[7]!==i||t[8]!==a||t[9]!==f||t[10]!==b||t[11]!==u||t[12]!==s||t[13]!==n||t[14]!==h||t[15]!==m||t[16]!==g||t[17]!==c){let e;t[19]!==f||t[20]!==n?(e=()=>f(n),t[19]=f,t[20]=n,t[21]=e):e=t[21],v=(0,p.jsx)(ah,{children:(0,p.jsxs)(nq,{className:m,closeOnBlur:!1,slug:n,style:{zIndex:g},children:[(!b||1===b)&&(0,p.jsx)("div",{className:`${as}__blur-bg`}),(0,p.jsx)("button",{"aria-label":h("general:close"),className:`${as}__close`,id:`close-drawer__${n}`,onClick:e,type:"button"}),(0,p.jsxs)("div",{className:`${as}__content`,style:{width:`calc(100% - (${b} * var(--gutter-h)))`},children:[(0,p.jsx)("div",{className:`${as}__blur-bg-content`}),(0,p.jsxs)(ai,{className:`${as}__content-children`,left:u,right:u,children:[i,void 0===i&&(0,p.jsxs)("div",{className:`${as}__header`,children:[(0,p.jsx)("h2",{className:`${as}__header__title`,title:s?c:null,children:c}),(0,p.jsx)("button",{"aria-label":h("general:close"),className:`${as}__header__close`,id:`close-drawer__${n}`,onClick:()=>f(n),type:"button",children:(0,p.jsx)(d.a,{})})]}),a]})]})]})}),t[7]=i,t[8]=a,t[9]=f,t[10]=b,t[11]=u,t[12]=s,t[13]=n,t[14]=h,t[15]=m,t[16]=g,t[17]=c,t[18]=v}else v=t[18];return v}return null},ap=(0,o.createContext)(1),ah=e=>{let t=(0,g.c)(3),{children:n}=e,a=af()+1,l;return t[0]!==n||t[1]!==a?(l=(0,p.jsx)(ap,{value:a,children:n}),t[0]=n,t[1]=a,t[2]=l):l=t[2],l},af=()=>(0,o.use)(ap),am="confirmation-modal";function ag(e){let t,n=(0,g.c)(25),{body:a,cancelLabel:l,className:r,confirmingLabel:i,confirmLabel:s,heading:c,modalSlug:u,onCancel:h,onConfirm:f}=e,m=af(),[b,v]=o.useState(!1),{closeModal:y,isModalOpen:x}=nN(),{t:w}=(0,d.d)(),j;n[0]!==y||n[1]!==b||n[2]!==u||n[3]!==f?(j=async()=>{b||(v(!0),"function"==typeof f&&await f(),v(!1),y(u))},n[0]=y,n[1]=b,n[2]=u,n[3]=f,n[4]=j):j=n[4];let C=j,S;n[5]!==y||n[6]!==b||n[7]!==u||n[8]!==h?(S=()=>{b||(y(u),"function"==typeof h&&h())},n[5]=y,n[6]=b,n[7]=u,n[8]=h,n[9]=S):S=n[9];let k=S;if(!x(u))return null;n[10]!==r?(t=[am,r].filter(Boolean),n[10]=r,n[11]=t):t=n[11];let _=t.join(" "),$=100+m,N;return n[12]!==a||n[13]!==l||n[14]!==s||n[15]!==b||n[16]!==i||n[17]!==c||n[18]!==u||n[19]!==k||n[20]!==C||n[21]!==w||n[22]!==_||n[23]!==$?(N=(0,p.jsx)(nq,{className:_,closeOnBlur:!1,slug:u,style:{zIndex:$},children:(0,p.jsxs)("div",{className:`${am}__wrapper`,children:[(0,p.jsxs)("div",{className:`${am}__content`,children:["string"==typeof c?(0,p.jsx)("h1",{children:c}):c,"string"==typeof a?(0,p.jsx)("p",{children:a}):a]}),(0,p.jsxs)("div",{className:`${am}__controls`,children:[(0,p.jsx)(tN,{buttonStyle:"secondary",disabled:b,id:"confirm-cancel",onClick:k,size:"large",type:"button",children:l||w("general:cancel")}),(0,p.jsx)(tN,{id:"confirm-action",onClick:C,size:"large",children:b?i||`${w("general:loading")}...`:s||w("general:confirm")})]})]})}),n[12]=a,n[13]=l,n[14]=s,n[15]=b,n[16]=i,n[17]=c,n[18]=u,n[19]=k,n[20]=C,n[21]=w,n[22]=_,n[23]=$,n[24]=N):N=n[24],N}var ab="stay-logged-in",av=()=>{let e=(0,g.c)(11),{refreshCookie:t}=aj(),n=(0,m.useRouter)(),{config:a}=(0,c.c)(),{admin:l,routes:r}=a,{routes:i}=l,{logout:o}=i,{admin:s}=r,{t:u}=(0,d.d)(),{startRouteTransition:h}=te(),f;e[0]!==s||e[1]!==o||e[2]!==n||e[3]!==h?(f=()=>h(()=>n.push((0,y.Q)({adminRoute:s,path:o}))),e[0]=s,e[1]=o,e[2]=n,e[3]=h,e[4]=f):f=e[4];let b=f,v;e[5]!==t?(v=()=>{t()},e[5]=t,e[6]=v):v=e[6];let x=v,w;return e[7]!==x||e[8]!==b||e[9]!==u?(w=(0,p.jsx)(ag,{body:u("authentication:youAreInactive"),cancelLabel:u("authentication:stayLoggedIn"),
36confirmLabel:u("authentication:logOut"),heading:u("authentication:stayLoggedIn"),modalSlug:ab,onCancel:x,onConfirm:b}),e[7]=x,e[8]=b,e[9]=u,e[10]=w):w=e[10],w},ay={delete:(e,t={headers:{}})=>{let n=t&&t.headers?{...t.headers}:{};return fetch(e,{...t,credentials:"include",headers:{...n},method:"delete"})},get:(e,t={headers:{}})=>{let n="";return t.params&&(n=x.A(t.params,{addQueryPrefix:!0})),fetch(`${e}${n}`,{credentials:"include",...t})},patch:(e,t={headers:{}})=>{let n=t&&t.headers?{...t.headers}:{};return fetch(e,{...t,credentials:"include",headers:{...n},method:"PATCH"})},post:(e,t={headers:{}})=>{let n=t&&t.headers?{...t.headers}:{};return fetch(`${e}`,{...t,credentials:"include",headers:{...n},method:"post"})},put:(e,t={headers:{}})=>{let n=t&&t.headers?{...t.headers}:{};return fetch(e,{...t,credentials:"include",headers:{...n},method:"put"})}},ax=(0,o.createContext)({});function aw({children:e,permissions:t,user:n}){let a=(0,m.usePathname)(),l=(0,m.useRouter)(),{config:r}=(0,c.c)(),{admin:{autoLogin:i,autoRefresh:s,routes:{inactivity:u},user:h},routes:{admin:f,api:g}}=r,{i18n:b}=(0,d.d)(),{closeAllModals:v,openModal:w}=nN(),{startRouteTransition:j}=te(),[C,S]=(0,o.useState)(n),[k,_]=(0,o.useState)(),[$,N]=(0,o.useState)(),[P,E]=(0,o.useState)(t),[D,T]=(0,o.useState)(12e4),[A,R]=(0,o.useState)(!1),L=o.useRef(null),F=o.useRef(null),O=o.useRef(null),M=C?.id,I=(0,o.useCallback)(()=>{let e=(0,y.Q)({adminRoute:f,path:""});j(()=>l.replace((0,y.Q)({adminRoute:f,path:`${u}${window.location.pathname.startsWith(e)?`?redirect=${encodeURIComponent(window.location.pathname)}`:""}`}))),v()},[l,f,u,v,j]),B=(0,o.useCallback)(()=>{S(null),_(void 0),N(void 0),clearTimeout(L.current)},[]),z=tv(()=>{s?Q():w(ab)}),U=(0,o.useCallback)(e=>{if(clearTimeout(F.current),clearTimeout(O.current),e?.user){S(e.user),_(e.token??e.refreshedToken),N(1e3*e.exp);let t=Math.max(0,Math.min((e.exp??0)*1e3-Date.now(),0x7fffffff));if(t){let e=Math.min(6e4,t/2);T(e),F.current=setTimeout(z,Math.max(t-e,0)),O.current=setTimeout(()=>{B(),I()},t)}}else B()},[I,B]),V=(0,o.useCallback)(e=>{if(!M)return;let t=Math.max(0,($??0)-Date.now());(e||$&&t<2*D)&&(clearTimeout(L.current),L.current=setTimeout(async()=>{try{let e=await ay.post((0,y.Q)({apiRoute:g,path:`/${h}/refresh-token?refresh`}),{headers:{"Accept-Language":b.language}});if(200===e.status){let t=await e.json();U(t)}else U(null),I()}catch(e){e3.error(e.message)}},1e3))},[g,b.language,I,U,$,h,D,M]),H=(0,o.useCallback)(async e=>{try{let t=await ay.post((0,y.Q)({apiRoute:g,path:`/${h}/refresh-token`}),{headers:{"Accept-Language":b.language}});if(200===t.status){let n=await t.json();return e||U(n),n.user}C&&(U(null),I())}catch(e){e3.error(`Refreshing token failed: ${e.message}`)}return null},[g,b.language,I,U,h,C]),q=(0,o.useCallback)(async()=>{try{C&&C.collection&&(U(null),await ay.post((0,y.Q)({apiRoute:g,path:`/${C.collection}/logout`})))}catch{}return!0},[g,U,C]),W=(0,o.useCallback)(async({locale:e}={})=>{let t=x.A({locale:e},{addQueryPrefix:!0});try{let e=await ay.get((0,y.Q)({apiRoute:g,path:`/access${t}`}),{headers:{"Accept-Language":b.language}});if(200===e.status){let t=await e.json();E(t)}else throw Error(`Fetching permissions failed with status code ${e.status}`)}catch(e){e3.error(`Refreshing permissions failed: ${e.message}`)}},[g,b]),K=o.useCallback(async()=>{try{let e=await ay.get((0,y.Q)({apiRoute:g,path:`/${h}/me`}),{credentials:"include",headers:{"Accept-Language":b.language}});if(200===e.status){let t=await e.json();return U(t),t?.user||null}}catch(e){e3.error(`Fetching user failed: ${e.message}`)}return null},[g,h,b.language,U]),Q=tv(V);(0,o.useEffect)(()=>{Q()},[a]);let Y=tv(K);return(0,o.useEffect)(()=>{!async function(){await Y(),R(!0)}()},[]),(0,o.useEffect)(()=>{C||!i||i.prefillOnly||Y()},[C,i]),(0,o.useEffect)(()=>()=>{clearTimeout(L.current),clearTimeout(F.current),clearTimeout(O.current)},[]),C||A?(0,p.jsx)(ax,{value:{fetchFullUser:K,logOut:q,permissions:P,refreshCookie:V,refreshCookieAsync:H,refreshPermissions:W,setPermissions:E,setUser:U,token:k,tokenExpirationMs:$,user:C},children:e}):null}var aj=()=>(0,o.use)(ax),aC=(0,o.createContext)({}),aS=(0,o.createContext)({localeIsLoading:!1,setLocaleIsLoading:e=>{}}),ak=async(e,t)=>await fetch((0,y.Q)({apiRoute:t,path:`/payload-preferences/${e}`}),{credentials:"include",headers:{"Content-Type":"application/json"},method:"GET"})?.then(e=>e.json()),a_=e=>{let t,n,a=(0,g.c)(26),{children:l,locale:r}=e,{config:i}=(0,c.c)(),{localization:s,routes:d}=i,u=void 0!==s&&s,{api:h}=d,{user:f}=aj(),b=u?u.defaultLocale:"en",v=(0,m.useSearchParams)(),y;a[0]!==v?(y=v.get("locale"),a[0]=v,a[1]=y):y=a[1];let x=y,w;a[2]!==b||a[3]!==r||a[4]!==x||a[5]!==u?(w=()=>u&&(!u||u.locales.length)?nd(u,x)||nd(u,r)||nd(u,b)||nd(u,u.locales[0].code):{},a[2]=b,a[3]=r,a[4]=x,a[5]=u,a[6]=w):w=a[6];let[j,C]=o.useState(w),[S,k]=(0,o.useState)(!1),_=(0,o.useRef)(j),$,N;a[7]!==j?($=()=>{j.code!==_.current.code&&k(!1),_.current=j},N=[j],a[7]=j,a[8]=$,a[9]=N):($=a[8],N=a[9]),(0,o.useEffect)($,N),a[10]!==h||a[11]!==b||a[12]!==x||a[13]!==u||a[14]!==f?.id?(t=()=>{!async function(){if(u&&f?.id){let e=nd(u,x||await ak("locale",h)?.then(aP))||nd(u,b)||nd(u,u?.locales?.[0]?.code);e&&C(e)}}()},a[10]=h,a[11]=b,a[12]=x,a[13]=u,a[14]=f?.id,a[15]=t):t=a[15];let P=f?.id,E;return a[16]!==h||a[17]!==b||a[18]!==x||a[19]!==u||a[20]!==P?(E=[h,b,u,x,P],a[16]=h,a[17]=b,a[18]=x,a[19]=u,a[20]=P,a[21]=E):E=a[21],(0,o.useEffect)(t,E),a[22]!==l||a[23]!==S||a[24]!==j?(n=(0,p.jsx)(aC,{value:j,children:(0,p.jsx)(aS,{value:{localeIsLoading:S,setLocaleIsLoading:k},children:l})}),a[22]=l,a[23]=S,a[24]=j,a[25]=n):n=a[25],n},a$=()=>(0,o.use)(aS),aN=()=>(0,o.use)(aC);function aP(e){return e.value}var aE=(e,t,n)=>{if(e)return`field-${e.replace(/\./g,"__")}${t>1?`-${t}`:""}${n?`-${n}`:""}`},aD=e=>
36{let{as:t,hideLocale:n,htmlFor:a,label:l,localized:r,path:i,required:o,unstyled:s}=e,c=void 0===t?"label":t,u=void 0!==s&&s,{uuid:f}=eT(),m=nc(),g=a||aE(i,m,f),{i18n:b}=(0,d.d)(),{code:v,label:y}=aN();return l?(0,p.jsxs)("label"===c?g?"label":"span":c||"span",{className:`field-label${u?" unstyled":""}`,htmlFor:g,children:[(0,h.s)(l,b),void 0!==o&&o&&!u&&(0,p.jsx)("span",{className:"required",children:"*"}),void 0!==r&&r&&!(void 0!==n&&n)&&(0,p.jsxs)("span",{className:"localized",children:["— ","string"==typeof y?y:v]})]}):null},aT=({collapsed:e,rowID:t,rows:n})=>n.reduce((n,a)=>(t===a.id&&(a.collapsed=e),a.collapsed&&n.collapsedIDs.push(a.id),n.updatedRows.push(a),n),{collapsedIDs:[],updatedRows:[]}),aA=({collapsed:e,rows:t})=>t.reduce((t,n)=>(n.collapsed=e,e&&t.collapsedIDs.push(n.id),t.updatedRows.push(n),t),{collapsedIDs:[],updatedRows:[]}),aR=(e,t,n)=>{let a,l=(0,g.c)(9),r;l[0]!==n?(r=void 0===n?[]:n,l[0]=n,l[1]=r):r=l[1];let i=r,s;l[2]===Symbol.for("react.memo_cache_sentinel")?(s=Date.now(),l[2]=s):s=l[2];let c=(0,o.useRef)(s),d;l[3]!==e||l[4]!==t?(d=()=>{let n=setTimeout(()=>{Date.now()-c.current>=t&&(e(),c.current=Date.now())},t-(Date.now()-c.current));return()=>{clearTimeout(n)}},l[3]=e,l[4]=t,l[5]=d):d=l[5],l[6]!==t||l[7]!==i?(a=[t,...i],l[6]=t,l[7]=i,l[8]=a):a=l[8],(0,o.useEffect)(d,a)},aL={},aF={};function aO(e,t){try{let n=(aL[e]||=new Intl.DateTimeFormat("en-GB",{timeZone:e,hour:"numeric",timeZoneName:"longOffset"}).format)(t).split("GMT")[1]||"";return n in aF?aF[n]:aI(n,n.split(":"))}catch{if(e in aF)return aF[e];let t=e?.match(aM);return t?aI(e,t.slice(1)):NaN}}var aM=/([+-]\d\d):?(\d\d)?/;function aI(e,t){let n=+t[0],a=+(t[1]||0);return aF[e]=n>0?60*n+a:60*n-a}var aB=class e extends Date{constructor(...e){super(),e.length>1&&"string"==typeof e[e.length-1]&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(aO(this.timeZone,this))?this.setTime(NaN):e.length?"number"==typeof e[0]&&(1===e.length||2===e.length&&"number"!=typeof e[1])?this.setTime(e[0]):"string"==typeof e[0]?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),aV(this,NaN),aU(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){return-aO(this.timeZone,this)}setTime(e){return Date.prototype.setTime.apply(this,arguments),aU(this),+this}[Symbol.for("constructDateFrom")](t){return new e(+new Date(t),this.timeZone)}},az=/^(get|set)(?!UTC)/;function aU(e){e.internal.setTime(+e),e.internal.setUTCMinutes(e.internal.getUTCMinutes()-e.getTimezoneOffset())}function aV(e){let t=aO(e.timeZone,e),n=new Date(+e);n.setUTCHours(n.getUTCHours()-1);let a=-new Date(+e).getTimezoneOffset(),l=a- -new Date(+n).getTimezoneOffset(),r=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();l&&r&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+l);let i=a-t;i&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+i);let o=aO(e.timeZone,e),s=-new Date(+e).getTimezoneOffset()-o-i;if(o!==t&&s){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let t=o-aO(e.timeZone,e);t&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+t),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+t))}}Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!az.test(e))return;let t=e.replace(az,"$1UTC");aB.prototype[t]&&(e.startsWith("get")?aB.prototype[e]=function(){return this.internal[t]()}:(aB.prototype[e]=function(){var e;return Date.prototype[t].apply(this.internal,arguments),e=this,Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),aV(e),+this},aB.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),aU(this),+this}))});var aH=Symbol.for("constructDateFrom");function aq(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&aH in e?e[aH](t):e instanceof Date?new e.constructor(t):new Date(t)}function aW(e,t){return aq(t||e,e)}var aK={};function aQ(e,t){let n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??aK.weekStartsOn??aK.locale?.options?.weekStartsOn??0,a=aW(e,t?.in),l=a.getDay();return a.setDate(a.getDate()-(7*(l<n)+l-n)),a.setHours(0,0,0,0),a}function aY(e,t){return aQ(e,{...t,weekStartsOn:1}
36)}function aG(e,t){let n=aW(e,t?.in),a=n.getFullYear(),l=aq(n,0);l.setFullYear(a+1,0,4),l.setHours(0,0,0,0);let r=aY(l),i=aq(n,0);i.setFullYear(a,0,4),i.setHours(0,0,0,0);let o=aY(i);return n.getTime()>=r.getTime()?a+1:n.getTime()>=o.getTime()?a:a-1}function aX(e){let t=aW(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-n}function aZ(e,...t){let n=aq.bind(null,e||t.find(e=>"object"==typeof e));return t.map(n)}function aJ(e,t){let n=aW(e,t?.in);return n.setHours(0,0,0,0),n}function a0(e,t){let n=aW(e)-aW(t);return n<0?-1:n>0?1:n}function a1(e){return aq(e,Date.now())}function a3(e,t){let n=aW(e,t?.in);return n.setHours(23,59,59,999),n}function a2(e,t){let n=aW(e,t?.in),a=n.getFullYear(),l=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??aK.firstWeekContainsDate??aK.locale?.options?.firstWeekContainsDate??1,r=aq(t?.in||e,0);r.setFullYear(a+1,0,l),r.setHours(0,0,0,0);let i=aQ(r,t),o=aq(t?.in||e,0);o.setFullYear(a,0,l),o.setHours(0,0,0,0);let s=aQ(o,t);return+n>=+i?a+1:+n>=+s?a:a-1}function a6(e,t){let n=Math.abs(e).toString().padStart(t,"0");return(e<0?"-":"")+n}var a5={y(e,t){let n=e.getFullYear(),a=n>0?n:1-n;return a6("yy"===t?a%100:a,t.length)},M(e,t){let n=e.getMonth();return"M"===t?String(n+1):a6(n+1,2)},d:(e,t)=>a6(e.getDate(),t.length),a(e,t){let n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>a6(e.getHours()%12||12,t.length),H:(e,t)=>a6(e.getHours(),t.length),m:(e,t)=>a6(e.getMinutes(),t.length),s:(e,t)=>a6(e.getSeconds(),t.length),S(e,t){let n=t.length;return a6(Math.trunc(e.getMilliseconds()*Math.pow(10,n-3)),t.length)}},a4={G:function(e,t,n){let a=+(e.getFullYear()>0);switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){let t=e.getFullYear();return n.ordinalNumber(t>0?t:1-t,{unit:"year"})}return a5.y(e,t)},Y:function(e,t,n,a){let l=a2(e,a),r=l>0?l:1-l;return"YY"===t?a6(r%100,2):"Yo"===t?n.ordinalNumber(r,{unit:"year"}):a6(r,t.length)},R:function(e,t){return a6(aG(e),t.length)},u:function(e,t){return a6(e.getFullYear(),t.length)},Q:function(e,t,n){let a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return a6(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){let a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return a6(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){let a=e.getMonth();switch(t){case"M":case"MM":return a5.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){let a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return a6(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){let l,r,i,o,s=Math.round((aQ(o=aW(e,a?.in),a)-(l=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??aK.firstWeekContainsDate??aK.locale?.options?.firstWeekContainsDate??1,r=a2(o,a),(i=aq(a?.in||o,0)).setFullYear(r,0,l),i.setHours(0,0,0,0),aQ(i,a)))/6048e5)+1;return"wo"===t?n.ordinalNumber(s,{unit:"week"}):a6(s,t.length)},I:function(e,t,n){let a,l,r,i=Math.round((aY(r=aW(e,void 0))-(a=aG(r,void 0),(l=aq(r,0)).setFullYear(a,0,4),l.setHours(0,0,0,0),aY(l)))/6048e5)+1;return"Io"===t?n.ordinalNumber(i,{unit:"week"}):a6(i,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):a5.d(e,t)},D:function(e,t,n){let a,l,r=function(e,t){let[n,a]=aZ(void 0,e,t),l=aJ(n),r=aJ(a);return Math.round((l-aX(l)-(r-aX(r)))/864e5)}(l=aW(e,void 0),((a=aW(l,void 0)).setFullYear(a.getFullYear(),0,1),a.setHours(0,0,0,0),a))+1;return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):a6(r,t.length)},E:function(e,t,n){let a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){let l=e.getDay(),r=(l-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return a6(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(l,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(l,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(l,{width:"short",context:"formatting"});default:return n.day(l,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){let l=e.getDay(),r=(l-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return a6(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(l,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(l,{width:"narrow",context:"standalone"});case"cccccc":return n.day(l,{width:"short",context:"standalone"});default:return n.day(l,{width:"wide",context:"standalone"})}},i:function(e,t,n){let a=e.getDay(),l=0===a?7:a;switch(t){case"i":return String(l);case"ii":return a6(l,t.length);case"io":return n.ordinalNumber(l,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){let a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){let a=e.getHours(),l;switch(l=12===a?"noon":0===a?"midnight":a/12>
36=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(l,{width:"narrow",context:"formatting"});default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},B:function(e,t,n){let a=e.getHours(),l;switch(l=a>=17?"evening":a>=12?"afternoon":a>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(l,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(l,{width:"narrow",context:"formatting"});default:return n.dayPeriod(l,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return a5.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):a5.H(e,t)},K:function(e,t,n){let a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):a6(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):a6(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):a5.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):a5.s(e,t)},S:function(e,t){return a5.S(e,t)},X:function(e,t,n){let a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return a7(a);case"XXXX":case"XX":return a9(a);default:return a9(a,":")}},x:function(e,t,n){let a=e.getTimezoneOffset();switch(t){case"x":return a7(a);case"xxxx":case"xx":return a9(a);default:return a9(a,":")}},O:function(e,t,n){let a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+a8(a,":");default:return"GMT"+a9(a,":")}},z:function(e,t,n){let a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+a8(a,":");default:return"GMT"+a9(a,":")}},t:function(e,t,n){return a6(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return a6(+e,t.length)}};function a8(e,t=""){let n=e>0?"-":"+",a=Math.abs(e),l=Math.trunc(a/60),r=a%60;return 0===r?n+String(l):n+String(l)+t+a6(r,2)}function a7(e,t){return e%60==0?(e>0?"-":"+")+a6(Math.abs(e)/60,2):a9(e,t)}function a9(e,t=""){let n=Math.abs(e);return(e>0?"-":"+")+a6(Math.trunc(n/60),2)+t+a6(n%60,2)}var le=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},lt=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},ln={p:lt,P:(e,t)=>{let n,a=e.match(/(P+)(p+)?/)||[],l=a[1],r=a[2];if(!r)return le(e,t);switch(l){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",le(l,t)).replace("{{time}}",lt(r,t))}},la=/^D+$/,ll=/^Y+$/,lr=["D","DD","YY","YYYY"],li=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,lo=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ls=/^'([^]*?)'?$/,lc=/''/g,ld=/[a-zA-Z]/;function lu(e,t,n){let a=n?.locale??aK.locale??d.b,l=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??aK.firstWeekContainsDate??aK.locale?.options?.firstWeekContainsDate??1,r=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??aK.weekStartsOn??aK.locale?.options?.weekStartsOn??0,i=aW(e,n?.in);if(!(i instanceof Date||"object"==typeof i&&"[object Date]"===Object.prototype.toString.call(i))&&"number"!=typeof i||isNaN(+aW(i)))throw RangeError("Invalid time value");let o=t.match(lo).map(e=>{let t=e[0];return"p"===t||"P"===t?(0,ln[t])(e,a.formatLong):e}).join("").match(li).map(e=>{if("''"===e)return{isToken:!1,value:"'"};let t=e[0];if("'"===t){var n;let t;return{isToken:!1,value:(t=(n=e).match(ls))?t[1].replace(lc,"'"):n}}if(a4[t])return{isToken:!0,value:e};if(t.match(ld))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});a.localize.preprocessor&&(o=a.localize.preprocessor(i,o));let s={firstWeekContainsDate:l,weekStartsOn:r,locale:a};return o.map(l=>{if(!l.isToken)return l.value;let r=l.value;return(!n?.useAdditionalWeekYearTokens&&ll.test(r)||!n?.useAdditionalDayOfYearTokens&&la.test(r))&&function(e,t,n){var a,l,r;let i,o=(a=e,l=t,r=n,i="Y"===a[0]?"years":"days of the month",`Use \`${a.toLowerCase()}\` instead of \`${a}\` (in \`${l}\`) for formatting ${i} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`);if(console.warn(o),lr.includes(e))throw RangeError(o)}(r,t,String(e)),(0,a4[r[0]])(i,r,a.localize,s)}).join("")}function lp(e,t){var n;let a="function"==typeof(n=t)&&n.prototype?.constructor===n?new t(0):aq(t,0);return a.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),a.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),a}var lh=({date:e,i18n:t,pattern:n,timezone:a})=>{let l=new aB(new Date(e));if(a){let e=aB.tz(a),r=lp(l.withTimeZone(a),e);return t.dateFNS?lu(r,n,{locale:t.dateFNS}):`${t.t("general:loading")}...`}return t.dateFNS?lu(l,n,{locale:t.dateFNS}):`${t.t("general:loading")}...`},lf=({date:e,i18n:t})=>{var n;let a="string"==typeof e?new Date(e):e;return t?.dateFNS?(n={locale:t.dateFNS},function(e,t,n){var a;let l=n?.locale??aK.locale??d.b,r=a0(e,t);if(isNaN(r))throw RangeError("Invalid time value");let i=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:r}),[o,s]=aZ(n?.in,...r>0?[t,e]:[e,t]),c=(a=void 0,e=>{let t=(a?Math[a]:Math.trunc)(e);return 0===t?0:t})((aW(s)-aW(o))/1e3),u=Math.round((c-(aX(s)-aX(o))/1e3)/60),p;if(u<2)return n?.includeSeconds?c<5?l.formatDistance("lessThanXSeconds",5,i):c<10?l.formatDistance("lessThanXSeconds",10,i):c<20?l.formatDistance("lessThanXSeconds",20,i):c<40?l.formatDistance("halfAMinute",0,i):c<60?l.formatDistance("lessThanXMinutes",1,i):l.formatDistance("xMinutes",1,i):0===u?l.formatDistance("lessThanXMinutes",1,i):l.formatDistance("xMinutes",u,i);if(u<45)return l.formatDistance("xMinutes",u,i);if(u<90)return l.formatDistance("aboutXHours",1,i);if(u<1440){let e=Math.round(u/60);return l.formatDistance("aboutXHours",e,i)}if(u<2520)return l.formatDistance("xDays",1,i);if(u<43200){let e=Math.round(u/1440);return l.formatDistance("xDays",e,i)}if(u<86400)return p=Math.round(u/43200),l.formatDistance("aboutXMonths",p,i);if((p=function(e,t){var n;let a,l,r,[i,o,s]=aZ(void 0,e,e,t),c=a0(o,s),d=Math.abs(function(e,t){let[n,a]=aZ(void 0,e,t);return 12*(n.getFullYear()-a.getFullYear())+(n.getMonth()-a.getMonth())}
36(o,s));if(d<1)return 0;1===o.getMonth()&&o.getDate()>27&&o.setDate(30),o.setMonth(o.getMonth()-c*d);let u=a0(o,s)===-c;+a3(a=aW(i,void 0),void 0)==+(n=void 0,r=(l=aW(a,n?.in)).getMonth(),l.setFullYear(l.getFullYear(),r+1,0),l.setHours(23,59,59,999),l)&&1===d&&1===a0(i,s)&&(u=!1);let p=c*(d-u);return 0===p?0:p}(s,o))<12){let e=Math.round(u/43200);return l.formatDistance("xMonths",e,i)}{let e=p%12,t=Math.trunc(p/12);return e<3?l.formatDistance("aboutXYears",t,i):e<9?l.formatDistance("overXYears",t,i):l.formatDistance("almostXYears",t+1,i)}}(a,a1(a),n)):`${t.t("general:loading")}...`};function lm(e){return"object"==typeof e&&"root"in e}function lg(e,t){for(let n of e)"text"in n&&n.text?t+=n.text:"children"in n||(t+=`[${n.type}]`),"children"in n&&n.children&&(t+=lg(n.children,t));return t}var lb=({collectionConfig:e,data:t,dateFormat:n,fallback:a,globalConfig:l,i18n:r})=>{let i;if(e){let a=e?.admin?.useAsTitle;if(a&&(i=t?.[a])){let l,o=e.fields.find(e=>"name"in e&&e.name===a),s=o?.type==="date",c=o?.type==="relationship";s&&(i=lh({date:i,i18n:r,pattern:"date"in o.admin&&o?.admin?.date?.displayFormat||n})||i),c&&(i=Array.isArray(l=t[a])?l.map(e=>"object"==typeof e&&null!==e?e.id:String(e)).filter(Boolean).join(", "):"object"==typeof l&&null!==l?l.id||"":String(l))}}return l&&(i=(0,h.s)(l?.label,r)||l?.slug),i&&lm(i)&&(i=lg(i.root.children?.[0]?.children||[],"")),!i&&lm(a)&&(i=lg(a.root.children?.[0]?.children||[],"")),i||(i="string"==typeof a?a:`[${r.t("general:untitled")}]`),i},lv=(0,o.createContext)({}),ly=()=>(0,o.use)(lv),lx=({children:e})=>{let{id:t,collectionSlug:n,data:a,docConfig:l,globalSlug:r,initialData:i}=lE(),{config:{admin:{dateFormat:s}}}=(0,c.c)(),{i18n:u}=(0,d.d)(),[h,f]=(0,o.useState)(()=>lb({collectionConfig:n?l:void 0,data:{...i||{},id:t},dateFormat:s,fallback:t?.toString(),globalConfig:r?l:void 0,i18n:u}));return(0,o.useEffect)(()=>{f(lb({collectionConfig:n?l:void 0,data:{...a,id:t},dateFormat:s,fallback:t?.toString(),globalConfig:r?l:void 0,i18n:u}))},[a,s,u,t,n,l,r]),(0,p.jsx)(lv,{value:{setDocumentTitle:f,title:h},children:e})},lw=(0,o.createContext)({}),lj=(e,t)=>({body:JSON.stringify({value:e}),headers:{"Accept-Language":t,"Content-Type":"application/json"}}),lC=({children:e})=>{let t=(0,o.useRef)({}),n=(0,o.useRef)({}),a=(0,o.useRef)({}),{config:l}=(0,c.c)(),{user:r}=aj(),{i18n:i}=(0,d.d)(),{routes:{api:s}}=l;(0,o.useEffect)(()=>{r||(n.current={})},[r]);let u=(0,o.useCallback)(async e=>{let t=n.current;if("u">typeof t[e])return t[e];let a=new Promise(t=>{(async()=>{let a=await ay.get((0,y.Q)({apiRoute:s,path:`/payload-preferences/${e}`}),{credentials:"include",headers:{"Accept-Language":i.language}}),l=null;200===a.status&&(l=(await a.json()).value),n.current[e]=l,t(l)})()});return t[e]=a,a},[i.language,s,n]),h=(0,o.useCallback)(async(e,t,l=!1)=>{if(!1===l){n.current[e]=t,await ay.post((0,y.Q)({apiRoute:s,path:`/payload-preferences/${e}`}),lj(t,i.language));return}let r=t,o=await u(e);if("object"==typeof t&&"object"==typeof o&&"object"==typeof r){if(o&&(r=function e(t,n){let a={...t};for(let l in n)"__proto__"===l||"constructor"===l||"prototype"===l||Object.prototype.hasOwnProperty.call(n,l)&&("object"==typeof n[l]&&!Array.isArray(n[l])&&t[l]?a[l]=e(t[l],n[l]):a[l]=n[l]);return a}(o,r)),(0,j.j)(r,o))return;a.current[e]={...a.current[e],...r}}else{if(r===o)return;a.current[e]=r}let c=async()=>{(0,j.j)(a.current[e],n.current[e])||(n.current[e]=a.current[e],await ay.post((0,y.Q)({apiRoute:s,path:`/payload-preferences/${e}`}),lj(n.current[e],i.language)),delete a.current[e])};setTimeout(()=>{c()})},[s,u,i.language,a]);return t.current.getPreference=u,t.current.setPreference=h,(0,p.jsx)(lw,{value:t.current,children:e})},lS=()=>(0,o.use)(lw),lk=o.createContext({getUploadEdits:()=>{},resetUploadEdits:void 0,updateUploadEdits:void 0,uploadEdits:void 0}),l_=e=>{let t=(0,g.c)(10),{children:n,initialUploadEdits:a}=e,l;t[0]!==a?(l=a||{},t[0]=a,t[1]=l):l=t[1];let[r,i]=o.useState(l),s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{i({})},t[2]=s):s=t[2];let c=s,d;t[3]===Symbol.for("react.memo_cache_sentinel")?(d=e=>{i(t=>({...t||{},...e||{}}))},t[3]=d):d=t[3];let u=d,h;t[4]!==r?(h=()=>r,t[4]=r,t[5]=h):h=t[5];let f=h,m;return t[6]!==n||t[7]!==f||t[8]!==r?(m=(0,p.jsx)(lk,{value:{getUploadEdits:f,resetUploadEdits:c,updateUploadEdits:u,uploadEdits:r},children:n}),t[6]=n,t[7]=f,t[8]=r,t[9]=m):m=t[9],m},l$=()=>o.use(lk),lN=e=>{let{collectionSlug:t,docPermissions:n,globalSlug:a,isEditing:l}=e;return t?!!(l&&n?.update||!l&&n?.create):!!a&&!!n?.update},lP=(0,o.createContext)({}),lE=()=>(0,o.use)(lP),lD=({children:e,...t})=>{let{id:n,collectionSlug:a,currentEditor:l,docPermissions:r,globalSlug:i,hasPublishedDoc:s,hasPublishPermission:u,hasSavePermission:h,initialData:f,initialState:m,isLocked:g,lastUpdateTime:b,mostRecentVersionIsAutosaved:v,unpublishedVersionCount:w,versionCount:j}
36=t,[C,S]=(0,c.a)(r),[k,_]=(0,c.a)(h),[$,N]=(0,c.a)(u),{permissions:P}=aj(),{config:{admin:{dateFormat:E},collections:D,routes:{api:T}},getEntityConfig:A}=(0,c.c)(),R=A({collectionSlug:a}),L=A({globalSlug:i}),F=D.some(e=>"payload-locked-documents"===e.slug),O=(0,o.useRef)(new AbortController),M=R||L,{i18n:I}=(0,d.d)(),{uploadEdits:B}=l$(),[z,U]=(0,o.useState)(()=>lb({collectionConfig:R,data:{...f||{},id:n},dateFormat:E,fallback:n?.toString(),globalConfig:L,i18n:I})),[V,H]=(0,o.useState)(v),[q,W]=(0,o.useState)(j),[K,Q]=(0,o.useState)(s),[Y,G]=(0,o.useState)(w),[X,Z]=(0,c.a)(g),[J,ee]=(0,c.a)(l),[et,en]=(0,c.a)(b),[ea,el]=(0,c.a)(f),[er,ei]=(0,c.a)("idle"),eo=(0,o.useRef)({hasShownLockedModal:!1,isLocked:!1,user:null}),es=(0,o.useCallback)(e=>{ei(e)},[ei]),{getPreference:ec,setPreference:ed}=lS(),{code:eu}=aN(),{localeIsLoading:ep}=a$(),eh=(0,o.useMemo)(()=>void 0===m||void 0===f||ep,[f,m,ep]),ef,em,eg;i&&(ef=i,em="globals",eg=`global-${ef}`),a&&(ef=a,em="collections",n&&(eg=`collection-${ef}-${n}`));let eb=(0,o.useCallback)(async(e,t)=>{if(F)try{let n=t===i,a=await ay.get((0,y.Q)({apiRoute:T,path:"/payload-locked-documents"}),{credentials:"include",params:n?{"where[globalSlug][equals]":t}:{"where[document.relationTo][equals]":t,"where[document.value][equals]":e}}),{docs:l}=await a.json();if(l?.length>0){let e=l[0].id;await ay.delete((0,y.Q)({apiRoute:T,path:`/payload-locked-documents/${e}`}),{credentials:"include",headers:{"Content-Type":"application/json"}}),Z(!1)}}catch(e){console.error("Failed to unlock the document",e)}},[T,i,Z,F]),ev=(0,o.useCallback)(async(e,t,n)=>{if(F)try{let a=t===i,l=await ay.get((0,y.Q)({apiRoute:T,path:"/payload-locked-documents"}),{credentials:"include",params:a?{"where[globalSlug][equals]":t}:{"where[document.relationTo][equals]":t,"where[document.value][equals]":e}}),{docs:r}=await l.json();if(r?.length>0){let e=r[0].id,t="object"==typeof n?{relationTo:n.collection,value:n.id}:{relationTo:"users",value:n};await ay.patch((0,y.Q)({apiRoute:T,path:`/payload-locked-documents/${e}`}),{body:JSON.stringify({user:t}),credentials:"include",headers:{"Content-Type":"application/json"}})}}catch(e){console.error("Failed to update the document editor",e)}},[T,i,F]),ey=(({id:e,api:t,collectionSlug:n,globalSlug:a,i18n:l,locale:r,permissions:i,setDocPermissions:s,setHasPublishPermission:c,setHasSavePermission:d})=>o.useCallback(async o=>{let u={locale:r||void 0},p=o?.id||e,h=(({id:e,collectionSlug:t,globalSlug:n})=>!!(n||t&&e))({id:p,collectionSlug:n,globalSlug:a});if(h){let e=n?`/${n}/access/${p}`:a?`/globals/${a}/access`:null;if(e){let r=await (await fetch((0,y.Q)({apiRoute:t,path:`${e}${x.A(u,{addQueryPrefix:!0})}`}),{body:JSON.stringify({...o?.doc||o||{},_status:"draft"}),credentials:"include",headers:{"Accept-Language":l.language,"Content-Type":"application/json"},method:"post"})).json(),i=await fetch((0,y.Q)({apiRoute:t,path:`${e}${x.A(u,{addQueryPrefix:!0})}`}),{body:JSON.stringify({...o?.doc||o||{},_status:"published"}),credentials:"include",headers:{"Accept-Language":l.language,"Content-Type":"application/json"},method:"POST"}).then(e=>e.json());s(r),d(lN({collectionSlug:n,docPermissions:r,globalSlug:a,isEditing:h})),c(i?.update)}}else{let e=n?i?.collections?.[n]:i?.globals?.[a];s(e),d(lN({collectionSlug:n,docPermissions:e,globalSlug:a,isEditing:h}))}},[r,e,n,a,t,l.language,s,d,c,i?.collections,i?.globals]))({id:n,api:T,collectionSlug:a,globalSlug:i,i18n:I,locale:eu,permissions:P,setDocPermissions:S,setHasPublishPermission:N,setHasSavePermission:_}),ex=(0,o.useCallback)(()=>ec(eg),[ec,eg]),ew=(0,o.useCallback)(async(e,t)=>{let n=await ex();if(eg)try{await ed(eg,{...n,fields:{...n?.fields||{},[e]:{...n?.fields?.[e],...t}}})}catch(e){console.error(e)}},[ed,eg,ex]),ej=(0,o.useCallback)(()=>{let e=q+1;R&&R.versions?R.versions.maxPerDoc>0?W(Math.min(e,R.versions.maxPerDoc)):W(e):L&&L.versions&&(L.versions.max>0?W(Math.min(e,L.versions.max)):W(e))},[R,L,q]);(0,o.useEffect)(()=>{U(lb({collectionConfig:R,data:{...ea,id:n},dateFormat:E,fallback:n?.toString(),globalConfig:L,i18n:I}))},[R,L,ea,E,I,n]),(0,o.useEffect)(()=>{let e=O.current;return()=>{if(e)try{e.abort()}catch{}}},[]);let eC=o.useMemo(()=>{let e=`${"globals"===em?"/globals":""}/${ef}${n?`/${n}`:""}`;return(0,y.Q)({apiRoute:T,path:`${e}${x.A({depth:0,"fallback-locale":"null",locale:eu,uploadEdits:B||void 0},{addQueryPrefix:!0})}`})},[T,eu,em,n,ef,B]),eS={...t,action:eC,currentEditor:J,data:ea,docConfig:M,docPermissions:C,documentIsLocked:X,documentLockState:eo,getDocPermissions:ey,getDocPreferences:ex,hasPublishedDoc:K,hasPublishPermission:$,hasSavePermission:k,incrementVersionCount:ej,initialData:f,initialState:m,isInitializing:eh,lastUpdateTime:et,mostRecentVersionIsAutosaved:V,preferencesKey:eg,savedDocumentData:ea,setCurrentEditor:ee,setData:el,setDocFieldPreferences:ew,setDocumentIsLocked:Z,setDocumentTitle:U,setHasPublishedDoc:Q,setLastUpdateTime:en,setMostRecentVersionIsAutosaved:H,setUnpublishedVersionCount:G,setUploadStatus:es,title:z,unlockDocument:eb,unpublishedVersionCount:Y,updateDocumentEditor:ev,updateSavedDocumentData:el,uploadStatus:er,versionCount:q};return(0,p.jsx)(lP,{value:eS,children:(0,p.jsx)(lx,{children:e})})},lT=e=>(0,p.jsx)(l_,{children:(0,p.jsx)(lD,{...e})}),lA=(0,o.createContext)(""),lR=({children:e,operation:t})=>(0,p.jsx)(lA,{value:t,children:e}),lL=()=>(0,o.use)(lA),lF=o.createContext(void 0),lO=()=>{let e=o.useContext(lF);if(e)return e},lM=o.createContext(void 0),lI=e=>{let t=lO(),n=o.use(lM),a=o.useRef(null);if(null===a.current){let l=e?.path||t||e?.potentiallyStalePath;a.current=!!(n&&l&&n.path===l)}if(!0===a.current){if(!n)throw Error("FieldContext was removed after mount. This breaks hook ordering.");return n}return(e=>{let t=(0,g.c)(65),n;t[0]!==e?(n=e||{},t[0]=e,t[1]=n):n=t[1];let{disableFormData:a,hasRows:l,path:r,potentiallyStalePath:i,validate:s}=n,u=void 0!==a&&a,p=lO(),h=r||p||i,f=eL(),m=eF(),b=eI(),{user:v}=aj(),{id:y,collectionSlug:x}=lE(),w=lL(),j=eB(lB),C;t[2]!==h?(C=e=>{let[t]=e;return t&&t?.[h]||null},t[2]=h,t[3]=C):C=t[3];let S=eB(C),{t:k}=(0,d.d)(),{config:_}=(0,c.c)(),{getData:$,getDataByPath:N,getSiblingData:P,setModified:E}=eT(),D=eA(),T=S?.filterOptions,A=S?.value,R=S?.initialValue,L="boolean"!=typeof S?.valid||S.val
36id,F=!1===L&&f,O=(0,o.useRef)(L),M=(0,o.useRef)(S?.errorMessage),I;t[4]!==h?(I=h?h.split("."):[],t[4]=h,t[5]=I):I=t[5];let B=I,z;t[6]!==u||t[7]!==j||t[8]!==l||t[9]!==h||t[10]!==E?(z=(e,t)=>{let n=e&&"object"==typeof e&&"function"==typeof e.preventDefault&&"function"==typeof e.stopPropagation?e.target.value:e;j({type:"UPDATE",disableFormData:u||l&&n>0,path:h,value:n}),void 0!==t&&t||E(!0)},t[6]=u,t[7]=j,t[8]=l,t[9]=h,t[10]=E,t[11]=z):z=t[11];let U=z,V=S?.blocksFilterOptions,H=S?.customComponents,q=m||b,W=S?.errorMessage,K;t[12]!==S?.errorPaths?(K=S?.errorPaths||[],t[12]=S?.errorPaths,t[13]=K):K=t[13];let Q=S?.rows,Y=S?.selectFilterOptions,G=S?.valid,X;t[14]!==T||t[15]!==R||t[16]!==b||t[17]!==h||t[18]!==m||t[19]!==U||t[20]!==F||t[21]!==f||t[22]!==Q||t[23]!==Y||t[24]!==G||t[25]!==V||t[26]!==H||t[27]!==q||t[28]!==W||t[29]!==K||t[30]!==A?(X={blocksFilterOptions:V,customComponents:H,disabled:q,errorMessage:W,errorPaths:K,filterOptions:T,formInitializing:b,formProcessing:m,formSubmitted:f,initialValue:R,path:h,rows:Q,selectFilterOptions:Y,setValue:U,showError:F,valid:G,value:A},t[14]=T,t[15]=R,t[16]=b,t[17]=h,t[18]=m,t[19]=U,t[20]=F,t[21]=f,t[22]=Q,t[23]=Y,t[24]=G,t[25]=V,t[26]=H,t[27]=q,t[28]=W,t[29]=K,t[30]=A,t[31]=X):X=t[31];let Z=X,J;t[32]!==x||t[33]!==_||t[34]!==u||t[35]!==j||t[36]!==D||t[37]!==S||t[38]!==$||t[39]!==N||t[40]!==P||t[41]!==l||t[42]!==y||t[43]!==w||t[44]!==h||t[45]!==B||t[46]!==k||t[47]!==v||t[48]!==s||t[49]!==A?(J=()=>{(async()=>{let e=A;S?.rows&&Array.isArray(S.rows)&&(e=N(h));let t=M.current,n=O.current,a=$(),r="function"==typeof s?await s(e,{id:y,blockData:void 0,collectionSlug:x,data:D?.getData?D.getData():a,event:"onChange",operation:w,path:B,preferences:{},req:{payload:{config:_},t:k,user:v},siblingData:P(h)}):"string"==typeof M.current?M.current:O.current;if("string"==typeof r?(n=!1,t=r):"boolean"==typeof r&&(n=r,t=void 0),n!==O.current||t!==M.current){O.current=n,M.current=t;let e={type:"UPDATE",errorMessage:t,path:h,rows:S?.rows,valid:n,validate:s,value:A};(u||l&&"number"==typeof A&&A>0)&&(e.disableFormData=!0),"function"==typeof j&&j(e)}})()},t[32]=x,t[33]=_,t[34]=u,t[35]=j,t[36]=D,t[37]=S,t[38]=$,t[39]=N,t[40]=P,t[41]=l,t[42]=y,t[43]=w,t[44]=h,t[45]=B,t[46]=k,t[47]=v,t[48]=s,t[49]=A,t[50]=J):J=t[50];let ee=S?.rows,et;return t[51]!==x||t[52]!==u||t[53]!==j||t[54]!==$||t[55]!==N||t[56]!==P||t[57]!==y||t[58]!==w||t[59]!==h||t[60]!==ee||t[61]!==v||t[62]!==s||t[63]!==A?(et=[A,u,j,$,P,N,y,w,h,v,s,ee,x],t[51]=x,t[52]=u,t[53]=j,t[54]=$,t[55]=N,t[56]=P,t[57]=y,t[58]=w,t[59]=h,t[60]=ee,t[61]=v,t[62]=s,t[63]=A,t[64]=et):et=t[64],aR(J,150,et),Z})(e)};function lB(e){let[,t]=e;return t}var lz=e=>{let t=(0,g.c)(2),{children:n,path:a}=e,l;t[0]!==a?(l=e=>{let[t]=e;return t&&t?.[a]||null},t[0]=a,t[1]=l):l=t[1];let{passesCondition:r}=eB(l)||{};return!1===r?null:n},lU=e=>t=>{let{path:n}=t;return(0,p.jsx)(lz,{path:n,children:(0,p.jsx)(e,{...t})})},lV=e=>({...e?.admin?.style||{},...e?.admin?.width?{"--field-width":e.admin.width}:{flex:"1 1 auto"},...e?.admin?.style?.flex?{flex:e.admin.style.flex}:{}}),lH="field-type";function lq({fieldLocalized:e,fieldRTL:t,locale:n,localizationConfig:a}){let l=n&&a&&a.locales&&a.locales.length>1,r=n?.code===a?.defaultLocale;return!1!==t&&n?.rtl===!0&&(e||!e&&!l||!e&&r)||!0===t}var lW=()=>(0,p.jsx)("svg",{className:"icon icon--check",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M15.3333 6.00001L8.00001 13.3333L4.66667 10",strokeLinecap:"square"})}),lK=()=>(0,p.jsx)("svg",{className:"icon icon--line",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M5.33333 10H14.6667",strokeLinecap:"square"})}),lQ="checkbox-input",lY=e=>{let t=(0,g.c)(24),{id:n,name:a,AfterInput:l,BeforeInput:r,checked:i,className:s,inputRef:c,Label:d,label:u,localized:h,onToggle:f,partialChecked:m,readOnly:b,required:v}=e,[y,x]=(0,o.useState)(!1),w=(0,o.useId)(),j=n||w,C,S;t[0]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{x(!0)},S=[],t[0]=C,t[1]=S):(C=t[0],S=t[1]),(0,o.useEffect)(C,S);let k=b||!y,_=i&&`${lQ}--checked`,$=k&&`${lQ}--read-only`,N;
36t[2]!==s||t[3]!==_||t[4]!==$?(N=[s,lQ,_,$].filter(Boolean),t[2]=s,t[3]=_,t[4]=$,t[5]=N):N=t[5];let P=N.join(" "),E=!!i,D;if(t[6]!==l||t[7]!==r||t[8]!==d||t[9]!==i||t[10]!==j||t[11]!==c||t[12]!==u||t[13]!==h||t[14]!==a||t[15]!==f||t[16]!==m||t[17]!==k||t[18]!==v||t[19]!==P||t[20]!==E){let e=(0,p.jsx)("input",{"aria-label":"","aria-labelledby":a,checked:E,disabled:k,id:j,name:a,onChange:f,ref:c,required:v,title:a,type:"checkbox"}),n=!i&&m?"partial":"check",o;t[22]!==n?(o=[`${lQ}__icon`,n].filter(Boolean),t[22]=n,t[23]=o):o=t[23],D=(0,p.jsxs)("div",{className:P,children:[(0,p.jsxs)("div",{className:`${lQ}__input`,children:[r,e,(0,p.jsxs)("span",{className:o.join(" "),children:[i&&(0,p.jsx)(lW,{}),!i&&m&&(0,p.jsx)(lK,{})]}),l]}),(0,p.jsx)(em,{CustomComponent:d,Fallback:(0,p.jsx)(aD,{htmlFor:j,label:u,localized:h,required:v})})]}),t[6]=l,t[7]=r,t[8]=d,t[9]=i,t[10]=j,t[11]=c,t[12]=u,t[13]=h,t[14]=a,t[15]=f,t[16]=m,t[17]=k,t[18]=v,t[19]=P,t[20]=E,t[21]=D}else D=t[21];return D},lG="checkbox",lX=lU(e=>{let{id:t,checked:n,disableFormData:a,field:l,field:{admin:{className:r,description:i}={},label:s,required:c}={},onChange:u,partialChecked:h,path:f,readOnly:m,validate:g}=e,{uuid:b}=eT(),v=nc(),{i18n:{language:y}}=(0,d.d)(),x=w.aG.includes(y),{customComponents:{AfterInput:j,BeforeInput:C,Description:S,Error:k,Label:_}={},disabled:$,path:N,setValue:P,showError:E,value:D}=lI({disableFormData:a,potentiallyStalePath:f,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof g)return g(e,{...t,required:c})},[g,c])}),T=(0,o.useCallback)(()=>{m||(P(!D),"function"==typeof u&&u(!D))},[u,m,P,D]),A=n||!!D,R=t||aE(N,v,b),L=(0,o.useMemo)(()=>lV(l),[l]);return(0,p.jsxs)("div",{className:[lH,lG,E&&"error",r,D&&`${lG}--checked`,(m||$)&&`${lG}--read-only`].filter(Boolean).join(" "),style:L,children:[(0,p.jsx)(em,{CustomComponent:k,Fallback:(0,p.jsx)(ni,{alignCaret:x?"right":"left",path:N,showError:E})}),(0,p.jsx)(lY,{AfterInput:j,BeforeInput:C,checked:A,id:R,inputRef:null,Label:_,label:s,name:N,onToggle:T,partialChecked:h,readOnly:m||$,required:c}),(0,p.jsx)(em,{CustomComponent:S,Fallback:(0,p.jsx)(nr,{description:i,path:N})})]})}),lZ=e=>{let t,n,a=(0,g.c)(13),{fieldValue:l,localized:r,path:i,readOnly:s}=e,u=void 0!==s&&s,{code:h}=aN(),{config:f}=(0,c.c)(),{localization:m}=f,[b,v]=o.useState("number"!=typeof l),{t:y}=(0,d.d)(),{dispatchFields:x,setModified:w}=eT();if(!r||!m||m.defaultLocale===h||!m.fallback)return null;a[0]!==b||a[1]!==x||a[2]!==l||a[3]!==i||a[4]!==w?(t=()=>{let e=!b;x({type:"UPDATE",path:i,value:e?null:l||0}),w(!0),v(e)},a[0]=b,a[1]=x,a[2]=l,a[3]=i,a[4]=w,a[5]=t):t=a[5];let j=t;if(l){let e=!1;if("number"==typeof l&&l>0&&(e=!0),Array.isArray(l)&&l.length>0&&(e=!0),e)return b&&v(!1),null}return a[6]!==b||a[7]!==l||a[8]!==j||a[9]!==i||a[10]!==u||a[11]!==y?(n=(0,p.jsx)(ti,{className:"nullify-locale-field",children:!l&&u?y("general:fallbackToDefaultLocale"):(0,p.jsx)(lX,{checked:b,field:{name:"",label:y("general:fallbackToDefaultLocale")},id:`field-${i.replace(/\./g,"__")}`,onChange:j,path:i,schemaPath:""})}),a[6]=b,a[7]=l,a[8]=j,a[9]=i,a[10]=u,a[11]=y,a[12]=n):n=a[12],n},lJ=e=>{let t=document.getElementById(e);if(t){let e=t.getBoundingClientRect();window.scrollBy({behavior:"smooth",top:e.top-100})}},l0="array-actions",l1=e=>{let t=(0,g.c)(12),{addRow:n,copyRow:a,duplicateRow:l,hasMaxRows:r,index:i,isSortable:s,moveRow:c,pasteRow:u,removeRow:h,rowCount:f}=e,{t:m}=(0,d.d)(),b;return t[0]!==n||t[1]!==a||t[2]!==l||t[3]!==r||t[4]!==i||t[5]!==s||t[6]!==c||t[7]!==u||t[8]!==h||t[9]!==f||t[10]!==m?(b=(0,p.jsx)(tC,{button:(0,p.jsx)(tA,{}),buttonClassName:`${l0}__button`,className:l0,horizontalAlign:"center",render:e=>{let{close:t}=e;return(0,p.jsxs)(tp.ButtonGroup,{buttonSize:"small",children:[s&&0!==i&&(0,p.jsxs)(tp.Button,{className:`${l0}__action ${l0}__move-up`,onClick:()=>{c(i,i-1),t()},children:[(0,p.jsx)("div",{className:`${l0}__action-chevron`,children:(0,p.jsx)(to,{direction:"up"})}),m("general:moveUp")]}),s&&i<f-1&&(0,p.jsxs)(tp.Button,{className:`${l0}__action`,onClick:()=>{c(i,i+1),t()},children:[(0,p.jsx)("div",{className:`${l0}__action-chevron`,children:(0,p.jsx)(to,{})}),m("general:moveDown")]}),!r&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsxs)(tp.Button,{className:`${l0}__action ${l0}__add`,onClick:()=>{n(i+1),t()},children:[(0,p.jsx)(td,{}),m("general:addBelow")]}),(0,p.jsxs)(tp.Button,{className:`${l0}__action ${l0}__duplicate`,onClick:()=>{l(i),t()},children:[(0,p.jsx)(tR,{}),m("general:duplicate")]})]}),(0,p.jsx)(tp.Button,{className:`${l0}__action ${l0}__copy`,onClick:()=>{a(i),t()},children:(0,p.jsx)(tL,{isRow:!0})}),(0,p.jsx)(tp.Button,{className:`${l0}__action ${l0}__paste`,onClick:()=>{u(i),t()},children:(0,p.jsx)(tL,{isPaste:!0,isRow:!0})}),(0,p.jsxs)(tp.Button,{className:`${l0}__action ${l0}__remove`,onClick:()=>{h(i),t()},children:[(0,p.jsx)(d.a,{}),m("general:remove")]})]})},size:"medium"}),t[0]=n,t[1]=a,t[2]=l,t[3]=r,t[4]=i,t[5]=s,t[6]=c,t[7]=u,t[8]=h,t[9]=f,t[10]=m,t[11]=b):b=t[11
36],b},l3=({className:e})=>(0,p.jsxs)("svg",{className:["icon icon--drag-handle",e].filter(Boolean).join(" "),viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:[(0,p.jsx)("path",{className:"fill",d:"M7.99999 10.6667C8.36818 10.6667 8.66666 10.3682 8.66666 9.99999C8.66666 9.6318 8.36818 9.33332 7.99999 9.33332C7.63181 9.33332 7.33333 9.6318 7.33333 9.99999C7.33333 10.3682 7.63181 10.6667 7.99999 10.6667Z",strokeLinecap:"square"}),(0,p.jsx)("path",{className:"fill",d:"M7.99999 5.99999C8.36818 5.99999 8.66666 5.70151 8.66666 5.33332C8.66666 4.96513 8.36818 4.66666 7.99999 4.66666C7.63181 4.66666 7.33333 4.96513 7.33333 5.33332C7.33333 5.70151 7.63181 5.99999 7.99999 5.99999Z",strokeLinecap:"square"}),(0,p.jsx)("path",{className:"fill",d:"M7.99999 15.3333C8.36818 15.3333 8.66666 15.0348 8.66666 14.6667C8.66666 14.2985 8.36818 14 7.99999 14C7.63181 14 7.33333 14.2985 7.33333 14.6667C7.33333 15.0348 7.63181 15.3333 7.99999 15.3333Z",strokeLinecap:"square"}),(0,p.jsx)("path",{className:"fill",d:"M12 10.6667C12.3682 10.6667 12.6667 10.3682 12.6667 9.99999C12.6667 9.6318 12.3682 9.33332 12 9.33332C11.6318 9.33332 11.3333 9.6318 11.3333 9.99999C11.3333 10.3682 11.6318 10.6667 12 10.6667Z",strokeLinecap:"square"}),(0,p.jsx)("path",{className:"fill",d:"M12 5.99999C12.3682 5.99999 12.6667 5.70151 12.6667 5.33332C12.6667 4.96513 12.3682 4.66666 12 4.66666C11.6318 4.66666 11.3333 4.96513 11.3333 5.33332C11.3333 5.70151 11.6318 5.99999 12 5.99999Z",strokeLinecap:"square"}),(0,p.jsx)("path",{className:"fill",d:"M12 15.3333C12.3682 15.3333 12.6667 15.0348 12.6667 14.6667C12.6667 14.2985 12.3682 14 12 14C11.6318 14 11.3333 14.2985 11.3333 14.6667C11.3333 15.0348 11.6318 15.3333 12 15.3333Z",strokeLinecap:"square"})]}),l2=({id:e,children:t,className:n,duration:a=300,height:l})=>{let[r,i]=o.useState(()=>!!l),s=(0,o.useRef)(r),[c,d]=o.useState(()=>r?"":"none"),[u,h]=o.useState(()=>r?"":"hidden"),[f,m]=o.useState(!1),g=(0,o.useRef)(null),b=(0,o.useRef)(null);return(0,o.useEffect)(()=>{let e,t,n=!!l,r=s.current!==n;return s.current=n,r&&(m(!0),h("hidden"),n?d(""):e=window.setTimeout(()=>{d("none")},a),i(n),t=window.setTimeout(()=>{h(""),m(!1)},a)),()=>{e&&clearTimeout(e),t&&clearTimeout(t)}},[l,a]),(({containerRef:e,contentRef:t,duration:n,open:a})=>{let l=(0,o.useMemo)(()=>!!("u">typeof CSS&&CSS)&&!!CSS.supports&&CSS.supports("interpolate-size","allow-keywords"),[]),r=(0,o.useRef)(!1),i=(0,o.useRef)(a),[s,c]=(0,o.useState)(!1),d=(0,o.useRef)(null);return(0,o.useEffect)(()=>{let o=e.current,u=t.current;if(!o||!u||l)return;let p=e=>{o.style.height=e};return(()=>{if(!r.current&&a){p("auto"),c(!1);return}r.current=!0,i.current!==a&&p(a?"0px":`${u.scrollHeight}px`),o.offsetHeight,c(!0),o.style.transition=`height ${n}ms ease`,p(a?`${u.scrollHeight}px`:"0px");let e=()=>{o&&(o.style.transition="",o.style.height=a?"auto":"0px",c(!1)),o.removeEventListener("transitionend",e)};o.addEventListener("transitionend",e)})(),i.current=a,d.current=new ResizeObserver(()=>{s&&(o.style.height=a?`${u.scrollHeight}px`:"0px")}),d.current.observe(u),()=>{o&&(o.style.transition="",o.style.height=""),d.current?.disconnect()}},[a,n,e,t,l])})({containerRef:g,contentRef:b,duration:a,open:r}),(0,p.jsx)("div",{"aria-hidden":!r,className:[n,"rah-static",r&&"auto"===l&&"rah-static--height-auto",f&&`rah-animating--${r?"down":"up"}`,f&&"auto"===l&&"rah-animating--to-height-auto"].filter(Boolean).join(" "),id:e,ref:g,style:{overflow:u,transition:`height ${a}ms ease`},children:(0,p.jsx)("div",{ref:b,...c?{style:{display:c}}:{},children:t})})},l6=(0,o.createContext)({isCollapsed:void 0,isVisible:void 0,isWithinCollapsible:void 0,toggle:()=>{}}),l5=({children:e,isCollapsed:t,isWithinCollapsible:n=!0,toggle:a})=>{let{isCollapsed:l,isVisible:r}=l4(),i=o.useMemo(()=>({isCollapsed:t,isVisible:r&&!l,isWithinCollapsible:n,toggle:a}),[t,n,a,l,r]);return(0,p.jsx)(l6,{value:i,children:e})},l4=()=>(0,o.use)(l6),l8="collapsible",l7=e=>{let t,n=(0,g.c)(25),{actions:a,AfterCollapsible:l,children:r,className:i,collapsibleStyle:s,disableHeaderToggle:c,disableToggleIndicator:u,dragHandleProps:h,header:f,initCollapsed:m,isCollapsed:b,onToggle:v}=e,y=void 0!==c&&c,x=void 0!==u&&u,[w,j]=(0,o.useState)(!!m),[C,S]=(0,o.useState)(!1),{isWithinCollapsible:k}=l4(),{t:_}=(0,d.d)(),$="boolean"==typeof b?b:w,N;n[0]!==$||n[1]!==v?(N=()=>{"function"==typeof v&&v(!$),j(!$)},n[0]=$,n[1]=v,n[2]=N):N=n[2];let P=N,E=h&&`${l8}--has-drag-handle`,D=$&&`${l8}--collapsed`,T=k&&`${l8}--nested`,A=C&&!y&&`${l8}--hovered`,R=`${l8}--style-${void 0===s?"default":s}`,L;n[3]!==i||n[4]!==E||n[5]!==D||n[6]!==T||n[7]!==A||n[8]!==R?(L=[l8,i,E,D,T,A,R].filter(
36Boolean),n[3]=i,n[4]=E,n[5]=D,n[6]=T,n[7]=A,n[8]=R,n[9]=L):L=n[9];let F=L.join(" "),O=`${l8}__toggle-wrap${y?" toggle-disabled":""}`,M,I;return n[10]===Symbol.for("react.memo_cache_sentinel")?(M=()=>S(!0),I=()=>S(!1),n[10]=M,n[11]=I):(M=n[10],I=n[11]),n[12]!==l||n[13]!==a||n[14]!==r||n[15]!==y||n[16]!==x||n[17]!==h||n[18]!==f||n[19]!==$||n[20]!==_||n[21]!==F||n[22]!==O||n[23]!==P?(t=(0,p.jsx)("div",{className:F,children:(0,p.jsxs)(l5,{isCollapsed:$,toggle:P,children:[(0,p.jsxs)("div",{className:O,onMouseEnter:M,onMouseLeave:I,children:[!y&&(0,p.jsx)("button",{className:[`${l8}__toggle`,`${l8}__toggle--${$?"collapsed":"open"}`].filter(Boolean).join(" "),onClick:P,type:"button",children:(0,p.jsx)("span",{children:_("fields:toggleBlock")})}),h&&(0,p.jsx)("div",{className:`${l8}__drag`,...h.attributes,...h.listeners,children:(0,p.jsx)(l3,{})}),f?(0,p.jsx)("div",{className:[`${l8}__header-wrap`,h&&`${l8}__header-wrap--has-drag-handle`].filter(Boolean).join(" "),children:f}):null,(0,p.jsxs)("div",{className:`${l8}__actions-wrap`,children:[a?(0,p.jsx)("div",{className:`${l8}__actions`,children:a}):null,!x&&(0,p.jsx)("div",{className:`${l8}__indicator`,children:(0,p.jsx)(to,{direction:$?void 0:"up"})})]})]}),(0,p.jsx)(l2,{height:$?0:"auto",children:(0,p.jsx)("div",{className:`${l8}__content`,children:r})}),l]})}),n[12]=l,n[13]=a,n[14]=r,n[15]=y,n[16]=x,n[17]=h,n[18]=f,n[19]=$,n[20]=_,n[21]=F,n[22]=O,n[23]=P,n[24]=t):t=n[24],t},l9=e=>{let t=(0,g.c)(9),{children:n,className:a,forceRender:l}=e,[r,i]=o.useState(!!l),s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={rootMargin:"1000px"},t[0]=s):s=t[0];let[c,d]=tS(s,!!l),u=!!d?.isIntersecting,h=d?.boundingClientRect?.top<0,f=l||u||h,m,b;t[1]!==r||t[2]!==f?(m=()=>{f&&!r&&i(!0)},b=[f,r],t[1]=r,t[2]=f,t[3]=m,t[4]=b):(m=t[3],b=t[4]),o.useEffect(m,b);let v=r?n:null,y;return t[5]!==a||t[6]!==c||t[7]!==v?(y=(0,p.jsx)("div",{className:a,ref:c,children:v}),t[5]=a,t[6]=c,t[7]=v,t[8]=y):y=t[8],y},re="pill",rt=e=>{let t=(0,g.c)(12),{id:n,className:a}=e,l;t[0]!==n?(l={id:n},t[0]=n,t[1]=l):l=t[1];let{attributes:r,isDragging:i,listeners:o,setNodeRef:s,transform:c}=t9(l),d=i&&`${re}--is-dragging`,u;t[2]!==a||t[3]!==d?(u=[d,a].filter(Boolean),t[2]=a,t[3]=d,t[4]=u):u=t[4];let h=u.join(" "),f;return t[5]!==r||t[6]!==o||t[7]!==e||t[8]!==s||t[9]!==h||t[10]!==c?(f=(0,p.jsx)(rn,{...e,className:h,elementProps:{...o,...r,ref:s,style:{transform:c}}}),t[5]=r,t[6]=o,t[7]=e,t[8]=s,t[9]=h,t[10]=c,t[11]=f):f=t[11],f},rn=e=>{let t=(0,g.c)(27),{id:n,alignIcon:a,"aria-checked":l,"aria-controls":r,"aria-expanded":i,"aria-label":s,children:c,className:d,draggable:u,elementProps:h,icon:f,onClick:m,pillStyle:b,rounded:v,size:y,to:x}=e,[w,j]=(0,o.useState)(!1),C,S;t[0]===Symbol.for("react.memo_cache_sentinel")?(C=()=>{j(!0)},S=[],t[0]=C,t[1]=S):(C=t[0],S=t[1]),(0,o.useEffect)(C,S);let k=m&&!x,_=`${re}--style-${void 0===b?"light":b}`,$=`${re}--size-${void 0===y?"medium":y}`,N=d&&d,P=x&&`${re}--has-link`,E=(x||m)&&`${re}--has-action`,D=f&&`${re}--has-icon`,T=f&&`${re}--align-icon-${void 0===a?"right":a}`,A=u&&`${re}--draggable`,R=v&&`${re}--rounded`,L;t[2]!==D||t[3]!==T||t[4]!==A||t[5]!==R||t[6]!==_||t[7]!==$||t[8]!==N||t[9]!==P||t[10]!==E?(L=[re,_,$,N,P,E,D,T,A,R].filter(Boolean),t[2]=D,t[3]=T,t[4]=A,t[5]=R,t[6]=_,t[7]=$,t[8]=N,t[9]=P,t[10]=E,t[11]=L):L=t[11];let F=L.join(" "),O="div";k&&(O="button"),x&&(O=tl);let M=k?!w:void 0,I=x||null,B=k?"button":void 0,z;return t[12]!==O||t[13]!==l||t[14]!==r||t[15]!==i||t[16]!==s||t[17]!==c||t[18]!==F||t[19]!==h||t[20]!==f||t[21]!==n||t[22]!==m||t[23]!==M||t[24]!==I||t[25]!==B?(z=(0,p.jsxs)(O,{...h,"aria-checked":l,"aria-controls":r,"aria-expanded":i,"aria-label":s,className:F,disabled:M,href:I,id:n,onClick:m,type:B,children:[(0,p.jsx)("span",{className:`${re}__label`,children:c}),!!f&&(0,p.jsx)("span",{className:`${re}__icon`,children:f})]}),t[12]=O,t[13]=l,t[14]=r,t[15]=i,t[16]=s,t[17]=c,t[18]=F,t[19]=h,t[20]=f,t[21]=n,t[22]=m,t[23]=M,t[24]=I,t[25]=B,t[26]=z):z=t[26],z},ra=e=>{let{draggable:t}=e;return t?(0,p.jsx)(rt,{...e}):(0,p.jsx)(rn,{...e})};function rl(e,t){let[n,a]=(0,o.useState)(e);return(0,o.useEffect)(()=>{let n=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}var rr="thumbnail-card",ri=e=>{let t=(0,g.c)(13),{alignLabel:n,className:a,collection:l,doc:r,label:i,onClick:o,thumbnail:s}=e,{config:u}=(0,c.c)(),{i18n:h}=(0,d.d)(),f="function"==typeof o&&`${rr}
36--has-on-click`,m=n&&`${rr}--align-label-${n}`,b;t[0]!==a||t[1]!==f||t[2]!==m?(b=[rr,a,f,m].filter(Boolean),t[0]=a,t[1]=f,t[2]=m,t[3]=b):b=t[3];let v=b.join(" "),y;if(t[4]!==v||t[5]!==l||t[6]!==u||t[7]!==r||t[8]!==h||t[9]!==i||t[10]!==o||t[11]!==s){let e=i;e||(e=lb({collectionConfig:l,data:r,dateFormat:u.admin.dateFormat,fallback:r?.filename,i18n:h})),y=(0,p.jsxs)("button",{className:v,onClick:o,title:e,type:"button",children:[(0,p.jsx)("div",{className:`${rr}__thumbnail`,children:s}),(0,p.jsx)("div",{className:`${rr}__label`,children:e})]}),t[4]=v,t[5]=l,t[6]=u,t[7]=r,t[8]=h,t[9]=i,t[10]=o,t[11]=s,t[12]=y}else y=t[12];return y},ro=[];for(let e=0;e<256;++e)ro.push((e+256).toString(16).slice(1));var rs,rc=new Uint8Array(16),rd="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ru=function(e,t,n){return!rd||t||e?function(e,t,n){let a=(e=e||{}).random??e.rng?.()??function(){if(!rs){if(typeof crypto>"u"||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");rs=crypto.getRandomValues.bind(crypto)}return rs(rc)}();if(a.length<16)throw Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){if((n=n||0)<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=a[e];return t}return function(e,t=0){return(ro[e[t+0]]+ro[e[t+1]]+ro[e[t+2]]+ro[e[t+3]]+"-"+ro[e[t+4]]+ro[e[t+5]]+"-"+ro[e[t+6]]+ro[e[t+7]]+"-"+ro[e[t+8]]+ro[e[t+9]]+"-"+ro[e[t+10]]+ro[e[t+11]]+ro[e[t+12]]+ro[e[t+13]]+ro[e[t+14]]+ro[e[t+15]]).toLowerCase()}(a)}(e,t,n):rd()},rp=()=>{let[e]=(0,o.useState)(()=>`pattern${ru()}`);return(0,p.jsxs)("svg",{fill:"none",height:"151",preserveAspectRatio:"xMidYMid slice",viewBox:"0 0 231 151",width:"231",xmlns:"http://www.w3.org/2000/svg",children:[(0,p.jsxs)("g",{clipPath:`url(#${e})`,children:[(0,p.jsx)("rect",{fill:"#D9D9D9",height:"100%",rx:"2",width:"100%"}),(0,p.jsx)("rect",{fill:"#BCBCBC",height:"116.063",transform:"rotate(52.0687 33.7051 79.3051)",width:"85.8593",x:"33.7051",y:"79.3051"}),(0,p.jsx)("rect",{fill:"#BCBCBC",height:"116.063",transform:"rotate(52.0687 86.1219 92.6272)",width:"85.8593",x:"86.1219",y:"92.6272"}),(0,p.jsx)("circle",{cx:"189",cy:"45",fill:"#BCBCBC",r:"19"}),(0,p.jsx)("rect",{fill:"#B8B8B8",height:"5",rx:"2.5",width:"98",x:"66",y:"70"}),(0,p.jsx)("rect",{fill:"#B8B8B8",height:"5",rx:"2.5",width:"76",x:"77",y:"82"})]}),(0,p.jsx)("defs",{children:(0,p.jsx)("clipPath",{id:`${e}`,children:(0,p.jsx)("rect",{fill:"white",height:"151",width:"231"})})})]})},rh=()=>(0,p.jsx)("svg",{className:"icon icon--search",fill:"none",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M16 16L13.1333 13.1333M14.6667 9.33333C14.6667 12.2789 12.2789 14.6667 9.33333 14.6667C6.38781 14.6667 4 12.2789 4 9.33333C4 6.38781 6.38781 4 9.33333 4C12.2789 4 14.6667 6.38781 14.6667 9.33333Z",strokeLinecap:"square"})}),rf="block-search",rm=e=>{let t=(0,g.c)(5),{setSearchTerm:n}=e,{t:a}=(0,d.d)(),l;t[0]!==n?(l=e=>{n(e.target.value)},t[0]=n,t[1]=l):l=t[1];let r=l,i;return t[2]!==r||t[3]!==a?(i=(0,p.jsxs)("div",{className:rf,children:[(0,p.jsx)("input",{className:`${rf}__input`,onChange:r,placeholder:a("fields:searchForBlock")}),(0,p.jsx)(rh,{})]}),t[2]=r,t[3]=a,t[4]=i):i=t[4],i},rg="blocks-drawer",rb=e=>{let{blocks:t,onSelect:n,searchTerm:a}=e,[l,r]=(0,c.a)(a??""),[i,s]=(0,o.useState)(t),{i18n:u}=(0,d.d)(),{config:f}=(0,c.c)(),m=(0,o.useMemo)(()=>{let e={_none:[]};return i.forEach(t=>{if("object"==typeof t&&t.admin?.group){let n=t.admin.group,a="string"==typeof n?n:(0,h.s)(n,u);Object.hasOwn(e,a)?e[a].push(t):e[a]=[t]}else e._none.push(t)}),e},[i,u]);return(0,o.useEffect)(()=>{let e=l.toLowerCase();s(t?.reduce((t,n)=>{let a="string"==typeof n?f.blocksMap[n]:n;return("string"==typeof a.labels.singular?a.labels.singular.toLowerCase():"object"==typeof a.labels.singular?(0,h.s)(a.labels.singular,u).toLowerCase():"").includes(e)&&t.push(a),t},[]))},[l,t,u,f.blocksMap]),(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(rm,{setSearchTerm:r}),(0,p.jsx)("div",{className:`${rg}__blocks-wrapper`,children:(0,p.jsx)("ul",{className:`${rg}__block-groups`,children:Object.entries(m).map(([e,t])=>t.length?(0,p.jsxs)("li",{className:[`${rg}__block-group`,"_none"===e&&`${rg}
36__block-group-none`].filter(Boolean).join(" "),children:["_none"!==e&&(0,p.jsx)("h3",{className:`${rg}__block-group-label`,children:e}),(0,p.jsx)("ul",{className:`${rg}__blocks`,children:t.map((e,t)=>{let{slug:a,admin:l,imageAltText:r,imageURL:i,labels:o}="string"==typeof e?f.blocksMap[e]:e,s=l?.images?.thumbnail?"string"==typeof l.images.thumbnail?l.images.thumbnail:l.images.thumbnail.url:i,c=l?.images?.thumbnail&&"string"!=typeof l.images.thumbnail?l.images.thumbnail.alt:r;return(0,p.jsx)("li",{className:`${rg}__block`,children:(0,p.jsx)(ri,{alignLabel:"center",label:(0,h.s)(o?.singular,u),onClick:()=>{"function"==typeof n&&n(a)},thumbnail:(0,p.jsx)("div",{className:`${rg}__default-image`,children:s?(0,p.jsx)("img",{alt:c,src:s}):(0,p.jsx)(rp,{})})})},t)})})]},e):null)})})]})},rv=e=>{let t,n=(0,g.c)(19),{addRow:a,addRowIndex:l,blocks:r,drawerSlug:i,labels:s}=e,{closeModal:c,isModalOpen:u}=nN(),{i18n:f,t:m}=(0,d.d)(),[b,v]=o.useState(""),y,x;if(n[0]!==i||n[1]!==u?(y=()=>{u(i)||v("")},x=[u,i],n[0]=i,n[1]=u,n[2]=y,n[3]=x):(y=n[2],x=n[3]),(0,o.useEffect)(y,x),n[4]!==a||n[5]!==l||n[6]!==r||n[7]!==c||n[8]!==i||n[9]!==f||n[10]!==s.singular||n[11]!==b||n[12]!==m){let e;n[14]!==a||n[15]!==l||n[16]!==c||n[17]!==i?(e=e=>{a(l,e),c(i)},n[14]=a,n[15]=l,n[16]=c,n[17]=i,n[18]=e):e=n[18],t=(0,p.jsx)(au,{slug:i,title:m("fields:addLabel",{label:(0,h.s)(s.singular,f)}),children:(0,p.jsx)(rb,{blocks:r,onSelect:e,searchTerm:b})}),n[4]=a,n[5]=l,n[6]=r,n[7]=c,n[8]=i,n[9]=f,n[10]=s.singular,n[11]=b,n[12]=m,n[13]=t}else t=n[13];return t},ry=e=>{let t,n=(0,g.c)(28),{addRow:a,blocks:l,blockType:r,copyRow:i,duplicateRow:s,hasMaxRows:c,isSortable:d,labels:u,moveRow:h,pasteRow:f,removeRow:m,rowCount:b,rowIndex:v}=e,{closeModal:y,openModal:x}=nN(),w=ao("blocks-drawer"),[j,C]=o.useState(null),S;if(n[0]!==a||n[1]!==y||n[2]!==w||n[3]!==j?(S=(e,t)=>{"function"==typeof a&&a(j,t),y(w)},n[0]=a,n[1]=y,n[2]=w,n[3]=j,n[4]=S):S=n[4],n[5]!==r||n[6]!==l||n[7]!==i||n[8]!==w||n[9]!==s||n[10]!==c||n[11]!==d||n[12]!==u||n[13]!==h||n[14]!==x||n[15]!==f||n[16]!==m||n[17]!==b||n[18]!==v||n[19]!==S){let e,a;n[21]!==w||n[22]!==x?(e=e=>{C(e),x(w)},n[21]=w,n[22]=x,n[23]=e):e=n[23],n[24]!==r||n[25]!==s||n[26]!==v?(a=()=>s(v,r),n[24]=r,n[25]=s,n[26]=v,n[27]=a):a=n[27],t=(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(rv,{addRow:S,addRowIndex:v,blocks:l,drawerSlug:w,labels:u}),(0,p.jsx)(l1,{addRow:e,copyRow:i,duplicateRow:a,hasMaxRows:c,index:v,isSortable:d,moveRow:h,pasteRow:f,removeRow:m,rowCount:b})]}),n[5]=r,n[6]=l,n[7]=i,n[8]=w,n[9]=s,n[10]=c,n[11]=d,n[12]=u,n[13]=h,n[14]=x,n[15]=f,n[16]=m,n[17]=b,n[18]=v,n[19]=S,n[20]=t}else t=n[20];return t},rx="section-title",rw=e=>{let t=(0,g.c)(14),{customOnChange:n,customValue:a,path:l,readOnly:r}=e,i;t[0]!==l?(i={path:l},t[0]=l,t[1]=i):i=t[1];let{setValue:o,value:s}=lI(i),{t:c}=(0,d.d)(),u;t[2]===Symbol.for("react.memo_cache_sentinel")?(u=[rx].filter(Boolean),t[2]=u):u=t[2];let h=u.join(" "),f;t[3]!==n||t[4]!==o?(f=n||(e=>{e.stopPropagation(),e.preventDefault(),o(e.target.value)}),t[3]=n,t[4]=o,t[5]=f):f=t[5];let m=f,b=a||s,v;return t[6]!==a||t[7]!==m||t[8]!==l||t[9]!==r||t[10]!==c||t[11]!==b||t[12]!==s?(v=(0,p.jsx)("div",{className:h,"data-value":b,children:(0,p.jsx)("input",{className:`${rx}__input`,id:l,name:l,onChange:m,placeholder:c("general:untitled"),readOnly:r,type:"text",value:a||s||""})}),t[6]=a,t[7]=m,t[8]=l,t[9]=r,t[10]=c,t[11]=b,t[12]=s,t[13]=v):v=t[13],v},rj="blocks-field",rC=e=>{let t=(0,g.c)(42),{addRow:n,attributes:a,block:l,blocks:r,copyRow:i,duplicateRow:o,errorCount:s,fields:u,hasMaxRows:f,isLoading:m,isSortable:b,Label:v,labels:y,listeners:x,moveRow:w,parentPath:j,pasteRow:C,path:S,permissions:k,readOnly:_,removeRow:$,row:N,rowCount:P,rowIndex:E,schemaPath:D,setCollapse:T,setNodeRef:A,transform:R}=e,L=rl(m,500),{i18n:F}=(0,d.d)(),O=eL()&&s>0,M=!l.admin?.disableBlockName,I=O?`${rj}__row--has-errors`:`${rj}__row--no-errors`,B;t[0]!==I?(B=[`${rj}__row`,I].filter(Boolean),t[0]=I,t[1]=B):B=t[1];let z=B.join(" "),U;if(t[2]!==v||t[3]!==n||t[4]!==a||t[5]!==l.fields||t[6]!==l.labels||t[7]!==l.slug||t[8]!==r||t[9]!==z||t[10]!==i||t[11]!==o||t[12]!==s||t[13]!==O||t[14]!==u||t[15]!==f||t[16]!==F||t[17]!==L||t[18]!==b||t[19]!==y||t[20]!==x||t[21]!==w||t[22]!==j||t[23]!==C||t[24]!==S||t[25]!==k||t[26]!==_||t[27]!==$||t[28]!==N.blockType||t[29]!==N.collapsed||t[30]!==N.id||t[31]!==P||t[32]!==E||t[33]!==D||t[34]!==T||t[35]!==A||t[36]!==M||t[37]!==R){let e,d;if(!0===k)e=!0;else{let t=k?.blocks?.[l.slug]||k?.blocks;if(!0===t)e=!0;else if(t?.fields)e=t.fields;else if("object"==typeof k&&k&&!t){let n=!0===k.read,a=!k.create||!k.update;e=n&&(a||"object"==typeof k&&1===Object.keys(k).length&&k.read)?{read:!0}:t?.fields}else e=t?.fields}t[39]!==N.id||t[40]!==T?(d=e=>T(N.id,e),t[39]=N.id,t[40]=T,t[41]=d):d=t[41],U=(0,p.jsx)("div",{id:`${j?.split(".").join("-")}-row-${E}`,ref:A,style:{transform:R},children:(0,p.jsx)(l7,{actions:_?void 0:(0,p.jsx)(ry,{addRow:n,blocks:r,blockType:N.blockType,copyRow:i,duplicateRow:o,fields:l.fields,hasMaxRows:f,isSortable:b,labels:y,moveRow:w,pasteRow:C,removeRow:$,rowCount:P,rowIndex:E}),className:z,collapsibleStyle:O?"error":"default",dragHandleProps:b?{id:N.id,attributes:a,listeners:x}:void 0,header:L?(0,p.jsx)(c.f,{height:"1rem",width:"8rem"}):(0,p.jsxs)("div",{className:`${rj}__block-header`,children:[(0,p.jsx)(eq,{CustomComponent:v,label:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{className:`${rj}__block-number`,children:String(E+1).padStart(2,"0")}),(0,p.jsx)(ra,{className:`${rj}__block-pill ${rj}__block-pill-${N.blockType}`,pillStyle:"white",size:"small",children:(0,h.s)(l.labels.singular,F)}),M&&(0,p.jsx)(rw,{path:`${S}.blockName`,readOnly:_})]}),path:S,rowNumber:E}
36),O&&(0,p.jsx)(na,{count:s,i18n:F,withMessage:!0})]}),isCollapsed:N.collapsed,onToggle:d,children:L?(0,p.jsx)(c.f,{}):(0,p.jsx)(hU,{className:`${rj}__fields`,fields:u,margins:"small",parentIndexPath:"",parentPath:S,parentSchemaPath:D,permissions:e,readOnly:_})},N.id)},`${j}-row-${E}`),t[2]=v,t[3]=n,t[4]=a,t[5]=l.fields,t[6]=l.labels,t[7]=l.slug,t[8]=r,t[9]=z,t[10]=i,t[11]=o,t[12]=s,t[13]=O,t[14]=u,t[15]=f,t[16]=F,t[17]=L,t[18]=b,t[19]=y,t[20]=x,t[21]=w,t[22]=j,t[23]=C,t[24]=S,t[25]=k,t[26]=_,t[27]=$,t[28]=N.blockType,t[29]=N.collapsed,t[30]=N.id,t[31]=P,t[32]=E,t[33]=D,t[34]=T,t[35]=A,t[36]=M,t[37]=R,t[38]=U}else U=t[38];return U},rS="blocks-field",rk=lU(e=>{let{i18n:t,t:n}=(0,d.d)(),{field:a,field:{name:l,type:r,admin:{className:i,description:s,isSortable:u=!0}={},blockReferences:f,blocks:m,label:g,labels:b,localized:v,maxRows:y,minRows:x,required:w},path:j,permissions:C,readOnly:S,schemaPath:k,validate:_}=e,$=k??l,N=x??w?1:0,{setDocFieldPreferences:P}=lE(),{addFieldRow:E,dispatchFields:D,getFields:T,moveFieldRow:A,removeFieldRow:R,replaceState:L,setModified:F}=eT(),{code:O}=aN(),{config:{localization:M},config:I}=(0,c.c)(),B=ao("blocks-drawer"),z=eL(),U={plural:n("fields:blocks"),singular:n("fields:block"),...b},V=!M||!M.fallback||O===M.defaultLocale,{blocksFilterOptions:H,customComponents:{AfterInput:q,BeforeInput:W,Description:K,Error:Q,Label:Y}={},disabled:G,errorPaths:X,path:Z,rows:J=[],showError:ee,valid:et,value:en}=lI({hasRows:!0,potentiallyStalePath:j,validate:(0,o.useCallback)((e,t)=>!V&&null===e||("function"==typeof _?_(e,{...t,maxRows:y,minRows:N,required:w}):void 0),[y,N,w,_,V])}),{clientBlocks:ea,clientBlocksAfterFilter:el}=(0,o.useMemo)(()=>{let e=[];
36if(f)for(let t of f){let n="string"==typeof t?I.blocksMap[t]:t;n&&e.push(n)}else e=m;if(Array.isArray(H)){let t=e.filter(e=>{let t="string"==typeof e?e:e.slug;return H.includes(t)});return{clientBlocks:e,clientBlocksAfterFilter:t}}return{clientBlocks:e,clientBlocksAfterFilter:e}},[f,m,H,I.blocksMap]),er=(0,o.useCallback)((e,t)=>{E({blockType:t,path:Z,rowIndex:e,schemaPath:$}),setTimeout(()=>{lJ(`${Z}-row-${e+1}`)},0)},[E,Z,$]),ei=(0,o.useCallback)(e=>{D({type:"DUPLICATE_ROW",path:Z,rowIndex:e}),F(!0),setTimeout(()=>{lJ(`${Z}-row-${e+1}`)},0)},[D,Z,F]),eo=(0,o.useCallback)(e=>{R({path:Z,rowIndex:e})},[Z,R]),es=(0,o.useCallback)((e,t)=>{A({moveFromIndex:e,moveToIndex:t,path:Z})},[A,Z]),ec=(0,o.useCallback)(e=>{let{collapsedIDs:t,updatedRows:n}=aA({collapsed:e,rows:J});D({type:"SET_ALL_ROWS_COLLAPSED",path:Z,updatedRows:n}),P(Z,{collapsed:t})},[D,Z,J,P]),ed=(0,o.useCallback)((e,t)=>{let{collapsedIDs:n,updatedRows:a}=aT({collapsed:t,rowID:e,rows:J});D({type:"SET_ROW_COLLAPSED",path:Z,updatedRows:a}),P(Z,{collapsed:n})},[D,Z,J,P]),eu=(0,o.useCallback)(e=>{let t=tD({type:r,blocks:ea,getDataToCopy:()=>tB({formState:{...T()},path:Z,rowIndex:e}),path:Z,rowIndex:e,t:n});"string"==typeof t?e3.error(t):e3.success(n("general:copied"))},[ea,Z,n,r,T]),ep=(0,o.useCallback)(e=>{let t=tT({onPaste:t=>{L(tz({dataFromClipboard:t,formState:{...T()},path:Z,rowIndex:e})),F(!0)},path:Z,schemaBlocks:ea,t:n});"string"==typeof t&&e3.error(t)},[ea,T,Z,L,F,n]),eh=(0,o.useCallback)(e=>{L(tz({dataFromClipboard:e,formState:{...T()},path:Z})),F(!0)},[T,Z,L,F]),ef=y&&J.length>=y,eg=X.length,eb=z&&eg+ +!et>0,ev=J.length<N||w&&0===J.length,ey=S&&0===J.length,ex=(0,o.useMemo)(()=>lV(a),[a]);return(0,p.jsxs)("div",{className:[lH,rS,i,eb?`${rS}--has-error`:`${rS}--has-no-error`].filter(Boolean).join(" "),id:`field-${Z?.replace(/\./g,"__")}`,style:ex,children:[ee&&(0,p.jsx)(em,{CustomComponent:Q,Fallback:(0,p.jsx)(ni,{path:Z,showError:ee})}),(0,p.jsxs)("header",{className:`${rS}__header`,children:[(0,p.jsxs)("div",{className:`${rS}__header-wrap`,children:[(0,p.jsxs)("div",{className:`${rS}__heading-with-error`,children:[(0,p.jsx)("h3",{children:(0,p.jsx)(em,{CustomComponent:Y,Fallback:(0,p.jsx)(aD,{as:"span",label:g,localized:v,path:Z,required:w})})}),eb&&eg>0&&(0,p.jsx)(na,{count:eg,i18n:t,withMessage:!0})]}),(0,p.jsxs)("ul",{className:`${rS}__header-actions`,children:[J.length>0&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)("li",{children:(0,p.jsx)("button",{className:`${rS}__header-action`,onClick:()=>ec(!0),type:"button",children:n("fields:collapseAll")})}),(0,p.jsx)("li",{children:(0,p.jsx)("button",{className:`${rS}__header-action`,onClick:()=>ec(!1),type:"button",children:n("fields:showAll")})})]}),(0,p.jsx)("li",{children:(0,p.jsx)(tF,{allowCopy:J?.length>0,allowPaste:!S,blocks:ea,className:`${rS}__header-action`,disabled:G,getDataToCopy:()=>tB({formState:{...T()},path:Z}),onPaste:eh,path:Z,type:r})})]})]}),(0,p.jsx)(em,{CustomComponent:K,Fallback:(0,p.jsx)(nr,{description:s,path:Z})})]}),W,(0,p.jsx)(lZ,{fieldValue:en,localized:v,path:Z,readOnly:S}),(J.length>0||!et&&(ey||ev))&&(0,p.jsxs)(nt,{className:`${rS}__rows`,ids:J.map(e=>e.id),onDragEnd:({moveFromIndex:e,moveToIndex:t})=>es(e,t),children:[J.map((e,t)=>{let{blockType:n,isLoading:a}=e,l=I.blocksMap[n]??ea.find(e=>e.slug===n);if(l){let n=`${Z}.${t}`,r=X.filter(e=>e.startsWith(n+".")).length;return(0,p.jsx)(ne,{disabled:S||G||!u,id:e.id,children:i=>(0,p.jsx)(rC,{...i,addRow:er,block:l,blocks:ea,copyRow:eu,duplicateRow:ei,errorCount:r,fields:l.fields,hasMaxRows:ef,isLoading:a,isSortable:u,Label:J?.[t]?.customComponents?.RowLabel,labels:U,moveRow:es,parentPath:Z,pasteRow:ep,path:n,permissions:C,readOnly:S||G,removeRow:eo,row:e,rowCount:J.length,rowIndex:t,schemaPath:$+l.slug,setCollapse:ed})},e.id)}return null}),!V&&(0,p.jsxs)(o.Fragment,{children:[ev&&(0,p.jsx)(ti,{type:"error",children:n("validation:requiresAtLeast",{count:N,label:(0,h.s)(N>1?U.plural:U.singular,t)||n(N>1?"general:row":"general:rows")})}),ey&&(0,p.jsx)(ti,{children:n("validation:fieldHasNo",{label:(0,h.s)(U.plural,t)})})]})]}),!ef&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(ad,{className:`${rS}__drawer-toggler`,disabled:S||G,slug:B,children:(0,p.jsx)(tN,{buttonStyle:"icon-label",disabled:S||G,el:"span",icon:"plus",iconPosition:"left",iconStyle:"with-border",children:n("fields:addLabel",{label:(0,h.s)(U.singular,t)})})}),(0,p.jsx)(rv,{addRow:er,addRowIndex:J?.length||0,blocks:el,drawerSlug:B,labels:U})]}),q]})}),r_=(0,o.lazy)(()=>n.e(4660).then(n.bind(n,84660))),r$=e=>(0,p.jsx)(o.Suspense,{fallback:(0,p.jsx)(c.f,{}),children:(0,p.jsx)(r_,{...e})}
36),rN={js:"javascript",ts:"typescript",tsx:"typescript"},rP=lU(e=>{let{field:t,field:{admin:{className:n,description:a,editorOptions:l,editorProps:r,language:i="javascript"}={},label:s,localized:c,required:d},onMount:u,path:h,readOnly:f,validate:m}=e,g=o.useRef("formState"),[b,v]=(0,o.useState)(Date.now()),{customComponents:{AfterInput:y,BeforeInput:x,Description:w,Error:j,Label:C}={},disabled:S,initialValue:k,path:_,setValue:$,showError:N,value:P}=lI({potentiallyStalePath:h,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof m)return m(e,{...t,required:d})},[m,d])}),E=o.useRef((P||k)!==void 0?P??k:void 0),D=(0,o.useCallback)(e=>{if(!(f||S)){g.current="internalEditor";try{$(e||null),E.current=e}catch{$(e||null),E.current=e}}},[f,S,$]);(0,o.useEffect)(()=>{"formState"===g.current&&(E.current=(P||k)!==void 0?P??k:void 0,v(Date.now())),g.current="formState"},[k,_,P]);let T=(0,o.useMemo)(()=>lV(t),[t]);return(0,p.jsxs)("div",{className:[lH,"code-field",n,N&&"error",(f||S)&&"read-only"].filter(Boolean).join(" "),style:T,children:[(0,p.jsx)(em,{CustomComponent:C,Fallback:(0,p.jsx)(aD,{label:s,localized:c,path:_,required:d})}),(0,p.jsxs)("div",{className:`${lH}__wrap`,children:[(0,p.jsx)(em,{CustomComponent:j,Fallback:(0,p.jsx)(ni,{path:_,showError:N})}),x,(0,p.jsx)(r$,{defaultLanguage:rN[i]||i,onChange:D,onMount:u,options:l,readOnly:f||S,recalculatedHeightAt:b,value:E.current,wrapperProps:{id:`field-${_?.replace(/\./g,"__")}`},...r||{}}),y]}),(0,p.jsx)(em,{CustomComponent:w,Fallback:(0,p.jsx)(nr,{description:a,path:_})})]})}),rE=e=>e.reduce((e,t)=>{let n="fields"in t?t.fields:void 0;return n?(0,b.Z7)(t)?e.push(`${t.name}.`):e.push(...rE(n)):"tabs"===t.type?"tabs"in t&&t.tabs?.forEach(t=>{"name"in t?e.push(`${t.name}.`):e.push(...rE(t.fields))}):(0,b.Z7)(t)&&e.push(t.name),e},[]),rD=e=>{let t,n=(0,g.c)(12),{fields:a,path:l,setErrorCount:r}=e,[i]=ez(),o=eL(),s;n[0]!==a?(s=rE(a),n[0]=a,n[1]=s):s=n[1];let c=s,d;return n[2]!==i||n[3]!==o||n[4]!==l||n[5]!==c||n[6]!==r?(d=()=>{if(o){let e=0;Object.entries(i).forEach(t=>{let[n]=t;if(c?.some(e=>{let t=[...l,e].join(".");if(t.endsWith(".")){let e=t.slice(0,-1);return n.startsWith(t)||n===e}return n===t})){let t=i[n];"valid"in t&&!t.valid&&(e+=1)}}),r(e)}},n[2]=i,n[3]=o,n[4]=l,n[5]=c,n[6]=r,n[7]=d):d=n[7],n[8]!==a||n[9]!==i||n[10]!==o?(t=[i,o,a],n[8]=a,n[9]=i,n[10]=o,n[11]=t):t=n[11],aR(d,250,t),null},rT="collapsible-field",rA=lU(e=>{let{field:t,field:{admin:{className:n,description:a,initCollapsed:l=!1}={},fields:r,label:i}={},indexPath:s,parentPath:c,parentSchemaPath:u,path:f,permissions:m,readOnly:g}=e,{i18n:b}=(0,d.d)(),{getPreference:v,setPreference:y}=lS(),{preferencesKey:x}=lE(),[w,j]=(0,o.useState)(),C=`collapsible-${f?.replace(/\./g,"__")}`,[S,k]=(0,o.useState)(0),_=S>0,{customComponents:{AfterInput:$,BeforeInput:N,Description:P,Label:E}={},disabled:D}=lI({path:f}),T=(0,o.useCallback)(async e=>{let t=await v(x);x&&y(x,{...t,...f?{fields:{...t?.fields||{},[f]:{...t?.fields?.[f],collapsed:e}}}:{fields:{...t?.fields||{},[C]:{...t?.fields?.[C],collapsed:e}}}})},[x,C,v,y,f]);(0,o.useEffect)(()=>{(async()=>{if(x){let e=await v(x),t=f?e?.fields?.[f]?.collapsed:e?.fields?.[C]?.collapsed;j(void 0!==t?!!t:"boolean"==typeof l&&l)}else j("boolean"==typeof l&&l)})()},[v,x,C,l,f]);let A=(0,o.useMemo)(()=>lV(t),[t]);return"boolean"!=typeof w?null:(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(rD,{fields:r,path:f.split(".").slice(0,-1),setErrorCount:k}),(0,p.jsxs)("div",{className:[lH,rT,n,_?`${rT}--has-error`:`${rT}--has-no-error`].filter(Boolean).join(" "),id:`field-${C}`,style:A,children:[N,(0,p.jsx)(l7,{className:`${rT}__collapsible`,collapsibleStyle:_?"error":"default",header:(0,p.jsxs)("div",{className:`${rT}__row-label-wrap`,children:[(0,p.jsx)(eq,{CustomComponent:E,label:(0,h.s)(i,b),path:f}),_&&(0,p.jsx)(na,{count:S,i18n:b,withMessage:!0})]}),initCollapsed:w,onToggle:T,children:(0,p.jsx)(hU,{fields:r,margins:"small",parentIndexPath:s,parentPath:c,parentSchemaPath:u,permissions:m,readOnly:g||D})}),$,(0,p.jsx)(em,{CustomComponent:P,Fallback:(0,p.jsx)(nr,{description:a,path:f})})]})]})}),rR=(0,o.lazy)(()=>n.e(8886).then(n.bind(n,68886))),rL=e=>(0,p.jsx)(o.Suspense,{fallback:(0,p.jsx)(c.f,{height:50}),children:(0,p.jsx)(rR,{...e})});function rF(e){return(rF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function rO(e){var t=function(e,t){if("object"!=rF(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=rF(a))return a;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==rF(t)?t:t+""}function rM(e,t,n){return(t=rO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function rB(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
36t%2?rI(Object(n),!0).forEach(function(t){rM(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rz(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function rU(e,t){if(e){if("string"==typeof e)return rz(e,t);var n=({}).toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rz(e,t):void 0}}function rV(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,l,r,i,o=[],s=!0,c=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(a=r.call(n)).done)&&(o.push(a.value),o.length!==t);s=!0);}catch(e){c=!0,l=e}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw l}}return o}}(e,t)||rU(e,t)||function(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
37In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function rH(e,t){if(null==e)return{};var n,a,l=np(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var rq=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function rW(e){var t=e.defaultInputValue,n=e.defaultMenuIsOpen,a=e.defaultValue,l=e.inputValue,r=e.menuIsOpen,i=e.onChange,s=e.onInputChange,c=e.onMenuClose,d=e.onMenuOpen,u=e.value,p=rH(e,rq),h=rV((0,o.useState)(void 0!==l?l:void 0===t?"":t),2),f=h[0],m=h[1],g=rV((0,o.useState)(void 0!==r?r:void 0!==n&&n),2),b=g[0],v=g[1],y=rV((0,o.useState)(void 0!==u?u:void 0===a?null:a),2),x=y[0],w=y[1],j=(0,o.useCallback)(function(e,t){"function"==typeof i&&i(e,t),w(e)},[i]),C=(0,o.useCallback)(function(e,t){var n;"function"==typeof s&&(n=s(e,t)),m(void 0!==n?n:e)},[s]),S=(0,o.useCallback)(function(){"function"==typeof d&&d(),v(!0)},[d]),k=(0,o.useCallback)(function(){"function"==typeof c&&c(),v(!1)},[c]),_=void 0!==l?l:f,$=void 0!==r?r:b,N=void 0!==u?u:x;return rB(rB({},p),{},{inputValue:_,menuIsOpen:$,onChange:j,onInputChange:C,onMenuClose:k,onMenuOpen:S,value:N})}function rK(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,rO(a.key),a)}}function rQ(e){return(rQ=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function rY(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rY=function(){return!!e})()}function rG(e){return function(e){if(Array.isArray(e))return rz(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||rU(e)||function(){throw TypeError(`Invalid attempt to spread non-iterable instance.
38In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}var rX=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(((t=document.createElement("style")).setAttribute("data-emotion",this.key),void 0!==this.nonce&&t.setAttribute("nonce",this.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t));var t,n=this.tags[this.tags.length-1];if(this.isSpeedy){var a=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(n);try{a.insertRule(e,a.cssRules.length)}catch{}}else n.appendChild(document.createTextNode(e));this.ctr++}
vendor: 2,813 bytes, line 38
38,t.flush=function(){this.tags.forEach(function(e){var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)}),this.tags=[],this.ctr=0},e}(),rZ="-ms-",rJ="-moz-",r0="-webkit-",r1="comm",r3="rule",r2="decl",r6="@keyframes",r5=Math.abs,r4=String.fromCharCode,r8=Object.assign;function r7(e,t,n){return e.replace(t,n)}function r9(e,t){return e.indexOf(t)}function ie(e,t){return 0|e.charCodeAt(t)}function it(e,t,n){return e.slice(t,n)}function ia(e){return e.length}function il(e,t){return t.push(e),e}var ir=1,ii=1,io=0,is=0,ic=0,id="";function iu(e,t,n,a,l,r,i){return{value:e,root:t,parent:n,type:a,props:l,children:r,line:ir,column:ii,length:i,return:""}}function ip(e,t){return r8(iu("",null,null,"",null,null,0),e,{length:-e.length},t)}function ih(){return ic=is<io?ie(id,is++):0,ii++,10===ic&&(ii=1,ir++),ic}function im(){return ie(id,is)}function ig(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function ib(e){return ir=ii=1,io=ia(id=e),is=0,[]}function iv(e){var t,n;return(t=is-1,n=function e(t){for(;ih();)switch(ic){case t:return is;case 34:case 39:34!==t&&39!==t&&e(ic);break;case 40:41===t&&e(t);break;case 92:ih()}return is}(91===e?e+2:40===e?e+1:e),it(id,t,n)).trim()}function iy(e,t,n,a,l,r,i,o,s,c,d){for(var u=l-1,p=0===l?r:[""],h=p.length,f=0,m=0,g=0;f<a;++f)for(var b=0,v=it(e,u+1,u=r5(m=i[f])),y=e;b<h;++b)(y=(m>0?p[b]+" "+v:r7(v,/&\f/g,p[b])).trim())&&(s[g++]=y);return iu(e,t,n,0===l?r3:o,s,c,d)}function ix(e,t,n,a){return iu(e,t,n,r2,it(e,0,a),it(e,a+1,-1),a)}function iw(e,t){for(var n="",a=e.length,l=0;l<a;l++)n+=t(e[l],l,e,t)||"";return n}function ij(e,t,n,a){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case r2:return e.return=e.return||e.value;case r1:return"";case r6:return e.return=e.value+"{"+iw(e.children,a)+"}";case r3:e.value=e.props.join(",")}return ia(n=iw(e.children,a))?e.return=e.value+"{"+n+"}":""}var iC=function(e,t,n){for(var a=0,l=0;a=l,l=im(),38===a&&12===l&&(t[n]=1),!ig(l);)ih();return it(id,e,is)},iS=function(e,t){var n=-1,a=44;do switch(ig(a)){case 0:38===a&&12===im()&&(t[n]=1),e[n]+=iC(is-1,t,n);break;case 2:e[n]+=iv(a);break;case 4:if(44===a){e[++n]=58===im()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=r4(a)}while(a=ih());return e},ik=function(e,t){var n;return n=iS(ib(e),t),id="",n},i_=new WeakMap,i$=function(e){if(!("rule"!==e.type||!e.parent||e.length<1)){for(var t=e.value,n=e.parent,a=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if(!(1===e.props.length&&58!==t.charCodeAt(0)&&!i_.get(n))&&!a){i_.set(e,!0);for(var l=[],r=ik(t,l),i=n.props,o=0,s=0;o<r.length;o++)for(var c=0;c<i.length;
vendor: 7,670 bytes, line 38
38c++,s++)e.props[s]=l[o]?r[o].replace(/&\f/g,i[c]):i[c]+" "+r[o]}}},iN=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}},iP=[function(e,t,n,a){if(e.length>-1&&!e.return)switch(e.type){case r2:e.return=function e(t,n){switch(45^ie(t,0)?(((n<<2^ie(t,0))<<2^ie(t,1))<<2^ie(t,2))<<2^ie(t,3):0){case 5103:return r0+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return r0+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return r0+t+rJ+t+rZ+t+t;case 6828:case 4268:return r0+t+rZ+t+t;case 6165:return r0+t+rZ+"flex-"+t+t;case 5187:return r0+t+r7(t,/(\w+).+(:[^]+)/,r0+"box-$1$2"+rZ+"flex-$1$2")+t;case 5443:return r0+t+rZ+"flex-item-"+r7(t,/flex-|-self/,"")+t;case 4675:return r0+t+rZ+"flex-line-pack"+r7(t,/align-content|flex-|-self/,"")+t;case 5548:return r0+t+rZ+r7(t,"shrink","negative")+t;case 5292:return r0+t+rZ+r7(t,"basis","preferred-size")+t;case 6060:return r0+"box-"+r7(t,"-grow","")+r0+t+rZ+r7(t,"grow","positive")+t;case 4554:return r0+r7(t,/([^-])(transform)/g,"$1"+r0+"$2")+t;case 6187:return r7(r7(r7(t,/(zoom-|grab)/,r0+"$1"),/(image-set)/,r0+"$1"),t,"")+t;case 5495:case 3959:return r7(t,/(image-set\([^]*)/,r0+"$1$`$1");case 4968:return r7(r7(t,/(.+:)(flex-)?(.*)/,r0+"box-pack:$3"+rZ+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+r0+t+t;case 4095:case 3583:case 4068:case 2532:return r7(t,/(.+)-inline(.+)/,r0+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ia(t)-1-n>6)switch(ie(t,n+1)){case 109:if(45!==ie(t,n+4))break;case 102:return r7(t,/(.+:)(.+)-([^]+)/,"$1"+r0+"$2-$3$1"+rJ+(108==ie(t,n+3)?"$3":"$2-$3"))+t;case 115:return~r9(t,"stretch")?e(r7(t,"stretch","fill-available"),n)+t:t}break;case 4949:if(115!==ie(t,n+1))break;case 6444:switch(ie(t,ia(t)-3-(~r9(t,"!important")&&10))){case 107:return r7(t,":",":"+r0)+t;case 101:return r7(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+r0+(45===ie(t,14)?"inline-":"")+"box$3$1"+r0+"$2$3$1"+rZ+"$2box$3")+t}break;case 5936:switch(ie(t,n+11)){case 114:return r0+t+rZ+r7(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return r0+t+rZ+r7(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return r0+t+rZ+r7(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return r0+t+rZ+t+t}return t}(e.value,e.length);break;case r6:return iw([ip(e,{value:r7(e.value,"@","@"+r0)})],a);case r3:if(e.length){var l,r;return l=e.props,r=function(t){var n;switch(n=t,(n=/(::plac\w+|:read-\w+)/.exec(n))?n[0]:n){case":read-only":case":read-write":return iw([ip(e,{props:[r7(t,/:(read-\w+)/,":"+rJ+"$1")]})],a);case"::placeholder":return iw([ip(e,{props:[r7(t,/:(plac\w+)/,":"+r0+"input-$1")]}),ip(e,{props:[r7(t,/:(plac\w+)/,":"+rJ+"$1")]}),ip(e,{props:[r7(t,/:(plac\w+)/,rZ+"input-$1")]})],a)}return""},l.map(r).join("")}}}],iE=function(e,t,n){var a=e.key+"-"+t.name;!1===n&&void 0===e.registered[a]&&(e.registered[a]=t.styles)},iD=function(e,t,n){iE(e,t,n);var a=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var l=t;do e.insert(t===l?"."+a:"",l,e.sheet,!0),l=l.next;while(void 0!==l)}},iT={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},iA=/[A-Z]|^ms/g,iR=/_EMO_([^_]+?)_([^]*?)_EMO_/g,iL=function(e){return 45===e.charCodeAt(1)},iF=function(e){return null!=e&&"boolean"!=typeof e},iO=(iB=function(e){return iL(e)?e:e.replace(iA,"-$&").toLowerCase()},iz=Object.create(null),function(e){return void 0===iz[e]&&(iz[e]=iB(e)),iz[e]}),iM=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(iR,function(e,t,n){return iU={name:t,styles:n,next:iU},t})}return 1===iT[e]||iL(e)||"number"!=typeof t||0===t?t:t+"px"};function iI(e,t,n){if(null==n)return"";if(void 0!==n.__emotion_styles)return n;switch(typeof n){case"boolean":return"";case"object":if(1===n.anim)return iU={name:n.name,styles:n.styles,next:iU},n.name;if(void 0!==n.styles){var a=n.next;if(void 0!==a)for(;void 0!==a;)iU={name:a.name,styles:a.styles,next:iU},a=a.next;return n.styles+";"}return function(e,t,n){var a="";if(Array.isArray(n))for(var l=0;l<n.length;l++)a+=iI(e,t,n[l])+";";else for(var r in n){var i=n[r];if("object"!=typeof i)null!=t&&void 0!==t[i]?a+=r+"{"+t[i]+"}":iF(i)&&(a+=iO(r)+":"+iM(r,i)+";");else if(Array.isArray(i)&&"string"==typeof i[0]&&(null==t||void 0===t[i[0]]))for(var o=0;o<i.length;o++)iF(i[o])&&(a+=iO(r)+":"+iM(r,i[o])+";");else{var s=iI(e,t,i);switch(r){case"animation":case"animationName":a+=iO(r)+":"+s+";";break;default:a+=r+"{"+s+"}"}}}return a}(e,t,n);case"function":if(void 0!==e){var l=iU,r=n(e);return iU=l,iI(e,t,r)}}if(null==t)return n;var i=t[n];return void 0!==i?i:n}var iB,iz,iU,iV=/label:\s*([^\s;{]+)\s*(;|$)/g;function iH(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var a=!0,l="";iU=void 0;var r=e[0];null==r||void 0===r.raw?(a=!1,l+=iI(n,t,r)):l+=r[0];for(var i=1;i<e.length;i++)l+=iI(n,t,e[i]),a&&(l+=r[i]);iV.lastIndex=0;for(var o,s="";null!==(o=iV.exec(l));)s+="-"+o[1];return{name:function(e){for(var t,n=0,a=0,l=e.length;l>=4;++a,l-=4)t=(65535&(t=255&e.charCodeAt(a)|(255&e.charCodeAt(++a))<<8|(255&e.charCodeAt(++a))<<16|(255&e.charCodeAt(++a))<<24))*0x5bd1e995+((t>>>16)*59797<<16),t^=t>>>24,n=(65535&t)*0x5bd1e995+((t>>>16)*59797<<16)^(65535&n)*0x5bd1e995+((n>>>16)*59797<<16);switch(l){case 3:n^=(255&e.charCodeAt(a+2))<<16;case 2:n^=(255&e.charCodeAt(a+1))<<8;case 1:n^=255&e.charCodeAt(a),n=(65535&n)*0x5bd1e995+((n>>>16)*59797<<16)}return n^=n>>>13,(((n=(65535&n)*0x5bd1e995+((n>>>16)*59797<<16))^n>>>15)>>>0).toString(36)}(l)+s,styles:l,next:iU}}var iq=!!o.useInsertionEffect&&o.useInsertionEffect||function(e){return e()},iW=o.createContext("u">typeof HTMLElement?function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))})}var a,l=e.stylisPlugins||iP,r={},i=[];a=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n<t.length;n++)r[t[n]]=!0;i.push(e)});var o,s,c,d,u=(s=(o=[i$,iN].concat(l,[ij,(c=function(e){d.insert(e)},function(e){e.root||(e=e.return)&&c(e)})])).length,function(e,t,n,a){for(var l="",r=0;r<s;r++)l+=o[r](e,t,n,a)||"";return l}),p=function(e){var t,n;return iw((n=function e(t,n,a,l,r,i,o,s,c){for(var d,u=0,p=0,h=o,f=0,m=0,g=0,b=1,v=1,y=1,x=0,w="",j=r,C=i,S=l,k=w;v;)switch(g=x,x=ih()){case 40:if(108!=g&&58==ie(k,h-1)){-1!=r9(k+=r7(iv(x),"&","&\f"),"&\f")&&(y=-1);break}case 34:case 39:case 91:k+=iv(x);break;case 9:case 10:case 13:case 32:k+=function(e){for(;(ic=im())&&ic<33;)ih();return ig(e)>2||ig(ic)>3?"":" "}(g);break;case 92:k+=function(e,t){for(var n;--t&&ih()&&!(ic<48||ic>102||ic>57&&ic<65||ic>70&&ic<97););
38return n=is+(t<6&&32==im()&&32==ih()),it(id,e,n)}(is-1,7);continue;case 47:switch(im()){case 42:case 47:il((d=function(e,t){for(;ih()&&e+ic!==57&&(e+ic!==84||47!==im()););return"/*"+it(id,t,is-1)+"*"+r4(47===e?e:ih())}(ih(),is),iu(d,n,a,r1,r4(ic),it(d,2,-2),0)),c);break;default:k+="/"}break;case 123*b:s[u++]=ia(k)*y;case 125*b:case 59:case 0:switch(x){case 0:case 125:v=0;case 59+p:-1==y&&(k=r7(k,/\f/g,"")),m>0&&ia(k)-h&&il(m>32?ix(k+";",l,a,h-1):ix(r7(k," ","")+";",l,a,h-2),c);break;case 59:k+=";";default:if(il(S=iy(k,n,a,u,p,r,s,w,j=[],C=[],h),i),123===x)if(0===p)e(k,n,S,S,j,i,h,s,C);else switch(99===f&&110===ie(k,3)?100:f){case 100:case 108:case 109:case 115:e(t,S,S,l&&il(iy(t,S,S,0,0,r,s,w,r,j=[],h),C),r,C,h,s,l?j:C);break;default:e(k,S,S,S,[""],C,0,s,C)}}u=p=m=0,b=y=1,w=k="",h=o;break;case 58:h=1+ia(k),m=g;default:if(b<1){if(123==x)--b;else if(125==x&&0==b++&&125==(ic=is>0?ie(id,--is):0,ii--,10===ic&&(ii=1,ir--),ic))continue}switch(k+=r4(x),x*b){case 38:y=p>0?1:(k+="\f",-1);break;case 44:s[u++]=(ia(k)-1)*y,y=1;break;case 64:45===im()&&(k+=iv(ih())),f=im(),p=h=ia(w=k+=function(e){for(;!ig(im());)ih();return it(id,e,is)}(is)),x++;break;case 45:45===g&&2==ia(k)&&(b=0)}}return i}("",null,null,null,[""],t=ib(t=e),0,[0],t),id="",n),u)},h={key:t,sheet:new rX({key:t,container:a,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:r,registered:{},insert:function(e,t,n,a){d=n,p(e?e+"{"+t.styles+"}":t.styles),a&&(h.inserted[t.name]=!0)}};return h.sheet.hydrate(i),h}({key:"css"}):null);iW.Provider;var iK=o.createContext({}),iQ={}.hasOwnProperty,iY="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",iG=function(e,t){var n={};for(var a in t)iQ.call(t,a)&&(n[a]=t[a]);return n[iY]=e,n},iX=function(e){var t=e.cache,n=e.serialized,a=e.isStringTag;return iE(t,n,a),iq(function(){return iD(t,n,a)}),null},iZ=(os=function(e,t,n){var a,l,r,i=e.css;"string"==typeof i&&void 0!==t.registered[i]&&(i=t.registered[i]);var s=e[iY],c=[i],d="";"string"==typeof e.className?(a=t.registered,l=e.className,r="",l.split(" ").forEach(function(e){void 0!==a[e]?c.push(a[e]+";"):e&&(r+=e+" ")}),d=r):null!=e.className&&(d=e.className+" ");var u=iH(c,void 0,o.useContext(iK));d+=t.key+"-"+u.name;var p={};for(var h in e)iQ.call(e,h)&&"css"!==h&&h!==iY&&(p[h]=e[h]);return p.className=d,n&&(p.ref=n),o.createElement(o.Fragment,null,o.createElement(iX,{cache:t,serialized:u,isStringTag:"string"==typeof s}),o.createElement(s,p))},(0,o.forwardRef)(function(e,t){return os(e,(0,o.useContext)(iW),t)}));(0,u.e)(ec());var iJ=function(e,t){var n=arguments;if(null==t||!iQ.call(t,"css"))return o.createElement.apply(void 0,n);var a=n.length,l=Array(a);l[0]=iZ,l[1]=iG(e,t);for(var r=2;r<a;r++)l[r]=n[r];return o.createElement.apply(null,l)};function i0(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return iH(t)}oc=iJ||(iJ={}),od||(od=oc.JSX||(oc.JSX={})),(0,d.l)();var i1=o.useLayoutEffect,i3=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],i2=function(){};function i6(e,t){for(var n=arguments.length,a=Array(n>2?n-2:0),l=2;l<n;l++)a[l-2]=arguments[l];var r=[].concat(a);if(t&&e)for(var i in t)t.hasOwnProperty(i)&&t[i]&&r.push("".concat(i?"-"===i[0]?e+i:e+"__"+i:e));return r.filter(function(e){return e}).map(function(e){return String(e).trim()}).join(" ")}var i5=function(e){return Array.isArray(e)?e.filter(Boolean):"object"===rF(e)&&null!==e?[e]:[]},i4=function(e){return e.className,e.clearValue,e.cx,e.getStyles,e.getClassNames,e.getValue,e.hasValue,e.isMulti,e.isRtl,e.options,e.selectOption,e.selectProps,e.setValue,e.theme,rB({},rH(e,i3))},i8=function(e,t,n){var a=e.cx,l=e.getStyles,r=e.getClassNames,i=e.className;return{css:l(t,e),className:a(n??{},r(t,e),i)}};function i7(e){return[document.documentElement,document.body,window].indexOf(e)>-1}function i9(e){return i7(e)?window.pageYOffset:e.scrollTop}function oe(e,t){i7(e)?window.scrollTo(0,t):e.scrollTop=t}function ot(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:i2,l=i9(e),r=t-l,i=0;!function t(){var o;i+=10,oe(e,r*((o=(o=i)/n-1)*o*o+1)+l),i<n?window.requestAnimationFrame(t):a(e)}()}function on(e,t){var n=e.getBoundingClientRect(),a=t.getBoundingClientRect(),l=t.offsetHeight/3;a.bottom+l>n.bottom?oe(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+l,e.scrollHeight)):a.top-l<n.top&&oe(e,Math.max(t.offsetTop-l,0))}function oa(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}var ol=!1,or="u">typeof window?window:{};or.addEventListener&&or.removeEventListener&&(or.addEventListener("p",i2,{get passive
38(){return ol=!0}}),or.removeEventListener("p",i2,!1));var oi=ol;function oo(e){return null!=e}var os,oc,od,ou,op=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return Object.entries(e).filter(function(e){var t=rV(e,1)[0];return!n.includes(t)}).reduce(function(e,t){var n=rV(t,2),a=n[0],l=n[1];return e[a]=l,e},{})},oh=["children","innerProps"],of=["children","innerProps"],om=function(e){return"auto"===e?"bottom":e},og=(0,o.createContext)(null),ob=function(e){var t=e.children,n=e.minMenuHeight,a=e.maxMenuHeight,l=e.menuPlacement,r=e.menuPosition,i=e.menuShouldScrollIntoView,s=e.theme,c=((0,o.useContext)(og)||{}).setPortalPlacement,d=(0,o.useRef)(null),u=rV((0,o.useState)(a),2),p=u[0],h=u[1],f=rV((0,o.useState)(null),2),m=f[0],g=f[1],b=s.spacing.controlHeight;return i1(function(){var e=d.current;if(e){var t="fixed"===r,o=function(e){var t,n=e.maxHeight,a=e.menuEl,l=e.minHeight,r=e.placement,i=e.shouldScroll,o=e.isFixedPosition,s=e.controlHeight,c=function(e){var t=getComputedStyle(e),n="absolute"===t.position,a=/(auto|scroll)/;if("fixed"===t.position)return document.documentElement;for(var l=e;l=l.parentElement;)if(t=getComputedStyle(l),!(n&&"static"===t.position)&&a.test(t.overflow+t.overflowY+t.overflowX))return l;return document.documentElement}(a),d={placement:"bottom",maxHeight:n};if(!a||!a.offsetParent)return d;var u=c.getBoundingClientRect().height,p=a.getBoundingClientRect(),h=p.bottom,f=p.height,m=p.top,g=a.offsetParent.getBoundingClientRect().top,b=o||i7(t=c)?window.innerHeight:t.clientHeight,v=i9(c),y=parseInt(getComputedStyle(a).marginBottom,10),x=parseInt(getComputedStyle(a).marginTop,10),w=g-x,j=b-m,C=w+v,S=u-v-m,k=h-b+v+y,_=v+m-x;switch(r){case"auto":case"bottom":if(j>=f)return{placement:"bottom",maxHeight:n};if(S>=f&&!o)return i&&ot(c,k,160),{placement:"bottom",maxHeight:n};if(!o&&S>=l||o&&j>=l)return i&&ot(c,k,160),{placement:"bottom",maxHeight:o?j-y:S-y};if("auto"===r||o){var $=n,N=o?w:C;return N>=l&&($=Math.min(N-y-s,n)),{placement:"top",maxHeight:$}}if("bottom"===r)return i&&oe(c,k),{placement:"bottom",maxHeight:n};break;case"top":if(w>=f)return{placement:"top",maxHeight:n};if(C>=f&&!o)return i&&ot(c,_,160),{placement:"top",maxHeight:n};if(!o&&C>=l||o&&w>=l){var P=n;return(!o&&C>=l||o&&w>=l)&&(P=o?w-x:C-x),i&&ot(c,_,160),{placement:"top",maxHeight:P}}return{placement:"bottom",maxHeight:n};default:throw Error('Invalid placement provided "'.concat(r,'".'))}return d}({maxHeight:a,menuEl:e,minHeight:n,placement:l,shouldScroll:i&&!t,isFixedPosition:t,controlHeight:b});h(o.maxHeight),g(o.placement),c?.(o.placement)}},[a,l,r,i,n,c,b]),t({ref:d,placerProps:rB(rB({},e),{},{placement:m||om(l),maxHeight:p})})},ov=function(e,t){var n=e.theme,a=n.spacing.baseUnit,l=n.colors;return rB({textAlign:"center"},t?{}:{color:l.neutral40,padding:"".concat(2*a,"px ").concat(3*a,"px")})},oy=["size"],ox=["innerProps","isRtl","size"],ow={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},oj=function(e){var t=e.size,n=rH(e,oy);return iJ("svg",nu({height:t,width:t,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:ow},n))},oC=function(e){return iJ(oj,nu({size:20},e),iJ("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},oS=function(e){return iJ(oj,nu({size:20},e),iJ("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},ok=function(e,t){var n=e.isFocused,a=e.theme,l=a.spacing.baseUnit,r=a.colors;return rB({label:"indicatorContainer",display:"flex",transition:"color 150ms"},t?{}:{color:n?r.neutral60:r.neutral20,padding:2*l,":hover":{color:n?r.neutral80:r.neutral40}})},o_=function(){var e=i0.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}(ou||(oV=[`
39  0%, 80%, 100% { opacity: 0; }
40  40% { opacity: 1; }
41`],oH||(oH=oV.slice(0)),ou=Object.freeze(Object.defineProperties(oV,{raw:{value:Object.freeze(oH)}})))),o$=function(e){var t=e.delay,n=e.offset;return iJ("span",{css:i0({animation:"".concat(o_," 1s ease-in-out ").concat(t,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:n?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},oN=["data"],oP=["innerRef","isDisabled","isHidden","inputClassName"],oE={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},oD={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":rB({content:'attr(data-value) " "',visibility:"hidden",
41whiteSpace:"pre"},oE)},oT=function(e){var t=e.children,n=e.innerProps;return iJ("div",n,t)},oA={ClearIndicator:function(e){var t=e.children,n=e.innerProps;return iJ("div",nu({},i8(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),n),t||iJ(oC,null))},Control:function(e){var t=e.children,n=e.isDisabled,a=e.isFocused,l=e.innerRef,r=e.innerProps,i=e.menuIsOpen;return iJ("div",nu({ref:l},i8(e,"control",{control:!0,"control--is-disabled":n,"control--is-focused":a,"control--menu-is-open":i}),r,{"aria-disabled":n||void 0}),t)},DropdownIndicator:function(e){var t=e.children,n=e.innerProps;return iJ("div",nu({},i8(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),n),t||iJ(oS,null))},DownChevron:oS,CrossIcon:oC,Group:function(e){var t=e.children,n=e.cx,a=e.getStyles,l=e.getClassNames,r=e.Heading,i=e.headingProps,o=e.innerProps,s=e.label,c=e.theme,d=e.selectProps;return iJ("div",nu({},i8(e,"group",{group:!0}),o),iJ(r,nu({},i,{selectProps:d,theme:c,getStyles:a,getClassNames:l,cx:n}),s),iJ("div",null,t))},GroupHeading:function(e){var t=i4(e);t.data;var n=rH(t,oN);return iJ("div",nu({},i8(e,"groupHeading",{"group-heading":!0}),n))},IndicatorsContainer:function(e){var t=e.children,n=e.innerProps;return iJ("div",nu({},i8(e,"indicatorsContainer",{indicators:!0}),n),t)},IndicatorSeparator:function(e){var t=e.innerProps;return iJ("span",nu({},t,i8(e,"indicatorSeparator",{"indicator-separator":!0})))},Input:function(e){var t=e.cx,n=e.value,a=i4(e),l=a.innerRef,r=a.isDisabled,i=a.isHidden,o=a.inputClassName,s=rH(a,oP);return iJ("div",nu({},i8(e,"input",{"input-container":!0}),{"data-value":n||""}),iJ("input",nu({className:t({input:!0},o),ref:l,style:rB({label:"input",color:"inherit",background:0,opacity:+!i,width:"100%"},oE),disabled:r},s)))},LoadingIndicator:function(e){var t=e.innerProps,n=e.isRtl,a=e.size,l=rH(e,ox);return iJ("div",nu({},i8(rB(rB({},l),{},{innerProps:t,isRtl:n,size:void 0===a?4:a}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),t),iJ(o$,{delay:0,offset:n}),iJ(o$,{delay:160,offset:!0}),iJ(o$,{delay:320,offset:!n}))},Menu:function(e){var t=e.children,n=e.innerRef,a=e.innerProps;return iJ("div",nu({},i8(e,"menu",{menu:!0}),{ref:n},a),t)},MenuList:function(e){var t=e.children,n=e.innerProps,a=e.innerRef,l=e.isMulti;return iJ("div",nu({},i8(e,"menuList",{"menu-list":!0,"menu-list--is-multi":l}),{ref:a},n),t)},MenuPortal:function(e){var t=e.appendTo,n=e.children,a=e.controlElement,l=e.innerProps,r=e.menuPlacement,i=e.menuPosition,c=(0,o.useRef)(null),u=(0,o.useRef)(null),p=rV((0,o.useState)(om(r)),2),h=p[0],f=p[1],m=(0,o.useMemo)(function(){return{setPortalPlacement:f}},[]),g=rV((0,o.useState)(null),2),b=g[0],v=g[1],y=(0,o.useCallback)(function(){if(a){var e,t={bottom:(e=a.getBoundingClientRect()).bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width},n="fixed"===i?0:window.pageYOffset,l=t[h]+n;(l!==b?.offset||t.left!==b?.rect.left||t.width!==b?.rect.width)&&v({offset:l,rect:t})}},[a,i,h,b?.offset,b?.rect.left,b?.rect.width]);i1(function(){y()},[y]);var x=(0,o.useCallback)(function(){"function"==typeof u.current&&(u.current(),u.current=null),a&&c.current&&(u.current=(0,d.k)(a,c.current,y,{elementResize:"ResizeObserver"in window}))},[a,y]);i1(function(){x()},[x]);var w=(0,o.useCallback)(function(e){c.current=e,x()},[x]);if(!t&&"fixed"!==i||!b)return null;var j=iJ("div",nu({ref:w}
41,i8(rB(rB({},e),{},{offset:b.offset,position:i,rect:b.rect}),"menuPortal",{"menu-portal":!0}),l),n);return iJ(og.Provider,{value:m},t?(0,s.createPortal)(j,t):j)},LoadingMessage:function(e){var t=e.children,n=void 0===t?"Loading...":t,a=e.innerProps,l=rH(e,of);return iJ("div",nu({},i8(rB(rB({},l),{},{children:n,innerProps:a}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),a),n)},NoOptionsMessage:function(e){var t=e.children,n=void 0===t?"No options":t,a=e.innerProps,l=rH(e,oh);return iJ("div",nu({},i8(rB(rB({},l),{},{children:n,innerProps:a}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),a),n)},MultiValue:function(e){var t=e.children,n=e.components,a=e.data,l=e.innerProps,r=e.isDisabled,i=e.removeProps,o=e.selectProps,s=n.Container,c=n.Label,d=n.Remove;return iJ(s,{data:a,innerProps:rB(rB({},i8(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":r})),l),selectProps:o},iJ(c,{data:a,innerProps:rB({},i8(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:o},t),iJ(d,{data:a,innerProps:rB(rB({},i8(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(t||"option")},i),selectProps:o}))},MultiValueContainer:oT,MultiValueLabel:oT,MultiValueRemove:function(e){var t=e.children,n=e.innerProps;return iJ("div",nu({role:"button"},n),t||iJ(oC,{size:14}))},Option:function(e){var t=e.children,n=e.isDisabled,a=e.isFocused,l=e.isSelected,r=e.innerRef,i=e.innerProps;return iJ("div",nu({},i8(e,"option",{option:!0,"option--is-disabled":n,"option--is-focused":a,"option--is-selected":l}),{ref:r,"aria-disabled":n},i),t)},Placeholder:function(e){var t=e.children,n=e.innerProps;return iJ("div",nu({},i8(e,"placeholder",{placeholder:!0}),n),t)},SelectContainer:function(e){var t=e.children,n=e.innerProps,a=e.isDisabled,l=e.isRtl;return iJ("div",nu({},i8(e,"container",{"--is-disabled":a,"--is-rtl":l}),n),t)},SingleValue:function(e){var t=e.children,n=e.isDisabled,a=e.innerProps;return iJ("div",nu({},i8(e,"singleValue",{"single-value":!0,"single-value--is-disabled":n}),a),t)},ValueContainer:function(e){var t=e.children,n=e.innerProps,a=e.isMulti,l=e.hasValue;return iJ("div",nu({},i8(e,"valueContainer",{"value-container":!0,"value-container--is-multi":a,"value-container--has-value":l}),n),t)}},oR=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function oL(e,t){if(e.length!==t.length)return!1;for(var n,a,l=0;l<e.length;l++)if(!((n=e[l])===(a=t[l])||oR(n)&&oR(a)))return!1;return!0}var oF={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},oO=function(e){return iJ("span",nu({css:oF},e))},oM={guidance:function(e){var t=e.isSearchable,n=e.isMulti,a=e.tabSelectsValue,l=e.context,r=e.isInitialFocus;switch(l){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(a?", press Tab to select the option and exit the menu":"",".");case"input":return r?"".concat(e["aria-label"]||"Select"," is focused ").concat(t?",type to refine list":"",", press Down to open the menu, ").concat(n?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(e){var t=e.action,n=e.label,a=void 0===n?"":n,l=e.labels,r=e.isDisabled;switch(t){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(a,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(l.length>1?"s":""," ").concat(l.join(","),", selected.");case"select-option":return r?"option ".concat(a," is disabled. Select another option."):"option ".concat(a,", selected.");default:return""}},onFocus:function(e){var t=e.context,n=e.focused,a=e.options,l=e.label,r=void 0===l?"":l,i=e.selectValue,o=e.isDisabled,s=e.isSelected,c=e.isAppleDevice,d=function(e,t){return e&&e.length?"".concat(e.indexOf(t)+1," of ").concat(e.length):""};if("value"===t&&i)return"value ".concat(r," focused, ").concat(d(i,n),".");if("menu"===t&&c){var u="".concat(s?" selected":"").concat(o?" disabled":"");return"".concat(r).concat(u,", ").concat(d(a,n),".")}return""},onFilter:function(e){var t=e.inputValue,n=e.resultsMessage;return"".concat(n).concat(t?" for search term "+t:"",".")}},oI=function(e){var t=e.ariaSelection,n=e.focusedOption,a=e.focusedValue,l=e.focu
41sableOptions,r=e.isFocused,i=e.selectValue,s=e.selectProps,c=e.id,d=e.isAppleDevice,u=s.ariaLiveMessages,p=s.getOptionLabel,h=s.inputValue,f=s.isMulti,m=s.isOptionDisabled,g=s.isSearchable,b=s.menuIsOpen,v=s.options,y=s.screenReaderStatus,x=s.tabSelectsValue,w=s.isLoading,j=s["aria-label"],C=s["aria-live"],S=(0,o.useMemo)(function(){return rB(rB({},oM),u||{})},[u]),k=(0,o.useMemo)(function(){var e="";if(t&&S.onChange){var n=t.option,a=t.options,l=t.removedValue,r=t.removedValues,o=t.value,s=l||n||(Array.isArray(o)?null:o),c=s?p(s):"",d=a||r||void 0,u=d?d.map(p):[],h=rB({isDisabled:s&&m(s,i),label:c,labels:u},t);e=S.onChange(h)}return e},[t,S,m,i,p]),_=(0,o.useMemo)(function(){var e="",t=n||a,r=!!(n&&i&&i.includes(n));if(t&&S.onFocus){var o={focused:t,label:p(t),isDisabled:m(t,i),isSelected:r,options:l,context:t===n?"menu":"value",selectValue:i,isAppleDevice:d};e=S.onFocus(o)}return e},[n,a,p,m,S,l,i,d]),$=(0,o.useMemo)(function(){var e="";if(b&&v.length&&!w&&S.onFilter){var t=y({count:l.length});e=S.onFilter({inputValue:h,resultsMessage:t})}return e},[l,h,b,S,v,y,w]),N=t?.action==="initial-input-focus",P=(0,o.useMemo)(function(){var e="";if(S.guidance){var t=a?"value":b?"menu":"input";e=S.guidance({"aria-label":j,context:t,isDisabled:n&&m(n,i),isMulti:f,isSearchable:g,tabSelectsValue:x,isInitialFocus:N})}return e},[j,n,a,f,m,g,b,S,i,x,N]),E=iJ(o.Fragment,null,iJ("span",{id:"aria-selection"},k),iJ("span",{id:"aria-focused"},_),iJ("span",{id:"aria-results"},$),iJ("span",{id:"aria-guidance"},P));return iJ(o.Fragment,null,iJ(oO,{id:c},N&&E),iJ(oO,{"aria-live":C,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},r&&!N&&E))},oB=[{base:"A",letters:"AⒶA\xc0\xc1\xc2ẦẤẪẨ\xc3ĀĂẰẮẴẲȦǠ\xc4ǞẢ\xc5ǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"\xc6ǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČ\xc7ḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺE\xc8\xc9\xcaỀẾỄỂẼĒḔḖĔĖ\xcbẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾI\xcc\xcd\xceĨĪĬİ\xcfḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃ\xd1ṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄO\xd2\xd3\xd4ỒỐỖỔ\xd5ṌȬṎŌṐṒŎȮȰ\xd6ȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬ\xd8ǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊU\xd9\xda\xdbŨṸŪṺŬ\xdcǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲ\xddŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚ\xe0\xe1\xe2ầấẫẩ\xe3āăằắẵẳȧǡ\xe4ǟả\xe5ǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"\xe6ǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"}
41,{base:"c",letters:"cⓒcćĉċč\xe7ḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔe\xe8\xe9\xeaềếễểẽēḕḗĕė\xebẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘi\xec\xed\xeeĩīĭ\xefḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹń\xf1ṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞo\xf2\xf3\xf4ồốỗổ\xf5ṍȭṏōṑṓŏȯȱ\xf6ȫỏőǒȍȏơờớỡởợọộǫǭ\xf8ǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢs\xdfśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤu\xf9\xfa\xfbũṹūṻŭ\xfcǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳ\xfdŷỹȳẏ\xffỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],oz=RegExp("["+oB.map(function(e){return e.letters}).join("")+"]","g"),oU={};for(oK=0;oK<oB.length;oK++)for(oq=oB[oK],oW=0;oW<oq.letters.length;oW++)oU[oq.letters[oW]]=oq.base;var oV,oH,oq,oW,oK,oQ=function(e){return e.replace(oz,function(e){return oU[e]})},oY=function(e,t){void 0===t&&(t=oL);var n=null;function a(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];if(n&&n.lastThis===this&&t(a,n.lastArgs))return n.lastResult;var r=e.apply(this,a);return n={lastResult:r,lastArgs:a,lastThis:this},r}return a.clear=function(){n=null},a}(oQ),oG=function(e){return e.replace(/^\s+|\s+$/g,"")},oX=function(e){return"".concat(e.label," ").concat(e.value)},oZ=["innerRef"];function oJ(e){var t=e.innerRef,n=op(rH(e,oZ),"onExited","in","enter","exit","appear");return iJ("input",nu({ref:t},n,{css:i0({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var o0=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()},o1=["boxSizing","height","overflow","paddingRight","position"],o3={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function o2(e){e.cancelable&&e.preventDefault()}function o6(e){e.stopPropagation()}function o5(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;0===e?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function o4(){return"ontouchstart"in window||navigator.maxTouchPoints}var o8=!!("u">typeof window&&window.document&&window.document.createElement),o7=0,o9={capture:!1,passive:!1},se=function(e){var t=e.target;return t.ownerDocument.activeElement&&t.ownerDocument.activeElement.blur()},st={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function sn(e){var t,n,a,l,r,i,s,c,d,u,p,h,f,m,g,b,v,y,x,w,j,C,S,k,_=e.children,$=e.lockEnabled,N=e.captureEnabled,P=(n=(t={isEnabled:void 0===N||N,onBottomArrive:e.onBottomArrive,onBottomLeave:e.onBottomLeave,onTopArrive:e.onTopArrive,onTopLeave:e.onTopLeave}).isEnabled,a=t.onBottomArrive,l=t.onBottomLeave,r=t.onTopArrive,i=t.onTopLeave,s=(0,o.useRef)(!1),c=(0,o.useRef)(!1),d=(0,o.useRef)(0),u=(0,o.useRef)(null),p=(0,o.useCallback)(function(e,t){if(null!==u.current){var n=u.current,o=n.scrollTop,d=n.scrollHeight,p=n.clientHeight,h=u.current,f=t>0,m=d-p-o,g=!1;m>t&&s.current&&(l&&l(e),s.current=!1),f&&c.current&&(i&&i(e),c.current=!1),f&&t>m?(a&&!s.current&&a(e),h.scrollTop=d,g=!0,s.current=!0):!f&&-t>o&&(r&&!c.current&&r(e),h.scrollTop=0,g=!0,c.current=!0),g&&o0(e)}},[a,l,r,i]),h=(0,o.useCallback)(function(e){p(e,e.deltaY)},[p]),f=(0,o.useCallback)(function(e){d.current=e.changedTouches[0].clientY},[]),m=(0,o.useCallback)(function(e){var t=d.current-e.changedTouches[0].clientY;p(e,t)},[p]),g=(0,o.useCallback)(function(e){if(e){var t=!!oi&&{passive:!1};e.addEventListener("wheel",h,t),e.addEventListener("touchstart",f,t),e.addEventListener("touchmove",m,t)}},[m,f,h]),b=(0,o.useCallback)(function(e){e&&(e.removeEventListener("wheel",h,!1),e.removeEventListener("touchstart",f,!1),e.removeEventListener("touchmove",m,!1))},[m,f,h]),(0,o.useEffect)(function(){if(n){var e=u.current;return g(e),function(){b(e)}}},[n,g,b]),function(e){u.current=e}),E=(y=(v={isEnabled:$}).isEnabled,w=void 0===(x=v.accountForScrollbars)||x,j=(0,o.useRef)({}),C=(0,o.useRef)(null),S=(0,o.useCallback)(function(e){if(o8){var t=document.body,n=t&&t.style;if(w&&o1.forEach(function(e){var t=n&&n[e];j.current[e]=t}),w&&o7<1){var a=parseInt(j.current.paddingRight,10)||0,l=document.body?document.body.clientWidth:0,r=window.innerWidth-l+a||0;Object.keys(o3).forEach(function(e){var t=o3[e];n&&(n[e]=t)}),n&&(n.paddingRight="".concat(r,"px"))}
41t&&o4()&&(t.addEventListener("touchmove",o2,o9),e&&(e.addEventListener("touchstart",o5,o9),e.addEventListener("touchmove",o6,o9))),o7+=1}},[w]),k=(0,o.useCallback)(function(e){if(o8){var t=document.body,n=t&&t.style;o7=Math.max(o7-1,0),w&&o7<1&&o1.forEach(function(e){var t=j.current[e];n&&(n[e]=t)}),t&&o4()&&(t.removeEventListener("touchmove",o2,o9),e&&(e.removeEventListener("touchstart",o5,o9),e.removeEventListener("touchmove",o6,o9)))}},[w]),(0,o.useEffect)(function(){if(y){var e=C.current;return S(e),function(){k(e)}}},[y,S,k]),function(e){C.current=e});return iJ(o.Fragment,null,$&&iJ("div",{onClick:se,css:st}),_(function(e){P(e),E(e)}))}var sa={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},sl=function(e){var t=e.name,n=e.onFocus;return iJ("input",{required:!0,name:t,tabIndex:-1,"aria-hidden":"true",onFocus:n,css:sa,value:"",onChange:function(){}})};function sr(e){var t;return"u">typeof window&&null!=window.navigator&&e.test((null==(t=window.navigator.userAgentData)?void 0:t.platform)||window.navigator.platform)}var si=function(e){return e.label},so=function(e){return e.value},ss={clearIndicator:ok,container:function(e){var t=e.isDisabled;return{label:"container",direction:e.isRtl?"rtl":void 0,pointerEvents:t?"none":void 0,position:"relative"}},control:function(e,t){var n=e.isDisabled,a=e.isFocused,l=e.theme,r=l.colors,i=l.borderRadius;return rB({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:l.spacing.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},t?{}:{backgroundColor:n?r.neutral5:r.neutral0,borderColor:n?r.neutral10:a?r.primary:r.neutral20,borderRadius:i,borderStyle:"solid",borderWidth:1,boxShadow:a?"0 0 0 1px ".concat(r.primary):void 0,"&:hover":{borderColor:a?r.primary:r.neutral30}})},dropdownIndicator:ok,group:function(e,t){var n=e.theme.spacing;return t?{}:{paddingBottom:2*n.baseUnit,paddingTop:2*n.baseUnit}},groupHeading:function(e,t){var n=e.theme,a=n.colors,l=n.spacing;return rB({label:"group",cursor:"default",display:"block"},t?{}:{color:a.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:3*l.baseUnit,paddingRight:3*l.baseUnit,textTransform:"uppercase"})},indicatorsContainer:function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},indicatorSeparator:function(e,t){var n=e.isDisabled,a=e.theme,l=a.spacing.baseUnit,r=a.colors;return rB({label:"indicatorSeparator",alignSelf:"stretch",width:1},t?{}:{backgroundColor:n?r.neutral10:r.neutral20,marginBottom:2*l,marginTop:2*l})},input:function(e,t){var n=e.isDisabled,a=e.value,l=e.theme,r=l.spacing,i=l.colors;return rB(rB({visibility:n?"hidden":"visible",transform:a?"translateZ(0)":""},oD),t?{}:{margin:r.baseUnit/2,paddingBottom:r.baseUnit/2,paddingTop:r.baseUnit/2,color:i.neutral80})},loadingIndicator:function(e,t){var n=e.isFocused,a=e.size,l=e.theme,r=l.colors,i=l.spacing.baseUnit;return rB({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:a,lineHeight:1,marginRight:a,textAlign:"center",verticalAlign:"middle"},t?{}:{color:n?r.neutral60:r.neutral20,padding:2*i})},loadingMessage:ov,menu:function(e,t){var n,a=e.placement,l=e.theme,r=l.borderRadius,i=l.spacing,o=l.colors;return rB((rM(n={label:"menu"},a?({bottom:"top",top:"bottom"})[a]:"bottom","100%"),rM(n,"position","absolute"),rM(n,"width","100%"),rM(n,"zIndex",1),n),t?{}:{backgroundColor:o.neutral0,borderRadius:r,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:i.menuGutter,marginTop:i.menuGutter})},menuList:function(e,t){var n=e.maxHeight,a=e.theme.spacing.baseUnit;return rB({maxHeight:n,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},t?{}:{paddingBottom:a,paddingTop:a})},menuPortal:function(e){var t=e.rect,n=e.offset,a=e.position;return{left:t.left,position:a,top:n,width:t.width,zIndex:1}},multiValue:function(e,t){var n=e.theme,a=n.spacing,l=n.borderRadius,r=n.colors;return rB({label:"multiValue",display:"flex",minWidth:0},t?{}:{backgroundColor:r.neutral10,borderRadius:l/2,margin:a.baseUnit/2})},multiValueLabel:function(e,t){var n=e.theme,a=n.borderRadius,l=n.colors,r=e.cropWithEllipsis;return rB({overflow:"hidden",textOverflow:r||void 0===r?"ellipsis":void 0,whiteSpace:"nowrap"},t?{}:{borderRadius:a/2,color:l.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},multiValueRemove:function(e,t){var n=e.theme,a=n.spacing,l=n.borderRadius,r=n.colors,i=e.isFocused;return rB({alignItems:"center",display:"flex"},t?{}:{borderRadius:l/2,backgroundColor:i?r.dangerLight:void 0,paddingLeft:a.baseUnit,paddingRight:a.baseUnit,":hover":{backgroundColor:r.dangerLight,color:r.danger}})},noOptionsMessage:ov,option:function(e,t){var n=e.isDisabled,a=e.isFocused,l=e.isSelected,r=e.theme,i=r.spacing,o=r.colors;return rB({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},t?{}:{backgroundColor:l?o.primary:a?o.primary25:"transparent",color:n?o.neutral20:l?o.neutral0:"inherit",padding:"".concat(2*i.baseUnit,"px ").concat(3*i.baseUnit,"px"),":active":{backgroundColor:n?void 0:l?o.primary:o.primary50}})},placeholder:function(e,t){var n=e.theme,a=n.spacing,l=n.colors;return rB({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},t?{}:{color:l.neutral50,marginLeft:a.baseUnit/2,marginRight:a.baseUnit/2})},singleValue:function(e,t){var n=e.isDisabled,a=e.theme,l=a.spacing,r=a.colors;return rB({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},t?{}:{color:n?r.neutral40:r.neutral80,marginLeft:l.baseUnit/2,marginRight:l.baseUnit/2})},valueContainer:function(e,t){var n=e.theme.spacing,a=e.isMulti,l=e.hasValue,r=e.selectProps.controlShouldRenderValue;return rB({alignItems:"center",display:a&&l&&r?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},t?{}:{padding:"".concat(n.baseUnit/2,"px ").concat(2*n.baseUnit,"px")})}},sc={borderRadius:4,colors:{primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},spacing:{baseUnit:4,controlHeight:38,menuGutter:8}},sd={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:oa(),captureMenuScroll:!oa(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:function(e,t){if(e.data.__isNew__)return!0;var n=rB({ignoreCase:!0,ignoreAccents:!0,stringify:oX,trim:!0,matchFrom:"any"},void 0),a=n.ignoreCase,l=n.ignoreAccents,r=n.stringify,i=n.trim,o=n.matchFrom,s=i?oG(t):t,c=i?oG(r(e)):r(e);return a&&(s=s.toLowerCase(),c=c.toLowerCase()),l&&(s=oY(s),c=oQ(c)),"start"===o?c.substr(0,s.length)===s:c.indexOf(s)>-1},formatGroupLabel:function(e){return e.label},getOptionLabel:si,getOptionValue:so,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:function(e){return!!e.isDisabled},loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!function(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var t=e.count;return"".concat(t," result").concat(1!==t?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};
41function su(e,t,n,a){var l=sy(e,t,n),r=sx(e,t,n),i=sb(e,t),o=sv(e,t);return{type:"option",data:t,isDisabled:l,isSelected:r,label:i,value:o,index:a}}function sp(e,t){return e.options.map(function(n,a){if("options"in n){var l=n.options.map(function(n,a){return su(e,n,t,a)}).filter(function(t){return sm(e,t)});return l.length>0?{type:"group",data:n,options:l,index:a}:void 0}var r=su(e,n,t,a);return sm(e,r)?r:void 0}).filter(oo)}function sh(e){return e.reduce(function(e,t){return"group"===t.type?e.push.apply(e,rG(t.options.map(function(e){return e.data}))):e.push(t.data),e},[])}function sf(e,t){return e.reduce(function(e,n){return"group"===n.type?e.push.apply(e,rG(n.options.map(function(e){return{data:e.data,id:"".concat(t,"-").concat(n.index,"-").concat(e.index)}}))):e.push({data:n.data,id:"".concat(t,"-").concat(n.index)}),e},[])}function sm(e,t){var n=e.inputValue,a=t.data,l=t.isSelected,r=t.label,i=t.value;return(!sj(e)||!l)&&sw(e,{label:r,value:i,data:a},void 0===n?"":n)}var sg=function(e,t){var n;return(null==(n=e.find(function(e){return e.data===t}))?void 0:n.id)||null},sb=function(e,t){return e.getOptionLabel(t)},sv=function(e,t){return e.getOptionValue(t)};function sy(e,t,n){return"function"==typeof e.isOptionDisabled&&e.isOptionDisabled(t,n)}function sx(e,t,n){if(n.indexOf(t)>-1)return!0;if("function"==typeof e.isOptionSelected)return e.isOptionSelected(t,n);var a=sv(e,t);return n.some(function(t){return sv(e,t)===a})}function sw(e,t,n){return!e.filterOption||e.filterOption(t,n)}var sj=function(e){var t=e.hideSelectedOptions,n=e.isMulti;return void 0===t?n:t},sC=1,sS=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&nh(r,e);var t,n,a,l=(t=rY(),function(){var e,n=rQ(r);e=t?Reflect.construct(n,arguments,rQ(this).constructor):n.apply(this,arguments);if(e&&("object"==rF(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");if(void 0===this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return this});function r(e){var t;if(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,r),(t=l.call(this,e)).state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:""},t.blockOptionHover=!1,t.isComposing=!1,t.commonProps=void 0,t.initialTouchX=0,t.initialTouchY=0,t.openAfterFocus=!1,t.scrollToFocusedOptionOnUpdate=!1,t.userIsDragging=void 0,t.isAppleDevice=sr(/^Mac/i)||sr(/^iPhone/i)||sr(/^iPad/i)||sr(/^Mac/i)&&navigator.maxTouchPoints>1,t.controlRef=null,t.getControlRef=function(e){t.controlRef=e},t.focusedOptionRef=null,t.getFocusedOptionRef=function(e){t.focusedOptionRef=e},t.menuListRef=null,t.getMenuListRef=function(e){t.menuListRef=e},t.inputRef=null,t.getInputRef=function(e){t.inputRef=e},t.focus=t.focusInput,t.blur=t.blurInput,t.onChange=function(e,n){var a=t.props,l=a.onChange;n.name=a.name,t.ariaOnChange(e,n),l(e,n)},t.setValue=function(e,n,a){var l=t.props,r=l.closeMenuOnSelect,i=l.isMulti,o=l.inputValue;t.onInputChange("",{action:"set-value",prevInputValue:o}),r&&(t.setState({inputIsHiddenAfterUpdate:!i}),t.onMenuClose()),t.setState({clearFocusValueOnUpdate:!0}),t.onChange(e,{action:n,option:a})},t.selectOption=function(e){var n=t.props,a=n.blurInputOnSelect,l=n.isMulti,r=n.name,i=t.state.selectValue,o=l&&t.isOptionSelected(e,i),s=t.isOptionDisabled(e,i);if(o){var c=t.getOptionValue(e);t.setValue(i.filter(function(e){return t.getOptionValue(e)!==c}),"deselect-option",e)}else{if(s)return void t.ariaOnChange(e,{action:"select-option",option:e,name:r});l?t.setValue([].concat(rG(i),[e]),"select-option",e):t.setValue(e,"select-option")}a&&t.blurInput()},t.removeValue=function(e){var n,a=t.props.isMulti,l=t.state.selectValue,r=t.getOptionValue(e),i=l.filter(function(e){return t.getOptionValue(e)!==r}),o=(n=i[0]||null,a?i:n);t.onChange(o,{action:"remove-value",removedValue:e}),t.focusInput()},t.clearValue=function(){var e,n,a=t.state.selectValue;t.onChange((e=t.props.isMulti,n=[],e?n:null),{action:"clear",removedValues:a})},t.popValue=function(){var e,n=t.props.isMulti,a=t.state.selectValue,l=a[a.length-1],r=a.slice(0,a.length-1),i=(e=r[0]||null,n?r:e);l&&t.onChange(i,{action:"pop-value",removedValue:l})},t.getFocusedOptionId=function(e){return sg(t.state.focusableOptionsWithIds,e)},t.getFocusableOptionsWithIds=function(){return sf(sp(t.props,t.state.selectValue),t.getElementId("option"))},t.getValue=function(){return t.state.selectValue},t.cx=function(){for(var e=arguments.length,n=Array(e),a=0;a<e;a++)n[a]=arguments[a];return i6.apply(void 0,[t.props.classNamePrefix].concat(n))},t.getOptionLabel=function(e){return sb(t.props,e)},t.getOptionValue=function(e){return sv(t.props,e)},t.getStyles=function(e,n){var a=t.props.unstyled,l=ss[e](n,a);l.boxSizing="border-box";var r=t.props.styles[e];return r?r(l,n):l},t.getClassNames=function(e,n){var a,l;return null==(a=(l=t.props.classNames)[e])?void 0:a.call(l,n)},t.getElementId=function(e){return"".concat(t.state.instancePrefix,"-").concat(e)},t.getComponents=function(){var e;return e=t.props,rB(rB({},oA),e.components)},t.buildCategorizedOptions=function(){return sp(t.props,t.state.selectValue)},t.getCategorizedOptions=function(){return t.props.menuIsOpen?t.buildCategorizedOptions():[]},t.buildFocusableOptions=function(){return sh(t.buildCategorizedOptions())},t.getFocusableOptions=function(){return t.props.menuIsOpen?t.buildFocusableOptions():[]},t.ariaOnChange=function(e,n){t.setState({ariaSelection:rB({value:e},n)})},t.onMenuMouseDown=function(e){0===e.button&&(e.stopPropagation(),e.preventDefault(),t.focusInput())},t.onMenuMouseMove=function(e){t.blockOptionHover=!1},t.onControlMouseDown=function(e){if(!e.defaultPrevented){var n=t.props.openMenuOnClick;t.state.isFocused?t.props.menuIsOpen?"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&t.onMenuClose():n&&t.openMenu("first"):(n&&(t.openAfterFocus=!0),t.focusInput()),"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&e.preventDefault()}},t.onDropdownIndicatorMouseDown=function(e){if(!(e&&"mousedown"===e.type&&0!==e.button)&&!t.props.isDisabled){var n=t.props,a=n.isMulti,l=n.menuIsOpen;t.focusInput(),l?(t.setState({inputIsHiddenAfterUpdate:!a}),t.onMenuClose()):t.openMenu("first"),e.preventDefault()}},t.onClearIndicatorMouseDown=function(e){e&&"mousedown"===e.type&&0!==e.button||(t.clearValue(),e.preventDefault(),t.openAfterFocus=!1,"touchend"===e.type?t.focu
vendor: 11,684 bytes, line 41
41sInput():setTimeout(function(){return t.focusInput()}))},t.onScroll=function(e){"boolean"==typeof t.props.closeMenuOnScroll?e.target instanceof HTMLElement&&i7(e.target)&&t.props.onMenuClose():"function"==typeof t.props.closeMenuOnScroll&&t.props.closeMenuOnScroll(e)&&t.props.onMenuClose()},t.onCompositionStart=function(){t.isComposing=!0},t.onCompositionEnd=function(){t.isComposing=!1},t.onTouchStart=function(e){var n=e.touches,a=n&&n.item(0);a&&(t.initialTouchX=a.clientX,t.initialTouchY=a.clientY,t.userIsDragging=!1)},t.onTouchMove=function(e){var n=e.touches,a=n&&n.item(0);if(a){var l=Math.abs(a.clientX-t.initialTouchX),r=Math.abs(a.clientY-t.initialTouchY);t.userIsDragging=l>5||r>5}},t.onTouchEnd=function(e){t.userIsDragging||(t.controlRef&&!t.controlRef.contains(e.target)&&t.menuListRef&&!t.menuListRef.contains(e.target)&&t.blurInput(),t.initialTouchX=0,t.initialTouchY=0)},t.onControlTouchEnd=function(e){t.userIsDragging||t.onControlMouseDown(e)},t.onClearIndicatorTouchEnd=function(e){t.userIsDragging||t.onClearIndicatorMouseDown(e)},t.onDropdownIndicatorTouchEnd=function(e){t.userIsDragging||t.onDropdownIndicatorMouseDown(e)},t.handleInputChange=function(e){var n=t.props.inputValue,a=e.currentTarget.value;t.setState({inputIsHiddenAfterUpdate:!1}),t.onInputChange(a,{action:"input-change",prevInputValue:n}),t.props.menuIsOpen||t.onMenuOpen()},t.onInputFocus=function(e){t.props.onFocus&&t.props.onFocus(e),t.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(t.openAfterFocus||t.props.openMenuOnFocus)&&t.openMenu("first"),t.openAfterFocus=!1},t.onInputBlur=function(e){var n=t.props.inputValue;t.menuListRef&&t.menuListRef.contains(document.activeElement)?t.inputRef.focus():(t.props.onBlur&&t.props.onBlur(e),t.onInputChange("",{action:"input-blur",prevInputValue:n}),t.onMenuClose(),t.setState({focusedValue:null,isFocused:!1}))},t.onOptionHover=function(e){if(!(t.blockOptionHover||t.state.focusedOption===e)){var n=t.getFocusableOptions().indexOf(e);t.setState({focusedOption:e,focusedOptionId:n>-1?t.getFocusedOptionId(e):null})}},t.shouldHideSelectedOptions=function(){return sj(t.props)},t.onValueInputFocus=function(e){e.preventDefault(),e.stopPropagation(),t.focus()},t.onKeyDown=function(e){var n=t.props,a=n.isMulti,l=n.backspaceRemovesValue,r=n.escapeClearsValue,i=n.inputValue,o=n.isClearable,s=n.isDisabled,c=n.menuIsOpen,d=n.onKeyDown,u=n.tabSelectsValue,p=n.openMenuOnFocus,h=t.state,f=h.focusedOption,m=h.focusedValue,g=h.selectValue;if(!s&&!("function"==typeof d&&(d(e),e.defaultPrevented))){switch(t.blockOptionHover=!0,e.key){case"ArrowLeft":if(!a||i)return;t.focusValue("previous");break;case"ArrowRight":if(!a||i)return;t.focusValue("next");break;case"Delete":case"Backspace":if(i)return;if(m)t.removeValue(m);else{if(!l)return;a?t.popValue():o&&t.clearValue()}break;case"Tab":if(t.isComposing||e.shiftKey||!c||!u||!f||p&&t.isOptionSelected(f,g))return;t.selectOption(f);break;case"Enter":if(229===e.keyCode)break;if(c){if(!f||t.isComposing)return;t.selectOption(f);break}return;case"Escape":c?(t.setState({inputIsHiddenAfterUpdate:!1}),t.onInputChange("",{action:"menu-close",prevInputValue:i}),t.onMenuClose()):o&&r&&t.clearValue();break;case" ":if(i)return;if(!c){t.openMenu("first");break}if(!f)return;t.selectOption(f);break;case"ArrowUp":c?t.focusOption("up"):t.openMenu("last");break;case"ArrowDown":c?t.focusOption("down"):t.openMenu("first");break;case"PageUp":if(!c)return;t.focusOption("pageup");break;case"PageDown":if(!c)return;t.focusOption("pagedown");break;case"Home":if(!c)return;t.focusOption("first");break;case"End":if(!c)return;t.focusOption("last");break;default:return}e.preventDefault()}},t.state.instancePrefix="react-select-"+(t.props.instanceId||++sC),t.state.selectValue=i5(e.value),e.menuIsOpen&&t.state.selectValue.length){var n=t.getFocusableOptionsWithIds(),a=t.buildFocusableOptions(),i=a.indexOf(t.state.selectValue[0]);t.state.focusableOptionsWithIds=n,t.state.focusedOption=a[i],t.state.focusedOptionId=sg(n,a[i])}return t}return n=[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&on(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.isDisabled,a=t.menuIsOpen,l=this.state.isFocused;(l&&!n&&e.isDisabled||l&&a&&!e.menuIsOpen)&&this.focusInput(),l&&n&&!e.isDisabled?this.setState({isFocused:!1},this.onMenuClose):l||n||!e.isDisabled||this.inputRef!==document.activeElement||this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(on(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(e,t){this.props.onInputChange(e,t)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(e){var t=this,n=this.state,a=n.selectValue,l=n.isFocused,r=this.buildFocusableOptions(),i="first"===e?0:r.length-1;if(!this.props.isMulti){var o=r.indexOf(a[0]);o>-1&&(i=o)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:r[i],focusedOptionId:this.getFocusedOptionId(r[i])},function(){return t.onMenuOpen()})}},{key:"focusValue",value:function(e){var t=this.state,n=t.selectValue,a=t.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=n.indexOf(a);a||(l=-1);var r=n.length-1,i=-1;if(n.length){switch(e){case"previous":i=0===l?0:-1===l?r:l-1;break;case"next":l>-1&&l<r&&(i=l+1)}this.setState({inputIsHidden:-1!==i,focusedValue:n[i]})}}}},{key:"focusOption",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"first",t=this.props.pageSize,n=this.state.focusedOption,a=this.getFocusableOptions();if(a.length){var l=0,r=a.indexOf(n);n||(r=-1),"up"===e?l=r>0?r-1:a.length-1:"down"===e?l=(r+1)%a.length:"pageup"===e?(l=r-t)<0&&(l=0):"pagedown"===e?(l=r+t)>a.length-1&&(l=a.length-1):"last"===e&&(l=a.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:a[l],focusedValue:null,focusedOptionId:this.getFocusedOptionId(a[l])})}}},{key:"getTheme",value:function(){return this.props.theme?"function"==typeof this.props.theme?this.props.theme(sc):rB(rB({},sc),this.props.theme):sc}},{key:"getCommonProps",value:function(){var e=this.clearValue,t=this.cx,n=this.getStyles,a=this.getClassNames,l=this.getValue,r=this.selectOption,i=this.setValue,o=this.props,s=o.isMulti,c=o.isRtl,d=o.options;return{clearValue:e,cx:t,getStyles:n,getClassNames:a,getValue:l,hasValue:this.hasValue(),isMulti:s,isRtl:c,options:d,selectOption:r,selectProps:o,setValue:i,theme:this.getTheme()}}},{key:"hasValue",value:function(){return this.state.selectValue.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var e=this.props,t=e.isClearable,n=e.isMulti;return void 0===t?n:t}},{key:"isOptionDisabled",value:function(e,t){return sy(this.props,e,t)}},{key:"isOptionSelected",value:function(e,t){return sx(this.props,e,t)}},{key:"filterOption",value:function(e,t){return sw(this.props,e,t)}},{key:"formatOptionLabel",value:function(e,t){if("function"!=typeof this.props.formatOptionLabel)return this.getOptionLabel(e);var n=this.props.inputValue,a=this.state.selectValue;return this.props.formatOptionLabel(e,{context:t,inputValue:n,selectValue:a})}},{key:"formatGroupLabel",value:function(e){return this.props.formatGroupLabel(e)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var e=this.props,t=e.isDisabled,n=e.isSearchable,a=e.inputId,l=e.inputValue,r=e.tabIndex,i=e.form,s=e.menuIsOpen,c=e.required,d=this.getComponents().Input,u=this.state,p=u.inputIsHidden,h=u.ariaSelection,f=this.commonProps,m=a||this.getElementId("input"),g=rB(rB(rB({"aria-autocomplete":"list","aria-expanded":s,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":c,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},s&&{"aria-controls":this.getElementId("listbox")}),!n&&{"aria-readonly":!0}),this.hasValue()?h?.action==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return n?o.createElement(d,nu({},f,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:m,innerRef:this.getInputRef,isDisabled:t,isHidden:p,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:r,form:i,type:"text",value:l},g)):o.createElement(oJ,nu({id:m,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:i2,onFocus:this.onInputFocus,disabled:t,tabIndex:r,inputMode:"none",form:i,value:""},g))}},{key:"renderPlaceholderOrValue",value:function(){var e=this,t=this.getComponents(),n=t.MultiValue,a=t.MultiValueContainer,l=t.MultiValueLabel,r=t.MultiValueRemove,i=t.SingleValue,s=t.Placeholder,c=this.commonProps,d=this.props,u=d.controlShouldRenderValue,p=d.isDisabled,h=d.isMulti,f=d.inputValue,m=d.placeholder,g=this.state,b=g.selectValue,v=g.focusedValue,y=g.isFocused;if(!this.hasValue()||!u)return f?null:o.createElement(s,nu({},c,{key:"placeholder",isDisabled:p,isFocused:y,innerProps:{id:this.getElementId("placeholder")}}),m);if(h)return b.map(function(t,i){var s=t===v,d="".concat(e.getOptionLabel(t),"-").concat(e.getOptionValue(t));return o.createElement(n,nu({},c,{components:{Container:a,Label:l,Remove:r},isFocused:s,isDisabled:p,key:d,index:i,removeProps:{onClick:function(){return e.removeValue(t)},onTouchEnd:function(){return e.removeValue(t)},onMouseDown:function(e){e.preventDefault()}},data:t}),e.formatOptionLabel(t,"value"))});if(f)return null;var x=b[0];return o.createElement(i,nu({},c,{data:x,isDisabled:p}),this.formatOptionLabel(x,"value"))}},{key:"renderClearIndicator",value:function(){var e=this.getComponents().
41ClearIndicator,t=this.commonProps,n=this.props,a=n.isDisabled,l=n.isLoading,r=this.state.isFocused;if(!this.isClearable()||!e||a||!this.hasValue()||l)return null;var i={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return o.createElement(e,nu({},t,{innerProps:i,isFocused:r}))}},{key:"renderLoadingIndicator",value:function(){var e=this.getComponents().LoadingIndicator,t=this.commonProps,n=this.props,a=n.isDisabled,l=n.isLoading,r=this.state.isFocused;return e&&l?o.createElement(e,nu({},t,{innerProps:{"aria-hidden":"true"},isDisabled:a,isFocused:r})):null}},{key:"renderIndicatorSeparator",value:function(){var e=this.getComponents(),t=e.DropdownIndicator,n=e.IndicatorSeparator;if(!t||!n)return null;var a=this.commonProps,l=this.props.isDisabled,r=this.state.isFocused;return o.createElement(n,nu({},a,{isDisabled:l,isFocused:r}))}},{key:"renderDropdownIndicator",value:function(){var e=this.getComponents().DropdownIndicator;if(!e)return null;var t=this.commonProps,n=this.props.isDisabled,a=this.state.isFocused,l={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return o.createElement(e,nu({},t,{innerProps:l,isDisabled:n,isFocused:a}))}},{key:"renderMenu",value:function(){var e=this,t=this.getComponents(),n=t.Group,a=t.GroupHeading,l=t.Menu,r=t.MenuList,i=t.MenuPortal,s=t.LoadingMessage,c=t.NoOptionsMessage,d=t.Option,u=this.commonProps,p=this.state.focusedOption,h=this.props,f=h.captureMenuScroll,m=h.inputValue,g=h.isLoading,b=h.loadingMessage,v=h.minMenuHeight,y=h.maxMenuHeight,x=h.menuIsOpen,w=h.menuPlacement,j=h.menuPosition,C=h.menuPortalTarget,S=h.menuShouldBlockScroll,k=h.menuShouldScrollIntoView,_=h.noOptionsMessage,$=h.onMenuScrollToTop,N=h.onMenuScrollToBottom;if(!x)return null;var P,E=function(t,n){var a=t.type,l=t.data,r=t.isDisabled,i=t.isSelected,s=t.label,c=t.value,h=p===l,f=r?void 0:function(){return e.onOptionHover(l)},m=r?void 0:function(){return e.selectOption(l)},g="".concat(e.getElementId("option"),"-").concat(n),b={id:g,onClick:m,onMouseMove:f,onMouseOver:f,tabIndex:-1,role:"option","aria-selected":e.isAppleDevice?void 0:i};return o.createElement(d,nu({},u,{innerProps:b,data:l,isDisabled:r,isSelected:i,key:g,label:s,type:a,value:c,isFocused:h,innerRef:h?e.getFocusedOptionRef:void 0}),e.formatOptionLabel(t.data,"menu"))};if(this.hasOptions())P=this.getCategorizedOptions().map(function(t){if("group"===t.type){var l=t.data,r=t.options,i=t.index,s="".concat(e.getElementId("group"),"-").concat(i),c="".concat(s,"-heading");return o.createElement(n,nu({},u,{key:s,data:l,options:r,Heading:a,headingProps:{id:c,data:t.data},label:e.formatGroupLabel(t.data)}),t.options.map(function(e){return E(e,"".concat(i,"-").concat(e.index))}))}if("option"===t.type)return E(t,"".concat(t.index))});else if(g){var D=b({inputValue:m});if(null===D)return null;P=o.createElement(s,u,D)}else{var T=_({inputValue:m});if(null===T)return null;P=o.createElement(c,u,T)}var A={minMenuHeight:v,maxMenuHeight:y,menuPlacement:w,menuPosition:j,menuShouldScrollIntoView:k},R=o.createElement(ob,nu({},u,A),function(t){var n=t.ref,a=t.placerProps,i=a.placement,s=a.maxHeight;return o.createElement(l,nu({},u,A,{innerRef:n,innerProps:{onMouseDown:e.onMenuMouseDown,onMouseMove:e.onMenuMouseMove},isLoading:g,placement:i}),o.createElement(sn,{captureEnabled:f,onTopArrive:$,onBottomArrive:N,lockEnabled:S},function(t){return o.createElement(r,nu({},u,{innerRef:function(n){e.getMenuListRef(n),t(n)},innerProps:{role:"listbox","aria-multiselectable":u.isMulti,id:e.getElementId("listbox")},isLoading:g,maxHeight:s,focusedOption:p}),P)}))});return C||"fixed"===j?o.createElement(i,nu({},u,{appendTo:C,controlElement:this.controlRef,menuPlacement:w,menuPosition:j}),R):R}},{key:"renderFormField",value:function(){var e=this,t=this.props,n=t.delimiter,a=t.isDisabled,l=t.isMulti,r=t.name,i=t.required,s=this.state.selectValue;if(i&&!this.hasValue()&&!a)return o.createElement(sl,{name:r,onFocus:this.onValueInputFocus});if(!(!r||a))if(l)if(n){var c=s.map(function(t){return e.getOptionValue(t)}).join(n);return o.createElement("input",{name:r,type:"hidden",value:c})}else{var d=s.length>0?s.map(function(t,n){return o.createElement("input",{key:"i-".concat(n),name:r,type:"hidden",value:e.getOptionValue(t)})}):o.createElement("input",{name:r,type:"hidden",value:""});return o.createElement("div",null,d)}else{var u=s[0]?this.getOptionValue(s[0]):"";return o.createElement("input",{name:r,type:"hidden",value:u})}}},{key:"renderLiveRegion",value:function(){var e=this.commonProps,t=this.state,n=t.ariaSelection,a=t.focusedOption,l=t.focusedValue,r=t.isFocused,i=t.selectValue,s=this.getFocusableOptions();return o.createElement(oI,nu({},e,{id:this.getElementId("live-region"),ariaSelection:n,focusedOption:a,focusedValue:l,isFocused:r,selectValue:i,focusableOptions:s,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var e=this.getComponents(),t=e.Control,n=e.IndicatorsContainer,a=e.SelectContainer,l=e.ValueContainer,r=this.props,i=r.className,s=r.id,c=r.isDisabled,d=r.menuIsOpen,u=this.state.isFocused,p=this.commonProps=this.getCommonProps();return o.createElement(a,nu({},p,{className:i,innerProps:{id:s,onKeyDown:this.onKeyDown},isDisabled:c,isFocused:u}),this.renderLiveRegion(),o.createElement(t,nu({},p,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:c,isFocused:u,menuIsOpen:d}),o.createElement(l,nu({},p,{isDisabled:c}),this.renderPlaceholderOrValue(),this.renderInput()),o.createElement(n,nu({},p,{isDisabled:c}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],a=[{key:"getDerivedStateFromProps",value:function(e,t){var n,a=t.prevProps,l=t.clearFocusValueOnUpdate,r=t.inputIsHiddenAfterUpdate,i=t.ariaSelection,o=t.isFocused,s=t.prevWasFocused,c=t.instancePrefix,d=e.options,u=e.value,p=e.menuIsOpen,h=e.inputValue,f=e.isMulti,m=i5(u),g={};
41if(a&&(u!==a.value||d!==a.options||p!==a.menuIsOpen||h!==a.inputValue)){var b,v=p?sh(sp(e,m)):[],y=p?sf(sp(e,m),"".concat(c,"-option")):[],x=l?function(e,t){var n=e.focusedValue,a=e.selectValue.indexOf(n);if(a>-1){if(t.indexOf(n)>-1)return n;if(a<t.length)return t[a]}return null}(t,m):null,w=(b=t.focusedOption)&&v.indexOf(b)>-1?b:v[0],j=sg(y,w);g={selectValue:m,focusedOption:w,focusedOptionId:j,focusableOptionsWithIds:y,focusedValue:x,clearFocusValueOnUpdate:!1}}var C=null!=r&&e!==a?{inputIsHidden:r,inputIsHiddenAfterUpdate:void 0}:{},S=i,k=o&&s;return o&&!k&&(S={value:(n=m[0]||null,f?m:n),options:m,action:"initial-input-focus"},k=!s),i?.action==="initial-input-focus"&&(S=null),rB(rB(rB({},g),C),{},{prevProps:e,ariaSelection:S,prevWasFocused:k})}}],n&&rK(r.prototype,n),a&&rK(r,a),Object.defineProperty(r,"prototype",{writable:!1}),r}(o.Component);sS.defaultProps=sd;var sk=(0,o.forwardRef)(function(e,t){var n=rW(e);return o.createElement(sS,nu({ref:t},n))}),s_=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],s$=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,a=String(e).toLowerCase(),l=String(n.getOptionValue(t)).toLowerCase(),r=String(n.getOptionLabel(t)).toLowerCase();return l===a||r===a},sN=function(e){return'Create "'.concat(e,'"')},sP=function(e,t,n,a){return!(!e||t.some(function(t){return s$(e,t,a)})||n.some(function(t){return s$(e,t,a)}))},sE=function(e,t){return{label:t,value:e,__isNew__:!0}},sD=(0,o.forwardRef)(function(e,t){var n,a,l,r,i,s,c,d,u,p,h,f,m,g,b,v,y,x,w,j,C,S,k,_,$,N,P,E,D=(l=void 0!==(a=(n=rW(e)).allowCreateWhileLoading)&&a,i=void 0===(r=n.createOptionPosition)?"last":r,c=void 0===(s=n.formatCreateLabel)?sN:s,u=void 0===(d=n.isValidNewOption)?sP:d,h=void 0===(p=n.getNewOptionData)?sE:p,f=n.onCreateOption,g=void 0===(m=n.options)?[]:m,b=n.onChange,x=void 0===(y=(v=rH(n,s_)).getOptionValue)?so:y,j=void 0===(w=v.getOptionLabel)?si:w,C=v.inputValue,S=v.isLoading,k=v.isMulti,_=v.value,$=v.name,N=(0,o.useMemo)(function(){return u(C,i5(_),g,{getOptionValue:x,getOptionLabel:j})?h(C,c(C)):void 0},[c,h,j,x,C,u,g,_]),P=(0,o.useMemo)(function(){return(l||!S)&&N?"first"===i?[N].concat(rG(g)):[].concat(rG(g),[N]):g},[l,i,S,N,g]),E=(0,o.useCallback)(function(e,t){if("select-option"!==t.action)return b(e,t);var n=Array.isArray(e)?e:[e];if(n[n.length-1]===N){if(f)f(C);else{var a,l=h(C,C);b((a=[].concat(rG(i5(_)),[l]),k?a:l),{action:"create-option",name:$,option:l})}return}b(e,t)},[h,C,k,$,N,f,b,_]),rB(rB({},v),{},{options:P,onChange:E}));return o.createElement(sS,nu({ref:t},D))}),sT="clear-indicator",sA=e=>{let{clearValue:t,innerProps:{ref:n,...a}}=e;return(0,p.jsx)("div",{className:sT,ref:"string"==typeof n?null:n,...a,onKeyDown:e=>{"Enter"===e.key&&(t(),e.stopPropagation())},role:"button",tabIndex:0,children:(0,p.jsx)(d.a,{className:`${sT}__icon`})})},sR=e=>{let{children:t,innerProps:n,selectProps:{customProps:{disableKeyDown:a,disableMouseDown:l}={}}={}}=e;return(0,p.jsx)(o.Fragment,{children:(0,p.jsx)(oA.Control,{...e,innerProps:{...n,onKeyDown:e=>{if(a){e.stopPropagation();let t=new CustomEvent("bypassKeyDown",{detail:e});document.dispatchEvent(t)}},onMouseDown:e=>{l||n.onMouseDown(e)}},children:t})})},sL="dropdown-indicator",sF=e=>{let{innerProps:{ref:t,...n}}=e;return(0,p.jsx)("button",{className:sL,ref:t,...n,onKeyDown:e=>{"Enter"===e.key&&(e.key=" ")},type:"button",children:(0,p.jsx)(to,{className:`${sL}__icon`})})},sO=e=>(0,p.jsx)(o.Fragment,{children:(0,p.jsx)(oA.Input,{...e,"aria-activedescendant":void 0})}),sM="multi-value";function sI(e,t){return"function"==typeof t?t(e):e?.value}var sB=e=>{let t=(0,g.c)(24),{className:n,data:a,innerProps:l,isDisabled:r,selectProps:i}=e,s;t[0]!==i?(s=void 0===i?{}:i,t[0]=i,t[1]=s):s=t[1];let{customProps:c,getOptionValue:d,isSortable:u}=s,h;t[2]!==c?(h=void 0===c?{}:c,t[2]=c,t[3]=h):h=t[3];let{disableMouseDown:f}=h,m;t[4]!==a||t[5]!==d?(m=sI(a,d),t[4]=a,t[5]=d,t[6]=m):m=t[6];let b=m,v=!u,y;t[7]!==b||t[8]!==v?(y={id:b,disabled:v},t[7]=b,t[8]=v,t[9]=y):y=t[9];let{attributes:x,isDragging:w,listeners:j,setNodeRef:C,transform:S}=t9(y),k=!r&&u&&"draggable",_=w&&`${sM}--is-dragging`,$;
41t[10]!==n||t[11]!==k||t[12]!==_?($=[sM,n,k,_].filter(Boolean),t[10]=n,t[11]=k,t[12]=_,t[13]=$):$=t[13];let N=$.join(" "),P;if(t[14]!==x||t[15]!==N||t[16]!==f||t[17]!==l||t[18]!==u||t[19]!==j||t[20]!==e||t[21]!==C||t[22]!==S){let{onMouseDown:n,...a}=j||{};P=(0,p.jsx)(o.Fragment,{children:(0,p.jsx)(oA.MultiValue,{...e,className:N,innerProps:{...u?{...x,...a}:{},...l,onMouseDown:e=>{u&&n&&n(e),f||e.stopPropagation()},ref:C,style:u?{transform:S,...x?.style}:{}}})}),t[14]=x,t[15]=N,t[16]=f,t[17]=l,t[18]=u,t[19]=j,t[20]=e,t[21]=C,t[22]=S,t[23]=P}else P=t[23];return P},sz="multi-value-label",sU=e=>{let{data:t,selectProps:n}=e,{customProps:a}=void 0===n?{}:n,{draggableProps:l,editableProps:r}=void 0===a?{}:a,{i18n:i}=(0,d.d)(),o=`${sz}__text`,s=t.label?(0,h.s)(t.label,i):"";return(0,p.jsx)("div",{className:sz,title:"string"==typeof s?s:"",children:(0,p.jsx)(oA.MultiValueLabel,{...e,innerProps:{className:o,...r&&r(t,o,e.selectProps)||{},...l||{}}})})},sV="multi-value-remove",sH=e=>{let t=(0,g.c)(12),{innerProps:n}=e,{className:a,onClick:l,onTouchEnd:r}=n,[i,s]=o.useState(!1),{t:c}=(0,d.d)(),u;if(t[0]!==a||t[1]!==l||t[2]!==r||t[3]!==i||t[4]!==c){let e,n,o,h=c("general:remove"),f;t[6]!==a?(f=[sV,a].filter(Boolean),t[6]=a,t[7]=f):f=t[7],t[8]!==l?(e=e=>{s(!1),l(e)},t[8]=l,t[9]=e):e=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(n=()=>s(!0),o=()=>s(!1),t[10]=n,t[11]=o):(n=t[10],o=t[11]),u=(0,p.jsxs)("button",{"aria-label":h,className:f.join(" "),onClick:e,onKeyDown:sq,onMouseDown:sW,onMouseEnter:n,onMouseLeave:o,onTouchEnd:r,type:"button",children:[(0,p.jsx)(tk,{className:`${sV}__tooltip`,show:i,children:c("general:remove")}),(0,p.jsx)(d.a,{className:`${sV}__icon`})]}),t[0]=a,t[1]=l,t[2]=r,t[3]=i,t[4]=c,t[5]=u}else u=t[5];return u};function sq(e){"Enter"===e.key&&e.stopPropagation()}function sW(e){return e.stopPropagation()}var sK=e=>{let{children:t,className:n}=e;return(0,p.jsx)(o.Fragment,{children:(0,p.jsx)(oA.SingleValue,{...e,className:["react-select--single-value",n].filter(Boolean).join(" "),children:t})})},sQ="value-container",sY=e=>{let{selectProps:t}=e,{customProps:n,value:a}=void 0===t?{}:t,{i18n:l}=(0,d.d)(),r="";if(a&&!Array.isArray(a)&&"object"==typeof a&&"label"in a){let e=a.label?(0,h.s)(a.label,l):"";r="string"==typeof e?e:""}return(0,p.jsxs)("div",{className:sQ,ref:n?.droppableRef,title:r,children:[n?.valueContainerLabel&&(0,p.jsx)("span",{className:`${sQ}__label`,children:n?.valueContainerLabel}),(0,p.jsx)(oA.ValueContainer,{...e})]})},sG=e=>{let{i18n:t,t:n}=(0,d.d)(),[a,l]=o.useState(""),r=(0,o.useId)(),[i,s]=o.useState(!1);(0,o.useEffect)(()=>{s(!0)},[]);let{className:u,components:f,customProps:m,disabled:g=!1,filterOption:b,getOptionValue:v,isClearable:y=!0,isCreatable:x,isLoading:w,isSearchable:j=!0,noOptionsMessage:C=()=>n("general:noOptions"),numberOnly:S=!1,onChange:k,onMenuClose:_,onMenuOpen:$,options:N,placeholder:P=n("general:selectValue"),showError:E,value:D}=e,T=()=>n("general:loading")+"...",A=[u,"react-select",E&&"react-select--error"].filter(Boolean).join(" "),R={menu:e=>({...e,zIndex:void 0})};return i?x?(0,p.jsx)(sD,{captureMenuScroll:!0,isLoading:w,...e,className:A,classNamePrefix:"rs",components:{ClearIndicator:sA,Control:sR,DropdownIndicator:sF,Input:sO,MultiValue:sB,MultiValueLabel:sU,MultiValueRemove:sH,SingleValue:sK,ValueContainer:sY,...f},filterOption:b,inputValue:a,instanceId:r,isClearable:y,isDisabled:g,isSearchable:j,loadingMessage:T,menuPlacement:"auto",noOptionsMessage:C,onChange:k,onInputChange:e=>l(e),onKeyDown:e=>{if(!0===S){let t=!/\D/.test(e.key),n=["Tab","Escape","Backspace","Enter","ArrowRight","ArrowLeft","ArrowUp","ArrowDown"].includes(e.key);if(!t&&!n)return void e.preventDefault()}if(!(!D||!a||""===a.trim())&&!(b&&!b(null,a))&&!e.nativeEvent.isComposing)switch(e.key){case"Enter":case"Tab":k([...D,{label:a,value:a}]),l(""),e.preventDefault()}},onMenuClose:_,onMenuOpen:$,options:N,placeholder:(0,h.s)(P,t),styles:R,unstyled:!0,value:D}):(0,p.jsx)(sk,{captureMenuScroll:!0,customProps:m,isLoading:w,...e,className:A,classNamePrefix:"rs",components:{ClearIndicator:sA,Control:sR,DropdownIndicator:sF,Input:sO,MultiValue:sB,MultiValueLabel:sU,MultiValueRemove:sH,SingleValue:sK,ValueContainer:sY,...f},filterOption:b,getOptionValue:v,instanceId:r,isClearable:y,isDisabled:g,isSearchable:j,loadingMessage:T,menuPlacement:"auto",noOptionsMessage:C,onChange:k,onMenuClose:_,onMenuOpen:$,options:N,placeholder:(0,h.s)(P,t),styles:R,unstyled:!0,value:D}):(0,p.jsx)(c.f,{height:"calc(var(--base) * 2 + 2px)"})},sX=e=>{let{getOptionValue:t,onChange:n,value:a}=e,l=[];return a&&(l=(Array.isArray(a)?a:[a]).map(e=>sI(e,t))),(0,p.jsx)(nt,{className:"react-select-container",ids:l,onDragEnd:({moveFromIndex:e,moveToIndex:t})=>{let l=a;a&&Array.isArray(a)&&(l=tK(a,e,t)),n(l)},children:(0,p.jsx)(sG,{...e})})},sZ=e=>{let{isMulti:t,isSortable:n}=e;return t&&n?(0,p.jsx)(sX,{...e}):(0,p.jsx)(sG,{...e})},sJ=e=>e.map(e=>"object"==typeof e&&(e.value||""===e.value)?e:{label:e,value:e}),s0=e=>{let{id:t,onChange:n,options:a,readOnly:l,required:r,selectedTimezone:i}=e,{t:s}=(0,d.d)(),c=sJ(a),u=(0,o.useMemo)(()=>c.find(e=>("string"==typeof e?e:e.value)===i),[c,i]),h=!!l||1===c.length;return(0,p.jsxs)("div",{className:"timezone-picker-wrapper",children:[(0,p.jsx)(aD,{htmlFor:t,label:`${s("general:timezone")} ${r?"*":""}`,required:r,unstyled:!0}),(0,p.jsx)(sZ,{className:"timezone-picker",disabled:h,inputId:t,isClearable:!r,isCreatable:!1,onChange:e=>{n&&n(e?.value||"")},options:c,value:u})]})},s1="date-time-field",s3=lU(e=>{let{field:t,field:{admin:{className:n,date:a,description:l,placeholder:r}={},label:i,localized:s,required:u,timezone:f},path:m,readOnly:g,validate:b}=e,v=a?.pickerAppearance||"default",y=Intl.DateTimeFormat().resolvedOptions().timeZone,{config:x}=(0,c.c)(),{i18n:w}=(0,d.d)(),{dispatchFields:j,setModified:C}=eT(),{customComponents:{AfterInput:S,BeforeInput:k,Description:_,Error:$,Label:N}={},disabled:P,path:E,setValue:D,showError:T,value:A}=lI({potentiallyStalePath:m,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof b)return b(e,{...t,required:u})},[b,u])}),R=E+"_tz",L=eB(([e,t])=>e?.[R]),F=(0,o.useMemo)(()=>f&&"object"==typeof f&&f.supportedTimezones?f.supportedTimezones:x.admin.timezones.supportedTimezones,[x.admin.timezones.supportedTimezones,f]),O=["dayOnly","default","monthOnly"].includes(v),M=L?.value,I=u||f&&"object"==typeof f&&f.required,B=(0,o.useMemo)(()=>
41{if(f&&M&&y&&A){let e=aB.tz(M),t=aB.tz(y),n=lp(new aB(A).withTimeZone(M),e);return lp(n,t).toISOString()}return A},[f,M,A,y]),z=(0,o.useMemo)(()=>lV(t),[t]),U=(0,o.useCallback)(e=>{if(!(g||P))if(f&&M&&e){let t=aB.tz(M);if(O){let n=e.getTimezoneOffset()/60,a=e.getHours()+n;e.setHours(a),D(lp(e,t).toISOString()||null)}else D(lp(new aB(e),t).toISOString()||null)}else D(e?.toISOString()||null)},[g,P,f,M,O,D]),V=(0,o.useCallback)(e=>{R&&(j({type:"UPDATE",path:R,value:e}),C(!0))},[j,C,R]);return(0,p.jsxs)("div",{className:[lH,s1,n,T&&`${s1}--has-error`,(g||P)&&"read-only"].filter(Boolean).join(" "),style:z,children:[(0,p.jsx)(em,{CustomComponent:N,Fallback:(0,p.jsx)(aD,{label:i,localized:s,path:E,required:u})}),(0,p.jsxs)("div",{className:`${lH}__wrap`,id:`field-${E.replace(/\./g,"__")}`,children:[(0,p.jsx)(em,{CustomComponent:$,Fallback:(0,p.jsx)(ni,{path:E,showError:T})}),k,(0,p.jsx)(rL,{...a,onChange:U,overrides:{...a?.overrides},placeholder:(0,h.s)(r,w),readOnly:g||P,value:B}),f&&F.length>0&&(0,p.jsx)(s0,{id:`${E}-timezone-picker`,onChange:V,options:F,readOnly:g||P,required:I,selectedTimezone:M}),S]}),(0,p.jsx)(em,{CustomComponent:_,Fallback:(0,p.jsx)(nr,{description:l,path:E})})]})}),s2=lU(e=>{let{field:t,field:{admin:{autoComplete:n,className:a,description:l,placeholder:r}={},label:i,localized:s,required:c}={},path:u,readOnly:f,validate:m}=e,{i18n:g}=(0,d.d)(),{customComponents:{AfterInput:b,BeforeInput:v,Description:y,Error:x,Label:w}={},disabled:j,path:C,setValue:S,showError:k,value:_}=lI({potentiallyStalePath:u,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof m)return m(e,{...t,required:c})},[m,c])}),$=(0,o.useMemo)(()=>lV(t),[t]);return(0,p.jsxs)("div",{className:[lH,"email",a,k&&"error",(f||j)&&"read-only"].filter(
41Boolean).join(" "),style:$,children:[(0,p.jsx)(em,{CustomComponent:w,Fallback:(0,p.jsx)(aD,{label:i,localized:s,path:C,required:c})}),(0,p.jsxs)("div",{className:`${lH}__wrap`,children:[(0,p.jsx)(em,{CustomComponent:x,Fallback:(0,p.jsx)(ni,{path:C,showError:k})}),v,(0,p.jsx)("input",{autoComplete:n,disabled:f||j,id:`field-${C.replace(/\./g,"__")}`,name:C,onChange:S,placeholder:(0,h.s)(r,g),required:c,type:"email",value:_||""}),b]}),(0,p.jsx)(em,{CustomComponent:y,Fallback:(0,p.jsx)(nr,{description:l,path:C})})]})}),s6=(0,o.createContext)(!1),s5=({children:e,withinRow:t=!0})=>(0,p.jsx)(s6,{value:t,children:e}),s4=(0,o.createContext)(!1),s8=({children:e,withinTab:t=!0})=>(0,p.jsx)(s4,{value:t,children:e}),s7=(0,o.createContext)(!1),s9=({children:e,withinGroup:t=!0})=>(0,p.jsx)(s7,{value:t,children:e}),ce="group-field",ct=lU(e=>{let{field:t,field:{admin:{className:n,description:a,hideGutter:l}={},fields:r,label:i},indexPath:s,parentPath:c,parentSchemaPath:u,path:f,permissions:m,readOnly:g,schemaPath:v}=e,y=v??("group"===t.type&&(0,b.jY)(t)?t.name:f),{i18n:x}=(0,d.d)(),{isWithinCollapsible:w}=l4(),j=(0,o.use)(s7),C=(0,o.use)(s6),S=(0,o.use)(s4),{customComponents:{AfterInput:k,BeforeInput:_,Description:$,Label:N}={},errorPaths:P}=lI({path:f}),E=eL(),D=P.length,T=E&&D>0,A=!(w||j||C),R=(0,o.useMemo)(()=>lV(t),[t]);return(0,p.jsxs)("div",{className:[lH,ce,A&&`${ce}--top-level`,w&&`${ce}--within-collapsible`,j&&`${ce}--within-group`,C&&`${ce}--within-row`,S&&`${ce}--within-tab`,!l&&j&&`${ce}--gutter`,T&&`${ce}--has-error`,n].filter(Boolean).join(" "),id:`field-${f?.replace(/\./g,"__")}`,style:R,children:[(0,p.jsx)(s9,{children:(0,p.jsxs)("div",{className:`${ce}__wrap`,children:[!!(N||$||i||T)&&(0,p.jsxs)("div",{className:`${ce}__header`,children:[!!(N||$||i)&&(0,p.jsxs)("header",{children:[(0,p.jsx)(em,{CustomComponent:N,Fallback:(0,p.jsx)("h3",{className:`${ce}__title`,children:(0,p.jsx)(aD,{as:"span",label:(0,h.s)(i,x),localized:!1,path:f,required:!1})})}),(0,p.jsx)(em,{CustomComponent:$,Fallback:(0,p.jsx)(nr,{description:a,path:f})})]}),T&&(0,p.jsx)(na,{count:D,i18n:x,withMessage:!0})]}),_,(0,b.jY)(t)?(0,p.jsx)(hU,{fields:r,margins:"small",parentIndexPath:"",parentPath:f,parentSchemaPath:y,permissions:!0===m?m:m?.fields,readOnly:g}):(0,p.jsx)(hU,{fields:r,margins:"small",parentIndexPath:s,parentPath:c,parentSchemaPath:u,permissions:m,readOnly:g})]})}),k]})}),cn=lU(e=>{let t=(0,g.c)(13),{disableModifyingForm:n,path:a,value:l}=e,r=void 0===n||n,i;t[0]!==a?(i={potentiallyStalePath:a},t[0]=a,t[1]=i):i=t[1];let{formInitializing:s,path:c,setValue:d,value:u}=lI(i),h,f;t[2]!==r||t[3]!==s||t[4]!==d||t[5]!==l?(h=()=>{void 0===l||s||d(l,r)},f=[l,d,r,s],t[2]=r,t[3]=s,t[4]=d,t[5]=l,t[6]=h,t[7]=f):(h=t[6],f=t[7]),(0,o.useEffect)(h,f);let m=`field-${c?.replace(/\./g,"__")}`,b=u||"",v;return t[8]!==c||t[9]!==d||t[10]!==m||t[11]!==b?(v=(0,p.jsx)("input",{id:m,name:c,onChange:d,type:"hidden",value:b}),t[8]=c,t[9]=d,t[10]=m,t[11]=b,t[12]=v):v=t[12],v}),ca=(0,u.e)(ei(),1),cl=(0,o.createContext)({}),cr=({children:e,...t})=>(0,p.jsx)(cl,{value:{isInDrawer:!!t.drawerSlug,...t},children:e}),ci=()=>{let e=(0,o.use)(cl);if(!e)throw Error("useListDrawerContext must be used within a ListDrawerContextProvider");return e};function co(e){let t=e.toString();return N.q(t,{depth:10,ignoreQueryPrefix:!0})}var cs=(0,o.createContext)({}),cc=()=>(0,o.use)(cs),cd=(0,o.createContext)(!1),cu=e=>{let t={...e};return Object.entries(t).forEach(([e,n])=>{if("columns"===e&&("[]"===n||Array.isArray(t[e])&&0===t[e].length)&&delete t[e],"where"!==e||"object"!=typeof n||null===n||Object.keys(n).length||delete t[e],("limit"===e||"page"===e)&&"string"==typeof n){let a=parseInt(n,10);t[e]=Number.isNaN(a)?void 0:a}"page"===e&&0===n&&delete t[e],""===n&&delete t[e]}),t},cp=({children:e,collectionSlug:t,data:n,modifySearchParams:a,onQueryChange:l,orderableFieldName:r,query:i})=>{let s=(0,m.useRouter)(),d=(0,m.useSearchParams)(),{startRouteTransition:u}=te(),[h,f]=(0,o.useState)(!1),{getEntityConfig:g}=(0,c.c)(),b=g({collectionSlug:t}),v=(0,o.useRef)({});v.current.modified=h;let{onQueryChange:y}=ci(),w=y||l,j=(0,o.useMemo)(()=>cu(co(d)),[d]),[C,S]=(0,o.useState)(()=>a?j:{limit:i.limit,sort:i.sort}),k=(0,o.useCallback)(async(e,t)=>{var n;let l,r;f(t??!0);let o=(n={defaults:{limit:i.limit,sort:i.sort}},l="page"in e?e.page:C?.page,["where","search","groupBy"].some(t=>t in e&&!["limit","page"].includes(t))&&(l=1),["where","search","page","limit","groupBy","
41sort"].some(t=>t in e)||(r={...C?.queryByGroup||{},...e.queryByGroup?Object.fromEntries(Object.entries(e.queryByGroup).map(([e,t])=>[e,{...C?.queryByGroup?.[e]||{},...t}])):{}}),{...C,...e,columns:"columns"in e?e.columns:C.columns,groupBy:"groupBy"in e?e.groupBy:C?.groupBy??n?.defaults?.groupBy,limit:"limit"in e?e.limit:C?.limit??n?.defaults?.limit,page:l,preset:"preset"in e?e.preset:C?.preset,queryByGroup:r,search:"search"in e?e.search:C?.search,sort:"sort"in e?e.sort:C?.sort??n?.defaults?.sort,where:"where"in e?e.where:C?.where});if(a){let e=`?${x.A({...o,columns:JSON.stringify(o.columns),queryByGroup:JSON.stringify(o.queryByGroup)})}`;window.location.search!==e&&u(()=>s.replace(e))}else"function"==typeof w&&w(o);S(o)},[C,i.limit,i.sort,a,w,u,s]),_=(0,o.useCallback)(async e=>{await k({page:e})},[k]),$=o.useCallback(async e=>{await k({limit:e,page:1})},[k]),N=(0,o.useCallback)(async e=>{await k({search:""===e?void 0:e})},[k]),P=(0,o.useCallback)(async e=>{await k({sort:e})},[k]),E=(0,o.useCallback)(async e=>{await k({where:e})},[k]),D=tv(()=>{let e=cu({...C||{},...i||{}}),t=`?${x.A({...e,columns:JSON.stringify(e.columns),queryByGroup:JSON.stringify(e.queryByGroup)})}`;window.location.search!==t&&(S(e),window.history.replaceState(null,"",t))});return(0,o.useEffect)(()=>{a&&i&&D()},[a,i]),(0,p.jsx)(cs,{value:{collectionSlug:t,data:n,defaultLimit:n?.limit,handlePageChange:_,handlePerPageChange:$,handleSearchChange:N,handleSortChange:P,handleWhereChange:E,isGroupingBy:!!(b?.admin?.groupBy&&C?.groupBy),orderableFieldName:r,query:C,refineListData:k,setModified:f,...v.current},children:(0,p.jsx)(cd,{value:h,children:e})})},ch=(0,o.createContext)(void 0),cf=()=>{let e=o.use(ch);if(void 0===e)throw Error("useServerFunctions must be used within a ServerFunctionsProvider");return e},cm=({children:e,serverFunction:t})=>{if(!t)throw Error("ServerFunctionsProvider requires a serverFunction prop");let n=(0,o.useCallback)(async e=>await t({name:"render-document-slots",args:e}),[t]),a=(0,o.useCallback)(async e=>{let{signal:n,...a}=e;try{if(!n?.aborted){let e=await t({name:"schedule-publish",args:{...a}});if(!n?.aborted)return e}}catch(e){console.error(e)}let l=`Error scheduling ${a.type}`;return a.doc&&(l+=` for document with ID ${a.doc.value} in collection ${a.doc.relationTo}`),{error:l}},[t]),l=(0,o.useCallback)(async e=>{let{signal:n,...a}=e;if(n?.aborted)return[];let l=await t({name:"get-upcoming-scheduled-publish",args:a});return n?.aborted?[]:l},[t]),r=(0,o.useCallback)(async e=>{let{signal:n,...a}=e||{};try{if(!n?.aborted){let e=await t({name:"form-state",args:{fallbackLocale:!1,...a}});if(!n?.aborted)return e}}catch(e){console.error(e)}return{state:null}},[t]),i=(0,o.useCallback)(async e=>{let{signal:n,...a}=e||{};try{if(!n?.aborted){let e=await t({name:"table-state",args:{fallbackLocale:!1,...a}});if(!n?.aborted)return e}}catch(e){console.error(e)}},[t]),s=(0,o.useCallback)(async e=>{let{signal:n,...a}=e||{};try{return await t({name:"render-document",args:{fallbackLocale:!1,...a}})}catch(e){console.error(e)}},[t]),c=(0,o.useCallback)(async e=>{let{signal:n,...a}=e||{},l=await t({name:"copy-data-from-locale",args:a});if(!n?.aborted)return{data:l}},[t]),d=(0,o.useCallback)(async e=>{let{signal:n,...a}=e||{};try{let e=await t({name:"get-folder-results-component-and-data",args:a});if(!n?.aborted)return e}catch(e){console.error(e)}},[t]),u=(0,o.useCallback)(async e=>{try{return await t({name:"render-field",args:e})}catch(e){console.error(e)}},[t]),h=(0,o.useCallback)(async e=>{let{signal:n,...a}=e||{};try{return await t({name:"slugify",args:{...a}})}catch(e){console.error(e)}},[t]);return(0,p.jsx)(ch,{value:{_internal_renderField:u,copyDataFromLocale:c,getDocumentSlots:n,getFolderResultsComponentAndData:d,getFormState:r,getTableState:i,getUpcomingScheduledPublish:l,renderDocument:s,schedulePublish:a,serverFunction:t,slugify:h},children:e})},cg=(0,o.createContext)({}),cb=()=>(0,o.use)(cg),cv=({children:e,collectionSlug:t,columnState:n,LinkedCellOverride:a})=>{let{getEntityConfig:l}=(0,c.c)(),{query:r,refineListData:i}=cc(),{admin:{defaultColumns:s}={}}=l({collectionSlug:t}),[d,u]=o.useOptimistic(n,(e,t)=>t),h=(0,o.useRef)({}),f=(0,o.useCallback)(async e=>{let t=(d||[]).map(t=>t.accessor===e?{...t,active:!t.active}:t);(0,o.startTransition)(()=>{u(t)}),await i({columns:(0,$.F)(t)})},[i,d,u]),m=(0,o.useCallback)(async e=>{let{fromIndex:t,toIndex:n}=e,a=[...d||[]],[l]=a.splice(t,1);a.splice(n,0,l),(0,o.startTransition)(()=>{u(a)}),await i({columns:(0,$.F)(a)})},[d,i,u]),g=(0,o.useCallback)(async e=>{let t=r.columns;
41e.forEach(e=>{let n=t.findIndex(t=>e===t);void 0!==n&&"-"===t[n][0]&&(t[n]=e.slice(1))}),await i({columns:t})},[r,i]),b=o.useCallback(async()=>{await i({columns:s||[]})},[s,i]);return(0,p.jsx)(cg,{value:{columns:d,LinkedCellOverride:a,moveColumn:m,resetColumnsState:b,setActiveColumns:g,toggleColumn:f,...h.current},children:e})},cy="pill-selector",cx=({draggable:e,onClick:t,pills:n})=>{let a=o.useMemo(()=>n.map((n,a)=>(0,p.jsx)(ra,{alignIcon:"left","aria-checked":n.selected,className:[`${cy}__pill`,n.selected&&`${cy}__pill--selected`].filter(Boolean).join(" "),draggable:!!e,icon:n.selected?(0,p.jsx)(d.a,{}):(0,p.jsx)(td,{}),id:n.name,onClick:()=>{t&&t({pill:n})},size:"small",children:n.Label??(0,p.jsx)("span",{className:`${cy}__pill-label`,children:n.name})},n.key??`${n.name}-${a}`)),[n,t,e]);return e?(0,p.jsx)(nt,{className:cy,ids:n.map(e=>e.name),onDragEnd:({moveFromIndex:t,moveToIndex:n})=>{e.onDragEnd({moveFromIndex:t,moveToIndex:n})},children:a}):(0,p.jsx)("div",{className:cy,children:a})},cw=({collectionSlug:e})=>{let{columns:t,moveColumn:n,toggleColumn:a}=cb(),l=(0,o.useId)(),r=nc(),i=(0,o.useMemo)(()=>t?.filter(e=>!((0,b.I2)(e.field)&&!(0,b.uT)(e.field))&&!e?.field?.admin?.disableListColumn),[t]),s=(0,o.useMemo)(()=>i?i.map((t,n)=>{let{accessor:a,active:i,field:o}=t,s="labelWithPrefix"in o&&void 0!==o.labelWithPrefix?o.labelWithPrefix:"label"in o&&void 0!==o.label?o.label:"name"in o&&void 0!==o.name?o.name:void 0;return{name:a,key:`${e}-${a}-${n}${r?`-${r}-`:""}${l}`,Label:(0,p.jsx)(aD,{label:s,unstyled:!0}),selected:i}}):null,[e,r,i,l]);return s?(0,p.jsx)(cx,{draggable:{onDragEnd:({moveFromIndex:e,moveToIndex:t})=>{n({fromIndex:e,toIndex:t})}},onClick:({pill:e})=>{a(e.name)},pills:s}):null},cj=e=>{let t=(0,g.c)(3),{getEntityConfig:n}=(0,c.c)(),a;t[0]!==n||t[1]!==e?(a=()=>e?("string"==typeof e?[e]:e).map(e=>n({collectionSlug:e})):[],t[0]=n,t[1]=e,t[2]=a):a=t[2];let[l]=(0,o.useState)(a);return l},cC=e=>{let t,n=(0,g.c)(13),{delayBeforeShow:a,inTimeout:l,minShowTime:r,outTimeout:i,show:s}=e,d=l+r+i,[u,p]=(0,c.e)(a),[h,f]=o.useState(!1),[m,b]=o.useState(!1),v=o.useRef(0),y=o.useRef(void 0),x;n[0]!==i?(x=()=>{b(!0),y.current=setTimeout(()=>{f(!1),b(!1)},i)},n[0]=i,n[1]=x):x=n[1];let w=x,j,C;return n[2]!==u||n[3]!==h||n[4]!==s||n[5]!==d||n[6]!==w?(j=()=>{let e=u&&!h&&s,t=h&&!s;if(e)v.current=Date.now(),f(!0);else if(t){let e=d-(Date.now()-v.current);clearTimeout(y.current),y.current=setTimeout(w,Math.max(0,e))}},C=[h,s,w,d,u],n[2]=u,n[3]=h,n[4]=s,n[5]=d,n[6]=w,n[7]=j,n[8]=C):(j=n[7],C=n[8]),o.useEffect(j,C),n[9]!==h||n[10]!==m||n[11]!==p?(t={isMounted:h,isUnmounting:m,triggerDelayedRender:p},n[9]=h,n[10]=m,n[11]=p,n[12]=t):t=n[12],t},cS={isLoading:!1,loaders:[],loadingText:"",overlayType:null},ck=(e,t)=>{let n=[...e.loaders],{type:a="fullscreen",key:l="user",loadingText:r}=t.payload;if("add"===t.type)n.push({type:a,key:l,loadingText:r});else if("remove"===t.type){let e=n.findIndex(e=>e.key===l&&e.type===a);n.splice(e,1)}let i=n?.length>0?n[n.length-1]:null;return{isLoading:!!i,loaders:n,loadingText:i?.loadingText||e?.loadingText,overlayType:i?.type||e?.overlayType}},c_=(0,o.createContext)({isOnScreen:!1,toggleLoadingOverlay:void 0}),c$=({children:e})=>{let{t:t}=(0,d.d)(),n=t("general:loading"),[a,l]=o.useReducer(ck,cS),{isMounted:r,isUnmounting:i,triggerDelayedRender:s}=cC({delayBeforeShow:1e3,inTimeout:250,minShowTime:500,outTimeout:250,show:a.isLoading}),c=o.useCallback(({type:e,isLoading:t,key:a,loadingText:r=n})=>{t?(s(),l({type:"add",payload:{type:e,key:a,loadingText:r}})):l({type:"remove",payload:{type:e,key:a}})},[s,n]);return(0,p.jsxs)(c_,{value:{isOnScreen:r,toggleLoadingOverlay:c},children:[r&&(0,p.jsx)(cE,{animationDuration:"250ms",loadingText:a.loadingText||n,overlayType:a.overlayType,show:!i}),e]})},cN=()=>{let e=o.use(c_);if(void 0===e)throw Error("useLoadingOverlay must be used within a LoadingOverlayProvider");return e},cP="loading-overlay",cE=e=>{let t=(0,g.c)(8),{animationDuration:n,loadingText:a,overlayType:l,show:r}=e,{t:i}=(0,d.d)(),o=void 0===r||r?`${cP}--entering`:`${cP}--exiting`,s=l?`${cP}--${l}`:"",c;
41t[0]!==o||t[1]!==s?(c=[cP,o,s].filter(Boolean),t[0]=o,t[1]=s,t[2]=c):c=t[2];let u=c.join(" "),h=n||"500ms",f;return t[3]!==a||t[4]!==i||t[5]!==u||t[6]!==h?(f=(0,p.jsxs)("div",{className:u,style:{animationDuration:h},children:[(0,p.jsxs)("div",{className:`${cP}__bars`,children:[(0,p.jsx)("div",{className:`${cP}__bar`}),(0,p.jsx)("div",{className:`${cP}__bar`}),(0,p.jsx)("div",{className:`${cP}__bar`}),(0,p.jsx)("div",{className:`${cP}__bar`}),(0,p.jsx)("div",{className:`${cP}__bar`})]}),(0,p.jsx)("span",{className:`${cP}__text`,children:a||i("general:loading")})]}),t[3]=a,t[4]=i,t[5]=u,t[6]=h,t[7]=f):f=t[7],f},cD=e=>{let t=(0,g.c)(7),{name:n,type:a,loadingText:l,show:r}=e,i=void 0===a?"fullscreen":a,{toggleLoadingOverlay:s}=cN(),c,d;return t[0]!==n||t[1]!==l||t[2]!==r||t[3]!==s||t[4]!==i?(c=()=>(s({type:i,isLoading:r,key:n,loadingText:l||void 0}),()=>{s({type:i,isLoading:!1,key:n})}),d=[r,s,n,i,l],t[0]=n,t[1]=l,t[2]=r,t[3]=s,t[4]=i,t[5]=c,t[6]=d):(c=t[5],d=t[6]),o.useEffect(c,d),null},cT=e=>{let t=(0,g.c)(6),{name:n,type:a,action:l,formIsLoading:r,loadingSuffix:i}=e,o=void 0===a?"fullscreen":a,s=void 0!==r&&r,c=eF(),{i18n:u,t:f}=(0,d.d)(),m=`${{create:f("general:creating"),loading:f("general:loading"),update:f("general:updating")}[l]} ${i?(0,h.s)(i,u):""}`,b;return t[0]!==s||t[1]!==c||t[2]!==n||t[3]!==m||t[4]!==o?(b=(0,p.jsx)(cD,{loadingText:m.trim(),name:n,show:s||c,type:o}),t[0]=s,t[1]=c,t[2]=n,t[3]=m,t[4]=o,t[5]=b):b=t[5],b};function cA(e){if(e)try{e.abort()}catch{}}function cR(e){let t=new AbortController;if(e.current)try{e.current.abort()}catch{}return e.current=t,t}var cL=(0,o.createContext)({}),cF=({children:e,...t})=>(0,p.jsx)(cL,{value:{...t},children:e}),cO=()=>{let e=(0,o.use)(cL);if(!e)throw Error("useDocumentDrawerContext must be used within a DocumentDrawerProvider");return e},cM=({id:e,collectionSlug:t,disableActions:n,drawerSlug:a,initialData:l,onDelete:r,onDuplicate:i,onSave:s,overrideEntityVisibility:u=!0,redirectAfterCreate:h,redirectAfterDelete:f,redirectAfterDuplicate:m,redirectAfterRestore:g})=>{let{getEntityConfig:b}=(0,c.c)(),[v]=(0,o.useState)(()=>b({collectionSlug:t})),y=o.useRef(null),{closeModal:x}=nN(),{t:w}=(0,d.d)(),{renderDocument:j}=cf(),[C,S]=(0,o.useState)(void 0),[k,_]=(0,o.useState)(!0),$=(0,o.useRef)(!1),N=(0,o.useCallback)((e,r=!1)=>{let i=cR(y);(async()=>{r&&_(!0);try{let r=await j({collectionSlug:t,disableActions:n,docID:e,drawerSlug:a,initialData:l,overrideEntityVisibility:u,redirectAfterCreate:h,redirectAfterDelete:void 0!==f&&f,redirectAfterDuplicate:void 0!==m&&m,redirectAfterRestore:void 0!==g&&g,signal:i.signal});r?.Document&&(S(r.Document),_(!1))}catch(e){e3.error(e?.message||w("error:unspecific")),x(a)}y.current=null})()},[t,n,a,l,f,m,g,j,h,x,u,w]),P=(0,o.useCallback)(e=>{"create"===e.operation&&N(e.doc.id),"function"==typeof s&&s({...e,collectionConfig:v})},[s,v,N]),E=(0,o.useCallback)(e=>{N(e.doc.id),"function"==typeof i&&i({...e,collectionConfig:v})},[i,v,N]),D=(0,o.useCallback)(e=>{"function"==typeof r&&r({...e,collectionConfig:v}),x(a)},[r,x,a,v]),T=(0,o.useCallback)(()=>{N(void 0,!0)},[N]);return(0,o.useEffect)(()=>{C||$.current||(N(e,!0),$.current=!0)},[C,N,e]),(0,o.useEffect)(()=>{let e=y.current;return()=>{cA(e)}},[]),k?(0,p.jsx)(cE,{}):(0,p.jsx)(cF,{clearDoc:T,drawerSlug:a,onDelete:D,onDuplicate:E,onSave:P,children:C})},cI="doc-drawer",cB=({id:e,collectionSlug:t,depth:n,uuid:a})=>`doc-drawer_${t}_${n}${e?`_${e}`:""}_${a}`,cz=e=>{let t=(0,g.c)(2),{children:n,className:a,collectionSlug:l,disabled:r,drawerSlug:i,onClick:o,operation:s,...c}=e,{t:u}=(0,d.d)(),[h]=cj(l),f=u("create"===s?"fields:addNewLabel":"general:editLabel",{label:h?.labels.singular}),m;return t[0]!==a?(m=[a,`${cI}
41__toggler`].filter(Boolean),t[0]=a,t[1]=m):m=t[1],(0,p.jsx)(ad,{"aria-label":f,className:m.join(" "),disabled:r,onClick:o,slug:i,...c,children:n})},cU=e=>{let{drawerSlug:t}=e;return(0,p.jsx)(au,{className:cI,gutter:!1,Header:null,slug:t,children:(0,p.jsx)(cM,{...e})})},cV=e=>{let t,n=(0,g.c)(38),{id:a,collectionSlug:l,overrideEntityVisibility:r}=e,i=nc(),s=(0,o.useId)(),{closeModal:c,modalState:d,openModal:u,toggleModal:h}=nN(),[f,m]=(0,o.useState)(!1),b;n[0]!==l||n[1]!==i||n[2]!==a||n[3]!==s?(b=cB({id:a,collectionSlug:l,depth:i,uuid:s}),n[0]=l,n[1]=i,n[2]=a,n[3]=s,n[4]=b):b=n[4];let v=b,y,x;n[5]!==v||n[6]!==d?(y=()=>{m(!!d[v]?.isOpen)},x=[d,v],n[5]=v,n[6]=d,n[7]=y,n[8]=x):(y=n[7],x=n[8]),(0,o.useEffect)(y,x),n[9]!==v||n[10]!==h?(t=()=>{h(v)},n[9]=v,n[10]=h,n[11]=t):t=n[11];let w=t,j;n[12]!==c||n[13]!==v?(j=()=>{c(v)},n[12]=c,n[13]=v,n[14]=j):j=n[14];let C=j,S;n[15]!==v||n[16]!==u?(S=()=>{u(v)},n[15]=v,n[16]=u,n[17]=S):S=n[17];let k=S,_;n[18]!==l||n[19]!==v||n[20]!==a||n[21]!==r?(_=e=>(0,o.createElement)(cU,{...e,collectionSlug:l,drawerSlug:v,id:a,key:v,overrideEntityVisibility:r}),n[18]=l,n[19]=v,n[20]=a,n[21]=r,n[22]=_):_=n[22];let $=_,N;n[23]!==l||n[24]!==v||n[25]!==a?(N=e=>(0,p.jsx)(cz,{...e,collectionSlug:l,drawerSlug:v,operation:a?"update":"create"}),n[23]=l,n[24]=v,n[25]=a,n[26]=N):N=n[26];let P=N,E;n[27]!==C||n[28]!==v||n[29]!==i||n[30]!==f||n[31]!==k||n[32]!==w?(E={closeDrawer:C,drawerDepth:i,drawerSlug:v,isDrawerOpen:f,openDrawer:k,toggleDrawer:w},n[27]=C,n[28]=v,n[29]=i,n[30]=f,n[31]=k,n[32]=w,n[33]=E):E=n[33];let D=E,T;return n[34]!==$||n[35]!==D||n[36]!==P?(T=[$,P,D],n[34]=$,n[35]=D,n[36]=P,n[37]=T):T=n[37],T},cH="no-results";function cq({Actions:e,Message:t}){return(0,p.jsxs)("div",{className:cH,children:[t,e&&e.length>0&&(0,p.jsx)("div",{className:`${cH}__actions`,children:e.map((e,t)=>(0,p.jsx)(o.Fragment,{children:e},t))})]})}function cW(e,t){let n=(0,g.c)(4),[a,l]=(0,o.useState)(e),r,i;return n[0]!==t||n[1]!==e?(r=()=>{let n=setTimeout(()=>{l(e)},t);return()=>{clearTimeout(n)}},i=[e,t],n[0]=t,n[1]=e,n[2]=r,n[3]=i):(r=n[2],i=n[3]),(0,o.useEffect)(r,i),a}function cK(e,t){switch(t.type){case"ADD_LOADED":{let n={...e};"object"!=typeof n[t.relationTo]&&(n[t.relationTo]={});let a=[...t.idsToLoad];return Array.isArray(t.docs)&&t.docs.forEach(e=>{a.splice(a.indexOf(e.id),1),n[t.relationTo][e.id]=e}),a.forEach(e=>{n[t.relationTo][e]=!1}),n}case"REQUEST":{let n={...e};return t.docs.forEach(({relationTo:e,value:t})=>{"object"!=typeof n[e]&&(n[e]={}),n[e][t]=null}),n}default:return e}}var cQ=(0,o.createContext)({}),cY=e=>{let t,n=(0,g.c)(15),{children:a}=e,l;n[0]===Symbol.for("react.memo_cache_sentinel")?(l={},n[0]=l):l=n[0];let[r,i]=(0,o.useReducer)(cK,l),s=cW(r,100),{config:u}=(0,c.c)(),{collections:h,routes:f}=u,{api:m}=f,{i18n:b}=(0,d.d)(),{code:v}=aN(),w=(0,o.useRef)(v),j;n[1]!==m||n[2]!==h||n[3]!==s||n[4]!==b||n[5]!==v?(j=e=>{let t=void 0!==e&&e;Object.entries(s).forEach(async e=>{let[n,a]=e,l=[];if(Object.entries(a).forEach(e=>{let[n,a]=e;(null===a||t)&&l.push(n)}),l.length>0){let e=(0,y.Q)({apiRoute:m,path:`/${n}`}),t=new URLSearchParams,a={};t.append("depth","0"),t.append("draft","true"),t.append("limit","250");let r=h.find(e=>e.slug===n);r.admin.enableListViewSelectAPI&&(a[r.admin.useAsTitle??"id"]=!0,r.upload&&(0,P.f)({collectionConfig:r,select:a})),v&&t.append("locale",v);let o=l.map(cX);t.append("where[id][in]",o.join(","));let s=`?${t.toString()}&${x.A({select:a})}`,c=await fetch(`${e}${s}`,{credentials:"include",headers:{"Accept-Language":b.language}});if(c.ok){let e=await c.json();e.docs&&i({type:"ADD_LOADED",docs:e.docs,idsToLoad:l,relationTo:n})}else i({type:"ADD_LOADED",docs:[],idsToLoad:l,relationTo:n})}})},n[1]=m,n[2]=h,n[3]=s,n[4]=b,n[5]=v,n[6]=j):j=n[6];let C=j,S,k;n[7]!==C||n[8]!==v?(S=()=>{C(v&&w.current!==v),w.current=v},k=[v,C],n[7]=C,n[8]=v,n[9]=S,n[10]=k):(S=n[9],k=n[10]),(0,o.useEffect)(S,k),n[11]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{i({type:"REQUEST",docs:e})},n[11]=t):t=n[11];let _=t,$;return n[12]!==a||n[13]!==r?($=(0,p.jsx)(cQ,{value:{documents:r,getRelationships:_},children:a}),n[12]=a,n[13]=r,n[14]=$):$=n[14],$},cG=()=>(0,o.use)(cQ);function cX(e){return String(e)}var cZ=({allowCreate:e,baseClass:t,buttonStyle:n,className:a,collections:l,i18n:r,icon:i,label:o,onClick:s,permissions:c,relationTo:d})=>e?Array.isArray(d)?(0,p.jsx)("div",{className:`${t}__add-new-polymorphic-wrapper`,children:(0,p.jsx)(tC,{button:(0,p.jsx)(tN,{buttonStyle:n,className:a,icon:i,children:o}),buttonType:"custom",horizontalAlign:"center",render:({close:e})=>(0,p.jsx)(tp.ButtonGroup,{children:d.map(n=>c.collections[n]?.create?(0,p.jsx)(tp.Button,{className:`${t}__relation-button--${n}`,onClick:()=>{e(),s(n)},children:(0,h.s)(l.find(e=>e.slug===n).labels.singular,r)},n):null)}),size:"medium"})}):(0,p.jsx)(tN,{buttonStyle:n,className:a,onClick:()=>s(),children:o}):null,cJ=Symbol.for("react.lazy");function c0(e){return o.isValidElement(e)||e?.$$typeof===cJ}var c1=({cellData:e,nowrap:t})=>{let n=e?.length>100?`${e.substring(0,100)}\u2026`:e;return(0,p.jsx)("code",{className:"code-cell",style:t?{whiteSpace:"nowrap"}:{},children:(0,p.jsx)("span",{children:n})})};function c3(e){let{blockType:t}=e;return t}var c2=e=>{let{cellData:t,field:n,rowData:a}=e,{name:l,accessor:r,admin:i,timezone:o}=n,{date:s}=void 0===i?{}:i,{config:u}=(0,c.c)(),{admin:h}=u,{dateFormat:f}=h,{i18n:m}=(0,d.d)(),g=`${r||l}_tz`,b=o&&a?(0,E.v)(a,g,void 0):void 0,v=s?.displayFormat||f;
41return(0,p.jsx)("span",{children:!!t&&lh({date:t,i18n:m,pattern:v,timezone:b})})},c6=()=>(0,p.jsxs)("svg",{height:"150",style:{backgroundColor:"#333333"},viewBox:"0 0 150 150",width:"150",xmlns:"http://www.w3.org/2000/svg",children:[(0,p.jsx)("path",{d:"M82.8876 50.5H55.5555V100.5H94.4444V61.9818H82.8876V50.5Z",fill:"white"}),(0,p.jsx)("path",{d:"M82.8876 61.9818H94.4444L82.8876 50.5V61.9818Z",fill:"#9A9A9A"})]});function c5(e,t){if(!t)return e;let n=e.includes("?")?"&":"?";return`${e}${n}${encodeURIComponent(t)}`}var c4="thumbnail",c8=e=>{let{className:t="",doc:{filename:n}={},fileSrc:a,height:l,imageCacheTag:r,size:i,width:s}=e,[d,u]=o.useState(void 0),h=[c4,`${c4}--size-${i||"medium"}`,t].join(" "),f=o.useMemo(()=>a?c5(a,r):null,[a,r]);return o.useEffect(()=>{if(!f)return void u(!1);u(void 0);let e=new Image;e.src=f,e.onload=()=>{u(!0)},e.onerror=()=>{u(!1)}},[f]),(0,p.jsxs)("div",{className:h,children:[void 0===d&&(0,p.jsx)(c.f,{height:"100%"}),d&&(0,p.jsx)("img",{alt:n,height:l,src:f,width:s}),!1===d&&(0,p.jsx)(c6,{})]})};function c7(e){let{alt:t,className:n="",filename:a,fileSrc:l,imageCacheTag:r,size:i}
41=e,[s,d]=o.useState(void 0),u=[c4,`${c4}--size-${i||"medium"}`,n].join(" "),h=o.useMemo(()=>l?c5(l,r):null,[l,r]);return o.useEffect(()=>{if(!h)return void d(!1);d(void 0);let e=new Image;e.src=h,e.onload=()=>{d(!0)},e.onerror=()=>{d(!1)}},[h]),(0,p.jsxs)("div",{className:u,children:[void 0===s&&(0,p.jsx)(c.f,{height:"100%"}),s&&(0,p.jsx)("img",{alt:t||a,src:h}),!1===s&&(0,p.jsx)(c6,{})]})}var c9="file",de=({cellData:e,collectionConfig:t,field:n,rowData:a})=>{if(!(("displayPreview"in n?n.displayPreview:void 0)??t.upload?.displayPreview??!0))return(0,p.jsx)(p.Fragment,{children:String(e)});{let n=(0,D.w)(a?.mimeType),l=n?a?.thumbnailURL||a?.url:a?.thumbnailURL;n&&(l=(0,T.k)({sizes:a?.sizes,thumbnailURL:a?.thumbnailURL,url:a?.url,width:a?.width}));let r=t?.upload,i=r?.cacheTags&&a?.updatedAt;return(0,p.jsxs)("div",{className:c9,children:[(0,p.jsx)(c8,{className:`${c9}__thumbnail`,collectionSlug:t?.slug,doc:{...a,filename:e},fileSrc:l,imageCacheTag:i,size:"small",uploadConfig:r}),(0,p.jsx)("span",{className:`${c9}__filename`,children:String(e)})]})}},dt=!!("u">typeof window&&window.document&&window.document.createElement),dn=e=>{let t,n,a,l,r=(0,g.c)(39),{cellData:i,customCellProps:s,field:u,field:f}=e,{label:m}=f,b="relationTo"in u&&u.relationTo||"collection"in u&&u.collection,v="collection"in u?i?.docs:i,{config:y,getEntityConfig:x}=(0,c.c)(),{collections:w}=y,[j,C]=tS(),S;r[0]===Symbol.for("react.memo_cache_sentinel")?(S=[],r[0]=S):S=r[0];let[k,_]=(0,o.useState)(S),{documents:$,getRelationships:N}=cG(),[P,E]=(0,o.useState)(!1),{i18n:D,t:T}=(0,d.d)(),A=!!dt&&C?.boundingClientRect?.top<window.innerHeight,R;if(r[1]!==v||r[2]!==N||r[3]!==P||r[4]!==A||r[5]!==b?(R=()=>{if((v||"number"==typeof v)&&A&&!P){let e=[],t=Array.isArray(v)?v:[v];t.slice(0,t.length<3?t.length:3).forEach(t=>{"object"==typeof t&&"relationTo"in t&&"value"in t&&e.push(t),("number"==typeof t||"string"==typeof t)&&"string"==typeof b&&e.push({relationTo:b,value:t})}),N(e),E(!0),_(e)}},r[1]=v,r[2]=N,r[3]=P,r[4]=A,r[5]=b,r[6]=R):R=r[6],r[7]!==v||r[8]!==w||r[9]!==N||r[10]!==P||r[11]!==A||r[12]!==b?(t=[v,b,w,A,P,N],r[7]=v,r[8]=w,r[9]=N,r[10]=P,r[11]=A,r[12]=b,r[13]=t):t=r[13],(0,o.useEffect)(R,t),r[14]!==P?(n=()=>{P&&E(!1)},r[14]=P,r[15]=n):n=r[15],r[16]!==v?(a=[v],r[16]=v,r[17]=a):a=r[17],(0,o.useEffect)(n,a),r[18]!==v||r[19]!==y.admin||r[20]!==s||r[21]!==$||r[22]!==u||r[23]!==x||r[24]!==D||r[25]!==j||r[26]!==m||r[27]!==T||r[28]!==k){let e;r[30]!==y.admin||r[31]!==s||r[32]!==$||r[33]!==u||r[34]!==x||r[35]!==D||r[36]!==T||r[37]!==k.length?(e=(e,t)=>{let{relationTo:n,value:a}=e,l=$[n][a],r=x({collectionSlug:n}),i=lb({collectionConfig:r,data:l||null,dateFormat:y.admin.dateFormat,fallback:`${T("general:untitled")} - ID: ${a}`,i18n:D}),c=null;return"upload"===u.type&&(("displayPreview"in u?u.displayPreview:void 0)??r.upload?.displayPreview??!0)&&l&&(c=(0,p.jsx)(de,{cellData:i,collectionConfig:r,collectionSlug:r.slug,customCellProps:s,field:u,rowData:l})),(0,p.jsxs)(o.Fragment,{children:[!1===l&&`${T("general:untitled")} - ID: ${a}`,null===l&&`${T("general:loading")}...`,l?c||i:null,k.length>t+1&&", "]},t)},r[30]=y.admin,r[31]=s,r[32]=$,r[33]=u,r[34]=x,r[35]=D,r[36]=T,r[37]=k.length,r[38]=e):e=r[38],l=(0,p.jsxs)("div",{className:"relationship-cell",ref:j,children:[k.map(e),Array.isArray(v)&&v.length>3&&T("fields:itemsAndMore",{count:v.length-3,items:""}),0===k.length&&T("general:noLabel",{label:(0,h.s)(m||"",D)})]}),r[18]=v,r[19]=y.admin,r[20]=s,r[21]=$,r[22]=u,r[23]=x,r[24]=D,r[25]=j,r[26]=m,r[27]=T,r[28]=k,r[29]=l}else l=r[29];return l},da=e=>{let t=(0,g.c)(7),{cellData:n,field:a}=e,{options:l}=a,{i18n:r}=(0,d.d)(),i;t[0]!==r||t[1]!==l?(i=e=>e.map(e=>{let t=l.filter(t=>t.value===e)?.[0]?.label;return(0,h.s)(t,r)}).join(", "),t[0]=r,t[1]=l,t[2]=i):i=t[2];let o=i,s;if(t[3]!==n||t[4]!==o||t[5]!==l){let e;e=(0,b.Vh)(l)?o(Array.isArray(n)?n:[n]):Array.isArray(n)?n.join(", "):n,s=(0,p.jsx)("span",{children:e}),t[3]=n,t[4]=o,t[5]=l,t[6]=s}else s=t[6];return s},dl={array:e=>{let t=(0,g.c)(2),{cellData:n,field:a}=e,{labels:l}=a,{i18n:r}=(0,d.d)(),i=n??[],o=1===i.length?`${i.length} ${(0,h.s)(l?.singular||r.t("general:rows"),r)}`:`${i.length} ${(0,h.s)(l?.plural||r.t("general:rows"),r)}`,s;return t[0]!==o?(s=(0,p.jsx)("span",{children:o}),t[0]=o,t[1]=s):s=t[1],s},blocks:e=>{let t,n=(0,g.c)(2),{cellData:a,field:l}=e,{blockReferences:r,blocks:i,labels:o}=l,{i18n:s}=(0,d.d)(),{config:u}=(0,c.c)(),f=Array.isArray(a)?a.map(c3):[],m=(r??i)?.map(e=>{let t="string"==typeof e?u.blocksMap[e]:e;return{slug:t.slug,label:(0,h.s)(t.labels.singular,s)}}),b=`0 ${(0,h.s)(o?.plural,s)}`,v=e=>e.map(e=>m.filter(t=>t.slug===e)?.[0]?.label).join(", ");
41if(f.length>5){let e=f.length-5;b=`${f.length} ${(0,h.s)(o?.plural,s)} - ${s.t("fields:itemsAndMore",{count:e,items:v(f.slice(0,5))})}`}else f.length>0&&(b=`${f.length} ${(0,h.s)(1===f.length?o?.singular:o?.plural,s)} - ${v(f)}`);return n[0]!==b?(t=(0,p.jsx)("span",{children:b}),n[0]=b,n[1]=t):t=n[1],t},checkbox:e=>{let t=(0,g.c)(3),{cellData:n}=e,{t:a}=(0,d.d)(),l=`general:${n}`,r;return t[0]!==a||t[1]!==l?(r=(0,p.jsx)("code",{className:"bool-cell",children:(0,p.jsx)("span",{children:a(l).toLowerCase()})}),t[0]=a,t[1]=l,t[2]=r):r=t[2],r},code:c1,date:c2,File:de,join:dn,json:e=>{let t=(0,g.c)(4),{cellData:n}=e,{t:a}=(0,d.d)();try{let e;if(t[0]!==n){let a,l=(a=JSON.stringify(n)).length/100>1.5?`${a.substring(0,100)}\u2026`:a;e=(0,p.jsx)("code",{className:"json-cell",children:(0,p.jsx)("span",{children:l})}),t[0]=n,t[1]=e}else e=t[1];return e}catch{let e;return t[2]!==a?(e=(0,p.jsx)("code",{className:"json-cell",children:(0,p.jsx)("span",{children:a("general:error")})}),t[2]=a,t[3]=e):e=t[3],e}},radio:da,relationship:dn,select:da,textarea:({cellData:e})=>{let t=e?.length>100?`${e.substring(0,100)}\u2026`:e;return(0,p.jsx)("span",{children:t})},upload:dn},dr=e=>{let t=(0,g.c)(16),{cellData:n,className:a,collectionSlug:l,field:r,field:i,link:o,linkURL:s,onClick:u,rowData:f,viewType:m}=e,{admin:v}=i,{i18n:x}=(0,d.d)(),{config:w,getEntityConfig:j}=(0,c.c)(),{routes:C}=w,{admin:S}=C,k,_;if(t[0]!==v||t[1]!==S||t[2]!==n||t[3]!==a||t[4]!==l||t[5]!==r||t[6]!==j||t[7]!==x||t[8]!==o||t[9]!==s||t[10]!==u||t[11]!==e||t[12]!==f||t[13]!==m){_=Symbol.for("react.early_return_sentinel");e:{let t=j({collectionSlug:l}),i=v&&"className"in v?v.className:void 0,c=a||(r.admin&&"className"in r.admin?r.admin.className:null)||i,d="span",g={className:c};if(o&&(g.prefetch=!1,d=tl,s?g.href=s:g.href=t?.slug?(0,y.Q)({adminRoute:S,path:`/collections/${t?.slug}${"trash"===m?"/trash":""}/${encodeURIComponent(f.id)}`}):""),"function"==typeof u&&(d="button",g.type="button",g.onClick=()=>{u({cellData:n,collectionSlug:t?.slug,rowData:f})}),(0,b.uT)(r)){_=(0,p.jsx)(d,{...g,children:(0,p.jsx)(c1,{cellData:`ID: ${n}`,collectionConfig:t,collectionSlug:l,field:{...r,type:"code"},nowrap:!0,rowData:f})});break e}let w=((e,t,n)=>{if((t?.type==="select"||t?.type==="radio")&&Array.isArray(t.options)){let a=t.options.find(t=>"object"==typeof t?t.value===e:t===e);if(a)return"object"==typeof a&&"label"in a?c0(a.label)?a.label:(0,h.s)(a.label,n)||a.value:a}return e})(n,r,x),C="u">typeof n&&dl[r.type],$=null;if(c0(w))$=w;else if(C)$=(0,p.jsx)(C,{cellData:n,rowData:f,...e});else if(!C)if(t?.upload&&(0,b.Z7)(r)&&"filename"===r.name&&"text"===r.type){let a=dl.File;$=(0,p.jsx)(a,{cellData:n,rowData:f,...e,collectionConfig:t,field:r})}else{_=(0,p.jsxs)(d,{...g,children:[(""===w||typeof w>"u"||null===w)&&x.t("general:noLabel",{label:(0,h.s)(("label"in r?r.label:null)||"data",x)}),"string"==typeof w&&w,"number"==typeof w&&w,"object"==typeof w&&null!==w&&JSON.stringify(w)]});break e}if(("select"===r.type||"radio"===r.type)&&r.options.length&&n){let e=Array.isArray(n)?n.map(di).join(" "):`selected--${n}
41`,t=[g.className,e].filter(Boolean).join(" ");_=(0,p.jsx)(d,{...g,className:t,children:$});break e}k=(0,p.jsx)(d,{...g,children:$})}t[0]=v,t[1]=S,t[2]=n,t[3]=a,t[4]=l,t[5]=r,t[6]=j,t[7]=x,t[8]=o,t[9]=s,t[10]=u,t[11]=e,t[12]=f,t[13]=m,t[14]=k,t[15]=_}else k=t[14],_=t[15];return _!==Symbol.for("react.early_return_sentinel")?_:k};function di(e){return`selected--${e}`}var ds=o.createContext(null),dc=()=>o.use(ds),dd=e=>{let t=(0,g.c)(9),{clientProps:n,columnIndex:a,isLinkedColumn:l}=e,{drawerSlug:r,onSelect:i}=ci(),{LinkedCellOverride:o}=cb(),s;if(t[0]!==o||t[1]!==n||t[2]!==a||t[3]!==r||t[4]!==l||t[5]!==i){let e={...n,columnIndex:a};if(l&&r&&!1!==n.link){let n;e.className="default-cell__first-cell",e.link=!1,t[7]!==i?(n=e=>{let{collectionSlug:t,rowData:n}=e;"function"==typeof i&&i({collectionSlug:t,doc:n,docID:n.id})},t[7]=i,t[8]=n):n=t[8],e.onClick=n}s=(0,p.jsx)(ds,{value:e,children:l&&o?o:(0,p.jsx)(dr,{...e})}),t[0]=o,t[1]=n,t[2]=a,t[3]=r,t[4]=l,t[5]=i,t[6]=s}else s=t[6];return s},du=e=>{let t=(0,g.c)(3),{onDrawerOpen:n}=e,a=dc(),l;return t[0]!==a||t[1]!==n?(l=(0,p.jsxs)("div",{className:"drawer-link",children:[(0,p.jsx)(dr,{...a,className:"drawer-link__cell",link:!1,onClick:null}),(0,p.jsx)("button",{className:"drawer-link__doc-drawer-toggler",onClick:()=>{n(a.rowData.id,a.collectionSlug)},type:"button",children:(0,p.jsx)(ts,{})})]}),t[0]=a,t[1]=n,t[2]=l):l=t[2],l},dp="clickable-arrow",dh="paginator__page",df=({isCurrent:e,isFirstPage:t=!1,isLastPage:n=!1,page:a=1,updatePage:l})=>{let r=[dh,e&&`${dh}--is-current`,t&&`${dh}--is-first-page`,n&&`${dh}--is-last-page`].filter(Boolean).join(" ");return(0,p.jsx)("button",{className:r,onClick:()=>l(a),type:"button",children:a})},dm={ClickableArrow:e=>{let{direction:t="right",isDisabled:n=!1,updatePage:a}=e,l=[dp,n&&`${dp}--is-disabled`,t&&`${dp}--${t}`].filter(Boolean).join(" ");return(0,p.jsx)("button",{className:l,disabled:n,onClick:n?void 0:a,type:"button",children:(0,p.jsx)(to,{})})},Page:df,Separator:()=>(0,p.jsx)("span",{className:"paginator__separator",children:"—"})},dg=e=>{let{hasNextPage:t=!1,hasPrevPage:n=!1,nextPage:a=null,numberOfNeighbors:l=1,onChange:r,page:i,prevPage:o=null,totalPages:s=null}=e;if(!n&&!t)return null;let c=e=>{"function"==typeof r&&r(e)},d=Array.from({length:s},(e,t)=>t+1),u=i-1-l;u<=0&&(u=0);let h=i-1+l+1,f=d.slice(u,h);return i-l-1>=2&&f.unshift({type:"Separator"}),i>l+1&&f.unshift({type:"Page",props:{isFirstPage:!0,page:1,updatePage:c}}),i+l+1<s&&f.push({type:"Separator"}),h<s&&f.push({type:"Page",props:{isLastPage:!0,page:s,updatePage:c}}),f.unshift({type:"ClickableArrow",props:{direction:"right",isDisabled:!t,updatePage:()=>c(a??i+1)}}),f.unshift({type:"ClickableArrow",props:{direction:"left",isDisabled:!n,updatePage:()=>c(o??Math.max(1,i-1))}}),(0,p.jsx)("div",{className:"paginator",children:f.map((e,t)=>{if("number"==typeof e)return(0,p.jsx)(df,{isCurrent:i===e,page:e,updatePage:c},t);let n=dm[e.type];return(0,p.jsx)(n,{...e.props},t)})})},db=()=>{let e=(0,g.c)(11),{data:t,handlePageChange:n}=cc(),a=t.nextPage||2,l;e[0]!==n?(l=e=>{n(e)},e[0]=n,e[1]=l):l=e[1];let r=t.page||1,i=t.prevPage||void 0,o;return e[2]!==t.hasNextPage||e[3]!==t.hasPrevPage||e[4]!==t.limit||e[5]!==t.totalPages||e[6]!==a||e[7]!==l||e[8]!==r||e[9]!==i?(o=(0,p.jsx)(dg,{hasNextPage:t.hasNextPage,hasPrevPage:t.hasPrevPage,limit:t.limit,nextPage:a,numberOfNeighbors:1,onChange:l,page:r,prevPage:i,totalPages:t.totalPages}),e[2]=t.hasNextPage,e[3]=t.hasPrevPage,e[4]=t.limit,e[5]=t.totalPages,e[6]=a,e[7]=l,e[8]=r,e[9]=i,e[10]=o):o=e[10],o},dv="relationship-table",dy=e=>{let{AfterInput:t,allowCreate:n=!0,BeforeInput:a,disableTable:l=!1,field:r,fieldPath:i,filterOptions:s,initialData:u,initialDrawerData:f,Label:m,parent:g,relationTo:b}=e,[v,y]=(0,o.useState)(null),{config:x,getEntityConfig:w}=(0,c.c)(),{i18n:j,t:C}=(0,d.d)(),[S,k]=(0,o.useState)(),[N,P]=(0,o.useState)(!1),[E]=(0,o.useState)(()=>w({collectionSlug:b})),D=Array.isArray(b),[T,A]=(0,o.useState)(D?void 0:b),{permissions:R}=aj(),L=(0,o.useRef)(!1),[F,O]=(0,o.useState)(void 0),[M,,{closeDrawer:I,isDrawerOpen:B,openDrawer:z}
41]=cV({id:F,collectionSlug:T}),[U,V]=(0,o.useState)(!l),[H,q]=(0,o.useState)(()=>u?{...u,docs:Array.isArray(u.docs)?u.docs.reduce((e,t)=>"string"==typeof t||"number"==typeof t?[...e,{id:t}]:[...e,t],[]):[]}:void 0),[W,K]=(0,o.useState)(),{getTableState:Q}=cf(),Y=(0,o.useCallback)(async e=>{let t={limit:r?.defaultLimit||E?.admin?.pagination?.defaultLimit,sort:r.defaultSort||E?.defaultSort,...S||{},where:{...S?.where||{}}};s&&(t.where=(0,_.Y)(t.where,s));let n=r.admin.defaultColumns?r.admin.defaultColumns.map(e=>({accessor:e,active:!0})):void 0,a="boolean"==typeof r.admin.disableRowTypes?!r.admin.disableRowTypes:Array.isArray(b),{data:l,state:i,Table:o}=await Q({collectionSlug:b,columns:(0,$.l)(S?.columns)||n,data:e,enableRowSelections:!1,orderableFieldName:!r.orderable||Array.isArray(r.collection)?void 0:`_${r.collection}_${r.name}_order`,parent:g,query:t,renderRowTypes:a,tableAppearance:"condensed"});q(l),y(o),K(i),V(!1)},[r.defaultLimit,r.defaultSort,r.admin.defaultColumns,r.admin.disableRowTypes,r.collection,r.name,r.orderable,E?.admin?.pagination?.defaultLimit,E?.defaultSort,S,s,Q,b,g]),G=tv((e,t)=>{t||v&&!e||Y()});(0,o.useEffect)(()=>{G(S,l)},[S,l]);let X=(0,o.useCallback)(({doc:e,operation:t})=>{"create"===t&&I();let n=H?.docs?.findIndex(t=>t.id===e.id),a={docs:[]};if(-1!==n){let t=[...H.docs];t[n]=e,a.docs=t}else a.docs=[e,...H.docs];Y(a)},[H?.docs,Y,I]),Z=(0,o.useCallback)(e=>{let t=H.docs.filter(t=>t.id!==e.id);Y({...H,docs:t}),O(void 0)},[H,Y]),J=(0,o.useCallback)((e,t)=>{L.current=!0,O(e||void 0),A(t||void 0)},[]);(0,o.useEffect)(()=>{L.current&&(L.current=!1,z())},[z]),(0,o.useEffect)(()=>{B||O(void 0)},[B]);let ee=!1!==n&&R?.collections?.[D?b[0]:b]?.create;(0,o.useEffect)(()=>{D&&T&&z()},[T,z,D]),(0,o.useEffect)(()=>{D&&!B&&T&&A(void 0)},[B]);let et=o.useMemo(()=>({columns:(0,$.l)(W)?.map(({accessor:e})=>e),limit:r.defaultLimit??E?.admin?.pagination?.defaultLimit,sort:r.defaultSort??E?.defaultSort}),[W,r,E]);return(0,p.jsxs)("div",{className:dv,children:[(0,p.jsxs)("div",{className:`${dv}__header`,children:[m,(0,p.jsxs)("div",{className:`${dv}__actions`,children:[(0,p.jsx)(cZ,{allowCreate:!1!==n,baseClass:dv,buttonStyle:"none",className:`${dv}__add-new${D?"-polymorphic":" doc-drawer__toggler"}`,collections:x.collections,i18n:j,icon:D?"plus":void 0,label:j.t("fields:addNew"),onClick:D?A:z,permissions:R,relationTo:b}),(0,p.jsx)(ra,{"aria-controls":`${dv}-columns`,"aria-expanded":N,className:`${dv}__toggle-columns ${N?`${dv}__buttons-active`:""}`,icon:(0,p.jsx)(to,{direction:N?"up":"down"}),onClick:()=>P(!N),pillStyle:"light",size:"small",children:C("general:columns")})]})]}),a,U?(0,p.jsx)("p",{children:C("general:loading")}):(0,p.jsxs)(o.Fragment,{children:[H?.docs&&0===H.docs.length&&(0,p.jsx)(cq,{Actions:ee?[(0,p.jsx)(cZ,{allowCreate:ee,baseClass:dv,collections:x.collections,i18n:j,label:j.t("general:createNewLabel",{label:D?j.t("general:document"):(0,h.s)(E?.labels?.singular,j)}),onClick:D?A:z,permissions:R,relationTo:b},"create")]:[],Message:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("h3",{children:j.t("general:noResultsFound")}),(0,p.jsx)("p",{children:j.t("general:noResults",{label:D?j.t("general:documents"):(0,h.s)(E?.labels?.plural,j)})})]})}),H?.docs&&H.docs.length>0&&(0,p.jsx)(cY,{children:(0,p.jsx)(cp,{data:H,modifySearchParams:!1,onQueryChange:k,orderableFieldName:!r.orderable||Array.isArray(r.collection)?void 0:`_${r.collection}_${i.replaceAll(".","_")}_order`,query:et,children:(0,p.jsxs)(cv,{collectionSlug:D?b[0]:b,columnState:W,LinkedCellOverride:(0,p.jsx)(du,{currentDrawerID:F,onDrawerOpen:J}),children:[(0,p.jsx)(l2,{className:`${dv}__columns`,height:N?"auto":0,id:`${dv}-columns`,children:(0,p.jsx)("div",{className:`${dv}__columns-inner`,children:E&&(0,p.jsx)(cw,{collectionSlug:E.slug})})}),v,(0,p.jsx)(db,{})]})})})]}),t,(0,p.jsx)(M,{initialData:f,onDelete:Z,onSave:X})]})},dx="default"in ca.default?ca.default.default:ca.default,dw=({collectionSlug:e,config:t,docID:n,fields:a,segments:l})=>{let r=(0,k.L)(a,{keepPresentationalFields:!0}),i=l[0],o=r.find(e=>e.name===i);if(!o)return null;if("relationship"===o.type||"upload"===o.type){let t=n;return Array.isArray(o.relationTo)&&(t={relationTo:e,value:n}),{[o.name]:o.hasMany?[t]:t}}let s=l.slice(1,l.length);if("tab"===o.type||"group"===o.type&&(0,b.Z7)(o))return{[o.name]:dw({collectionSlug:e,config:t,docID:n,fields:o.fields,segments:s})};if("array"===o.type){let a=dw({collectionSlug:e,config:t,docID:n,fields:o.fields,segments:s});return a.id=dx().toHexString(),{[o.name]:[a]}}if("blocks"===o.type)for(let a of o.blockReferences??o.blocks){let l="string"==typeof a?t.blocksMap[a]:a,r=dw({collectionSlug:e,config:t,docID:n,fields:l.fields,segments:s});if(r)return r.id=dx().toHexString(),r.blockType=l.slug,{[o.name]:[r]}}},dj=lU(e=>{let{field:t,field:{admin:{allowCreate:n,description:a},collection:l,label:r,localized:i,on:s,required:d},path:u}=e,{id:h,docConfig:f}=lE(),{config:m,getEntityConfig:g}=(0,c.c)(),{customComponents:{AfterInput:b,BeforeInput:v,Description:y,Error:x,Label:w}={},path:j,showError:C,value:S}=lI({potentiallyStalePath:u}),k=(0,o.useMemo)(()=>
41{if(!h)return null;let e=h;Array.isArray(t.targetField.relationTo)&&(e={relationTo:f.slug,value:e});let n=Array.isArray(l)?{}:{[s]:{equals:e}};return t.where?{and:[n,t.where]}:n},[h,l,t.targetField.relationTo,t.where,s,f?.slug]),_=(0,o.useMemo)(()=>{let e=g({collectionSlug:Array.isArray(t.collection)?t.collection[0]:t.collection});return dw({collectionSlug:f?.slug,config:m,docID:h,fields:e?.fields,segments:t.on.split(".")})},[g,t.collection,t.on,f?.slug,h,m]);return f?(0,p.jsxs)("div",{className:[lH,C&&"error","join"].filter(Boolean).join(" "),id:`field-${j?.replace(/\./g,"__")}`,children:[(0,p.jsx)(em,{CustomComponent:x,Fallback:(0,p.jsx)(ni,{path:j,showError:C})}),(0,p.jsx)(dy,{AfterInput:b,allowCreate:"u">typeof h&&n,BeforeInput:v,disableTable:null===k,field:t,fieldPath:j,filterOptions:k,initialData:h&&S?S:{docs:[]},initialDrawerData:_,Label:(0,p.jsx)("h4",{style:{margin:0},children:w||(0,p.jsx)(aD,{label:r,localized:i,path:j,required:d})}),parent:"u">typeof h?{id:h,collectionSlug:f.slug,joinPath:j}:void 0,relationTo:l}),(0,p.jsx)(em,{CustomComponent:y,Fallback:(0,p.jsx)(nr,{description:a,path:j})})]}):null}),dC=lU(e=>{let{field:t,field:{admin:{className:n,description:a,editorOptions:l,maxHeight:r}={},jsonSchema:i,label:s,localized:d,required:u},path:h,readOnly:f,validate:m}=e,{insertSpaces:g=c.k.insertSpaces,tabSize:b=c.k.tabSize}=l||{},v=(0,o.useCallback)(e=>{if(void 0!==e)return null===e?"":g?JSON.stringify(e,null,b):JSON.stringify(e,null,"	")},[b,g]),[y,x]=(0,o.useState)(),w=o.useRef("formState"),[j,C]=(0,o.useState)(Date.now()),{customComponents:{AfterInput:S,BeforeInput:k,Description:_,Error:$,Label:N}={},disabled:P,initialValue:E,path:D,setValue:T,showError:A,value:R}=lI({potentiallyStalePath:h,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof m)return m(e,{...t,jsonError:y,required:u})},[m,u,y])}),L=o.useRef(v(R??E)),F=(0,o.useCallback)((e,t)=>{if(!i)return;t.languages.json.jsonDefaults.setDiagnosticsOptions({enableSchemaRequest:!0,schemas:[...t.languages.json.jsonDefaults.diagnosticsOptions.schemas||[],i],validate:!0});let n=i.uri,a=n.includes("?")?`${n}&${crypto.randomUUID?crypto.randomUUID():ru()}`:`${n}?${crypto.randomUUID?crypto.randomUUID():ru()}`;e.setModel(t.editor.createModel(v(R)||"","json",t.Uri.parse(a)))},[i,v,R]),O=(0,o.useCallback)(e=>{if(!(f||P)){w.current="internalEditor";try{T(e?JSON.parse(e):null),L.current=e,x(void 0)}catch(t){T(e||null),L.current=e,x(t)}}},[f,P,T]);(0,o.useEffect)(()=>{if("formState"===w.current){let e=v(R??E);e!==L.current&&(L.current=e,C(Date.now()))}w.current="formState"},[E,D,v,R]);let M=(0,o.useMemo)(()=>lV(t),[t]);return(0,p.jsxs)("div",{className:[lH,"json-field",n,A&&"error",(f||P)&&"read-only"].filter(
41Boolean).join(" "),style:M,children:[(0,p.jsx)(em,{CustomComponent:N,Fallback:(0,p.jsx)(aD,{label:s,localized:d,path:D,required:u})}),(0,p.jsxs)("div",{className:`${lH}__wrap`,children:[(0,p.jsx)(em,{CustomComponent:$,Fallback:(0,p.jsx)(ni,{message:y,path:D,showError:A})}),k,(0,p.jsx)(r$,{defaultLanguage:"json",maxHeight:r,onChange:O,onMount:F,options:l,readOnly:f||P,recalculatedHeightAt:j,value:L.current,wrapperProps:{id:`field-${D?.replace(/\./g,"__")}`}}),S]}),(0,p.jsx)(em,{CustomComponent:_,Fallback:(0,p.jsx)(nr,{description:a,path:D})})]})}),dS=lU(e=>{let{field:t,field:{admin:{className:n,description:a,placeholder:l,step:r=1}={},hasMany:i=!1,label:s,localized:c,max:u=1/0,maxRows:f=1/0,min:m=-1/0,required:g},onChange:b,path:v,readOnly:y,validate:x}=e,{i18n:w,t:j}=(0,d.d)(),{customComponents:{AfterInput:C,BeforeInput:S,Description:k,Error:_,Label:$}={},disabled:N,path:P,setValue:E,showError:D,value:T}=lI({potentiallyStalePath:v,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof x)return x(e,{...t,max:u,min:m,required:g})},[x,m,u,g])}),R=(0,o.useCallback)(e=>{let t=parseFloat(e.target.value),n=t;Number.isNaN(t)&&(n=null),"function"==typeof b&&b(n),E(n)},[b,E]),[L,F]=(0,o.useState)([]),O=(0,o.useCallback)(e=>{!(y||N)&&E(e?Array.isArray(e)?e.map(e=>Number(e.value?.value||e.value)):[Number(e.value?.value||e.value)]:[])},[y,N,E]);(0,o.useEffect)(()=>{i&&Array.isArray(T)&&F(T.map((e,t)=>({id:`${e}${t}`,label:`${e}`,value:{toString:()=>`${e}${t}`,value:e?.value||e}})))},[T,i]);let M=(0,o.useMemo)(()=>lV(t),[t]),I=(0,h.s)(l,w);return(0,p.jsxs)("div",{className:[lH,"number",n,D&&"error",(y||N)&&"read-only",i&&"has-many"].filter(Boolean).join(" "),style:M,children:[(0,p.jsx)(em,{CustomComponent:$,Fallback:(0,p.jsx)(aD,{label:s,localized:c,path:P,required:g})}),(0,p.jsxs)("div",{className:`${lH}__wrap`,children:[(0,p.jsx)(em,{CustomComponent:_,Fallback:(0,p.jsx)(ni,{path:P,showError:D})}),S,i?(0,p.jsx)(sZ,{className:`field-${P.replace(/\./g,"__")}`,disabled:y||N,filterOption:(e,t)=>{let n=Array.isArray(T)&&T.length>=f;return(0,A.E)(t)&&!n},isClearable:!0,isCreatable:!0,isMulti:!0,isSortable:!0,noOptionsMessage:()=>Array.isArray(T)&&T.length>=f?j("validation:limitReached",{max:f,value:T.length+1}):null,onChange:O,options:[],placeholder:I,showError:D,value:L}):(0,p.jsx)("div",{children:(0,p.jsx)("input",{disabled:y||N,id:`field-${P.replace(/\./g,"__")}`,max:u,min:m,name:P,onChange:R,onWheel:e=>{e.target.blur()},placeholder:I,step:r,type:"number",value:"number"==typeof T?T:""})}),C,(0,p.jsx)(em,{CustomComponent:k,Fallback:(0,p.jsx)(nr,{description:a,path:P})})]})]})}),dk="point",d_=lU(e=>{let{field:t,field:{admin:{className:n,description:a,placeholder:l,step:r}={},label:i,localized:s,required:c},path:u,readOnly:f,validate:m}=e,{i18n:g,t:b}=(0,d.d)(),{customComponents:{AfterInput:v,BeforeInput:y,Description:x,Error:w,Label:j}={},disabled:C,path:S,setValue:k,showError:_,value:$=[null,null]}=lI({potentiallyStalePath:u,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof m)return m(e,{...t,required:c})},[m,c])}),N=(0,o.useCallback)((e,t)=>{let n=parseFloat(e.target.value);Number.isNaN(n)&&(n=e.target.value);let a=[...$];a[t]=n,k(a)},[k,$]),P=e=>{let t=b("longitude"===e?"fields:longitude":"fields:latitude"),n=i?(0,h.s)(i,g):"";return`${n}${n?" - ":""}${t}`},E=(0,o.useMemo)(()=>lV(t),[t]);return(0,p.jsxs)("div",{className:[lH,dk,n,_&&"error",(f||C)&&"read-only"].filter(
41Boolean).join(" "),style:E,children:[(0,p.jsxs)("ul",{className:`${dk}__wrap`,children:[(0,p.jsxs)("li",{children:[(0,p.jsx)(em,{CustomComponent:j,Fallback:(0,p.jsx)(aD,{label:P("longitude"),localized:s,path:S,required:c})}),(0,p.jsxs)("div",{className:"input-wrapper",children:[y,(0,p.jsx)("input",{disabled:f||C,id:`field-longitude-${S?.replace(/\./g,"__")}`,name:`${S}.longitude`,onChange:e=>N(e,0),placeholder:(0,h.s)(l,g),step:r,type:"number",value:$&&"number"==typeof $[0]?$[0]:""}),v]})]}),(0,p.jsxs)("li",{children:[(0,p.jsx)(em,{CustomComponent:j,Fallback:(0,p.jsx)(aD,{label:P("latitude"),localized:s,path:S,required:c})}),(0,p.jsxs)("div",{className:"input-wrapper",children:[(0,p.jsx)(em,{CustomComponent:w,Fallback:(0,p.jsx)(ni,{path:S,showError:_})}),y,(0,p.jsx)("input",{disabled:f||C,id:`field-latitude-${S?.replace(/\./g,"__")}`,name:`${S}.latitude`,onChange:e=>N(e,1),placeholder:(0,h.s)(l,g),step:r,type:"number",value:$&&"number"==typeof $[1]?$[1]:""}),v]})]})]}),(0,p.jsx)(em,{CustomComponent:x,Fallback:(0,p.jsx)(nr,{description:a,path:S})})]})}),d$="radio-input",dN=e=>{let t,n=(0,g.c)(16),{isSelected:a,onChange:l,option:r,path:i,readOnly:o,uuid:s}=e,{i18n:c}=(0,d.d)(),u=nc(),f=`field-${i}-${r.value}${u>1?`-${u}`:""}${s?`-${s}`:""}`,m=a&&`${d$}--is-selected`,b;n[0]!==m?(b=[d$,m].filter(Boolean),n[0]=m,n[1]=b):b=n[1];let v=b.join(" "),y;if(n[2]!==l||n[3]!==r.value?(y=()=>"function"==typeof l?l(r.value):null,n[2]=l,n[3]=r.value,n[4]=y):y=n[4],n[5]!==c||n[6]!==f||n[7]!==a||n[8]!==r.label||n[9]!==i||n[10]!==o||n[11]!==v||n[12]!==y){let e=(0,p.jsx)("input",{checked:a,disabled:o,id:f,name:i,onChange:y,type:"radio"}),l=o&&`${d$}__styled-radio--disabled`,s;n[14]!==l?(s=[`${d$}__styled-radio`,l].filter(Boolean),n[14]=l,n[15]=s):s=n[15],t=(0,p.jsx)("label",{htmlFor:f,children:(0,p.jsxs)("div",{className:v,children:[e,(0,p.jsx)("span",{className:s.join(" ")}),(0,p.jsx)("span",{className:`${d$}__label`,children:(0,h.s)(r.label,c)})]})}),n[5]=c,n[6]=f,n[7]=a,n[8]=r.label,n[9]=i,n[10]=o,n[11]=v,n[12]=y,n[13]=t}else t=n[13];return t},dP="radio-group",dE=lU(e=>{let{disableModifyingForm:t,field:n,field:{admin:{className:a,description:l,layout:r="horizontal"}={},label:i,localized:s,options:c=[],required:d}={},onChange:u,path:h,readOnly:f,validate:m,value:g}=e,{uuid:v}=eT(),{customComponents:{AfterInput:y,BeforeInput:x,Description:w,Error:j,Label:C}={},disabled:S,path:k,setValue:_,showError:$,value:N}=lI({potentiallyStalePath:h,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof m)return m(e,{...t,options:c,required:d})},[m,c,d])}),P=N||g,E=(0,o.useMemo)(()=>lV(n),[n]);return(0,p.jsxs)("div",{className:[lH,dP,a,`${dP}--layout-${r}`,$&&"error",(f||S)&&`${dP}--read-only`].filter(Boolean).join(" "),style:E,children:[(0,p.jsx)(em,{CustomComponent:j,Fallback:(0,p.jsx)(ni,{path:k,showError:$})}),(0,p.jsx)(em,{CustomComponent:C,Fallback:(0,p.jsx)(aD,{label:i,localized:s,path:k,required:d})}),(0,p.jsxs)("div",{className:`${lH}__wrap`,children:[x,(0,p.jsx)("ul",{className:`${dP}--group`,id:`field-${k.replace(/\./g,"__")}`,children:c.map(e=>{let n="",a=String(n=(0,b.vs)(e)?e.value:e)===String(P),l=`field-${k}-${n}${v?`-${v}`:""}`;return(0,p.jsx)("li",{children:(0,p.jsx)(dN,{id:l,isSelected:a,onChange:()=>{"function"==typeof u&&u(n),f||S||_(n,!!t)},option:(0,b.vs)(e)?e:{label:e,value:e},path:k,readOnly:f||S,uuid:v})},`${k} - ${n}`)})}),y,(0,p.jsx)(em,{CustomComponent:w,Fallback:(0,p.jsx)(nr,{description:l,path:k})})]})]})}),dD="relationship-add-new",dT=e=>{let t,n,a,l,r,i,s=(0,g.c)(46),{Button:c,hasMany:u,onChange:f,path:m,relationTo:b,unstyled:v,value:y}=e,x=cj(b),{permissions:w}=aj(),[j,C]=(0,o.useState)(!1),[S,k]=(0,o.useState)(),_=x.length>1,$;s[0]!==x[0]||s[1]!==_?($=()=>_?void 0:x[0],s[0]=x[0],s[1]=_,s[2]=$):$=s[2];let[N,P]=(0,o.useState)($),[E,D]=(0,o.useState)(!1),{i18n:T,t:A}=(0,d.d)(),[R,F]=(0,o.useState)(!1),O=N?.slug,M;s[3]!==O?(M={collectionSlug:O},s[3]=O,s[4]=M):M=s[4];let[I,B,z]=cV(M),{isDrawerOpen:U,toggleDrawer:V}=z,H;s[5]!==N||s[6]!==u||s[7]!==f||s[8]!==y?(H=e=>{let{doc:t,operation:n}=e;("create"===n||"update"===n&&(0,L.s8)(N))&&(y&&(Array.isArray(y)?y.some(e=>e&&e.value===t.id):y.value===t.id)||f(!0===u?[...Array.isArray(y)?y:[],{relationTo:N?.slug,value:t.id}]:{relationTo:N?.slug,value:t.id}),k(void 0))},s[5]=N,s[6]=u,s[7]=f,s[8]=y,s[9]=H):H=s[9];let q=H,W;s[10]===Symbol.for("react.memo_cache_sentinel")?(W=e=>{D(e)},s[10]=W):W=s[10];let K=W,Q,Y;s[11]!==w||s[12]!==x?(Q=()=>{w&&(1===x.length?C(w.collections[x[0]?.slug]?.create):C(x.some(e=>w.collections[e?.slug]?.create)))},Y=[w,x],s[11]=w,s[12]=x,s[13]=Q,s[14]=Y):(Q=s[13],Y=s[14]),(0,o.useEffect)(Q,Y),s[15]!==x||s[16]!==_||s[17]!==S?(n=()=>{_&&S&&P(x.find(e=>e?.slug===S))},t=[S,_,x],s[15]=x,s[16]=_,s[17]=S,s[18]=t,s[19]=n):(t=s[18],n=s[19]),(0,o.useEffect)(n,t),s[20]!==N||s[21]!==_||s[22]!==V?(a=()=>{_&&N&&(V(),k(void 0))},l=[V,_,N],s[20]=N,s[21]=_,s[22]=V,s[23]=a,s[24]=l):(a=s[23],l=s[24]),(0,o.useEffect)(a,l),s[25]!==U||s[26]!==_?
41(r=()=>{_&&!U&&P(void 0)},i=[U,_],s[25]=U,s[26]=_,s[27]=r,s[28]=i):(r=s[27],i=s[28]),(0,o.useEffect)(r,i);let G=x[0]?.labels.singular,X,Z;if(s[29]!==c||s[30]!==I||s[31]!==B||s[32]!==N||s[33]!==T||s[34]!==q||s[35]!==m||s[36]!==w||s[37]!==E||s[38]!==x||s[39]!==j||s[40]!==R||s[41]!==A||s[42]!==G||s[43]!==v){Z=Symbol.for("react.early_return_sentinel");e:{let e=A("fields:addNewLabel",{label:(0,h.s)(G,T)});if(!j){Z=null;break e}X=(0,p.jsxs)("div",{className:dD,id:`${m}-add-new`,children:[1===x.length&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(B,{className:[`${dD}__add-button`,v&&`${dD}__add-button--unstyled`].filter(Boolean).join(" "),onClick:()=>{F(!1)},onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),children:c||(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(tk,{className:`${dD}__tooltip`,show:R,children:e}),(0,p.jsx)(td,{})]})}),(0,p.jsx)(I,{onSave:q})]}),x.length>1&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(tC,{button:c||(0,p.jsx)(tN,{buttonStyle:"none",className:`${dD}__add-button`,tooltip:E?void 0:A("fields:addNew"),children:(0,p.jsx)(td,{})}),buttonType:"custom",horizontalAlign:"center",onToggleOpen:K,render:e=>{let{close:t}=e;return(0,p.jsx)(tg,{children:x.map(e=>w.collections[e?.slug]?.create?(0,p.jsx)(tb,{className:`${dD}__relation-button--${e?.slug}`,onClick:()=>{t(),k(e?.slug)},children:(0,h.s)(e?.labels?.singular,T)},e?.slug):null)})},size:"medium"}),N&&w.collections[N?.slug]?.create&&(0,p.jsx)(I,{onSave:q})]})]})}s[29]=c,s[30]=I,s[31]=B,s[32]=N,s[33]=T,s[34]=q,s[35]=m,s[36]=w,s[37]=E,s[38]=x,s[39]=j,s[40]=R,s[41]=A,s[42]=G,s[43]=v,s[44]=X,s[45]=Z}else X=s[44],Z=s[45];return Z!==Symbol.for("react.early_return_sentinel")?Z:X},dA=({allowCreate:e=!0,collectionSlugs:t,disableQueryPresets:n,drawerSlug:a,enableRowSelections:l,filterOptions:r,onBulkSelect:i,onSelect:s,overrideEntityVisibility:d=!0,selectedCollection:u})=>{let{closeModal:h,isModalOpen:f}=nN(),{serverFunction:m}=cf(),[g,b]=(0,o.useState)(void 0),[v,y]=(0,o.useState)(!0),{config:{collections:x},getEntityConfig:w}=(0,c.c)(),j=f(a),C=x.filter(({slug:e})=>t.includes(e)),[S,k]=(0,o.useState)(()=>{let e=w({collectionSlug:u||C[0]?.slug});return e?{label:e.labels,value:e.slug}:void 0}),[$,N,{drawerSlug:P}]=cV({collectionSlug:S.value}),E=tv(e=>{e&&e!==S?.value&&k({label:w({collectionSlug:e})?.labels,value:e})});(0,o.useEffect)(()=>{E(u)},[u]);let D=(0,o.useCallback)(async({slug:e,query:t})=>{try{let i={...t||{},where:{...t?.where||{}}},o=r?.[e];
41if(r&&"boolean"!=typeof o&&(i.where=(0,_.Y)(i.where,o)),e){let t=await m({name:"render-list",args:{collectionSlug:e,disableBulkDelete:!0,disableBulkEdit:!0,disableQueryPresets:n,drawerSlug:a,enableRowSelections:l,overrideEntityVisibility:d,query:i}});b(t?.List||null)}else b(null);y(!1)}catch(e){console.error("Error rendering List View: ",e),j&&h(a)}},[m,h,a,j,l,r,d,n]);(0,o.useEffect)(()=>{g||D({slug:S?.value})},[D,g,S.value]);let T=(0,o.useCallback)(({doc:e})=>{"function"==typeof s&&s({collectionSlug:S?.value,doc:e,docID:e.id}),h(P),h(a)},[h,P,a,s,S.value]),A=(0,o.useCallback)(e=>{D({slug:S?.value,query:e})},[D,S.value]),R=(0,o.useCallback)(e=>{k(e),D({slug:e?.value})},[D]),L=(0,o.useCallback)(async e=>{e&&k({label:w({collectionSlug:e})?.labels,value:e}),await D({slug:S.value||e})},[w,D,S.value]);return v?(0,p.jsx)(cE,{}):(0,p.jsxs)(cr,{allowCreate:e,createNewDrawerSlug:P,DocumentDrawerToggler:N,drawerSlug:a,enabledCollections:t,onBulkSelect:e=>i?.(e,S.value),onQueryChange:A,onSelect:s,refresh:L,selectedOption:S,setSelectedOption:R,children:[g,(0,p.jsx)($,{onSave:T})]})},dR="list-drawer",dL=({children:e,className:t,disabled:n,drawerSlug:a,onClick:l,...r})=>(0,p.jsx)(ad,{className:[t,`${dR}
41__toggler`].filter(Boolean).join(" "),disabled:n,onClick:l,slug:a,...r,children:e}),dF=e=>{let{drawerSlug:t}=e;return(0,p.jsx)(au,{className:dR,gutter:!1,Header:null,slug:t,children:(0,p.jsx)(dA,{...e})})},dO=e=>{let t,n,a,l=(0,g.c)(42),{collectionSlugs:r,filterOptions:i,selectedCollection:s,uploads:d}=e,{config:u}=(0,c.c)(),{collections:h}=u,f=nc(),m=(0,o.useId)(),{closeModal:b,modalState:v,openModal:y,toggleModal:x}=nN(),[w,j]=(0,o.useState)(!1),[C,S]=(0,o.useState)(r),k;l[0]!==f||l[1]!==m?(k=(({depth:e,uuid:t})=>`list-drawer_${e}_${t}`)({depth:f,uuid:m}),l[0]=f,l[1]=m,l[2]=k):k=l[2];let _=k,$,N;l[3]!==_||l[4]!==v?($=()=>{j(!!v[_]?.isOpen)},N=[v,_],l[3]=_,l[4]=v,l[5]=$,l[6]=N):($=l[5],N=l[6]),(0,o.useEffect)($,N),l[7]!==C||l[8]!==h||l[9]!==d?(t=()=>{C&&0!==C.length||S(h.filter(e=>{let{upload:t}=e;return!d||!!t}).map(dM))},n=[C,d,h],l[7]=C,l[8]=h,l[9]=d,l[10]=t,l[11]=n):(t=l[10],n=l[11]),(0,o.useEffect)(t,n),l[12]!==_||l[13]!==x?(a=()=>{x(_)},l[12]=_,l[13]=x,l[14]=a):a=l[14];let P=a,E;l[15]!==b||l[16]!==_?(E=()=>{b(_)},l[15]=b,l[16]=_,l[17]=E):E=l[17];let D=E,T;l[18]!==_||l[19]!==y?(T=()=>{y(_)},l[18]=_,l[19]=y,l[20]=T):T=l[20];let A=T,R;l[21]!==D||l[22]!==C||l[23]!==_||l[24]!==i||l[25]!==s||l[26]!==d?(R=e=>(0,o.createElement)(dF,{...e,closeDrawer:D,collectionSlugs:C,drawerSlug:_,filterOptions:i,key:_,selectedCollection:s,uploads:d}),l[21]=D,l[22]=C,l[23]=_,l[24]=i,l[25]=s,l[26]=d,l[27]=R):R=l[27];let L=R,F;l[28]!==_?(F=e=>(0,p.jsx)(dL,{...e,drawerSlug:_}),l[28]=_,l[29]=F):F=l[29];let O=F,M;l[30]!==D||l[31]!==C||l[32]!==f||l[33]!==_||l[34]!==w||l[35]!==A||l[36]!==P?(M={closeDrawer:D,collectionSlugs:C,drawerDepth:f,drawerSlug:_,isDrawerOpen:w,openDrawer:A,setCollectionSlugs:S,toggleDrawer:P},l[30]=D,l[31]=C,l[32]=f,l[33]=_,l[34]=w,l[35]=A,l[36]=P,l[37]=M):M=l[37];let I=M,B;return l[38]!==L||l[39]!==I||l[40]!==O?(B=[L,O,I],l[38]=L,l[39]=I,l[40]=O,l[41]=B):B=l[41],B};function dM(e){let{slug:t}=e;return t}var dI=(e,t)=>{let n=(0,g.c)(3),a=(0,o.useRef)(void 0),l;return n[0]!==e||n[1]!==t?(l=(...n)=>{clearTimeout(a.current),a.current=setTimeout(()=>{clearTimeout(a.current),e(...n)},t)},n[0]=e,n[1]=t,n[2]=l):l=n[2],l};function dB(){let e=(0,o.useRef)([]),t=(0,o.useRef)(!1);return{queueTask:(0,o.useCallback)((n,a)=>{e.current.push(n),async function(){if(!t.current&&("function"!=typeof a?.beforeProcess||!1!==a.beforeProcess()))for(;e.current.length>0;){let n=e.current.pop();e.current=[],t.current=!0;try{await n()}catch(e){console.error("Error in queued function:",e)}finally{t.current=!1,"function"==typeof a?.afterProcess&&a.afterProcess()}}}()},[])}}
41var dz=(0,o.createContext)({mostRecentUpdate:null,reportUpdate:()=>null}),dU=e=>{let t=(0,g.c)(3),{children:n}=e,[a,l]=(0,o.useState)(null),r;return t[0]!==n||t[1]!==a?(r=(0,p.jsx)(dz,{value:{mostRecentUpdate:a,reportUpdate:l},children:n}),t[0]=n,t[1]=a,t[2]=r):r=t[2],r},dV=()=>(0,o.use)(dz),dH=e=>{for(let t in e){let n=e[t];if(("and"===t.toLowerCase()||"or"===t.toLowerCase())&&Array.isArray(n))for(let e of n)dH(e);else n&&"object"==typeof n&&"in"in n&&Array.isArray(n.in)&&0===n.in.length&&(e[t]={exists:!1})}return e},dq=({hasMany:e,relationTo:t,value:n})=>{let a=t.reduce((e,t)=>({...e,[t]:[]}),{});if(null===n)return a;if(n){let t=(e,t)=>{("string"==typeof t||"number"==typeof t)&&"string"==typeof e&&(a[e]?a[e].push(t):a[e]=[t])};!0===e?n.forEach(e=>{e&&t(e.relationTo,e.value)}):t(n.relationTo,n.value)}return a},dW=e=>e.reduce((e,t)=>t.options?[...e,...dW(t.options)]:[...e,{id:t.value,relationTo:t.relationTo}],[]),dK=e=>e.sort((e,t)=>"function"==typeof e?.label?.localeCompare&&"function"==typeof t?.label?.localeCompare?e.label.localeCompare(t.label):0),dQ=(e,t)=>{switch(t.type){case"ADD":{let{collection:n,config:a,docs:l,i18n:r,ids:i=[],sort:o}=t,s=n.slug,c=dW(e),d=[...e],u=d.find(e=>e.label===n.labels.plural),p=l.reduce((e,t)=>0===c.filter(e=>e.id===t.id&&e.relationTo===s).length?(c.push({id:t.id,relationTo:s}),[...e,{label:lb({collectionConfig:n,data:t,dateFormat:a.admin.dateFormat,fallback:`${r.t("general:untitled")} - ID: ${t.id}`,i18n:r}),relationTo:s,value:t.id}]):e,[]);if(i.forEach(e=>{0===c.filter(t=>t.id===e&&t.relationTo===s).length&&(c.push({id:e,relationTo:s}),p.push({allowEdit:!1,label:`${r.t("general:untitled")} - ID: ${e}`,relationTo:s,value:e}))}),u){let e=[...u.options,...p];u.options=o?dK(e):e}else d.push({label:(0,h.s)(n.labels.plural,r),options:o?dK(p):p});return d}case"CLEAR":{let n=t.exemptValues?Array.isArray(t.exemptValues)?t.exemptValues:[t.exemptValues]:[];return e.filter(e=>{let t=e.options.filter(e=>!!n&&n.some(t=>t&&e.value===t.value));return e.options=t,t.length>0})}case"REMOVE":{let{id:n,collection:a}=t,l=[...e],r=l.findIndex(e=>e.label===a.labels.plural);return -1===r||(l[r]={...l[r],options:l[r].options.filter(e=>e.value!==n)}),l}case"UPDATE":{let{collection:n,config:a,doc:l,i18n:r}=t,i=n.slug,o=[...e],s=lb({collectionConfig:n,data:l,dateFormat:a.admin.dateFormat,fallback:`${r.t("general:untitled")} - ID: ${l.id}`,i18n:r}),c=o.find(e=>e.label===n.labels.plural)?.options?.find(e=>e.value===l.id);return c&&(c.label=s,c.relationTo=i),o}default:return e}},dY="relationship--multi-value-label",dG=e=>{let{data:t,selectProps:n}=e,{allowEdit:a,label:l,relationTo:r,value:i}=t,{customProps:s}=void 0===n?{}:n,{draggableProps:c,onDocumentOpen:u}=void 0===s?{}:s,{permissions:h}=aj(),[f,m]=(0,o.useState)(!1),{t:g}=(0,d.d)(),b=!!h?.collections?.[r]?.read;return(0,p.jsxs)("div",{className:dY,title:l||"",children:[(0,p.jsx)("div",{className:`${dY}__content`,children:(0,p.jsx)(oA.MultiValueLabel,{...e,innerProps:{className:`${dY}__text`,...c||{}}})}),r&&b&&!1!==a&&(0,p.jsx)(o.Fragment,{children:(0,p.jsxs)("button",{"aria-label":`Edit ${l}`,className:`${dY}__drawer-toggler`,onClick:e=>{m(!1),u({id:i,collectionSlug:r,hasReadPermission:b,openInNewTab:e.metaKey||e.ctrlKey})},onKeyDown:dX,onMouseDown:dZ,onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),onTouchEnd:dJ,type:"button",children:[(0,p.jsx)(tk,{className:`${dY}__tooltip`,show:f,children:g("general:editLabel",{label:""})}),(0,p.jsx)(ts,{className:`${dY}__icon`})]})})]})};function dX(e){"Enter"===e.key&&e.stopPropagation()}function dZ(e){return e.stopPropagation()}function dJ(e){return e.stopPropagation()}var d0="relationship--single-value",d1=e=>{let t=(0,g.c)(16),{children:n,data:a,selectProps:l}=e,{allowEdit:r,label:i,relationTo:s,value:c}=a,u;t[0]!==l?(u=void 0===l?{}:l,t[0]=l,t[1]=u):u=t[1];let{customProps:h}=u,f;t[2]!==h?(f=void 0===h?{}:h,t[2]=h,t[3]=f):f=t[3];let{onDocumentOpen:m}=f,[b,v]=(0,o.useState)(!1),{t:y}=(0,d.d)(),{permissions:x}=aj(),w=!!x?.collections?.[s]?.read,j=i||"",C;return t[4]!==r||t[5]!==n||t[6]!==w||t[7]!==i||t[8]!==m||t[9]!==e||t[10]!==s||t[11]!==b||t[12]!==y||t[13]!==j||t[14]!==c?(C=(0,p.jsx)(oA.SingleValue,{...e,className:d0,children:(0,p.jsx)("div",{className:`${d0}__label`,title:j,children:(0,p.jsxs)("div",{className:`${d0}__label-text`,children:[(0,p.jsx)("div",{className:`${d0}__text`,children:n}),s&&w&&!1!==r&&(0,p.jsx)(o.Fragment,{children:(0,p.jsxs)("button",{"aria-label":y("general:editLabel",{label:i}),className:`${d0}__drawer-toggler`,onClick:e=>{v(!1),m({id:c,collectionSlug:s,hasReadPermission:w,openInNewTab:e.metaKey||e.ctrlKey})},onKeyDown:d3,onMouseDown:d2,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),onTouchEnd:d6,type:"button",children:[(0,p.jsx)(tk,{className:`${d0}__tooltip`,show:b,children:y("general:edit")}),(0,p.jsx)(ts,{})]})})]})})}),t[4]=r,t[5]=n,t[6]=w,t[7]=i,t[8]=m,t[9]=e,t[10]=s,t[11]=b,t[12]=y,t[13]=j,t[14]=c,t[15]=C):C=t[15],C};function d3(e){"Enter"===e.key&&e.stopPropagation()}function d2(e){return e.stopPropagation()}function d6(e){return e.stopPropagation()}var d5="relationship",d4=e=>{let{AfterInput:t,allowCreate:n=!0,allowEdit:a=!0,appearance:l="select",BeforeInput:r,className:i,description:s,Description:u,Error:h,filterOptions:f,formatDisplayedOptions:m,hasMany:g,initialValue:b,isSortable:v=!0,label:w,Label:C,localized:S,maxResultsPerRequest:k=10,onChange:_,path:$,placeholder:N,readOnly:P,relationTo:E,required:D,showError:T,sortOptions:A,style:L,value:F}=e,{config:O,getEntityConfig:M}=(0,c.c)(),{routes:{api:I},serverURL:B}=O,{i18n:z,t:U}=(0,d.d)(),{permissions:V}=aj(),{code:H}=aN(),[q,W]=(0,o.useState)({id:void 0,collectionSlug:void 0,hasReadPermission:!1}),[K,Q]=(0,o.useState)(-1),[Y,G]=(0,o.useState)({}),[X,Z]=(0,o.useState)(""),[J,ee]=(0,o.useState)(""),[et,en]=(0,o.useState)(!1),[ea,el]=(0,o.useState)(!1),[er,ei]=(0,o.useState)(!1),eo=(0,o.useRef)(!1),{queueTask:es}
41=dB(),[ec,ed]=(0,o.useReducer)(dQ,[]),eu=(0,o.useRef)(F),[ep,,{drawerSlug:eh,isDrawerOpen:ef,openDrawer:eg}]=cV({id:q.id,collectionSlug:q.collectionSlug}),eb=(0,o.useMemo)(()=>{let e=f;if(F){let t=(!1===g?[F]:F).reduce((e,t)=>(e[t.relationTo]||(e[t.relationTo]=[]),e[t.relationTo].push(t.value),e),{});(Array.isArray(E)?E:[E]).forEach(n=>{e={...e||{},[n]:{..."object"==typeof f?.[n]?f[n]:{},...t[n]?{id:{not_in:t[n]}}:{}}}})}return e},[f,F,g,E]),[ev,,{closeDrawer:ey,isDrawerOpen:ex,openDrawer:ew}]=dO({collectionSlugs:E,filterOptions:eb}),ej=(0,o.useCallback)(({collectionSlug:e,doc:t})=>{g?_([...Array.isArray(F)?F:[],{relationTo:e,value:t.id}]):!1===g&&_({relationTo:e,value:t.id}),ey()},[g,_,ey,F]),eC=(0,o.useRef)(!1),eS=(0,o.useCallback)(({filterOptions:e,hasMany:t,lastFullyLoadedRelation:n,lastLoadedPage:a,onSuccess:l,search:r,sort:i,value:o})=>{V&&es(async()=>{let s="u">typeof n?n:-1,c=Array.isArray(E)?E:[E],d=-1===s?c:c.slice(s+1),u=0,p=dq(!0===t?{hasMany:!0,relationTo:E,value:o}:{hasMany:!1,relationTo:E,value:o});X||(await d.reduce(async(t,n)=>{let l=e?.[n],o;if(o=J!==r?1:(a[n]||0)+1,await t,!1===l)return Q(c.indexOf(n)),Promise.resolve();if(u<10){let e=M({collectionSlug:n}),t=e?.admin?.useAsTitle||"id",a=e?.defaultSort||"id";"string"==typeof A?a=A:A?.[n]&&(a=A[n]);let s={depth:0,draft:!0,limit:k,locale:H,page:o,select:{[t]:!0},sort:a,where:{and:[{id:{not_in:p[n]}}]}};r&&s.where.and.push({[t]:{like:r}}),l&&"boolean"!=typeof l&&s.where.and.push(l),dH(s.where);let d=await fetch((0,y.Q)({apiRoute:I,path:`/${n}`}),{body:x.A(s),credentials:"include",headers:{"Accept-Language":z.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"},method:"POST"});if(d.ok){let t=await d.json();G(e=>({...e,[n]:o})),t.nextPage||Q(c.indexOf(n)),t.docs.length>0&&(u+=t.docs.length,ed({type:"ADD",collection:e,config:O,docs:t.docs,i18n:z,sort:i}))}else 403===d.status?(Q(c.indexOf(n)),ed({type:"ADD",collection:e,config:O,docs:[],i18n:z,ids:p[n],sort:i})):Z(U("error:unspecific"))}},Promise.resolve()),"function"==typeof l&&l())})},[V,es,E,X,J,M,A,k,H,I,z,O,U]),ek=dI(({hasMany:e,search:t,value:n})=>{eR({filterOptions:f,lastLoadedPage:{},onSuccess:()=>{en(!1)},search:t,sort:!0,hasMany:e,value:n}),ee(t)},300),e_=(0,o.useCallback)(e=>{J!==e.search&&(en(!0),G({}),ek(e))},[J,ek]),e$=tv(({hasMany:e,value:t})=>{Object.entries(dq({hasMany:e,relationTo:E,value:t})).reduce(async(e,[t,n])=>{await e;let a=n.filter(e=>!ec.find(n=>n?.options?.find(n=>n.value===e&&n.relationTo===t)));if(a.length>0){let e=M({collectionSlug:t}),n=e?.admin?.useAsTitle||"id",l={depth:0,draft:!0,limit:a.length,locale:H,select:{[n]:!0},where:{id:{in:a}}};if(!X){let n=await fetch((0,y.Q)({apiRoute:I,path:`/${t}`}),{body:x.A(l),credentials:"include",headers:{"Accept-Language":z.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"},method:"POST"}),r=[];n.ok&&(r=(await n.json()).docs),ed({type:"ADD",collection:e,config:O,docs:r,i18n:z,ids:a,sort:!0})}}},Promise.resolve())}),{mostRecentUpdate:eN}=dV(),eP=tv(e=>{if(!F)return!1;let t=e.doc.id,n=!1;"update"===e.operation?!0===g?n=(Array.isArray(F)?F:[F]).some(n=>n.value===t&&n.relationTo===e.entitySlug):!1===g&&(n=F?.value===t&&F?.relationTo===e.entitySlug):"create"===e.operation&&(n=e.drawerSlug===eh),n&&((ed({type:"UPDATE",collection:M({collectionSlug:e.entitySlug}),config:O,doc:e.doc,i18n:z}),g)?_((F?Array.isArray(F)?F:[F]:[]).map(n=>({relationTo:n.value===t?e.entitySlug:n.relationTo,value:n.value}))):!1===g&&_({relationTo:e.entitySlug,value:t}))});(0,o.useEffect)(()=>{eN&&eP(eN)},[eN]);let eE=(0,o.useCallback)(e=>{ed({type:"ADD",collection:e.collectionConfig,config:O,docs:[e.doc],i18n:z,sort:!0}),g?_(F?F.concat({relationTo:e.collectionConfig.slug,value:e.doc.id}):null):!1===g&&_({relationTo:e.collectionConfig.slug,value:e.doc.id})},[z,O,g,_,F]),eD=(0,o.useCallback)(e=>{ed({id:e.id,type:"REMOVE",collection:e.collectionConfig,config:O,i18n:z}),_(g&&F?F.filter(t=>t.value!==e.id):null)},[z,O,g,_,F]),eT=(0,o.useCallback)((e,t)=>{if(!t)return!0;let n=(0,R.m)(t||""),a=String(e.label);for(;a.length>250;){let e=a.indexOf(" ",t.length);if(n.test(a.slice(0,-1===e?t.length:e+1)))return!0;a=a.slice(-1===e?t.length:e+1)}return n.test(a.slice(-250))},[]),eA=(0,o.useCallback)(({id:e,collectionSlug:t,hasReadPermission:n,openInNewTab:a})=>{if(a){if(n&&e&&t){let n=(0,y.Q)({adminRoute:O.routes.admin,path:`/collections/${t}/${e}`,serverURL:B});window.open(n,"_blank")}}else eC.current=!0,W({id:e,collectionSlug:t,hasReadPermission:n})},[O.routes.admin,B]),eR=tv(e=>eS(e));(0,o.useEffect)(()=>{eo.current&&er&&(en(!0),eR({filterOptions:f,lastLoadedPage:{},onSuccess:()=>{eo.current=!0,en(!1)},...{hasMany:g,value:eu.current}})),ed({type:"CLEAR",exemptValues:eu.current}),Q(-1),G({})},[E,f,H,$,er,g]);let eL=(0,o.useRef)(F),eF=(0,o.useRef)(!0);(0,o.useEffect)(()=>{(eF.current||!(0,j.j)(F,eL.current))&&e$({hasMany:g,value:F}),eF.current=!1,eL.current=F},[F,g]),(0,o.useEffect)(()=>{el(!(Array.isArray(E)?E:[E]).reduce((e,t)=>
41"id"===(M({collectionSlug:t})?.admin?.useAsTitle||"id")&&e,!0))},[E,M]),(0,o.useEffect)(()=>{eC.current&&(eg(),eC.current=!1)},[eg,q]),(0,o.useEffect)(()=>{eu.current=F},[F]);let eO=(({allowEdit:e,options:t,value:n})=>{if(n||"number"==typeof n){let a;return Array.isArray(n)?n.map(n=>{let a;return t.forEach(e=>{a||(a=e.options.find(e=>e.value===n.value&&e.relationTo===n.relationTo))}),a?{allowEdit:e,...a}:void 0}):(t.forEach(e=>{a||(a=e.options.find(e=>e.value===n.value&&e.relationTo===n.relationTo))}),a?{allowEdit:e,...a}:void 0)}})({allowEdit:a,options:ec,value:F});return Array.isArray(eO)||eO?.value!=="null"||(eO.value=null),(0,p.jsxs)("div",{className:[lH,d5,i,T&&"error",X&&"error-loading",P&&`${d5}--read-only`,!P&&n&&`${d5}--allow-create`].filter(Boolean).join(" "),id:`field-${$.replace(/\./g,"__")}`,style:L,children:[(0,p.jsx)(em,{CustomComponent:C,Fallback:(0,p.jsx)(aD,{label:w,localized:S,path:$,required:D})}),(0,p.jsxs)("div",{className:`${lH}__wrap`,children:[(0,p.jsx)(em,{CustomComponent:h,Fallback:(0,p.jsx)(ni,{path:$,showError:T})}),r,X?(0,p.jsx)("div",{className:`${d5}__error-loading`,children:X}):(0,p.jsxs)("div",{className:`${d5}__wrap`,children:[(0,p.jsx)(sZ,{backspaceRemovesValue:!(ef||ex),components:{MultiValueLabel:dG,SingleValue:d1,..."select"!==l&&{DropdownIndicator:null}},customProps:{disableKeyDown:ef||ex,disableMouseDown:ef||ex,onDocumentOpen:eA},disabled:P||ef||ex,filterOption:ea?eT:void 0,getOptionValue:e=>{if(e)return g&&Array.isArray(E)?`${e.relationTo}_${e.value}`:e.value},isLoading:"select"===l&&et,isMulti:g,isSearchable:"select"===l,isSortable:v,menuIsOpen:"select"===l&&er,onChange:P?void 0:e=>{g?null===e?(eu.current=[],_([])):(eu.current=e,_(e)):!1===g&&(null===e?(eu.current=null,_(null)):(eu.current=e,_(e)))},onInputChange:e=>e_({search:e,hasMany:g,value:F}),onMenuClose:()=>{ei(!1)},onMenuOpen:()=>{"drawer"===l?ew():"select"===l&&(ei(!0),eo.current||(en(!0),eR({filterOptions:f,lastLoadedPage:{},onSuccess:()=>{eo.current=!0,en(!1)},hasMany:g,value:F})))},onMenuScrollToBottom:()=>{en(!0),eR({filterOptions:f,lastFullyLoadedRelation:K,lastLoadedPage:Y,onSuccess:()=>{en(!1)},search:J,sort:!1,hasMany:g,value:b})},options:"function"==typeof m?m(ec):ec,placeholder:N,showError:T,value:eO??null}),!P&&n&&(0,p.jsx)(dT,{path:$,relationTo:E,hasMany:g,onChange:_,value:F})]}),t,(0,p.jsx)(em,{CustomComponent:u,Fallback:(0,p.jsx)(nr,{description:s,path:$})})]}),q.collectionSlug&&q.hasReadPermission&&(0,p.jsx)(ep,{onDelete:eD,onDuplicate:eE}),"drawer"===l&&!P&&(0,p.jsx)(ev,{allowCreate:n,enableRowSelections:!1,onSelect:ej})]})},d8=lU(e=>{let{field:t,field:{admin:{allowCreate:n=!0,allowEdit:a=!0,appearance:l="select",className:r,description:i,isSortable:s=!0,placeholder:c,sortOptions:d}={},hasMany:u,label:h,localized:f,relationTo:m,required:g},path:b,readOnly:v,validate:y}=e,{customComponents:{AfterInput:x,BeforeInput:w,Description:j,Error:C,Label:S}={},disabled:k,filterOptions:_,initialValue:$,path:N,setValue:P,showError:E,value:D}=lI({potentiallyStalePath:b,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof y)return y(e,{...t,required:g})},[y,g])}),T=(0,o.useMemo)(()=>lV(t),[t]),A=Array.isArray(m),[R]=o.useState(()=>Array.isArray(m)?m:[m]),L=(0,o.useCallback)(e=>{if(!e)return void P(null,e===D);let t=!1;t=A?Array.isArray(D)&&Array.isArray(e)&&D.length===e.length&&D.every((t,n)=>{let a=e[n];return t.value===a.value&&t.relationTo===a.relationTo}):Array.isArray(D)&&Array.isArray(e)&&D.length===e.length&&D.every((t,n)=>t===e[n].value),P(e.map(e=>A?e:e.value),t)},[A,P,D]),F=(0,o.useCallback)(e=>{if(!e)return void P(null,e===D);let t=!1;t=A?D&&e&&D.value===e.value&&D.relationTo===e.relationTo:D&&e&&D===e.value,P(A?e:e.value,t)},[A,P,D]),O=o.useMemo(()=>!0===u?Array.isArray(D)?D.map(e=>A?e:{relationTo:Array.isArray(R)?R[0]:R,value:e}):D:D&&(A?D:{relationTo:Array.isArray(R)?R[0]:R,value:D}),[u,D,A,R]),M=o.useMemo(()=>!0===u?Array.isArray($)?$.map(e=>A?e:{relationTo:Array.isArray(R)?R[0]:R,value:e}):$:$&&(A?$:{relationTo:Array.isArray(R)?R[0]:R,value:$}),[$,A,R,u]);return(0,p.jsx)(d4,{AfterInput:x,allowCreate:n,allowEdit:a,appearance:l,BeforeInput:w,className:r,Description:j,description:i,Error:C,filterOptions:_,formatDisplayedOptions:A?void 0:e=>e.map(e=>e.options).flat(),isSortable:s,Label:S,label:h,localized:f,maxResultsPerRequest:10,maxRows:t?.maxRows,minRows:t?.minRows,path:N,placeholder:c,readOnly:v||k,relationTo:R,required:g,showError:E,sortOptions:d,style:T,...!0===u?{hasMany:!0,initialValue:M,onChange:L,value:O}:{hasMany:!1,initialValue:M,onChange:F,value:O}})}),d7=()=>null,d9=lU(e=>{let{field:{admin:{className:t,style:n}={},fields:a},forceRender:l=!1,indexPath:r="",parentPath:i="",parentSchemaPath:o="",permissions:s,readOnly:c}=e;return(0,p.jsx)(s5,{children:(0,p.jsx)("div",{className:[lH,"row",t].filter(
41Boolean).join(" "),style:n||void 0,children:(0,p.jsx)(hU,{className:"row__fields",fields:a,forceRender:l,margins:!1,parentIndexPath:r,parentPath:i,parentSchemaPath:o,permissions:s,readOnly:c})})})}),ue=e=>{let t=(0,g.c)(37),{id:n,AfterInput:a,BeforeInput:l,className:r,Description:i,description:o,Error:s,filterOption:c,hasMany:u,isClearable:f,isSortable:m,label:b,Label:v,localized:y,onChange:x,onInputChange:w,options:j,path:C,placeholder:S,readOnly:k,required:_,showError:$,style:N,value:P}=e,E=void 0!==u&&u,D=void 0===f||f,T=void 0===m||m,{i18n:A}=(0,d.d)(),R;if(t[0]!==a||t[1]!==l||t[2]!==i||t[3]!==s||t[4]!==v||t[5]!==r||t[6]!==o||t[7]!==c||t[8]!==E||t[9]!==A||t[10]!==n||t[11]!==D||t[12]!==T||t[13]!==b||t[14]!==y||t[15]!==x||t[16]!==w||t[17]!==j||t[18]!==C||t[19]!==S||t[20]!==k||t[21]!==_||t[22]!==$||t[23]!==N||t[24]!==P){let e,d;if(E&&Array.isArray(P)){let n;t[26]!==A||t[27]!==j?(n=e=>{let t=j.find(t=>t.value===e);return{label:t?(0,h.s)(t.label,A):e,value:t?.value??e}},t[26]=A,t[27]=j,t[28]=n):n=t[28],e=P.map(n)}else if(P){let n;t[29]!==P?(n=e=>e.value===P,t[29]=P,t[30]=n):n=t[30];let a=j.find(n);e={label:a?(0,h.s)(a.label,A):P,value:a?.value??P}}else e=null;let u=$&&"error",f=k&&"read-only",m;t[31]!==r||t[32]!==u||t[33]!==f?(m=[lH,"select",r,u,f].filter(Boolean),t[31]=r,t[32]=u,t[33]=f,t[34]=m):m=t[34],t[35]!==A?(d=e=>({...e,label:(0,h.s)(e.label,A)}),t[35]=A,t[36]=d):d=t[36],R=(0,p.jsxs)("div",{className:m.join(" "),id:`field-${C.replace(/\./g,"__")}`,style:N,children:[(0,p.jsx)(em,{CustomComponent:v,Fallback:(0,p.jsx)(aD,{label:b,localized:y,path:C,required:_})}),(0,p.jsxs)("div",{className:`${lH}__wrap`,children:[(0,p.jsx)(em,{CustomComponent:s,Fallback:(0,p.jsx)(ni,{path:C,showError:$})}),l,(0,p.jsx)(sZ,{disabled:k,filterOption:c,id:n,isClearable:D,isMulti:E,isSortable:T,onChange:x,onInputChange:w,options:j.map(d),placeholder:S,showError:$,value:e}),a]}),(0,p.jsx)(em,{CustomComponent:i,Fallback:(0,p.jsx)(nr,{description:o,path:C})})]}),t[0]=a,t[1]=l,t[2]=i,t[3]=s,t[4]=v,t[5]=r,t[6]=o,t[7]=c,t[8]=E,t[9]=A,t[10]=n,t[11]=D,t[12]=T,t[13]=b,t[14]=y,t[15]=x,t[16]=w,t[17]=j,t[18]=C,t[19]=S,t[20]=k,t[21]=_,t[22]=$,t[23]=N,t[24]=P,t[25]=R}else R=t[25];return R},ut=e=>e.map(e=>"object"==typeof e&&(e.value||""===e.value)?e:{label:e,value:e}),un=lU(e=>{let{field:t,field:{name:n,admin:{className:a,description:l,isClearable:r=!0,isSortable:i=!0,placeholder:s}={},hasMany:c=!1,label:d,localized:u,options:h=[],required:f},onChange:m,path:g,readOnly:b,validate:v}=e,y=o.useMemo(()=>ut(h),[h]),{customComponents:{AfterInput:x,BeforeInput:w,Description:j,Error:C,Label:S}={},disabled:k,path:_,selectFilterOptions:$,setValue:N,showError:P,value:E}=lI({potentiallyStalePath:g,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof v)return v(e,{...t,hasMany:c,options:y,required:f})},[v,f,c,y])}),D=(0,o.useCallback)(e=>{if(!b||k){let t=null;e&&c?t=Array.isArray(e)?e.map(e=>e.value):[]:e&&!Array.isArray(e)&&(t=e.value),"function"==typeof m&&m(t),N(t)}},[b,k,c,N,m]),T=(0,o.useMemo)(()=>lV(t),[t]);return(0,p.jsx)(ue,{AfterInput:x,BeforeInput:w,className:a,Description:j,description:l,Error:C,filterOption:$?({label:e,value:t},n)=>$?.some(e=>("string"==typeof e?e:e.value)===t)&&e.toLowerCase().includes(n.toLowerCase()):void 0,hasMany:c,isClearable:r,isSortable:i,Label:S,label:d,localized:u,name:n,onChange:D,options:y,path:_,placeholder:s,readOnly:b||k,required:f,showError:P,style:T,value:E})}),ua=(0,u.e)(ed(),1);function ul(e){let t=(0,g.c)(5),{errorMessage:n}=e,a;t[0]!==n?(a=()=>(function(e){let t=e.indexOf(":"),n=t>=0?e.slice(0,t):e,a=t>=0?e.slice(t+1):void 0;if(!a)return{message:n};let l=a.split(",").map(e=>e.replaceAll(" > "," → ").trim());return 1===l.length?{errors:l,message:`${n}: `}:{errors:function(e){let t=[];for(let n of e)if(n){let e=n.split(" → "),a=!1;for(let l=0;l<t.length;l++)if(t[l].startsWith(e[0])){t.splice(l+1,0,n),a=!0;break}a||t.push(n)}return t}(l),message:`${n} (${l.length}):`}})(n),t[0]=n,t[1]=a):a=t[1];let[l]=o.useState(a),{errors:r,message:i}=l,s;return t[2]!==r||t[3]!==i?(s=(0,p.jsxs)("div",{children:[i,Array.isArray(r)&&r.length>0?1===r.length?(0,p.jsx)("span",{"data-testid":"field-error",children:r[0]}):(0,p.jsx)("ul",{"data-testid":"field-errors",children:r.map(ur)}):null]}),t[2]=r,t[3]=i,t[4]=s):s=t[4],s}function ur(e,t){return(0,p.jsx)("li",{children:e},t)}
41function ui(e,t,n){let a,l,r,i=(0,g.c)(11),s;i[0]!==e?(s=()=>e,i[0]=e,i[1]=s):s=i[1];let[c,d]=(0,o.useState)(s),u;i[2]!==n||i[3]!==e?(u=()=>{let t=setTimeout(()=>{d(()=>e)},n);return()=>{clearTimeout(t)}},i[2]=n,i[3]=e,i[4]=u):u=i[4],i[5]!==n||i[6]!==t?(a=[...t,n],i[5]=n,i[6]=t,i[7]=a):a=i[7],(0,o.useEffect)(u,a),i[8]!==c?(l=()=>{c()},r=[c],i[8]=c,i[9]=l,i[10]=r):(l=i[9],r=i[10]),(0,o.useEffect)(l,r)}var uo=o.createContext(null),us=({children:e})=>{let t=(0,o.useRef)(new Map),n=(0,o.useCallback)(({collectionSlug:e})=>t.current.get(e),[]),a=(0,o.useCallback)(({collectionSlug:e,handler:n})=>{t.current.set(e,n)},[]),l=(0,o.useMemo)(()=>({getUploadHandler:n,setUploadHandler:a}),[n,a]);return(0,p.jsx)(uo,{value:l,children:e})},uc=()=>{let e=o.use(uo);if(null===e)throw Error("useUploadHandlers must be used within UploadHandlersProvider");return e},ud={413:"Your request was too large to submit successfully."},uu=(0,u.e)(ei(),1),up=(e,t)=>{let n={},a=Object.entries(t).reduce((t,[a,l])=>{if(0===a.indexOf(`${e}.`)){let[n]=a.replace(`${e}.`,"").split(".");t[n]||(t[n]={}),t[n][a.replace(`${e}.${String(n)}.`,"")]={...l}}else n[a]=l;return t},[]);return{remainingFields:n,rows:a}},uh=(e,t)=>t.reduce((t,n,a)=>({...t,...Object.entries(n).reduce((t,[n,l])=>({...t,[`${e}.${a}.${n}`]:{...l}}),{})}),{}),uf="default"in uu.default?uu.default.default:uu.default;function um(e,t){switch(t.type){case"ADD_ROW":{let{blockType:n,path:a,rowIndex:l,subFieldState:r={}}=t,i="number"==typeof l?l:e[a]?.rows?.length||0,o=[...e[a]?.rows||[]],s={id:r?.id?.value||new uf().toHexString(),isLoading:!0};n&&(s.blockType=n),o.splice(i,0,s),n&&(r.blockType={initialValue:n,valid:!0,value:n});let{remainingFields:c,rows:d}=up(a,e);return d.splice(i,0,r),{...c,...uh(a,d),[`${a}.${i}.id`]:{initialValue:s.id,passesCondition:!0,valid:!0,value:s.id},[a]:{...e[a],disableFormData:!0,rows:o,value:d.length}}}case"ADD_SERVER_ERRORS":{let n={...e},a=[];return t.errors.forEach(({message:e,path:t})=>{n[t]={...n[t]||{initialValue:null,value:null},errorMessage:e,valid:!1};let l=t.split(".");l.length>1&&a.push({fieldErrorPath:t,parentPath:l.slice(0,l.length-1).join(".")})}),n=Object.entries(n).reduce((e,[t,n])=>{let l=a.reduce((e,{fieldErrorPath:n,parentPath:a})=>(a.startsWith(t)&&e.push(n),e),[]),r=!1;if(l.length>0){let a=Array.isArray(n.errorPaths)?n.errorPaths:[];l.forEach(e=>{a.includes(e)||(a.push(e),r=!0)}),r&&(e[t]={...n,errorPaths:a})}return r||(e[t]=n),e},{})}case"DUPLICATE_ROW":{let{path:n,rowIndex:a}=t,{remainingFields:l,rows:r}=up(n,e),i=[...e[n].rows||[]],o=(0,I.KS)(i[a]),s=new uf().toHexString();o.id&&(o.id=s),i[a]?.customComponents?.RowLabel&&(o.customComponents={RowLabel:i[a].customComponents.RowLabel});let c=(0,I.KS)(r[a]);for(let e of(c.id&&(c.id.value=s,c.id.initialValue=s),Object.keys(c).filter(e=>e.endsWith(".id")))){let t=c[e],n=new uf().toHexString();if(t&&"string"==typeof t.value&&uf.isValid(t.value)){c[e].value=n,c[e].initialValue=n;let t=e.split("."),a=parseInt(t[t.length-2],10),l=t.slice(0,t.length-2).join("."),r=c?.[l]?.rows;c[l]&&Array.isArray(r)&&(r[a]?r[a].id=n:r[a]={id:n})}}return Object.keys(c).length>0&&(r.splice(a+1,0,c),i.splice(a+1,0,o)),{...l,...uh(n,r),[n]:{...e[n],disableFormData:!0,rows:i,value:r.length}}}case"MERGE_SERVER_STATE":{let{acceptValues:n,prevStateRef:a,serverState:l}=t,r=(({acceptValues:e,currentState:t={},incomingState:n})=>{let a={...t};for(let[l,r]of Object.entries(n||{})){if(!(l in t)&&!r.addedByServer)continue;let i=r.addedByServer||!0===e||"object"==typeof e&&null!==e&&!1===e.overrideLocalChanges&&!t[l]?.isModified;if(i&&!r.addedByServer&&!0!==e){let e=function(e){let t=e.split("."),n=-1;for(let e=t.length-1;e>=0;e--)if(/^\d+$/.test(t[e])){n=e;break}return -1===n||n===t.length-1?null:{arrayPath:t.slice(0,n).join("."),fieldPath:t.slice(n+1).join("."),rowIndex:parseInt(t[n],10)}}(l);if(e){let{arrayPath:a,rowIndex:l}=e,r=t[a]?.rows?.[l]?.id,o=n[a]?.rows?.[l]?.id;(void 0===r||o&&r!==o)&&(i=!1)}}let o=r;if(!i){let{initialValue:e,value:t,...n}=r;o=n}a[l]={...t[l],...o},t[l]&&"errorPaths"in t[l]&&!("errorPaths"in r)&&(a[l].errorPaths=[]),Array.isArray(r.rows)&&l in t&&(!0===e?a[l].rows=r.rows.map((e,n)=>({...t[l]?.rows?.[n]||{},...e}
41)):(a[l].rows=[...t[l]?.rows||[]],r.rows.forEach(e=>{let n=t[l].rows?.findIndex(t=>t.id===e.id);if(n>-1)a[l].rows[n]={...t[l].rows[n],...e};else if(e.addedByServer){let t={...e};delete t.addedByServer,a[l].rows.push(t)}}),"value"in r&&a[l].rows.length!==r.value&&(a[l].value=a[l].rows.length))),!1!==r.valid&&(a[l].valid=!0),!1!==r.passesCondition&&(a[l].passesCondition=!0),r.blocksFilterOptions||delete a[l].blocksFilterOptions,delete a[l].addedByServer}return(0,j.j)(a,t)?t:a})({acceptValues:n,currentState:e||{},incomingState:l});return a.current=r,r}case"MOVE_ROW":{let{moveFromIndex:n,moveToIndex:a,path:l}=t,{remainingFields:r,rows:i}=up(l,e),o=i[n];i.splice(n,1),i.splice(a,0,o);let s=[...e[l]?.rows||[]],c={...s[n]};return s.splice(n,1),s.splice(a,0,c),{...r,...uh(l,i),[l]:{...e[l],rows:s}}}case"REMOVE":{let n={...e};return n[t.path]&&delete n[t.path],n}case"REMOVE_ROW":{let{path:n,rowIndex:a}=t,{remainingFields:l,rows:r}=up(n,e),i=[...e[n]?.rows||[]];return r.splice(a,1),i.splice(a,1),{...l,[n]:{...e[n],disableFormData:r.length>0,rows:i,value:r.length},...uh(n,r)}}case"REPLACE_ROW":{let{blockType:n,path:a,rowIndex:l,subFieldState:r={}}=t,{remainingFields:i,rows:o}=up(a,e),s=Math.max(0,Math.min(l,o?.length-1||0)),c=[...e[a]?.rows||[]];return c[s]={id:new uf().toHexString(),blockType:n||void 0,collapsed:!1},n&&(r.blockType={initialValue:n,valid:!0,value:n}),o[s]=r,{...i,...uh(a,o),[a]:{...e[a],disableFormData:!0,rows:c,value:o.length}}}case"REPLACE_STATE":if(!1!==t.optimize){let n={};for(let[a,l]of Object.entries(t.state)){let t=e[a];!1!==l.valid&&(l.valid=!0),!1!==l.passesCondition&&(l.passesCondition=!0),(0,j.j)(t,l)?t&&(n[a]=t):n[a]=l}return n}if(t.sanitize)for(let e of Object.values(t.state))!1!==e.valid&&(e.valid=!0),!1!==e.passesCondition&&(e.passesCondition=!0);return t.state;case"SET_ALL_ROWS_COLLAPSED":{let{path:n,updatedRows:a}=t;return{...e,[n]:{...e[n],rows:a}}}case"SET_ROW_COLLAPSED":{let{path:n,updatedRows:a}=t;return{...e,[n]:{...e[n],rows:a}}}case"UPDATE":{let n=Object.entries(t).reduce((e,[t,n])=>["disableFormData","errorMessage","initialValue","rows","valid","validate","value"].includes(t)?{...e,[t]:n,..."value"===t?{isModified:!0}:{}}:e,e?.[t.path]||{}),a={...e,[t.path]:n};if("value"in t){for(let[e,n]of Object.entries(a))if(e!==t.path&&"isModified"in n){let{isModified:t,...l}=n;a[e]=l}}return a}case"UPDATE_MANY":{let n={...e};return Object.entries(t.formState).forEach(([e,t])=>{n[e]=t}),n}default:return e}}var ug={addFieldRow:()=>{},buildRowErrors:()=>{},createFormData:()=>{},disabled:!1,dispatchFields:()=>{},fields:{},formRef:null,getData:()=>{},getDataByPath:()=>{},getField:()=>{},getFields:()=>({}),getSiblingData:()=>{},initializing:void 0,isValid:!0,moveFieldRow:()=>{},removeFieldRow:()=>{},replaceFieldRow:()=>{},replaceState:()=>{},reset:()=>{},setBackgroundProcessing:()=>{},setDisabled:()=>{},setIsValid:()=>{},setModified:()=>{},setProcessing:()=>{},setSubmitted:()=>{},submit:()=>{},validateForm:()=>{}},ub=e=>{let{id:t,collectionSlug:n,docConfig:a,docPermissions:l,getDocPreferences:r,globalSlug:i}=lE(),s=(0,L.wA)(a),{action:u,beforeSubmit:h,children:f,className:g,disabled:b,disableSuccessStatus:v,disableValidationOnSubmit:y,el:x,handleResponse:w,initialState:C,isDocumentForm:S,isInitializing:k,onChange:_,onSubmit:$,onSuccess:N,redirect:P,submitted:E,uuid:D,waitForAutocomplete:T}=e,A="method"in e?e?.method:void 0,R=(0,m.useRouter)(),F=eA(),{code:V}=aN(),{i18n:H,t:q}=(0,d.d)(),{refreshCookie:W,user:K}=aj(),Q=lL(),{queueTask:Y}=dB(),{getFormState:G}=cf(),{startRouteTransition:X}=te(),{getUploadHandler:Z}=uc(),{config:J}=(0,c.c)(),[ee,et]=(0,o.useState)(b||!1),[en,ea]=(0,o.useState)(!1),[el,er]=(0,o.useState)(!1),[ei,eo]=(0,o.useState)(!0),[es,ec]=(0,o.useState)(k),[ed,eu]=(0,o.useState)(!1),[ep,eh]=(0,o.useState)(!1),ef=(0,o.useRef)(ep),em=(0,o.useRef)(!1),eg=(0,o.useCallback)(e=>{ef.current=e,eh(e)},[]),[eb,ev]=(0,o.useState)(!1),ey=(0,o.useCallback)(e=>{ef.current&&(em.current=!0),ev(e)},[]),ex=(0,o.useRef)(null),ew=(0,o.useRef)({}),ej=(0,o.useRef)(null),eT=(0,o.useRef)(!0),eR=(0,o.useReducer)(um,{},()=>C),[eL,eF]=eR;ew.current.fields=eL;let eO=(0,o.useRef)(eL),eM=(0,o.useCallback)(async()=>{let e={},a=!0,l=ew.current.getData(),r=Object.entries(ew.current.fields).map(async([r,i])=>{let o=r?r.split("."):[];if(!1!==i.passesCondition){let e=i.valid;
41if("validate"in i&&"function"==typeof i.validate){let a=i.value;i?.rows&&Array.isArray(i.rows)&&(a=ew.current.getDataByPath(r)),"string"==typeof(e=await i.validate(a,{...i,id:t,collectionSlug:n,blockData:void 0,data:F?.getData?F.getData():l,event:"submit",operation:Q,path:o,preferences:{},req:{payload:{config:J},t:q,user:K},siblingData:ew.current.getSiblingData(r)}))?(i.errorMessage=e,i.valid=!1):(i.valid=!0,i.errorMessage=void 0)}!1===i.valid&&(a=!1)}e[r]=i});return await Promise.all(r),(0,j.j)(ew.current.fields,e)||eF({type:"REPLACE_STATE",state:e}),eo(a),a},[n,J,eF,t,Q,q,K,F]),eI=(0,o.useCallback)(async(e,t)=>{let{acceptValues:n=!0,action:a=u,context:l,disableFormWhileProcessing:r=!0,disableSuccessStatus:i,method:o=A,overrides:c={},skipValidation:d}=e||{},f=i??v;if(ee){t&&t.preventDefault();return}let m,g,b=new Promise((e,t)=>{g=e,m=t}),x=a||"string"==typeof u||"function"==typeof u;P||f||!x?(g=e=>e3.success(e),m=e=>e3.error(e)):e3.promise(b,{error:e=>e,loading:q("general:submitting"),success:e=>e}),t&&(t.stopPropagation(),t.preventDefault()),r&&(eu(!0),et(!0)),T&&await (0,O.u)(100);let j=(0,M.r)(ew.current.fields,!0),C=(0,I.KS)(ew.current.fields,{excludeFiles:!0});if(Array.isArray(h)){let e;await h.reduce(async(t,n)=>{await t,e=await n({formState:C})},Promise.resolve());let t=Object.entries(e).every(([,e])=>!1!==e.valid);if(eo(t),!t)return eu(!1),er(!0),et(!1),eF({type:"REPLACE_STATE",state:e})}let S=!!d||!!y||await ew.current.validateForm();if(eo(S),!S){m(q("error:correctInvalidFields")),eu(!1),er(!0),et(!1);return}let k={};if("function"==typeof c?k=c(ew.current.fields):"object"==typeof c&&(k=c),$){for(let[e,t]of Object.entries(k))j[e]=t;$(ew.current.fields,j)}if(!x){eu(!1),er(!0),et(!1);return}try{let e=await ew.current.createFormData(k,{data:j,mergeOverrideData:"function"!=typeof c}),t;if("string"==typeof a?t=await ay[o.toLowerCase()](a,{body:e,headers:{"Accept-Language":H.language}}
41):"function"==typeof u&&(t=await u(e)),em.current?em.current=!1:ey(!1),et(!1),"function"==typeof w)return void w(t,g,m);let r=t.headers.get("content-type"),i=r&&-1!==r.indexOf("application/json"),d={};if(i&&(d=await t.json()),t.status<400){if("function"==typeof N){let e=await N(d,{context:l,formState:C});e&&eF({type:"MERGE_SERVER_STATE",acceptValues:n,prevStateRef:eO,serverState:e})}er(!1),eu(!1),P?X(()=>R.push(P)):f||g(d.message||q("general:submissionSuccessful"))}else{if(eu(!1),er(!0),"draft"===c._status&&(ey(!0),s||er(!1)),ew.current={...ew.current},d.message)return void m(d.message);if(Array.isArray(d.errors)){let[e,t]=d.errors.reduce(([e,t],n)=>{let a=[],l=[];return n?.message&&l.push(n),Array.isArray(n?.data?.errors)&&n.data?.errors.forEach(e=>{e?.path?a.push(e):l.push(e)}),[[...e,...a],[...t,...l]]},[[],[]]);eo(!1),eF({type:"ADD_SERVER_ERRORS",errors:e}),t.forEach(e=>{m((0,p.jsx)(ul,{errorMessage:e.message||q("error:unknown")}))});return}let e=ud?.[t.status]||t?.statusText||q("error:unknown");m(e)}return{formState:ew.current.fields,res:t}}catch(e){console.error("Error submitting form",e),eu(!1),er(!0),et(!1),m(e.message)}},[h,X,u,v,y,ee,eF,w,A,$,N,P,R,q,H,s,T,ey,er]),eB=(0,o.useCallback)(()=>ew.current.fields,[]),ez=(0,o.useCallback)(e=>ew.current.fields[e],[]),eU=(0,o.useCallback)(()=>(0,M.r)(ew.current.fields,!0),[]),eV=(0,o.useCallback)(e=>(0,B.d)(ew.current.fields,e),[]),eH=(0,o.useCallback)(e=>(0,z.Z)(ew.current.fields,e),[]),eq=(0,o.useCallback)(async(e,{data:t,mergeOverrideData:l=!0})=>{let r=t||(0,M.r)(ew.current.fields,!0),i=r?.file;if(a&&"upload"in a&&a.upload&&i){delete r.file;let e=Z({collectionSlug:n});if("function"==typeof e&&!(0,U.M9)({allowRestrictedFileTypes:a.upload.allowRestrictedFileTypes,filename:i.name,mimeType:i.type})){let t=i.name;i=JSON.stringify({clientUploadContext:await e({docPrefix:"string"==typeof r?.prefix?r.prefix:void 0,file:i,updateFilename:e=>{t=e}}),collectionSlug:n,filename:t,mimeType:i.type,size:i.size})}}let o={_payload:JSON.stringify(r=l?{...r,...e}:e)};return a&&"upload"in a&&a.upload&&i&&(o.file=i),(0,ua.serialize)(o,{indices:!0,nullsAsUndefineds:!1})},[n,a,Z]),eW=(0,o.useCallback)(async e=>{let a=cR(ej),o=await r(),{state:s}=await G({id:t,collectionSlug:n,data:e,docPermissions:l,docPreferences:o,globalSlug:i,locale:V,operation:Q,renderAllFields:!0,schemaPath:n||i,signal:a.signal,skipValidation:!0});ew.current={...ug},ey(!1),eF({type:"REPLACE_STATE",state:s}),ej.current=null},[n,eF,i,t,Q,G,l,r,V,ey]),eK=(0,o.useCallback)(e=>{ew.current={...ug},ey(!1),eF({type:"REPLACE_STATE",state:e})},[eF,ey]),eQ=(0,o.useCallback)(({blockType:e,path:t,rowIndex:n,subFieldState:a})=>{let l=eH(t)||[];eF({type:"ADD_ROW",blockType:e,path:t,rowIndex:void 0===n?l.length:n,subFieldState:a}),ey(!0)},[eF,eH,ey]),eY=(0,o.useCallback)(({moveFromIndex:e,moveToIndex:t,path:n})=>{eF({type:"MOVE_ROW",moveFromIndex:e,moveToIndex:t,path:n}),ey(!0)},[eF,ey]),eG=(0,o.useCallback)(({path:e,rowIndex:t})=>{eF({type:"REMOVE_ROW",path:e,rowIndex:t}),ey(!0)},[eF,ey]),eX=(0,o.useCallback)(({blockType:e,path:t,rowIndex:n,subFieldState:a})=>{let l=eH(t);eF({type:"REPLACE_ROW",blockType:e,path:t,rowIndex:void 0===n?l.length:n,subFieldState:a}),ey(!0)},[eF,eH,ey]);(0,o.useEffect)(()=>{let e=ej.current;return()=>{cA(e)}},[]),(0,o.useEffect)(()=>{void 0!==k&&ec(k)},[k]),ew.current.submit=eI,ew.current.getFields=eB,ew.current.getField=ez,ew.current.getData=eU,ew.current.getSiblingData=eV,ew.current.getDataByPath=eH,ew.current.validateForm=eM,ew.current.createFormData=eq,ew.current.setModified=ey,ew.current.setProcessing=eu,ew.current.setBackgroundProcessing=eg,ew.current.setSubmitted=er,ew.current.setIsValid=eo,ew.current.disabled=ee,ew.current.setDisabled=et,ew.current.formRef=ex,ew.current.reset=eW,ew.current.replaceState=eK,ew.current.dispatchFields=eF,ew.current.addFieldRow=eQ,ew.current.removeFieldRow=eG,ew.current.moveFieldRow=eY,ew.current.replaceFieldRow=eX,ew.current.uuid=D,ew.current.initializing=es,ew.current.isValid=ei,(0,o.useEffect)(()=>{ea(!0)},[]),(0,o.useEffect)(()=>{"boolean"==typeof b&&et(b)},[b]),(0,o.useEffect)(()=>{"boolean"==typeof E&&er(E)},[E]),(0,o.useEffect)(()=>{C&&(ew.current={...ug},eF({type:"REPLACE_STATE",optimize:!1,sanitize:!0,state:C}))},[C,eF]),aR(()=>{W()},15e3,[eL]);let eZ=tv(()=>{ew.current={...ew.current},ey(!1)});(0,o.useEffect)(()=>{eZ()},[V]);
41let eJ=[g,"form"].filter(Boolean).join(" "),e0=tv(e=>{Y(async()=>{if(Array.isArray(_)){let t;for(let n of _)t=await n({formState:(0,I.KS)(eL,{excludeFiles:!0}),submitted:e});eF({type:"MERGE_SERVER_STATE",prevStateRef:eO,serverState:t})}})});ui(()=>{(eT.current||!(0,j.j)(eL,eO.current))&&eb&&e0(el),eO.current=eL,eT.current=!1},[eb,el,eL],250);let e1=S?eS:o.Fragment,e2=S?{value:ew.current}:{};return(0,p.jsx)(x||"form",{action:"function"==typeof u?void 0:u,className:eJ,"data-form-ready":!ed&&en&&!es,method:A,noValidate:!0,onSubmit:e=>{ew.current.submit({},e)},ref:ex,children:(0,p.jsx)(e1,{...e2,children:(0,p.jsx)(eC,{value:ew.current,children:(0,p.jsx)(ek,{value:{fields:eL,...ew.current},children:(0,p.jsx)(e_,{value:el,children:(0,p.jsx)(eE,{value:!en||en&&es,children:(0,p.jsx)(e$,{value:ed,children:(0,p.jsx)(eN,{value:ep,children:(0,p.jsx)(eP,{value:eb,children:(0,p.jsx)(eD.Provider,{value:eR,children:f})})})})})})})})})})},uv="tabs-field__tab-button",uy=e=>{let t=(0,g.c)(12),{hidden:n,isActive:a,parentPath:l,setIsActive:r,tab:i}=e,{i18n:s}=(0,d.d)(),[c,u]=(0,o.useState)(void 0),f;if(t[0]!==c||t[1]!==n||t[2]!==s||t[3]!==a||t[4]!==l||t[5]!==r||t[6]!==i){let e=[...l?l.split(".").slice(0,-1):[],...(0,b.pz)(i)?[i.name]:[]],d=c>0,m=(0,p.jsx)(rD,{fields:i.fields,path:e,setErrorCount:u}),g=d&&`${uv}--has-error`,v=a&&`${uv}--active`,y=n&&`${uv}--hidden`,x;t[8]!==g||t[9]!==v||t[10]!==y?(x=[uv,g,v,y].filter(Boolean),t[8]=g,t[9]=v,t[10]=y,t[11]=x):x=t[11],f=(0,p.jsxs)(o.Fragment,{children:[m,(0,p.jsxs)("button",{className:x.join(" "),onClick:r,type:"button",children:[i.label?(0,h.s)(i.label,s):(0,b.pz)(i)?i.name:"",d&&(0,p.jsx)(na,{count:c,i18n:s})]})]}),t[0]=c,t[1]=n,t[2]=s,t[3]=a,t[4]=l,t[5]=r,t[6]=i,t[7]=f}else f=t[7];return f},ux="tabs-field",uw=lU(e=>{let{field:{admin:{className:t}={},tabs:n=[]},forceRender:a=!1,indexPath:l="",parentPath:r="",parentSchemaPath:i="",path:s="",permissions:c,readOnly:u,schemaPath:h=""}=e,{getPreference:f,setPreference:m}=lS(),{preferencesKey:g}=lE(),{i18n:b}=(0,d.d)(),{isWithinCollapsible:v}=l4(),y=eB(([e])=>n.map((t,n)=>{let a=t?.id;return{index:n,passesCondition:e?.[a]?.passesCondition??!0,tab:t}})),[x,w]=(0,o.useState)(()=>y.filter(({passesCondition:e})=>e)?.[0]?.index??0),j=(0,o.useRef)(!1),C=`tabs-${l}`,S=y[x],k=S?.tab,_=k?.admin?.description??k?.description,$="function"==typeof _?_({i18n:b,t:b.t}):_,N=y.some(({passesCondition:e})=>e),P=(0,o.useCallback)(async e=>{w(e);let t=await f(g);g&&m(g,{...t,...s?{fields:{...t?.fields||{},[s]:{...t?.fields?.[s],tabIndex:e}}}:{fields:{...t?.fields,[C]:{...t?.fields?.[C],tabIndex:e}}}})},[f,g,m,s,C]);return(0,o.useEffect)(()=>{g&&(async()=>{let e=await f(g);if(j.current)return;let t=(({storedTabIndex:e,tabCount:t})=>{if(!("number"!=typeof e||!Number.isInteger(e))&&!(e<0||e>=t))return e})({storedTabIndex:s?e?.fields?.[s]?.tabIndex:e?.fields?.[C]?.tabIndex,tabCount:y.length});"number"==typeof t&&w(t)})()},[s,f,g,C,n,y.length,r,i]),(0,o.useEffect)(()=>{if(S?.passesCondition===!1){let e=y.find(({passesCondition:e})=>e);e&&P(e.index)}},[S,y,P]),(0,p.jsx)("div",{className:[lH,t,ux,v&&`${ux}--within-collapsible`,!N&&`${ux}--hidden`].filter(Boolean).join(" "),children:(0,p.jsxs)(s8,{children:[(0,p.jsx)("div",{className:`${ux}__tabs-wrap`,children:(0,p.jsx)("div",{className:`${ux}__tabs`,children:y.map(({index:e,passesCondition:t,tab:n})=>(0,p.jsx)(uy,{hidden:!t,isActive:x===e,parentPath:s,setIsActive:()=>{j.current=!0,P(e)},tab:n},e))})}),(0,p.jsx)("div",{className:`${ux}__content-wrap`,children:k&&(0,p.jsx)(uj,{description:$,field:k,forceRender:a,hidden:!1,parentIndexPath:l,parentPath:s,parentSchemaPath:h,path:s,permissions:c&&"object"==typeof c&&"name"in k?c[k.name]&&"object"==typeof c[k.name]&&"fields"in c[k.name]?c[k.name].fields:c[k.name]:c,readOnly:u,tabIndex:x})})]})})});function uj(e){let t=(0,g.c)(21),{description:n,field:a,forceRender:l,hidden:r,label:i,parentIndexPath:o,parentPath:s,parentSchemaPath:c,permissions:u,readOnly:f,tabIndex:m}=e,{i18n:b}=(0,d.d)(),{customComponents:v}=lI(),y,x;if(t[0]!==n||t[1]!==a||t[2]!==l||t[3]!==r||t[4]!==b||t[5]!==i||t[6]!==o||t[7]!==s||t[8]!==c||t[9]!==u||t[10]!==f||t[11]!==v||t[12]!==m){x=Symbol.for("react.early_return_sentinel");e:{let e,{AfterInput:d,BeforeInput:g,Description:w,Field:j}=void 0===v?{}:v;if(j){x=j;break e}let{indexPath:C,path:k,schemaPath:_}=(0,S.Z)({field:a,index:m,parentIndexPath:o,parentPath:s,parentSchemaPath:c}),$=r&&`${ux}__tab--hidden`,N;t[15]!==b||t[16]!==i?(N=i&&`${ux}
41__tabConfigLabel-${(0,F.f)((0,h.s)(i,b))}`,t[15]=b,t[16]=i,t[17]=N):N=t[17],t[18]!==$||t[19]!==N?(e=[$,`${ux}__tab`,N].filter(Boolean),t[18]=$,t[19]=N,t[20]=e):e=t[20],y=(0,p.jsxs)("div",{className:e.join(" "),children:[(0,p.jsx)(em,{CustomComponent:w,Fallback:(0,p.jsx)(nr,{description:n,marginPlacement:"bottom",path:s})}),g,(0,p.jsx)(hU,{fields:a.fields,forceRender:l,parentIndexPath:C,parentPath:k,parentSchemaPath:_,permissions:u,readOnly:f}),d]})}t[0]=n,t[1]=a,t[2]=l,t[3]=r,t[4]=b,t[5]=i,t[6]=o,t[7]=s,t[8]=c,t[9]=u,t[10]=f,t[11]=v,t[12]=m,t[13]=y,t[14]=x}else y=t[13],x=t[14];return x!==Symbol.for("react.early_return_sentinel")?x:y}var uC=e=>{let t=(0,g.c)(32),{AfterInput:n,BeforeInput:a,className:l,Description:r,description:i,Error:o,hasMany:s,htmlAttributes:c,inputRef:u,Label:f,label:m,localized:b,maxRows:v,onChange:y,onKeyDown:x,path:w,placeholder:j,readOnly:C,required:S,rtl:k,showError:_,style:$,value:N,valueToRender:P}=e,{i18n:E,t:D}=(0,d.d)(),T;if(t[0]!==n||t[1]!==a||t[2]!==r||t[3]!==o||t[4]!==f||t[5]!==l||t[6]!==i||t[7]!==s||t[8]!==c||t[9]!==E||t[10]!==u||t[11]!==m||t[12]!==b||t[13]!==v||t[14]!==y||t[15]!==x||t[16]!==w||t[17]!==j||t[18]!==C||t[19]!==S||t[20]!==k||t[21]!==_||t[22]!==$||t[23]!==D||t[24]!==N||t[25]!==P){let e=(0,h.s)(j,E),d=_&&"error",g=C&&"read-only",A=s&&"has-many",R;t[27]!==l||t[28]!==d||t[29]!==g||t[30]!==A?(R=[lH,"text",l,d,g,A].filter(
41Boolean),t[27]=l,t[28]=d,t[29]=g,t[30]=A,t[31]=R):R=t[31],T=(0,p.jsxs)("div",{className:R.join(" "),style:$,children:[(0,p.jsx)(em,{CustomComponent:f,Fallback:(0,p.jsx)(aD,{label:m,localized:b,path:w,required:S})}),(0,p.jsxs)("div",{className:`${lH}__wrap`,children:[(0,p.jsx)(em,{CustomComponent:o,Fallback:(0,p.jsx)(ni,{path:w,showError:_})}),a,s?(0,p.jsx)(sZ,{className:`field-${w.replace(/\./g,"__")}`,components:{DropdownIndicator:null},customProps:{editableProps:uk},disabled:C,filterOption:()=>!v||!(Array.isArray(N)&&v&&N.length>=v),isClearable:!1,isCreatable:!0,isMulti:!0,isSortable:!0,menuIsOpen:!1,noOptionsMessage:()=>Array.isArray(N)&&N.length>=v?D("validation:limitReached",{max:v,value:N.length+1}):null,onChange:y,options:[],placeholder:e,showError:_,value:P}):(0,p.jsx)("input",{"data-rtl":k,disabled:C,id:`field-${w?.replace(/\./g,"__")}`,name:w,onChange:y,onKeyDown:x,placeholder:e,ref:u,type:"text",value:N||"",...c??{}}),n,(0,p.jsx)(em,{CustomComponent:r,Fallback:(0,p.jsx)(nr,{description:i,path:w})})]})]}),t[0]=n,t[1]=a,t[2]=r,t[3]=o,t[4]=f,t[5]=l,t[6]=i,t[7]=s,t[8]=c,t[9]=E,t[10]=u,t[11]=m,t[12]=b,t[13]=v,t[14]=y,t[15]=x,t[16]=w,t[17]=j,t[18]=C,t[19]=S,t[20]=k,t[21]=_,t[22]=$,t[23]=D,t[24]=N,t[25]=P,t[26]=T}else T=t[26];return T};function uS(e){e.currentTarget.contentEditable="false"}function uk(e,t,n){let a=`${t}--editable`;return{onBlur:uS,onClick:e=>{e.currentTarget.contentEditable="true",e.currentTarget.classList.add(a),e.currentTarget.focus()},onKeyDown:t=>{if(!t.nativeEvent.isComposing&&("Enter"===t.key||"Tab"===t.key||"Escape"===t.key)){if(t.currentTarget.contentEditable="false",t.currentTarget.classList.remove(a),e.value.value=t.currentTarget.innerText,e.label=t.currentTarget.innerText,e.value.value.replaceAll(`
42`,""))n.onChange(n.value,{action:"create-option",option:e});else if(Array.isArray(n.value)){let t=n.value.filter(t=>t.id!==e.id);n.onChange(t,{action:"pop-value",removedValue:e})}t.preventDefault()}t.stopPropagation()}}}var u_=lU(e=>{let{field:t,field:{admin:{autoComplete:n,className:a,description:l,placeholder:r,rtl:i}={},hasMany:s,label:d,localized:u,maxLength:h,maxRows:f,minLength:m,minRows:g,required:b},inputRef:v,path:y,readOnly:x,validate:w}=e,j=aN(),{config:{localization:C}}=(0,c.c)(),{customComponents:{AfterInput:S,BeforeInput:k,Description:_,Error:$,Label:N}={},disabled:P,path:E,setValue:D,showError:T,value:A}=lI({potentiallyStalePath:y,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof w)return w(e,{...t,maxLength:h,minLength:m,required:b})},[w,m,h,b])}),R=lq({fieldLocalized:u,fieldRTL:i,locale:j,localizationConfig:C||void 0}),[L,F]=(0,o.useState)([]),O=(0,o.useCallback)(e=>{!(x||P)&&D(e?Array.isArray(e)?e.map(e=>e.value?.value||e.value):[e.value?.value||e.value]:[])},[x,D,P]);(0,o.useEffect)(()=>{s&&Array.isArray(A)&&F(A.map((e,t)=>({id:`${e}${t}`,label:`${e}`,value:{toString:()=>`${e}${t}`,value:e?.value||e}})))},[A,s]);let M=(0,o.useMemo)(()=>lV(t),[t]);return(0,p.jsx)(uC,{AfterInput:S,BeforeInput:k,className:a,Description:_,description:l,Error:$,hasMany:s,htmlAttributes:{autoComplete:n||void 0},inputRef:v,Label:N,label:d,localized:u,maxRows:f,minRows:g,onChange:s?O:e=>{D(e.target.value)},path:E,placeholder:r,readOnly:x||P,required:b,rtl:R,showError:T,style:M,value:A||"",valueToRender:L})}),u$=e=>{let t=(0,g.c)(26),{AfterInput:n,BeforeInput:a,className:l,Description:r,description:i,Error:o,Label:s,label:c,localized:u,onChange:f,path:m,placeholder:b,readOnly:v,required:y,rows:x,rtl:w,showError:j,style:C,value:S}=e,{i18n:k}=(0,d.d)(),_=j&&"error",$=v&&"read-only",N;t[0]!==l||t[1]!==_||t[2]!==$?(N=[lH,"textarea",l,_,$].filter(Boolean),t[0]=l,t[1]=_,t[2]=$,t[3]=N):N=t[3];let P=N.join(" "),E=`field-${m.replace(/\./g,"__")}`,D;return t[4]!==n||t[5]!==a||t[6]!==r||t[7]!==o||t[8]!==s||t[9]!==i||t[10]!==k||t[11]!==c||t[12]!==u||t[13]!==f||t[14]!==m||t[15]!==b||t[16]!==v||t[17]!==y||t[18]!==x||t[19]!==w||t[20]!==j||t[21]!==C||t[22]!==P||t[23]!==E||t[24]!==S?(D=(0,p.jsxs)("div",{className:P,style:C,children:[(0,p.jsx)(em,{CustomComponent:s,Fallback:(0,p.jsx)(aD,{htmlFor:E,label:c,localized:u,path:m,required:y})}),(0,p.jsxs)("div",{className:`${lH}__wrap`,children:[(0,p.jsx)(em,{CustomComponent:o,Fallback:(0,p.jsx)(ni,{path:m,showError:j})}),a,(0,p.jsx)("div",{className:"textarea-outer",children:(0,p.jsx)("textarea",{"data-rtl":w,disabled:v,id:`field-${m.replace(/\./g,"__")}`,name:m,onChange:f,placeholder:(0,h.s)(b,k),rows:x,style:{"--rows":x},value:S||""})}),n,(0,p.jsx)(em,{CustomComponent:r,Fallback:(0,p.jsx)(nr,{description:i,path:m})})]})]}),t[4]=n,t[5]=a,t[6]=r,t[7]=o,t[8]=s,t[9]=i,t[10]=k,t[11]=c,t[12]=u,t[13]=f,t[14]=m,t[15]=b,t[16]=v,t[17]=y,t[18]=x,t[19]=w,t[20]=j,t[21]=C,t[22]=P,t[23]=E,t[24]=S,t[25]=D):D=t[25],D},uN=lU(e=>{let{field:t,field:{admin:{className:n,description:a,placeholder:l,rows:r,rtl:i}={},label:s,localized:u,maxLength:f,minLength:m,required:g},path:b,readOnly:v,validate:y}=e,{i18n:x}=(0,d.d)(),{config:{localization:w}}=(0,c.c)(),j=lq({fieldLocalized:u,fieldRTL:i,locale:aN(),localizationConfig:w||void 0}),{customComponents:{AfterInput:C,BeforeInput:S,Description:k,Error:_,Label:$}={},disabled:N,path:P,setValue:E,showError:D,value:T}=lI({potentiallyStalePath:b,validate:(0,o.useCallback)((e,t)=>{if("function"==typeof y)return y(e,{...t,maxLength:f,minLength:m,required:g})},[y,g,f,m])}),A=(0,o.useMemo)(()=>lV(t),[t]);return(0,p.jsx)(u$,{AfterInput:C,BeforeInput:S,className:n,Description:k,description:a,Error:_,Label:$,label:s,localized:u,onChange:e=>{E(e.target.value)},path:P,placeholder:(0,h.s)(l,x),readOnly:v||N,required:g,rows:r,rtl:j,showError:D,style:A,value:T})}),uP=()=>null,uE=(0,o.createContext)(void 0),uD=e=>{let t=(0,g.c)(5),{children:n}=e,[a,l]=(0,o.useState)(null),[r,i]=(0,o.useState)(""),[s,c]=(0,o.useState)(null),d;return t[0]!==n||t[1]!==s||t[2]!==a||t[3]!==r?(d=(0,p.jsx)(uE,{value:{setUploadControlFile:c,setUploadControlFileName:l,setUploadControlFileUrl:i,uploadControlFile:s,uploadControlFileName:a,uploadControlFileUrl:r},children:n}),t[0]=n,t[1]=s,t[2]=a,t[3]=r,t[4]=d):d=t[4],d},uT=()=>{let e=(0,o.use)(uE);
42if(!e)throw Error("useUploadControls must be used within an UploadControlsProvider");return e},uA=e=>{e.preventDefault(),e.stopPropagation()};function uR({children:e,className:t,disabled:n=!1,dropzoneStyle:a="default",multipleFiles:l,onChange:r}){let i=o.useRef(null),[s,c]=o.useState(!1),d=o.useCallback(e=>{if(!l&&e.length>1){let t=new DataTransfer;t.items.add(e[0]),r(t.files)}else r(e)},[l,r]),u=o.useCallback(e=>{e.preventDefault(),e.stopPropagation(),e.clipboardData.files&&e.clipboardData.files.length>0&&d(e.clipboardData.files)},[d]),h=o.useCallback(e=>{e.preventDefault(),e.stopPropagation(),c(!0)},[]),f=o.useCallback(e=>{e.preventDefault(),e.stopPropagation(),c(!1)},[]),m=o.useCallback(e=>{if(e.preventDefault(),e.stopPropagation(),c(!1),e.dataTransfer.files&&e.dataTransfer.files.length>0){d(e.dataTransfer.files),c(!1);try{e.dataTransfer.clearData()}catch{}}},[d]);o.useEffect(()=>{let e=i.current;return e&&!n?(e.addEventListener("dragenter",h),e.addEventListener("dragleave",f),e.addEventListener("dragover",uA),e.addEventListener("drop",m),e.addEventListener("paste",u),()=>{e.removeEventListener("dragenter",h),e.removeEventListener("dragleave",f),e.removeEventListener("dragover",uA),e.removeEventListener("drop",m),e.removeEventListener("paste",u)}):()=>null},[n,h,f,m,u]);let g=["dropzone",t,s?"dragging":"",`dropzoneStyle--${a}`].filter(Boolean).join(" ");return(0,p.jsx)("div",{className:g,ref:i,children:e})}function uL(e){let t=(0,g.c)(3),{onClick:n}=e,{t:a}=(0,d.d)(),l;return t[0]!==n||t[1]!==a?(l=(0,p.jsx)("button",{"aria-label":a("general:close"),className:"drawer-close-button",onClick:n,type:"button",children:(0,p.jsx)(d.a,{})}),t[0]=n,t[1]=a,t[2]=l):l=t[2],l}function uF({onClose:e,title:t}){return(0,p.jsxs)("div",{className:"bulk-upload--drawer-header",children:[(0,p.jsx)("h2",{title:t,children:t}),(0,p.jsx)(uL,{onClick:e})]})}var uO="bulk-upload--add-files";function uM({acceptMimeTypes:e,onCancel:t,onDrop:n}){let{t:a}=(0,d.d)(),l=o.useRef(null);return(0,p.jsxs)("div",{className:uO,children:[(0,p.jsx)(uF,{onClose:t,title:a("upload:addFiles")}),(0,p.jsx)("div",{className:`${uO}__dropArea`,children:(0,p.jsxs)(uR,{multipleFiles:!0,onChange:n,children:[(0,p.jsx)(tN,{buttonStyle:"subtle",iconPosition:"left",onClick:()=>{l.current&&l.current.click()},size:"small",children:a("upload:selectFile")}),(0,p.jsx)("input",{accept:e,"aria-hidden":"true",className:`${uO}__hidden-input`,hidden:!0,multiple:!0,onChange:e=>{e.target.files&&e.target.files.length>0&&n(e.target.files)},ref:l,type:"file"}),(0,p.jsxs)("p",{className:`${uO}__dragAndDropText`,children:[a("general:or")," ",a("upload:dragAndDrop")]})]})})]})}var uI=(0,u.e)(ed(),1);async function uB(e={},t={},n,a,l){let r=(0,M.r)(e,!0),i=r?.file;if(i&&delete r.file,i&&"function"==typeof a&&!(0,U.M9)({allowRestrictedFileTypes:l,filename:i.name,mimeType:i.type})){let e=i.name;i=JSON.stringify({clientUploadContext:await a({docPrefix:"string"==typeof r?.prefix?r.prefix:void 0,file:i,updateFilename:t=>{e=t}}),collectionSlug:n,filename:e,mimeType:i.type,size:i.size})}let o={_payload:JSON.stringify({...r,...t}),file:i};return(0,uI.serialize)(o,{indices:!0,nullsAsUndefineds:!1})}function uz(e,t){switch(t.type){case"ADD_FORMS":{let n=[];for(let e=0;e<t.forms.length;e++)n[e]={errorCount:0,formID:t.forms[e].formID??(crypto.randomUUID?crypto.randomUUID():ru()),formState:{...t.forms[e].initialState||{},file:{initialValue:t.forms[e].file,valid:!0,value:t.forms[e].file}},uploadEdits:{}};return{...e,activeIndex:0,forms:[...n,...e.forms]}}case"REMOVE_FORM":{let n=[...e.forms],[a]=n.splice(t.index,1),l=e.activeIndex>=t.index,r=Math.min(n.length-1,e.activeIndex===t.index?t.index:l?e.activeIndex-1:e.activeIndex);return{...e,activeIndex:l?r:e.activeIndex,forms:n,totalErrorCount:e.totalErrorCount-a.errorCount}}case"REPLACE":return{...e,...t.state};case"SET_ACTIVE_INDEX":return{...e,activeIndex:t.index};case"UPDATE_ERROR_COUNT":{let n=[...e.forms];return n[t.index].errorCount=t.count,{...e,forms:n,totalErrorCount:n.reduce((e,t)=>e+t.errorCount,0)}}case"UPDATE_FORM":{let n=[...e.forms];return n[t.index].errorCount=t.errorCount,n[t.index]={...n[t.index],formState:{...n[t.index].formState,...t.formState},uploadEdits:{...n[t.index].uploadEdits,...t.uploadEdits}},{...e,forms:n,totalErrorCount:n.reduce((e,t)=>
42e+t.errorCount,0)}}default:return e}}var uU=o.createContext({activeIndex:0,addFiles:()=>Promise.resolve(),bulkUpdateForm:()=>null,collectionSlug:"",docPermissions:void 0,documentSlots:{},forms:[],getFormDataRef:{current:()=>({})},hasPublishPermission:!1,hasSavePermission:!1,hasSubmitted:!1,isInitializing:!1,removeFile:()=>{},saveAllDocs:()=>Promise.resolve(),setActiveIndex:()=>0,setFormTotalErrorCount:()=>{},totalErrorCount:0,updateUploadEdits:()=>{}}),uV={activeIndex:0,forms:[],totalErrorCount:0};function uH({children:e}){let{config:t}=(0,c.c)(),{routes:{api:n}}=t,a=t.folders?t.folders.fieldName:void 0,{code:l}=aN(),{i18n:r,t:i}=(0,d.d)(),{getDocumentSlots:s,getFormState:u}=cf(),{getUploadHandler:h}=uc(),[f,m]=o.useState({}),[g,b]=o.useState(!1),[v,w]=o.useState(),[j,C]=o.useState(!1),[S,k]=o.useState(!1),[_,$]=o.useState(!1),[N,P]=o.useState(!1),[E,D]=o.useState(!1),[T,A]=o.useReducer(uz,uV),{activeIndex:R,forms:L,totalErrorCount:F}=T;o.useRef(L).current=L;let{toggleLoadingOverlay:O}=cN(),{closeModal:M}=nN(),{collectionSlug:I,drawerSlug:B,folderID:z,initialFiles:U,initialForms:V,onSuccess:H,setInitialFiles:q,setInitialForms:W,setSuccessfullyUploaded:K}=h$(),[Q,Y]=o.useState(!1),[G,X]=o.useState(""),Z=o.useRef(!1),J=o.useRef(null),ee=o.useRef(()=>({})),et=(0,y.Q)({apiRoute:n,path:`/${I}`}),en=o.useCallback(async()=>{let e=`/${I}/access?${x.A({locale:l||void 0})}`,t=await (await fetch((0,y.Q)({apiRoute:n,path:e}),{credentials:"include",headers:{"Accept-Language":r.language,"Content-Type":"application/json"},method:"POST"})).json(),a=await fetch((0,y.Q)({apiRoute:n,path:e}),{body:JSON.stringify({_status:"published"}),credentials:"include",headers:{"Accept-Language":r.language,"Content-Type":"application/json"},method:"POST"}).then(e=>e.json());w(t),C(lN({collectionSlug:I,docPermissions:t,isEditing:!1})),k(a?.update),P(!0)},[n,l,I,r.language]),ea=o.useCallback(async e=>{e?.signal&&e.abort("aborting previous fetch for initial form state without files"),m(await s({collectionSlug:I}));try{let{state:e}=await u({collectionSlug:I,docPermissions:v,docPreferences:{fields:{}},locale:l,operation:"create",renderAllFields:!0,schemaPath:I,skipValidation:!0});a&&e?.[a]&&(e[a]={...e[a],customComponents:{...e[a].customComponents,Field:void 0}}),J.current=e,$(!0)}catch{}},[s,I,u,v,l,a]),el=o.useCallback(e=>{let t=ee.current();A({type:"REPLACE",state:{activeIndex:e,forms:L.map((e,n)=>n===R?{errorCount:e.errorCount,formID:e.formID,formState:t,uploadEdits:e.uploadEdits}:e)}})},[L,R]),er=o.useCallback(e=>z&&a&&e?.[a]?{...e,[a]:{...e[a],initialValue:z,value:z}}:e,[z,a]),ei=o.useCallback(async e=>{L.length&&A({type:"UPDATE_FORM",errorCount:L[R].errorCount,formState:ee.current(),index:R}),O({isLoading:!0,key:"addingDocs"}),_||await ea(),A({type:"ADD_FORMS",forms:Array.from(e).map(e=>({file:e,initialState:er(J.current)}))}),O({isLoading:!1,key:"addingDocs"})},[ea,_,O,R,L,er]),eo=tv(ei),es=tv(async e=>{O({isLoading:!0,key:"addingDocs"}),_||await ea(),A({type:"ADD_FORMS",forms:e.map(e=>({...e,initialState:er(e?.initialState||J.current)}))}),O({isLoading:!1,key:"addingDocs"})}),ec=o.useCallback(e=>{A({type:"REMOVE_FORM",index:e})},[]),ed=o.useCallback(({errorCount:e,index:t})=>{A({type:"UPDATE_ERROR_COUNT",count:e,index:t})},[]),eu=o.useCallback(async({overrides:e}={})=>{let n=ee.current(),a=[...L];a[R]={errorCount:a[R].errorCount,formID:a[R].formID,formState:n,uploadEdits:a[R].uploadEdits};let r=a[R]?.formID,o=[];Y(!0);for(let n=0;n<a.length;n++)try{let r=a[n],s=r.formState?.file?.value;X(i("general:uploadingBulk",{current:n+1,total:a.length}));let c=`${et}${x.A({locale:l,uploadEdits:r?.uploadEdits||void 0},{addQueryPrefix:!0})}`,d=await fetch(c,{body:await uB(r.formState,e,I,h({collectionSlug:I}),t.collections.find(({slug:e})=>e===I)?.upload?.allowRestrictedFileTypes),credentials:"include",method:"POST"}),f=await d.json(),m=201===d.status&&f?.doc;m&&o.push({collectionSlug:I,doc:f.doc,formID:r.formID});let[g,b]=(f?.errors||[]).reduce(([e,t],n)=>{let a=[],l=[];return n?.message&&l.push(n),Array.isArray(n?.data?.errors)&&n.data?.errors.forEach(e=>{e?.path?a.push(e):l.push(e)}),[[...e,...a],[...t,...l]]},[[],[]]),y=!s&&400===d.status,w=s&&413===d.status,j=s&&"object"==typeof s&&"name"in s&&(!s.name||""===s.name);if(y||w||j){a[n].formState.file.valid=!1;let e=a[n].formState.file?.value,t={...a[n].formState};e instanceof File&&(t.file={...t.file,value:{name:e.name}});let{state:l}=await u({collectionSlug:I,docPermissions:v,docPreferences:null,formState:t,operation:"update",sc
42hemaPath:I});l&&(e instanceof File&&l.file&&(l.file={...l.file,value:e}),a[n]={errorCount:Object.values(l).reduce((e,t)=>t?.valid===!1?e+1:e,0),formID:a[n].formID,formState:l}),e3.error(b[0]?.message)}else{let e=g.length;m||0!==e||(e=b.length||1),a[n]={errorCount:e,formID:a[n].formID,formState:um(a[n].formState,{type:"ADD_SERVER_ERRORS",errors:g})},m||b.forEach(e=>{e3.error((0,p.jsx)(ul,{errorMessage:e.message||i("error:unknown")}))})}}catch{}b(!0),X(""),Y(!1);let s=[];a.forEach(({errorCount:e},t)=>{e&&s.push(a[t])});let c=Math.max(0,a.length-s.length),d=a.length-c;c&&(e3.success(`Successfully saved ${c} files`),K(!0),"function"==typeof H&&H(o,d)),d?e3.error(`Failed to save ${d} files`):M(B),A({type:"REPLACE",state:{activeIndex:s.reduce((e,{formID:t},n)=>t===r?n:e,0),forms:s,totalErrorCount:s.reduce((e,{errorCount:t})=>e+t,0)}}),0===s.length&&(q(void 0),W(void 0))},[L,R,i,et,l,I,t.collections,h,u,v,K,H,M,B,q,W]),ep=o.useCallback(async(e,t)=>{for(let n=0;n<L.length;n++)if(Object.entries(e).forEach(([e,t])=>{L[n].formState[e]&&(L[n].formState[e].value=t,A({type:"UPDATE_FORM",errorCount:L[n].errorCount,formState:L[n].formState,index:n}))}),"function"==typeof t&&t(),g){let{state:e}=await u({collectionSlug:I,docPermissions:v,docPreferences:null,formState:L[n].formState,operation:"create",schemaPath:I});A({type:"UPDATE_FORM",errorCount:Object.values(e).reduce((e,t)=>t?.valid===!1?e+1:e,0),formState:e,index:n})}},[I,v,L,u,g]),eh=o.useCallback(e=>{A({type:"UPDATE_FORM",errorCount:L[R].errorCount,formState:L[R].formState,index:R,uploadEdits:e})},[R,L]),ef=o.useCallback(()=>{A({type:"REPLACE",state:{forms:L.map(e=>({...e,uploadEdits:{}}))}})},[L]);return o.useEffect(()=>{I&&(_||ea(),N||en(),(U||V)&&D(!_||!N),_&&(V?.length||U?.length)&&!Z.current&&(V?.length&&es(V),U?.length&&eo(U),Z.current=!0))},[U,ea,en,I,_,N,V]),(0,p.jsxs)(uU,{value:{activeIndex:T.activeIndex,addFiles:ei,bulkUpdateForm:ep,collectionSlug:I,docPermissions:v,documentSlots:f,forms:L,getFormDataRef:ee,hasPublishPermission:S,hasSavePermission:j,hasSubmitted:g,isInitializing:E,removeFile:ec,resetUploadEdits:ef,saveAllDocs:eu,setActiveIndex:el,setFormTotalErrorCount:ed,totalErrorCount:F,updateUploadEdits:eh},children:[Q&&(0,p.jsx)(cE,{animationDuration:"250ms",loadingText:G,overlayType:"fullscreen",show:!0}),e]})}function uq(){return o.use(uU)}var uW=(e,t)=>e?(0,b.Z7)(t)&&t.name?`${e}.${t.name}`:e:(0,b.Z7)(t)?t.name:"",uK=({CustomLabel:e,field:t,prefix:n})=>(0,p.jsxs)(o.Fragment,{children:[n?(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)("span",{style:{display:"inline-block"},children:n})," > "]}):null,(0,p.jsx)("span",{style:{display:"inline-block"},children:(0,p.jsx)(em,{CustomComponent:e,Fallback:(0,p.jsx)(aD,{label:"label"in t&&t.label})})})]}),uQ=({fields:e,formState:t,labelPrefix:n=null,parentPath:a="",path:l="",permissions:r})=>{if(!e)return[];let i=t?.[l]?.customComponents?.Label;return e?.reduce((e,t)=>{let{operation:o,permissions:s,read:c}=(0,C.P)({field:t,operation:"update",parentName:a?.includes(".")?a.split(".")[a.split(".").length-1]:a,permissions:r});if(((0,b.Z7)(t)||"ui"===t.type)&&(t.admin?.disableBulkEdit||t.unique||(0,b.I2)(t)||"readOnly"in t&&t.readOnly||!o||!c))return e;if("array"!==t.type&&"blocks"!==t.type&&(0,b.sd)(t)){let a="label"in t&&t.label;return[...e,...uQ({fields:t.fields,labelPrefix:a?uK({CustomLabel:i,field:t,prefix:n}):n,parentPath:l,path:uW(l,t),permissions:s})]}return"tabs"===t.type&&"tabs"in t?[...e,...t.tabs.reduce((e,t)=>{if("fields"in t){let a="name"in t&&t.name,r=a&&s&&!0!==s?s[t.name]:void 0,i=a?!0===r||(r?.fields??s):s;return[...e,...uQ({fields:t.fields,labelPrefix:n,parentPath:l,path:a?uW(l,t):l,permissions:i})]}},[])]:[...e,{label:uK({CustomLabel:i,field:t,prefix:n}),value:{field:t,fieldPermissions:s,path:uW(l,t)}}]},[])},uY=e=>{let t=(0,g.c)(14),{fields:n,onChange:a,permissions:l}=e,{t:r}=(0,d.d)(),{dispatchFields:i,getFields:s}=eT(),c;t[0]!==n||t[1]!==s||t[2]!==l?(c=()=>{let e;return uQ({fields:(e=["file","mimeType","thumbnailURL","width","height","filesize","filename","url","focalX","focalY","sizes"],n.filter(t=>!e.includes("name"in t&&t.name))),formState:s(),permissions:l})},t[0]=n,t[1]=s,t[2]=l,t[3]=c):c=t[3];let[u]=(0,o.useState)(c),h;if(t[4]!==i||t[5]!==s||t[6]!==a||t[7]!==u||t[8]!==r){let e;t[10]!==i||t[11]!==s||t[12]!==a?(e=e=>a({dispatchFields:i,formState:s(),selected:e}),t[10]=i,t[11]=s,t[12]=a,t[13]=e):e=t[13],h=(0,p.jsxs)("div",{className:"field-select",children:[(0,p.jsx)(aD,{label:r("fields:selectFieldsToEdit")}),(0,p.jsx)(sZ,{getOptionValue:uG,isMulti:!0,onChange:e,options:u})]}),t[4]=i,t[5]=s,t[6]=a,t[7]=u,t[8]=r,t[9]=h}else h=t[9];return h};function uG(e){return"object"==typeof e.value&&"path"in e.value?String(e.value.path):String(e.value)}var uX=e=>{let{collection:{fields:t,labels:{plural:n,singular:a}}={},collection:l,drawerSlug:r,forms:i}=e,[s,c]=(0,o.useState)(!1),{permissions:u}=aj(),{i18n:f,t:m}=(0,d.d)(),{closeModal:g}=nN(),{bulkUpdateForm:b}=uq(),{getFormState:v}=cf(),y=o.useRef(null),[x,w]=(0,o.useState)([]),j=u?.collections?.[l.slug],C=(0,o.useMemo)(()=>(0,H.s)(x.reduce((e,t)=>
42(e[t.value.path]=!0,e),{})),[x]),S=(0,o.useCallback)(async({formState:e,submitted:t})=>{let n=cR(y),{state:a}=await v({collectionSlug:l.slug,docPermissions:j,docPreferences:null,formState:e,operation:"update",schemaPath:l.slug,select:C,signal:n.signal,skipValidation:!t});return y.current=null,a},[v,l,j,C]);(0,o.useEffect)(()=>{let e=y.current;return()=>{cA(e)}},[]);let k=(0,o.useCallback)(e=>{b(x.reduce((t,n)=>(e[n.value.path]&&(t[n.value.path]=e[n.value.path].value),t),{}),()=>g(r))},[g,r,b,x]),_=(0,o.useCallback)(async({dispatchFields:e,formState:t,selected:n})=>{c(!0),w(n||[]);let{state:a}=await v({collectionSlug:l.slug,docPermissions:j,docPreferences:null,formState:t,operation:"update",schemaPath:l.slug,select:(0,H.s)(n.reduce((e,t)=>(e[t.value.path]=!0,e),{})),skipValidation:!0});e({type:"UPDATE_MANY",formState:a}),c(!1)},[v,l,j]);return(0,p.jsxs)("div",{className:`${uZ}__main`,children:[(0,p.jsxs)("div",{className:`${uZ}__header`,children:[(0,p.jsx)("h2",{className:`${uZ}__header__title`,children:m("general:editingLabel",{count:i.length,label:(0,h.s)(i.length>1?n:a,f)})}),(0,p.jsx)("button",{"aria-label":m("general:close"),className:`${uZ}__header__close`,id:`close-drawer__${r}`,onClick:()=>g(r),type:"button",children:(0,p.jsx)(d.a,{})})]}),(0,p.jsxs)(ub,{className:`${uZ}__form`,isInitializing:s,onChange:[S],onSubmit:k,children:[(0,p.jsx)(uY,{fields:t,onChange:_,permissions:j.fields}),0===x.length?null:(0,p.jsx)("div",{className:"render-fields",children:(0,p.jsx)(lF,{value:void 0,children:x.map((e,t)=>{let{value:{field:n,fieldPermissions:a,path:l}}=e;return(0,p.jsx)(hB,{clientFieldConfig:n,indexPath:"",parentPath:"",parentSchemaPath:"",path:l,permissions:a},`${l}-${t}`)})})}),(0,p.jsx)("div",{className:`${uZ}__sidebar-wrap`,children:(0,p.jsx)("div",{className:`${uZ}__sidebar`,children:(0,p.jsx)("div",{className:`${uZ}__sidebar-sticky-wrap`,children:(0,p.jsx)("div",{className:`${uZ}__document-actions`,children:(0,p.jsx)(tN,{type:"submit",children:m("general:applyChanges")})})})})})]})]})},uZ="edit-many-bulk-uploads",uJ=e=>{let t,n=(0,g.c)(5),{collection:a,collection:l}=e,{slug:r}=void 0===a?{}:a,{permissions:i}=aj(),{t:o}=(0,d.d)(),{forms:s}=uq(),c=i?.collections?.[r]?.update,u=`edit-${r}-bulk-uploads`;return c?(n[0]!==l||n[1]!==u||n[2]!==s||n[3]!==o?(t=(0,p.jsxs)("div",{className:uZ,children:[(0,p.jsx)(ad,{"aria-label":o("general:editAll"),className:`${uZ}__toggle`,slug:u,children:o("general:editAll")}),(0,p.jsx)(ns,{children:(0,p.jsx)(au,{Header:null,slug:u,children:(0,p.jsx)(uX,{collection:l,drawerSlug:u,forms:s})})})]}),n[0]=l,n[1]=u,n[2]=s,n[3]=o,n[4]=t):t=n[4],t):null},u0="bulk-upload--actions-bar";function u1(e){let t=(0,g.c)(15),{collectionConfig:n}=e,{activeIndex:a,forms:l,setActiveIndex:r}=uq(),{t:i}=(0,d.d)(),o=a+1,s;if(t[0]!==a||t[1]!==n||t[2]!==l.length||t[3]!==r||t[4]!==i||t[5]!==o){let e,c;t[7]!==a||t[8]!==l.length||t[9]!==r?(e=()=>{let e=a-1;e<0?r(l.length-1):r(e)},t[7]=a,t[8]=l.length,t[9]=r,t[10]=e):e=t[10],t[11]!==a||t[12]!==l.length||t[13]!==r?(c=()=>{let e=a+1;e===l.length?r(0):r(e)},t[11]=a,t[12]=l.length,t[13]=r,t[14]=c):c=t[14],s=(0,p.jsxs)("div",{className:u0,children:[(0,p.jsxs)("div",{className:`${u0}__navigation`,children:[(0,p.jsxs)("p",{className:`${u0}__locationText`,children:[(0,p.jsx)("strong",{children:o}),` ${i("general:of")} `,(0,p.jsx)("strong",{children:l.length})]}),(0,p.jsxs)("div",{className:`${u0}__controls`,children:[(0,p.jsx)(tN,{"aria-label":i("general:previous"),buttonStyle:"none",onClick:e,type:"button",children:(0,p.jsx)(to,{direction:"left"})}),(0,p.jsx)(tN,{"aria-label":i("general:next"),buttonStyle:"none",onClick:c,type:"button",children:(0,p.jsx)(to,{direction:"right"})})]}),(0,p.jsx)(uJ,{collection:n})]}),(0,p.jsx)(u3,{className:`${u0}__saveButtons`})]}),t[0]=a,t[1]=n,t[2]=l.length,t[3]=r,t[4]=i,t[5]=o,t[6]=s}else s=t[6];return s}function u3(e){let t=(0,g.c)(12),{className:n}=e,{getEntityConfig:a}=(0,c.c)(),{t:l}=(0,d.d)(),{collectionSlug:r,hasPublishPermission:i,hasSavePermission:o,saveAllDocs:s}=uq(),u;t[0]!==r||t[1]!==a?(u=a({collectionSlug:r}),t[0]=r,t[1]=a,t[2]=u):u=t[2];let h=u,f;t[3]!==n?(f=[`${u0}
42__buttons`,n].filter(Boolean),t[3]=n,t[4]=f):f=t[4];let m=f.join(" "),b;return t[5]!==h?.versions?.drafts||t[6]!==i||t[7]!==o||t[8]!==s||t[9]!==l||t[10]!==m?(b=(0,p.jsxs)("div",{className:m,children:[h?.versions?.drafts&&o?(0,p.jsx)(tN,{buttonStyle:"secondary",onClick:()=>{s({overrides:{_status:"draft"}})},children:l("version:saveDraft")}):null,h?.versions?.drafts&&i?(0,p.jsx)(tN,{onClick:()=>{s({overrides:{_status:"published"}})},children:l("version:publish")}):null,!h?.versions?.drafts&&o?(0,p.jsx)(tN,{onClick:()=>{s()},children:l("general:save")}):null]}),t[5]=h?.versions?.drafts,t[6]=i,t[7]=o,t[8]=s,t[9]=l,t[10]=m,t[11]=b):b=t[11],b}var u2="bulk-upload--discard-without-saving";function u6(){let e=(0,g.c)(9),{t:t}=(0,d.d)(),{closeModal:n}=nN(),{drawerSlug:a}=h$(),l;e[0]!==n?(l=()=>{n(u2)},e[0]=n,e[1]=l):l=e[1];let r=l,i;e[2]!==n||e[3]!==a?(i=()=>{n(a),n(u2)},e[2]=n,e[3]=a,e[4]=i):i=e[4];let o=i,s;return e[5]!==r||e[6]!==o||e[7]!==t?(s=(0,p.jsx)(ag,{body:t("general:changesNotSaved"),cancelLabel:t("general:stayOnThisPage"),confirmLabel:t("general:leaveAnyway"),heading:t("general:leaveWithoutSaving"),modalSlug:u2,onCancel:r,onConfirm:o}),e[5]=r,e[6]=o,e[7]=t,e[8]=s):s=e[8],s}function u5({className:e}){return(0,p.jsx)("svg",{className:[e,"icon icon--trash"].filter(
42Boolean).join(" "),fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{d:"M4.1499 6.1H15.8499M14.5499 6.1V15.2C14.5499 15.85 13.8999 16.5 13.2499 16.5H6.7499C6.0999 16.5 5.4499 15.85 5.4499 15.2V6.1M7.3999 6.1V4.8C7.3999 4.15 8.0499 3.5 8.6999 3.5H11.2999C11.9499 3.5 12.5999 4.15 12.5999 4.8V6.1M8.6999 9.35V13.25M11.2999 9.35V13.25",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}var u4=()=>{let{getEntityConfig:e}=(0,c.c)(),{collectionSlug:t}=lE(),{labels:n}=e({collectionSlug:t}),{i18n:a}=(0,d.d)();return(0,p.jsxs)("div",{className:"trash-banner",children:[(0,p.jsx)(u5,{}),(0,p.jsx)("p",{children:a.t("general:documentIsTrashed",{label:`${(0,h.s)(n?.singular,a)}`})})]})},u8="document-fields",u7=({AfterFields:e,BeforeFields:t,docPermissions:n,fields:a,forceSidebarWrap:l,isTrashed:r=!1,readOnly:i,schemaPathSegments:s})=>{let{hasSidebarFields:c,mainFields:d,sidebarFields:u}=(0,o.useMemo)(()=>a.reduce((e,t)=>((0,b.zj)(t)?(e.sidebarFields.push(t),e.mainFields.push(null),e.hasSidebarFields=!0):(e.mainFields.push(t),e.sidebarFields.push(null)),e),{hasSidebarFields:!1,mainFields:[],sidebarFields:[]}),[a]);return(0,p.jsxs)("div",{className:[u8,c?`${u8}--has-sidebar`:`${u8}--no-sidebar`,l&&`${u8}--force-sidebar-wrap`].filter(Boolean).join(" "),children:[(0,p.jsx)("div",{className:`${u8}__main`,children:(0,p.jsxs)(ai,{className:`${u8}__edit`,children:[r&&(0,p.jsx)(u4,{}),t,(0,p.jsx)(hU,{className:`${u8}__fields`,fields:d,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:s.join("."),permissions:n?.fields,readOnly:i}),e]})}),c?(0,p.jsx)("div",{className:`${u8}__sidebar-wrap`,children:(0,p.jsx)("div",{className:`${u8}__sidebar`,children:(0,p.jsx)("div",{className:`${u8}__sidebar-fields`,children:(0,p.jsx)(hU,{fields:u,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:s.join("."),permissions:n?.fields,readOnly:i})})})}):null]})};function u9({className:e}){return(0,p.jsx)("svg",{className:[e,"icon icon--folder"].filter(Boolean).join(" "),fill:"none",height:"16",viewBox:"0 0 16 16",width:"16",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{d:"M13.3333 13.3333C13.6869 13.3333 14.026 13.1929 14.2761 12.9428C14.5261 12.6928 14.6666 12.3536 14.6666 12V5.33333C14.6666 4.97971 14.5261 4.64057 14.2761 4.39052C14.026 4.14048 13.6869 4 13.3333 4H8.06659C7.84359 4.00219 7.62362 3.94841 7.42679 3.84359C7.22996 3.73877 7.06256 3.58625 6.93992 3.4L6.39992 2.6C6.27851 2.41565 6.11323 2.26432 5.91892 2.1596C5.7246 2.05488 5.50732 2.00004 5.28659 2H2.66659C2.31296 2 1.97382 2.14048 1.72378 2.39052C1.47373 2.64057 1.33325 2.97971 1.33325 3.33333V12C1.33325 12.3536 1.47373 12.6928 1.72378 12.9428C1.97382 13.1929 2.31296 13.3333 2.66659 13.3333H13.3333Z",fill:"currentColor"})})}var pe=o.createContext({activeCollectionFolderSlugs:[],allCollectionFolderSlugs:[],allowCreateCollectionSlugs:[],breadcrumbs:[],checkIfItemIsDisabled:()=>!1,clearSelections:()=>{},currentFolder:null,documents:[],dragOverlayItem:void 0,focusedRowIndex:-1,folderCollectionConfig:null,folderCollectionSlug:"",folderFieldName:"folder",folderID:void 0,FolderResultsComponent:null,folderType:void 0,getFolderRoute:()=>"",getSelectedItems:()=>[],isDragging:!1,itemKeysToMove:void 0,moveToFolder:()=>Promise.resolve(void 0),onItemClick:()=>{},onItemKeyPress:()=>{},refineFolderData:()=>{},search:"",selectedFolderCollections:void 0,selectedItemKeys:new Set,setBreadcrumbs:()=>{},setFocusedRowIndex:()=>-1,setIsDragging:()=>!1,sort:"name",subfolders:[]});function pt({activeCollectionFolderSlugs:e,allCollectionFolderSlugs:t=[],allowCreateCollectionSlugs:n,allowMultiSelection:a=!0,baseFolderPath:l,breadcrumbs:r=[],children:i,documents:s,folderFieldName:u,folderID:h,FolderResultsComponent:f,onItemClick:g,search:b,sort:v="name",subfolders:w}){let j=pn(),{config:C}=(0,c.c)(),{routes:S}=C,k=af(),{t:_}=(0,d.d)(),$=(0,m.useRouter)(),{startRouteTransition:N}=te(),P=aN(),E=P?P.code:void 0,D=o.useRef(new Set),[T,A]=o.useState([]),[R,L]=o.useState(f||(()=>null)),[F]=o.useState(()=>C.collections.find(e=>C.folders&&e.slug===C.folders.slug)),O=F.slug,M=(0,m.useSearchParams)(),I=o.useMemo(()=>co(M),[M]),[B,z]=o.useState(I),[U,V]=o.useState(!1),[H,K]=o.useState(()=>new Set),[Q,Y]=o.useState(-1),[G,X]=o.useState(),[Z,J]=o.useState(r),ee=o.useRef(null),et=w.length+s.length,en=o.useCallback(()=>
42{Y(-1),K(new Set),X(void 0),D.current=new Set},[]),ea=o.useCallback((e={})=>{let t="page"in e?e.page:B?.page;return"search"in e&&(t="1"),{...B,...e,locale:E,page:t,relationTo:"relationTo"in e?e.relationTo:B?.relationTo,search:"search"in e?e.search:B?.search,sort:"sort"in e?e.sort:B?.sort??void 0}},[B,E]),el=o.useCallback(({query:e,updateURL:t})=>{if(t){let t=ea(e);N(()=>$.replace(`${x.A({...t,relationTo:JSON.stringify(t.relationTo)},{addQueryPrefix:!0})}`)),z(t)}},[ea,$,N]),er=o.useCallback(e=>{let t=x.A(ea({page:"1",search:""}),{addQueryPrefix:!0});return(0,y.Q)({adminRoute:C.routes.admin,path:`${l}${e?`/${e}`:""}${t}`})},[l,C.routes.admin,ea]),ei=o.useCallback(e=>[...w,...s].find(t=>t.itemKey===e),[s,w]),eo=o.useCallback(()=>Array.from(H).reduce((e,t)=>{let n=ei(t);return n&&e.push(n),e},[]),[H,ei]),es=o.useCallback(({collectionSlug:e,docID:t})=>{1===k?e===O?N(()=>{$.push(er(t)),en()}):e&&N(()=>{$.push((0,y.Q)({adminRoute:C.routes.admin,path:`/collections/${e}/${t}`})),en()}):en(),"function"==typeof g&&g(ei(`${e}-${t}`))},[en,C.routes.admin,k,O,er,ei,g,$,N]),ec=o.useCallback(e=>{let t=[...w,...s].reduce((e,t,n)=>(H.has(t.itemKey)&&e.push(n),e),[]);if(0===t.length)return[e];let n=Math.min(...t),a=Math.max(...t),l=e>=n&&e<=a,r=e,i=Math.min(r=l?e===n||e===a?e:Math.abs(e-n)>=Math.abs(e-a)?n:a:Math.abs(e-n)<=Math.abs(e-a)?n:a,e),o=Array.from({length:Math.max(r,e)-i+1},(e,t)=>i+t);return l?o:[...new Set([...t,...o])]},[w,s,H]),ed=o.useCallback(({indexes:e})=>{let{newSelectedFolderCollections:t,newSelectedItemKeys:n}=[...w,...s].reduce((t,n,a)=>(e.includes(a)&&(t.newSelectedItemKeys.add(n.itemKey),n.relationTo===O?n.value.folderType?.forEach(e=>{t.newSelectedFolderCollections.includes(e)||t.newSelectedFolderCollections.push(e)}):t.newSelectedFolderCollections.includes(n.relationTo)||t.newSelectedFolderCollections.push(n.relationTo)),t),{newSelectedFolderCollections:[],newSelectedItemKeys:new Set});A(t),K(n)},[s,O,w]),eu=o.useCallback(({event:e,item:t})=>{let{code:n,ctrlKey:l,metaKey:r,shiftKey:i}=e,o=l||r,c=H.has(t.itemKey),d=[...w,...s],u=d.findIndex(e=>e.itemKey===t.itemKey);switch(n){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":{if(e.preventDefault(),-1===u)break;let t="ArrowLeft"===n||"ArrowUp"===n?u-1:u+1;if(t<0||t>et-1)return;if(Y(t),o)break;if(i&&a)return void ed({indexes:ec(t)});i||K(new Set([d[t].itemKey]));break}case"Enter":if(1===H.size){Y(void 0),es({collectionSlug:t.relationTo,docID:(0,q.r)(t.value)});return}break;case"Escape":en();break;case"KeyA":a&&o&&(e.preventDefault(),Y(et-1),ed({indexes:Array.from({length:et},(e,t)=>t)}));break;case"Space":a&&i?(e.preventDefault(),ed({indexes:[...w,...s].reduce((e,n,a)=>{if(n.itemKey===t.itemKey){if(c)return e;e.push(a)}else H.has(n.itemKey)&&e.push(a);return e},[])})):(e.preventDefault(),ed({indexes:c?[]:[u]}));break;case"Tab":if(a&&i){let e=u-1;e<0&&H?.size>0&&Y(e)}else u+1===et&&H.size>0&&Y(et-1)}},[H,w,s,a,ec,ed,es,en,et]),ep=o.useCallback(({event:e,item:t})=>{let n=!1,l=e.ctrlKey||e.metaKey,r=e.shiftKey,i=H.has(t.itemKey),o=[...w,...s],c=o.findIndex(e=>e.itemKey===t.itemKey);if(a&&l){let n;e.preventDefault(),ed({indexes:o.reduce((a,l,r)=>{if(l.itemKey===t.itemKey){if(i&&"pointermove"!==e.type)return a;a.push(r),n=l.itemKey}else H.has(l.itemKey)&&a.push(r);return a},[])}),n&&X(ei(n))}else if(a&&r)-1!==c&&ed({indexes:ec(c)});else if(a&&"pointermove"===e.type)i||ed({indexes:o.reduce((e,n,a)=>(n.itemKey===t.itemKey&&e.push(a),e),[])}),X(ei(t.itemKey));else{let e=Date.now();n=e-ee.current<400&&G?.itemKey===t.itemKey,ee.current=e,n||ed({indexes:i&&1===H.size?[]:[c]}),X(ei(t.itemKey))}n&&es({collectionSlug:t.relationTo,docID:(0,q.r)(t.value)})},[H,w,s,a,G,ei,ed,es,ec]),eh=o.useCallback(async e=>{let{itemsToMove:t,toFolderID:n}=e;if(t.length){if(1===t.length&&t[0].relationTo===O&&t[0].value.id===h){let e=x.A({depth:0,locale:E},{addQueryPrefix:!0});200!==(await fetch((0,y.Q)({apiRoute:S.api,path:`/${O}/${h}${e}`}),{body:JSON.stringify({[u]:n||null}),credentials:"include",headers:{"content-type":"application/json"},method:"PATCH"})).status&&e3.error(_("general:error"))}else for(let[e,a]of Object.entries(t.reduce((e,t)=>
42(e[t.relationTo]||(e[t.relationTo]=[]),e[t.relationTo].push(t.value.id),e),{}))){let t=x.A({depth:0,limit:0,locale:E,where:{id:{in:a}}},{addQueryPrefix:!0});try{await fetch((0,y.Q)({apiRoute:S.api,path:`/${e}${t}`}),{body:JSON.stringify({[u]:n||null}),credentials:"include",headers:{"content-type":"application/json"},method:"PATCH"})}catch(e){e3.error(_("general:error")),console.error(e);continue}}en()}},[h,en,O,u,S.api,_,E]),ef=o.useCallback(e=>{function t({item:e,selectedFolderCollections:n}){return!(!e.value.folderType||Array.isArray(e.value.folderType)&&0===e.value.folderType.length)&&(0===n.length?!!(e.value.folderType||e.value.folderType.length>0):n.some(t=>!e.value.folderType.includes(t)))}return U?!!H.has(e.itemKey)||e.relationTo!==O||t({item:e,selectedFolderCollections:T}):j?.selectedItemKeys?.size?!!j.selectedItemKeys.has(e.itemKey)||e.relationTo!==O||t({item:e,selectedFolderCollections:j.selectedFolderCollections}):void 0},[T,U,H,O,j?.selectedFolderCollections,j?.selectedItemKeys]);return o.useEffect(()=>{f&&L(f)},[f]),(0,p.jsx)(pe,{value:{activeCollectionFolderSlugs:e||t,allCollectionFolderSlugs:t,allowCreateCollectionSlugs:n,breadcrumbs:Z,checkIfItemIsDisabled:ef,clearSelections:en,currentFolder:Z?.[Z.length-1]?.id!==void 0?(0,W.p)({folderFieldName:u,isUpload:!1,relationTo:O,useAsTitle:F.admin.useAsTitle,value:Z[Z.length-1]}):null,documents:s,dragOverlayItem:G,focusedRowIndex:Q,folderCollectionConfig:F,folderCollectionSlug:O,folderFieldName:u,folderID:h,FolderResultsComponent:R,folderType:Z?.[Z.length-1]?.folderType,getFolderRoute:er,getSelectedItems:eo,isDragging:U,itemKeysToMove:j.selectedItemKeys,moveToFolder:eh,onItemClick:ep,onItemKeyPress:eu,refineFolderData:el,search:b,selectedFolderCollections:T,selectedItemKeys:H,setBreadcrumbs:J,setFocusedRowIndex:Y,setIsDragging:V,sort:v,subfolders:w},children:i})}function pn(){let e=o.use(pe);if(void 0===e)throw Error("useFolder must be used within a FolderProvider");return e}var pa=(0,o.createContext)({cachingEnabled:!0,clearRouteCache:()=>{}}),pl=e=>{let t,n,a,l,r=(0,g.c)(17),{cachingEnabled:i,children:s}=e,c=void 0===i||i,d=(0,m.usePathname)(),u=(0,m.useRouter)(),h=(0,o.useRef)(!1),f;r[0]!==u?(f=()=>{u.refresh()},r[0]=u,r[1]=f):f=r[1];let b=f,v;r[2]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{let e=()=>{h.current=!0};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)}},r[2]=v):v=r[2],r[3]!==u?(t=[u],r[3]=u,r[4]=t):t=r[4],(0,o.useEffect)(v,t),r[5]!==c||r[6]!==b?(n=e=>{(c||h.current)&&(h.current=!1,b())},r[5]=c,r[6]=b,r[7]=n):n=r[7];let y=tv(n),x;return r[8]!==y||r[9]!==d?(x=()=>{y(d)},r[8]=y,r[9]=d,r[10]=x):x=r[10],r[11]!==d?(a=[d],r[11]=d,r[12]=a):a=r[12],(0,o.useEffect)(x,a),r[13]!==c||r[14]!==s||r[15]!==b?(l=(0,p.jsx)(pa,{value:{cachingEnabled:c,clearRouteCache:b},children:s}),r[13]=c,r[14]=s,r[15]=b,r[16]=l):l=r[16],l},pr=()=>(0,o.use)(pa),pi=e=>{let{type:t="submit",buttonId:n,children:a,disabled:l,onClick:r,programmaticSubmit:i,ref:o}=e,s=eF(),c=eO(),d=eI(),{disabled:u,submit:h}=eT();return(0,p.jsx)("div",{className:"form-submit",children:(0,p.jsx)(tN,{ref:o,...e,disabled:!!(l||d||s||c||u)||void 0,id:n,onClick:r??(i?()=>{h()}:void 0),type:t,children:a})})},po="drawer-action-header",ps=e=>{let t=(0,g.c)(10),{cancelLabel:n,className:a,onCancel:l,onSave:r,saveLabel:i,title:o}=e,{t:s}=(0,d.d)(),c;t[0]!==a?(c=[po,a].filter(Boolean),t[0]=a,t[1]=c):c=t[1];let u=c.join(" "),h;return t[2]!==n||t[3]!==l||t[4]!==r||t[5]!==i||t[6]!==s||t[7]!==u||t[8]!==o?(h=(0,p.jsx)("div",{className:u,children:(0,p.jsxs)("div",{className:`${po}__content`,children:[(0,p.jsx)("h1",{className:`${po}__title`,children:o}),(0,p.jsxs)("div",{className:`${po}__actions`,children:[(0,p.jsx)(tN,{"aria-label":s("general:cancel"),buttonStyle:"secondary",onClick:l,children:n||s("general:cancel")}),(0,p.jsx)(pi,{"aria-label":s("general:applyChanges"),onClick:r,children:i||s("general:applyChanges")})]})]})}),t[2]=n,t[3]=l,t[4]=r,t[5]=i,t[6]=s,t[7]=u,t[8]=o,t[9]=h):h=t[9],h};function pc({children:e,className:t}){return(0,p.jsx)("div",{className:["drawer-content-container",t].filter(
42Boolean).join(" "),children:e})}var pd=({elements:e,translationString:t})=>{let n=t.split(/(<[^>]+>.*?<\/[^>]+>)/g);return(0,p.jsx)("span",{children:n.map((t,n)=>{if(e&&t.startsWith("<")&&t.endsWith(">")){let a=t[1],l=e[a];if(l){let e=RegExp(`<${a}>(.*?)</${a}>`,"g"),r=t.replace(e,(e,t)=>t);return(0,p.jsx)(l,{children:(0,p.jsx)(pd,{translationString:r})},n)}}return t})})},pu=({elements:e,i18nKey:t,t:n,variables:a})=>{let l=n(t,a||{});return e?(0,p.jsx)(pd,{elements:e,translationString:l}):l},pp="folderBreadcrumbs";function ph({breadcrumbs:e,className:t}){return(0,p.jsx)("div",{className:`${pp} ${t||""}`.trim(),children:e?.map((t,n)=>(0,p.jsxs)("div",{className:`${pp}__crumb`,children:[t.onClick?(0,p.jsx)(pf,{className:`${pp}__crumb-item`,id:t.id,onClick:t.onClick,children:t.name}):t.name,e.length>0&&n!==e.length-1&&(0,p.jsx)(to,{className:`${pp}__crumb-chevron`,direction:"right"})]},n))})}function pf(e){let t,n=(0,g.c)(13),{id:a,children:l,className:r,onClick:i}=e,o=`folder-${a}`,s;n[0]!==a?(s={id:a,type:"folder"},n[0]=a,n[1]=s):s=n[1],n[2]!==o||n[3]!==s?(t={id:o,data:s},n[2]=o,n[3]=s,n[4]=t):t=n[4];let{isOver:c,setNodeRef:d}=(0,v.zM)(t),u=c&&"droppable-button--hover",h;
42n[5]!==r||n[6]!==u?(h=["droppable-button",r,u].filter(Boolean),n[5]=r,n[6]=u,n[7]=h):h=n[7];let f=h.join(" "),m;return n[8]!==l||n[9]!==i||n[10]!==d||n[11]!==f?(m=(0,p.jsx)("button",{className:f,onClick:i,ref:d,type:"button",children:l}),n[8]=l,n[9]=i,n[10]=d,n[11]=f,n[12]=m):m=n[12],m}function pm(){return(0,p.jsx)(u9,{className:"colored-folder-icon"})}var pg="move-folder-drawer",pb="move-folder-drawer-confirm-move";function pv(e){return(0,p.jsx)(au,{gutter:!1,Header:null,slug:e.drawerSlug,children:(0,p.jsx)(py,{...e})})}function py(e){let{permissions:t}=aj(),[n,a]=o.useState([]),[l,r]=o.useState([]),[i,s]=o.useState([]),[c,d]=o.useState(null),[u,h]=o.useState(!1),[f,m]=o.useState(e.fromFolderID||null),g=o.useRef(!1),{getFolderResultsComponentAndData:b}=cf(),v=o.useCallback(async t=>{try{let n=await b({browseByFolder:!1,collectionsToDisplay:[e.folderCollectionSlug],displayAs:"grid",folderAssignedCollections:e.folderAssignedCollections,folderID:t,sort:"name"});s(n.breadcrumbs||[]),a(n?.subfolders||[]),r(n?.documents||[]),d(n.FolderResultsComponent||null),m(t),h(!0)}catch{s([]),a([]),r([])}g.current=!0},[b,e.folderAssignedCollections,e.folderCollectionSlug]);return o.useEffect(()=>{g.current||v(e.fromFolderID)},[v,e.fromFolderID]),u?(0,p.jsx)(pt,{allCollectionFolderSlugs:[e.folderCollectionSlug],allowCreateCollectionSlugs:t.collections[e.folderCollectionSlug]?.create?[e.folderCollectionSlug]:[],allowMultiSelection:!1,breadcrumbs:i,documents:l,folderFieldName:e.folderFieldName,folderID:f,FolderResultsComponent:c,onItemClick:async e=>{await v(e.value.id)},subfolders:n,children:(0,p.jsx)(px,{...e,populateMoveToFolderDrawer:v})},f):(0,p.jsx)(cE,{})}function px(e){let t,n,a,l,r,i=(0,g.c)(38),{drawerSlug:s,fromFolderID:c,fromFolderName:u,itemsToMove:f,onConfirm:m,populateMoveToFolderDrawer:b,skipConfirmModal:v,...y}=e,{clearRouteCache:x}=pr(),{closeModal:w,isModalOpen:j,openModal:C}=nN(),S;i[0]!==f?(S=()=>f.length,i[0]=f,i[1]=S):S=i[1];let[k]=o.useState(S),[_,$]=o.useState(!1),{i18n:N,t:P}=(0,d.d)(),{breadcrumbs:E,folderCollectionConfig:D,folderCollectionSlug:T,folderFieldName:A,folderID:R,FolderResultsComponent:L,folderType:F,getSelectedItems:O,subfolders:M}=pn(),I;i[2]!==T?(I={collectionSlug:T},i[2]=T,i[3]=I):I=i[3];let[B,,z]=cV(I),{closeDrawer:U,openDrawer:V}=z,H=null==R?y.folderAssignedCollections:F,W;i[4]!==E||i[5]!==O?(W=()=>{let e=O();if(0!==e.length)return{id:e[0].value.id,name:e[0].value._folderOrDocumentTitle};{let e=E?.[E.length-1];return{id:e?.id||null,name:e?.name||null}}},i[4]=E,i[5]=O,i[6]=W):W=i[6];let K=W,Q;i[7]!==T||i[8]!==R||i[9]!==c||i[10]!==b?(Q=async e=>{let{collectionSlug:t,doc:n}=e;await b(R),t===T&&(n?.folder&&c===(0,q.r)(n?.folder)||!c&&!n?.folder)&&$(!0)},i[7]=T,i[8]=R,i[9]=c,i[10]=b,i[11]=Q):Q=i[11];let Y=Q,G;i[12]!==K||i[13]!==m?(G=()=>{"function"==typeof m&&m(K())},i[12]=K,i[13]=m,i[14]=G):G=i[14];let X=G,Z,J;return i[15]!==x||i[16]!==s||i[17]!==_||i[18]!==j?(Z=()=>{!j(s)&&_&&($(!1),x())},J=[s,j,x,_],i[15]=x,i[16]=s,i[17]=_,i[18]=j,i[19]=Z,i[20]=J):(Z=i[19],J=i[20]),o.useEffect(Z,J),i[21]!==w||i[22]!==s?(t=()=>{w(s)},i[21]=w,i[22]=s,i[23]=t):t=i[23],i[24]!==X||i[25]!==C||i[26]!==v?(n=()=>{v?X():C(pb)},i[24]=X,i[25]=C,i[26]=v,i[27]=n):n=i[27],i[28]!==E.length||i[29]!==b?(a=E.length?()=>{b(null)}:void 0,i[28]=E.length,i[29]=b,i[30]=a):a=i[30],i[31]!==E.length||i[32]!==b?(l=(e,t)=>({id:e.id,name:e.name,onClick:t!==E.length-1?()=>{b(e.id)}:void 0}),i[31]=E.length,i[32]=b,i[33]=l):l=i[33],i[34]!==U||i[35]!==D||i[36]!==Y?(r=e=>{Y({collectionSlug:D.slug,doc:e.doc}),U()},i[34]=U,i[35]=D,i[36]=Y,i[37]=r):r=i[37],(0,p.jsxs)("div",{className:pg,children:[(0,p.jsx)(ps,{onCancel:t,onSave:n,saveLabel:P("general:select"),title:(0,p.jsx)(pw,{action:y.action,count:k,fromFolderName:c?u:void 0,title:"moveItemToFolder"===y.action?y.title:void 0})}),(0,p.jsxs)("div",{className:`${pg}__breadcrumbs-section`,children:[(0,p.jsx)(ph,{breadcrumbs:[{id:null,name:(0,p.jsxs)("span",{className:`${pg}__folder-breadcrumbs-root`,children:[(0,p.jsx)(pm,{}),P("folder:folders")]}),onClick:a},...E.map(l)]}),M.length>0&&(0,p.jsx)(tN,{buttonStyle:"pill",className:`${pg}__add-folder-button`,margin:!1,onClick:()=>{V()},children:P("fields:addLabel",{label:(0,h.s)(D.labels?.singular,N
42)})})]}),(0,p.jsx)(B,{initialData:{[A]:R,folderType:H},onSave:r,redirectAfterCreate:!1}),(0,p.jsx)(pc,{className:`${pg}__body-section`,children:M.length>0?L:(0,p.jsx)(cq,{Actions:[(0,p.jsx)(tN,{buttonStyle:"primary",className:`${pg}__create-folder-button`,onClick:()=>{V()},size:"medium",children:`${P("general:create")} ${(0,h.s)(D.labels?.singular,N).toLowerCase()}`},"create-folder")],Message:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("h3",{children:N.t("general:noResultsFound")}),(0,p.jsx)("p",{children:N.t("general:noResultsDescription")})]})})}),!v&&(0,p.jsx)(ag,{body:(0,p.jsx)(pj,{action:y.action,count:k,fromFolderName:u,title:"moveItemToFolder"===y.action?y.title:void 0,toFolderName:K().name}),confirmingLabel:P("general:moving"),confirmLabel:P("general:move"),heading:P("general:confirmMove"),modalSlug:pb,onConfirm:X})]})}function pw(e){let t=(0,g.c)(14),{t:n}=(0,d.d)();switch(e.action){case"moveItemToFolder":if(e.fromFolderName){let a;return t[0]!==e.fromFolderName||t[1]!==e.title||t[2]!==n?(a=n("folder:movingFromFolder",{fromFolder:e.fromFolderName,title:e.title}),t[0]=e.fromFolderName,t[1]=e.title,t[2]=n,t[3]=a):a=t[3],a}{let a;return t[4]!==e.title||t[5]!==n?(a=n("folder:selectFolderForItem",{title:e.title}),t[4]=e.title,t[5]=n,t[6]=a):a=t[6],a}case"moveItemsToFolder":if(e.fromFolderName){let a=`${e.count} ${n(e.count>1?"general:items":"general:item")}`,l;return t[7]!==e.fromFolderName||t[8]!==n||t[9]!==a?(l=n("folder:movingFromFolder",{fromFolder:e.fromFolderName,title:a}),t[7]=e.fromFolderName,t[8]=n,t[9]=a,t[10]=l):l=t[10],l}{let a=`${e.count} ${n(e.count>1?"general:items":"general:item")}`,l;return t[11]!==n||t[12]!==a?(l=n("folder:selectFolderForItem",{title:a}),t[11]=n,t[12]=a,t[13]=l):l=t[13],l}}}function pj(e){let t=(0,g.c)(14),{t:n}=(0,d.d)();switch(e.action){case"moveItemToFolder":if(e.toFolderName){let a;return t[0]!==e.title||t[1]!==e.toFolderName||t[2]!==n?(a=(0,p.jsx)(pu,{elements:{1:pN,2:p$},i18nKey:"folder:moveItemToFolderConfirmation",t:n,variables:{title:e.title,toFolder:e.toFolderName}}),t[0]=e.title,t[1]=e.toFolderName,t[2]=n,t[3]=a):a=t[3],a}{let a;return t[4]!==e.title||t[5]!==n?(a=(0,p.jsx)(pu,{elements:{1:p_},i18nKey:"folder:moveItemToRootConfirmation",t:n,variables:{title:e.title}}),t[4]=e.title,t[5]=n,t[6]=a):a=t[6],a}case"moveItemsToFolder":if(e.toFolderName){let a;return t[7]!==e.count||t[8]!==e.toFolderName||t[9]!==n?(a=(0,p.jsx)(pu,{elements:{1:pk,2:pS},i18nKey:"folder:moveItemsToFolderConfirmation",t:n,variables:{count:e.count,label:n(e.count>1?"general:items":"general:item"),toFolder:e.toFolderName}}),t[7]=e.count,t[8]=e.toFolderName,t[9]=n,t[10]=a):a=t[10],a}{let a;return t[11]!==e.count||t[12]!==n?(a=(0,p.jsx)(pu,{elements:{1:pC},i18nKey:"folder:moveItemsToRootConfirmation",t:n,variables:{count:e.count,label:n(e.count>1?"general:items":"general:item")}}),t[11]=e.count,t[12]=n,t[13]=a):a=t[13],a}}}function pC(e){let{children:t}=e;return(0,p.jsx)("strong",{children:t})}function pS(e){let{children:t}=e;return(0,p.jsx)("strong",{children:t})}function pk(e){let{children:t}=e;return(0,p.jsx)("strong",{children:t})}function p_(e){let{children:t}=e;return(0,p.jsx)("strong",{children:t})}function p$(e){let{children:t}=e;return(0,p.jsx)("strong",{children:t})}function pN(e){let{children:t}=e;return(0,p.jsx)("strong",{children:t})}function pP(e){let t=(0,g.c)(29),{buttonProps:n,className:a,folderCollectionSlug:l,folderFieldName:r}=e,i=void 0===a?"":a,{t:s}=(0,d.d)(),u=eB(pE),h;t[0]!==r?(h=e=>{let[t]=e;return t&&t?.[r]||null},t[0]=r,t[1]=h):h=t[1];let f=eB(h),m=f?.value,{id:b,collectionSlug:v,initialData:x,title:w}=lE(),{setModified:j}=eT(),C;t[2]!==s?(C=()=>`${s("general:loading")}...`,t[2]=s,t[3]=C):C=t[3];let[S,k]=o.useState(C),{config:_}=(0,c.c)(),$=(0,o.useId)(),N,P;t[4]!==_.routes.api||t[5]!==l||t[6]!==m||t[7]!==s?(N=()=>{!async function(){if(m&&("string"==typeof m||"number"==typeof m)){let e=await (await fetch((0,y.Q)({apiRoute:_.routes.api,path:`/${l}/${m}`}))).json();k(e?.name||s("folder:noFolder"))}else k(s("folder:noFolder"))}()},P=[l,_.routes.api,m,s],t[4]=_.routes.api,t[5]=l,t[6]=m,t[7]=s,t[8]=N,t[9]=P):(N=t[8],P=t[9]),o.useEffect(N,P);let E=`move-to-folder-${$}`,D;t[10]!==f||t[11]!==u||t[12]!==r||t[13]!==j?(D=e=>{let{id:t}=e;f.value!==t&&(u({type:"UPDATE",path:r,value:t}),j(!0))},t[10]=f,t[11]=u,t[12]=r,t[13]=j,t[14]=D):D=t[14];let T=!f?.value,A;return t[15]!==n||t[16]!==i||t[17]!==v||t[18]!==l||t[19]!==r||t[20]!==m||t[21]!==S||t[22]!==b||t[23]!==x||t[24]!==E||t[25]!==D||t[26]!==T||t[27]!==w?(A=(0,p.jsx)(pD,{buttonProps:n,className:i,collectionSlug:v,docData:x,docID:b,docTitle:w,folderCollectionSlug:l,folderFieldName:r,fromFolderID:m,fromFolderName:S,modalSlug:E,onConfirm:D,skipConfirmModal:T}),t[15]=n,t[16]=i,t[17]=v,t[18]=l,t[19]=r,t[20]=m,t[21]=S,t[22]=b,t[23]=x,t[24]=E,t[25]=D,t[26]=T,t[27]=w,t[28]=A):A=t[28],A}function pE(e){let[,t]=e;return t}var pD=e=>{let t=(0,g.c)(22),{buttonProps:n,className:a,collectionSlug:l,docData:r,docID:i,docTitle:o,folderCollectionSlug:s,folderFieldName:u,fromFolderID:f,fromFolderName:m,modalSlug:b,onConfirm:v,ski
42pConfirmModal:y}=e,{getEntityConfig:x}=(0,c.c)(),{i18n:w,t:j}=(0,d.d)(),{closeModal:C,openModal:S}=nN(),k=af(),_;if(t[0]!==n||t[1]!==a||t[2]!==C||t[3]!==l||t[4]!==r||t[5]!==i||t[6]!==o||t[7]!==k||t[8]!==s||t[9]!==u||t[10]!==f||t[11]!==m||t[12]!==x||t[13]!==w||t[14]!==b||t[15]!==v||t[16]!==S||t[17]!==y||t[18]!==j){let e=ac({slug:b,depth:k}),c=o||(0,h.s)(x({collectionSlug:l}).labels.singular,w),d;t[20]!==a?(d=["move-doc-to-folder",a].filter(Boolean),t[20]=a,t[21]=d):d=t[21],_=(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(tN,{buttonStyle:"subtle",className:d.join(" "),icon:(0,p.jsx)(u9,{}),iconPosition:"left",onClick:()=>{S(e)},...n,children:m}),(0,p.jsx)(pv,{action:"moveItemToFolder",drawerSlug:e,folderAssignedCollections:[l],folderCollectionSlug:s,folderFieldName:u,fromFolderID:f,fromFolderName:m,itemsToMove:[{itemKey:`${l}-${i}`,relationTo:l,value:{...r,id:i}}],onConfirm:async t=>{if(f!==t.id&&"function"==typeof v)try{await v(t),t.id?e3.success(j("folder:itemHasBeenMoved",{folderName:`"${t.name}"`,title:c})):e3.success(j("folder:itemHasBeenMovedToRoot",{title:c}))}catch(e){}C(e)},skipConfirmModal:y,title:c})]}),t[0]=n,t[1]=a,t[2]=C,t[3]=l,t[4]=r,t[5]=i,t[6]=o,t[7]=k,t[8]=s,t[9]=u,t[10]=f,t[11]=m,t[12]=x,t[13]=w,t[14]=b,t[15]=v,t[16]=S,t[17]=y,t[18]=j,t[19]=_}else _=t[19];return _},pT={x:0,y:0,width:0,height:0,unit:"px"},pA=(e,t,n)=>Math.min(Math.max(e,t),n),pR=(e,t)=>e===t||e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit;function pL(e,t,n){return"%"===e.unit?{...pT,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function pF(e,t,n){return e.unit?"px"===e.unit?{...pT,...e,unit:"px"}:{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{...pT,...e,unit:"px"}}function pO(e,t,n,a,l,r=0,i=0,o=a,s=l){let c={...e},d=Math.min(r,a),u=Math.min(i,l),p=Math.min(o,a),h=Math.min(s,l);t&&(t>1?(u=(d=i?i*t:d)/t,p=o*t):(d=(u=r?r/t:u)*t,h=s/t)),c.y<0&&(c.height=Math.max(c.height+c.y,u),c.y=0),c.x<0&&(c.width=Math.max(c.width+c.x,d),c.x=0);let f=a-(c.x+c.width);f<0&&(c.x=Math.min(c.x,a-d),c.width+=f);let m=l-(c.y+c.height);if(m<0&&(c.y=Math.min(c.y,l-u),c.height+=m),c.width<d&&(("sw"===n||"nw"==n)&&(c.x-=d-c.width),c.width=d),c.height<u&&(("nw"===n||"ne"==n)&&(c.y-=u-c.height),c.height=u),c.width>p&&(("sw"===n||"nw"==n)&&(c.x-=p-c.width),c.width=p),c.height>h&&(("nw"===n||"ne"==n)&&(c.y-=h-c.height),c.height=h),t){let e=c.width/c.height;if(e<t){let e=Math.max(c.width/t,u);("nw"===n||"ne"==n)&&(c.y-=e-c.height),c.height=e}else if(e>t){let e=Math.max(c.height*t,d);("sw"===n||"nw"==n)&&(c.x-=e-c.width),c.width=e}}return c}var pM={capture:!0,passive:!1},pI=class e extends o.PureComponent{constructor(){super(...arguments),this.docMoveBound=!1,this.mouseDownOnCrop=!1,this.dragStarted=!1,this.evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0},this.componentRef=(0,o.createRef)(),this.mediaRef=(0,o.createRef)(),this.initChangeCalled=!1,this.state={cropIsActive:!1,newCropIsBeingDrawn:!1},this.onCropPointerDown=e=>{let{crop:t,disabled:n}=this.props,a=this.getBox();if(!t)return;let l=pF(t,a.width,a.height);if(n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let r=e.target.dataset.ord,i=e.clientX,o=e.clientY,s=l.x,c=l.y;if(r){let t=e.clientX-a.x,n=e.clientY-a.y,d=0,u=0;"ne"===r||"e"==r?(d=t-(l.x+l.width),u=n-l.y,s=l.x,c=l.y+l.height):"se"===r||"s"===r?(d=t-(l.x+l.width),u=n-(l.y+l.height),s=l.x,c=l.y):"sw"===r||"w"==r?(d=t-l.x,u=n-(l.y+l.height),s=l.x+l.width,c=l.y):("nw"===r||"n"==r)&&(d=t-l.x,u=n-l.y,s=l.x+l.width,c=l.y+l.height),i=s+a.x+d,o=c+a.y+u}this.evData={startClientX:i,startClientY:o,startCropX:s,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:!!r,ord:r},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})},this.onComponentPointerDown=e=>{let{crop:t,disabled:n,locked:a,keepSelection:l,onChange:r}=this.props,i=this.getBox();if(n||a||l&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let o=e.clientX-i.x,s=e.clientY-i.y,c={unit:"px",x:o,y:s,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:o,startCropY:s,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,r(pF(c,i.width,i.height),pL(c,i.width,i.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})},this.onDocPointerMove=e=>{let t,{crop:n,disabled:a,onChange:l,onDragStart:r}=this.props,i=this.getBox();if(a||!n||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,r&&r(e));let{evData:o}=this;o.clientX=e.clientX,o.clientY=e.clientY,pR(n,t=o.isResize?this.resizeCrop():this.dragCrop())||l(pF(t,i.width,i.height),pL(t,i.width,i.height))},this.onComponentKeyDown=t=>{let{crop:n,disabled:a,onChange:l,onComplete:r}=this.props;if(a)return;let i=t.key,o=!1;if(!n)return;let s=this.getBox(),c=this.makePixelCrop(s),d=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep;if("ArrowLeft"===i?(c.x-=d,o=!0):"ArrowRight"===i?(c.x+=d,o=!0):"ArrowUp"===i?(c.y-=d,o=!0):"ArrowDown"===i&&(c.y+=d,o=!0),o){t.cancelable&&t.preventDefault(),c.x=pA(c.x,0,s.width-c.width),c.y=pA(c.y,0,s.height-c.height);let e=pF(c,s.width,s.height),n=pL(c,s.width,s.height);l(e,n),r&&r(e,n)}},this.onHandlerKeyDown=(t,n)=>{var a,l;let r,{aspect:i=0,crop:o,disabled:s,minWidth:c=0,minHeight:d=0,maxWidth:u,maxHeight:p,onChange:h,onComplete:f}=this.props,m=this.getBox();if(s||!o||"ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.stopPropagation(),t.preventDefault();let g=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep,b=pO((a=pF(o,m.width,m.height),l=t.key,r={...a},"ArrowLeft"===l?"nw"===n?(r.x-=g,r.y-=g,r.width+=g,r.height+=g):"w"===n?(r.x-=g,r.width+=g):"sw"===n?(r.x-=g,r.width+=g,r.height+=g):"ne"===n?(r.y+=g,r.width-=g,r.height-=g):"e"===n?r.width-=g:"se"===n&&(r.width-=g,r.height-=g):"ArrowRight"===l&&("nw"===n?(r.x+=g,r.y+=g,r.width-=g,r.height-=g):"w"===n?(r.x+=g,r.width-=g):"sw"===n?(r.x+=g,r.width-=g,r.height-=g):"ne"===n?(r.y-=g,r.width+=g,r.height+=g):"e"===n?r.width+=g:"se"===n&&(r.width+=g,r.height+=g)),"ArrowUp"===l?"nw"===n?(r.x-=g,r.y-=g,r.width+=g,r.height+=g):"n"===n?(r.y-=g,r.height+=g):"ne"===n?(r.y-=g,r.width+=g,r.height+=g):"sw"===n?(r.x+=g,r.width-=g,r.height-=g):"s"===n?r.height-=g:"se"===n&&(r.width-=g,r.height-=g):"ArrowDown"===l&&("nw"===n?(r.x+=g,r.y+=g,r.width-=g,r.height-=g):"n"===n?(r.y+=g,r.height-=g):"ne"===n?(r.y+=g,r.width-=g,r.height-=g):"sw"===n?(r.x-=g,r.width+=g,r.height+=g):"s"===n?r.height+=g:"se"===n&&(r.width+=g,r.height+=g)),r),i,n,m.width,m.height,c,d,u,p);if(!pR(o,b)){let e=pL(b,m.width,m.height);h(b,e),f&&f(b,e)}},this.onDocPointerDone=e=>{let{crop:t,disabled:n,onComplete:a,onDragEnd:l}=this.props,r=this.getBox();this.unbindDocMove(),!(n||!t)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,l&&l(e),a&&a(pF(t,r.width,r.height),pL(t,r.width,r.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))},this.onDragFocus=e=>{var t;null==(t=this.componentRef.current)||t.scrollTo(0,0)}}get document(){return document}getBox(){let e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};let{x:t,y:n,width:a,height:l}=e.getBoundingClientRect();return{x:t,y:n,width:a,height:l}}componentDidUpdate(e){let{crop:t,onComplete:n}=this.props;if(n&&!e.crop&&t){let{width:e,height:a}=this.getBox();e&&a&&n(pF(t,e,a),pL(t,e,a))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,pM),this.document.addEventListener("pointerup",this.onDocPointerDone,pM),this.document.addEventListener("pointercancel",this.onDocPointerDone,pM),this.docMoveBound=!0)}
42unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,pM),this.document.removeEventListener("pointerup",this.onDocPointerDone,pM),this.document.removeEventListener("pointercancel",this.onDocPointerDone,pM),this.docMoveBound=!1)}getCropStyle(){let{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){let{evData:e}=this,t=this.getBox(),n=this.makePixelCrop(t),a=e.clientX-e.startClientX,l=e.clientY-e.startClientY;return n.x=pA(e.startCropX+a,0,t.width-n.width),n.y=pA(e.startCropY+l,0,t.height-n.height),n}getPointRegion(e,t,n,a){let{evData:l}=this,r=l.clientX-e.x,i=l.clientY-e.y,o;return o=a&&t?"nw"===t||"n"===t||"ne"===t:i<l.startCropY,(n&&t?"nw"===t||"w"===t||"sw"===t:r<l.startCropX)?o?"nw":"sw":o?"ne":"se"}resolveMinDimensions(e,t,n=0,a=0){let l=Math.min(n,e.width),r=Math.min(a,e.height);return t&&(l||r)?t>1?l?[l,l/t]:[r*t,r]:r?[r*t,r]:[l,l/t]:[l,r]}resizeCrop(){let{evData:t}=this,{aspect:n=0,maxWidth:a,maxHeight:l}=this.props,r=this.getBox(),[i,o]=this.resolveMinDimensions(r,n,this.props.minWidth,this.props.minHeight),s=this.makePixelCrop(r),c=this.getPointRegion(r,t.ord,i,o),d=t.ord||c,u=t.clientX-t.startClientX,p=t.clientY-t.startClientY;(i&&"nw"===d||"w"===d||"sw"===d)&&(u=Math.min(u,-i)),(o&&"nw"===d||"n"===d||"ne"===d)&&(p=Math.min(p,-o));let h={unit:"px",x:0,y:0,width:0,height:0};"ne"===c?(h.x=t.startCropX,h.width=u,n?h.height=h.width/n:h.height=Math.abs(p),h.y=t.startCropY-h.height):"se"===c?(h.x=t.startCropX,h.y=t.startCropY,h.width=u,n?h.height=h.width/n:h.height=p):"sw"===c?(h.x=t.startCropX+u,h.y=t.startCropY,h.width=Math.abs(u),n?h.height=h.width/n:h.height=p):"nw"===c&&(h.x=t.startCropX+u,h.width=Math.abs(u),n?(h.height=h.width/n,h.y=t.startCropY-h.height):(h.height=Math.abs(p),h.y=t.startCropY+p));let f=pO(h,n,c,r.width,r.height,i,o,a,l);return n||e.xyOrds.indexOf(d)>-1?s=f:e.xOrds.indexOf(d)>-1?(s.x=f.x,s.width=f.width):e.yOrds.indexOf(d)>-1&&(s.y=f.y,s.height=f.height),s.x=pA(s.x,0,r.width-s.width),s.y=pA(s.y,0,r.height-s.height),s}createCropSelection(){let{ariaLabels:t=e.defaultProps.ariaLabels,disabled:n,locked:a,renderSelectionAddon:l,ruleOfThirds:r,crop:i}=this.props,s=this.getCropStyle();if(i)return o.createElement("div",{style:s,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":t.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!a&&o.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},o.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),o.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),o.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),o.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":t.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":t.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":t.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":t.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":t.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":t.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":t.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),o.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":t.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),l&&o.createElement("div",{className:"ReactCrop__selection-addon",onMouseDown:e=>e.stopPropagation()},l(this.state)),r&&o.createElement(o.Fragment,null,o.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),o.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){return pF({...pT,...this.props.crop||{}},e.width,e.height)}render(){let{aspect:e,children:t,circularCrop:n,className:a,crop:l,disabled:r,locked:i,style:s,ruleOfThirds:c}=this.props,{cropIsActive:d,newCropIsBeingDrawn:u}=this.state,p=l?this.createCropSelection():null,h=((...e)=>e.filter(e=>e&&"string"==typeof e).join(" "))("ReactCrop",a,d&&"ReactCrop--active",r&&"ReactCrop--disabled",i&&"ReactCrop--locked",u&&"ReactCrop--new-crop",l&&e&&"ReactCrop--fixed-aspect",l&&n&&"ReactCrop--circular-crop",l&&c&&"ReactCrop--rule-of-thirds",!this.dragStarted&&l&&!l.width&&!l.height&&"ReactCrop--invisible-crop",n&&"ReactCrop--no-animate");return o.createElement("div",{ref:this.componentRef,className:h,style:s},o.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},t),p)}};pI.xOrds=["e","w"],pI.yOrds=["n","s"],pI.xyOrds=["nw","ne","se","sw"],pI.nudgeStep=1,pI.nudgeStepMedium=10,pI.nudgeStepLarge=100,pI.defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};var pB="edit-upload",pz=e=>{let{name:t,onChange:n,ref:a,value:l}=e;return(0,p.jsxs)("div",{className:`${pB}__input`,children:[t,(0,p.jsx)("input",{name:t,onChange:e=>n(e.target.value),ref:a,type:"number",value:l})]})},pU={height:100,unit:"%",width:100,x:0,y:0},pV=({fileName:e,fileSrc:t,imageCacheTag:n,initialCrop:a,initialFocalPoint:l,onSave:r,showCrop:i,showFocalPoint:s})=>{let{closeModal:c}=nN(),{t:u}=(0,d.d)(),[h,f]=(0,o.useState)(()=>({...pU,...a||{}})),m={x:50,y:50},[g,b]=(0,o.useState)(()=>({...m,...l})),[v,y]=(0,o.useState)(!1),[x,w]=(0,o.useState)(0),[j,C]=(0,o.useState)(0),S=(0,o.useRef)(void 0),k=(0,o.useRef)(void 0),_=(0,o.useRef)(void 0),$=(0,o.useRef)(null),N=(0,o.useRef)(null),[P,E]=(0,o.useState)(!1),D=e=>
42{w(e.currentTarget.naturalHeight),C(e.currentTarget.naturalWidth),E(!0)},T=({dimension:e,value:t})=>{let n=100*(parseInt(t)/("width"===e?j:x));if(n<=0||n>100)return null;f({...h,[e]:n})},A=({coordinate:e,value:t})=>{let n=parseInt(t);n>=0&&n<=100&&b(t=>({...t,[e]:n}))},R=o.useCallback(({x:e,y:t})=>{b({x:e,y:t}),y(!1)},[]),L=t&&c5(t,n);return(0,p.jsxs)("div",{className:pB,children:[(0,p.jsxs)("div",{className:`${pB}__header`,children:[(0,p.jsxs)("h2",{title:`${u("general:editing")} ${e}`,children:[u("general:editing")," ",e]}),(0,p.jsxs)("div",{className:`${pB}__actions`,children:[(0,p.jsx)(tN,{"aria-label":u("general:cancel"),buttonStyle:"secondary",className:`${pB}__cancel`,onClick:()=>c(p6),children:u("general:cancel")}),(0,p.jsx)(tN,{"aria-label":u("general:applyChanges"),buttonStyle:"primary",className:`${pB}__save`,disabled:!P,onClick:()=>{"function"==typeof r&&r({crop:h||void 0,focalPoint:g,heightInPixels:Number($?.current?.value??x),widthInPixels:Number(N?.current?.value??j)}),c(p6)},children:u("general:applyChanges")})]})]}),(0,p.jsxs)("div",{className:`${pB}__toolWrap`,children:[(0,p.jsx)("div",{className:`${pB}__crop`,children:(0,p.jsxs)("div",{className:`${pB}__focal-wrapper`,ref:S,style:{aspectRatio:`${j/x}`},children:[i?(0,p.jsx)(pI,{className:`${pB}__reactCrop`,crop:h,onChange:(e,t)=>
42f(t),onComplete:()=>y(!0),renderSelectionAddon:()=>(0,p.jsx)("div",{className:`${pB}__crop-window`,ref:_}),children:(0,p.jsx)("img",{alt:u("upload:setCropArea"),onLoad:D,ref:k,src:L})}):(0,p.jsx)("img",{alt:u("upload:setFocalPoint"),onLoad:D,ref:k,src:L}),s&&(0,p.jsx)(pH,{boundsRef:i?_:k,checkBounds:!!i&&v,className:`${pB}__focalPoint`,containerRef:S,initialPosition:g,onDragEnd:R,setCheckBounds:!!i&&y,children:(0,p.jsx)(td,{})})]})}),(i||s)&&(0,p.jsxs)("div",{className:`${pB}__sidebar`,children:[i&&(0,p.jsxs)("div",{className:`${pB}__groupWrap`,children:[(0,p.jsx)("div",{children:(0,p.jsxs)("div",{className:`${pB}__titleWrap`,children:[(0,p.jsx)("h3",{children:u("upload:crop")}),(0,p.jsx)(tN,{buttonStyle:"none",className:`${pB}__reset`,onClick:()=>f({height:100,unit:"%",width:100,x:0,y:0}),children:u("general:reset")})]})}),(0,p.jsx)("span",{className:`${pB}__description`,children:u("upload:cropToolDescription")}),(0,p.jsxs)("div",{className:`${pB}__inputsWrap`,children:[(0,p.jsx)(pz,{name:`${u("upload:width")} (px)`,onChange:e=>T({dimension:"width",value:e}),ref:N,value:(h.width/100*j).toFixed(0)}),(0,p.jsx)(pz,{name:`${u("upload:height")} (px)`,onChange:e=>T({dimension:"height",value:e}),ref:$,value:(h.height/100*x).toFixed(0)})]})]}),s&&(0,p.jsxs)("div",{className:`${pB}__groupWrap`,children:[(0,p.jsx)("div",{children:(0,p.jsxs)("div",{className:`${pB}__titleWrap`,children:[(0,p.jsx)("h3",{children:u("upload:focalPoint")}),(0,p.jsx)(tN,{buttonStyle:"none",className:`${pB}__reset`,onClick:()=>{let e=S.current.getBoundingClientRect(),t=i?_.current.getBoundingClientRect():k.current.getBoundingClientRect();b({x:(t.left-e.left+t.width/2)/e.width*100,y:(t.top-e.top+t.height/2)/e.height*100})},children:u("general:reset")})]})}),(0,p.jsx)("span",{className:`${pB}__description`,children:u("upload:focalPointDescription")}),(0,p.jsxs)("div",{className:`${pB}__inputsWrap`,children:[(0,p.jsx)(pz,{name:"X %",onChange:e=>A({coordinate:"x",value:e}),value:g.x.toFixed(0)}),(0,p.jsx)(pz,{name:"Y %",onChange:e=>A({coordinate:"y",value:e}),value:g.y.toFixed(0)})]})]})]})]})]})},pH=({boundsRef:e,checkBounds:t,children:n,className:a,containerRef:l,initialPosition:r={x:50,y:50},onDragEnd:i,setCheckBounds:s})=>{let[c,d]=(0,o.useState)({x:r.x,y:r.y}),[u,h]=(0,o.useState)(!1),f=(0,o.useRef)(void 0),m=o.useCallback((t,n,a)=>{let r=l.current.getBoundingClientRect(),i=e.current.getBoundingClientRect(),o=t??i.left,s=n??i.top,c=o<i.left||o>i.right,d=s<i.top||s>i.bottom,u=(o-r.left)/r.width*100,p=(s-r.top)/r.height*100,f=(i.left-r.left+i.width/2)/r.width*100,m=(i.top-r.top+i.height/2)/r.height*100;return(c||d)&&(h(!1),o<i.left?u=(i.left-r.left)/r.width*100:o>i.right&&(u=(r.width-(r.right-i.right))/r.width*100),s<i.top?p=(i.top-r.top)/r.height*100:s>i.bottom&&(p=(r.height-(r.bottom-i.bottom))/r.height*100),a&&(u=c?f:u,p=d?m:p)),{x:u,y:p}},[e,l]);return o.useEffect(()=>{if(!(u||!f.current)&&t){let{height:e,left:t,top:n,width:a}=f.current.getBoundingClientRect(),{x:l,y:r}=m(t+a/2,n+e/2,!0);i({x:l,y:r}),d({x:l,y:r}),s(!1);return}},[m,u,t,s,c.x,c.y,i]),o.useEffect(()=>{d({x:r.x,y:r.y})},[r.x,r.y]),(0,p.jsxs)("div",{className:[`${pB}__draggable-container`,u&&`${pB}__draggable-container--dragging`].filter(Boolean).join(" "),onMouseMove:e=>{if(!u)return null;let{x:t,y:n}=m(e.clientX,e.clientY);d({x:t,y:n})},children:[(0,p.jsx)("button",{className:[`${pB}__draggable`,a].filter(Boolean).join(" "),onMouseDown:e=>{e.preventDefault(),h(!0)},onMouseUp:()=>{h(!1),i(c)},ref:f,style:{left:`${c.x}%`,top:`${c.y}%`},type:"button",children:n}),(0,p.jsx)("div",{})]})},pq="file-details-draggable",pW=e=>{let t,n=(0,g.c)(20),{collectionSlug:a,doc:l,hideRemoveFile:r,imageCacheTag:i,isSortable:o,removeItem:s,rowIndex:c,uploadConfig:d}=e,{id:u,filename:h,thumbnailURL:f,url:m}=l,b;n[0]!==a||n[1]!==u?(b={id:u,collectionSlug:a},n[0]=a,n[1]=u,n[2]=b):b=n[2];let[v,y]=cV(b),x;return n[3]!==v||n[4]!==y||n[5]!==a||n[6]!==l||n[7]!==h||n[8]!==r||n[9]!==i||n[10]!==o||n[11]!==s||n[12]!==c||n[13]!==f||n[14]!==d||n[15]!==m?(x=e=>(0,p.jsxs)("div",{className:[pq,e&&o&&`${pq}
42--has-drag-handle`].filter(Boolean).join(" "),ref:e.setNodeRef,style:{transform:e.transform,transition:e.transition,zIndex:e.isDragging?1:void 0},children:[(0,p.jsxs)("div",{className:`${pq}--drag-wrapper`,children:[o&&e&&(0,p.jsx)("div",{className:`${pq}__drag`,...e.attributes,...e.listeners,children:(0,p.jsx)(l3,{})}),(0,p.jsx)(c8,{className:`${pq}__thumbnail`,collectionSlug:a,doc:l,fileSrc:f||m,imageCacheTag:i,uploadConfig:d})]}),(0,p.jsx)("div",{className:`${pq}__main-detail`,children:h}),(0,p.jsxs)("div",{className:`${pq}__actions`,children:[(0,p.jsx)(v,{}),(0,p.jsx)(y,{children:(0,p.jsx)(ts,{})}),!r&&s&&(0,p.jsx)(tN,{buttonStyle:"icon-label",className:`${pq}__remove`,icon:"x",iconStyle:"none",onClick:()=>s(c),round:!0})]})]}),n[3]=v,n[4]=y,n[5]=a,n[6]=l,n[7]=h,n[8]=r,n[9]=i,n[10]=o,n[11]=s,n[12]=c,n[13]=f,n[14]=d,n[15]=m,n[16]=x):x=n[16],n[17]!==u||n[18]!==x?(t=(0,p.jsx)(ne,{id:u,children:x},u),n[17]=u,n[18]=x,n[19]=t):t=n[19],t},pK=e=>{let t=(0,g.c)(11),{defaultMessage:n,successMessage:a,value:l}=e,[r,i]=(0,o.useState)(!1),[s,c]=(0,o.useState)(!1),{t:u}=(0,d.d)();if(l){let e,o,d,h;return t[0]!==l?(e=async()=>{await navigator.clipboard.writeText(l),i(!0)},t[0]=l,t[1]=e):e=t[1],t[2]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{c(!0),i(!1)},d=()=>{c(!1),i(!1)},t[2]=o,t[3]=d):(o=t[2],d=t[3]),t[4]!==r||t[5]!==n||t[6]!==s||t[7]!==a||t[8]!==u||t[9]!==e?(h=(0,p.jsxs)("button",{className:"copy-to-clipboard",onClick:e,onMouseEnter:o,onMouseLeave:d,type:"button",children:[(0,p.jsx)(tR,{}),(0,p.jsxs)(tk,{delay:r?0:void 0,show:s||r,children:[r&&(a??u("general:copied")),!r&&(n??u("general:copy"))]})]}),t[4]=r,t[5]=n,t[6]=s,t[7]=a,t[8]=u,t[9]=e,t[10]=h):h=t[10],h}return null},pQ="file-meta",pY=e=>{let{filename:t,filesize:n,height:a,mimeType:l,url:r,width:i}=e;return(0,p.jsxs)("div",{className:pQ,children:[(0,p.jsxs)("div",{className:`${pQ}__url`,children:[(0,p.jsx)("a",{href:r,rel:"noopener noreferrer",target:"_blank",children:t}),(0,p.jsx)(pK,{defaultMessage:"Copy URL",value:r})]}),(0,p.jsxs)("div",{className:`${pQ}__size-type`,children:[(0,K.B)(n),"number"==typeof i&&"number"==typeof a&&(0,p.jsxs)(o.Fragment,{children:["\xa0-\xa0",i,"x",a]}),l&&(0,p.jsxs)(o.Fragment,{children:["\xa0-\xa0",l]})]})]})},pG="file-details",pX=e=>{let{customUploadActions:t,doc:n,enableAdjustments:a,handleRemove:l,hasImageSizes:r,hideRemoveFile:i,imageCacheTag:o,uploadConfig:s}=e,{filename:c,filesize:d,height:u,mimeType:h,thumbnailURL:f,url:m,width:g}=n,b=s.displayPreview??!0;return(0,p.jsx)("div",{className:pG,children:(0,p.jsxs)("header",{children:[b&&(0,p.jsx)(c8,{className:`${pG}__thumbnail`,doc:n,fileSrc:f||m,imageCacheTag:o,uploadConfig:s}),(0,p.jsxs)("div",{className:`${pG}__main-detail`,children:[(0,p.jsx)(pY,{filename:c,filesize:d,height:u,mimeType:h,url:m,width:g}),(a||r&&n.filename||t)&&(0,p.jsx)(p8,{customActions:t,enableAdjustments:!!a,enablePreviewSizes:r&&n.filename,mimeType:h})]}),!i&&l&&(0,p.jsx)(tN,{buttonStyle:"icon-label",className:`${pG}__remove`,icon:"x",iconStyle:"with-border",onClick:l,round:!0})]})})},pZ=e=>{let{hasMany:t}=e;return t?(0,p.jsx)(pW,{...e}):(0,p.jsx)(pX,{...e})},pJ="preview-sizes",p0=(e,t)=>{if(!t||0===t.length)return e;let n={};return t.forEach(({name:t})=>{e[t]&&(n[t]=e[t])}),n},p1=({name:e,active:t,alt:n,meta:a,onClick:l,previewSrc:r})=>(0,p.jsxs)("div",{className:[`${pJ}__sizeOption`,t&&`${pJ}--selected`].filter(Boolean).join(" "),onClick:"function"==typeof l?l:void 0,onKeyDown:e=>{"function"==typeof l&&"Enter"===e.key&&l()},role:"button",tabIndex:0,children:[(0,p.jsx)("div",{className:`${pJ}__image`,children:(0,p.jsx)("img",{alt:n,src:r})}),(0,p.jsxs)("div",{className:`${pJ}__sizeMeta`,children:[(0,p.jsx)("div",{className:`${pJ}__sizeName`,children:e}),(0,p.jsx)(pY,{...a})]})]}),p3=({doc:e,imageCacheTag:t,uploadConfig:n})=>{let{imageSizes:a}=n,{sizes:l}=e,r=e?.alt||e.filename||"",[i,s]=(0,o.useState)(()=>p0(l,a)),[c,d]=(0,o.useState)(null),u=e=>e.filename?e.url?c5(e.url,t):void 0:null;(0,o.useEffect)(()=>{s(p0(l,a))},[l,a,t]);let h=u(c?e.sizes[c]:e),f=(0,o.useMemo)(()=>({filename:e.filename,filesize:e.filesize,height:e.height,mimeType:e.mimeType,url:e.url,width:e.width}),[e]),m="Original";return(0,p.jsxs)("div",{className:pJ,children:[(0,p.jsxs)("div",{className:`${pJ}__imageWrap`,children:[(0,p.jsxs)("div",{className:`${pJ}__meta`,children:[(0,p.jsx)("div",{className:`${pJ}__sizeName`,children:c||m}),(0,p.jsx)(pY,{...c?i[c]:f})]}),(0,p.jsx)("img",{alt:r,className:`${pJ}__preview`,src:h})]}),(0,p.jsx)("div",{className:`${pJ}__listWrap`,children:(0,p.jsxs)("div",{className:`${pJ}__list`,children:[(0,p.jsx)(p1,{active:!c,alt:r,meta:f,name:m,onClick:()=>d(null),previewSrc:u(e)}),Object.entries(i).map(([e,t])=>{let n=c===e,a=u(t);return a?(0,p.jsx)(p1,{active:n,alt:r,meta:t,name:e,onClick:()=>d(e),previewSrc:a},e):null})]})})]})},p2="file-field",p6="edit-upload",p5="preview-sizes",p4=e=>e||void 0===e?!e||!!e.name&&""!==e.name||"A file name is required.":"A file is required.",p8=e=>{let t=(0,g.c)(8),{customActions:n,enableAdjustments:a,enablePreviewSizes:l,mimeType:r}=e,{t:i}=(0,d.d)(),{openModal:s}=nN(),c,u;if(t[0]!==n||t[1]!==a||t[2]!==l||t[3]!==r||t[4]!==s||t[5]!==i){u=Symbol.for("react.early_return_sentinel");e:{let e=(0,D.w)(r)&&"image/svg+xml"!==r&&"image/jxl"!==r;if(!e&&(!n||0===n.length)){u=null;break e}c=(0,p.jsxs)("div",{className:`${p2}__upload-actions`,children:[e&&(0,p.jsxs)(o.Fragment,{children:[l&&(0,p.jsx)(tN,{buttonStyle:"pill",className:`${p2}__previewSizes`,margin:!1,onClick:()=>{s(p5)},size:"small",children:i("upload:previewSizes")}),a&&(0,p.jsx)(tN,{buttonStyle:"pill",className:`${p2}__edit`,margin:!1,onClick:()=>{s(p6)},size:"small",children:i("upload:editImage")})]}),n&&n.map(he)]})}t[0]=n,t[1]=a,t[2]=l,t[3]=r,t[4]=s,t[5]=i,t[6]=c,t[7]=u}else c=t[6],u=t[7];return u!==Symbol.for("react.early_return_sentinel")?u:c},p7=e=>{let t=(0,g.c)(5),{resetUploadEdits:n,updateUploadEdits:a,uploadEdits:l}=l$(),r;
42return t[0]!==e||t[1]!==n||t[2]!==a||t[3]!==l?(r=(0,p.jsx)(uD,{children:(0,p.jsx)(p9,{...e,resetUploadEdits:n,updateUploadEdits:a,uploadEdits:l})}),t[0]=e,t[1]=n,t[2]=a,t[3]=l,t[4]=r):r=t[4],r},p9=e=>{let{collectionSlug:t,customActions:n,initialState:a,onChange:l,resetUploadEdits:r,updateUploadEdits:i,uploadConfig:s,UploadControls:u,uploadEdits:h}=e,{setUploadControlFile:f,setUploadControlFileName:m,setUploadControlFileUrl:g,uploadControlFile:b,uploadControlFileName:v,uploadControlFileUrl:x}=uT(),{config:{routes:{api:w}}}=(0,c.c)(),{t:j}=(0,d.d)(),{setModified:C}=eT(),{id:S,data:k,docPermissions:_,setUploadStatus:$}=lE(),N=eF(),{errorMessage:P,setValue:E,showError:T,value:A}=lI({path:"file",validate:p4}),[R,L]=(0,o.useState)(null),[F,O]=(0,o.useState)(!1),[M,I]=(0,o.useState)(A?.name||""),[B,z]=(0,o.useState)(!1),[U,V]=(0,o.useState)(""),H=(0,o.useRef)(null),q=(0,o.useRef)(null),W="object"==typeof s?.pasteURL&&s.pasteURL.allowList?.length>0,K=(0,o.useCallback)(({file:e,isNewFile:t=!0})=>{t&&e instanceof File&&L(URL.createObjectURL(e)),E(e),z(!1),g(""),m(null),f(null),"function"==typeof l&&l(e)},[l,E,f,m,g]),Q=o.useCallback(e=>{let t=e.target.value;A&&(K({file:new File([A],t,{type:A.type,lastModified:A.lastModified}),isNewFile:!1}),I(t))},[K,A]),Y=(0,o.useCallback)(e=>{K({file:e?.[0]})},[K]),G=(0,o.useCallback)(()=>{O(!0),K({file:null}),L(""),V(""),r(),z(!1),g(""),m(null),f(null)},[K,r,f,m,g]),X=(0,o.useCallback)(e=>{C(!0),i(e)},[C,i]),Z=(0,o.useCallback)(async()=>{if(!(!U||s?.pasteURL===!1)){$("uploading");try{let e=await fetch(U);if(!e.ok)throw Error(`Fetch failed with status: ${e.status}`);let t=await e.blob(),n=v||decodeURIComponent(U.split("/").pop()||""),a=new File([t],n,{type:t.type});K({file:a}),$("idle");return}catch{if(!W){e3.error("Failed to fetch the file."),$("failed");return}}try{let e=`/${t}/paste-url${S?`/${S}?`:"?"}src=${encodeURIComponent(U)}`,n=await fetch((0,y.Q)({apiRoute:w,path:e}));if(!n.ok)throw Error(`Fetch failed with status: ${n.status}`);let a=await n.blob(),l=decodeURIComponent(U.split("/").pop()||""),r=new File([a],l,{type:a.type});K({file:r}),$("idle")}catch{e3.error("The provided URL is not allowed."),$("failed")}}},[w,t,U,K,S,$,s,v,W]);(0,o.useEffect)(()=>{a?.file?.value instanceof File&&(L(URL.createObjectURL(a.file.value)),O(!1))},[a]),(0,o.useEffect)(()=>{B&&H.current},[B]),(0,o.useEffect)(()=>{N&&O(!1)},[N]);let J=_?.update,ee=s?.imageSizes?.length>0,et=!!s?.resizeOptions,en=s?.focalPoint===!0,{crop:ea=!0,focalPoint:el=!0}=s,er=el&&(ee||et||en),ei=s.mimeTypes?.join(", "),eo=s?.cacheTags&&k?.updatedAt;return(0,o.useEffect)(()=>{(async()=>x&&(V(x),await Z()))()},[x,Z]),(0,o.useEffect)(()=>{b&&K({file:b})},[b,K]),(0,p.jsxs)("div",{className:[lH,p2].filter(Boolean).join(" "),children:[(0,p.jsx)(ni,{message:P,showError:T}),k&&k.filename&&!F&&(0,p.jsx)(pZ,{collectionSlug:t,customUploadActions:n,doc:k,enableAdjustments:ea||er,handleRemove:J?G:void 0,hasImageSizes:ee,hideRemoveFile:s.hideRemoveFile,imageCacheTag:eo,uploadConfig:s}),(!s.hideFileInputOnCreate&&!k?.filename||F)&&(0,p.jsxs)("div",{className:`${p2}__upload`,children:[!A&&!B&&(0,p.jsx)(uR,{onChange:Y,children:(0,p.jsxs)("div",{className:`${p2}__dropzoneContent`,children:[(0,p.jsxs)("div",{className:`${p2}__dropzoneButtons`,children:[(0,p.jsx)(tN,{buttonStyle:"pill",onClick:()=>{q.current&&q.current.click()},size:"small",children:j("upload:selectFile")}),(0,p.jsx)("input",{accept:ei,"aria-hidden":"true",className:`${p2}__hidden-input`,hidden:!0,onChange:e=>{e.target.files&&e.target.files.length>0&&Y(e.target.files)},ref:q,type:"file"}),s?.pasteURL!==!1&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)("span",{className:`${p2}__orText`,children:j("general:or")}),(0,p.jsx)(tN,{buttonStyle:"pill",onClick:()=>{z(!0),g(""),f(null),m(null)},size:"small",children:j("upload:pasteURL")})]}),u||null]}),(0,p.jsxs)("p",{className:`${p2}__dragAndDropText`,children:[j("general:or")," ",j("upload:dragAndDrop")]})]})}),B&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsxs)("div",{className:`${p2}__remote-file-wrap`,children:[(0,p.jsx)("input",{className:`${p2}__remote-file`,onChange:e=>{V(e.target.value)},ref:H,title:U,type:"text",value:U}),(0,p.jsx)("div",{className:`${p2}__add-file-wrap`,children:(0,p.jsx)("button",{className:`${p2}__add-file`,onClick:()=>{Z()},type:"button",children:j("upload:addFile")})})]}),(0,p.jsx)(tN,{buttonStyle:"icon-label",className:`${p2}__remove`,icon:"x",iconStyle:"with-border",onClick:()=>{z(!1),g(""),f(null),m(null)},round:!0,tooltip:j("general:cancel")})]}),A&&R&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)("div",{className:`${p2}__thumbnail-wrap`,children:(0,p.jsx)(c8,{collectionSlug:t,fileSrc:(0,D.w)(A.type)?R:null})}),(0,p.jsxs)("div",{className:`${p2}__file-adjustments`,children:[(0,p.jsx)("input",{className:`${p2}__filename`,onChange:Q,title:M||A.name,type:"text",value:M||A.name}),(0,p.jsx)(p8,{customActions:n,enableAdjustments:ea||er,enablePreviewSizes:ee&&k?.filename&&!F,mimeType:A.type})]}),(0,p.jsx)(tN,{buttonStyle:"icon-label",className:`${p2}__remove`,icon:"x",iconStyle:"with-border",onClick:G,round:!0,tooltip:j("general:cancel")})]})]}),(A||k?.filename)&&(0,p.jsx)(ns,{children:(0,p.jsx)(au,{Header:null,slug:p6,children:(0,p.jsx)(pV,{fileName:A?.name||k?.filename,fileSrc:k?.url||R,imageCacheTag:eo,initialCrop:h?.crop??void 0,initialFocalPoint:{x:h?.focalPoint?.x||k?.focalX||50,y:h?.focalPoint?.y||k?.focalY||50},onSave:X,showCrop:ea,showFocalPoint:er})})}),k&&ee&&(0,p.jsx)(au,{className:`${p2}__previewDrawer`,hoverTitle:!0,slug:p5,title:j("upload:sizesFor",{label:k.filename}),children:(0,p.jsx)(p3,{doc:k,imageCacheTag:eo,uploadConfig:s})})]})};function he(e,t){return(0,p.jsx)(o.Fragment,{children:e},t)}function ht({resetUploadEdits:e,submitted:t,updateUploadEdits:n,uploadEdits:a}){let{action:l,collectionSlug:r,docPermissions:i,getDocPreferences:s,hasSavePermission:d,initialState:u,isInitializing:h,Upload:f}=lE(),{drawerSlug:m,onSave:g}=cO(),{getFormState:b}=cf(),{config:{folders:v},getEntityConfig:y}=(0,c.c)(),x=o.useRef(null),w=y({collectionSlug:r}),{reportUpdate:j}=dV(),C=w.slug,[S]=o.useState(C),k=(0,o.useCallback)(t=>{j({doc:t?.doc||t?.result,drawerSlug:m,entitySlug:C,operation:"create",updatedAt:t?.result?.updatedAt||new Date().toISOString()}),"function"==typeof g&&g({...t,operation:"create"}),e()},[C,g,j,e,m]),_=(0,o.useCallback)(async({formState:e,submitted:t})=>{let n=cR(x),a=await s(),{state:l}=await b({collectionSlug:C,docPermissions:i,docPreferences:a,formState:e,operation:"create",schemaPath:S,signal:n.signal,skipValidation:!t});return x.current=null,l},[C,S,s,b,i]);return(0,o.useEffect)(()=>{let e=x.current;return()=>{cA(e)}},[]),(0,p.jsx)(lR,{operation:"create",children:(0,p.jsxs)(ub,{action:l,className:"collection-edit__form",disabled:h||!d,initialState:h?void 0:u,isInitializing:h,method:"POST",onChange:[_],onSuccess:k,submitted:t,children:[(0,p.jsx)(u7,{BeforeFields:(0,p.jsx)(o.Fragment,{children:f||(0,p.jsx)(p9,{collectionSlug:w.slug,customActions:[v&&w.folders&&(0,p.jsx)(pP,{buttonProps:{buttonStyle:"pill",size:"small"},folderCollectionSlug:v.slug,folderFieldName:v.fieldName}
42,"move-doc-to-folder")].filter(Boolean),initialState:u,resetUploadEdits:e,updateUploadEdits:n,uploadConfig:w.upload,uploadEdits:a})}),docPermissions:i,fields:w.fields,schemaPathSegments:[w.slug]}),(0,p.jsx)(ha,{}),(0,p.jsx)(hn,{})]})})}function hn(){let e,t=(0,g.c)(7),{getField:n,getFields:a}=eT(),{getFormDataRef:l}=uq(),r;return t[0]!==a||t[1]!==l?(r=()=>{l.current=a},t[0]=a,t[1]=l,t[2]=r):r=t[2],t[3]!==n||t[4]!==a||t[5]!==l?(e=[a,n,l],t[3]=n,t[4]=a,t[5]=l,t[6]=e):e=t[6],(0,o.useEffect)(r,e),null}function ha(){let{docConfig:e}=lE(),{activeIndex:t,forms:n,setFormTotalErrorCount:a}=uq(),l=o.useRef(0),r=(0,o.useMemo)(()=>n[t]?.formState?.file?.valid??!0,[t,n]),i=o.useCallback(e=>{let n=e;r||(n+=1),n!==l.current&&(a({errorCount:n,index:t}),l.current=n)},[t,a,r]);return e?(0,p.jsx)(rD,{fields:e.fields,path:[],setErrorCount:i}):null}var hl={};(0,u.d)(hl,{WindowInfo:()=>ho,WindowInfoContext:()=>hr,WindowInfoProvider:()=>hc,useWindowInfo:()=>hi,withWindowInfo:()=>hd});var hr=(0,o.createContext)({}),hi=()=>(0,o.useContext)(hr),ho=e=>{let{children:t}=e,n=hi();return t?"function"==typeof t?o.createElement(o.Fragment,null,t(n)):o.createElement(o.Fragment,null,t):null},hs=(e,t)=>{let{payload:{breakpoints:n,animationRef:a}}=t;a.current=null;let{eventsFired:l}=e,{documentElement:{style:r,clientWidth:i,clientHeight:o}}=document,{innerWidth:s,innerHeight:c}=window,d=`${i/100}px`,u=`${o/100}px`,p=n?Object.keys(n).reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:window.matchMedia(n[t]).matches}),{}):{};return r.setProperty("--vw",d),r.setProperty("--vh",u),{width:s,height:c,"--vw":d,"--vh":u,breakpoints:p,eventsFired:l+1}},hc=e=>{let{breakpoints:t,children:n}=e,a=(0,o.useRef)(null),[l,r]=(0,o.useReducer)(hs,{width:void 0,height:void 0,"--vw":"","--vh":"",breakpoints:{},eventsFired:0}),i=(0,o.useCallback)(()=>{a.current&&cancelAnimationFrame(a.current),a.current=requestAnimationFrame(()=>r({type:"UPDATE",payload:{breakpoints:t,animationRef:a}}))},[t]),s=(0,o.useCallback)(()=>{setTimeout(()=>{i()},500)},[i]);return(0,o.useEffect)(()=>(window.addEventListener("resize",i),window.addEventListener("orientationchange",s),()=>{window.removeEventListener("resize",i),window.removeEventListener("orientationchange",s)}),[i,s]),(0,o.useEffect)(()=>{0===l.eventsFired&&r({type:"UPDATE",payload:{breakpoints:t,animationRef:a}})},[t,l]),o.createElement(hr.Provider,{value:Object.assign({},l)},n&&n)},hd=e=>t=>{let n=hi();return o.createElement(e,Object.assign({},t,{windowInfo:n}))},hu="bulk-upload-drawer--add-more-files",hp="file-selections";function hh(){let e=(0,g.c)(39),{activeIndex:t,addFiles:n,forms:a,isInitializing:l,removeFile:r,setActiveIndex:i,totalErrorCount:s}=uq(),{initialFiles:u,initialForms:h,maxFiles:f}=h$(),{i18n:m,t:b}=(0,d.d)(),{closeModal:v,openModal:y}=nN(),[x,w]=o.useState(!1),{breakpoints:j}=hi(),C;e[0]!==r?(C=e=>{r(e)},e[0]=r,e[1]=C):C=e[1];let S=C,k;e[2]!==n||e[3]!==v?(k=e=>{n(e),v(hu)},e[2]=n,e[3]=v,e[4]=k):k=e[4];let _=k,$=l?u?.length??h?.length:a.length,{collectionSlug:N,selectableCollections:P,setCollectionSlug:E}=h$(),{getEntityConfig:D}=(0,c.c)(),T=x&&`${hp}__showingFiles`,A;e[5]!==T?(A=[hp,T].filter(Boolean),e[5]=T,e[6]=A):A=e[6];let R=A.join(" "),L;if(e[7]!==t||e[8]!==j.m||e[9]!==N||e[10]!==v||e[11]!==a||e[12]!==D||e[13]!==_||e[14]!==S||e[15]!==m||e[16]!==u||e[17]!==h||e[18]!==l||e[19]!==f||e[20]!==y||e[21]!==P||e[22]!==i||e[23]!==E||e[24]!==x||e[25]!==b||e[26]!==R||e[27]!==s||e[28]!==$){let n,r,o;e[30]===Symbol.for("react.memo_cache_sentinel")?(n=()=>w(hm),e[30]=n):n=e[30],e[31]!==v?(r=()=>v(hu),e[31]=v,e[32]=r):r=e[32],e[33]!==t||e[34]!==S||e[35]!==m||e[36]!==i||e[37]!==b?(o=(e,n)=>{let{errorCount:a,formID:l,formState:r}=e,o=r?.file?.value||{};return(0,p.jsxs)("div",{className:[`${hp}__fileRowContainer`,n===t&&`${hp}__fileRowContainer--active`,a&&a>0&&`${hp}__fileRowContainer--error`].filter(Boolean).join(" "),children:[(0,p.jsxs)("button",{className:`${hp}__fileRow`,onClick:()=>i(n),type:"button",children:[(0,p.jsx)(hg,{file:o,formID:l}),(0,p.jsx)("div",{className:`${hp}__fileDetails`,children:(0,p.jsx)("p",{className:`${hp}__fileName`,title:o.name,children:o.name||b("upload:noFile")})}),o instanceof File?(0,p.jsx)("p",{className:`${hp}__fileSize`,children:function(e){let t=e.size,n=0===t?0:Math.floor(Math.log(t)/Math.log(1024));return(t/Math.pow(1024,n)).toFixed(+(n>1))+" "+["B","kB","MB","GB","TB"][n]}(o)}):null,(0,p.jsx)("div",{className:`${hp}__remove ${hp}__remove--underlay`,children:(0,p.jsx)(d.a,{})}),a?(0,p.jsx)(na,{className:`${hp}__errorCount`,count:a,i18n:m}):null]}),(0,p.jsx)("button",{"aria-label":b("general:remove"),className:`${hp}__remove ${hp}__remove--overlay`,onClick:()=>S(n),type:"button",children:(0,p.jsx)(d.a,{})})]},l)},e[33]=t,e[34]=S,e[35]=m,e[36]=i,e[37]=b,e[38]=o):o=e[38],L=(0,p.jsxs)("div",{className:R,children:[j.m&&x?(0,p.jsx)("div",{className:`${hp}__mobileBlur`}):null,(0,p.jsxs)("div",{className:`${hp}__header`,children:[P?.length>1&&(0,p.jsx)(ue,{className:`${hp}__collectionSelect`,isClearable:!1,name:"groupBy",onChange:e=>{E("object"==typeof e&&"value"in e?e?.value:e)},options:P?.map(e=>{let t=D({collectionSlug:e});return{label:t.labels.singular,value:t.slug}})||[],path:"groupBy",required:!0,value:N}),(0,p.jsxs)("div",{className:`${hp}__headerTopRow`,children:[(0,p.jsxs)("div",{className:`${hp}__header__text`,children:[(0,p.jsx)(na,{count:s,i18n:m,withMessage:!0}),(0,p.jsx)("p",{children:(0,p.jsxs)("strong",{title:`${$} ${b($>1?"upload:filesToUpload":"upload:fileToUpload")}`,children:[$," ",b($>1?"upload:filesToUpload":"upload:fileToUpload")]})})]}),(0,p.jsxs)("div",{className:`${hp}__header__actions`,children:["number"!=typeof f||$<f?(0,p.jsx)(ra,{className:`${hp}__header__addFile`,onClick:()=>y(hu),size:"small",children:b("upload:addFile")}):null,(0,p.jsxs)(tN,{buttonStyle:"transparent",className:`${hp}__toggler`,onClick:n,children:[(0,p.jsx)("span",{className:`${hp}__toggler__label`,children:(0,p.jsxs)("strong",{title:`${$} ${b($>1?"upload:filesToUpload":"upload:fileToUpload")}`,children:[$," ",b($>1?"upload:filesToUpload":"upload:fileToUpload")]})}),(0,p.jsx)(to,{direction:x?"down":"up"})]}),(0,p.jsx)(au,{gutter:!1,Header:null,slug:hu,children:(0,p.jsx)(uM,{onCancel:r,onDrop:_})})]})]}),(0,p.jsx)("div",{className:`${hp}__header__mobileDocActions`,children:(0,p.jsx)(u3,{})})]}),(0,p.jsx)("div",{className:`${hp}__animateWrapper`,children:(0,p.jsx)(l2,{height:!j.m||x?"auto":0,children:(0,p.jsxs)("div",{className:`${hp}__filesContainer`,children:[l&&0===a.length&&(u?.length>0||h?.length>0)?(u?Array.from(u):h).map(hf):null,a.map(o)]})})})]}),e[7]=t,e[8]=j.m,e[9]=N,e[10]=v,e[11]=a,e[12]=D,e[13]=_,e[14]=S,e[15]=m,e[16]=u,e[17]=h,e[18]=l,e[19]=f,e[20]=y,e[21]=P,e[22]=i,e[23]=E,e[24]=x,e[25]=b,e[26]=R,e[27]=s,e[28]=$,e[29]=L}else L=e[29];return L}function hf(e,t){return(0,p.jsx)(c.f,{animationDelay:`calc(${t} * 60ms)`,height:"35px"},t)}function hm(e){return!e}function hg({file:e,formID:t}
42){let[n,a]=o.useState(null),[l,r]=o.useState(!0);return o.useEffect(()=>{let t=!1;return async function(){r(!0),a(null);try{if((0,D.w)(e.type)){let n=await new Promise((t,n)=>{let a=new Image;a.src=URL.createObjectURL(e),a.onload=()=>{let l,r,i=a.height&&a.width?a.width/a.height:1;i>1?(r=280,l=280/i):(r=280*i,l=280);let o=new OffscreenCanvas(r,l),s=o.getContext("2d"),c="image/png"===e.type?"image/png":"image/jpeg",d="image/png"===e.type?void 0:.8;s.drawImage(a,0,0,r,l),o.convertToBlob({type:c,...d&&{quality:d}}).then(e=>{URL.revokeObjectURL(a.src);let l=new FileReader;l.onload=()=>t(l.result),l.onerror=n,l.readAsDataURL(e)}).catch(n)},a.onerror=e=>{URL.revokeObjectURL(a.src),n(e)}});t||a(n)}else a(null)}catch{t||a(null)}finally{t||r(!1)}}(),()=>{t=!0}},[e]),l?(0,p.jsx)(c.f,{className:`${hp}__thumbnail-shimmer`,disableInlineStyles:!0}):(0,p.jsx)(c8,{className:`${hp}__thumbnail`,fileSrc:n},`${t}-${n||"placeholder"}`)}var hb="bulk-upload--file-manager";function hv(){let e=(0,g.c)(18),{activeIndex:t,collectionSlug:n,docPermissions:a,documentSlots:l,forms:r,hasPublishPermission:i,hasSavePermission:o,hasSubmitted:s,resetUploadEdits:u,updateUploadEdits:f}=uq(),m=r[t],{getEntityConfig:b}=(0,c.c)(),{i18n:v}=(0,d.d)(),{user:y}=aj(),{openModal:x}=nN(),w;if(e[0]!==m||e[1]!==t||e[2]!==n||e[3]!==a||e[4]!==l||e[5]!==r.length||e[6]!==b||e[7]!==i||e[8]!==o||e[9]!==s||e[10]!==v||e[11]!==x||e[12]!==u||e[13]!==f||e[14]!==y){let c=b({collectionSlug:n}),d;e[16]!==x?(d=()=>x(u2),e[16]=x,e[17]=d):d=e[17],w=(0,p.jsxs)("div",{className:hb,children:[(0,p.jsx)(hh,{}),(0,p.jsxs)("div",{className:`${hb}__editView`,children:[(0,p.jsx)(uF,{onClose:d,title:(0,h.s)(c.labels.singular,v)}),m?(0,p.jsxs)(lT,{collectionSlug:n,currentEditor:y,docPermissions:a,hasPublishedDoc:!1,hasPublishPermission:i,hasSavePermission:o,id:null,initialData:(0,M.r)(m.formState,!0),initialState:m.formState,isLocked:!1,lastUpdateTime:0,mostRecentVersionIsAutosaved:!1,unpublishedVersionCount:0,Upload:l.Upload,versionCount:0,children:[(0,p.jsx)(u1,{collectionConfig:c}),(0,p.jsx)(ht,{resetUploadEdits:u,submitted:s,updateUploadEdits:f,uploadEdits:m?.uploadEdits})]},`${t}-${r.length}`):null]}),(0,p.jsx)(u6,{})]}),e[0]=m,e[1]=t,e[2]=n,e[3]=a,e[4]=l,e[5]=r.length,e[6]=b,e[7]=i,e[8]=o,e[9]=s,e[10]=v,e[11]=x,e[12]=u,e[13]=f,e[14]=y,e[15]=w}else w=e[15];return w}function hy(){let{addFiles:e,forms:t,isInitializing:n}=uq(),{closeModal:a}=nN(),{collectionSlug:l,drawerSlug:r}=h$(),{getEntityConfig:i}=(0,c.c)(),{t:s}=(0,d.d)(),u=i({collectionSlug:l})?.upload?.mimeTypes,h=o.useCallback(t=>{let n=new DataTransfer;for(let e of t)(void 0===u||0===u.length||(0,V.d)(e.type,u))&&n.items.add(e);0===n.files.length?e3.error(s("error:invalidFileType")):e(n.files)},[e,s,u]);return l?t.length||n?(0,p.jsx)(hv,{}):(0,p.jsx)(uM,{acceptMimeTypes:u?.join(", "),onCancel:()=>a(r),onDrop:h}):null}function hx(){let e,t,n=(0,g.c)(18),{drawerSlug:a,onCancel:l,setFolderID:r,setInitialFiles:i,setInitialForms:s,setOnCancel:c,setOnSuccess:d,setSelectableCollections:u,setSuccessfullyUploaded:h,successfullyUploaded:f}=h$(),{modalState:m}=nN(),b=o.useRef(m),v;n[0]!==a||n[1]!==l||n[2]!==r||n[3]!==i||n[4]!==s||n[5]!==c||n[6]!==d||n[7]!==u||n[8]!==h||n[9]!==f?(v=e=>{let t=b.current[a],n=e[a];typeof n>"u"&&typeof t>"u"||(t?.isOpen!==n?.isOpen&&(n?.isOpen||(f||"function"==typeof l&&l(),r(void 0),i(void 0),s(void 0),c(hC),d(hw),u(null),h(!1))),b.current=e)},n[0]=a,n[1]=l,n[2]=r,n[3]=i,n[4]=s,n[5]=c,n[6]=d,n[7]=u,n[8]=h,n[9]=f,n[10]=v):v=n[10];let y=tv(v),x;return n[11]!==m||n[12]!==y?(x=()=>{y(m)},n[11]=m,n[12]=y,n[13]=x):x=n[13],n[14]!==m?(e=[m],n[14]=m,n[15]=e):e=n[15],(0,o.useEffect)(x,e),n[16]!==a?(t=(0,p.jsx)(au,{gutter:!1,Header:null,slug:a,children:(0,p.jsx)(uH,{children:(0,p.jsx)(uD,{children:(0,p.jsx)(ns,{children:(0,p.jsx)(hy,{})})})})}),n[16]=a,n[17]=t):t=n[17],t}function hw(){return hj}function hj(){return null}function hC(){return hS}function hS(){return null}var hk=o.createContext({collectionSlug:"",drawerSlug:"",folderID:void 0,initialFiles:void 0,initialForms:[],maxFiles:void 0,onCancel:()=>null,onSuccess:()=>null,selectableCollections:null,setCollectionSlug:()=>null,setFolderID:()=>null,setInitialFiles:()=>null,setInitialForms:()=>null,setMaxFiles:()=>null,setOnCancel:()=>null,setOnSuccess:()=>null,setSelectableCollections:()=>null,setSuccessfullyUploaded:()=>!1,successfullyUploaded:!1});function h_(e){let t,n,a=(0,g.c)(18),{children:l,drawerSlugPrefix:r}
42=e,[i,s]=o.useState(null),[c,d]=o.useState(),[u,h]=o.useState(void 0),[f,m]=o.useState(),[b,v]=o.useState(),[y,x]=o.useState(void 0),[w,j]=o.useState(void 0),[C,S]=o.useState(void 0),[k,_]=o.useState(!1),$=`${r?`${r}-`:""}${hN()}`,N;a[0]===Symbol.for("react.memo_cache_sentinel")?(N=e=>{m(()=>e)},a[0]=N):N=a[0];let P=N,E;a[1]===Symbol.for("react.memo_cache_sentinel")?(E=e=>{v(()=>e)},a[1]=E):E=a[1];let D=E,T;return a[2]!==b?(T=()=>{"function"==typeof b&&b()},a[2]=b,a[3]=T):T=a[3],a[4]!==f?(t=(e,t)=>{"function"==typeof f&&f(e,t)},a[4]=f,a[5]=t):t=a[5],a[6]!==l||a[7]!==c||a[8]!==$||a[9]!==u||a[10]!==y||a[11]!==w||a[12]!==C||a[13]!==i||a[14]!==k||a[15]!==T||a[16]!==t?(n=(0,p.jsx)(hk,{value:{collectionSlug:c,drawerSlug:$,folderID:u,initialFiles:y,initialForms:w,maxFiles:C,onCancel:T,onSuccess:t,selectableCollections:i,setCollectionSlug:d,setFolderID:h,setInitialFiles:x,setInitialForms:j,setMaxFiles:S,setOnCancel:D,setOnSuccess:P,setSelectableCollections:s,setSuccessfullyUploaded:_,successfullyUploaded:k},children:(0,p.jsxs)(o.Fragment,{children:[l,(0,p.jsx)(hx,{})]})}),a[6]=l,a[7]=c,a[8]=$,a[9]=u,a[10]=y,a[11]=w,a[12]=C,a[13]=i,a[14]=k,a[15]=T,a[16]=t,a[17]=n):n=a[17],n}var h$=()=>o.use(hk);function hN(){let e=af();return`bulk-upload-drawer-slug-${e||1}`}var hP="upload-relationship-details";function hE(e){let t=(0,g.c)(11),{id:n,allowEdit:a,allowRemove:l,alt:r,byteSize:i,className:o,collectionSlug:s,displayPreview:u,filename:f,mimeType:m,onRemove:b,reloadDoc:v,showCollectionSlug:y,src:x,thumbnailSrc:w,updatedAt:j,withMeta:C,x:S,y:k}=e,_=void 0===C||C,{config:$}=(0,c.c)(),{i18n:N}=(0,d.d)(),P="collections"in $?$.collections.find(e=>e.slug===s):void 0,E=n??void 0,D;t[0]!==s||t[1]!==E?(D={id:E,collectionSlug:s},t[0]=s,t[1]=E,t[2]=D):D=t[2];let[T,,A]=cV(D),{openDrawer:R}=A,L;t[3]!==s||t[4]!==v?(L=async e=>{let{doc:t}=e;return v(t.id,s)},t[3]=s,t[4]=v,t[5]=L):L=t[5];let F=L,O;t[6]!==S||t[7]!==k?(O=function(e,t){let n=[];return t&&n.push((0,K.B)(t)),S&&k&&n.push(`${S}x${k}`),e&&n.push(e),n.join(" — ")},t[6]=S,t[7]=k,t[8]=O):O=t[8];let M=_?O(m,i):"",I=u??P?.upload?.displayPreview??!0,B;return t[9]!==o?(B=[hP,o].filter(Boolean),t[9]=o,t[10]=B):B=t[10],(0,p.jsxs)("div",{className:B.join(" "),children:[(0,p.jsxs)("div",{className:`${hP}__imageAndDetails`,children:[I&&(0,p.jsx)(c7,{alt:r,className:`${hP}__thumbnail`,filename:f,fileSrc:w,imageCacheTag:P?.upload?.cacheTags&&j,size:"small"}),void 0!==y&&y&&P?(0,p.jsx)(ra,{size:"small",children:(0,h.s)(P.labels.singular,N)}):null,(0,p.jsxs)("div",{className:`${hP}__details`,children:[(0,p.jsx)("p",{className:`${hP}__filename`,children:x?(0,p.jsx)("a",{href:x,target:"_blank",children:f}):f}),_?(0,p.jsx)("p",{className:`${hP}__meta`,children:M}):null]})]}),!1!==a||!1!==l?(0,p.jsxs)("div",{className:`${hP}__actions`,children:[!1!==a?(0,p.jsx)(tN,{buttonStyle:"icon-label",className:`${hP}__edit`,icon:"edit",iconStyle:"none",onClick:R}):null,!1!==l?(0,p.jsx)(tN,{buttonStyle:"icon-label",className:`${hP}__remove`,icon:"x",iconStyle:"none",onClick:()=>b()}):null,(0,p.jsx)(T,{onSave:F})]}):null]})}var hD="upload-field-card";function hT({children:e,className:t,size:n="medium"}){return(0,p.jsx)("div",{className:[hD,t,`${hD}--size-${n}`].filter(Boolean).join(" "),children:e})}var hA="upload upload--has-many";function hR(e){let t=(0,g.c)(29),{className:n,displayPreview:a,fileDocs:l,isSortable:r,onRemove:i,onReorder:o,readonly:s,reloadDoc:c,serverURL:d,showCollectionSlug:u}=e,h=void 0!==u&&u,f;t[0]!==l||t[1]!==o?(f=(e,t)=>{if(e===t)return;let n=[...l],[a]=n.splice(e,1);n.splice(t,0,a),o(n)},t[0]=l,t[1]=o,t[2]=f):f=t[2];let m=f,b;t[3]!==l||t[4]!==i?(b=e=>{let t=[...l||[]];t.splice(e,1),i(0===t.length?[]:t)},t[3]=l,t[4]=i,t[5]=b):b=t[5];let v=b,y;t[6]!==n?(y=[hA,n].filter(Boolean),t[6]=n,t[7]=y):y=t[7];let x=y.join(" "),w;if(t[8]!==a||t[9]!==l||t[10]!==r||t[11]!==m||t[12]!==s||t[13]!==c||t[14]!==v||t[15]!==d||t[16]!==h||t[17]!==x){let e,n;t[19]!==m?(e=e=>{let{moveFromIndex:t,moveToIndex:n}=e;return m(t,n)},t[19]=m,t[20]=e):e=t[20],t[21]!==a||t[22]!==r||t[23]!==s||t[24]!==c||t[25]!==v||t[26]!==d||t[27]!==h?(n=(e,t)=>{let{relationTo:n,value:l}=e,i=String(l.id),o,u;if(l.url)try{o=new URL(l.url,d).toString()}catch{o=`${d}${l.url}`}if(l.thumbnailURL)try{u=new URL(l.thumbnailURL,d).toString()}catch{u=`${d}${l.thumbnailURL}`}return(0,D.w)(l.mimeType)&&(u=(0,T.k)({sizes:l.sizes,thumbnailURL:u,url:o,width:l.width})),(0,p.jsx)(ne,{disabled:!r||s,id:i,children:e=>(0,p.jsx)("div",{className:[`${hA}__dragItem`,e&&r&&`${hA}
42--has-drag-handle`].filter(Boolean).join(" "),ref:e.setNodeRef,style:{transform:e.transform,transition:e.transition,zIndex:e.isDragging?1:void 0},children:(0,p.jsxs)(hT,{size:"small",children:[e&&(0,p.jsx)("div",{className:`${hA}__drag`,...e.attributes,...e.listeners,children:(0,p.jsx)(l3,{})}),(0,p.jsx)(hE,{allowEdit:!s,allowRemove:!s,alt:l?.alt||l?.filename,byteSize:l.filesize,collectionSlug:n,displayPreview:a,filename:l.filename,id:i,mimeType:l?.mimeType,onRemove:()=>v(t),reloadDoc:c,showCollectionSlug:h,src:o,thumbnailSrc:u,updatedAt:l.updatedAt,withMeta:!1,x:l?.width,y:l?.height})]})})},i)},t[21]=a,t[22]=r,t[23]=s,t[24]=c,t[25]=v,t[26]=d,t[27]=h,t[28]=n):n=t[28],w=(0,p.jsx)("div",{className:x,children:(0,p.jsx)(nt,{className:`${hA}__draggable-rows`,ids:l?.map(hL),onDragEnd:e,children:l.map(n)})}),t[8]=a,t[9]=l,t[10]=r,t[11]=m,t[12]=s,t[13]=c,t[14]=v,t[15]=d,t[16]=h,t[17]=x,t[18]=w}else w=t[18];return w}function hL(e){let{value:t}=e;return String(t.id)}function hF(e){let{className:t,displayPreview:n,fileDoc:a,onRemove:l,readonly:r,reloadDoc:i,serverURL:o,showCollectionSlug:s=!1}=e,{relationTo:c,value:d}=a,u=String(d?.id),h,f;if(d.url)try{h=new URL(d.url,o).toString()}catch{h=`${o}${d.url}`}if(d.thumbnailURL)try{f=new URL(d.thumbnailURL,o).toString()}catch{f=`${o}${d.thumbnailURL}`}return(0,D.w)(d.mimeType)&&(f=(0,T.k)({sizes:d.sizes,thumbnailURL:f,url:h,width:d.width})),(0,p.jsx)(hT,{className:["upload upload--has-one",t].filter(Boolean).join(" "),children:(0,p.jsx)(hE,{allowEdit:!r,allowRemove:!r,alt:d?.alt||d?.filename,byteSize:d.filesize,collectionSlug:c,displayPreview:n,filename:d.filename,id:u,mimeType:d?.mimeType,onRemove:l,reloadDoc:i,showCollectionSlug:s,src:h,thumbnailSrc:f,updatedAt:d.updatedAt,x:d?.width,y:d?.height})})}var hO="upload";function hM(e){let{AfterInput:t,allowCreate:n,api:a,BeforeInput:l,className:r,Description:i,description:s,displayPreview:u,Error:h,filterOptions:f,hasMany:m,isSortable:g,Label:b,label:v,localized:w,maxRows:j,onChange:C,path:S,readOnly:k,relationTo:_,required:$,serverURL:N,showError:P,style:E,value:D}=e,[T,A]=o.useState(),[R]=o.useState(Array.isArray(_)?_[0]:_),{openModal:L}=nN(),{drawerSlug:F,setCollectionSlug:O,setInitialFiles:M,setMaxFiles:I,setOnSuccess:B,setSelectableCollections:z}=h$(),{permissions:U}=aj(),{code:V}=aN(),{i18n:H,t:q}=(0,d.d)(),W=(0,o.useMemo)(()=>Array.isArray(_)?_.filter(e=>U?.collections&&U.collections?.[e]?.create):[],[_,U]),K=(0,o.useMemo)(()=>{let e=Array.isArray(_);if(!D)return f;let t={};for(let n of Array.isArray(D)?D:[D])if(e&&"object"==typeof n&&"relationTo"in n)t[n.relationTo]||(t[n.relationTo]=[]),t[n.relationTo].push(n.value);else if(!e){t[_]||(t[_]=[]);let e="object"==typeof n&&"value"in n?n.value:n;("string"==typeof e||"number"==typeof e)&&t[_].push(e)}let n={...f};return(e?_:[_]).forEach(e=>{let a=t[e]||[];n[e]={...f?.[e]||{},id:{...f?.[e]?.id||{},not_in:(f?.[e]?.id?.not_in||[]).concat(a)}}}),n},[D,f,_]),[Q,,{closeDrawer:Y,openDrawer:G}]=dO({collectionSlugs:"string"==typeof _?[_]:_,filterOptions:K}),[X,,{closeDrawer:Z,openDrawer:J}]=cV({collectionSlug:R}),ee=o.useRef(null),et=(0,o.useMemo)(()=>!!n&&!!("string"==typeof R&&U?.collections&&U.collections?.[R]?.create),[R,U,n]),en=o.useCallback(e=>{"function"==typeof C&&C(e)},[C]),ea=o.useCallback(async e=>{if(!e?.length)return[];let t={};e.forEach(({relationTo:e,value:n})=>{t[e]||(t[e]=[]);let a=n;n&&"object"==typeof n&&"value"in n&&(a=n.value),t[e].push(a)});let n=Object.entries(t).map(async([e,t])=>{let n={depth:0,draft:!0,limit:t.length,locale:V,where:{and:[{id:{in:t}}]}},l=await fetch((0,y.Q)({apiRoute:a,path:`/${e}`}),{body:x.A(n),credentials:"include",headers:{"Accept-Language":H.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"},method:"POST"}),r=[];return l.ok&&(r=(await l.json()).docs),{collection:e,docsById:r.reduce((e,t)=>(e[t.id]=t,e),{})}}),l=await Promise.all(n),r={};return l.forEach(({collection:e,docsById:t})=>{r[e]=t}),e.map(({relationTo:e,value:t})=>{let n=r[e]?.[t]||{id:t,filename:`${q("general:untitled")} - ID: ${t}`,isPlaceholder:!0};return{relationTo:e,value:n}})},[a,V,H.language,q]),el=(0,o.useCallback)(e=>(function(e,t){let n=Array.isArray(t);if("string"==typeof e||"number"==typeof e)return e;if(e&&"object"==typeof e&&"relationTo"in e&&"value"in e){let t=e.value;for(;t&&"object"==typeof t&&null!==t&&"value"in t;)t=t.value;return t&&"object"==typeof t&&null!==t&&"id"in t&&(t=t.id),n?{relationTo:e.relationTo,value:t}:t}return e&&"object"==typeof e&&"id"in e?e.id:e})(e,_),[_]),er=(0,o.useCallback)(e=>{let t=Array.isArray(_);if(m){let n=e.map(e=>t?{relationTo:e.collectionSlug,value:e.doc.id}:e.doc.id);en([...Array.isArray(D)?D.map(el):[],...n]),A(t=>[...t||[],...e.map(e=>({relationTo:e.collectionSlug,value:e.doc}))])}else{let n=e[0];en(t?{relationTo:n.collectionSlug,value:n.doc.id}:n.doc.id),A([{relationTo:n.collectionSlug,value:n.doc}])}},[D,en,m,_,el]),ei=o.useCallback(e=>{let t=e;if(!m&&e&&e.length>1){let n=new DataTransfer;n.items.add(e[0]),t=n.files}t&&M(t),O(Array.isArray(_)?R:_),Array.isArray(W)&&z(W),"number"==typeof j&&I(j),L(F)},[m,_,R,O,W,j,L,F,M,z,I]),eo=o.useCallback(async(e,t)=>{let n=Array.isArray(_),a=n&&t||R,l=[];for(let[t,n]of e)n&&l.push(t);let r=l.map(e=>({relationTo:a,value:e})),i=await ea(r);i&&A(e=>[...e||[],...i]);let o=l.map(e=>n?{relationTo:a,value:e}:e);en([...Array.isArray(D)?D.map(el):[],...o]),Y()},[R,Y,en,ea,D,_,el]),es=o.useCallback(e=>{let t=Array.isArray(_);e.doc&&(A(t=>[...t||[],{relationTo:R,value:e.doc}]),en(t?{relationTo:R,value:e.doc.id}:e.doc.id)),Z()},[Z,R,en,_]),ec=(0,o.useCallback)(async({collectionSlug:e,doc:t})=>{let n=Array.isArray(_),a=(await ea([{relationTo:e,value:t.id}]))?.[0]||null;if(A(e=>a?m?[...e||[],a]:[a]:e),m){let a=n?{relationTo:e,value:t.id}:t.id;en([...Array.isArray(D)?D.map(el):[],a])}else en(n?{relationTo:e,value:t.id}:t.id);Y()},[Y,m,ea,en,D,_,el]),ed=o.useCallback(async(e,t)=>{let n=await ea([{relationTo:t,value:e}]);if(n[0]){let e=[];A(a=>{let l=a?.findIndex(e=>(e.value?.id===n[0].value.id||e.value?.isPlaceholder)&&e.relationTo===t);if(l>-1){let t=[...a];return t[l]=n[0],e=t,t}return a}),e.length&&m&&en(e.map(e=>e.value?.id))}},[ea,en,m]),eu=o.useCallback(e=>{let t=Array.isArray(_);en(e.map(({relationTo:e,value:n})=>t?{relationTo:e,value:n.id}:n.id)),A(e)},[en,_]),ep=o.useCallback(e=>{let t=Array.isArray(_);if(!e||0===e.length){en(m?[]:null),A(m?[]:null);return}let n=e.map(({relationTo:e,value:n})=>t?{relationTo:e,value:n.id}:n.id);en(m?n:n[0]),A(e)},[en,m,_]);(0,o.useEffect)(()=>{async function e(){if(D){let e=[];
42if(Array.isArray(_)&&("object"==typeof D&&"relationTo"in D||Array.isArray(D)&&D.length>0&&"object"==typeof D[0]&&"relationTo"in D[0])?e=(Array.isArray(D)?D:[D]).filter(e=>"object"==typeof e&&"relationTo"in e).map(e=>{let t=e.value;for(;t&&"object"==typeof t&&null!==t&&"value"in t;)t=t.value;return{relationTo:e.relationTo,value:t}}):Array.isArray(_)||(e=(Array.isArray(D)?D:[D]).map(e=>{let t=e;for(;t&&"object"==typeof t&&null!==t&&"value"in t;)t=t.value;return{relationTo:_,value:t}})),e.length>0){let t=await ea(e);t&&(A(t),ee.current=D)}}else A([]),ee.current=null}ee.current!==D&&e()},[ea,D,_]),(0,o.useEffect)(()=>{B(er)},[D,S,er,B]);let eh=!D||m&&Array.isArray(D)&&("number"!=typeof j||D.length<j)||!m&&T?.[0]&&typeof T[0].value>"u";return(0,p.jsxs)("div",{className:[lH,hO,r,P&&"error",k&&"read-only"].filter(Boolean).join(" "),id:`field-${S?.replace(/\./g,"__")}`,style:E,children:[(0,p.jsx)(em,{CustomComponent:b,Fallback:(0,p.jsx)(aD,{label:v,localized:w,path:S,required:$})}),(0,p.jsx)("div",{className:`${hO}__wrap`,children:(0,p.jsx)(em,{CustomComponent:h,Fallback:(0,p.jsx)(ni,{path:S,showError:P})})}),l,(0,p.jsxs)("div",{className:`${hO}__dropzoneAndUpload`,children:[m&&Array.isArray(D)&&D.length>0?(0,p.jsx)(p.Fragment,{children:T&&T?.length>0?(0,p.jsx)(hR,{displayPreview:u,fileDocs:T,isSortable:g&&!k,onRemove:ep,onReorder:eu,readonly:k,reloadDoc:ed,serverURL:N,showCollectionSlug:Array.isArray(_)}):(0,p.jsx)("div",{className:`${hO}__loadingRows`,children:D.map(e=>(0,p.jsx)(c.f,{height:"40px"},"object"==typeof e?e.value:e))})}):null,!m&&D?(0,p.jsx)(p.Fragment,{children:T&&T?.length>0&&T[0].value?(0,p.jsx)(hF,{displayPreview:u,fileDoc:T[0],onRemove:ep,readonly:k,reloadDoc:ed,serverURL:N,showCollectionSlug:Array.isArray(_)}):T&&D&&!T?.[0]?.value?(0,p.jsxs)(p.Fragment,{children:[q("general:untitled")," - ID: ",D]}):(0,p.jsx)(c.f,{height:"62px"})}):null,eh?(0,p.jsx)(uR,{disabled:k||!et,multipleFiles:m,onChange:ei,children:(0,p.jsxs)("div",{className:`${hO}__dropzoneContent`,children:[(0,p.jsxs)("div",{className:`${hO}__dropzoneContent__buttons`,children:[et&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(tN,{buttonStyle:"pill",className:`${hO}__createNewToggler`,disabled:k||!et,onClick:()=>{k||(m?ei():J())},size:"small",children:q("general:createNew")}),(0,p.jsx)("span",{className:`${hO}__dropzoneContent__orText`,children:q("general:or")})]}),(0,p.jsx)(tN,{buttonStyle:"pill",className:`${hO}__listToggler`,disabled:k,onClick:G,size:"small",children:q("fields:chooseFromExisting")}),(0,p.jsx)(X,{onSave:es}),(0,p.jsx)(Q,{allowCreate:et,enableRowSelections:m,onBulkSelect:eo,onSelect:ec})]}),et&&!k&&(0,p.jsxs)("p",{className:`${hO}__dragAndDropText`,children:[q("general:or")," ",q("upload:dragAndDrop")]})]})}):(0,p.jsx)(p.Fragment,{children:!k&&!T&&(!D||"number"!=typeof j||Array.isArray(D)&&D.length<j)?(0,p.jsx)(c.f,{height:"40px"}):null})]}),t,(0,p.jsx)(em,{CustomComponent:i,Fallback:(0,p.jsx)(nr,{description:s,path:S})})]})}var hI=lU(function(e){let{field:t,field:{admin:{allowCreate:n,className:a,description:l,isSortable:r}={},hasMany:i,label:s,localized:d,maxRows:u,relationTo:h,required:f},path:m,readOnly:g,validate:b}=e,{config:v}=(0,c.c)(),y=t.displayPreview,{customComponents:{AfterInput:x,BeforeInput:w,Description:j,Error:C,Label:S}={},disabled:k,filterOptions:_,path:$,setValue:N,showError:P,value:E}=lI({potentiallyStalePath:m,validate:o.useCallback((e,t)=>{if("function"==typeof b)return b(e,{...t,required:f})},[b,f])}),D=Array.isArray(h),T=o.useMemo(()=>!0===i&&Array.isArray(E)?E.map(e=>D?e:{relationTo:Array.isArray(h)?h[0]:h,value:e}):E,[i,E,D,h]),A=(0,o.useMemo)(()=>lV(t),[t]);return(0,p.jsx)(h_,{drawerSlugPrefix:m,children:(0,p.jsx)(hM,{AfterInput:x,allowCreate:!1!==n,api:v.routes.api,BeforeInput:w,className:a,Description:j,description:l,displayPreview:y,Error:C,filterOptions:_,hasMany:i,isSortable:r,label:s,Label:S,localized:d,maxRows:u,onChange:N,path:$,readOnly:g||k,relationTo:h,required:f,serverURL:v.serverURL,showError:P,style:A,value:T})})});function hB(e){let t=(0,g.c)(13),{clientFieldConfig:n,forceRender:a,indexPath:l,parentPath:r,parentSchemaPath:i,path:o,permissions:s,readOnly:c,schemaPath:d}=e,u;t[0]!==o?(u=e=>{let[t]=e;return t&&t?.[o]?.customComponents?.Field},t[0]=o,t[1]=u):u=t[1];let h=eB(u),f;if(t[2]!==h||t[3]!==n||t[4]!==a||t[5]!==l||t[6]!==r||t[7]!==i||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==d){f=Symbol.for("react.early_return_sentinel");e:{let e={forceRender:a,permissions:s,readOnly:c,schemaPath:d};if(n.admin?.hidden){f=(0,p.jsx)(cn,{...e,path:o});break e}if(void 0!==h){f=h||null;break e}let t={...e,indexPath:l,parentPath:r,parentSchemaPath:i};switch(n.type){case"array":f=(0,p.jsx)(hW,{...t,field:n,path:o});break e;case"blocks":f=(0,p.jsx)(rk,{...t,field:n,path:o});break e;case"checkbox":f=(0,p.jsx)(lX,{...e,field:n,path:o});break e;case"code":f=(0,p.jsx)(rP,{...e,field:n,path:o});break e;case"collapsible":f=(0,p.jsx)(rA,{...t,field:n,path:o});break e;case"date":f=(0,p.jsx)(s3,{...e,field:n,path:o});break e;case"email":f=(0,p.jsx)(s2,{...e,field:n,path:o});break e;case"group":f=(0,p.jsx)(ct,{...t,field:n,path:o});break e;case"join":f=(0,p.jsx)(dj,{...e,field:n,path:o});break e;case"json":f=(0,p.jsx)(dC,{...e,field:n,path:o});break e;case"number":f=(0,p.jsx)(dS,{...e,field:n,path:o});break e;case"point":f=(0,p.jsx)(d_,{...e,field:n,path:o});break e;case"radio":f=(0,p.jsx)(dE,{...e,field:n,path:o});break e;case"relationship":f=(0,p.jsx)(d8,{...e,field:n,path:o});break e;case"richText":f=(0,p.jsx)(d7,{...e,field:n,path:o});break e;case"row":f=(0,p.jsx)(d9,{...t,field:n,path:o});break e;case"select":f=(0,p.jsx)(un,{...e,field:n,path:o});break e;case"tabs":f=(0,p.jsx)(uw,{...t,field:n,path:o});break e;case"text":f=(0,p.jsx)(u_,{...e,field:n,path:o});break e;case"textarea":f=(0,p.jsx)(uN,{...e,field:n,path:o});break e;case"ui":f=(0,p.jsx)(uP,{});break e;case"upload":f=(0,p.jsx)(hI,{...e,field:n,path:o});break e}}t[2]=h,t[3]=n,t[4]=a,t[5]=l,t[6]=r,t[7]=i,t[8]=o,t[9]=s,t[10]=c,t[11]=d,t[12]=f}else f=t[12];if(f!==Symbol.for("react.early_return_sentinel"))return f}var hz="render-fields",hU=e=>{let t=(0,g.c)(22),{className:n,fields:a,forceRender:l,margins:r,parentIndexPath:i,parentPath:o,parentSchemaPath:s,permissions:c,readOnly:d}=e,u=lL();if(a&&a.length>0){let e=r&&`${hz}--margins-${r}`,h=!1===r&&`${hz}--margins-none`,f;
42t[0]!==n||t[1]!==e||t[2]!==h?(f=[hz,n,e,h].filter(Boolean),t[0]=n,t[1]=e,t[2]=h,t[3]=f):f=t[3];let m=f.join(" "),g;if(t[4]!==a||t[5]!==l||t[6]!==u||t[7]!==i||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==d||t[12]!==m){let e;t[14]!==l||t[15]!==u||t[16]!==i||t[17]!==o||t[18]!==s||t[19]!==c||t[20]!==d?(e=(e,t)=>{if(!e||(0,b.I2)(e))return null;let{operation:n,permissions:a,read:r}=(0,C.P)({field:e,operation:u,parentName:o?.includes(".")?o.split(".")[o.split(".").length-1]:o,permissions:c});if("name"in e&&!r)return null;let h=d||e?.admin?.readOnly;h&&e.admin?.readOnly===!1&&(h=!1),"name"in e&&!n&&(h=!0);let{indexPath:f,path:m,schemaPath:g}=(0,S.Z)({field:e,index:t,parentIndexPath:i,parentPath:o,parentSchemaPath:s});return(0,p.jsx)(lF,{value:m,children:(0,p.jsx)(hB,{clientFieldConfig:e,forceRender:l,indexPath:f,parentPath:o,parentSchemaPath:s,path:m,permissions:a,readOnly:h,schemaPath:g})},`${m}-${t}`)},t[14]=l,t[15]=u,t[16]=i,t[17]=o,t[18]=s,t[19]=c,t[20]=d,t[21]=e):e=t[21],g=(0,p.jsx)(l9,{className:m,forceRender:l,children:a.map(e)}),t[4]=a,t[5]=l,t[6]=u,t[7]=i,t[8]=o,t[9]=s,t[10]=c,t[11]=d,t[12]=m,t[13]=g}else g=t[13];return g}return null},hV="array-field",hH=e=>{let t=(0,g.c)(41),{addRow:n,attributes:a,copyRow:l,CustomRowLabel:r,duplicateRow:i,errorCount:o,fields:s,forceRender:u,hasMaxRows:f,isDragging:m,isLoading:b,isSortable:v,labels:y,listeners:x,moveRow:w,parentPath:j,pasteRow:C,path:S,permissions:k,readOnly:_,removeRow:$,row:N,rowCount:P,rowIndex:E,schemaPath:D,scrollIdPrefix:T,setCollapse:A,setNodeRef:R,transform:L,transition:F}=e,O=void 0!==u&&u,M=rl(b,500),{i18n:I}=(0,d.d)(),B=eL(),z=`${(0,h.s)(y.singular,I)} ${String(E+1).padStart(2,"0")}`,U=o>0&&B,V=U?`${hV}__row--has-errors`:`${hV}__row--no-errors`,H;t[0]!==V?(H=[`${hV}__row`,V].filter(Boolean),t[0]=V,t[1]=H):H=t[1];let q=H.join(" "),W=`${j.split(".").join("-")}-row-${E}`,K=m?1:void 0,Q;if(t[2]!==r||t[3]!==n||t[4]!==a||t[5]!==q||t[6]!==l||t[7]!==i||t[8]!==o||t[9]!==z||t[10]!==U||t[11]!==s||t[12]!==O||t[13]!==f||t[14]!==I||t[15]!==M||t[16]!==v||t[17]!==x||t[18]!==w||t[19]!==j||t[20]!==C||t[21]!==S||t[22]!==k||t[23]!==_||t[24]!==$||t[25]!==N.collapsed||t[26]!==N.id||t[27]!==P||t[28]!==E||t[29]!==D||t[30]!==T||t[31]!==A||t[32]!==R||t[33]!==W||t[34]!==K||t[35]!==L||t[36]!==F){let e;t[38]!==N.id||t[39]!==A?(e=e=>A(N.id,e),t[38]=N.id,t[39]=A,t[40]=e):e=t[40],Q=(0,p.jsx)("div",{id:W,ref:R,style:{transform:L,transition:F,zIndex:K},children:(0,p.jsx)(l7,{actions:_?void 0:(0,p.jsx)(l1,{addRow:n,copyRow:l,duplicateRow:i,hasMaxRows:f,index:E,isSortable:v,moveRow:w,pasteRow:C,removeRow:$,rowCount:P}),className:q,collapsibleStyle:U?"error":"default",dragHandleProps:v?{id:N.id,attributes:a,listeners:x}:void 0,header:(0,p.jsxs)("div",{className:`${hV}__row-header`,id:`${T}-row-${E}`,children:[M?(0,p.jsx)(c.f,{height:"1rem",width:"8rem"}):(0,p.jsx)(eq,{CustomComponent:r,label:z,path:S,rowNumber:E}),U&&(0,p.jsx)(na,{count:o,i18n:I,withMessage:!0})]}),isCollapsed:N.collapsed,onToggle:e,children:M?(0,p.jsx)(c.f,{}):(0,p.jsx)(hU,{className:`${hV}__fields`,fields:s,forceRender:O,margins:"small",parentIndexPath:"",parentPath:S,parentSchemaPath:D,permissions:!0===k?k:k?.fields,readOnly:_})})},`${j}-row-${N.id}`),t[2]=r,t[3]=n,t[4]=a,t[5]=q,t[6]=l,t[7]=i,t[8]=o,t[9]=z,t[10]=U,t[11]=s,t[12]=O,t[13]=f,t[14]=I,t[15]=M,t[16]=v,t[17]=x,t[18]=w,t[19]=j,t[20]=C,t[21]=S,t[22]=k,t[23]=_,t[24]=$,t[25]=N.collapsed,t[26]=N.id,t[27]=P,t[28]=E,t[29]=D,t[30]=T,t[31]=A,t[32]=R,t[33]=W,t[34]=K,t[35]=L,t[36]=F,t[37]=Q}else Q=t[37];return Q},hq="array-field",hW=lU(e=>{let{field:t,field:{name:n,type:a,admin:{className:l,description:r,isSortable:i=!0}={},fields:s,label:u,localized:f,maxRows:m,minRows:g,required:b},forceRender:v=!1,path:y,permissions:x,readOnly:w,schemaPath:j,validate:C}=e,S=j??n,k=g??+!!b,{setDocFieldPreferences:_}=lE(),{addFieldRow:$,dispatchFields:N,getFields:P,moveFieldRow:E,removeFieldRow:D,replaceState:T,setModified:A}=eT(),R=eL(),{code:L}=aN(),{i18n:F,t:O}=(0,d.d)(),{config:{localization:M}}=(0,c.c)(),I=!M||!M.fallback||L===M.defaultLocale,B="labels"in e&&e?.labels?e.labels:"labels"in e.field&&e.field.labels?{plural:e.field.labels?.plural,singular:e.field.labels?.singular}:"label"in e.field&&e.field.label?{plural:void 0,singular:e.field.label}:{plural:O("general:rows"),singular:O("general:row")},{customComponents:{AfterInput:z,BeforeInput:U,Description:V,Error:H,Label:q}={},disabled:W,errorPaths:K,path:Q,rows:Y=[],showError:G,valid:X,value:Z}=lI({hasRows:!0,potentiallyStalePath:y,validate:(0,o.useCallback)((e,t)=>!I&&null===e||("function"==typeof C?C(e,{...t,maxRows:m,minRows:k,required:b}):void 0),[m,k,b,C,I])}),J=(0,o.useId)(),ee=(0,o.useMemo)(()=>`scroll-${J}`,[J]),et=(0,o.useCallback)(e=>{$({path:Q,rowIndex:e,schemaPath:S}),setTimeout(()=>{lJ(`${ee}-row-${e}`)},0)},[$,Q,S,ee]),en=(0,o.useCallback)(e=>{N({type:"DUPLICATE_ROW",path:Q,rowIndex:e}),A(!0),setTimeout(()=>{lJ(`${ee}-row-${e}`)},0)},[N,Q,ee,A]),ea=(0,o.useCallback)(e=>{D({path:Q,rowIndex:e})},[D,Q]),el=(0,o.useCallback)((e,t)=>{E({moveFromIndex:e,moveToIndex:t,path:Q})},[Q,E]),er=(0,o.useCallback)(e=>{let{collapsedIDs:t,updatedRows:n}=aA({collapsed:e,rows:Y});_(Q,{collapsed:t}),N({type:"SET_ALL_ROWS_COLLAPSED",path:Q,updatedRows:n})},[N,Q,Y,_]),ei=(0,o.useCallback)((e,t)=>{let{collapsedIDs:n,updatedRows:a}=aT({collapsed:t,rowID:e,rows:Y});N({type:"SET_ROW_COLLAPSED",path:Q,updatedRows:a}),_(Q,{collapsed:n})},[N,Q,Y,_]),eo=(0,o.useCallback)(e=>{let t={...P()},n=tD({type:a,fields:s,getDataToCopy:()=>tB({formState:t,path:Q,rowIndex:e}),path:Q,rowIndex:e,t:O});"string"==typeof n?e3.error(n):e3.success(O("general:copied"))},[s,P,Q,O,a]),es=(0,o.useCallback)(e=>{let t={...P()},n=tT({onPaste:n=>{T(tz({dataFromClipboard:n,formState:t,path:Q,rowIndex:e})),A(!0)},path:Q,schemaFields:s,t:O});"string"==typeof n&&e3.error(n)},[s,P,Q,T,A,O]),ec=(0,o.useCallback)(e=>{T(tz({dataFromClipboard:e,formState:{...P()},path:Q})),A(!0)},[P,Q,T,A]),ed=(0,o.useCallback)(()=>tB({formState:{...P()},path:Q}),[P,Q]),eu=m&&Y.length>=m,ep=K.length,eh=R&&K.length>0,ef=(w||W)&&0===Y.length,eg=Y.length&&Y.length<k||b&&0===Y.length,eb=(0,o.useMemo)(()=>lV(t),[t]);return(0,p.jsxs)("div",{className:[lH,hq,l,eh?`${hq}--has-error`:`${hq}
42--has-no-error`].filter(Boolean).join(" "),id:`field-${Q.replace(/\./g,"__")}`,style:eb,children:[G&&(0,p.jsx)(em,{CustomComponent:H,Fallback:(0,p.jsx)(ni,{path:Q,showError:G})}),(0,p.jsxs)("header",{className:`${hq}__header`,children:[(0,p.jsxs)("div",{className:`${hq}__header-wrap`,children:[(0,p.jsxs)("div",{className:`${hq}__header-content`,children:[(0,p.jsx)("h3",{className:`${hq}__title`,children:(0,p.jsx)(em,{CustomComponent:q,Fallback:(0,p.jsx)(aD,{as:"span",label:u,localized:f,path:Q,required:b})})}),eh&&ep>0&&(0,p.jsx)(na,{count:ep,i18n:F,withMessage:!0})]}),(0,p.jsxs)("ul",{className:`${hq}__header-actions`,children:[Y?.length>0&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)("li",{children:(0,p.jsx)("button",{className:`${hq}__header-action`,onClick:()=>er(!0),type:"button",children:O("fields:collapseAll")})}),(0,p.jsx)("li",{children:(0,p.jsx)("button",{className:`${hq}__header-action`,onClick:()=>er(!1),type:"button",children:O("fields:showAll")})})]}),(0,p.jsx)("li",{children:(0,p.jsx)(tF,{allowCopy:Y?.length>0,allowPaste:!w,className:`${hq}__header-action`,disabled:W,fields:s,getDataToCopy:ed,onPaste:ec,path:Q,type:a})})]})]}),(0,p.jsx)(em,{CustomComponent:V,Fallback:(0,p.jsx)(nr,{description:r,path:Q})})]}),(0,p.jsx)(lZ,{fieldValue:Z,localized:f,path:Q,readOnly:w}),U,(Y?.length>0||!X&&(ef||eg))&&(0,p.jsxs)(nt,{className:`${hq}__draggable-rows`,ids:Y.map(e=>e.id),onDragEnd:({moveFromIndex:e,moveToIndex:t})=>el(e,t),children:[Y.map((e,t)=>{let{id:n,isLoading:a}=e,l=`${Q}.${t}`,r=K?.filter(e=>e.startsWith(l+".")).length;return(0,p.jsx)(ne,{disabled:w||W||!i,id:n,children:n=>(0,p.jsx)(hH,{...n,addRow:et,copyRow:eo,CustomRowLabel:Y?.[t]?.customComponents?.RowLabel,duplicateRow:en,errorCount:r,fields:s,forceRender:v,hasMaxRows:eu,isLoading:a,isSortable:i,labels:B,moveRow:el,parentPath:Q,pasteRow:es,path:l,permissions:x,readOnly:w||W,removeRow:ea,row:e,rowCount:Y?.length,rowIndex:t,schemaPath:S,scrollIdPrefix:ee,setCollapse:ei})},n)}),!X&&(0,p.jsxs)(o.Fragment,{children:[ef&&(0,p.jsx)(ti,{children:O("validation:fieldHasNo",{label:(0,h.s)(B.plural,F)})}),eg&&(0,p.jsx)(ti,{type:"error",children:O("validation:requiresAtLeast",{count:k,label:(0,h.s)(k>1?B.plural:B.singular,F)||O(k>1?"general:rows":"general:row")})})]})]}),!eu&&!w&&(0,p.jsx)(tN,{buttonStyle:"icon-label",className:`${hq}__add-row`,disabled:W,icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:()=>{et(Z||0)},children:O("fields:addLabel",{label:(0,h.s)(B.singular,F)})}),z]})}),hK=e=>{let t=(0,g.c)(12),{disabled:n,path:a}=e,l=void 0===a?"confirm-password":a,{t:r}=(0,d.d)(),i;t[0]!==l?(i={path:l,validate:hQ},t[0]=l,t[1]=i):i=t[1];let{disabled:o,setValue:s,showError:c,value:u}=lI(i),h=c&&"error",f;t[2]!==h?(f=[lH,"confirm-password",h].filter(Boolean),t[2]=h,t[3]=f):f=t[3];let m=f.join(" "),b;return t[4]!==o||t[5]!==n||t[6]!==l||t[7]!==s||t[8]!==r||t[9]!==m||t[10]!==u?(b=(0,p.jsxs)("div",{className:m,children:[(0,p.jsx)(aD,{htmlFor:"field-confirm-password",label:r("authentication:confirmPassword"),required:!0}),(0,p.jsxs)("div",{className:`${lH}__wrap`,children:[(0,p.jsx)(ni,{path:l}),(0,p.jsx)("input",{"aria-label":r("authentication:confirmPassword"),autoComplete:"off",disabled:!!(o||n),id:"field-confirm-password",name:"confirm-password",onChange:s,type:"password",value:u||""})]})]}),t[4]=o,t[5]=n,t[6]=l,t[7]=s,t[8]=r,t[9]=m,t[10]=u,t[11]=b):b=t[11],b};function hQ(e,t){return(0,Q.C5)(e,{name:"confirm-password",type:"text",required:!0,...t})}var hY=e=>{let t=(0,g.c)(28),{AfterInput:n,autoComplete:a,BeforeInput:l,className:r,description:i,Description:o,Error:s,inputRef:c,Label:u,label:f,localized:m,onChange:b,onKeyDown:v,path:y,placeholder:x,readOnly:w,required:j,rtl:C,showError:S,style:k,value:_,width:$}=e,N=void 0===a?"off":a,{i18n:P}=(0,d.d)(),E=S&&"error",D=w&&"read-only",T;t[0]!==r||t[1]!==E||t[2]!==D?(T=[lH,"password",r,E,D].filter(Boolean),t[0]=r,t[1]=E,t[2]=D,t[3]=T):T=t[3];let A=T.join(" "),R;return t[4]!==n||t[5]!==l||t[6]!==o||t[7]!==s||t[8]!==u||t[9]!==N||t[10]!==i||t[11]!==P||t[12]!==c||t[13]!==f||t[14]!==m||t[15]!==b||t[16]!==v||t[17]!==y||t[18]!==x||t[19]!==w||t[20]!==j||t[21]!==C||t[22]!==S||t[23]!==k||t[24]!==A||t[25]!==_||t[26]!==$?(R=(0,p.jsxs)("div",{className:A,style:{...k,width:$},children:[(0,p.jsx)(em,{CustomComponent:u,Fallback:(0,p.jsx)(aD,{label:f,localized:m,path:y,required:j})}),(0,p.jsxs)("div",{className:`${lH}__wrap`,children:[(0,p.jsx)(em,{CustomComponent:s,Fallback:(0,p.jsx)(ni,{path:y,showError:S})}),(0,p.jsxs)("div",{children:[l,(0,p.jsx)("input",{"aria-label":(0,h.s)(f,P),autoComplete:N,"data-rtl":C,disabled:w,id:`field-${y.replace(/\./g,"__")}`,name:y,onChange:b,onKeyDown:v,placeholder:(0,h.s)(x,P),ref:c,type:"password",value:_||""}),n]}),(0,p.jsx)(em,{CustomComponent:o,Fallback:(0,p.jsx)(nr,{description:i,path:y})})]})]}),t[4]=n,t[5]=l,t[6]=o,t[7]=s,t[8]=u,t[9]=N,t[10]=i,t[11]=P,t[12]=c,t[13]=f,t[14]=m,t[15]=b,t[16]=v,t[17]=y,t[18]=x,t[19]=w,t[20]=j,t[21]=C,t[22]=S,t[23]=k,t[24]=A,t[25]=_,t[26]=$,t[27]=R):R=t[27],R},hG=lU(e=>{let{autoComplete:t,field:n,field:{admin:{className:a,disabled:l,placeholder:r,rtl:i}={},label:s,localized:u,required:h}={},inputRef:f,path:m,validate:g}=e,{t:b}=(0,d.d)(),v=aN(),{config:y}=(0,c.c)(),x=(0,o.useCallback)((e,t)=>{let n=m?m.split("."):[];return"function"==typeof g?g(e,{...t,required:h}):(0,Q.wJ)(e,{name:"password",type:"text",blockData:{},data:{},event:"onChange",path:n,preferences:{fields:{}},req:{payload:{config:y},t:b},required:!0,siblingData:{}})},[g,y,b,h,m]),{customComponents:{AfterInput:w,BeforeInput:j,Description:C,Error:S,Label:k}={},disabled:_,setValue:$,showError:N,value:P}=lI({path:m,validate:x}),E=lq({fieldLocalized:!1,fieldRTL:i,locale:v,localizationConfig:y.localization||void 0}),D=(0,o.useMemo)(()=>lV(n),[n]);return(0,p.jsx)(hY,{AfterInput:w,autoComplete:t,BeforeInput:j,className:a,Description:C,Error:S,inputRef:f,Label:k,label:s,localized:u,onChange:e=>{$(e.target.value)},path:m,placeholder:r,readOnly:_||l,required:h,rtl:E,showError:N,style:D,value:P||""})}),hX={array:hW,blocks:rk,checkbox:lX,code:rP,collapsible:rA,confirmPassword:hK,date:s3,email:s2,group:ct,hidden:cn,join:dj,json:dC,number:dS,password:hG,point:d_,radio:dE,relationship:d8,richText:d7,row:d9,select:un,tabs:uw,text:u_,textarea:uN,ui:uP,upload:hI},hZ={...hX,Description:nr,Error:ni,Label:aD,RowLabel:eq},hJ=new Map([]),h0={altleft:"alt",altright:"alt",controlleft:"ctrl",controlright:"ctrl",ctrlleft:"ctrl",ctrlright:"ctrl",escape:"esc",metaleft:"meta",metaright:"meta",osleft:"meta",osright:"meta",shiftleft:"shift",shiftright:"shift"},h1=e=>(h0[e.toLowerCase()]||e).trim().toLowerCase().replace("key",""),h3=(e,t)=>
42{let n=(0,g.c)(9),{cmdCtrlKey:a,editDepth:l,keyCodes:r}=e,{modalState:i}=nN(),s;n[0]!==a||n[1]!==l||n[2]!==t||n[3]!==r||n[4]!==i?(s=e=>{let n,o=e.detail?.key?e.detail:e;if(void 0===o.key)return;hJ.forEach(h2),o.code&&("meta"===(n=h1(o.code))&&hJ.forEach((e,t)=>"meta"!==t&&hJ.delete(t)),hJ.set(n,Date.now()));let s=window.navigator.userAgent.includes("Mac OS X"),c=[...hJ.keys()].filter(h6);if((0,Y._)(new Set(c),new Set(r))&&(!a||s&&hJ.has("meta")||!s&&o.ctrlKey)){if((Object.keys(i).filter(e=>i[e]?.isOpen)?.length+1||1)!==l)return;t(o)}},n[0]=a,n[1]=l,n[2]=t,n[3]=r,n[4]=i,n[5]=s):s=n[5];let c=s,d,u;n[6]!==c?(d=()=>(document.addEventListener("keydown",c,!1),document.addEventListener("bypassKeyDown",c,!1),document.addEventListener("keyup",h5,!1),()=>{document.removeEventListener("keydown",c),document.removeEventListener("bypassKeyDown",c),document.removeEventListener("keyup",h5)}),u=[c,h5],n[6]=c,n[7]=d,n[8]=u):(d=n[7],u=n[8]),(0,o.useEffect)(d,u)};function h2(e,t){Date.now()-e>3e3&&hJ.delete(t)}function h6(e){return!["alt","ctrl","meta","shift"].includes(e)}function h5(e){let t;e.code&&("meta"===(t=h1(e.code))&&hJ.clear(),hJ.delete(t))}var h4=(e,t)=>{let n,a,l,r,i,s,c=(0,g.c)(30),u;c[0]!==t?(u=void 0===t?{}:t,c[0]=t,c[1]=u):u=c[1];let{initialData:p,initialParams:h}=u,f;c[2]!==h?(f=void 0===h?{}:h,c[2]=h,c[3]=f):f=c[3];let m=f,{i18n:b}=(0,d.d)(),v;c[4]!==p?(v=p||{},c[4]=p,c[5]=v):v=c[5];let[y,w]=(0,o.useState)(v),[j,C]=(0,o.useState)(m),[S,k]=(0,o.useState)(!p),[_,$]=(0,o.useState)(!1),{code:N}=aN(),P=(0,o.useRef)(!1),E;c[6]!==N||c[7]!==j?(E=x.A({locale:N,..."object"==typeof j?j:{}},{addQueryPrefix:!0}),c[6]=N,c[7]=j,c[8]=E):E=c[8];let D=E,T;return c[9]!==b.language||c[10]!==p||c[11]!==D||c[12]!==e?(T=()=>{if(p&&!P.current){P.current=!0;return}let t=new AbortController;return e?(async()=>{$(!1),k(!0);try{let n=await ay.get(`${e}${D}`,{headers:{"Accept-Language":b.language},signal:t.signal});n.status>201&&$(!0);let a=await n.json();w(a),k(!1)}catch{t.signal.aborted||($(!0),k(!1))}})():($(!1),k(!1)),()=>{try{t.abort()}catch(e){}}},c[9]=b.language,c[10]=p,c[11]=D,c[12]=e,c[13]=T):T=c[13],c[14]!==b.language||c[15]!==p||c[16]!==N||c[17]!==D||c[18]!==e?(n=[e,N,D,b.language,p],c[14]=b.language,c[15]=p,c[16]=N,c[17]=D,c[18]=e,c[19]=n):n=c[19],(0,o.useEffect)(T,n),c[20]!==p?(a=()=>{p&&P.current&&w(p)},l=[p],c[20]=p,c[21]=a,c[22]=l):(a=c[21],l=c[22]),(0,o.useEffect)(a,l),c[23]!==y||c[24]!==_||c[25]!==S?(r={data:y,isError:_,isLoading:S},c[23]=y,c[24]=_,c[25]=S,c[26]=r):r=c[26],c[27]===Symbol.for("react.memo_cache_sentinel")?(i={setParams:C},c[27]=i):i=c[27],c[28]!==r?(s=[r,i],c[28]=r,c[29]=s):s=c[29],s},h8=e=>{let t,n=(0,g.c)(5),[a,l]=(0,o.useState)(),r,i;return n[0]!==e?(r=()=>{let t;return e&&(t=new ResizeObserver(e=>{e.forEach(e=>{let{contentBoxSize:t,contentRect:n}=e,a=0,r=0;if(t){let e=Array.isArray(t)?t[0]:t;if(e){let{blockSize:t,inlineSize:n}=e;a=n,r=t}}else if(n){let{height:e,width:t}=n;a=t,r=e}l({height:r,width:a})})})).observe(e),()=>{t&&t.unobserve(e)}},i=[e],n[0]=e,n[1]=r,n[2]=i):(r=n[1],i=n[2]),(0,o.useEffect)(r,i),n[3]!==a?(t={size:a},n[3]=a,n[4]=t):t=n[4],t},h7=e=>{let t=(0,g.c)(4),{admin:n,fields:a}=e,{useAsTitle:l}=n,{i18n:r}=(0,d.d)(),i;return t[0]!==a||t[1]!==r||t[2]!==l?(i=(0,k.L)(a,{i18n:r,moveSubFieldsToTop:!0})?.find(e=>"name"in e&&e.name===l),t[0]=a,t[1]=r,t[2]=l,t[3]=i):i=t[3],i},h9=({className:e})=>(0,p.jsx)("svg",{className:"icon icon--sort",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"fill",d:"M2.5 13.3333L5.83333 16.6667M5.83333 16.6667L9.16667 13.3333M5.83333 16.6667V3.33333M9.16667 7.08333H17.5M9.16667 10.4167H15M11.6667 13.75H12.5",stroke:"#2F2F2F",strokeLinecap:"round",strokeLinejoin:"round"})}),fe=({className:e})=>(0,p.jsx)("svg",{className:"icon icon--sort",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"fill",d:"M2.5 6.66668L5.83333 3.33334M5.83333 3.33334L9.16667 6.66668M5.83333 3.33334V16.6667M11.6667 7.08354H17.5M9.16667 10.4169H15M9.16667 13.7502H12.5",stroke:"#2F2F2F",strokeLinecap:"round",strokeLinejoin:"round"})}),ft="sort-header",fn=e=>{let t=(0,g.c)(7),{appearance:n}=e,{handleSortPress:a,isActive:l}=function(){let e=(0,g.c)(7),{handleSortChange:t,orderableFieldName:n,query:a}=cc(),l=(Array.isArray(a.sort)?a.sort[0]:a.sort)===n,r;e[0]!==t||e[1]!==l||e[2]!==n?(r=()=>{l||t(n)},e[0]=t,e[1]=l,e[2]=n,e[3]=r):r=e[3];let i=r,o;return e[4]!==i||e[5]!==l?(o={handleSortPress:i,isActive:l},e[4]=i,e[5]=l,e[6]=o):o=e[6],o}(),{t:r}=(0,d.d)(),i=n&&`${ft}--appearance-${n}`,o;
42t[0]!==i?(o=[ft,i].filter(Boolean),t[0]=i,t[1]=o):o=t[1];let s=o.join(" "),c;return t[2]!==a||t[3]!==l||t[4]!==r||t[5]!==s?(c=(0,p.jsx)("div",{className:s,children:(0,p.jsx)("div",{className:`${ft}__buttons`,children:(0,p.jsx)("button",{"aria-label":r("general:sortByLabelDirection",{direction:r("general:ascending"),label:"Order"}),className:`${ft}__button ${l?`${ft}--active`:""}`,onClick:a,type:"button",children:(0,p.jsx)(h9,{})})})}),t[2]=a,t[3]=l,t[4]=r,t[5]=s,t[6]=c):c=t[6],c},fa="sort-row",fl=()=>{let e=(0,g.c)(2),{orderableFieldName:t,query:n}=cc(),a=n.sort===t||n.sort===`-${t}`,l=`${fa} ${a?"active":""}`,r;return e[0]!==l?(r=(0,p.jsx)("div",{className:l,role:"button",tabIndex:0,children:(0,p.jsx)(l3,{className:`${fa}__icon`})}),e[0]=l,e[1]=r):r=e[1],r},fr=({cellMap:e,columns:t,dragAttributes:n={},dragListeners:a={},rowId:l,...r})=>(0,p.jsx)("tr",{...r,children:t.map((t,r)=>{let{accessor:i}=t,o=t.renderedCells[e[l]];return"_dragHandle"===i?(0,p.jsx)("td",{className:`cell-${i}`,children:(0,p.jsx)("div",{...n,...a,children:o})},r):(0,p.jsx)("td",{className:`cell-${i}`,children:o},r)})}),fi=({children:e,className:t,rowId:n})=>typeof n>"u"?null:(0,p.jsx)("div",{className:t,children:(0,p.jsx)("table",{cellPadding:0,cellSpacing:0,children:(0,p.jsx)("tbody",{children:e})})}),fo="table",fs=({appearance:e="default",BeforeTable:t,collection:n,columns:a,data:l})=>{let{config:r}=(0,c.c)(),{data:i,orderableFieldName:s,query:d}=cc(),{code:u}=aN(),h=i?.docs||l,[f,m]=(0,o.useState)(h),[g,b]=(0,o.useState)({}),[x,w]=(0,o.useState)();(0,o.useEffect)(()=>{m(h),b(Object.fromEntries(h.map((e,t)=>[String(e.id??e._id),t])))},[h]);let j=a?.filter(e=>e?.active);if(!j||0===j.filter(e=>!["_dragHandle","_select"].includes(e.accessor)).length)return(0,p.jsx)("div",{children:"No columns selected"});let C=async({moveFromIndex:e,moveToIndex:t})=>{if(d.sort!==s&&d.sort!==`-${s}`){e3.warning('To reorder the rows you must first sort them by the "Order" column'),w(void 0);return}if(e===t)return void w(void 0);let a=f[e].id??f[e]._id,l=t>e?f[t]:f[t-1],i=t>e?f[t+1]:f[t],o=[...f];m(n=>{let a=[...n];return a[e][s]="pending",a.splice(t,0,a.splice(e,1)[0]),a});try{let e=l?{id:l.id??l._id,key:l[s]}:{id:i.id??i._id,key:i[s]},t=l&&d.sort===s||!l&&d.sort===`-${s}`?"greater":"less",o={collectionSlug:n.slug,docsToMove:[a],newKeyWillBe:t,orderableFieldName:s,target:e},c=await fetch((0,y.Q)({apiRoute:r.routes.api,path:`/reorder?locale=${u}`}),{body:JSON.stringify(o),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST"});if(403===c.status)throw Error("You do not have permission to reorder these rows");if(!c.ok)throw Error("Failed to reorder. This can happen if you reorder several rows too quickly. Please try again.");if(200===c.status&&"initial migration"===(await c.json()).message)throw Error('You have enabled "orderable" on a collection with existing documentsand this is the first time you have sorted documents. We have run an automatic migration to add an initial order to the documents. Please refresh the page and try again.')}catch(t){let e=t instanceof Error?t.message:String(t);m(o),e3.error(e)}finally{w(void 0)}},S=f.map(e=>e.id??e._id);return(0,p.jsxs)("div",{className:[fo,e&&`${fo}--appearance-${e}`].filter(Boolean).join(" "),children:[t,(0,p.jsxs)(nt,{ids:S,onDragEnd:C,onDragStart:({id:e})=>{w(e)},children:[(0,p.jsxs)("table",{cellPadding:"0",cellSpacing:"0",children:[(0,p.jsx)("thead",{children:(0,p.jsx)("tr",{children:j.map((e,t)=>(0,p.jsx)("th",{id:`heading-${e.accessor}`,children:e.Heading},t))})}),(0,p.jsx)("tbody",{children:f.map((e,t)=>(0,p.jsx)(ne,{id:S[t],children:({attributes:n,isDragging:a,listeners:l,setNodeRef:r,transform:i,transition:o})=>(0,p.jsx)(fr,{cellMap:g,className:`row-${t+1}`,columns:j,dragAttributes:n,dragListeners:l,ref:r,rowId:e.id??e._id,style:{opacity:+!a,transform:i,transition:o}})},S[t]))})]}),(0,p.jsx)(v.Hd,{children:(0,p.jsx)(fi,{className:[fo,`${fo}--drag-preview`].join(" "),rowId:x,children:(0,p.jsx)(fr,{cellMap:g,columns:j,rowId:x})})})]})]})},fc=({cellData:e})=>(0,p.jsx)("div",{className:"query-preset-columns-cell",children:e?(0,$.F)(e).map((e,t)=>{let n=!e.startsWith("-");return n?(0,p.jsx)(ra,{pillStyle:n?"always-white":"light",size:"small",children:(0,G.x4)(e)},t):null}):"No columns selected"}),fd=({cellData:e})=>(0,p.jsx)("div",{children:e?(e=>{if(e.or&&e.or.length>0&&e.or[0].and&&e.or[0].and.length>0){let t=e.or[0]?.and?.[0];if(!t||"object"!=typeof t)return"No where query";let n=Object.keys(t)[0];if(!n||!t[n]||"object"!=typeof t[n])return"No where query";let a=Object.keys(t[n])[0],l=t[n][a];if("string"==typeof l)return`${(0,G.x4)(n)} ${a} ${(0,G.x4)(l)}`;if(Array.isArray(l))return`${(0,G.x4)(n)} ${a} ${l.map(e=>(0,G.x4)(e)).join(" or ")}`}return""})(e):"No where query"}),fu=({cellData:e})=>{let t=["read","update","delete"];return(0,p.jsx)("p",{children:t.reduce((n,a,l)=>{let r=e?.[a];return r&&r.constraint&&n.push((0,p.jsxs)(o.Fragment,{children:[(0,p.jsxs)("span",{children:[(0,p.jsx)("strong",{children:(0,G.x4)(a)}),": ",(0,G.x4)(r.constraint)]}),l!==t.length-1&&", "]},a)),n},[])})},fp=[{label:"equals",value:"equals"},{label:"isNotEqualTo",value:"not_equals"}],fh={label:"exists",value:"exists"},ff=[...fp,{label:"isIn",value:"in"},{label:"isNotIn",value:"not_in"},fh],fm=[...ff,{label:"isGreaterThan",value:"greater_than"},{label:"isLessThan",value:"less_than"},{label:"isLessThanOrEqualTo",value:"less_than_equal"},{label:"isGreaterThanOrEqualTo",value:"greater_than_equal"}],fg=[...fp,{label:"near",value:"near"}],fb={label:"isLike",value:"like"},fv={label:"isNotLike",value:"not_like"},fy={label:"contains",value:"contains"},fx={checkbox:{component:"Text",operators:[...fp,fh]},code:{component:"Text",operators:[...ff,fb,fv,fy]},date:{component:"Date",operators:[...fm,fh]},email:{component:"Text",operators:[...ff,fy]},json:{component:"Text",operators:[fh]},number:{component:"Number",operators:[...fm,fh]},point:{component:"Point",operators:[...fg,fh,{label:"within",value:"within"},{label:"intersects",value:"intersects"}]},radio:{component:"Select",operators:[...ff]},relationship:{component:"Relationship",operators:[...ff]},richText:{component:"Text",operators:[fh]},select:{component:"Select",operators:[...ff]},text:{component:"Text",operators:[...ff,fb,fv,fy]},textarea:{component:"Text",operators:[...ff,fb,fv,fy]},upload:{component:"Relationship",operators:[...ff]}},fw=({field:e,operator:t})=>{let n=[];return n="relationship"===e.type&&Array.isArray(e.relationTo)?[...fp,fh]:[...fx[e.type].operators],{validOperator:t&&n.find(({value:e})=>e===t)?t:n[0].value,validOperators:n}},fj=({fieldPermissions:e,fields:t,i18n:n,labelPrefix:a,pathPrefix:l})=>t.reduce((t,r)=>{let i=l;if((0,b.I2)(r)&&!(0,b.uT)(r)||"virtual"in r&&!0===r.virtual)return t;let o=!1;if("virtual"in r&&"string"==typeof r.virtual&&(i=i?i+"."+r.virtual:r.virtual,(0,b.Z7)(r)&&(o=!0)),"tabs"===r.type&&"tabs"in r)return r.tabs.forEac
42h(l=>{if("boolean"!=typeof l.label){let r=(0,h.s)(l.label,n),o=(0,b.pz)(l)?a?a+" > "+r:r:a,s=(0,b.pz)(l)&&l.name?i?i+"."+l.name:l.name:i;"string"==typeof r&&t.push(...fj({fieldPermissions:"boolean"==typeof e?e:(0,b.pz)(l)&&l.name?e?.[l.name]?.fields||e?.[l.name]:e,fields:l.fields,i18n:n,labelPrefix:o,pathPrefix:s}))}}),t;if("row"===r.type&&"fields"in r)return t.push(...fj({fieldPermissions:e,fields:r.fields,i18n:n,labelPrefix:a,pathPrefix:i})),t;if("collapsible"===r.type&&"fields"in r){let l=(0,h.s)(r.label||"",n),o=a?a+" > "+l:l;return t.push(...fj({fieldPermissions:e,fields:r.fields,i18n:n,labelPrefix:o,pathPrefix:i})),t}if("group"===r.type&&"fields"in r){let l=(0,h.s)(r.label||"",n),o=a?l?a+" > "+l:a:l;if((0,b.Z7)(r)){let a=r.name?i?i+"."+r.name:r.name:i;t.push(...fj({fieldPermissions:"boolean"==typeof e?e:e?.[r.name]?.fields||e?.[r.name],fields:r.fields,i18n:n,labelPrefix:o,pathPrefix:a}))}else t.push(...fj({fieldPermissions:e,fields:r.fields,i18n:n,labelPrefix:o,pathPrefix:i}));return t}if("array"===r.type&&"fields"in r){let l=(0,h.s)(r.label||"",n),o=a?l?a+" > "+l:a:l,s=r.name?i?i+"."+r.name:r.name:i;return t.push(...fj({fieldPermissions:"boolean"==typeof e?e:e?.[r.name]?.fields||e?.[r.name],fields:r.fields,i18n:n,labelPrefix:o,pathPrefix:s})),t}if("object"==typeof fx[r.type]&&((0,b.uT)(r)||!0===e||e?.[r.name]===!0||e?.[r.name]?.read===!0)){let e=new Set,{validOperators:l}=fw({field:r}),s=l.reduce((t,a)=>{if(!e.has(a.value)){e.add(a.value);let l=`operators:${a.label}`;t.push({...a,label:n.t(l)})}return t},[]),c=(0,h.s)(r.label||"",n),d={label:a?uK({field:r,prefix:a}):c,plainTextLabel:`${a?a+" > ":""}${c}`,value:o?i:i?uW(i,r):r.name,...fx[r.type],field:r,operators:s};return t.push(d),t}return t},[]),fC=({cellData:e,rowData:t})=>{let{i18n:n}=(0,d.d)(),{permissions:a}=aj(),{config:l}=(0,c.c)(),r=t?.relatedCollection,i=(0,o.useMemo)(()=>r?l.collections?.find(e=>e.slug===r):null,[r,l.collections]),s=(0,o.useMemo)(()=>i?fj({fieldPermissions:a?.collections?.[r]?.fields,fields:i.fields,i18n:n}):[],[i,a,r,n]);if(!e||"string"!=typeof e)return(0,p.jsx)("div",{children:"No group by selected"});let u=e.startsWith("-"),h=u?e.slice(1):e,f=s.find(e=>e.value===h)?.label||(0,G.x4)(h);return(0,p.jsxs)("div",{children:[f," (",u?"descending":"ascending",")"]})},fS=({fieldPermissions:e,fields:t})=>(t??[]).reduce((t,n)=>{if("ui"!==n.type&&(0,b.I2)(n)&&!(0,b.uT)(n)||n?.admin?.disableListColumn===!0)return t;if("tabs"===n.type&&"tabs"in n){let a={...n,tabs:n.tabs.map(t=>({...t,fields:fS({fieldPermissions:"boolean"==typeof e?e:"name"in t&&t.name?e[t.name]?.fields||e[t.name]:e,fields:t.fields})}))};return t.push(a),t}if("fields"in n&&Array.isArray(n.fields)){let a={...n,fields:fS({fieldPermissions:"boolean"==typeof e?e:"name"in n&&n.name?e?.[n.name]?.fields||e?.[n.name]:e,fields:n.fields})};return t.push(a),t}if(!0===e)return t.push(n),t;if((0,b.Z7)(n)){let a=e?.[n.name];return((0,b.uT)(n)||!0===a||a?.read===!0)&&t.push(n),t}return t.push(n),t},[]),fk=(e,t)=>e?.reduce((e,n)=>(0,b.Z7)(n)&&n.name===t?e:!(0,b.Z7)(n)&&"fields"in n?[...e,...fk(n.fields,t)]:"tabs"===n.type&&"tabs"in n?[...e,...n.tabs.reduce((e,n)=>[...e,..."name"in n?[n.name]:fk(n.fields,t)],[])]:[...e,n.name],[]),f_=({field:{label:e,required:t}})=>{let{path:n,setValue:a,value:l}=lI(),r=lI({path:"relatedCollection"}).value,{config:i,getEntityConfig:s}=(0,c.c)(),{i18n:u}=(0,d.d)(),{permissions:h}=aj(),f=(0,o.useId)(),m=(0,o.useMemo)(()=>r?s({collectionSlug:r}):null,[r,s]),g=(0,o.useMemo)(()=>r&&m?(({clientConfig:e,collectionConfig:t,collectionSlug:n,columns:a,i18n:l,permissions:r})=>{let i=Array.isArray(n),o=i?[]:t?.fields??[];if(i)for(let t of n){let n=e.collections.find(e=>e.slug===t);for(let e of fS({fieldPermissions:r?.collections?.[t]?.fields||!0,fields:n.fields}))(0,b.Z7)(e)&&o.some(t=>(0,b.Z7)(t)&&t.name===e.name)||o.push(e)}return a?.length?a?.filter(e=>(0,k.L)(o,{i18n:l,keepPresentationalFields:!0,moveSubFieldsToTop:!0})?.some(t=>("accessor"in t?t.accessor:"name"in t?t.name:void 0)===e.accessor)):((e,t,n)=>{let a=[];if(Array.isArray(n)&&n.length>=1)a=n;else{t&&a.push(t);let n=fk(e,t);a=(a=a.concat(n)).slice(0,4)}return a.map(e=>({accessor:e,active:!0}))})(i?o:fS({fieldPermissions:!("string"==typeof n&&r?.collections?.[n]?.fields)||r.collections[n].fields,fields:o}),t?.admin?.useAsTitle,i?[]:t?.admin?.defaultColumns)})({clientConfig:i,collectionConfig:m,collectionSlug:r,columns:l??[],i18n:u,permissions:h}):[],[i,m,r,l,u,h]),v=(0,o.useMemo)(()=>m?.fields?fj({fieldPermissions:h?.collections?.[r]?.fields??!0,fields:m.fields,i18n:u}):[],[m,u,h,r]),y=(0,o.useMemo)(()=>{let e={};for(let t of v)e[String(t.value)]=t.label;return e},[v]),x=(0,o.useMemo)(()=>g.map((e,t)=>({name:e.accessor,key:`${r}-${e.accessor}-${t}-${f}`,Label:y[e.accessor]??e.accessor,selected:e.active})),[y,g,r,f]),w=l??g,j=o.useCallback(({pill:e})=>{let t=w.map(t=>t.accessor===e.name?{...t,active:!t.active}:t);a(t.length?t:void 0)},[w,a]);return r?(0,p.jsxs)("div",{className:"field-type query-preset-columns-field",children:[(0,p.jsx)(aD,{as:"h3",label:e,path:n,required:t}),x.length>0?(0,p.jsx)(cx,{onClick:j,pills:x}):(0,p.jsx)("p",{className:"query-preset-columns-field__hint",children:"No columns available for this collection."})]}):(0,p.jsxs)("div",{className:"field-type query-preset-columns-field",children:[(0,p.jsx)(aD,{as:"h3",label:e,path:n,required:t}),(0,p.jsx)("p",{className:"query-preset-columns-field__hint",children:"Select the related collection to configure columns."})]})},f$=e=>{let{disabled:t,field:n,onChange:a,value:l}=e,{admin:r}=n,{date:i}=r||{},{config:o}=(0,c.c)(),{admin:s}=o,{dateFormat:u}=s,{i18n:f,t:m}=(0,d.d)(),g=i?.displayFormat||u;return(0,p.jsx)("div",{className:"condition-value-date",children:(0,p.jsx)(rL,{...i,displayFormat:g,onChange:a,placeholder:(0,h.s)(r.placeholder,f)||m("general:enterAValue"),readOnly:t,value:l})})},fN=e=>{let t,n=(0,g.c)(20),{disabled:a,field:l,onChange:r,operator:i,value:s}=e,{admin:c,hasMany:u}=l,{i18n:f,t:m}=(0,d.d)(),b;n[0]!==u||n[1]!==i?(b=["in","not_in"].includes(i)||u,n[0]=u,n[1]=i,n[2]=b):b=n[2];let v=b,y;n[3]===Symbol.for("react.memo_cache_sentinel")?(y=[],n[3]=y):y=n[3];let[x,w]=o.useState(y),j;n[4]!==v||n[5]!==r?(j=e=>{let t;e?v&&(t=Array.isArray(e)?e.map(fP):[Number(e.value?.value||e.value)]):t=[],r(t)},n[4]=v,n[5]=r,n[6]=j):j=n[6];let C=j,S,k;if(n[7]!==s?(S=()=>{Array.isArray(s)?w(s.map(fE)):w([])},k=[s],n[7]=s,n[8]=S,n[9]=k):(S=n[8],k=n[9]),o.useEffect(S,k),n[10]!==c?.placeholder||n[11]!==a||n[12]!==f||n[13]!==v||n[14]!==r||n[15]!==C||n[16]!==m||n[17]!==s||n[18]!==x){let e=(0,h.s)(c?.placeholder,f)||m("general:enterAValue");t=v?(0,p.jsx)(sZ,{disabled:a,isClearable:!0,isCreatable:!0,isMulti:v,isSortable:!0,numberOnly:!0,onChange:C,options:[],placeholder:e,value:x||[]}):(0,p.jsx)("input",{className:"condition-value-number",disabled:a,onChange:e=>r(e.target.value),placeholder:e,type:"number",value:s}),n[10]=c?.placeholder,n[11]=a,n[12]=f,n[13]=v,n[14]=r,n[15]=C,n[16]=m,n[17]=s,n[18]=x,n[19]=t}else t=n[19];return t};function fP(e){return Number(e.value?.value||e.value)}function fE(e,t){return{id:`${e}${t}`,label:`${e}`,value:{toString:()=>`${e}${t}`,value:e?.value||e}}}var fD=e=>e.reduce((e,t)=>
42t.options?[...e,...fD(t.options)]:[...e,t.value],[]),fT=(e,t)=>{switch(t.type){case"ADD":{let{collection:n,data:a,hasMultipleRelations:l,i18n:r,relation:i}=t,o=n.admin.useAsTitle||"id",s=fD(e);if(!l)return[...e,...a.docs.reduce((e,t)=>-1===s.indexOf(t.id)?(s.push(t.id),[...e,{label:t[o],value:t.id}]):e,[])];let c=[...e],d=c.find(e=>e.label===(0,h.s)(n.labels.plural,r)),u=a.docs.reduce((e,t)=>-1===s.indexOf(t.id)?(s.push(t.id),[...e,{label:t[o],relationTo:i,value:t.id}]):e,[]);return d?d.options=[...d.options,...u]:c.push({label:(0,h.s)(n.labels.plural,r),options:u,value:void 0}),c}case"CLEAR":return t.required?[]:[{label:t.i18n.t("general:none"),value:"null"}];default:return e}},fA="condition-value-relationship",fR=e=>{let{disabled:t,field:{admin:n={},hasMany:a,relationTo:l},filterOptions:r,onChange:i,operator:s,value:u}=e,h="placeholder"in n?n?.placeholder:void 0,f=n?.isSortable,m=a||["in","not_in"].includes(s),{config:{routes:{api:g}},getEntityConfig:b}=(0,c.c)(),v=Array.isArray(l),[w,j]=(0,o.useReducer)(fT,[]),[C,S]=(0,o.useState)(""),k=cW(C,300),[_,$]=(0,o.useState)(""),[N,P]=(0,o.useState)(!1),{i18n:E,t:D}=(0,d.d)(),T=aN(),A=v?l:[l],R=o.useRef(new Map(A.map(e=>[e,{hasLoadedAll:!1,nextPage:1}]))),L=(0,o.useCallback)((e,t)=>{j({type:"ADD",collection:b({collectionSlug:t}),data:e,hasMultipleRelations:v,i18n:E,relation:t})},[v,E,b]),F=tv(async({abortController:e,relationSlug:t})=>{let n=R.current.get(t);if(t&&!n.hasLoadedAll){let a=b({collectionSlug:t})?.admin?.useAsTitle||"id",l={depth:0,limit:10,locale:T.code,page:n.nextPage,select:{[a]:!0},where:{and:[]}};r&&r?.[t]&&l.where.and.push(r[t]),k&&l.where.and.push({[a]:{like:k}});try{let n=await fetch((0,y.Q)({apiRoute:g,path:`/${t}${x.A(l,{addQueryPrefix:!0})}`}),{credentials:"include",headers:{"Accept-Language":E.language},signal:e.signal});if(n.ok){let e=await n.json();e.docs.length>0&&(L(e,t),e.nextPage?R.current.set(t,{hasLoadedAll:!1,nextPage:e.nextPage}):R.current.set(t,{hasLoadedAll:!0,nextPage:null}))}else $(D("error:unspecific"))}catch(t){e.signal.aborted||console.error(t)}}P(!0)}),O=o.useCallback(()=>{let e=R.current.entries().next().value;e[0]&&!e[1].hasLoadedAll&&F({abortController:new AbortController,relationSlug:e[0]})},[]),M=(0,o.useCallback)(()=>{if(u){if(m)return Array.isArray(u)?u.map(e=>{if(v){let t;return w.forEach(n=>{n.options&&n.options.some(n=>n?.value==e.value&&(t=n,!0))}),t}return w.find(t=>t.value==e)}):void 0;if(v){let e;return w.forEach(t=>{t?.options&&t.options.some(t=>t?.value==u.value&&(e=t,!0))}),e}return w.find(e=>e.value==u)}},[m,v,u,w]),I=(0,o.useCallback)(e=>{e!==C&&(j({type:"CLEAR",i18n:E,required:!1}),R.current=new Map((Array.isArray(l)?l:[l]).map(e=>[e,{hasLoadedAll:!1,nextPage:1}])),S(e))},[E,l,C]),B=(0,o.useCallback)(async(e,t)=>{if(!_&&"null"!==e&&e&&t){let n=await fetch((0,y.Q)({apiRoute:g,path:`/${t}/${e}?depth=0`}),{credentials:"include",headers:{"Accept-Language":E.language}});n.ok?L({docs:[await n.json()]},t):console.error(D("error:loadingDocument",{id:e}))}},[E,L,g,_,D]);(0,o.useEffect)(()=>{let e=Array.isArray(l)?l:[l];R.current=new Map(e.map(e=>[e,{hasLoadedAll:!1,nextPage:1}])),j({type:"CLEAR",i18n:E,required:!1}),P(!1);let t=[];return e.forEach(e=>{let n=new AbortController;F({abortController:n,relationSlug:e}),t.push(n)}),()=>{t.forEach(e=>{if(e.signal)try{e.abort()}catch{}})}},[E,l,k,r]),(0,o.useEffect)(()=>{u&&N&&(m?(M()||[]).forEach((e,t)=>{e||(v?B(u[t].value,u[t].relationTo):B(u[t],l))}):M()||(v?B(u.value,u.relationTo):B(u,l)))},[B,M,m,v,l,u,N]);let z=["field-type",fA,_&&"error-loading"].filter(Boolean).join(" "),U=M()||u;return(0,p.jsx)("div",{className:z,children:_?(0,p.jsx)("div",{className:`${fA}__error-loading`,children:_}):(0,p.jsx)(sZ,{disabled:t,isMulti:m,isSortable:f,onChange:e=>{e?m&&Array.isArray(e)?i(e?e.map(e=>v?{relationTo:e?.relationTo,value:e?.value}:e?.value):null):v&&!Array.isArray(e)?i({relationTo:e?.relationTo,value:e?.value}):Array.isArray(e)||i(e?.value):i(null)},onInputChange:I,onMenuScrollToBottom:O,options:w,placeholder:h,value:U})})},fL=e=>{let t,n,a,l,r=(0,g.c)(21),{disabled:i,field:s,isClearable:c,onChange:u,operator:f,options:m,value:b}=e,{admin:v}=s,{placeholder:y}=v,{i18n:x}=(0,d.d)(),w;r[0]!==m?(w=sJ(m),r[0]=m,r[1]=w):w=r[1];let[j,C]=o.useState(w),S;r[2]===Symbol.for("react.memo_cache_sentinel")?(S=["in","not_in"],r[2]=S):S=r[2];let k=S.includes(f),_;if(k&&Array.isArray(b)){let e;r[3]!==x||r[4]!==j?(e=e=>{let t=j.find(t=>t.value===e);return{label:t?(0,h.s)(t.label,x):e,value:t?.value??e}}
42,r[3]=x,r[4]=j,r[5]=e):e=r[5],_=b.map(e)}else if(b){let e;r[6]!==b?(e=e=>e.value===b,r[6]=b,r[7]=e):e=r[7];let t=j.find(e);_={label:t?(0,h.s)(t.label,x):b,value:t?.value??b}}r[8]!==k||r[9]!==u?(t=e=>{u(e?k?Array.isArray(e)?e.map(fF):[]:e.value:null)},r[8]=k,r[9]=u,r[10]=t):t=r[10];let $=t,N,P;return r[11]!==m?(N=()=>{C(sJ(m))},P=[m],r[11]=m,r[12]=N,r[13]=P):(N=r[12],P=r[13]),o.useEffect(N,P),r[14]!==k||r[15]!==u||r[16]!==b?(n=()=>{!k&&Array.isArray(b)&&u(b[0])},a=[k,u,b],r[14]=k,r[15]=u,r[16]=b,r[17]=n,r[18]=a):(n=r[17],a=r[18]),o.useEffect(n,a),r[19]!==x?(l=e=>({...e,label:(0,h.s)(e.label,x)}),r[19]=x,r[20]=l):l=r[20],(0,p.jsx)(sZ,{disabled:i,isClearable:c,isMulti:k,onChange:$,options:j.map(l),placeholder:y,value:_})};function fF(e){return e.value}var fO=e=>{let t,n=(0,g.c)(18),{disabled:a,field:l,onChange:r,operator:i,value:s}=e,{t:c}=(0,d.d)(),u=l?.hasMany??!1,h;n[0]!==u||n[1]!==i?(h=["in","not_in"].includes(i)||u,n[0]=u,n[1]=i,n[2]=h):h=n[2];let f=h,m;n[3]===Symbol.for("react.memo_cache_sentinel")?(m=[],n[3]=m):m=n[3];let[b,v]=o.useState(m),y;n[4]!==f||n[5]!==r?(y=e=>{let t;e?f&&(t=Array.isArray(e)?e.map(fM):[e.value?.value||e.value]):t=[],r(t)},n[4]=f,n[5]=r,n[6]=y):y=n[6];let x=y,w,j;return n[7]!==s?(w=()=>{Array.isArray(s)?v(s.map(fI)):v([])},j=[s],n[7]=s,n[8]=w,n[9]=j):(w=n[8],j=n[9]),o.useEffect(w,j),n[10]!==a||n[11]!==f||n[12]!==r||n[13]!==x||n[14]!==c||n[15]!==s||n[16]!==b?(t=f?(0,p.jsx)(sZ,{disabled:a,isClearable:!0,isCreatable:!0,isMulti:f,isSortable:!0,onChange:x,options:[],placeholder:c("general:enterAValue"),value:b||[]}):(0,p.jsx)("input",{className:"condition-value-text",disabled:a,onChange:e=>r(e.target.value),placeholder:c("general:enterAValue"),type:"text",value:s||""}),n[10]=a,n[11]=f,n[12]=r,n[13]=x,n[14]=c,n[15]=s,n[16]=b,n[17]=t):t=n[17],t};function fM(e){return e.value?.value||e.value}function fI(e,t){return{id:`${e}${t}`,label:`${e}`,value:{toString:()=>`${e}${t}`,value:e?.value||e}}}var fB=({booleanSelect:e,disabled:t,filterOptions:n,internalField:a,onChange:l,operator:r,options:i,value:o})=>{if(e||["radio","select"].includes(a?.field?.type))return(0,p.jsx)(fL,{disabled:t,field:a.field,isClearable:!e,onChange:l,operator:r,options:i,value:o});switch(a?.field?.type){case"date":return(0,p.jsx)(f$,{disabled:t,field:a.field,onChange:l,operator:r,value:o});case"number":return(0,p.jsx)(fN,{disabled:t,field:a.field,onChange:l,operator:r,value:o});case"relationship":case"upload":return(0,p.jsx)(fR,{disabled:t,field:a.field,filterOptions:n??{},onChange:l,operator:r,value:o});default:return(0,p.jsx)(fO,{disabled:t,field:a?.field,onChange:l,operator:r,value:o})}},fz="condition",fU=e=>{let{addCondition:t,andIndex:n,fieldPath:a,filterOptions:l,operator:r,orIndex:i,reducedFields:s,removeCondition:c,RenderedFilter:u,updateCondition:h,value:f}=e,{t:m}=(0,d.d)(),g=s.find(e=>e.value===a),[b,v]=(0,o.useState)(f),y=cW(b,300),x=["exists"].includes(r)||g?.field?.type==="checkbox",w=[];x?w=[{label:m("general:true"),value:"true"},{label:m("general:false"),value:"false"}]:g?.field&&"options"in g.field&&(w=g.field.options);let j=tv(async e=>{r&&await h({type:"value",andIndex:n,field:g,operator:r,orIndex:i,value:null===e||""===e?void 0:e})});(0,o.useEffect)(()=>{j(y)},[y]);let C=!g?.value&&"number"!=typeof g?.value||g?.field?.admin?.disableListFilter,S=(0,o.useCallback)(async e=>{v(void 0),await h({type:"field",andIndex:n,field:s.find(t=>t.value===e.value),operator:r,orIndex:i,value:void 0})},[n,r,i,s,h]),k=(0,o.useCallback)(async e=>{let t,a={all:"any",contains:"string",equals:"any",exists:"boolean",greater_than:"date"===(t=g.field.type)?"object":"string",greater_than_equal:"date"===t?"object":"string",in:"any",intersects:"any",less_than:"date"===t?"object":"string",less_than_equal:"date"===t?"object":"string",like:"string",near:"any",not_equals:"any",not_in:"any",not_like:"string",within:"any"}[e.value]||"any",l="any"===a||typeof f===a||"boolean"===a&&("true"===f||"false"===f);l||v(void 0),await h({type:"operator",andIndex:n,field:g,operator:e.value,orIndex:i,value:l?f:void 0})},[n,g,i,h,f]);return(0,p.jsx)("div",{className:fz,children:(0,p.jsxs)("div",{className:`${fz}__wrap`,children:[(0,p.jsxs)("div",{className:`${fz}__inputs`,children:[(0,p.jsx)("div",{className:`${fz}__field`,children:(0,p.jsx)(sZ,{disabled:C,filterOption:(e,t)=>(e?.data?.plainTextLabel||e.label).toLowerCase().includes(t.toLowerCase()),isClearable:!1,onChange:S,options:s.filter(e=>!e.field.admin.disableListFilter),value:g||{value:g?.value}})}),(0,p.jsx)("div",{className:`${fz}__operator`,children:(0,p.jsx)(sZ,{disabled:C,isClearable:!1,onChange:k,options:g?.o
42perators,value:g?.operators.find(e=>r===e.value)||null})}),(0,p.jsx)("div",{className:`${fz}__value`,children:u||(0,p.jsx)(fB,{booleanSelect:x,disabled:!r||!g||g?.field?.admin?.disableListFilter,filterOptions:l,internalField:g,onChange:v,operator:r,options:w,value:b??""})})]}),(0,p.jsxs)("div",{className:`${fz}__actions`,children:[(0,p.jsx)(tN,{buttonStyle:"icon-label",className:`${fz}__actions-remove`,icon:"x",iconStyle:"with-border",onClick:()=>c({andIndex:n,orIndex:i}),round:!0}),(0,p.jsx)(tN,{buttonStyle:"icon-label",className:`${fz}__actions-add`,icon:"plus",iconStyle:"with-border",onClick:()=>t({andIndex:n+1,field:s.find(e=>!e.field.admin?.disableListFilter),orIndex:i,relation:"and"}),round:!0})]})]})})},fV="where-builder",fH=e=>{let{collectionPluralLabel:t,collectionSlug:n,fields:a,onChange:l,renderedFilters:r,resolvedFilterOptions:i,value:s}=e,{i18n:u,t:f}=(0,d.d)(),{permissions:m}=aj(),{getEntityConfig:g}=(0,c.c)(),b=cc(),v="function"==typeof l,y=(0,o.useMemo)(()=>v?g({collectionSlug:n}):null,[v,n,g]),x=v?y?.labels?.plural??n:t??n,w=(v?y?.fields:a)??[],C=m?.collections?.[n]?.fields,S=(0,o.useMemo)(()=>fj({fieldPermissions:C,fields:w,i18n:u}),[C,w,u]),k=(0,o.useMemo)(()=>{let e=v?s:b.query?.where;if(e){if((0,X.Q)(e))return e.or??[];let t=(0,Z.a)(e);if((0,X.Q)(t))return t.or??[];v||console.warn(`Invalid where query in URL: ${JSON.stringify(e)}`)}return[]},[v,s,b.query?.where]),_=v?e=>{l?.(e)}:b.handleWhereChange,$=o.useCallback(async({andIndex:e,field:t,orIndex:n,relation:a})=>{let l=[...k],r=fx[t.field.type].operators[0].value;"and"===a?l[n].and.splice(e,0,{[String(t.value)]:{[r]:void 0}}):l.push({and:[{[String(t.value)]:{[r]:void 0}}]}),await _({or:l})},[k,_]),N=o.useCallback(async({andIndex:e,field:t,operator:n,orIndex:a,value:l})=>{let r=k[a].and[e];if("object"==typeof r&&t.value){let{validOperator:i}=fw({field:t.field,operator:n}),o=r[String(t.value)]?.[i];if("u">typeof o&&o===l)return;let s={[String(t.value)]:{[i]:l}};if((0,j.j)(r,s))return;let c=[...k];c[a].and[e]=s,await _({or:c})}},[k,_]),P=o.useCallback(async({andIndex:e,orIndex:t})=>{let n=[...k];n[t].and.splice(e,1),0===n[t].and.length&&n.splice(t,1),await _({or:n})},[k,_]);return(0,p.jsxs)("div",{className:fV,children:[k.length>0&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)("p",{className:`${fV}__label`,children:f("general:filterWhere",{label:(0,h.s)(x,u)})}),(0,p.jsx)("ul",{className:`${fV}__or-filters`,children:k.map((e,t)=>{let n=`${t}_${Array.isArray(e?.and)?e.and.length:""}`;return(0,p.jsxs)("li",{children:[0!==t&&(0,p.jsx)("div",{className:`${fV}__label`,children:f("general:or")}),(0,p.jsx)("ul",{className:`${fV}__and-filters`,children:Array.isArray(e?.and)&&e.and.map((e,n)=>{let a=k[t].and[n],l=Object.keys(a)[0],o=Object.keys(a?.[l]||{})?.[0]||void 0,s=a?.[l]?.[o]||void 0;return(0,p.jsxs)("li",{children:[0!==n&&(0,p.jsx)("div",{className:`${fV}__label`,children:f("general:and")}),(0,p.jsx)(fU,{addCondition:$,andIndex:n,fieldPath:l,filterOptions:i?.get(l),operator:o,orIndex:t,reducedFields:S,removeCondition:P,RenderedFilter:r?.get(l),updateCondition:N,value:s})]},n)})})]},n)})}),(0,p.jsx)(tN,{buttonStyle:"icon-label",className:`${fV}__add-or`,icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:async()=>{await $({andIndex:0,field:S.find(e=>!e.field.admin?.disableListFilter),orIndex:k.length,relation:"or"})},children:f("general:or")})]}),0===k.length&&(0,p.jsxs)("div",{className:`${fV}__no-filters`,children:[(0,p.jsx)("div",{className:`${fV}__label`,children:f("general:noFiltersSet")}),(0,p.jsx)(tN,{buttonStyle:"icon-label",className:`${fV}__add-first-filter`,icon:"plus",iconPosition:"left",iconStyle:"with-border",onClick:async()=>{S.length>0&&await $({andIndex:0,field:S.find(e=>!e.field.admin?.disableListFilter),orIndex:k.length,relation:"or"})},children:f("general:addFilter")})]})]})},fq=e=>{let t,n=(0,g.c)(14),{field:a}=e,{label:l,required:r}=a,{path:i,setValue:o,value:s}=lI(),c;n[0]===Symbol.for("react.memo_cache_sentinel")?(c={path:"relatedCollection"},n[0]=c):c=n[0];let d=lI(c).value;if(!d){let e;return n[1]!==l||n[2]!==i||n[3]!==r?(e=(0,p.jsxs)("div",{className:"field-type query-preset-where-field",children:[(0,p.jsx)(aD,{as:"h3",label:l,path:i,required:r}),(0,p.jsx)("p",{className:"query-preset-where-field__hint",children:"Select the related collection to configure filters."})]}),n[1]=l,n[2]=i,n[3]=r,n[4]=e):e=n[4],e}if(n[5]!==l||n[6]!==i||n[7]!==d||n[8]!==r||n[9]!==o||n[10]!==s){let e;n[12]!==o?(e=e=>o(e),n[12]=o,n[13]=e):e=n[13],t=(0,p.jsxs)("div",{className:"field-type query-preset-where-field",children:[(0,p.jsx)(aD,{as:"h3",label:l,path:i,required:r}),(0,p.jsx)(fH,{collectionSlug:d,onChange:e,value:s??void 0})]}),n[5]=l,n[6]=i,n[7]=d,n[8]=r,n[9]=o,n[10]=s,n[11]=t}else t=n[11];return t},fW="group-by-builder",fK=["text","textarea","number","select","relationship","date","checkbox","radio","email","number","upload"],fQ=({collectionSlug:e,fields:t,onChange:n,value:a})=>{let{i18n:l,t:r}=(0,d.d)(),{permissions:i}=aj(),s=cc(),c="function"==typeof n,u=c?a:s.query?.groupBy,h=u?.replace(/^-/,""),f=i?.collections?.[e]?.fields,m=(0,o.useMemo)(()=>
42fj({fieldPermissions:f,fields:t,i18n:l}),[t,f,l]),g=m.find(e=>e.value===h),b=(0,o.useMemo)(()=>c?e=>{let t=null===e?void 0:e.value,a=t?u?.startsWith("-")?`-${t}`:t:"";n?.(a)}:e=>{(async()=>{if("function"!=typeof s.refineListData)return;let t=null===e?void 0:e.value;null===e?await s.refineListData({groupBy:"",page:1}):await s.refineListData({groupBy:t?s.query?.groupBy?.startsWith("-")?`-${t}`:t:void 0,page:1})})()},[c,u,s,n]),v=(0,o.useMemo)(()=>c?()=>n?.(""):()=>{(async()=>"function"==typeof s.refineListData&&await s.refineListData({groupBy:""}))()},[c,s,n]),y=(0,o.useMemo)(()=>c?({value:e})=>{h&&n?.("asc"===e?h:`-${h}`)}:({value:e})=>{(async()=>!h||"function"!=typeof s.refineListData||await s.refineListData({groupBy:"asc"===e?h:`-${h}`,page:1}))()},[h,c,s,n]),x=u&&"string"==typeof u&&u.startsWith("-")?"desc":"asc";return(0,p.jsxs)("div",{className:fW,children:[(0,p.jsxs)("div",{className:`${fW}__header`,children:[(0,p.jsx)("p",{children:r("general:groupByLabel",{label:""})}),u&&(0,p.jsx)("button",{className:`${fW}__clear-button`,id:"group-by--reset",onClick:()=>{v()},type:"button",children:r("general:clear")})]}),(0,p.jsxs)("div",{className:`${fW}__inputs`,children:[(0,p.jsx)(sZ,{filterOption:(e,t)=>(e?.data?.plainTextLabel||e.label).toLowerCase().includes(t.toLowerCase()),id:"group-by--field-select",isClearable:!0,isMulti:!1,onChange:b,options:m.filter(e=>!e.field.admin?.disableGroupBy&&"id"!==e.value&&fK.includes(e.field.type)),value:{label:g?.label||r("general:selectValue"),value:h||""}}),(0,p.jsx)(ue,{id:"group-by--sort",isClearable:!1,name:"direction",onChange:y,options:[{label:r("general:ascending"),value:"asc"},{label:r("general:descending"),value:"desc"}],path:"direction",readOnly:!h,value:x})]})]})},fY=({field:{label:e,required:t}})=>{let{path:n,setValue:a,value:l}=lI(),r=lI({path:"relatedCollection"}).value,{config:i}=(0,c.c)(),s=(0,o.useMemo)(()=>r?i.collections?.find(e=>e.slug===r):null,[r,i.collections])?.fields??[];return r?(0,p.jsxs)("div",{className:"field-type query-preset-group-by-field",children:[(0,p.jsx)(aD,{as:"h3",label:e,path:n,required:t}),(0,p.jsx)(fQ,{collectionSlug:r,fields:s,onChange:e=>a(e||null),value:l??void 0})]}):(0,p.jsxs)("div",{className:"field-type query-preset-group-by-field",children:[(0,p.jsx)(aD,{as:"h3",label:e,path:n,required:t}),(0,p.jsx)("p",{className:"query-preset-group-by-field__hint",children:"Select the related collection to configure group by."})]})},fG="leave-without-saving",fX=e=>{let t,n=(0,g.c)(17),{disablePreventLeave:a,onConfirm:l,onPrevent:r}=e,{closeModal:i,openModal:s}=nN(),c=eM(),{isValid:d}=eT(),{user:u}=aj(),[h,f]=o.useState(!1),b=!(void 0!==a&&a)&&!!((c||!d)&&u),v;n[0]!==r||n[1]!==s?(v=()=>{let e=document.activeElement?.href||null;r&&r(e),s(fG)},n[0]=r,n[1]=s,n[2]=v):v=n[2];let y=v,x;n[3]!==i?(x=()=>{i(fG)},n[3]=i,n[4]=x):x=n[4];let w=x,j;n[5]!==w||n[6]!==y||n[7]!==h||n[8]!==b?(j={hasAccepted:h,onAccept:w,onPrevent:y,prevent:b},n[5]=w,n[6]=y,n[7]=h,n[8]=b,n[9]=j):j=n[9],(({hasAccepted:e=!1,message:t="Are you sure you want to leave this page?",onAccept:n,onPrevent:a,prevent:l=!0})=>{let r,i,s,c,d,u;r=(0,g.c)(7),i=void 0===l||l,r[0]!==i||r[1]!==t?(s=e=>{if("function"!=typeof i||i())return e.preventDefault(),t&&(e.returnValue=t),t},r[0]=i,r[1]=t,r[2]=s):s=r[2],c=s,r[3]!==i||r[4]!==c?(d=()=>{if(i)return function(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}(window,"beforeunload",c),()=>(function(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)})(window,"beforeunload",c)},u=[i,c],r[3]=i,r[4]=c,r[5]=d,r[6]=u):(d=r[5],u=r[6]),(0,o.useEffect)(d,u);let{startRouteTransition:p}=te(),h=(0,m.useRouter)(),f=(0,o.useRef)("");(0,o.useEffect)(()=>{function e(e){try{let n=e.target,r=function(e){for(;e&&"a"!==e.tagName.toLowerCase();)e=e.parentElement;return e}(n);if(r){let n=window.location.href,i=r.href,o=function(e,t){try{let n=new URL(e),a=new URL(t);if(n.hostname===a.hostname&&n.pathname===a.pathname&&n.search===a.search){let e=n.hash,t=a.hash;return e!==t&&n.href.replace(e,"")===a.href.replace(t,"")}}catch(e){console.log("Unexpected exception thrown in LeaveWithoutSaving:isAnchorOfCurrentUrl",e)}return!1}(n,i),s=""!==r.download,c="_blank"===r.target||e.metaKey||e.ctrlKey;!(i===n||o||s||c)&&l&&(a||!window.confirm(t))&&(f.current=i,e.preventDefault(),e.stopPropagation(),"function"==typeof a&&a())}}catch(e){console.log("Unexpected exception thrown in LeaveWithoutSaving:usePreventLeave",e)}}return l&&document.addEventListener("click",e,!0),()=>{document.removeEventListener("click",e,!0)}},[a,l,t]),(0,o.useEffect)(()=>{e&&f.current&&(n&&n(),p(()=>h.push(f.current)))},[e,n,h,p])})(j),n[10]!==i?(t=()=>{i(fG)},n[10]=i,n[11]=t):t=n[11];let C=t,S;
42n[12]!==l?(S=async()=>{if(l)try{await l()}catch(e){console.error("Error in LeaveWithoutSaving onConfirm:",e)}f(!0)},n[12]=l,n[13]=S):S=n[13];let k=S,_;return n[14]!==k||n[15]!==C?(_=(0,p.jsx)(fZ,{modalSlug:fG,onCancel:C,onConfirm:k}),n[14]=k,n[15]=C,n[16]=_):_=n[16],_},fZ=e=>{let t=(0,g.c)(5),{modalSlug:n,onCancel:a,onConfirm:l}=e,{t:r}=(0,d.d)(),i;return t[0]!==n||t[1]!==a||t[2]!==l||t[3]!==r?(i=(0,p.jsx)(ag,{body:r("general:changesNotSaved"),cancelLabel:r("general:stayOnThisPage"),confirmLabel:r("general:leaveAnyway"),heading:r("general:leaveWithoutSaving"),modalSlug:n,onCancel:a,onConfirm:l}),t[0]=n,t[1]=a,t[2]=l,t[3]=r,t[4]=i):i=t[4],i},fJ="document-take-over",f0="document-take-over",f1=e=>{let t,n=(0,g.c)(19),{handleBackToDashboard:a,isActive:l,onReadOnly:r}=e,{closeModal:i,openModal:s}=nN(),{t:c}=(0,d.d)(),{startRouteTransition:u}=te(),{clearRouteCache:h}=pr(),f,m;if(n[0]!==i||n[1]!==l||n[2]!==s?(f=()=>{l?s(fJ):i(fJ)},m=[l,s,i],n[0]=i,n[1]=l,n[2]=s,n[3]=f,n[4]=m):(f=n[3],m=n[4]),(0,o.useEffect)(f,m),n[5]!==h||n[6]!==i||n[7]!==a||n[8]!==r||n[9]!==u||n[10]!==c){let e,l;n[12]!==a||n[13]!==u?(e=()=>{u(()=>a())},n[12]=a,n[13]=u,n[14]=e):e=n[14],n[15]!==h||n[16]!==i||n[17]!==r?(l=()=>{r(),i(fJ),h()},n[15]=h,n[16]=i,n[17]=r,n[18]=l):l=n[18],t=(0,p.jsx)(nq,{className:f0,closeOnBlur:!1,slug:fJ,children:(0,p.jsxs)("div",{className:`${f0}__wrapper`,children:[(0,p.jsxs)("div",{className:`${f0}__content`,children:[(0,p.jsx)("h1",{children:c("general:editingTakenOver")}),(0,p.jsx)("p",{children:c("general:anotherUserTakenOver")})]}),(0,p.jsxs)("div",{className:`${f0}__controls`,children:[(0,p.jsx)(tN,{buttonStyle:"primary",id:`${fJ}-back-to-dashboard`,onClick:e,size:"large",children:c("general:backToDashboard")}),(0,p.jsx)(tN,{buttonStyle:"secondary",id:`${fJ}-view-read-only`,onClick:l,size:"large",children:c("general:viewReadOnly")})]})]})}),n[5]=h,n[6]=i,n[7]=a,n[8]=r,n[9]=u,n[10]=c,n[11]=t}else t=n[11];return t},f3="document-locked",f2="document-locked",f6=e=>{let t,n,a=(0,g.c)(33),{handleGoBack:l,isActive:r,onReadOnly:i,onTakeOver:s,updatedAt:c,user:u}=e,{closeModal:h,openModal:f}=nN(),{t:m}=(0,d.d)(),{clearRouteCache:b}=pr(),{startRouteTransition:v}=te(),y,x;if(a[0]!==h||a[1]!==r||a[2]!==f?(y=()=>{r?f(f3):h(f3)},x=[r,f,h],a[0]=h,a[1]=r,a[2]=f,a[3]=y,a[4]=x):(y=a[3],x=a[4]),(0,o.useEffect)(y,x),a[5]!==l||a[6]!==v?(t=()=>{v(()=>l())},a[5]=l,a[6]=v,a[7]=t):t=a[7],a[8]!==b||a[9]!==h||a[10]!==l||a[11]!==i||a[12]!==s||a[13]!==v||a[14]!==m||a[15]!==t||a[16]!==c||a[17]!==u){let e,r,o,d;a[19]!==m||a[20]!==u?(e=u&&"object"==typeof u?u.email??u.id:`${m("general:user")}: ${u}`,a[19]=m,a[20]=u,a[21]=e):e=a[21],a[22]!==h||a[23]!==l||a[24]!==v?(r=()=>{h(f3),v(()=>l())},a[22]=h,a[23]=l,a[24]=v,a[25]=r):r=a[25],a[26]!==b||a[27]!==h||a[28]!==i?(o=()=>{i(),h(f3),b()},a[26]=b,a[27]=h,a[28]=i,a[29]=o):o=a[29],a[30]!==h||a[31]!==s?(d=()=>{s(),h(f3)},a[30]=h,a[31]=s,a[32]=d):d=a[32],n=(0,p.jsx)(nq,{className:f2,closeOnBlur:!1,onClose:t,slug:f3,children:(0,p.jsxs)("div",{className:`${f2}__wrapper`,children:[(0,p.jsxs)("div",{className:`${f2}__content`,children:[(0,p.jsx)("h1",{children:m("general:documentLocked")}),(0,p.jsxs)("p",{children:[(0,p.jsx)("strong",{children:e})," ",m("general:currentlyEditing")]}),(0,p.jsxs)("p",{children:[m("general:editedSince")," ",(0,p.jsx)("strong",{children:c?new Intl.DateTimeFormat("en-US",{day:"numeric",hour:"numeric",hour12:!0,minute:"numeric",month:"short",year:"numeric"}).format(new Date(c)):""})]})]}),(0,p.jsxs)("div",{className:`${f2}__controls`,children:[(0,p.jsx)(tN,{buttonStyle:"secondary",id:`${f3}-go-back`,onClick:r,size:"large",children:m("general:goBack")}),(0,p.jsx)(tN,{buttonStyle:"secondary",id:`${f3}-view-read-only`,onClick:o,size:"large",children:m("general:viewReadOnly")}),(0,p.jsx)(tN,{buttonStyle:"primary",id:`${f3}-take-over`,onClick:d,size:"large",children:m("general:takeOver")})]})]})}),a[8]=b,a[9]=h,a[10]=l,a[11]=i,a[12]=s,a[13]=v,a[14]=m,a[15]=t,a[16]=c,a[17]=u,a[18]=n}else n=a[18];return n};function f5(e){let t=(0,g.c)(3),{i18n:n}=(0,d.d)(),{description:a}=e;if(a){let e;return t[0]!==a||t[1]!==n?(e=(0,p.jsx)("div",{className:"custom-view-description",children:(0,h.s)(a,n)}),t[0]=a,t[1]=n,t[2]=e):e=t[2],e}return null}var f4="graphic-account",f8=e=>(0,p.jsxs)("svg",{className:[f4,e?.active&&`${f4}
42--active`].filter(Boolean).join(" "),height:"25",viewBox:"0 0 25 25",width:"25",xmlns:"http://www.w3.org/2000/svg",children:[(0,p.jsx)("circle",{className:`${f4}__bg`,cx:"12.5",cy:"12.5",r:"11.5"}),(0,p.jsx)("circle",{className:`${f4}__head`,cx:"12.5",cy:"10.73",r:"3.98"}),(0,p.jsx)("path",{className:`${f4}__body`,d:"M12.5,24a11.44,11.44,0,0,0,7.66-2.94c-.5-2.71-3.73-4.8-7.66-4.8s-7.16,2.09-7.66,4.8A11.44,11.44,0,0,0,12.5,24Z"})]}),f7=(0,u.e)(ef(),1),f9=()=>{let e=(0,g.c)(2),{user:t}=aj(),n=(0,f7.default)(t.email.trim().toLowerCase()),a=`?${new URLSearchParams({default:"mp",r:"g",s:"50"}).toString()}`,l=`https://www.gravatar.com/avatar/${n}${a}`,r;return e[0]!==l?(r=(0,p.jsx)("img",{alt:"yas",className:"gravatar-account",height:25,src:l,style:{borderRadius:"50%"},width:25}),e[0]=l,e[1]=r):r=e[1],r},me=()=>{let e=(0,g.c)(3),{config:t}=(0,c.c)(),{admin:n,routes:a}=t,{avatar:l,routes:r}=n,{account:i}=r,{admin:o}=a,{user:s}=aj(),d=(0,m.usePathname)()===(0,y.Q)({adminRoute:o,path:i});if(!s?.email||"default"===l){let t;return e[0]!==d?(t=(0,p.jsx)(f8,{active:d}),e[0]=d,e[1]=t):t=e[1],t}if("gravatar"===l){let t;return e[2]===Symbol.for("react.memo_cache_sentinel")?(t=(0,p.jsx)(f9,{}),e[2]=t):t=e[2],t}},mt=(0,o.createContext)({Actions:{},setViewActions:()=>{}}),mn=()=>(0,o.use)(mt),ma=e=>{let t=(0,g.c)(4),{Actions:n,children:a}=e,[l,r]=(0,o.useState)(n),i;return t[0]!==n||t[1]!==a||t[2]!==l?(i=(0,p.jsx)(mt,{value:{Actions:{...l,...n}
42,setViewActions:r},children:a}),t[0]=n,t[1]=a,t[2]=l,t[3]=i):i=t[3],i},ml=()=>(0,p.jsx)("svg",{className:"icon icon--close-menu",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M14 6L6 14M6 6L14 14",strokeLinecap:"square"})}),mr=()=>(0,p.jsx)("svg",{className:"icon icon--menu",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M4.66667 10H15.3333M4.66667 6H15.3333M4.66667 14H15.3333",strokeLinecap:"square"})}),mi="hamburger",mo=e=>{let t=(0,g.c)(4),{t:n}=(0,d.d)(),{closeIcon:a,isActive:l}=e,r=void 0===a?"x":a,i=void 0!==l&&l,o;return t[0]!==r||t[1]!==i||t[2]!==n?(o=(0,p.jsxs)("div",{className:mi,children:[!i&&(0,p.jsx)("div",{"aria-label":n("general:open"),className:`${mi}__open-icon`,title:n("general:open"),children:(0,p.jsx)(mr,{})}),i&&(0,p.jsxs)("div",{"aria-label":n("collapse"===r?"general:collapse":"general:close"),className:`${mi}__close-icon`,title:n("collapse"===r?"general:collapse":"general:close"),children:["x"===r&&(0,p.jsx)(ml,{}),"collapse"===r&&(0,p.jsx)(to,{direction:"left"})]})]}),t[0]=r,t[1]=i,t[2]=n,t[3]=o):o=t[3],o},ms="localizer-button",mc=e=>{let t=(0,g.c)(8),{ariaLabel:n,className:a}=e,l=aN(),{i18n:r,t:i}=(0,d.d)(),o;if(t[0]!==n||t[1]!==a||t[2]!==r||t[3]!==l||t[4]!==i){let e;t[6]!==a?(e=[ms,a].filter(Boolean),t[6]=a,t[7]=e):e=t[7],o=(0,p.jsxs)("div",{"aria-label":n||i("general:locale"),className:e.join(" "),"data-locale":l?l.code:void 0,children:[(0,p.jsxs)("div",{className:`${ms}__label`,children:[`${i("general:locale")}:`,"\xa0"]}),(0,p.jsxs)("div",{className:`${ms}__current`,children:[(0,p.jsx)("span",{className:`${ms}__current-label`,children:`${(0,h.s)(l.label,r)}`}),(0,p.jsx)(to,{className:`${ms}__chevron`})]})]}),t[0]=n,t[1]=a,t[2]=r,t[3]=l,t[4]=i,t[5]=o}else o=t[5];return o},md="localizer",mu=e=>{let t=(0,g.c)(17),{className:n}=e,{config:a}=(0,c.c)(),{localization:l}=a,r=(0,m.useRouter)(),{startRouteTransition:i}=te(),{setLocaleIsLoading:s}=a$(),{i18n:u}=(0,d.d)(),f=aN();if(l){let{locales:e}=l,a;t[0]!==n?(a=[md,n].filter(Boolean),t[0]=n,t[1]=a):a=t[1];let c=a.join(" "),d;if(t[2]!==u||t[3]!==f||t[4]!==e||t[5]!==r||t[6]!==s||t[7]!==i||t[8]!==c){let n;t[10]!==u||t[11]!==f||t[12]!==e||t[13]!==r||t[14]!==s||t[15]!==i?(n=t=>{let{close:n}=t;return(0,p.jsx)(tp.ButtonGroup,{children:e.map(e=>{let t=(0,h.s)(e.label,u);return(0,p.jsx)(tp.Button,{active:f.code===e.code,disabled:f.code===e.code,onClick:()=>{s(!0),n();let t=new URLSearchParams(window.location.search),a=x.A({...N.q(t.toString(),{depth:10,ignoreQueryPrefix:!0}),locale:e.code},{addQueryPrefix:!0});i(()=>{r.push(a)})},children:t!==e.code?(0,p.jsxs)(o.Fragment,{children:[t,"\xa0",(0,p.jsx)("span",{className:`${md}__locale-code`,"data-locale":e.code,children:`(${e.code})`})]}):(0,p.jsx)("span",{className:`${md}__locale-code`,"data-locale":e.code,children:t})},e.code)})})},t[10]=u,t[11]=f,t[12]=e,t[13]=r,t[14]=s,t[15]=i,t[16]=n):n=t[16],d=(0,p.jsx)("div",{className:c,children:(0,p.jsx)(tC,{button:(0,p.jsx)(mc,{}),horizontalAlign:"right",render:n,showScrollbar:!0,size:"large"})}),t[2]=u,t[3]=f,t[4]=e,t[5]=r,t[6]=s,t[7]=i,t[8]=c,t[9]=d}else d=t[9];return d}return null},mp=o.createContext({hydrated:!1,navOpen:!0,navRef:null,setNavOpen:()=>{},shouldAnimate:!1}),mh=()=>o.use(mp),mf=async e=>{let t=(await e(J.x.NAV))?.open;return"boolean"!=typeof t||t},mm=({children:e,initialIsOpen:t})=>{let{breakpoints:{l:n,m:a,s:l}}=hi(),r=(0,m.usePathname)(),{getPreference:i}=lS(),s=(0,o.useRef)(null),[c,d]=o.useState(t),[u,h]=o.useState(!1),[f,g]=o.useState(!1);return(0,o.useEffect)(()=>{!1===n&&(async()=>{d(await mf(i))})()},[n,i,d]),(0,o.useEffect)(()=>{!0===l&&d(!1)},[r]),(0,o.useEffect)(()=>{s.current&&(c&&a?s.current.style.overscrollBehavior="contain":s.current.style.overscrollBehavior="auto")},[c,a]),(0,o.useEffect)(()=>{(!0===n||!0===a||!0===l)&&d(!1),g(!0);let e=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(e)}},[n,a,l]),(0,o.useEffect)(()=>()=>{s.current&&(s.current.style.overscrollBehavior="auto")},[]),(0,p.jsx)(mp,{value:{hydrated:f,navOpen:c,navRef:s,setNavOpen:d,shouldAnimate:u},children:e})},mg="nav-toggler",mb=e=>{let t,n=(0,g.c)(15),{id:a,children:l,className:r,tabIndex:i}=e,o=void 0===i?0:i,{t:s}=(0,d.d)(),{setPreference:c}=lS(),{navOpen:u,setNavOpen:h}=mh(),{breakpoints:f}=hi(),{l:m}=f,b=`${s(u?"general:close":"general:open")} ${s("general:menu")}`,v=u&&`${mg}--is-open`,y;
42n[0]!==r||n[1]!==v?(y=[mg,v,r].filter(Boolean),n[0]=r,n[1]=v,n[2]=y):y=n[2];let x=y.join(" "),w;return n[3]!==m||n[4]!==u||n[5]!==h||n[6]!==c?(w=async()=>{h(!u),m||await c(J.x.NAV,{open:!u},!0)},n[3]=m,n[4]=u,n[5]=h,n[6]=c,n[7]=w):w=n[7],n[8]!==l||n[9]!==a||n[10]!==b||n[11]!==x||n[12]!==w||n[13]!==o?(t=(0,p.jsx)("button",{"aria-label":b,className:x,id:a,onClick:w,tabIndex:o,type:"button",children:l}),n[8]=l,n[9]=a,n[10]=b,n[11]=x,n[12]=w,n[13]=o,n[14]=t):t=n[14],t},mv=({fill:e})=>{let t=e||"var(--theme-elevation-1000)";return(0,p.jsxs)("svg",{className:"graphic-icon",height:"100%",viewBox:"0 0 25 25",width:"100%",xmlns:"http://www.w3.org/2000/svg",children:[(0,p.jsx)("path",{d:"M11.8673 21.2336L4.40922 16.9845C4.31871 16.9309 4.25837 16.8355 4.25837 16.7282V10.1609C4.25837 10.0477 4.38508 9.97616 4.48162 10.0298L13.1404 14.9642C13.2611 15.0358 13.412 14.9464 13.412 14.8093V11.6091C13.412 11.4839 13.3456 11.3647 13.2309 11.2992L2.81624 5.36353C2.72573 5.30989 2.60505 5.30989 2.51454 5.36353L1.15085 6.14422C1.06034 6.19786 1 6.29321 1 6.40048V18.5995C1 18.7068 1.06034 18.8021 1.15085 18.8558L11.8491 24.9583C11.9397 25.0119 12.0603 25.0119 12.1509 24.9583L21.1355 19.8331C21.2562 19.7616 21.2562 19.5948 21.1355 19.5232L18.3357 17.9261C18.2211 17.8605 18.0883 17.8605 17.9737 17.9261L12.175 21.2336C12.0845 21.2872 11.9638 21.2872 11.8733 21.2336H11.8673Z",fill:t}),(0,p.jsx)("path",{d:"M22.8491 6.13827L12.1508 0.0417218C12.0603 -0.0119135 11.9397 -0.0119135 11.8491 0.0417218L6.19528 3.2658C6.0746 3.33731 6.0746 3.50418 6.19528 3.57569L8.97092 5.16091C9.08557 5.22647 9.21832 5.22647 9.33296 5.16091L11.8672 3.71872C11.9578 3.66508 12.0784 3.66508 12.1689 3.71872L19.627 7.96782C19.7175 8.02146 19.7778 8.11681 19.7778 8.22408V14.8212C19.7778 14.9464 19.8442 15.0656 19.9589 15.1311L22.7345 16.7104C22.8552 16.7819 23.006 16.6925 23.006 16.5554V6.40048C23.006 6.29321 22.9457 6.19786 22.8552 6.14423L22.8491 6.13827Z",fill:t})]})},my=()=>(0,o.use)(mx),mx=(0,o.createContext)({setStepNav:()=>{},stepNav:[]}),mw=e=>{let t=(0,g.c)(4),{children:n}=e,a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];let[l,r]=(0,o.useState)(a),i;return t[1]!==n||t[2]!==l?(i=(0,p.jsx)(mx,{value:{setStepNav:r,stepNav:l},children:n}),t[1]=n,t[2]=l,t[3]=i):i=t[3],i},mj=e=>{let t=(0,g.c)(4),{nav:n}=e,{setStepNav:a}=my(),l,r;return t[0]!==n||t[1]!==a?(l=()=>{a(n)},r=[a,n],t[0]=n,t[1]=a,t[2]=l,t[3]=r):(l=t[2],r=t[3]),(0,o.useEffect)(l,r),null},mC="step-nav",mS=e=>{let t=(0,g.c)(7),{className:n,CustomIcon:a}=e,{i18n:l}=(0,d.d)(),{stepNav:r}=my(),{config:i}=(0,c.c)(),{routes:s}=i,{admin:u}=s,{t:f}=(0,d.d)(),m;return t[0]!==a||t[1]!==u||t[2]!==n||t[3]!==l||t[4]!==r||t[5]!==f?(m=(0,p.jsx)(o.Fragment,{children:r.length>0?(0,p.jsxs)("nav",{className:[mC,n].filter(Boolean).join(" "),children:[(0,p.jsx)(tl,{className:`${mC}__home`,href:u,prefetch:!1,tabIndex:0,children:(0,p.jsx)("span",{title:f("general:dashboard"),children:(0,p.jsx)(em,{CustomComponent:a,Fallback:(0,p.jsx)(mv,{})})})}),(0,p.jsx)("span",{children:"/"}),r.map((e,t)=>{let n=(0,h.s)(e.label,l);return r.length===t+1?(0,p.jsx)("span",{className:`${mC}__last`,children:n},t):(0,p.jsxs)(o.Fragment,{children:[e.url?(0,p.jsx)(tl,{href:e.url,prefetch:!1,children:(0,p.jsx)("span",{children:n},t)}):(0,p.jsx)("span",{children:n},t),(0,p.jsx)("span",{children:"/"})]},t)})]}):(0,p.jsx)("div",{className:[mC,n].filter(Boolean).join(" "),children:(0,p.jsx)("div",{className:`${mC}__home`,children:(0,p.jsx)("span",{title:f("general:dashboard"),children:(0,p.jsx)(em,{CustomComponent:a,Fallback:(0,p.jsx)(mv,{})})})})})}),t[0]=a,t[1]=u,t[2]=n,t[3]=l,t[4]=r,t[5]=f,t[6]=m):m=t[6],m},mk="app-header";function m_({CustomAvatar:e,CustomIcon:t}){let{t:n}=(0,d.d)(),{Actions:a}=mn(),{config:{admin:{routes:{account:l}},localization:r,routes:{admin:i},serverURL:s}}=(0,c.c)(),{navOpen:u}=mh(),h=(0,o.useRef)(null),[f,m]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e=()=>{let e=h.current;e&&m(e.scrollWidth>e.clientWidth)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[a]);let g=a?Object.values(a):[];return(0,p.jsxs)("header",{className:[mk,u&&`${mk}
42--nav-open`].filter(Boolean).join(" "),children:[(0,p.jsx)("div",{className:`${mk}__bg`}),(0,p.jsx)("div",{className:`${mk}__content`,children:(0,p.jsxs)("div",{className:`${mk}__wrapper`,children:[(0,p.jsx)(mb,{className:`${mk}__mobile-nav-toggler`,tabIndex:-1,children:(0,p.jsx)(mo,{})}),(0,p.jsxs)("div",{className:`${mk}__controls-wrapper`,children:[(0,p.jsx)("div",{className:`${mk}__step-nav-wrapper`,children:(0,p.jsx)(mS,{className:`${mk}__step-nav`,CustomIcon:t})}),(0,p.jsxs)("div",{className:`${mk}__actions-wrapper`,children:[(0,p.jsx)("div",{className:`${mk}__actions`,ref:h,children:g.map((e,t)=>(0,p.jsx)("div",{className:f&&t===g.length-1?`${mk}__last-action`:"",children:e},t))}),f&&(0,p.jsx)("div",{className:`${mk}__gradient-placeholder`})]}),r&&(0,p.jsx)(mc,{ariaLabel:"invisible",className:`${mk}__localizer-spacing`}),(0,p.jsx)(tl,{"aria-label":n("authentication:account"),className:`${mk}__account`,href:(0,y.Q)({adminRoute:i,path:l}),prefetch:!1,tabIndex:0,children:(0,p.jsx)(em,{CustomComponent:e,Fallback:(0,p.jsx)(me,{})})})]})]})}),(0,p.jsx)(mu,{className:`${mk}__localizer`})]})}var m$="card",mN=e=>{let{id:t,actions:n,buttonAriaLabel:a,href:l,onClick:r,title:i,titleAs:o}=e,s=[m$,t,(r||l)&&`${m$}--has-onclick`].filter(Boolean).join(" ");return(0,p.jsxs)("div",{className:s,id:t,children:[(0,p.jsx)(o??"div",{className:`${m$}__title`,children:i}),n&&(0,p.jsx)("div",{className:`${m$}__actions`,children:n}),(r||l)&&(0,p.jsx)(tN,{"aria-label":a,buttonStyle:"none",className:`${m$}__click`,el:"link",onClick:r,to:l})]})},mP="copy-locale-data",mE="copy-locale",mD=()=>{let e,t,n,a,l,r,i,s=(0,g.c)(36),{config:u}=(0,c.c)(),{localization:f,routes:b}=u,{admin:v}=b,{code:x}=aN(),{id:w,collectionSlug:j,globalSlug:C}=lE(),{i18n:S,t:k}=(0,d.d)(),_=eM(),{toggleModal:$}=nN(),{copyDataFromLocale:N}=cf(),P=(0,m.useRouter)(),{startRouteTransition:E}=te(),D=f&&f.locales.map(mT)||[],T;s[0]!==x?(T=e=>e.value!==x,s[0]=x,s[1]=T):T=s[1];let A=D.filter(T),R;s[2]!==S||s[3]!==f?(R=e=>{let t=f&&f.locales.find(t=>t.code===e);return t&&t.label?(0,h.s)(t.label,S):e},s[2]=S,s[3]=f,s[4]=R):R=s[4];
42let L=R,[F,O]=o.useState(!1),[M,I]=o.useState(null),[B,z]=o.useState(x),[U,V]=o.useState(!1),H,q;s[5]!==x||s[6]!==B?(H=()=>{B!==x&&z(x)},q=[x,B],s[5]=x,s[6]=B,s[7]=H,s[8]=q):(H=s[7],q=s[8]),o.useEffect(H,q),s[9]!==v||s[10]!==j||s[11]!==N||s[12]!==C||s[13]!==w||s[14]!==U||s[15]!==P||s[16]!==E||s[17]!==k||s[18]!==$?(e=async e=>{let{from:t,to:n}=e;O(!0);try{await N({collectionSlug:j,docID:w,fromLocale:t,globalSlug:C,overrideData:U,toLocale:n}),O(!1),E(()=>P.push((0,y.Q)({adminRoute:v,path:`/${j?`collections/${j}/${w}`:`globals/${C}`}`})+`?locale=${n}`)),$(mE)}catch(n){O(!1);let e=n.message||"error:unknown",t=e.startsWith("error:")?k(e):e;e3.error(t)}},s[9]=v,s[10]=j,s[11]=N,s[12]=C,s[13]=w,s[14]=U,s[15]=P,s[16]=E,s[17]=k,s[18]=$,s[19]=e):e=s[19];let W=e;return w||C?(s[20]!==_||s[21]!==k||s[22]!==$?(t=()=>{_?e3.info(k("general:unsavedChanges")):$(mE)},s[20]=_,s[21]=k,s[22]=$,s[23]=t):t=s[23],s[24]!==$?(n=()=>{$(mE)},s[24]=$,s[25]=n):n=s[25],s[26]!==W||s[27]!==F||s[28]!==B||s[29]!==k||s[30]!==M?(a=async()=>{B===M?e3.error(k("localization:cannotCopySameLocale")):F||await W({from:B,to:M})},s[26]=W,s[27]=F,s[28]=B,s[29]=k,s[30]=M,s[31]=a):a=s[31],s[32]===Symbol.for("react.memo_cache_sentinel")?(l=e=>{e?.value&&z(e.value)},s[32]=l):l=s[32],s[33]===Symbol.for("react.memo_cache_sentinel")?(r=e=>{e?.value&&I(e.value)},s[33]=r):r=s[33],s[34]!==U?(i=()=>V(!U),s[34]=U,s[35]=i):i=s[35],(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(tp.Button,{id:`${mP}__button`,onClick:t,children:k("localization:copyToLocale")}),(0,p.jsxs)(au,{className:mP,gutter:!1,Header:(0,p.jsx)(uF,{onClose:n,title:k("localization:copyToLocale")}),slug:mE,children:[(0,p.jsxs)("div",{className:`${mP}__sub-header`,children:[(0,p.jsx)("span",{children:B&&M?(0,p.jsx)("div",{children:k("localization:copyFromTo",{from:L(B),to:L(M)})}):k("localization:selectLocaleToCopy")}),(0,p.jsx)(tN,{buttonStyle:"primary",disabled:!B||!M,iconPosition:"left",onClick:a,size:"medium",children:F?k("general:copying")+"...":k("general:copy")})]}),(0,p.jsxs)("div",{className:`${mP}__content`,children:[(0,p.jsx)(ue,{label:k("localization:copyFrom"),name:"fromLocale",onChange:l,options:D,path:"fromLocale",readOnly:!0,value:B}),(0,p.jsx)(ue,{label:k("localization:copyTo"),name:"toLocale",onChange:r,options:A,path:"toLocale",value:M}),(0,p.jsx)(lX,{checked:U,field:{name:"overwriteExisting",label:k("general:overwriteExistingData")},onChange:i,path:"overwriteExisting"})]})]})]})):null};function mT(e){return{label:e.label,value:e.code}}var mA=((i={}).AllAvailable="allAvailable",i.AllInPage="allInPage",i.None="none",i.Some="some",i),mR=(0,o.createContext)({count:void 0,getQueryParams:e=>"",getSelectedIds:()=>[],selectAll:void 0,selected:new Map,selectedIDs:[],setSelection:e=>{},toggleAll:e=>{},totalDocs:void 0}),mL=e=>{let t=[];for(let[n,a]of e)a&&t.push(n);return t},mF=({children:e,docs:t=[],totalDocs:n})=>{let a=(0,o.useRef)({}),{user:l}=aj(),{code:r}=aN(),[i,s]=(0,o.useState)(()=>{let e=new Map;return t.forEach(({id:t})=>{e.set(t,!1)}),e}),[c,d]=(0,o.useState)("none"),[u,h]=(0,o.useState)(0),f=(0,m.useSearchParams)(),{query:g}=cc(),b=(0,o.useCallback)((e=!1)=>{let n=new Map;if(e)d("allAvailable"),t.forEach(({id:e,_isLocked:t,_userEditing:a})=>{t&&a?.id!==l?.id||n.set(e,!0)});else if("allAvailable"===c||"allInPage"===c)d("none");else{let e="some"!==c;t.forEach(({id:t,_isLocked:a,_userEditing:r})=>{a&&r?.id!==l?.id||n.set(t,e)}),e&&n.size>0?n.size===t.length?d("allInPage"):d("some"):d("none")}s(n)},[t,c,l?.id]),v=(0,o.useCallback)(e=>{let n=t.find(t=>t.id===e);if(n?._isLocked&&l?.id!==n?._userEditing.id)return;let a=i.get(e),r="boolean"!=typeof a||!a,o=new Map(i.set(e,r));"allAvailable"!==c||r||d("some"),s(o)},[i,t,c,l?.id]),y=(0,o.useCallback)(e=>{let t;if("allAvailable"===c)t=co(f)?.where||{id:{not_equals:""}};else{let e=[];for(let[t,n]of i)n&&e.push(t);t={id:{in:e}}}return e&&(t={and:[{...e},t]}),x.A({locale:r,where:t},{addQueryPrefix:!0})},[c,i,r,f]),w=(0,o.useCallback)(()=>mL(i),[i]);(0,o.useEffect)(()=>{if("allAvailable"===c)return;let e=!1,n=!0;if(i.size)for(let[t,a]of i)n=n&&a,e=e||a;else n=!1,e=!1;n&&i.size===t.length?d("allInPage"):d(e?"some":"none")},[c,i,n,t]),(0,o.useEffect)(()=>{let e=0;if("allAvailable"===c)e=n;else for(let[t,n]of i)n&&e++;h(e)},[c,i,n]),(0,o.useEffect)(()=>{d("none"),s(new Map)},[g]);let j=(0,o.useMemo)(()=>mL(i),[i]);return a.current={count:u,getQueryParams:y,getSelectedIds:w,selectAll:c,selected:i,selectedIDs:j,setSelection:v,toggleAll:b,totalDocs:n},(0,p.jsx)(mR,{value:a.current,children:e})},mO=()=>(0,o.use)(mR),mM="list-selection";function mI(e){let t=(0,g.c)(5),{count:n,ListActions:a,SelectionActions:l}=e,{t:r}=(0,d.d)(),i;return t[0]!==a||t[1]!==l||t[2]!==n||t[3]!==r?(i=(0,p.jsxs)("div",{className:mM,children:[(0,p.jsx)("span",{children:r("general:selectedCount",{count:n,label:""})}),a&&a.length>0&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)("span",{children:"—"}),(0,p.jsx)("div",{className:`${mM}__actions`,children:a})]}),l&&l.length>0&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)("span",{children:"—"}),(0,p.jsx)("div",{className:`${mM}__actions`,children:l})]})]}),t[0]=a,t[1]=l,t[2]=n,t[3]=r,t[4]=i):i=t[4],i}function mB({children:e,className:t,...n}){return(0,p.jsx)(tN,{...n,buttonStyle:"none",className:[`${mM}
42__button`,t].filter(Boolean).join(" "),children:e})}var mz=e=>{let t=(0,g.c)(6),{viewType:n}=e,{collection:a,hasDeletePermission:l,hasTrashPermission:r,modalPrefix:i}=e,{slug:s,trash:c}=void 0===a?{}:a,{permissions:d}=aj(),{count:u,selectAll:h,selectedIDs:f,toggleAll:b}=mO(),v=(0,m.useRouter)(),y=(0,m.useSearchParams)(),{clearRouteCache:w}=pr(),j=d?.collections?.[s],C=void 0!==l?l:!!j?.delete,S=void 0!==r?r:C,k=h===mA.AllAvailable,_=k?[]:f,$="trash"===n?C:C||S;if(h===mA.None||!$)return null;let N=co(y)?.where,P="trash"===n?{and:[...Array.isArray(N?.and)?N.and:N?[N]:[],{deletedAt:{exists:!0}}]}:N,E;return t[0]!==w||t[1]!==v||t[2]!==y||t[3]!==h||t[4]!==b?(E=()=>{b(),v.replace(x.A({...co(y),page:h?"1":void 0},{addQueryPrefix:!0})),w()},t[0]=w,t[1]=v,t[2]=y,t[3]=h,t[4]=b,t[5]=E):E=t[5],(0,p.jsx)(o.Fragment,{children:(0,p.jsx)(mU,{afterDelete:E,hasDeletePermission:C,hasTrashPermission:S,modalPrefix:i,search:co(y)?.search,selections:{[s]:{all:h===mA.AllAvailable,ids:_,totalCount:k?u:_.length}},trash:c,viewType:n,where:P})})};function mU({afterDelete:e,hasDeletePermission:t=!1,hasTrashPermission:n=!1,modalPrefix:a,search:l,selections:r,trash:i,viewType:s,where:u}){let{t:f}=(0,d.d)(),{config:{collections:m,routes:{api:g}}}=(0,c.c)(),{code:b}=aN(),{i18n:v}=(0,d.d)(),{openModal:w}=nN(),[j,C]=o.useState(!1),S=`${a?`${a}-`:""}confirm-delete-many-docs`,k=o.useCallback(async()=>{let a=1===Object.keys(r).length,i={};for(let[e,{all:o,ids:c=[]}]of Object.entries(r)){let r=m.find(({slug:t})=>t===e);if(r){let d;d=o?a&&u?"trash"===s?{and:[...Array.isArray(u.and)?u.and:[u],{deletedAt:{exists:!0}}]}:u:"trash"===s?{and:[{id:{not_equals:""}},{deletedAt:{exists:!0}}]}:{id:{not_equals:""}}:{and:[{id:{in:c}},..."trash"===s?[{deletedAt:{exists:!0}}]:[]]};let p=(0,y.Q)({apiRoute:g,path:`/${e}${x.A({limit:0,locale:b,select:{},where:(0,_.d)({collectionConfig:r,search:l,where:d}),..."trash"===s?{trash:!0}:{}},{addQueryPrefix:!0})}`}),m=function({deletePermanently:e,hasDeletePermission:t,hasTrashPermission:n,isTrashView:a=!1}){return a||!n||t&&e}({deletePermanently:j,hasDeletePermission:t,hasTrashPermission:!!r.trash&&n,isTrashView:"trash"===s}),w=m?await ay.delete(p,{headers:{"Accept-Language":v.language,"Content-Type":"application/json"}}):await ay.patch(p,{body:JSON.stringify({deletedAt:new Date().toISOString()}),headers:{"Accept-Language":v.language,"Content-Type":"application/json"}});try{let{plural:n,singular:a}=r.labels,l=await w.json(),o=l?.docs.length||0,c=o>1?n:a;if(w.status<400||o>0){let e;e=m?"trash"===s||t&&j?"general:permanentlyDeletedCountSuccessfully":"general:deletedCountSuccessfully":"general:trashedCountSuccessfully",e3.success(f(e,{count:o,label:(0,h.s)(c,v)}))}l?.errors.length>0&&e3.error(l.message,{description:l.errors.map(e=>e.message).join(`
43`)}),i[e]={deletedCount:o,errors:l?.errors||null,ids:l?.docs.map(e=>e.id)||[],totalCount:l.totalDocs},w.status>400&&l?.errors.length===0&&(e3.error(f("error:unknown")),i[e].errors=[f("error:unknown")]);continue}catch(t){e3.error(f("error:unknown")),i[e]={deletedCount:0,errors:[t],ids:[],totalCount:0};continue}}}"function"==typeof e&&e(i)},[r,e,m,j,t,n,b,l,g,v,s,u,f]),{label:$,labelCount:N}=Object.entries(r).reduce((e,[t,n],a,l)=>{let r=m.find(({slug:e})=>e===t);if(r){let t=void 0===e.labelCount?n.totalCount:e.labelCount,i=`${void 0!==e.labelCount?`${n.totalCount} `:""}${(0,h.s)(n.totalCount>1?r.labels.plural:r.labels.singular,v)}`;return{label:a===l.length-1&&0!==a?`${e.label} and ${i}`:a>0?`${e.label}, ${i}`:i,labelCount:t}}return e},{label:"",labelCount:void 0});return(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(mB,{"aria-label":f("general:delete"),className:"delete-documents__toggle",onClick:()=>{w(S)},children:f("general:delete")}),(0,p.jsx)(ag,{body:(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)("p",{children:i&&n?"trash"===s?(0,p.jsx)(pu,{elements:{0:({children:e})=>(0,p.jsx)("strong",{children:e}),1:({children:e})=>(0,p.jsx)("strong",{children:e})},i18nKey:"general:aboutToPermanentlyDeleteTrash",t:f,variables:{count:N??0,label:$}}):f("general:aboutToTrashCount",{count:N,label:$}):f("general:aboutToDeleteCount",{count:N,label:$})}),i&&n&&t&&"trash"!==s&&(0,p.jsx)("div",{className:"delete-documents__checkbox",children:(0,p.jsx)(lY,{checked:j,id:"delete-forever",label:f("general:deletePermanently"),name:"delete-forever",onToggle:e=>C(e.target.checked)})})]}),confirmingLabel:f("general:deleting"),heading:f("general:confirmDeletion"),modalSlug:S,onConfirm:k})]})}var mV=(0,o.createContext)({appIsReady:!1,breakpoint:void 0,breakpoints:void 0,iframeRef:void 0,isLivePreviewEnabled:void 0,isLivePreviewing:!1,isPopupOpen:!1,isPreviewEnabled:void 0,measuredDeviceSize:{height:0,width:0},openPopupWindow:()=>{},popupRef:void 0,previewURL:void 0,previewWindowType:"iframe",setAppIsReady:()=>{},setBreakpoint:()=>{},setHeight:()=>{},setIsLivePreviewing:()=>{},setLoadedURL:()=>{},setMeasuredDeviceSize:()=>{},setPreviewURL:()=>{},setPreviewWindowType:()=>{},setSize:()=>{},setToolbarPosition:()=>{},setURL:()=>{},setWidth:()=>{},setZoom:()=>{},shouldRenderIframe:void 0,size:{height:0,width:0},toolbarPosition:{x:0,y:0},typeofLivePreviewURL:void 0,url:void 0,zoom:1}),mH=()=>(0,o.use)(mV),mq=()=>{let{isPreviewEnabled:e,previewURL:t,setPreviewURL:n}=(0,o.use)(mV);return{isPreviewEnabled:e,previewURL:t,setPreviewURL:n}},mW=({id:e,collection:t,global:n})=>{let{config:{routes:{api:a}}}=(0,c.c)(),{docConfig:l,lastUpdateTime:r,mostRecentVersionIsAutosaved:i,setMostRecentVersionIsAutosaved:s,setUnpublishedVersionCount:u}
43=lE(),{isValid:h,setBackgroundProcessing:f,submit:m}=eT(),[g]=ez(),b=eM(),v=eL(),{code:w}=aN(),{i18n:C,t:S}=(0,d.d)(),k=(0,L.ag)(l),_=(0,L.wA)(l),[$,N]=(0,o.useState)(!1),P=(0,o.useDeferredValue)($),E=cW(g,k),{queueTask:D}=dB(),T=(0,o.useRef)(null),A=tv(()=>{let l,r;T.current=void 0,D(async()=>{if(b){let o;l=new Date().getTime(),N(!0);let c,d,p,h=x.A({autosave:!0,depth:0,draft:!0,"fallback-locale":"null",locale:w},{addQueryPrefix:!0});t&&e&&(p=t.slug,c=(0,y.Q)({apiRoute:a,path:`/${p}/${e}${h}`}),d="PATCH"),n&&(p=n.slug,c=(0,y.Q)({apiRoute:a,path:`/globals/${p}${h}`}),d="POST");let{valid:f}=(o={data:{},valid:!0},g&&(Object.keys(g).forEach(e=>{!g[e]?.disableFormData&&(o.data[e]=g[e]?.value,g[e].valid||(o.valid=!1))}),o.data=(0,H.s)(o.data)),o);if(!(v&&!f&&_)&&b&&c){let e=await m({acceptValues:{overrideLocalChanges:!1},action:c,context:{getDocPermissions:!1,incrementVersionCount:!i},disableFormWhileProcessing:!1,disableSuccessStatus:!0,method:d,overrides:{_status:"draft"},skipValidation:!_});e&&e?.res?.ok&&!i&&(s(!0),u(e=>e+1)),(r=new Date().getTime())-l<1e3?T.current=setTimeout(()=>{N(!1)},1e3-(r-l)):O()}}},{afterProcess:()=>{f(!1)},beforeProcess:()=>{f(!0)}})}),R=(0,o.useRef)(!1),F=(0,o.useRef)((0,M.r)(E));(0,o.useEffect)(()=>{if(!R.current){R.current=!0;return}let{updatedAt:e,...t}=(0,M.r)(E),{updatedAt:n,...a}=F.current;(0,j.j)(t,a)||(F.current=t,A())},[E]),(0,o.useEffect)(()=>()=>{O()},[]);let O=tv(()=>{T.current&&clearTimeout(T.current),N(!1)});return(0,p.jsxs)("div",{className:"autosave",children:[_&&!h&&(0,p.jsx)(fX,{}),P&&S("general:saving"),!P&&!!r&&(0,p.jsx)(o.Fragment,{children:S("version:lastSavedAgo",{distance:lf({date:r,i18n:C})})})]})},mK="delete-document",mQ=e=>{let{id:t,buttonId:n,collectionSlug:a,onDelete:l,redirectAfterDelete:r=!0,singularLabel:i,title:s}=e,{config:{routes:{admin:u,api:f}},getEntityConfig:g}=(0,c.c)(),b=g({collectionSlug:a}),{hasDeletePermission:v,hasTrashPermission:x}=lE(),{setModified:w}=eT(),j=(0,m.useRouter)(),{i18n:C,t:S}=(0,d.d)(),{title:k}=ly(),{startRouteTransition:_}=te(),{openModal:$}=nN(),N=`delete-${t}`,[P,E]=(0,o.useState)(!1),D=(0,o.useCallback)(()=>{e3.error(S("error:deletingTitle",{title:k}))},[S,k]),T=(0,o.useCallback)(async()=>{w(!1);let e=function({deletePermanently:e,hasDeletePermission:t,hasTrashPermission:n,isTrashView:a=!1}){return a||!n||t&&e}({deletePermanently:P,hasDeletePermission:v,hasTrashPermission:x});try{let n=(0,y.Q)({apiRoute:f,path:`/${a}/${t}`}),o=e?await ay.delete(n,{headers:{"Accept-Language":C.language,"Content-Type":"application/json"}}):await ay.patch(n,{body:JSON.stringify({deletedAt:new Date().toISOString()}),headers:{"Accept-Language":C.language,"Content-Type":"application/json"}}),s=await o.json();if(o.status<400){if(e3.success(S(e?"general:titleDeleted":"general:titleTrashed",{label:(0,h.s)(i,C),title:k})||s.message),r)return _(()=>j.push((0,y.Q)({adminRoute:u,path:`/collections/${a}`})));"function"==typeof l&&await l({id:t,collectionConfig:b});return}s.errors?s.errors.forEach(e=>e3.error(e.message)):D();return}catch{return D()}},[P,w,v,x,f,a,t,S,i,D,C,k,j,u,r,l,b,_]);return t?(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(tp.Button,{id:n,onClick:()=>{$(N)},children:S("general:delete")}),(0,p.jsx)(ag,{body:(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(pu,{elements:{1:({children:e})=>(0,p.jsx)("strong",{children:e})},i18nKey:b.trash&&x?"general:aboutToTrash":"general:aboutToDelete",t:S,variables:{label:(0,h.s)(i,C),title:s||k||t}}),b.trash&&x&&v&&(0,p.jsx)("div",{className:`${mK}__checkbox`,children:(0,p.jsx)(lY,{checked:P,id:"delete-forever",label:S("general:deletePermanently"),name:"delete-forever",onToggle:e=>E(e.target.checked)})})]}),className:mK,confirmingLabel:S("general:deleting"),heading:S("general:confirmDeletion"),modalSlug:N,onConfirm:T})]}):null},mY=e=>{for(let t of e){if("localized"in t&&t.localized)return!0;switch(t.type){case"array":case"collapsible":case"group":case"row":if(t.fields&&mY(t.fields))return!0;break;case"blocks":if(t.blocks){for(let e of t.blocks)if(e.fields&&mY(e.fields))return!0}break;case"tabs":if(t.tabs){for(let e of t.tabs)if("localized"in e&&e.localized||"fields"in e&&e.fields&&mY(e.fields))return!0}}}return!1},mG="select-locales-drawer",mX=({slug:e,localization:t,onConfirm:n})=>{let{i18n:a,t:l}=(0,d.d)(),{toggleModal:r}=nN(),[i,s]=(0,o.useState)([]),c=(0,o.useMemo)(()=>(({i18n:e,localization:t})=>t.locales.map(t=>({label:(0,h.s)(t.label,e),value:t.code})))({i18n:a,localization:t}),[t,a]),u=(0,o.useMemo)(()=>c.map(e=>e.value),[c]),f=(0,o.useMemo)(()=>(0,Y._)(new Set(i),new Set(u)),[i,u]),m=(0,o.useCallback)(()=>{s(f?[]:[...u])},[f,u]),g=(0,o.useCallback)(e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),b=(0,o.useCallback)(async()=>{await n({selectedLocales:i}),r(e)},[n,i,e,r]);return(0,p.jsxs)(au,{className:mG,gutter:!1,Header:(0,p.jsx)(uF,{onClose:()=>{r(e)},title:`${l("general:duplicate")} ${l("localization:selectedLocales")}`}),slug:e,children:[(0,p.jsxs)("div",{className:`${mG}__sub-header`,children:[(0,p.jsx)("span",{children:l("localization:selectLocaleToDuplicate")}),(0,p.jsx)(tN,{buttonStyle:"primary",disabled:0===i.length,iconPosition:"left",id:"#action-duplicate-confirm",onClick:b,size:"medium",children:l("general:duplicate")})]}),(0,p.jsxs)("div",{className:`${mG}__content`,children:[(0,p.jsx)("div",{className:`${mG}__item`,children:(0,p.jsx)(lY,{checked:f,id:"select-locale-all",label:l("general:selectAll",{count:u.length,label:l("general:locales")}),onToggle:m})}),c.map(e=>(0,p.jsx)("div",{className:`${mG}__item`,children:(0,p.jsx)(lY,{checked:i.includes(e.value),id:`select-locale-${e.value}`,label:e.label,onToggle:()=>g(e.value)})},e.value))]})]})},mZ=({id:e,slug:t,onDuplicate:n,redirectAfterDuplicate:a=!0,selectLocales:l,singularLabel:r})=>{let i=(0,m.useRouter)(),s=eM(),{openModal:u}=nN(),{code:f}=aN(),{setModified:g}=eT(),{startRouteTransition:b}=te(),{config:{localization:v,routes:{admin:w,api:j}},getEntityConfig:C}=(0,c.c)(),S=C({collectionSlug:t}),{i18n:k,t:_}=(0,d.d)(),$=`duplicate-${e}`,N=`duplicate-locales-${e}`,P=(0,o.useMemo)(()=>!!l&&!!S&&mY(S.fields),[S,l]),E=(0,o.useCallback)(async l=>{let{selectedLocales:o}=l||{},s=o&&o.length>0,c={};f&&(c.locale=f),s&&(c.selectedLocales=o);let d={"Accept-Language":k.language,"Content-Type":"application/json",credentials:"include"};try{let l=await ay.post((0,y.Q)({apiRoute:j,path:`/${t}/${e}/duplicate${x.A(c,{addQueryPrefix:!0})}`}),{body:JSON.stringify((0,L.gD)(S)?{_status:"draft"}:{}),headers:d}),{doc:o,errors:s,message:u}=await l.json();if(l.status<400){if(e3.success(u||_("general:successfullyDuplicated",{label:(0,h.s)(r,k)})),g(!1),a)return b(()=>i.push((0,y.Q)({adminRoute:w,path:`/collections/${t}/${o.id}${f?`?locale=${f}`:""}`})));"function"==typeof n&&n({collectionConfig:S,doc:o})}else e3.error(s?.[0].message||u||_("error:unspecific",{label:(0,h.s)(r,k)}))}catch{e3.error(_("error:unspecific",{label:(0,h.s)(r,k)}))}},[w,j,S,k,e,f,n,a,i,g,r,t,b,_]),D=(0,o.useCallback)(async()=>{l?u(N):await E()},[E,N,l,u]),T=l?`${_("general:duplicate")} ${_("localization:selectedLocales")}`:_("general:duplicate");return!l||P?(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(tp.Button,{id:`action-duplicate${P?"-locales":""}`,onClick:()=>{s?u($):l?u(N):E()},children:T}),(0,p.jsx)(ag,{body:_("general:unsavedChangesDuplicate"),confirmLabel:_("general:duplicateWithoutSaving"),heading:_("general:unsavedChanges"),modalSlug:$,onConfirm:D}),l&&v&&(0,p.jsx)(mX,{localization:v,onConfirm:E,slug:N})]}):null},mJ=({active:e=!0,className:t})=>
43(0,p.jsx)("svg",{className:[t,"icon icon--eye"].filter(Boolean).join(" "),viewBox:"0 0 16 12",xmlns:"http://www.w3.org/2000/svg",children:e?(0,p.jsx)(o.Fragment,{children:(0,p.jsx)("path",{className:"stroke",d:"M2 11.5L4.35141 9.51035M15 0.5L12.6486 2.48965M10.915 6.64887C10.6493 7.64011 9.78959 8.38832 8.7408 8.48855M10.4085 4.38511C9.94992 3.84369 9.2651 3.5 8.5 3.5C7.11929 3.5 6 4.61929 6 6C6 6.61561 6.22251 7.17926 6.59149 7.61489M10.4085 4.38511L6.59149 7.61489M10.4085 4.38511L12.6486 2.48965M6.59149 7.61489L4.35141 9.51035M14.1292 3.92915C15.0431 5.02085 15.5 6 15.5 6C15.5 6 13.1667 11 8.5 11C7.67995 11 6.93195 10.8456 6.256 10.5911M4.35141 9.51035C2.45047 8.03672 1.5 6 1.5 6C1.5 6 3.83333 1 8.5 1C10.1882 1 11.5711 1.65437 12.6486 2.48965"})}):(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)("circle",{className:"stroke",cx:"8.5",cy:"6",r:"2.5"}),(0,p.jsx)("path",{className:"stroke",d:"M8.5 1C3.83333 1 1.5 6 1.5 6C1.5 6 3.83333 11 8.5 11C13.1667 11 15.5 6 15.5 6C15.5 6 13.1667 1 8.5 1Z"})]})}),m0="live-preview-toggler",m1=()=>{let{isLivePreviewing:e,setIsLivePreviewing:t,url:n}=mH(),{t:a}=(0,d.d)();return n?(0,p.jsx)("button",{"aria-label":a(e?"general:exitLivePreview":"general:livePreview"),className:[m0,e&&`${m0}--active`].filter(Boolean).join(" "),id:"live-preview-toggler",onClick:()=>{t(!e)},title:a(e?"general:exitLivePreview":"general:livePreview"),type:"button",children:(0,p.jsx)(mJ,{active:e})}):null},m3=({className:e})=>
43(0,p.jsxs)("svg",{className:["icon icon--lock",e].filter(Boolean).join(" "),fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,p.jsx)("path",{className:"stroke",d:"M7.5 9.5V7.5C7.5 6.83696 7.76339 6.20107 8.23223 5.73223C8.70107 5.26339 9.33696 5 10 5C10.663 5 11.2989 5.26339 11.7678 5.73223C12.2366 6.20107 12.5 6.83696 12.5 7.5V9.5",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:"1"}),(0,p.jsx)("path",{className:"stroke",d:"M13.5 9.5H6.5C5.94772 9.5 5.5 9.94772 5.5 10.5V14C5.5 14.5523 5.94772 15 6.5 15H13.5C14.0523 15 14.5 14.5523 14.5 14V10.5C14.5 9.94772 14.0523 9.5 13.5 9.5Z",stopOpacity:"1",strokeLinecap:"round",strokeLinejoin:"round"})]}),m2="locked",m6=e=>{let t=(0,g.c)(8),{className:n,user:a}=e,[l,r]=(0,o.useState)(!1),{t:i}=(0,d.d)(),s=a&&"object"==typeof a?a.email??a.id:i("general:anotherUser"),c;t[0]!==n?(c=[m2,n].filter(Boolean),t[0]=n,t[1]=c):c=t[1];let u=c.join(" "),h,f;t[2]===Symbol.for("react.memo_cache_sentinel")?(h=()=>r(!0),f=()=>r(!1),t[2]=h,t[3]=f):(h=t[2],f=t[3]);let m=`${s} ${i("general:isEditing")}`,b;return t[4]!==l||t[5]!==u||t[6]!==m?(b=(0,p.jsxs)("div",{className:u,onMouseEnter:h,onMouseLeave:f,role:"button",tabIndex:0,children:[(0,p.jsx)(tk,{alignCaret:"left",className:`${m2}__tooltip`,position:"top",show:l,children:m}),(0,p.jsx)(m3,{})]}),t[4]=l,t[5]=u,t[6]=m,t[7]=b):b=t[7],b},m5=e=>{let{id:t,buttonId:n,collectionSlug:a,onDelete:l,redirectAfterDelete:r=!0,singularLabel:i,title:s}=e,{config:{routes:{admin:u,api:f},serverURL:g},getEntityConfig:b}=(0,c.c)(),v=b({collectionSlug:a}),w=(0,m.useRouter)(),{i18n:j,t:C}=(0,d.d)(),{title:S}=ly(),{startRouteTransition:k}=te(),{openModal:_}=nN(),$=`perma-delete-${t}`,N=(0,o.useCallback)(()=>{e3.error(C("error:deletingTitle",{title:S}))},[C,S]),P=(0,o.useCallback)(async()=>{try{let e=(0,y.Q)({apiRoute:f,path:`/${a}${x.A({trash:!0,where:{and:[{id:{equals:t}},{deletedAt:{exists:!0}}]}},{addQueryPrefix:!0})}`}),n=await ay.delete(e,{headers:{"Accept-Language":j.language,"Content-Type":"application/json"}}),o=await n.json();if(n.status<400){if(e3.success(C("general:titleDeleted",{label:(0,h.s)(i,j),title:S})||o.message),r)return k(()=>w.push((0,y.Q)({adminRoute:u,path:`/collections/${a}/trash`,serverURL:g}
43)));"function"==typeof l&&await l({id:t,collectionConfig:v});return}o.errors?o.errors.forEach(e=>e3.error(e.message)):N()}catch{N()}},[g,f,a,t,C,i,N,j,S,w,u,r,l,v,k]);return t?(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(tN,{buttonStyle:"secondary",id:n,onClick:()=>{_($)},children:C("general:permanentlyDelete")}),(0,p.jsx)(ag,{body:(0,p.jsx)(pu,{elements:{1:({children:e})=>(0,p.jsx)("strong",{children:e})},i18nKey:"general:aboutToPermanentlyDelete",t:C,variables:{label:(0,h.s)(i,j),title:s||S||t}}),confirmingLabel:C("general:deleting"),heading:C("general:confirmDeletion"),modalSlug:$,onConfirm:P})]}):null},m4=e=>{let{className:t}=e;return(0,p.jsx)("svg",{className:[t,"icon icon--externalLink"].filter(Boolean).join(" "),viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M16 10.6667V14.6667C16 15.0203 15.8595 15.3594 15.6095 15.6095C15.3594 15.8595 15.0203 16 14.6667 16H5.33333C4.97971 16 4.64057 15.8595 4.39052 15.6095C4.14048 15.3594 4 15.0203 4 14.6667V5.33333C4 4.97971 4.14048 4.64057 4.39052 4.39052C4.64057 4.14048 4.97971 4 5.33333 4H9.33333M16 4L10 10M16 4H12M16 4V8",strokeLinecap:"square"})})};function m8(e){let t,n=(0,g.c)(3),{previewURL:a}=mq(),{t:l}=(0,d.d)();return a?(n[0]!==a||n[1]!==l?(t=(0,p.jsx)("a",{"aria-label":l("version:preview"),className:"preview-btn",href:a,id:"preview-button",target:"_blank",title:l("version:preview"),children:(0,p.jsx)(m4,{})}),n[0]=a,n[1]=l,n[2]=t):t=n[2],t):null}var m7="table",m9=({appearance:e,BeforeTable:t,columns:n,data:a})=>{let l=n?.filter(e=>e?.active);return l&&0!==l.length?(0,p.jsxs)("div",{className:[m7,e&&`${m7}--appearance-${e}`].filter(Boolean).join(" "),children:[t,(0,p.jsxs)("table",{cellPadding:"0",cellSpacing:"0",children:[(0,p.jsx)("thead",{children:(0,p.jsx)("tr",{children:l.map((e,t)=>(0,p.jsx)("th",{id:`heading-${e.accessor.replace(/\./g,"__")}`,children:e.Heading},t))})}),(0,p.jsx)("tbody",{children:a&&a?.map((e,t)=>(0,p.jsx)("tr",{className:`row-${t+1}`,"data-id":e.id,children:l.map((e,n)=>{let{accessor:a}=e;return(0,p.jsx)("td",{className:`cell-${a.replace(/\./g,"__")}`,children:e.renderedCells[t]},n)})},"string"==typeof e.id||"number"==typeof e.id?String(e.id):t))})]})]}):(0,p.jsx)("div",{children:"No columns selected"})},ge="schedule-publish",gt={label:"All",value:"all"},gn=({slug:e,defaultType:t,schedulePublishConfig:n})=>{let{toggleModal:a}=nN(),{config:{admin:{dateFormat:l,timezones:{defaultTimezone:r,supportedTimezones:i}},localization:s}}=(0,c.c)(),{id:u,collectionSlug:f,globalSlug:m}=lE(),{title:g}=ly(),{i18n:b,t:v}=(0,d.d)(),{getUpcomingScheduledPublish:y,schedulePublish:x}=cf(),[w,j]=o.useState(t||"publish"),[C,S]=o.useState(),[k,_]=o.useState(r),[$,N]=o.useState(gt),[P,E]=o.useState(!1),D=v("general:schedulePublishFor",{title:g}),[T,A]=o.useState(),[R,L]=o.useState(),F=o.useRef(()=>null),O=Intl.DateTimeFormat().resolvedOptions().timeZone,M=o.useMemo(()=>{if(s){let e=s.locales.map(({code:e,label:t})=>({label:(0,h.s)(t,b),value:e}));return e.unshift(gt),e}return[]},[s,b]),I=o.useCallback(async()=>{let e=await y({id:u,collectionSlug:f,globalSlug:m});L((({dateFormat:e,deleteHandler:t,docs:n,i18n:a,localization:l,supportedTimezones:r,t:i})=>{let o=[{accessor:"input.type",active:!0,field:{name:"",type:"text"},Heading:(0,p.jsx)("span",{children:i("version:type")}),renderedCells:n.map(e=>{let t=e.input?.type;return(0,p.jsxs)(ra,{pillStyle:"publish"===t?"success":"warning",size:"small",children:["publish"===t&&i("version:publish"),"unpublish"===t&&i("version:unpublish")]},e.id)})},{accessor:"waitUntil",active:!0,field:{name:"",type:"date"},Heading:(0,p.jsx)("span",{children:i("general:time")}),renderedCells:n.map(t=>(0,p.jsx)("span",{children:lh({date:t.waitUntil,i18n:a,pattern:e,timezone:t.input.timezone})},t.id))},{accessor:"input.timezone",active:!0,field:{name:"",type:"text"},Heading:(0,p.jsx)("span",{children:i("general:timezone")}),renderedCells:n.map(e=>{let t=r.find(t=>t.value===e.input.timezone)?.label||e.input.timezone;return(0,p.jsx)("span",{children:t||i("general:noValue")},e.id)})}];return l&&o.push({accessor:"input.locale",active:!0,field:{name:"",type:"text"},Heading:(0,p.jsx)("span",{children:i("general:locale")}
43),renderedCells:n.map(e=>{if(e.input.locale){let t=l.locales.find(t=>t.code===e.input.locale);if(t)return(0,p.jsx)("span",{children:(0,h.s)(t.label,a)},e.id)}return(0,p.jsx)("span",{children:i("general:all")},e.id)})}),o.push({accessor:"delete",active:!0,field:{name:"delete",type:"text"},Heading:(0,p.jsx)("span",{children:i("general:delete")}),renderedCells:n.map(e=>(0,p.jsx)(tN,{buttonStyle:"icon-label",className:"schedule-publish__delete",icon:"x",onClick:n=>{n.preventDefault(),t(e.id)},tooltip:i("general:delete")},e.id))}),o})({dateFormat:l,deleteHandler:F.current,docs:e,i18n:b,localization:s,supportedTimezones:i,t:v})),A(e)},[f,m,y,b,l,s,i,v,u]),B=o.useCallback(async e=>{try{await x({deleteID:e}),await I(),e3.success(v("general:deletedSuccessfully"))}catch(e){console.error(e),e3.error(e.message)}},[I,x,v]);o.useEffect(()=>{F.current=B},[B]);let z=o.useCallback(async()=>{let e;if(!C)return e3.error(v("general:noDateSelected"));E(!0),"object"==typeof $&&"all"!==$.value&&"publish"===w&&(e=$.value);try{await x({type:w,date:C,doc:f?{relationTo:f,value:String(u)}:void 0,global:m||void 0,localeToPublish:e,timezone:k}),S(void 0),e3.success(v("version:scheduledSuccessfully")),I()}catch(e){console.error(e),e3.error(e.message)}E(!1)},[C,$,w,v,x,f,u,m,k,I]),U=(0,o.useMemo)(()=>{if(k&&O&&C){let e=aB.tz(k),t=aB.tz(O),n=lp(new aB(C).withTimeZone(k),e);return lp(n,t).toISOString()}return C},[k,C,O]),V=(0,o.useCallback)(e=>{if(k&&e){let t=aB.tz(k);S(lp(new aB(e),t)||null)}else S(e||null)},[S,k]);o.useEffect(()=>{T||(async()=>await I())()},[T,I]);let H=(0,o.useMemo)(()=>C&&function(e,t){let[n,a]=aZ(void 0,e,t);return+aJ(n)==+aJ(a)}(aq(C,C),a1(C))?new Date:aJ(new Date),[C]);return(0,p.jsxs)(au,{className:ge,gutter:!1,Header:(0,p.jsxs)("div",{className:`${ge}__drawer-header`,children:[(0,p.jsx)("h2",{title:D,children:D}),(0,p.jsx)(uL,{onClick:()=>a(e)})]}),slug:e,children:[(0,p.jsxs)(ai,{className:`${ge}__scheduler`,children:[(0,p.jsx)(aD,{label:v("version:type"),required:!0}),(0,p.jsxs)("ul",{className:`${ge}__type`,children:[(0,p.jsx)("li",{children:(0,p.jsx)(dN,{id:`${e}-type`,isSelected:"publish"===w,onChange:()=>j("publish"),option:{label:v("version:publish"),value:"publish"},path:`${e}-type`,readOnly:P})}),(0,p.jsx)("li",{children:(0,p.jsx)(dN,{id:`${e}-type`,isSelected:"unpublish"===w,onChange:()=>j("unpublish"),option:{label:v("version:unpublish"),value:"unpublish"},path:`${e}-type`,readOnly:P})})]}),(0,p.jsx)("br",{}),(0,p.jsx)(aD,{label:v("general:time"),path:"time",required:!0}),(0,p.jsx)(rL,{id:"time",maxTime:a3(Date.now(),void 0),minDate:new Date,minTime:H,onChange:e=>V(e),pickerAppearance:"dayAndTime",readOnly:P,timeFormat:n?.timeFormat,timeIntervals:n?.timeIntervals??5,value:U}),i.length>0&&(0,p.jsx)(s0,{id:"timezone-picker",onChange:_,options:i,selectedTimezone:k}),(0,p.jsx)("br",{}),M.length>0&&"publish"===w&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(aD,{label:v("localization:localeToPublish")}),(0,p.jsx)(sZ,{onChange:e=>N(e),options:M,value:$}),(0,p.jsx)("br",{})]}),(0,p.jsxs)("div",{className:`${ge}__actions`,children:[(0,p.jsx)(tN,{buttonStyle:"primary",disabled:P,id:"scheduled-publish-save",onClick:z,type:"button",children:v("general:save")}),P?(0,p.jsx)("span",{children:v("general:saving")}):null]})]}),(0,p.jsxs)(ai,{className:`${ge}__upcoming`,children:[(0,p.jsx)("h4",{children:v("general:upcomingEvents")}),!T&&(0,p.jsx)(c.f,{}),T?.length===0&&(0,p.jsx)(ti,{type:"info",children:v("general:noUpcomingEventsScheduled")}),T?.length>0&&(0,p.jsx)(m9,{appearance:"condensed",columns:R,data:T})]})]})};function ga({label:e}={}){let{id:t,collectionSlug:n,globalSlug:a,hasPublishedDoc:l,hasPublishPermission:r,setHasPublishedDoc:i,setMostRecentVersionIsAutosaved:s,setUnpublishedVersionCount:u,unpublishedVersionCount:f,uploadStatus:m}=lE(),{config:g,getEntityConfig:b}=(0,c.c)(),{submit:v}=eT(),w=eM(),j=nc(),{code:C}=aN(),{isModalOpen:S,toggleModal:k}=nN(),_=`schedule-publish-${t}`,{localization:$,routes:{api:N}}=g,{i18n:P,t:E}=(0,d.d)(),D=e||E("version:publishChanges"),T=o.useMemo(()=>n?b({collectionSlug:n}):a?b({globalSlug:a}):void 0,[n,a,b]),A=f>0,R=r&&(w||A||!l)&&"uploading"!==m,F=(0,L._N)(T),O=(0,L.s8)(T),M=!!(F&&r&&(a||n&&t)&&(O||!w)),[I,B]=(0,o.useState)(!1);(0,o.useEffect)(()=>{B(mY(T?.fields))},[T?.fields]);let z=$&&I&&r,U="update"===lL()&&!w,V=(0,o.useCallback)(async()=>
43{if(U)return;let e=x.A({depth:0,draft:!0,"fallback-locale":"null",locale:C},{addQueryPrefix:!0}),l,r="POST";n&&(l=(0,y.Q)({apiRoute:N,path:`/${n}${t?`/${t}`:""}${e}`}),t&&(r="PATCH")),a&&(l=(0,y.Q)({apiRoute:N,path:`/globals/${a}${e}`})),await v({action:l,method:r,overrides:{_status:"draft"},skipValidation:!0})},[U,C,n,a,v,N,t]);h3({cmdCtrlKey:!0,editDepth:j,keyCodes:["s"]},e=>{e.preventDefault(),e.stopPropagation(),V&&O&&V()});let H=(0,L.jq)(T),q=(0,o.useCallback)(async()=>{if("uploading"===m)return;let e=x.A({depth:0,locale:C,...H&&{publishAllLocales:!0}},{addQueryPrefix:!0}),l=(0,y.Q)({apiRoute:N,path:`${a?`/globals/${a}`:`/${n}${t?`/${t}`:""}`}${e}`});await v({action:l,overrides:{_status:"published"}})&&(u(0),s(!1),i(!0))},[C,H,N,n,a,t,i,v,u,m,s]),W=(0,o.useCallback)(async e=>{if("uploading"===m)return;let l=x.A({depth:0,locale:e,publishSpecificLocale:e},{addQueryPrefix:!0}),r=a?`/globals/${a}`:`/${n}${t?`/${t}`:""}`,o=(0,y.Q)({apiRoute:N,path:`${r}${l}`});await v({action:o,overrides:{_status:"published"}})&&(u(0),s(!1),i(!0))},[N,n,a,t,i,s,u,v,m]),K=!z||$&&$?.defaultLocalePublishOption!=="active",Q=$&&$?.locales.find(e=>"string"==typeof e?e===C:e.code===C),Y=Q&&(0,h.s)(Q.label,P);return r?(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(pi,{buttonId:"action-save",disabled:!R,enableSubMenu:M,onClick:K?q:()=>W(Q.code),size:"medium",SubMenuPopupContent:z||M?({close:e})=>(0,p.jsxs)(o.Fragment,{children:[M&&(0,p.jsx)(tp.ButtonGroup,{children:(0,p.jsx)(tp.Button,{id:"schedule-publish",onClick:()=>[k(_),e()],children:E("version:schedulePublish")})},"schedule-publish"),z&&(0,p.jsx)(tp.ButtonGroup,{children:(0,p.jsx)(tp.Button,{id:"publish-locale",onClick:K?()=>W(Q.code):q,children:K?E("version:publishIn",{locale:Y}):E("version:publishAllLocales")})})]}):void 0,type:"button",children:K?D:E("version:publishIn",{locale:Y})}),M&&S(_)&&(0,p.jsx)(gn,{defaultType:A?"publish":"unpublish",schedulePublishConfig:F&&"object"==typeof T.versions.drafts.schedulePublish?T.versions.drafts.schedulePublish:void 0,slug:_})]}):null}var gl="restore-button",gr=e=>{let{id:t,buttonId:n,collectionSlug:a,onRestore:l,redirectAfterRestore:r=!0,singularLabel:i,title:s}=e,{config:{routes:{admin:u,api:f},serverURL:g},getEntityConfig:b}=(0,c.c)(),v=b({collectionSlug:a}),w=(0,m.useRouter)(),{i18n:j,t:C}=(0,d.d)(),{title:S}=ly(),{startRouteTransition:k}=te(),{openModal:_}=nN(),$=`restore-${t}`,[N,P]=(0,o.useState)(!1),E=(0,o.useCallback)(()=>{e3.error(C("error:restoringTitle",{title:S}))},[C,S]),D=(0,o.useCallback)(async()=>{try{let e=(0,y.Q)({apiRoute:f,path:`/${a}${x.A({trash:!0,where:{and:[{id:{equals:t}},{deletedAt:{exists:!0}}]}},{addQueryPrefix:!0})}`}),n={deletedAt:null};v?.versions?.drafts&&(n._status=N?"published":"draft");let o=await ay.patch(e,{body:JSON.stringify(n),headers:{"Accept-Language":j.language,"Content-Type":"application/json"}}),s=await o.json();if(o.status<400){if(e3.success(C("general:titleRestored",{label:(0,h.s)(i,j),title:S})||s.message),r)return k(()=>w.push((0,y.Q)({adminRoute:u,path:`/collections/${a}/${t}`,serverURL:g}
43)));"function"==typeof l&&await l({id:t,collectionConfig:v});return}s.errors?s.errors.forEach(e=>e3.error(e.message)):E()}catch{E()}},[g,f,a,t,C,i,E,j,S,w,u,r,l,v,k,N]);return t?(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(tN,{buttonStyle:"primary",id:n,onClick:()=>{_($)},children:C("general:restore")},n),(0,p.jsx)(ag,{body:(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(pu,{elements:{1:({children:e})=>(0,p.jsx)("strong",{children:e})},i18nKey:v?.versions?.drafts?"general:aboutToRestoreAsDraft":"general:aboutToRestore",t:C,variables:{label:(0,h.s)(i,j),title:s||S||t}}),v?.versions?.drafts&&(0,p.jsx)("div",{className:`${gl}__checkbox`,children:(0,p.jsx)(lY,{checked:N,id:"restore-as-published",label:C("general:restoreAsPublished"),name:"restore-as-published",onToggle:e=>P(e.target.checked)})})]}),className:gl,confirmingLabel:C("general:restoring"),heading:C("general:confirmRestoration"),modalSlug:$,onConfirm:D})]}):null};function gi({label:e}){let{uploadStatus:t}=lE(),{t:n}=(0,d.d)(),{submit:a}=eT(),l=eM(),r=e||n("general:save"),i=(0,o.useRef)(null),s=nc(),c="update"===lL()&&!l||"uploading"===t;return h3({cmdCtrlKey:!0,editDepth:s,keyCodes:["s"]},e=>{e.preventDefault(),e.stopPropagation(),i?.current&&i.current.click()}),(0,p.jsx)(pi,{buttonId:"action-save",disabled:c,onClick:()=>{"uploading"!==t&&a()},ref:i,size:"medium",type:"button",children:r})}function go(e){let{config:{routes:{api:t}}}=(0,c.c)(),{id:n,collectionSlug:a,globalSlug:l,setUnpublishedVersionCount:r,uploadStatus:i}=lE(),s=eM(),{code:u}=aN(),h=(0,o.useRef)(null),f=nc(),{t:m}=(0,d.d)(),{submit:g}=eT(),b="update"===lL()&&!s||"uploading"===i,v=(0,o.useCallback)(async()=>{if(b)return;let e=`?locale=${u}&depth=0&fallback-locale=null&draft=true`,i,o="POST";a&&(i=(0,y.Q)({apiRoute:t,path:`/${a}${n?`/${n}`:""}${e}`}),n&&(o="PATCH")),l&&(i=(0,y.Q)({apiRoute:t,path:`/globals/${l}${e}`})),await g({action:i,method:o,overrides:{_status:"draft"},skipValidation:!0}),r(e=>e+1)},[g,a,l,t,u,n,b,r]);return h3({cmdCtrlKey:!0,editDepth:f,keyCodes:["s"]},e=>{e.preventDefault(),e.stopPropagation(),h?.current&&h.current.click()}),(0,p.jsx)(pi,{buttonId:"action-save-draft",buttonStyle:"secondary",className:"save-draft",disabled:b,onClick:()=>{v()},ref:h,size:"medium",type:"button",children:m("version:saveDraft")})}var gs="status",gc=()=>{let{id:e,collectionSlug:t,docPermissions:n,globalSlug:a,hasPublishedDoc:l,incrementVersionCount:r,isTrashed:i,setMostRecentVersionIsAutosaved:s,setUnpublishedVersionCount:u,unpublishedVersionCount:h}=lE(),{toggleModal:f}=nN(),{config:{routes:{api:m}}}=(0,c.c)(),{reset:g}=eT(),{code:b}=aN(),{i18n:v,t:x}=(0,d.d)(),w=`confirm-revert-${e}`,j;h>0&&l?j="changed":l?l&&h<=0&&(j="published"):j="draft";let C=i?l?"previouslyPublished":"previouslyDraft":j,S=(0,o.useCallback)(async()=>{let n,l;t&&(n=(0,y.Q)({apiRoute:m,path:`/${t}/${e}?locale=${b}&fallback-locale=null&depth=0`}),l="patch"),a&&(n=(0,y.Q)({apiRoute:m,path:`/globals/${a}?locale=${b}&fallback-locale=null&depth=0`}),l="post");let i=await ay.get(n,{headers:{"Accept-Language":v.language,"Content-Type":"application/json"}}).then(e=>e.json()),o=await ay[l](n,{body:JSON.stringify(i),headers:{"Accept-Language":v.language,"Content-Type":"application/json"}});if(200===o.status){let e,n=await o.json();a?e=n.result:t&&(e=n.doc),g(e),e3.success(n.message),r(),s(!1),u(0)}else try{let e=await o.json();e.errors?.[0]?.message?e3.error(e.errors[0].message):e.error?e3.error(e.error):e3.error(x("error:revertingDocument"))}catch{e3.error(x("error:revertingDocument"))}},[m,t,a,e,v.language,r,b,g,u,s,x]),k=n?.update;return j?(0,p.jsx)("div",{className:gs,title:`${x("version:status")}: ${x(`version:${C}`)}`,children:(0,p.jsxs)("div",{className:`${gs}__value-wrap`,children:[(0,p.jsxs)("span",{className:`${gs}__label`,children:[x("version:status"),":\xa0"]}),(0,p.jsx)("span",{className:`${gs}__value`,children:x(`version:${C}`)}),!i&&k&&l&&"changed"===j&&(0,p.jsxs)(o.Fragment,{children:["\xa0—\xa0",(0,p.jsx)(tN,{buttonStyle:"none",className:`${gs}__action`,id:"action-revert-to-published",onClick:()=>f(w),children:x("version:revertToPublished")}),(0,p.jsx)(ag,{body:x("version:aboutToRevertToPublished"),confirmingLabel:x("version:reverting"),heading:x("version:confirmRevertToSaved"),modalSlug:w,onConfirm:()=>S()})]})]})}):null};function gd({label:e}={}){let{id:t,collectionSlug:n,data:a,globalSlug:l,hasPublishedDoc:r,hasPublishPermission:i,incrementVersionCount:s,isTrashed:u,setHasPublishedDoc:f,setMostRecentVersionIsAutosaved:m,setUnpublishedVersionCount:g}=lE(),{toggleModal:b}=nN(),{config:v,getEntityConfig:w}=(0,c.c)(),{reset:j}=eT(),{code:C,label:S}=aN(),[k,_]=(0,o.useState)(!1),[$,N]=(0,o.useState)(!1),P=`confirm-un-publish-${t}`,{routes:{api:E},serverURL:D}=v,{i18n:T,t:A}=(0,d.d)(),R=o.useMemo(()=>n?w({collectionSlug:n}):l?w({globalSlug:l}):void 0,[n,l,w]),L=(0,o.useCallback)(e=>{(async()=>{let r,i,o=x.A({depth:0,"fallback-locale":"null",locale:e?void 0:C,unpublishAllLocales:e},{addQueryPrefix:!0});n&&(r=(0,y.Q)({apiRoute:E,path:`/${n}/${t}${o}`,serverURL:D}),i="patch"),l&&(r=(0,y.Q)({apiRoute:E,path:`/globals/${l}${o}
43`,serverURL:D}),i="post");try{let t=await ay[i](r,{body:JSON.stringify({_status:"draft"}),headers:{"Accept-Language":T.language,"Content-Type":"application/json"}});if(200===t.status)j({...a||{},_status:"draft"}),e3.success(A("version:unpublishedSuccessfully")),e||s(),g(1),m(!1),f(!1);else try{let e=await t.json();e.errors?.[0]?.message?e3.error(e.errors[0].message):e.error?e3.error(e.error):e3.error(A("error:unPublishingDocument"))}catch{e3.error(A("error:unPublishingDocument"))}}catch{e3.error(A("error:unPublishingDocument"))}})().catch(()=>{e3.error(A("error:unPublishingDocument"))})},[a,j,n,l,D,E,C,t,T.language,s,f,m,g,A]);(0,o.useEffect)(()=>{N(mY(R?.fields))},[R?.fields]);let F=R?.versions?.drafts,O="object"==typeof F&&null!==F,M=o.useMemo(()=>O&&i&&r&&!u,[i,r,u,O]),I=o.useMemo(()=>{if(!M||!$)return!1;let e=F&&!0===F.localizeStatus,t=v.experimental?.localizeStatus===!0;return e&&t},[M,$,F,v.experimental?.localizeStatus]),B=(0,h.s)(S,T);return M?(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(tp.Button,{id:"action-unpublish",onClick:()=>{_(!0),b(P)},children:e||A("version:unpublish")}),I&&(0,p.jsx)(tp.Button,{id:"action-unpublish-locale",onClick:()=>{_(!1),b(P)},children:e?`${e} [${B}]`:A("version:unpublishIn",{locale:B})}),(0,p.jsx)(ag,{body:k?A("version:aboutToUnpublish"):A("version:aboutToUnpublishIn",{locale:B}),confirmingLabel:A("version:unpublishing"),heading:A("version:confirmUnpublish"),modalSlug:P,onConfirm:()=>L(k)})]}):null}var gu="doc-controls",gp=e=>{let t=(0,g.c)(5),{id:n,slug:a,BeforeDocumentControls:l,customComponents:r,data:i,disableActions:s,disableCreate:u,EditMenuItems:f,hasSavePermission:m,isAccountView:b,isEditing:v,isInDrawer:x,isTrashed:w,onDelete:j,onDrawerCreateNew:C,onDuplicate:S,onRestore:k,onTakeOver:_,permissions:$,readOnlyForIncomingUser:N,redirectAfterDelete:P,redirectAfterDuplicate:E,redirectAfterRestore:D,user:T}=e,{PreviewButton:A,PublishButton:R,SaveButton:F,SaveDraftButton:O,Status:M,UnpublishButton:I}=void 0===r?{}:r,{i18n:B,t:z}=(0,d.d)(),U=nc(),{config:V,getEntityConfig:H}=(0,c.c)(),q=H({collectionSlug:a}),W=H({globalSlug:a}),{isLivePreviewEnabled:K}=mH(),{hasDeletePermission:Q,hasTrashPermission:Y}=lE(),{admin:G,localization:X,routes:Z}=V,{dateFormat:J}=G,{admin:ee}=Z,[et,en]=o.useState(""),[ea,el]=o.useState(""),er=eF(),ei=eI(),eo,es;t[0]!==i||t[1]!==J||t[2]!==B?(eo=()=>{i?.updatedAt&&en(lh({date:i.updatedAt,i18n:B,pattern:J})),i?.createdAt&&el(lh({date:i.createdAt,i18n:B,pattern:J}))},es=[i,B,J],t[0]=i,t[1]=J,t[2]=B,t[3]=eo,t[4]=es):(eo=t[3],es=t[4]),(0,o.useEffect)(eo,es);let ec=$&&"create"in $&&$.create,ed=$&&"delete"in $&&$.delete,eu=q?.trash?Y||Q:ed,ep=!n&&q?.versions?.drafts&&q.versions?.drafts.validate,eh=(0,L.gD)(W),ef=(0,L.gD)(q),eg=!!(!s&&(q&&n&&(ec||eu)||W&&(eh||X))),eb=(0,L.s8)(q),ev=(0,L.s8)(W),ey=eb||ev,ex=eb&&!1!==q.versions.drafts.autosave&&!0===q.versions.drafts.autosave.showSaveDraftButton||ev&&!1!==W.versions.drafts.autosave&&!0===W.versions.drafts.autosave.showSaveDraftButton,ew=X&&!q?.admin?.disableCopyToLocale,ej=q&&q.folders,eC=T&&N;return(0,p.jsxs)(ai,{className:gu,children:[(0,p.jsxs)("div",{className:`${gu}__wrapper`,children:[(0,p.jsxs)("div",{className:`${gu}__content`,children:[eC||ej?(0,p.jsxs)("div",{className:`${gu}__meta-icons`,children:[eC&&(0,p.jsx)(m6,{className:`${gu}__locked-controls`,user:T}),ej&&V.folders&&!w&&(0,p.jsx)(pP,{folderCollectionSlug:V.folders.slug,folderFieldName:V.folders.fieldName})]}):null,(0,p.jsxs)("ul",{className:`${gu}__meta`,children:[q&&!v&&!b&&(0,p.jsx)("li",{className:`${gu}__list-item`,children:(0,p.jsx)("p",{className:`${gu}__value`,children:B.t("general:creatingNewLabel",{label:(0,h.s)(q?.labels?.singular??B.t("general:document"),B)})})}),(ef||eh)&&(0,p.jsxs)(o.Fragment,{children:[(W||q&&v)&&(0,p.jsx)("li",{className:[`${gu}__status`,`${gu}__list-item`].filter(Boolean).join(" "),children:(0,p.jsx)(em,{CustomComponent:M,Fallback:(0,p.jsx)(gc,{})})}),m&&ey&&!ep&&!w&&(0,p.jsx)("li",{className:`${gu}__list-item`,children:(0,p.jsx)(mW,{collection:q,global:W,id:n,publishedDocUpdatedAt:i?.createdAt})})]}),q?.timestamps&&(v||b)&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsxs)("li",{className:[`${gu}__list-item`,`${gu}
43__value-wrap`].filter(Boolean).join(" "),title:i?.updatedAt?et:"",children:[(0,p.jsxs)("p",{className:`${gu}__label`,children:[B.t(w?"general:deleted":"general:lastModified"),":\xa0"]}),i?.updatedAt&&(0,p.jsx)("p",{className:`${gu}__value`,children:et})]}),(0,p.jsxs)("li",{className:[`${gu}__list-item`,`${gu}__value-wrap`].filter(Boolean).join(" "),title:i?.createdAt?ea:"",children:[(0,p.jsxs)("p",{className:`${gu}__label`,children:[B.t("general:created"),":\xa0"]}),i?.createdAt&&(0,p.jsx)("p",{className:`${gu}__value`,children:ea})]})]})]})]}),(0,p.jsxs)("div",{className:`${gu}__controls-wrapper`,children:[(0,p.jsxs)("div",{className:`${gu}__controls`,children:[l,K&&!x&&(0,p.jsx)(m1,{}),(q?.admin.preview||W?.admin.preview)&&(0,p.jsx)(em,{CustomComponent:A,Fallback:(0,p.jsx)(m8,{})}),m&&!w&&(0,p.jsx)(o.Fragment,{children:ef||eh?(0,p.jsxs)(o.Fragment,{children:[(ep||!ey||ey&&ex)&&(0,p.jsx)(em,{CustomComponent:O,Fallback:(0,p.jsx)(go,{})}),(0,p.jsx)(em,{CustomComponent:R,Fallback:(0,p.jsx)(ga,{})})]}):(0,p.jsx)(em,{CustomComponent:F,Fallback:(0,p.jsx)(gi,{})})}),Q&&w&&(0,p.jsx)(m5,{buttonId:"action-permanently-delete",collectionSlug:q?.slug,id:n.toString(),onDelete:j,redirectAfterDelete:P,singularLabel:q?.labels?.singular}),m&&w&&(0,p.jsx)(gr,{buttonId:"action-restore",collectionSlug:q?.slug,id:n.toString(),onRestore:k,redirectAfterRestore:D,singularLabel:q?.labels?.singular}),T&&N&&(0,p.jsx)(tN,{buttonStyle:"secondary",id:"take-over",onClick:_,size:"medium",type:"button",children:z("general:takeOver")})]}),eg&&!N&&(0,p.jsx)(tC,{button:(0,p.jsxs)("div",{className:`${gu}__dots`,children:[(0,p.jsx)("div",{}),(0,p.jsx)("div",{}),(0,p.jsx)("div",{})]}),className:`${gu}__popup`,disabled:ei||er,horizontalAlign:"right",size:"large",verticalAlign:"bottom",children:(0,p.jsxs)(tp.ButtonGroup,{children:[ew&&(0,p.jsx)(mD,{}),ec&&(0,p.jsxs)(o.Fragment,{children:[!u&&(0,p.jsx)(o.Fragment,{children:U>1?(0,p.jsx)(tp.Button,{id:"action-create",onClick:C,children:B.t("general:createNew")}):(0,p.jsx)(tp.Button,{href:(0,y.Q)({adminRoute:ee,path:`/collections/${q?.slug}/create`}),id:"action-create",children:B.t("general:createNew")})}),!0!==q.disableDuplicate&&v&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(mZ,{id:n,onDuplicate:S,redirectAfterDuplicate:E,singularLabel:q?.labels?.singular,slug:q?.slug}),X&&(0,p.jsx)(mZ,{id:n,onDuplicate:S,redirectAfterDuplicate:E,selectLocales:!0,singularLabel:q?.labels?.singular,slug:q?.slug})]})]}),eu&&(0,p.jsx)(mQ,{buttonId:"action-delete",collectionSlug:q?.slug,id:n.toString(),onDelete:j,redirectAfterDelete:P,singularLabel:q?.labels?.singular,useAsTitle:q?.admin?.useAsTitle}),(0,p.jsx)(em,{CustomComponent:I,Fallback:(0,p.jsx)(gd,{})}),f]})})]})]}),(0,p.jsx)("div",{className:`${gu}__divider`})]})},gh=/^<(?<name>[^\s/>]+)[^>]*>$/,gf=/^<(?<isEnd>\/)?(?<name>[^\s>]+)[^>]*>$/,gm=/^<[^>]+>/,gg=/^<img[^>]*>$/,gb=/^<video[^>]*>.*?<\/video>$/ms,gv=class{config;leastCommonLength=1/0;matchedBlockList=[];newTokens=[];oldTokens=[];operationList=[];sideBySideContents;unifiedContent;constructor(e,t,{classNames:n={createBlock:"html-diff-create-block-wrapper",createInline:"html-diff-create-inline-wrapper",deleteBlock:"html-diff-delete-block-wrapper",deleteInline:"html-diff-delete-inline-wrapper"},greedyBoundary:a=1e3,greedyMatch:l=!0,minMatchedSize:r=2,tokenizeByCharacter:i=!1}={}){if(this.config={classNames:{createBlock:"html-diff-create-block-wrapper",createInline:"html-diff-create-inline-wrapper",deleteBlock:"html-diff-delete-block-wrapper",deleteInline:"html-diff-delete-inline-wrapper",...n},greedyBoundary:a,greedyMatch:l,minMatchedSize:r},(e=e.trim())===(t=t.trim())){this.unifiedContent=e;let t=0,n=e.replace(/<([^\s/>]+)[^>]*>/g,(e,n)=>{let a=n.length+1;return`${e.slice(0,a)} data-seq="${++t}"${e.slice(a)}`});this.sideBySideContents=[n,n];return}let o=i?this.tokenizeByCharacter:this.tokenizeByWord;this.oldTokens=o(e),this.newTokens=o(t),this.matchedBlockList=this.getMatchedBlockList(),this.operationList=this.getOperationList()}computeBestMatchedBlock(e,t,n,a){let l=null;for(let r=e;r<t;r++){let e=Math.min(t-r,a-n),i=this.slideBestMatchedBlock(r,n,e);if(i&&(!l||i.size>l.size)&&(l=i,i.size>this.leastCommonLength))return l}for(let r=n;r<a;r++){let n=Math.min(t-e,a-r),i=this.slideBestMatchedBlock(e,r,n);if(i&&(!l||i.size>l.size)&&(l=i,i.size>this.leastCommonLength))break}return l}computeMatchedBlockList(e,t,n,a,l=[]){let r=this.computeBestMatchedBlock(e,t,n,a);return r?(e<r.oldStart&&n<r.newStart&&this.computeMatchedBlockList(e,r.oldStart,n,r.newStart,l),l.push(r),t>r.oldEnd&&a>r.newEnd&&this.computeMatchedBlockList(r.oldEnd,t,r.newEnd,a,l),l):[]}dressUpBlockTag(e,t){return"create"===e?`<div class="${this.config.classNames.createBlock}">${t}</div>`:"delete"===e?`<div class="${this.config.classNames.deleteBlock}">${t}</div>`:""}dressUpDiffContent(e,t){let n=t.length;if(!n)return"";let a="",l=0,r=-1;for(let n of t){r++;let i=n.includes('data-enable-match="true"'),o=n.includes('data-enable-match="false"'),s=!!n.match(gm)?.length;o?(l=r+1,a+=n):!i&&s?(r>l&&(a+=this.dressUpText(e,t.slice(l,r))),l=r+1,n.match(gb)?a+=this.dressUpBlockTag(e,n):a+=n):i&&s&&(r>l&&(a+=this.dressUpText(e,t.slice(l,r))),l=r+1,a+=this.dressupMatchEnabledHtmlTag(e,n))}return l<n&&(a+=this.dressUpText(e,t.slice(l))),a}dressUpInlineTag(e,t){return"create"===e?`<span class="${this.config.classNames.createInline}">${t}</span>`:"delete"===e?`<span class="${this.config.classNames.deleteInline}">${t}</span>`:""}dressupMatchEnabledHtmlTag(e,t){let n=t.match(gh)?.groups?.name;if(!n)return t;let a=n.length+1;return`${t.slice(0,a)} data-match-type="${"create"===e?"create":"delete"}"${t.slice(a,t.length)}`}dressUpText(e,t){let n=t.join("");return n.trim()?"create"===e?`<span data-match-type="create">${n}</span>`:"delete"===e?`<span data-match-type="delete">${n}</span>`:"":""}getMatchedBlockList(){let e=this.oldTokens.length,t=this.newTokens.length,n=null,a=0;for(;a<e&&a<t&&this.oldTokens[a]===this.newTokens[a];)a++;a>=this.config.minMatchedSize&&(n={newEnd:a,newStart:0,oldEnd:a,oldStart:0,size:a});let l=null,r=e-1,i=t-1;for(;a<=r&&a<=i&&this.oldTokens[r]===this.newTokens[i];)r--,i--;let o=e-1-r;o>=this.config.minMatchedSize&&(l={newEnd:t,newStart:i+1,oldEnd:e,oldStart:r+1,size:o});let s=n?a:0,c=l?r+1:e,d=n?a:0,u=l?i+1:t;if(this.config.greedyMatch){let e=Math.min(c-s,u-d);e>this.config.greedyBoundary&&(this.leastCommonLength=Math.floor(e/3))}let p=this.computeMatchedBlockList(s,c,d,u);return n&&p.unshift(n),l&&p.push(l),p}getOperationList(){let e=[],t=0,n=0;for(let a of this.matchedBlockList){let l=t===a.oldStart,r=n===a.newStart,i={newEnd:a.newStart,newStart:n,oldEnd:a.oldStart,oldStart:t};l||r?l&&!r?e.push(Object.assign(i,{type:"create"})):!l&&r&&e.push(Object.assign(i,{type:"delete"})):e.push(Object.assign(i,{type:"replace"})),e.push({type:"equal",newEnd:a.newEnd,newStart:a.newStart,oldEnd:a.oldEnd,oldStart:a.oldStart}),t=a.oldEnd,n=a.newEnd}let a=this.oldTokens.length,l=this.newTokens.length,r={newEnd:l,newStart:n,oldEnd:a,oldStart:t},i=t===a,o=n===l;return i||o?i&&!o?e.push(Object.assign(r,{type:"create"})):!i&&o&&e.push(Object.assign(r,{type:"delete"})):e.push(Object.assign(r,{type:"replace"})),e}slideBestMatchedBlock(e,t,n){let a=0,l=null,r=0;for(let i=0;i<n;i++)this.oldTokens[e+i]===this.newTokens[t+i]?r++:r=0,r>a&&(a=r,l={newEnd:t+i+1,newStart:t+i-r+1,oldEnd:e+i+1,oldStart:e+i-r+1,size:r});return a>=this.config.minMatchedSize?l:null}
43tokenizeByCharacter(e){let t=[],n=0,a=/<picture[^>]*>.*?<\/picture>|<video[^>]*>.*?<\/video>|<[^>]+>/gs,l;for(;null!==(l=a.exec(e));){let a=e.substring(n,l.index);if(a)for(let e of a)t.push(e);t.push(l[0]),n=l.index+l[0].length}for(let a of e.substring(n))t.push(a);return t}tokenizeByWord(e){return e.match(/<picture[^>]*>.*?<\/picture>|<video[^>]*>.*?<\/video>|<[^>]+>|\w+\b|\s+|[^<>\w]/gs)||[]}getSideBySideContents(){if(void 0!==this.sideBySideContents)return this.sideBySideContents;let e="",t="",n=0;this.operationList.forEach(a=>{switch(a.type){case"create":t+=this.dressUpDiffContent("create",this.newTokens.slice(a.newStart,a.newEnd));break;case"delete":{let t=this.oldTokens.slice(a.oldStart,a.oldEnd);e+=this.dressUpDiffContent("delete",t);break}case"equal":{let l=this.newTokens.slice(a.newStart,a.newEnd),r="";for(let e of l){let t=e.match(gh);if(t){n+=1;let a=(t?.groups?.name?.length??0)+1;r+=`${e.slice(0,a)} data-seq="${n}"${e.slice(a)}`}else r+=e}e+=r,t+=r;break}case"replace":e+=this.dressUpDiffContent("delete",this.oldTokens.slice(a.oldStart,a.oldEnd)),t+=this.dressUpDiffContent("create",this.newTokens.slice(a.newStart,a.newEnd));break;default:console.error("Richtext diff error - invalid operation: "+String(a.type))}});let a=[e,t];return this.sideBySideContents=a,a}getUnifiedContent(){if(void 0!==this.unifiedContent)return this.unifiedContent;let e="";return this.operationList.forEach(t=>{switch(t.type){case"create":e+=this.dressUpDiffContent("create",this.newTokens.slice(t.newStart,t.newEnd));break;case"delete":e+=this.dressUpDiffContent("delete",this.oldTokens.slice(t.oldStart,t.oldEnd));break;case"equal":for(let n of this.newTokens.slice(t.newStart,t.newEnd))e+=n;break;case"replace":{let n=this.oldTokens.slice(t.oldStart,t.oldEnd),a=this.newTokens.slice(t.newStart,t.newEnd);if(1===n.length&&1===a.length&&n[0]?.match(gm)&&a[0]?.match(gm)){e+=a[0];break}let l=[],r=[],i=t.newStart;for(let n=t.oldStart;n<t.oldEnd;n++){let a=this.oldTokens[n];if(!a)continue;let o=a?.match(gf);if(o){if([gg,gb].some(e=>a?.match(e))){l.push(a);continue}e+=this.dressUpDiffContent("delete",l),l.splice(0);let n=!1;for(let a=i;a<t.newEnd;a++){let t=this.newTokens[a];if(!t)continue;let l=t?.match(gf);if(l&&l.groups?.name===o.groups?.name&&l.groups?.isEnd===o.groups?.isEnd){n=!0,e+=this.dressUpDiffContent("create",r),e+=t,r.splice(0),i=a+1;break}r.push(t)}n||(e+=a,r.splice(0))}else l.push(a)}i<t.newEnd&&r.push(...this.newTokens.slice(i,t.newEnd)),e+=this.dressUpDiffContent("delete",l),e+=this.dressUpDiffContent("create",r);break}default:console.error("Richtext diff error - invalid operation: "+String(t.type))}}),this.unifiedContent=e,e}};function gy(e){return null==e?"":("string"==typeof e?e:String(e)).replace(/&/g,"").replace(/</g,"").replace(/>/g,"").replace(/"/g,"").replace(/'/g,"")}function gx(e){return e.replace(/\uE001/g,"&amp;").replace(/\uE002/g,"&lt;").replace(/\uE003/g,"&gt;").replace(/\uE004/g,"&quot;").replace(/\uE005/g,"&#39;")}var gw="html-diff",gj=({fromHTML:e,postProcess:t,toHTML:n,tokenizeByCharacter:a})=>{let[l,r]=new gv(e,n,{tokenizeByCharacter:a}).getSideBySideContents();return t&&(l=t(l),r=t(r)),{From:l?(0,p.jsx)("div",{className:`${gw}__diff-old html-diff`,dangerouslySetInnerHTML:{__html:l}}):null,To:r?(0,p.jsx)("div",{className:`${gw}__diff-new html-diff`,dangerouslySetInnerHTML:{__html:r}}):null}},gC=(0,o.createContext)(null),gS=({children:e})=>{let t=(0,o.useRef)(new Set);return(0,o.useEffect)(()=>{let e=e=>{t.current.forEach(({handler:t,ref:n})=>{n.current&&!n.current.contains(e.target)&&t()})};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,p.jsx)(gC,{value:{register:e=>t.current.add(e),unregister:e=>t.current.delete(e)},children:e})},gk=()=>{let e=(0,o.use)(gC);if(!e)throw Error("useClickOutside must be used within a ClickOutsideProvider");return e};function g_(e,t,n=!0){let{register:a,unregister:l}=gk();(0,o.useEffect)(()=>{if(!n||!e.current)return;let r={handler:t,ref:e};return a(r),()=>l(r)},[e,t,n,a,l])}var g$=e=>{let t=(0,g.c)(7),{action:n,disabled:a}=e,{submit:l}=eT(),{t:r}=(0,d.d)(),i;t[0]!==n||t[1]!==l?(i=()=>{l({action:n,method:"PATCH",skipValidation:!0}
43)},t[0]=n,t[1]=l,t[2]=i):i=t[2];let o=i,s;return t[3]!==a||t[4]!==o||t[5]!==r?(s=(0,p.jsx)(pi,{className:`${gD}__save`,disabled:a,onClick:o,children:r("general:save")}),t[3]=a,t[4]=o,t[5]=r,t[6]=s):s=t[6],s},gN=e=>{let t=(0,g.c)(7),{action:n,disabled:a}=e,{submit:l}=eT(),{t:r}=(0,d.d)(),i;t[0]!==n||t[1]!==l?(i=()=>{l({action:n,method:"PATCH",overrides:{_status:"published"},skipValidation:!0})},t[0]=n,t[1]=l,t[2]=i):i=t[2];let o=i,s;return t[3]!==a||t[4]!==o||t[5]!==r?(s=(0,p.jsx)(pi,{className:`${gD}__publish`,disabled:a,onClick:o,children:r("version:publishChanges")}),t[3]=a,t[4]=o,t[5]=r,t[6]=s):s=t[6],s},gP=e=>{let t=(0,g.c)(7),{action:n,disabled:a}=e,{submit:l}=eT(),{t:r}=(0,d.d)(),i;t[0]!==n||t[1]!==l?(i=()=>{l({action:n,method:"PATCH",overrides:{_status:"draft"},skipValidation:!0})},t[0]=n,t[1]=l,t[2]=i):i=t[2];let o=i,s;return t[3]!==a||t[4]!==o||t[5]!==r?(s=(0,p.jsx)(pi,{buttonStyle:"secondary",className:`${gD}__draft`,disabled:a,onClick:o,children:r("version:saveDraft")}),t[3]=a,t[4]=o,t[5]=r,t[6]=s):s=t[6],s},gE=e=>{let{collection:t,collection:{fields:n,labels:{plural:a,singular:l}}={},count:r,drawerSlug:i,ids:s,onSuccess:u,selectAll:f,selectedFields:g,setSelectedFields:b,where:v}=e,{permissions:w,user:j}=aj(),{code:C}=aN(),{closeModal:S}=nN(),{config:{routes:{api:k}}}=(0,c.c)(),{getFormState:$}=cf(),{i18n:N,t:P}=(0,d.d)(),[E,D]=(0,o.useState)(!1),T=(0,m.useRouter)(),A=o.useRef(null),R=w?.collections?.[t.slug],L=(0,m.useSearchParams)(),F=(0,o.useMemo)(()=>(0,H.s)(g.reduce((e,t)=>(e[t.value.path]=!0,e),{})),[g]),O=(0,o.useCallback)(async({formState:e,submitted:n})=>{let a=cR(A),{state:l}=await $({collectionSlug:t.slug,docPermissions:R,docPreferences:null,formState:e,operation:"update",schemaPath:t.slug,select:F,signal:a.signal,skipValidation:!n});return A.current=null,l},[$,t,R,F]);(0,o.useEffect)(()=>{let e=A.current;return()=>{cA(e)}},[]);let M=(0,o.useMemo)(()=>{let e=[];v&&e.push(v);let n=(0,_.d)({collectionConfig:t,search:L.get("search")});return n&&e.push(n),f?e.push(co(L)?.where||{id:{not_equals:""}}):e.push({id:{in:s||[]}}),x.A({locale:C,select:{},where:(0,ee.h)(e)},{addQueryPrefix:!0})},[t,L,f,s,C,v]),I=(0,o.useCallback)(async({dispatchFields:e,formState:n,selected:a})=>{D(!0),b(a||[]);let{state:l}=await $({collectionSlug:t.slug,docPermissions:R,docPreferences:null,formState:n,operation:"update",schemaPath:t.slug,select:(0,H.s)(a.reduce((e,t)=>(e[t.value.path]=!0,e),{})),skipValidation:!0});e({type:"UPDATE_MANY",formState:l}),D(!1)},[$,t.slug,R,b]);return(0,p.jsx)(lT,{collectionSlug:t.slug,currentEditor:j,hasPublishedDoc:!1,id:null,initialData:{},isLocked:!1,lastUpdateTime:0,mostRecentVersionIsAutosaved:!1,unpublishedVersionCount:0,versionCount:0,children:(0,p.jsx)(lA,{value:"update",children:(0,p.jsxs)("div",{className:`${gD}__main`,children:[(0,p.jsxs)("div",{className:`${gD}__header`,children:[(0,p.jsx)("h2",{className:`${gD}__header__title`,children:P("general:editingLabel",{count:r,label:(0,h.s)(r>1?a:l,N)})}),(0,p.jsx)("button",{"aria-label":P("general:close"),className:`${gD}__header__close`,id:`close-drawer__${i}`,onClick:()=>S(i),type:"button",children:(0,p.jsx)(d.a,{})})]}),(0,p.jsxs)(ub,{className:`${gD}__form`,isInitializing:E,onChange:[O],onSuccess:()=>{T.replace(x.A({...co(L),_r:Date.now(),page:f?"1":void 0},{addQueryPrefix:!0})),S(i),"function"==typeof u&&u()},children:[(0,p.jsx)(uY,{fields:n,onChange:I,permissions:R.fields}),0===g.length?null:(0,p.jsx)("div",{className:"render-fields",children:g.map((e,t)=>{let{value:{field:n,fieldPermissions:a,path:l}}=e;return(0,p.jsx)(hB,{clientFieldConfig:n,indexPath:"",parentPath:"",parentSchemaPath:"",path:l,permissions:a},`${l}-${t}`)})}),(0,p.jsx)("div",{className:`${gD}__sidebar-wrap`,children:(0,p.jsx)("div",{className:`${gD}__sidebar`,children:(0,p.jsx)("div",{className:`${gD}__sidebar-sticky-wrap`,children:(0,p.jsx)("div",{className:`${gD}__document-actions`,children:t?.versions?.drafts?(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(gP,{action:(0,y.Q)({apiRoute:k,path:`/${t.slug}${M}&draft=true`}),disabled:0===g.length}),(0,p.jsx)(gN,{action:(0,y.Q)({apiRoute:k,path:`/${t.slug}${M}&draft=true`}),disabled:0===g.length})]}):(0,p.jsx)(g$,{action:(0,y.Q)({apiRoute:k,path:`/${t.slug}${M}`}),disabled:0===g.length})})})})})]})]})})})},gD="edit-many",gT=e=>{let t=(0,g.c)(8),{count:n,selectAll:a,selectedIDs:l,toggleAll:r}=mO(),i;t[0]!==r?(i=()=>r(),t[0]=r,t[1]=i):i=t[1];let o=a===mA.AllAvailable,s;return t[2]!==n||t[3]!==e||t[4]!==l||t[5]!==i||t[6]!==o?(s=(0,p.jsx)(gA,{...e,count:n,ids:l,onSuccess:i,selectAll:o}),t[2]=n,t[3]=e,t[4]=l,t[5]=i,t[6]=o,t[7]=s):s=t[7],s},gA=e=>{let t,n,a=(0,g.c)(16),{collection:l,count:r,ids:i,modalPrefix:s,onSuccess:c,selectAll:u,where:h}=e,{permissions:f}=aj(),{openModal:m}=nN(),{t:b}=(0,d.d)(),v;a[0]===Symbol.for("react.memo_cache_sentinel")?(v=[],a[0]=v):v=a[0];let[y,x]=(0,o.useState)(v),w=f?.collections?.[l.slug],j=`${s?`${s}-`:""}edit-${l.slug}`;if(0===r||!w?.update)return null;if(a[1]===Symbol.for("react.memo_cache_sentinel")?(t=[gD,`${gD}
43__toggle`].filter(Boolean),a[1]=t):t=a[1],a[2]!==l||a[3]!==r||a[4]!==j||a[5]!==i||a[6]!==c||a[7]!==m||a[8]!==u||a[9]!==y||a[10]!==b||a[11]!==h){let e;a[13]!==j||a[14]!==m?(e=()=>{m(j),x([])},a[13]=j,a[14]=m,a[15]=e):e=a[15],n=(0,p.jsxs)("div",{className:t.join(" "),children:[(0,p.jsx)(mB,{"aria-label":b("general:edit"),onClick:e,children:b("general:edit")}),(0,p.jsx)(ns,{children:(0,p.jsx)(au,{Header:null,slug:j,children:(0,p.jsx)(gE,{collection:l,count:r,drawerSlug:j,ids:i,onSuccess:c,selectAll:u,selectedFields:y,setSelectedFields:x,where:h})})})]}),a[2]=l,a[3]=r,a[4]=j,a[5]=i,a[6]=c,a[7]=m,a[8]=u,a[9]=y,a[10]=b,a[11]=h,a[12]=n}else n=a[12];return n};function gR(e){let t=(0,g.c)(3),n=nc(),a;return t[0]!==n||t[1]!==e?(a=(0,p.jsx)(nq,{closeOnBlur:!1,...e,style:{...e.style||{},zIndex:`calc(100 + ${n||0} + 1)`}}),t[0]=n,t[1]=e,t[2]=a):a=t[2],a}function gL(e){let t=(0,g.c)(16),{id:n,highlightField:a,icon:l,setKey:r,willInvalidateExistingKey:i}=e,s=void 0===i||i,{id:c}=lE(),{toggleModal:u}=nN(),{t:h}=(0,d.d)(),f=`generate-confirmation-${c}`,m;t[0]!==a||t[1]!==r||t[2]!==h?(m=async()=>{await r()!==!1&&(e3.success(h("authentication:newAPIKeyGenerated")),a(!0))},t[0]=a,t[1]=r,t[2]=h,t[3]=m):m=t[3];let b=m,v;if(t[4]!==c||t[5]!==b||t[6]!==l||t[7]!==n||t[8]!==f||t[9]!==h||t[10]!==u||t[11]!==s){let e;t[13]!==f||t[14]!==u?(e=()=>{u(f)},t[13]=f,t[14]=u,t[15]=e):e=t[15],v=(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(tN,{"aria-label":l?h("authentication:generateNewAPIKey"):void 0,buttonStyle:l?"none":"secondary",className:l?"api-key__regenerate-button":void 0,icon:l,id:n,onClick:e,size:"small",children:!l&&h("authentication:generateNewAPIKey")}),(0,p.jsx)(ag,{body:s?(0,p.jsx)(pu,{elements:{1:gF},i18nKey:"authentication:generatingNewAPIKeyWillInvalidate",t:h}):(0,p.jsxs)("span",{children:["Are you sure you want to generate an API key for user ",(0,p.jsx)("strong",{children:c}),"? This will take effect immediately."]}),confirmLabel:h("authentication:generate"),heading:h("authentication:confirmGeneration"),modalSlug:f,onConfirm:b})]}),t[4]=c,t[5]=b,t[6]=l,t[7]=n,t[8]=f,t[9]=h,t[10]=u,t[11]=s,t[12]=v}else v=t[12];return v}function gF(e){let{children:t}=e;return(0,p.jsx)("strong",{children:t})}function gO(e){let t=(0,g.c)(4),{permissions:n}=e,{setPermissions:a}=aj(),l,r;return t[0]!==n||t[1]!==a?(l=()=>{a(n)},r=[n,a],t[0]=n,t[1]=a,t[2]=l,t[3]=r):(l=t[2],r=t[3]),(0,o.useEffect)(l,r),null}var gM="dots",gI=({ariaLabel:e,className:t,noBackground:n,orientation:a="vertical"})=>(0,p.jsxs)("div",{"aria-label":e,className:[t,gM,n&&`${gM}--no-background`,a&&`${gM}--${a}`].filter(Boolean).join(" "),children:[(0,p.jsx)("div",{}),(0,p.jsx)("div",{}),(0,p.jsx)("div",{})]}),gB=({className:e})=>(0,p.jsx)("svg",{className:["icon","icon--people",e].filter(Boolean).join(" "),fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M14 16C14 14.5855 13.4381 13.229 12.4379 12.2288C11.4377 11.2286 10.0812 10.6667 8.66668 10.6667M8.66668 10.6667C7.25219 10.6667 5.89563 11.2286 4.89544 12.2288C3.89525 13.229 3.33334 14.5855 3.33334 16M8.66668 10.6667C10.5076 10.6667 12 9.17428 12 7.33333C12 5.49238 10.5076 4 8.66668 4C6.82573 4 5.33334 5.49238 5.33334 7.33333C5.33334 9.17428 6.82573 10.6667 8.66668 10.6667ZM16.6667 15.3333C16.6667 13.0867 15.3333 11 14 10C14.4383 9.67118 14.7888 9.23939 15.0204 8.74285C15.252 8.2463 15.3577 7.70031 15.328 7.1532C15.2984 6.60609 15.1343 6.07472 14.8503 5.60613C14.5664 5.13754 14.1713 4.74617 13.7 4.46667",strokeLinecap:"round",strokeLinejoin:"round"})}),gz="active-query-preset";function gU(e){let t=(0,g.c)(11),{activePreset:n,openPresetListDrawer:a,resetPreset:l}=e,{i18n:r,t:i}=(0,d.d)(),{getEntityConfig:o}=(0,c.c)(),s;if(t[0]!==n||t[1]!==o||t[2]!==r||t[3]!==a||t[4]!==l||t[5]!==i){let e,c=o({collectionSlug:"payload-query-presets"}),u=n&&`${gz}--active`,f;
43t[7]!==u?(f=[gz,u].filter(Boolean),t[7]=u,t[8]=f):f=t[8],t[9]!==a?(e=()=>{a()},t[9]=a,t[10]=e):e=t[10],s=(0,p.jsx)(ra,{className:f.join(" "),id:"select-preset",onClick:e,pillStyle:"light",size:"small",children:(0,p.jsxs)("div",{className:`${gz}__label`,children:[n?.isShared&&(0,p.jsx)(gB,{className:`${gz}__shared`}),(0,p.jsx)("div",{className:`${gz}__label-text-max-width`,children:(0,p.jsx)("div",{className:`${gz}__label-text`,children:n?.title||i("general:selectLabel",{label:(0,h.s)(c.labels.singular,r)})})}),n?(0,p.jsx)("div",{className:`${gz}__clear`,id:"clear-preset",onClick:async e=>{e.stopPropagation(),await l()},onKeyDown:async e=>{("Enter"===e.key||" "===e.key)&&(e.stopPropagation(),await l())},role:"button",tabIndex:0,children:(0,p.jsx)(d.a,{})}):null]})}),t[0]=n,t[1]=o,t[2]=r,t[3]=a,t[4]=l,t[5]=i,t[6]=s}else s=t[6];return s}var gV="confirm-delete-preset",gH="payload-query-presets",gq="query-preset-bar",gW=({activePreset:e,collectionSlug:t,queryPresetPermissions:n})=>{let{modified:a,query:l,refineListData:r,setModified:i}=cc(),{i18n:s,t:u}=(0,d.d)(),{openModal:f}=nN(),{config:{routes:{api:m}},getEntityConfig:g}=(0,c.c)(),b=g({collectionSlug:gH}),[v,,{openDrawer:x}]=cV({id:e?.id,collectionSlug:gH}),[w,,{closeDrawer:j,openDrawer:C}]=cV({collectionSlug:gH}),[S,,{closeDrawer:k,openDrawer:_}]=dO({collectionSlugs:[gH],filterOptions:(0,o.useMemo)(()=>({"payload-query-presets":{isTemp:{not_equals:!0},relatedCollection:{equals:t}}}),[t]),selectedCollection:gH}),N=(0,o.useCallback)(async e=>{await r({columns:e.columns?(0,$.F)(e.columns):void 0,groupBy:e.groupBy||"",preset:e.id,where:e.where},!1)},[r]),P=(0,o.useCallback)(async()=>{await r({columns:[],groupBy:"",preset:"",where:{}},!1)},[r]),E=(0,o.useCallback)(async()=>{try{await fetch((0,y.Q)({apiRoute:m,path:`/${gH}/${e.id}`}),{method:"DELETE"}).then(async t=>{try{let n=await t.json();t.status<400?(e3.success(u("general:titleDeleted",{label:(0,h.s)(b?.labels?.singular,s),title:e.title})),await P()):n.errors?n.errors.forEach(e=>e3.error(e.message)):e3.error(u("error:deletingTitle",{title:e.title}))}catch{e3.error(u("error:deletingTitle",{title:e.title}))}})}catch{e3.error(u("error:deletingTitle",{title:e.title}))}},[m,e?.id,e?.title,u,b,s,P]),D=(0,o.useCallback)(async()=>{try{await fetch((0,y.Q)({apiRoute:m,path:`/${gH}/${e.id}`}),{body:JSON.stringify({columns:(0,$.l)(l.columns),groupBy:l.groupBy,where:l.where}),credentials:"include",headers:{"Content-Type":"application/json"},method:"PATCH"}).then(async e=>{try{let t=await e.json();e.status<400?(e3.success(u("general:updatedLabelSuccessfully",{label:(0,h.s)(b?.labels?.singular,s)})),i(!1)):t.errors?t.errors.forEach(e=>e3.error(e.message)):e3.error(u("error:unknown"))}catch{e3.error(u("error:unknown"))}})}catch{e3.error(u("error:unknown"))}},[m,e?.id,l.columns,l.groupBy,l.where,u,b?.labels?.singular,s,i]),T=e&&a;return(0,p.jsxs)(o.Fragment,{children:[(0,p.jsxs)("div",{className:gq,children:[(0,p.jsxs)("div",{className:`${gq}__menu`,children:[(0,p.jsx)(gU,{activePreset:e,openPresetListDrawer:_,resetPreset:P}),(0,p.jsx)(ra,{"aria-label":u("general:newLabel",{label:b?.labels?.singular}),className:`${gq}__create-new-preset`,icon:(0,p.jsx)(td,{}),id:"create-new-preset",onClick:()=>{C()},size:"small"})]}),(0,p.jsxs)("div",{className:`${gq}__menu-items`,children:[T&&(0,p.jsx)(mB,{id:"reset-preset",onClick:async()=>{await r({columns:(0,$.F)(e.columns),groupBy:e.groupBy||"",where:e.where},!1)},type:"button",children:u("general:reset")},"reset"),T&&n.update&&(0,p.jsx)(mB,{id:"save-preset",onClick:async()=>{await D()},type:"button",children:e?.isShared?u("general:updateForEveryone"):u("fields:saveChanges")},"save"),e&&n?.delete&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(mB,{id:"delete-preset",onClick:()=>f(gV),type:"button",children:u("general:deleteLabel",{label:b?.labels?.singular})}),(0,p.jsx)(mB,{id:"edit-preset",onClick:()=>{x()},type:"button",children:u("general:editLabel",{label:b?.labels?.singular})})]})]})]}),(0,p.jsx)(w,{initialData:{columns:(0,$.l)(l.columns),groupBy:l.groupBy,relatedCollection:t,where:l.where},onSave:async({doc:e})=>{j(),await N(e)},redirectAfterCreate:!1}),(0,p.jsx)(ag,{body:(0,p.jsx)(pu,{elements:{1:({children:e})=>(0,p.jsx)("strong",{children:e})}
43,i18nKey:"general:aboutToDelete",t:u,variables:{label:b?.labels?.singular,title:e?.title}}),confirmingLabel:u("general:deleting"),heading:u("general:confirmDeletion"),modalSlug:gV,onConfirm:E}),(0,p.jsx)(v,{onDelete:()=>{},onDuplicate:async({doc:e})=>{await N(e)},onSave:async({doc:e})=>{await N(e)}}),(0,p.jsx)(S,{allowCreate:!1,disableQueryPresets:!0,onSelect:async({doc:e})=>{k(),await N(e)}})]})},gK="search-filter";function gQ(e){let{handleChange:t,initialParams:n,label:a,searchQueryParam:l}=e,r=n?.search||l,[i,s]=(0,o.useState)("string"==typeof r?r:void 0),c=(0,o.useRef)(!0),d=(0,o.useRef)("string"==typeof r?r:void 0),u=cW(i,300);return(0,o.useEffect)(()=>(r!==d.current&&(c.current=!1,s(r),d.current=r),()=>{c.current=!0,d.current=void 0}),[r]),(0,o.useEffect)(()=>{u!==d.current&&c.current&&(t&&t(u),d.current=u)},[u,t]),(0,p.jsx)("div",{className:gK,children:(0,p.jsx)("input",{"aria-label":a,className:`${gK}__input`,id:"search-filter-input",onChange:e=>{c.current=!0,s(e.target.value)},placeholder:a,type:"text",value:i||""})})}var gY="search-bar";function gG({Actions:e,className:t,label:n="Search...",onSearchChange:a,searchQueryParam:l}){return(0,p.jsxs)("div",{className:[gY,t].filter(Boolean).join(" "),children:[(0,p.jsx)(rh,{}),(0,p.jsx)(gQ,{handleChange:a,label:n,searchQueryParam:l}),e&&e.length>0?(0,p.jsx)("div",{className:`${gY}__actions`,children:e}):null]})}var gX="list-controls",gZ=e=>{let{beforeActions:t,collectionConfig:n,collectionSlug:a,disableQueryPresets:l,enableColumns:r=!0,enableFilters:i=!0,enableSort:s=!1,listMenuItems:c,queryPreset:u,queryPresetPermissions:f,renderedFilters:m,resolvedFilterOptions:g}=e,{handleSearchChange:v,query:y}=cc(),x=h7(n),{i18n:w,t:j}=(0,d.d)(),{breakpoints:{s:C}}=hi(),S=(x&&(0,h.s)("label"in x&&("string"==typeof x.label||"object"==typeof x.label)?x.label:"name"in x?x.name:null,w))??"ID",_=((e,t,n)=>{if(e){let a=(0,k.L)(t,{i18n:n,moveSubFieldsToTop:!0}),l=new Set(e),r=[];for(let e of a)(0,b.Z7)(e)&&l.has(e.name)&&(r.push(e),l.delete(e.name));return r}return null})(n.admin.listSearchableFields,n.fields,w),$=(0,o.useMemo)(()=>_?.length>0?_.reduce((e,t,n)=>{let a="label"in t&&t.label?t.label:"name"in t?t.name:null;return 0===n?`${j("general:searchBy",{label:(0,h.s)(a,w)})}`:n===_.length-1?`${e} ${j("general:or")} ${(0,h.s)(a,w)}`:`${e}, ${(0,h.s)(a,w)}`},""):j("general:searchBy",{label:(0,h.s)(S,w)}),[j,_,w,S]),N=(0,o.useRef)(!!y?.where),P=(0,X.Q)(y?.where),[E,D]=(0,o.useState)(P?"where":void 0);return(0,o.useEffect)(()=>{N.current&&!y?.where?N.current=!1:y?.where&&(N.current=!0)},[D,y?.where]),(0,p.jsxs)("div",{className:gX,children:[n?.enableQueryPresets&&!l&&(0,p.jsx)(gW,{activePreset:u,collectionSlug:a,queryPresetPermissions:f}),(0,p.jsx)(gG,{Actions:[!C&&(0,p.jsx)(o.Fragment,{children:t&&t},"before-actions"),r&&(0,p.jsx)(ra,{"aria-controls":`${gX}-columns`,"aria-expanded":"columns"===E,className:`${gX}__toggle-columns`,icon:(0,p.jsx)(to,{direction:"columns"===E?"up":"down"}),id:"toggle-list-columns",onClick:()=>D("columns"!==E?"columns":void 0),pillStyle:"light",size:"small",children:j("general:columns")},"toggle-list-columns"),i&&(0,p.jsx)(ra,{"aria-controls":`${gX}-where`,"aria-expanded":"where"===E,className:`${gX}__toggle-where`,icon:(0,p.jsx)(to,{direction:"where"===E?"up":"down"}),id:"toggle-list-filters",onClick:()=>D("where"!==E?"where":void 0),pillStyle:"light",size:"small",children:j("general:filters")},"toggle-list-filters"),s&&(0,p.jsx)(ra,{"aria-controls":`${gX}-sort`,"aria-expanded":"sort"===E,className:`${gX}__toggle-sort`,icon:(0,p.jsx)(to,{}),id:"toggle-list-sort",onClick:()=>D("sort"!==E?"sort":void 0),pillStyle:"light",size:"small",children:j("general:sort")},"toggle-list-sort"),n.admin.groupBy&&(0,p.jsx)(ra,{"aria-controls":`${gX}-group-by`,"aria-expanded":"group-by"===E,className:`${gX}__toggle-group-by`,icon:(0,p.jsx)(to,{direction:"group-by"===E?"up":"down"}),id:"toggle-group-by",onClick:()=>D("group-by"!==E?"group-by":void 0),pillStyle:"light",size:"small",children:j("general:groupByLabel",{label:""})},"toggle-group-by"),c&&Array.isArray(c)&&c.length>0&&(0,p.jsx)(tC,{button:(0,p.jsx)(gI,{ariaLabel:j("general:moreOptions")}),className:`${gX}__popup`,horizontalAlign:"right",id:"list-menu",size:"small",verticalAlign:"bottom",children:(0,p.jsx)(tp.ButtonGroup,{children:c.map((e,t)=>(0,p.jsx)(o.Fragment,{children:e},`list-menu-item-${t}`))})}
43,"list-menu")].filter(Boolean),label:$,onSearchChange:v,searchQueryParam:y?.search},a),r&&(0,p.jsx)(l2,{className:`${gX}__columns`,height:"columns"===E?"auto":0,id:`${gX}-columns`,children:(0,p.jsx)(cw,{collectionSlug:n.slug})}),(0,p.jsx)(l2,{className:`${gX}__where`,height:"where"===E?"auto":0,id:`${gX}-where`,children:(0,p.jsx)(fH,{collectionPluralLabel:n?.labels?.plural,collectionSlug:n.slug,fields:n?.fields,renderedFilters:m,resolvedFilterOptions:g})}),n.admin.groupBy&&(0,p.jsx)(l2,{className:`${gX}__group-by`,height:"group-by"===E?"auto":0,id:`${gX}-group-by`,children:(0,p.jsx)(fQ,{collectionSlug:n.slug,fields:n.fields})})]})};function gJ(e){let{collection:t,collection:{slug:n,labels:{plural:a,singular:l}}={},drawerSlug:r,ids:i,onSuccess:s,selectAll:u,where:f}=e,{clearRouteCache:g}=pr(),{config:{routes:{api:b}}}=(0,c.c)(),{code:v}=aN(),w=(0,m.useRouter)(),j=(0,m.useSearchParams)(),{i18n:C,t:S}=(0,d.d)(),k=(0,o.useCallback)(()=>{e3.error(S("error:unknown"))},[S]),$=o.useMemo(()=>{let e=[{_status:{not_equals:"published"}}];f&&e.push(f);let n=(0,_.d)({collectionConfig:t,search:j.get("search")});return n&&e.push(n),u?e.push(co(j)?.where||{id:{not_equals:""}}):e.push({id:{in:i||[]}}),x.A({locale:v,select:{},where:(0,ee.h)(e)},{addQueryPrefix:!0})},[t,j,u,i,v,f]),N=(0,o.useCallback)(async()=>{let e=(0,y.Q)({apiRoute:b,path:`/${n}${$}&draft=true`});await ay.patch(e,{body:JSON.stringify({_status:"published"}),headers:{"Accept-Language":C.language,"Content-Type":"application/json"}}).then(async e=>{try{let t=await e.json(),n=t?.docs.length||0,r=n>1?a:l;return e.status<400||n>0?(e3.success(S("general:updatedCountSuccessfully",{count:n,label:(0,h.s)(r,C)})),t?.errors.length>0&&e3.error(t.message,{description:t.errors.map(e=>e.message).join(`
44`)}),w.replace(x.A({...co(j),page:u?"1":void 0},{addQueryPrefix:!0})),g(),"function"==typeof s&&s(),null):(t.errors?t.errors.forEach(e=>e3.error(e.message)):k(),!1)}catch{return k()}})},[b,n,$,C,a,l,S,w,j,u,g,k,s]);return(0,p.jsx)(ag,{body:S("version:aboutToPublishSelection",{label:(0,h.s)(a,C)}),cancelLabel:S("general:cancel"),confirmingLabel:S("version:publishing"),confirmLabel:S("general:confirm"),heading:S("version:confirmPublish"),modalSlug:r,onConfirm:N})}var g0=e=>{let t=(0,g.c)(8),{count:n,selectAll:a,selectedIDs:l,toggleAll:r}=mO(),i;t[0]!==r?(i=()=>r(),t[0]=r,t[1]=i):i=t[1];let o=a===mA.AllAvailable,s;return t[2]!==n||t[3]!==e||t[4]!==l||t[5]!==i||t[6]!==o?(s=(0,p.jsx)(g1,{...e,count:n,ids:l,onSuccess:i,selectAll:o}),t[2]=n,t[3]=e,t[4]=l,t[5]=i,t[6]=o,t[7]=s):s=t[7],s},g1=e=>{let t,n=(0,g.c)(12),{collection:a,collection:l,count:r,ids:i,modalPrefix:s,onSuccess:c,selectAll:u,where:h}=e,{slug:f,versions:m}=void 0===l?{}:l,{permissions:b}=aj(),{t:v}=(0,d.d)(),{openModal:y}=nN(),x=b?.collections?.[f]?.update,w=`${s?`${s}-`:""}publish-${f}`;if(!m?.drafts||0===r||!x)return null;if(n[0]!==a||n[1]!==w||n[2]!==i||n[3]!==c||n[4]!==y||n[5]!==u||n[6]!==v||n[7]!==h){let e;n[9]!==w||n[10]!==y?(e=()=>{y(w)},n[9]=w,n[10]=y,n[11]=e):e=n[11],t=(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(mB,{"aria-label":v("version:publish"),onClick:e,children:v("version:publish")}),(0,p.jsx)(gJ,{collection:a,drawerSlug:w,ids:i,onSuccess:c,selectAll:u,where:h})]}),n[0]=a,n[1]=w,n[2]=i,n[3]=c,n[4]=y,n[5]=u,n[6]=v,n[7]=h,n[8]=t}else t=n[8];return t},g3="confirm-restore-many-docs",g2="restore-many",g6=e=>{let{collection:{slug:t}={},viewType:n}=e,{permissions:a}=aj(),{config:{collections:l,routes:r,serverURL:i}}=(0,c.c)(),{code:s}=aN(),u=(0,m.useRouter)(),{clearRouteCache:f}=pr(),g=(0,m.useSearchParams)(),{count:b,getSelectedIds:v,selectAll:w,toggleAll:j}=mO(),{openModal:C}=nN(),{i18n:S,t:k}=(0,d.d)(),[$,N]=o.useState(!1),P=a?.collections?.[t]?.update;if(w===mA.None||!P||"trash"!==n)return null;let E=w===mA.AllAvailable,D=E?[]:v(),T=co(g)?.where,A={and:[...Array.isArray(T?.and)?T.and:T?[T]:[],{deletedAt:{exists:!0}}]},R=async()=>{let e,n=l.find(e=>e.slug===t);if(!n)return;e=E?A:{and:[{id:{in:D}},{deletedAt:{exists:!0}}]};let a=(0,y.Q)({apiRoute:r.api,path:`/${t}${x.A({limit:0,locale:s,select:{},trash:!0,where:(0,_.d)({collectionConfig:n,search:co(g)?.search,where:e})},{addQueryPrefix:!0})}`}),i={deletedAt:null};n?.versions?.drafts&&(i._status=$?"published":"draft");let o=await ay.patch(a,{body:JSON.stringify(i),headers:{"Accept-Language":S.language,"Content-Type":"application/json"}});try{let{plural:e,singular:t}=n.labels,a=await o.json(),l=a?.docs?.length||0;(o.status<400||l>0)&&e3.success(k("general:restoredCountSuccessfully",{count:l,label:(0,h.s)(l>1?e:t,S)})),a?.errors?.length>0&&e3.error(a.message,{description:a.errors.map(e=>e.message).join(`
45`)})}catch{e3.error(k("error:unknown"))}j(),u.replace(x.A({...co(g),page:E?"1":void 0},{addQueryPrefix:!0})),f()},L=l.find(({slug:e})=>e===t),F=(0,h.s)(1===b?L.labels.singular:L.labels.plural,S);return(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(mB,{"aria-label":k("general:restore"),className:"restore-documents__toggle",onClick:()=>{C(g3)},children:k("general:restore")}),(0,p.jsx)(ag,{body:(0,p.jsxs)(o.Fragment,{children:[k(L?.versions?.drafts?"general:aboutToRestoreAsDraftCount":"general:aboutToRestoreCount",{count:b,label:F}),L?.versions?.drafts&&(0,p.jsx)("div",{className:`${g2}
45__checkbox`,children:(0,p.jsx)(lY,{checked:$,id:"restore-as-published-many",label:k("general:restoreAsPublished"),name:"restore-as-published-many",onToggle:e=>N(e.target.checked)})})]}),className:g2,confirmingLabel:k("general:restoring"),heading:k("general:confirmRestoration"),modalSlug:g3,onConfirm:R})]})};function g5(e){let{collection:t,collection:{slug:n,labels:{plural:a,singular:l}}={},drawerSlug:r,ids:i,onSuccess:s,selectAll:u,where:f}=e,{config:{routes:{api:g}}}=(0,c.c)(),{code:b}=aN(),{i18n:v,t:w}=(0,d.d)(),j=(0,m.useSearchParams)(),C=(0,m.useRouter)(),{clearRouteCache:S}=pr(),k=(0,o.useCallback)(()=>{e3.error(w("error:unknown"))},[w]),$=o.useMemo(()=>{let e=[{_status:{not_equals:"draft"}}];f&&e.push(f);let n=(0,_.d)({collectionConfig:t,search:j.get("search")});return n&&e.push(n),u||e.push({id:{in:i||[]}}),x.A({locale:b,select:{},where:(0,ee.h)(e)},{addQueryPrefix:!0})},[t,j,u,i,b,f]),N=(0,o.useCallback)(async()=>{let e=(0,y.Q)({apiRoute:g,path:`/${n}${$}`});await ay.patch(e,{body:JSON.stringify({_status:"draft"}),headers:{"Accept-Language":v.language,"Content-Type":"application/json"}}).then(async e=>{try{let t=await e.json(),n=t?.docs.length||0,r=n>1?a:l;return e.status<400||n>0?(e3.success(w("general:updatedCountSuccessfully",{count:n,label:(0,h.s)(r,v)})),t?.errors.length>0&&e3.error(t.message,{description:t.errors.map(e=>e.message).join(`
46`)}),C.replace(x.A({...co(j),page:u?"1":void 0},{addQueryPrefix:!0})),S(),"function"==typeof s&&s(),null):(t.errors?t.errors.forEach(e=>e3.error(e.message)):k(),!1)}catch{return k()}})},[g,n,$,v,a,l,w,C,j,u,S,k,s]);return(0,p.jsx)(ag,{body:w("version:aboutToUnpublishSelection",{label:(0,h.s)(a,v)}),confirmingLabel:w("version:unpublishing"),heading:w("version:confirmUnpublish"),modalSlug:r,onConfirm:N})}var g4=e=>{let t=(0,g.c)(8),{count:n,selectAll:a,selectedIDs:l,toggleAll:r}=mO(),i;t[0]!==r?(i=()=>r(),t[0]=r,t[1]=i):i=t[1];let o=a===mA.AllAvailable,s;return t[2]!==n||t[3]!==e||t[4]!==l||t[5]!==i||t[6]!==o?(s=(0,p.jsx)(g8,{...e,count:n,ids:l,onSuccess:i,selectAll:o}),t[2]=n,t[3]=e,t[4]=l,t[5]=i,t[6]=o,t[7]=s):s=t[7],s},g8=e=>{let t,n=(0,g.c)(12),{collection:a,collection:l,count:r,ids:i,modalPrefix:s,onSuccess:c,selectAll:u,where:h}=e,{slug:f,versions:m}=void 0===l?{}:l,{t:b}=(0,d.d)(),{permissions:v}=aj(),{toggleModal:y}=nN(),x=v?.collections?.[f]?.update,w=`${s?`${s}-`:""}unpublish-${f}`;if(!m?.drafts||0===r||!x)return null;if(n[0]!==a||n[1]!==w||n[2]!==i||n[3]!==c||n[4]!==u||n[5]!==b||n[6]!==y||n[7]!==h){let e;n[9]!==w||n[10]!==y?(e=()=>{y(w)},n[9]=w,n[10]=y,n[11]=e):e=n[11],t=(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(mB,{"aria-label":b("version:unpublish"),onClick:e,children:b("version:unpublish")}),(0,p.jsx)(g5,{collection:a,drawerSlug:w,ids:i,onSuccess:c,selectAll:u,where:h})]}),n[0]=a,n[1]=w,n[2]=i,n[3]=c,n[4]=u,n[5]=b,n[6]=y,n[7]=h,n[8]=t}else t=n[8];return t},g7=e=>{let t=(0,g.c)(21),{collectionConfig:n,disableBulkDelete:a,disableBulkEdit:l,hasDeletePermission:r,hasTrashPermission:i,label:s,modalPrefix:c,showSelectAllAcrossPages:u,viewType:h,where:f}=e,m=void 0===u||u,{count:b,selectAll:v,selectedIDs:y,toggleAll:x,totalDocs:w}=mO(),{t:j}=(0,d.d)(),C;t[0]!==x?(C=()=>x(),t[0]=x,t[1]=C):C=t[1];let S=C;if(0===b)return null;let k=n?.trash&&"trash"===h,_;return t[2]!==n||t[3]!==b||t[4]!==a||t[5]!==l||t[6]!==r||t[7]!==i||t[8]!==k||t[9]!==s||t[10]!==c||t[11]!==S||t[12]!==v||t[13]!==y||t[14]!==m||t[15]!==j||t[16]!==x||t[17]!==w||t[18]!==h||t[19]!==f?(_=(0,p.jsx)(mI,{count:b,ListActions:[v!==mA.AllAvailable&&b<w&&!1!==m?(0,p.jsx)(mB,{"aria-label":j("general:selectAll",{count:`(${w})`,label:s}),id:"select-all-across-pages",onClick:()=>x(!0),children:j("general:selectAll",{count:`(${w})`,label:""})},"select-all"):null].filter(Boolean),SelectionActions:[!l&&!k&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(gA,{collection:n,count:b,ids:y,modalPrefix:c,onSuccess:S,selectAll:v===mA.AllAvailable,where:f}),(0,p.jsx)(g1,{collection:n,count:b,ids:y,modalPrefix:c,onSuccess:S,selectAll:v===mA.AllAvailable,where:f}),(0,p.jsx)(g8,{collection:n,count:b,ids:y,modalPrefix:c,onSuccess:S,selectAll:v===mA.AllAvailable,where:f})]}
46,"bulk-actions"),k&&(0,p.jsx)(g6,{collection:n,viewType:h},"bulk-restore"),!a&&(0,p.jsx)(mz,{collection:n,hasDeletePermission:r,hasTrashPermission:i,modalPrefix:c,viewType:h},"bulk-delete")].filter(Boolean)}),t[2]=n,t[3]=b,t[4]=a,t[5]=l,t[6]=r,t[7]=i,t[8]=k,t[9]=s,t[10]=c,t[11]=S,t[12]=v,t[13]=y,t[14]=m,t[15]=j,t[16]=x,t[17]=w,t[18]=h,t[19]=f,t[20]=_):_=t[20],_};function g9({slug:e,className:t}){let{closeModal:n}=nN(),{t:a}=(0,d.d)();return(0,p.jsx)("button",{"aria-label":a("general:close"),className:["close-modal-button",t].filter(Boolean).join(" "),onClick:()=>{n(e)},type:"button",children:(0,p.jsx)(d.a,{})},"close-button")}var be="default-list-view-tabs",bt=e=>{let t,n=(0,g.c)(20),{collectionConfig:a,config:l,onChange:r,viewType:i}=e,{i18n:o,t:s}=(0,d.d)(),{setPreference:c}=lS(),u=(0,m.useRouter)(),f=a.trash,b=a.folders&&l.folders;if(!f&&!b)return null;n[0]!==a.slug||n[1]!==l||n[2]!==r||n[3]!==u||n[4]!==c?(t=async e=>{r&&r(e),("list"===e||"folders"===e)&&await c(`collection-${a.slug}`,{listViewType:e});let t=`/collections/${a.slug}`;switch(e){case"folders":l.folders&&(t=`/collections/${a.slug}/${l.folders.slug}`);break;case"trash":t=`/collections/${a.slug}/trash`}let n=(0,y.Q)({adminRoute:l.routes.admin,path:t});u.push(n)},n[0]=a.slug,n[1]=l,n[2]=r,n[3]=u,n[4]=c,n[5]=t):t=n[5];let v=t,x=`${s("general:all")} ${(0,h.s)(a?.labels?.plural,o)}`,w;if(n[6]!==x||n[7]!==a.labels?.plural||n[8]!==v||n[9]!==o||n[10]!==b||n[11]!==f||n[12]!==s||n[13]!==i){let e,t;n[15]===Symbol.for("react.memo_cache_sentinel")?(e=/\s+/g,n[15]=e):e=n[15];let l=x.toLowerCase().replace(e,"-"),r="list"===i&&`${be}__button--active`,c;n[16]!==r?(c=[`${be}__button`,r].filter(Boolean),n[16]=r,n[17]=c):c=n[17],n[18]!==v?(t=()=>v("list"),n[18]=v,n[19]=t):t=n[19],w=(0,p.jsxs)("div",{className:be,children:[(0,p.jsxs)(tN,{buttonStyle:"tab",className:c.join(" "),disabled:"list"===i,el:"button",id:l,onClick:t,children:[s("general:all")," ",(0,h.s)(a?.labels?.plural,o)]}),b&&(0,p.jsx)(tN,{buttonStyle:"tab",className:[`${be}__button`,"folders"===i&&`${be}__button--active`].filter(Boolean).join(" "),disabled:"folders"===i,el:"button",onClick:()=>v("folders"),children:s("folder:byFolder")}),f&&(0,p.jsx)(tN,{buttonStyle:"tab",className:[`${be}__button`,"trash"===i&&`${be}__button--active`].filter(Boolean).join(" "),disabled:"trash"===i,el:"button",id:"trash-view-pill",onClick:()=>v("trash"),children:s("general:trash")})]}),n[6]=x,n[7]=a.labels?.plural,n[8]=v,n[9]=o,n[10]=b,n[11]=f,n[12]=s,n[13]=i,n[14]=w}else w=n[14];return w},bn="list-header",ba=e=>(0,p.jsxs)("header",{className:[bn,e.className].filter(Boolean).join(" "),children:[(0,p.jsxs)("div",{className:`${bn}__content`,children:[(0,p.jsxs)("div",{className:`${bn}__title-and-actions`,children:[(0,p.jsx)("h1",{className:`${bn}__title`,children:e.title}),e.TitleActions.length?(0,p.jsx)("div",{className:`${bn}__title-actions`,children:e.TitleActions}):null]}),e.Actions.length?(0,p.jsx)("div",{className:`${bn}__actions`,children:e.Actions}):null]}),e.AfterListHeaderContent?(0,p.jsx)("div",{className:`${bn}__after-header-content`,children:e.AfterListHeaderContent}):null]}),bl=()=>{let e=(0,g.c)(12),{i18n:t,t:n}=(0,d.d)(),{config:a,getEntityConfig:l}=(0,c.c)(),{collections:r}=a,{enabledCollections:i,selectedOption:o,setSelectedOption:s}=ci(),u;if(e[0]!==r||e[1]!==i||e[2]!==l||e[3]!==t||e[4]!==o||e[5]!==s||e[6]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a;e[8]!==i?(a=e=>{let{slug:t}=e;return i.includes(t)},e[8]=i,e[9]=a):a=e[9];let c=r.filter(a);if(c.length>1){let a=l({collectionSlug:o.value}),r;e[10]!==t?(r=e=>({label:(0,h.s)(e.labels.singular,t),value:e.slug}),e[10]=t,e[11]=r):r=e[11],u=(0,p.jsxs)("div",{className:"list-drawer__select-collection-wrap",children:[(0,p.jsx)(aD,{label:n("upload:selectCollectionToBrowse")}),(0,p.jsx)(sZ,{className:`${bn}__select-collection`,isClearable:!1,onChange:s,options:c.map(r),value:{label:(0,h.s)(a?.labels.singular,t),value:a?.slug}})]});break e}}e[0]=r,e[1]=i,e[2]=l,e[3]=t,e[4]=o,e[5]=s,e[6]=n,e[7]=u}else u=e[7];return u!==Symbol.for("react.early_return_sentinel")?u:null};function br(e){let t,n=(0,g.c)(3),{hasCreatePermission:a}=e,{DocumentDrawerToggler:l}=ci(),{t:r}=(0,d.d)();return a?(n[0]!==l||n[1]!==r?(t=(0,p.jsx)(l,{className:"list-header__create-new-button",children:(0,p.jsx)(ra,{size:"small",children:r("general:createNew")})},"create-new-button-toggler"),n[0]=l,n[1]=r,n[2]=t):t=n[2],t):null}function bi(e){let t,n=(0,g.c)(14),{collectionSlug:a,hasCreatePermission:l,isBulkUploadEnabled:r,onBulkUploadSuccess:i,openBulkUpload:o}=e,{drawerSlug:s,setCollectionSlug:c,setFolderID:u,setOnSuccess:h}=h$(),{folderID:f}=pn(),{t:b}=(0,d.d)(),{openModal:v}=nN(),y=(0,m.useRouter)(),x;
46n[0]!==s||n[1]!==a||n[2]!==f||n[3]!==i||n[4]!==o||n[5]!==v||n[6]!==y||n[7]!==c||n[8]!==u||n[9]!==h?(x=()=>{"function"==typeof o?o():(c(a),u(f),v(s),h(()=>{"function"==typeof i?i():y.refresh()}))},n[0]=s,n[1]=a,n[2]=f,n[3]=i,n[4]=o,n[5]=v,n[6]=y,n[7]=c,n[8]=u,n[9]=h,n[10]=x):x=n[10];let w=x;return l&&r?(n[11]!==w||n[12]!==b?(t=(0,p.jsx)(tN,{"aria-label":b("upload:bulkUpload"),buttonStyle:"pill",onClick:w,size:"small",children:b("upload:bulkUpload")},"bulk-upload-button"),n[11]=w,n[12]=b,n[13]=t):t=n[13],t):null}function bo(e){let t=(0,g.c)(5),{collectionConfig:n,hasCreatePermission:a,newDocumentURL:l}=e,{i18n:r,t:i}=(0,d.d)();if(!a)return null;let o=n?.labels?.singular,s;return t[0]!==r||t[1]!==l||t[2]!==i||t[3]!==o?(s=(0,p.jsx)(tN,{"aria-label":i("general:createNewLabel",{label:(0,h.s)(o,r)}),buttonStyle:"pill",className:"list-create-new-doc__create-new-button",el:"link",size:"small",to:l,children:i("general:createNew")},"create-new-button"),t[0]=r,t[1]=l,t[2]=i,t[3]=o,t[4]=s):s=t[4],s}var bs="create-new-doc-in-folder";function bc(e){let t,n=(0,g.c)(10),{buttonLabel:a,buttonSize:l,buttonStyle:r,collectionSlugs:i,onRequestCreate:s}=e,u=void 0===l?"small":l,f=void 0===r?"pill":r,{i18n:m}=(0,d.d)(),{config:b}=(0,c.c)(),v;n[0]!==i||n[1]!==b?(v=()=>i.reduce((e,t)=>{let n=b.collections.find(e=>{let{slug:n}=e;return n===t});return n&&e.push(n),e},[]),n[0]=i,n[1]=b,n[2]=v):v=n[2];let[y]=o.useState(v);return 0===y.length?null:(n[3]!==a||n[4]!==u||n[5]!==f||n[6]!==y||n[7]!==m||n[8]!==s?(t=(0,p.jsx)(o.Fragment,{children:1===y.length?(0,p.jsx)(tN,{buttonStyle:f,className:`${bs}__button`,el:"div",onClick:()=>s(y[0].slug),size:u,children:a}):(0,p.jsx)(tC,{button:(0,p.jsx)(tN,{buttonStyle:f,className:`${bs}__popup-button`,el:"div",icon:"chevron",size:u,children:a}),buttonType:"default",className:`${bs}__action-popup`,children:(0,p.jsx)(tp.ButtonGroup,{children:y.map((e,t)=>(0,p.jsx)(tp.Button,{onClick:()=>s(e.slug),children:(0,h.s)(e.labels.singular,m)},t))})})}),n[3]=a,n[4]=u,n[5]=f,n[6]=y,n[7]=m,n[8]=s,n[9]=t):t=n[9],t)}var bd="confirm-empty-trash";function bu({collectionConfig:e,hasDeletePermission:t}){let{i18n:n,t:a}=(0,d.d)(),{code:l}=aN(),{config:r}=(0,c.c)(),{openModal:i}=nN(),s=(0,m.useRouter)(),u=(0,m.useSearchParams)(),{clearRouteCache:f}=pr(),[g,b]=o.useState(null);o.useEffect(()=>{(async()=>{let t=x.A({depth:0,limit:0,locale:l,trash:!0,where:{deletedAt:{exists:!0}}},{addQueryPrefix:!0});try{let a=await (await ay.get((0,y.Q)({apiRoute:r.routes.api,path:`/${e.slug}${t}`}),{headers:{"Accept-Language":n.language,"Content-Type":"application/json"}})).json();b(a?.totalDocs??0)}catch{b(0)}})()},[e.slug,r,n.language,l]);let v=o.useCallback(async()=>{if(!t)return;let{slug:i,labels:o}=e,c=x.A({limit:0,locale:l,trash:!0,where:{deletedAt:{exists:!0}}},{addQueryPrefix:!0}),d=await ay.delete((0,y.Q)({apiRoute:r.routes.api,path:`/${i}${c}`}),{headers:{"Accept-Language":n.language,"Content-Type":"application/json"}});try{let e=await d.json(),t=e?.docs?.length||0;d.status<400&&e3.success(a("general:permanentlyDeletedCountSuccessfully",{count:t,label:(0,h.s)(o?.plural,n)})),e?.errors?.length>0&&e3.error(e.message,{description:e.errors.map(e=>e.message).join(`
47`)}),s.replace(x.A({...Object.fromEntries(u.entries()),page:"1"},{addQueryPrefix:!0})),f()}catch{e3.error(a("error:unknown"))}},[e,r,t,n,a,l,u,s,f]);return(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(tN,{"aria-label":a("general:emptyTrashLabel",{label:(0,h.s)(e?.labels?.plural,n)}),buttonStyle:"pill",disabled:0===g,id:"empty-trash-button",onClick:()=>{i(bd)},size:"small",children:a("general:emptyTrash")},"empty-trash-button"),(0,p.jsx)(ag,{body:(0,p.jsx)(pu,{elements:{0:({children:e})=>(0,p.jsx)("strong",{children:e}),1:({children:e})=>(0,p.jsx)("strong",{children:e})},i18nKey:"general:aboutToPermanentlyDeleteTrash",t:a,variables:{count:g??0,label:(0,h.s)(1===g?e.labels?.singular:e.labels?.plural,n)}}),confirmingLabel:a("general:deleting"),heading:a("general:confirmDeletion"),modalSlug:bd,onConfirm:v})]})}var bp="list-drawer",bh=({className:e,collectionConfig:t,Description:n,disableBulkDelete:a,disableBulkEdit:l,hasCreatePermission:r,hasDeletePermission:i,hasTrashPermission:o,i18n:s,isBulkUploadEnabled:d,isTrashEnabled:u,newDocumentURL:f,onBulkUploadSuccess:m,openBulkUpload:g,smallBreak:b,viewType:v})=>{let{config:y,getEntityConfig:x}=(0,c.c)(),{drawerSlug:w,isInDrawer:j,selectedOption:C}=ci(),S="trash"===v,{isGroupingBy:k}
47=cc();return j?(0,p.jsx)(ba,{Actions:[(0,p.jsx)(g9,{className:`${bp}__header-close`,slug:w},"close-button")],AfterListHeaderContent:(0,p.jsxs)(p.Fragment,{children:[n,(0,p.jsx)(bl,{})]}),className:`${bp}__header`,title:(0,h.s)(x({collectionSlug:C.value})?.labels?.plural,s),TitleActions:[(0,p.jsx)(br,{hasCreatePermission:r},"list-drawer-create-new-doc")].filter(Boolean)}):(0,p.jsx)(ba,{Actions:[!b&&!k&&(0,p.jsx)(g7,{collectionConfig:t,disableBulkDelete:a,disableBulkEdit:l,hasDeletePermission:i,hasTrashPermission:o,label:(0,h.s)(t?.labels?.plural,s),showSelectAllAcrossPages:!k,viewType:v},"list-selection"),(0,p.jsx)(bt,{collectionConfig:t,config:y,viewType:v},"default-list-actions")].filter(Boolean),AfterListHeaderContent:n,className:e,title:(0,h.s)(t?.labels?.plural,s),TitleActions:[r&&!S&&(0,p.jsx)(bo,{collectionConfig:t,hasCreatePermission:r,newDocumentURL:f},"list-header-create-new-doc"),r&&d&&!S&&(0,p.jsx)(bi,{collectionSlug:t.slug,hasCreatePermission:r,isBulkUploadEnabled:d,onBulkUploadSuccess:m,openBulkUpload:g},"list-header-bulk-upload"),i&&u&&"trash"===v&&(0,p.jsx)(bu,{collectionConfig:t,hasDeletePermission:i},"list-header-empty-trash")].filter(Boolean)})},bf="group-by-header",bm=({collectionConfig:e,groupByFieldPath:t,groupByValue:n,heading:a})=>(0,p.jsxs)("header",{className:bf,children:[(0,p.jsx)("h4",{className:`${bf}__heading`,"data-group-id":n,children:a}),(0,p.jsx)(g7,{collectionConfig:e,label:a,modalPrefix:n,where:{[t]:{equals:n}}})]}),bg="per-page",bb=et.NT.admin.pagination.limits,bv=e=>{let t=(0,g.c)(9),{defaultLimit:n,handleChange:a,limit:l,limits:r}=e,i=void 0===r?bb:r,{t:o}=(0,d.d)(),s=(0,A.E)(l)?l:void 0===n?10:n,c;if(t[0]!==a||t[1]!==s||t[2]!==i||t[3]!==o){let e;t[5]!==a||t[6]!==s||t[7]!==i?(e=e=>{let{close:t}=e;return(0,p.jsx)(tp.ButtonGroup,{children:i.map((e,n)=>(0,p.jsxs)(tp.Button,{className:[`${bg}__button`,e===s&&`${bg}__button-active`].filter(Boolean).join(" "),onClick:()=>{t(),a&&a(e)},children:[e===s&&(0,p.jsx)("div",{className:`${bg}__chevron`,children:(0,p.jsx)(to,{direction:"right",size:"small"})}),"\xa0",(0,p.jsx)("span",{children:e})]},n))})},t[5]=a,t[6]=s,t[7]=i,t[8]=e):e=t[8],c=(0,p.jsx)("div",{className:bg,children:(0,p.jsx)(tC,{button:(0,p.jsxs)("div",{className:`${bg}__base-button`,children:[(0,p.jsx)("span",{children:o("general:perPage",{limit:s})}),"\xa0",(0,p.jsx)(to,{className:`${bg}__icon`})]}),horizontalAlign:"right",render:e,size:"small"})}),t[0]=a,t[1]=s,t[2]=i,t[3]=o,t[4]=c}else c=t[4];return c},by="page-controls",bx=e=>{let t=(0,g.c)(16),{AfterPageControls:n,collectionConfig:a,data:l,handlePageChange:r,handlePerPageChange:i,limit:s}=e,{i18n:c}=(0,d.d)(),u;return t[0]!==n||t[1]!==a?.admin?.pagination?.limits||t[2]!==l.hasNextPage||t[3]!==l.hasPrevPage||t[4]!==l.limit||t[5]!==l.nextPage||t[6]!==l.page||t[7]!==l.pagingCounter||t[8]!==l.prevPage||t[9]!==l.totalDocs||t[10]!==l.totalPages||t[11]!==r||t[12]!==i||t[13]!==c||t[14]!==s?(u=(0,p.jsxs)("div",{className:by,children:[(0,p.jsx)(dg,{hasNextPage:l.hasNextPage,hasPrevPage:l.hasPrevPage,limit:l.limit,nextPage:l.nextPage,numberOfNeighbors:1,onChange:r,page:l.page,prevPage:l.prevPage,totalPages:l.totalPages}),l.totalDocs>0&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsxs)("div",{className:`${by}__page-info`,children:[l.page*l.limit-(l.limit-1),"-",l.totalPages>1&&l.totalPages!==l.page?l.limit*l.page:l.totalDocs," ",c.t("general:of")," ",l.totalDocs]}),(0,p.jsx)(bv,{handleChange:i,limit:s,limits:a?.admin?.pagination?.limits,resetPage:l.totalDocs<=l.pagingCounter}),n]})]}),t[0]=n,t[1]=a?.admin?.pagination?.limits,t[2]=l.hasNextPage,t[3]=l.hasPrevPage,t[4]=l.limit,t[5]=l.nextPage,t[6]=l.page,t[7]=l.pagingCounter,t[8]=l.prevPage,t[9]=l.totalDocs,t[10]=l.totalPages,t[11]=r,t[12]=i,t[13]=c,t[14]=s,t[15]=u):u=t[15],u},bw=e=>{let t,n=(0,g.c)(10),{AfterPageControls:a,collectionConfig:l}=e,{data:r,defaultLimit:i,handlePageChange:o,handlePerPageChange:s,query:c}=cc(),d;return n[0]!==i||n[1]!==c.limit?(d=(0,A.E)(c.limit)?c.limit:i,n[0]=i,n[1]=c.limit,n[2]=d):d=n[2],n[3]!==a||n[4]!==l||n[5]!==r||n[6]!==o||n[7]!==s||n[8]!==d?(t=(0,p.jsx)(bx,{AfterPageControls:a,collectionConfig:l,data:r,handlePageChange:o,handlePerPageChange:s,limit:d}),n[3]=a,n[4]=l,n[5]=r,n[6]=o,n[7]=s,n[8]=d,n[9]=t):t=n[9],t},bj=({children:e})=>(0,p.jsx)("div",{className:"sticky-toolbar",children:e}),bC=e=>{let t=(0,g.c)(12),{AfterPageControls:n,collectionConfig:a,data:l,groupByValue:r}=e,{refineListData:i}=cc(),o;t[0]!==r||t[1]!==i?(o=async e=>{await i({queryByGroup:{[r]:{page:e}}})},t[0]=r,t[1]=i,t[2]=o):o=t[2];let s=o,c;t[3]!==r||t[4]!==i?(c=async e=>{await i({queryByGroup:{[r]:{limit:e,page:1}}})},t[3]=r,t[4]=i,t[5]=c):c=t[5];let d=c,u;return t[6]!==n||t[7]!==a||t[8]!==l||t[9]!==s||t[10]!==d?(u=(0,p.jsx)(bx,{AfterPageControls:n,collectionConfig:a,data:l,handlePageChange:s,handlePerPageChange:d}),t[6]=n,t[7]=a,t[8]=l,t[9]=s,t[10]=d,t[11]=u):u=t[11],u},bS={lg:"M16.445 5.348A8 8 0 0 0 12.5 4.016.525.525 0 0 1 12 3.5a.48.48 0 0 1 .5-.486A9 9 0 1 1 3.014 12.5.48.48 0 0 1 3.5 12c.276 0 .498.224.516.5a8 8 0 1 0 12.429-7.152",md:"M15.333 7.011a6 6 0 0 0-2.834-.99A.534.534 0 0 1 12 5.5c0-.276.224-.502.5-.482A7 7 0 1 1 5.018 12.5.473.473 0 0 1 5.5 12c.276 0 .498.224.52.5a6 6 0 1 0 9.313-5.489",sm:"M10.778 3.842a5 5 0 0 0-2.279-.817A.54.54 0 0 1 8 2.5a.47.47 0 0 1 .5-.48A6 6 0 1 1 2.02 8.5.47.47 0 0 1 2.5 8c.276 0 .497.224.525.499a5 5 0 1 0 7.753-4.657"},bk={lg:24,md:24,sm:16},b_=({className:e,size:t="sm"})=>{let n=bk[t];return(0,p.jsx)("svg",{className:["icon icon--spinner",e].filter(
47Boolean).join(" "),fill:"none",height:n,viewBox:`0 0 ${n} ${n}`,width:n,xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{clipRule:"evenodd",d:bS[t],fill:"currentColor",fillRule:"evenodd"})})},b$="spinner",bN=e=>{let t=(0,g.c)(7),{loadingText:n,size:a}=e,l=void 0===a?"md":a,{t:r}=(0,d.d)(),i=`${b$}--${l}`,o;t[0]!==i?(o=[b$,i].filter(Boolean),t[0]=i,t[1]=o):o=t[1];let s=o.join(" "),c;return t[2]!==n||t[3]!==l||t[4]!==r||t[5]!==s?(c=(0,p.jsxs)("div",{className:s,children:[(0,p.jsx)(b_,{size:l}),null!==n&&(0,p.jsx)("span",{className:`${b$}__text`,children:n||`${r("general:loading")}...`})]}),t[2]=n,t[3]=l,t[4]=r,t[5]=s,t[6]=c):c=t[6],c},bP=()=>(0,p.jsx)("svg",{className:"icon icon--logout",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M12 16H14.6667C15.0203 16 15.3594 15.8595 15.6095 15.6095C15.8595 15.3594 16 15.0203 16 14.6667V5.33333C16 4.97971 15.8595 4.64057 15.6095 4.39052C15.3594 4.14048 15.0203 4 14.6667 4H12M7.33333 13.3333L4 10M4 10L
477.33333 6.66667M4 10H12",strokeLinecap:"square"})}),bE=e=>{let t=(0,g.c)(5),{tabIndex:n}=e,a=void 0===n?0:n,{t:l}=(0,d.d)(),{config:r}=(0,c.c)(),{admin:i,routes:o}=r,{routes:s}=i,{logout:u}=s,{admin:h}=o,f;return t[0]!==h||t[1]!==u||t[2]!==l||t[3]!==a?(f=(0,p.jsx)(tl,{"aria-label":l("authentication:logOut"),className:"nav__log-out",href:(0,y.Q)({adminRoute:h,path:u}),prefetch:!1,tabIndex:a,title:l("authentication:logOut"),children:(0,p.jsx)(bP,{})}),t[0]=h,t[1]=u,t[2]=l,t[3]=a,t[4]=f):f=t[4],f},bD="nav-group",bT=e=>{let t,n=(0,g.c)(21),{children:a,isOpen:l,label:r}=e,[i,s]=(0,o.useState)("u">typeof l&&!l),[c,d]=(0,o.useState)(!1),{setPreference:u}=lS(),{navOpen:h}=mh();if(r){let e;n[0]!==i||n[1]!==r||n[2]!==u?(e=()=>{d(!0);let e={};e?.[r]?e[r].open=!!i:e[r]={open:!!i},u(J.x.NAV,{groups:e},!0),s(!i)},n[0]=i,n[1]=r,n[2]=u,n[3]=e):e=n[3];let t=e,l=`${r}`,o=i&&`${bD}--collapsed`,f;n[4]!==l||n[5]!==o?(f=[`${bD}`,l,o].filter(Boolean),n[4]=l,n[5]=o,n[6]=f):f=n[6];let m=f.join(" "),g=`nav-group-${r}`,b=`${bD}__toggle--${i?"collapsed":"open"}`,v;n[7]!==b?(v=[`${bD}__toggle`,b].filter(Boolean),n[7]=b,n[8]=v):v=n[8];let y=v.join(" "),x=h?0:-1,w;return n[9]!==c||n[10]!==a||n[11]!==i||n[12]!==r||n[13]!==x||n[14]!==m||n[15]!==g||n[16]!==y||n[17]!==t?(w=(0,p.jsxs)("div",{className:m,id:g,children:[(0,p.jsxs)("button",{className:y,onClick:t,tabIndex:x,type:"button",children:[(0,p.jsx)("div",{className:`${bD}__label`,children:r}),(0,p.jsx)("div",{className:`${bD}__indicator`,children:(0,p.jsx)(to,{className:`${bD}__indicator`,direction:i?void 0:"up"})})]}),(0,p.jsx)(l2,{duration:200*!!c,height:i?0:"auto",children:(0,p.jsx)("div",{className:`${bD}__content`,children:a})})]}),n[9]=c,n[10]=a,n[11]=i,n[12]=r,n[13]=x,n[14]=m,n[15]=g,n[16]=y,n[17]=t,n[18]=w):w=n[18],w}return n[19]!==a?(t=(0,p.jsx)(o.Fragment,{children:a}),n[19]=a,n[20]=t):t=n[20],t},bA="combobox",bR=e=>{let{entries:t,minEntriesForSearch:n=8,onSelect:a,onToggleClose:l,onToggleOpen:r,searchPlaceholder:i="Search...",...s}=e,[c,d]=(0,o.useState)(""),u=(0,o.useRef)(!1),h=(0,o.useRef)(null),f=(0,o.useMemo)(()=>{if(!c)return t;let e=c.toLowerCase();return t.filter(t=>t.name.toLowerCase().includes(e))},[t,c]),m=t.length>=n,g=f.length>0,b=o.useCallback(e=>{u.current=e,e&&m&&setTimeout(()=>{h.current?.focus()},100),r?.(e)},[m,r]),v=o.useCallback(()=>{u.current=!1,d(""),l?.()},[l]);return(0,p.jsx)(tC,{...s,className:`${bA} ${s.className||""}`,onToggleClose:v,onToggleOpen:b,render:({close:e})=>(0,p.jsxs)("div",{className:`${bA}__content`,children:[m&&(0,p.jsx)("div",{className:`${bA}__search-wrapper${g?"":` ${bA}__search-wrapper--no-results`}`,children:(0,p.jsx)("input",{"aria-label":i,className:`${bA}__search-input`,onChange:e=>d(e.target.value),placeholder:i,ref:h,type:"text",value:c})}),(0,p.jsx)(tp.ButtonGroup,{children:f.map((t,n)=>{let l=()=>{a&&a(t),e()};return(0,p.jsx)("div",{className:`${bA}__entry`,"data-popup-prevent-close":!0,onClick:l,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),l())},role:"menuitem",tabIndex:0,children:t.Component},`${t.name}-${n}`)})})]})})};function bL({active:e}){let{t:t}=(0,d.d)(),{config:n}=(0,c.c)(),{admin:{routes:{browseByFolder:a}},routes:{admin:l}}=n;return(0,p.jsxs)(tl,{className:["browse-by-folder-button",e&&"active"].filter(Boolean).join(" "),href:(0,y.Q)({adminRoute:l,path:a}),id:"browse-by-folder",prefetch:!1,children:[(0,p.jsx)(pm,{}),t("folder:browseByFolder")]})}var bF=e=>{let{field:t,field:{name:n,admin:{className:a,isClearable:l=!0,isSortable:r=!0,placeholder:i}={},hasMany:s=!1,label:c,localized:u,options:h=[],required:f},onChange:m,path:g,readOnly:b,validate:v}=e,{t:y}=(0,d.d)(),{folderType:x}=pn(),w=o.useMemo(()=>x&&0!==x.length?ut(h.filter(e=>"object"!=typeof e||!e.value||x.includes(e.value))):ut(h),[h,x]),{customComponents:{AfterInput:j,BeforeInput:C,Description:S,Error:k,Label:_}={},disabled:$,path:N,selectFilterOptions:P,setValue:E,showError:D,value:T}=lI({potentiallyStalePath:g,validate:o.useCallback((e,t)=>{if("function"==typeof v)return v(e,{...t,hasMany:s,options:w,required:f})},[v,f,s,w])}),A=o.useCallback(e=>{if(!b||$){let t=null;e&&s?t=Array.isArray(e)&&e.length>0?e.map(e=>e.value):null:e&&!Array.isArray(e)&&(t=e.value),"function"==typeof m&&m(t),E(t)}},[b,$,s,E,m]),R=o.useMemo(()=>lV(t),[t]);return(0,p.jsx)(ue,{AfterInput:j,BeforeInput:C,className:a,Description:S,description:y("folder:folderTypeDescription"),Error:k,filterOption:P?({value:e})=>P?.some(t=>("string"==typeof t?t:t.value)===e):void 0,hasMany:s,isClearable:l,isSortable:r,Label:_,label:c,localized:u,name:n,onChange:A,options:w,path:N,placeholder:i,readOnly:b||$,required:f||Array.isArray(x)&&x.length>0,showError:D,style:R,value:T})},bO=()=>(0,p.jsx)("svg",{className:"icon icon--document",fill:"none",height:"16",viewBox:"0 0 16 16",width:"16",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{clipRule:"evenodd",d:"M3.5 1C2.94772 1 2.5 1.44772 2.5 2V14C2.5 14.5523 2.94771 15 3.5 15H12.5C13.0523 15 13.5 14.5523 13.5 14V4.41421C13.5 4.149 13.3946 3.89464 13.2071 3.70711L10.7929 1.29289C10.6054 1.10536 10.351 1 10.0858 1H3.5ZM5 5.5C5 5.22386 5.22386 5 5.5 5H10.5C10.7761 5 11 5.22386 11 5.5C11 5.77614 10.7761 6 10.5 6H5.5C5.22386 6 5 5.77614 5 5.5ZM5 8.5C5 8.22386 5.22386 8 5.5 8H10.5C10.7761 8 11 8.22386 11 8.5C11 8.77614 10.7761 9 10.5 9H5.5C5.22386 9 5 8.77614 5 8.5ZM5 11.5C5 11.2239 5.22386 11 5.5 11H10.5C10.7761 11 11 11.2239 11 11.5C11 11.7761 10.7761 12 10.5 12H5.5C5.22386 12 5 11.7761 5 11.5Z",fill:"currentColor",fillRule:"evenodd"})}),bM="draggable-with-click",bI=({as:e="div",children:t,className:n,disabled:a=!1,onClick:l,onKeyDown:r,ref:i,thresholdPixels:s=3})=>
47{let c=(0,o.useId)(),{attributes:d,listeners:u,setNodeRef:h}=(0,v.PM)({id:c,disabled:a}),f=(0,o.useRef)({x:0,y:0}),m=(0,o.useRef)(!1);return(0,p.jsx)(e||"div",{role:"button",tabIndex:0,...d,className:[bM,n,a?`${bM}--disabled`:""].filter(Boolean).join(" "),onKeyDown:a?void 0:r,onPointerDown:a?void 0:l?e=>{f.current={x:e.clientX,y:e.clientY},m.current=!1;let t=n=>{let a=Math.abs(n.clientX-f.current.x),r=Math.abs(n.clientY-f.current.y);(a>s||r>s)&&(m.current=!0,u?.onPointerDown&&(u.onPointerDown(e),l(n)),window.removeEventListener("pointermove",t))},n=e=>{window.removeEventListener("pointermove",t),window.removeEventListener("pointerup",n),m.current||l(e)};window.addEventListener("pointermove",t),window.addEventListener("pointerup",n)}:void 0,ref:e=>{a||(h(e),i&&(i.current=e))},children:t})},bB="simple-table",bz=({appearance:e,className:t,headerCells:n,tableRows:a})=>(0,p.jsx)("div",{className:[t,bB,e&&`${bB}--appearance-${e}`].filter(Boolean).join(" "),children:(0,p.jsxs)("table",{cellPadding:0,cellSpacing:0,className:`${bB}__table`,children:[(0,p.jsx)(bU,{children:(0,p.jsx)(bH,{children:n})}),(0,p.jsx)(bV,{children:a})]})}),bU=({children:e,className:t,...n})=>(0,p.jsx)("thead",{className:`${bB}__thead ${t||""}`.trim(),...n,children:e}),bV=({children:e,className:t,...n})=>(0,p.jsx)("tbody",{className:`${bB}__tbody ${t||""}`.trim(),...n,children:e}),bH=({children:e,className:t,...n})=>(0,p.jsx)("tr",{className:`${bB}__tr ${t||""}`.trim(),...n,children:e}),bq=({children:e,className:t,...n})=>(0,p.jsx)("td",{className:`${bB}__td ${t||""}`.trim(),...n,children:e}),bW=({children:e,className:t,...n})=>(0,p.jsx)("th",{className:`${bB}__th ${t||""}`.trim(),...n,children:e}),bK=({children:e,className:t,...n})=>(0,p.jsx)("td",{className:`${bB}__hidden-cell ${t||""}`.trim(),...n,children:e}),bQ="draggable-table-row";function bY({id:e,columns:t,disabled:n=!1,dragData:a,isDroppable:l,isFocused:r,isSelected:i,isSelecting:s,itemKey:c,onClick:d,onKeyDown:u}){let h=!n&&l&&!i,{isOver:f,setNodeRef:m}=(0,v.zM)({id:e,data:a,disabled:!h}),g=o.useRef(null);return o.useEffect(()=>{let e=g.current;return r&&g.current?g.current.focus():!r&&g.current&&g.current.blur(),()=>{e&&e.blur()}},[r]),(0,p.jsxs)(bI,{as:"tr",className:[bQ,i&&`${bQ}--selected`,s&&`${bQ}--selecting`,n&&`${bQ}--disabled`,r&&`${bQ}--focused`,f&&`${bQ}
47--over`].filter(Boolean).join(" "),onClick:d,onKeyDown:u,ref:g,children:[t.map((e,n)=>(0,p.jsx)(bq,{className:[`${bQ}__cell-content`,0===n&&`${bQ}__first-td`,n===t.length-1&&`${bQ}__last-td`].filter(Boolean).join(" "),children:e},`${c}-${n}`)),h?(0,p.jsx)(bK,{children:(0,p.jsx)("div",{className:`${bQ}__drop-area`,ref:m})}):null]},c)}var bG="folder-file-table";function bX(e){let t=(0,g.c)(39),{showRelationCell:n}=e,a=void 0===n||n,{checkIfItemIsDisabled:l,documents:r,focusedRowIndex:i,onItemClick:s,onItemKeyPress:u,selectedItemKeys:f,subfolders:m}=pn(),{config:b}=(0,c.c)(),{i18n:v,t:y}=(0,d.d)(),x;t[0]!==b||t[1]!==v?(x=()=>{let e={};return b.collections.forEach(t=>{e[t.slug]={plural:(0,h.s)(t.labels?.plural,v),singular:(0,h.s)(t.labels?.singular,v)}}),e},t[0]=b,t[1]=v,t[2]=x):x=t[2];let[w]=o.useState(x),j;t[3]!==a||t[4]!==y?(j=()=>{let e=[{name:"name",label:y("general:name")},{name:"createdAt",label:y("general:createdAt")},{name:"updatedAt",label:y("general:updatedAt")}];return a&&e.push({name:"type",label:y("version:type")}),e},t[3]=a,t[4]=y,t[5]=j):j=t[5];let[C]=o.useState(j),S;if(t[6]!==l||t[7]!==C||t[8]!==b||t[9]!==r||t[10]!==i||t[11]!==v||t[12]!==s||t[13]!==u||t[14]!==w||t[15]!==f||t[16]!==m){let e,n;t[18]!==l||t[19]!==C||t[20]!==b||t[21]!==i||t[22]!==v||t[23]!==s||t[24]!==u||t[25]!==w||t[26]!==f?(e=(e,t)=>{let{itemKey:n,relationTo:a,value:r}=e,o=(0,q.r)(r);return(0,p.jsx)(bY,{columns:C.map((t,l)=>{let{name:i}=t,o="—";return"name"===i&&void 0!==r._folderOrDocumentTitle&&(o=r._folderOrDocumentTitle),("createdAt"===i||"updatedAt"===i)&&r[i]&&(o=lh({date:r[i],i18n:v,pattern:b.admin.dateFormat})),"type"===i&&(o=(0,p.jsxs)(p.Fragment,{children:[w[a]?.singular||a,Array.isArray(e.value?.folderType)?e.value?.folderType.reduce((e,t,n)=>0===n?` \u2014 ${w[t]?.plural||t}`:n>0?`${e}, ${w[t]?.plural||t}`:e,""):""]})),0===l?(0,p.jsxs)("span",{className:`${bG}__cell-with-icon`,children:[(0,p.jsx)(pm,{}),o]},`${n}-${i}`):o}),disabled:l(e),dragData:{id:o,type:"folder"},id:o,isDroppable:!0,isFocused:i===t,isSelected:f.has(n),isSelecting:f.size>0,itemKey:n,onClick:n=>{s({event:n,index:t,item:e})},onKeyDown:n=>{u({event:n,index:t,item:e})}},`${t}-${n}`)},t[18]=l,t[19]=C,t[20]=b,t[21]=i,t[22]=v,t[23]=s,t[24]=u,t[25]=w,t[26]=f,t[27]=e):e=t[27],t[28]!==l||t[29]!==C||t[30]!==b||t[31]!==i||t[32]!==v||t[33]!==s||t[34]!==u||t[35]!==w||t[36]!==f||t[37]!==m.length?(n=(e,t)=>{let{itemKey:n,relationTo:a,value:r}=e,o=(0,q.r)(r),c=t+m.length;return(0,p.jsx)(bY,{columns:C.map((e,t)=>{let{name:l}=e,i="—";return"name"===l&&void 0!==r._folderOrDocumentTitle&&(i=r._folderOrDocumentTitle),("createdAt"===l||"updatedAt"===l)&&r[l]&&(i=lh({date:r[l],i18n:v,pattern:b.admin.dateFormat})),"type"===l&&(i=w[a]?.singular||a),0===t?(0,p.jsxs)("span",{className:`${bG}__cell-with-icon`,children:[(0,p.jsx)(bO,{}),i]},`${n}-${l}`):i}),disabled:l(e),dragData:{id:o,type:"document"},id:o,isFocused:i===c,isSelected:f.has(n),isSelecting:f.size>0,itemKey:n,onClick:t=>{s({event:t,index:c,item:e})},onKeyDown:t=>{u({event:t,index:c,item:e})}},`${c}-${n}`)},t[28]=l,t[29]=C,t[30]=b,t[31]=i,t[32]=v,t[33]=s,t[34]=u,t[35]=w,t[36]=f,t[37]=m.length,t[38]=n):n=t[38],S=(0,p.jsx)(bz,{headerCells:C.map(bZ),tableRows:[...m.map(e),...r.map(n)]}),t[6]=l,t[7]=C,t[8]=b,t[9]=r,t[10]=i,t[11]=v,t[12]=s,t[13]=u,t[14]=w,t[15]=f,t[16]=m,t[17]=S}else S=t[17];return S}function bZ(e){let{name:t,label:n}=e;return(0,p.jsx)(bW,{children:n},t)}function bJ({className:e=""}){return(0,p.jsxs)("div",{className:`icon icon--dots ${e}`.trim(),children:[(0,p.jsx)("div",{}),(0,p.jsx)("div",{}),(0,p.jsx)("div",{})]})}var b0="folder-file-card";function b1({id:e,type:t,className:n="",disabled:a=!1,folderType:l,isDeleting:r=!1,isFocused:i=!1,isSelected:s=!1,itemKey:c,onClick:d,onKeyDown:u,PopupActions:h,previewUrl:f,selectedCount:m=0,title:g}){let b=!e||a||"folder"!==t,{isOver:y,setNodeRef:x}=(0,v.zM)({id:c,data:{id:e,type:t,folderType:l},disabled:b}),w=o.useRef(null);return o.useEffect(()=>{let e=w.current;return i&&w.current?w.current.focus():!i&&w.current&&w.current.blur(),()=>{e&&e.blur()}},[i]),(0,p.jsxs)(bI,{className:[b0,n,s&&`${b0}--selected`,a&&`${b0}--disabled`,r&&`${b0}--deleting`,i&&`${b0}--focused`,y&&`${b0}--over`,`${b0}--${t}
47`].filter(Boolean).join(" "),disabled:a||!d&&!u,onClick:d,onKeyDown:u,ref:w,children:[b?null:(0,p.jsx)("div",{className:`${b0}__drop-area`,ref:x}),"file"===t?(0,p.jsx)("div",{className:`${b0}__preview-area`,children:f?(0,p.jsx)(c8,{fileSrc:f}):(0,p.jsx)(bO,{})}):null,(0,p.jsxs)("div",{className:`${b0}__titlebar-area`,children:[(0,p.jsx)("div",{className:`${b0}__icon-wrap`,children:"file"===t?(0,p.jsx)(bO,{}):(0,p.jsx)(pm,{})}),(0,p.jsxs)("div",{className:`${b0}__titlebar-labels`,children:[(0,p.jsx)("p",{className:`${b0}__name`,title:g,children:(0,p.jsx)("span",{children:g})}),l&&l.length>0?(0,p.jsx)(b3,{folderType:l}):null]}),h?(0,p.jsx)(tC,{button:(0,p.jsx)(bJ,{}),disabled:m>1||1===m&&!s,horizontalAlign:"right",size:"large",verticalAlign:"bottom",children:h}):null]})]},c)}function b3({folderType:e}){let{config:t}=(0,c.c)(),{i18n:n}=(0,d.d)(),a=o.useMemo(()=>e.reduce((e,a)=>{let l=t.collections?.find(e=>e.slug===a);return l?[...e,(0,h.s)(l.labels.plural,n)]:e},[]),[e,t.collections,n]);return(0,p.jsx)("p",{className:`${b0}__assigned-collections`,children:a.map((t,n)=>(0,p.jsxs)("span",{children:[t,n<e.length-1?", ":""]},t))})}function b2(e){let t=(0,g.c)(18),{type:n,className:a,index:l,item:r}=e,{checkIfItemIsDisabled:i,focusedRowIndex:o,onItemClick:s,onItemKeyPress:c,selectedItemKeys:d}=pn(),u;if(t[0]!==i||t[1]!==a||t[2]!==o||t[3]!==l||t[4]!==r||t[5]!==s||t[6]!==c||t[7]!==d||t[8]!==n){let e,h=d.has(r.itemKey),f=i(r),m;t[10]!==l||t[11]!==r||t[12]!==s?(m=e=>{s({event:e,index:l,item:r})},t[10]=l,t[11]=r,t[12]=s,t[13]=m):m=t[13],t[14]!==l||t[15]!==r||t[16]!==c?(e=e=>{c({event:e,index:l,item:r})},t[14]=l,t[15]=r,t[16]=c,t[17]=e):e=t[17],u=(0,p.jsx)(b1,{className:a,disabled:f,folderType:r.value.folderType||[],id:r.value.id,isFocused:o===l,isSelected:h,itemKey:r.itemKey,onClick:m,onKeyDown:e,previewUrl:r.value.url,title:r.value._folderOrDocumentTitle,type:n}),t[0]=i,t[1]=a,t[2]=o,t[3]=l,t[4]=r,t[5]=s,t[6]=c,t[7]=d,t[8]=n,t[9]=u}else u=t[9];return u}var b6="item-card-grid";function b5({type:e,items:t,subfolderCount:n,title:a}){return(0,p.jsxs)(p.Fragment,{children:[a&&(0,p.jsx)("p",{className:`${b6}__title`,children:a}),(0,p.jsx)("div",{className:b6,children:t&&t?.length!==0?t.map((t,a)=>{let{itemKey:l}=t;return(0,p.jsx)(b2,{index:a+(n||0),item:t,type:e},l)}):null})]})}function b4(e){return void 0===e||"number"==typeof e?e:decodeURIComponent(e)}var b8=e=>{let t=(0,g.c)(9),{id:n,className:a,prefix:l}=e,r=void 0===l?"ID:":l,{config:i}=(0,c.c)(),{routes:o}=i,{admin:s}=o,{collectionSlug:d,globalSlug:u}=lE(),h=af(),f=`/${d?`collections/${d}`:`globals/${u}`}/${n}`,m;if(t[0]!==s||t[1]!==a||t[2]!==h||t[3]!==n||t[4]!==r||t[5]!==f){let e=(0,y.Q)({adminRoute:s,path:f}),l;t[7]!==a?(l=["id-label",a].filter(Boolean),t[7]=a,t[8]=l):l=t[8],m=(0,p.jsxs)("div",{className:l.join(" "),title:n,children:[r,"\xa0",h>1?(0,p.jsx)(tl,{href:e,children:b4(n)}):b4(n)]}),t[0]=s,t[1]=a,t[2]=h,t[3]=n,t[4]=r,t[5]=f,t[6]=m}else m=t[6];return m},b7="render-title",b9=e=>{let t=(0,g.c)(10),{className:n,element:a,fallback:l,title:r}=e,{id:i,isInitializing:s}=lE(),{title:c}=ly(),d=r||c||l,u=d===i,h=void 0===a?"h1":a,f;if(t[0]!==h||t[1]!==n||t[2]!==i||t[3]!==u||t[4]!==s||t[5]!==d){let e=(0,p.jsx)(o.Fragment,{children:"\xa0"}),a=u&&`${b7}--has-id`,l;t[7]!==n||t[8]!==a?(l=[n,b7,a].filter(Boolean),t[7]=n,t[8]=a,t[9]=l):l=t[9],f=(0,p.jsx)(h,{className:l.join(" "),"data-doc-id":i,title:d,children:s?e:(0,p.jsx)(o.Fragment,{children:u?(0,p.jsx)(b8,{className:`${b7}__id`,id:i}):d||e})}),t[0]=h,t[1]=n,t[2]=i,t[3]=u,t[4]=s,t[5]=d,t[6]=f}else f=t[6];return f},ve="sort-column",vt=e=>{let t,n=(0,g.c)(19),{name:a,appearance:l,disable:r,Label:i,label:o}=e,s=void 0!==r&&r,{handleSortChange:c,query:u}=cc(),{t:h}=(0,d.d)(),{sort:f}=u,m=`-${a}`,b;n[0]!==a||n[1]!==f?(b=[`${ve}__asc`],f===a&&b.push(`${ve}--active`),n[0]=a,n[1]=f,n[2]=b):b=n[2],n[3]!==m||n[4]!==f?(t=[`${ve}__desc`],f===m&&t.push(`${ve}--active`),n[3]=m,n[4]=f,n[5]=t):t=n[5];let v=l&&`${ve}--appearance-${l}`,y;
47n[6]!==v?(y=[ve,v].filter(Boolean),n[6]=v,n[7]=y):y=n[7];let x=y.join(" "),w;return n[8]!==i||n[9]!==a||n[10]!==b||n[11]!==m||n[12]!==t||n[13]!==s||n[14]!==c||n[15]!==o||n[16]!==h||n[17]!==x?(w=(0,p.jsxs)("div",{className:x,children:[(0,p.jsx)("span",{className:`${ve}__label`,children:i??(0,p.jsx)(aD,{hideLocale:!0,label:o,unstyled:!0})}),!s&&(0,p.jsxs)("div",{className:`${ve}__buttons`,children:[(0,p.jsx)("button",{"aria-label":h("general:sortByLabelDirection",{direction:h("general:ascending"),label:o}),className:[...b,`${ve}__button`].filter(Boolean).join(" "),onClick:()=>{c(a)},type:"button",children:(0,p.jsx)(to,{direction:"up"})}),(0,p.jsx)("button",{"aria-label":h("general:sortByLabelDirection",{direction:h("general:descending"),label:o}),className:[...t,`${ve}__button`].filter(Boolean).join(" "),onClick:()=>{c(m)},type:"button",children:(0,p.jsx)(to,{})})]})]}),n[8]=i,n[9]=a,n[10]=b,n[11]=m,n[12]=t,n[13]=s,n[14]=c,n[15]=o,n[16]=h,n[17]=x,n[18]=w):w=n[18],w},vn="item-search",va=e=>{let t=(0,g.c)(7),{placeholder:n,setSearchTerm:a}=e,l=(0,o.useId)(),r=`${l}-label`,i;t[0]!==a?(i=e=>{a(e.target.value)},t[0]=a,t[1]=i):i=t[1];let s=i,c;return t[2]!==s||t[3]!==l||t[4]!==r||t[5]!==n?(c=(0,p.jsxs)("div",{className:vn,children:[(0,p.jsx)("label",{className:"sr-only",htmlFor:l,id:r,children:n}),(0,p.jsx)("input",{"aria-labelledby":r,className:`${vn}
47__input`,id:l,onChange:s,placeholder:n,type:"text"}),(0,p.jsx)(rh,{})]}),t[2]=s,t[3]=l,t[4]=r,t[5]=n,t[6]=c):c=t[6],c},vl="items-drawer",vr=e=>{let{addRowIndex:t,drawerSlug:n,items:a,labels:l,onItemClick:r,searchPlaceholder:i,title:s}=e,[u,f]=(0,o.useState)(""),[m,g]=(0,o.useState)(a),{closeModal:b,isModalOpen:v}=nN(),{i18n:y,t:x}=(0,d.d)(),{config:w}=(0,c.c)(),j=(0,o.useMemo)(()=>{let e={_none:[]};return m.forEach(t=>{if("object"==typeof t&&"admin"in t&&t.admin?.group){let n=t.admin.group,a="string"==typeof n?n:(0,h.s)(n,y);Object.hasOwn(e,a)?e[a].push(t):e[a]=[t]}else e._none.push(t)}),e},[m,y]);(0,o.useEffect)(()=>{v(n)||f("")},[v,n]),(0,o.useEffect)(()=>{let e=u.toLowerCase();g(a?.reduce((t,n)=>{let a;return(a="string"==typeof n?w.blocksMap?.[n]:n)&&((e,t)=>{if("labels"in e&&e.labels?.singular){if("string"==typeof e.labels.singular)return e.labels.singular.toLowerCase();if("object"==typeof e.labels.singular)return(0,h.s)(e.labels.singular,t).toLowerCase()}if("label"in e&&e.label){if("string"==typeof e.label)return e.label.toLowerCase();if("object"==typeof e.label)return(0,h.s)(e.label,t).toLowerCase()}return"slug"in e?(0,G.x4)(e.slug).toLowerCase():""})(a,y).includes(e)&&t.push(a),t},[])||[])},[u,a,y,w.blocksMap]);let C=s||(l?x("fields:addLabel",{label:(0,h.s)(l.singular,y)}):x("fields:addNew"));return(0,p.jsxs)(au,{slug:n,title:C,children:[(0,p.jsx)(va,{placeholder:i||x("fields:searchForBlock"),setSearchTerm:f}),(0,p.jsx)("div",{className:`${vl}__items-wrapper`,children:(0,p.jsx)("ul",{className:`${vl}__item-groups`,children:Object.entries(j).map(([e,a])=>a.length?(0,p.jsxs)("li",{className:[`${vl}__item-group`,"_none"===e&&`${vl}
47__item-group-none`].filter(Boolean).join(" "),children:["_none"!==e&&(0,p.jsx)("h3",{className:`${vl}__item-group-label`,children:e}),(0,p.jsx)("ul",{className:`${vl}__items`,children:a.map((e,a)=>{let l="string"==typeof e?w.blocksMap?.[e]:e;if(!l)return null;let{imageAltText:i,imageURL:o}=(e=>{if("admin"in e&&e?.admin?.images?.thumbnail){let t=e.admin?.images.thumbnail;return{imageAltText:"string"==typeof t?void 0:t.alt,imageURL:"string"==typeof t?t:t.url}}return"imageURL"in e?{imageAltText:e.imageAltText,imageURL:e.imageURL}:{imageAltText:void 0,imageURL:void 0}})(l),s=((e,t)=>{if("labels"in e&&e.labels?.singular)return(0,h.s)(e.labels.singular,t);if("label"in e&&e.label){if("string"==typeof e.label)return e.label;if("object"==typeof e.label)return(0,h.s)(e.label,t)}return(0,G.x4)(e.slug)})(l,y);return(0,p.jsx)("li",{className:`${vl}__item`,children:(0,p.jsx)(ri,{alignLabel:"center",label:s,onClick:()=>{r(l,t),b(n)},thumbnail:(0,p.jsx)("div",{className:`${vl}__default-image`,children:o?(0,p.jsx)("img",{alt:i,src:o}):(0,p.jsx)(rp,{})})})},a)})})]},e):null)})})]})},vi=e=>{let t=(0,g.c)(27),{field:n,path:a,useAsSlug:l}=e,{admin:r,label:i}=n,s;t[0]!==r?(s=r||{},t[0]=r,t[1]=s):s=t[1];let{readOnly:c}=s,{t:u}=(0,d.d)(),{collectionSlug:h,globalSlug:f}=lE(),{slugify:m}=cf(),b=a||n.name,v;t[2]!==b?(v={path:b},t[2]=b,t[3]=v):v=t[3];let{setValue:y,showError:x,value:w}=lI(v),{getData:j,getDataByPath:C}=eT(),[S,k]=(0,o.useState)(!0),_;t[4]!==h||t[5]!==j||t[6]!==C||t[7]!==f||t[8]!==a||t[9]!==y||t[10]!==m||t[11]!==l||t[12]!==w?(_=async e=>{e.preventDefault();let t=C(l),n=await m({collectionSlug:h,data:j(),globalSlug:f,path:a,valueToSlugify:t});null==n?y(""):w!==n&&y(n)},t[4]=h,t[5]=j,t[6]=C,t[7]=f,t[8]=a,t[9]=y,t[10]=m,t[11]=l,t[12]=w,t[13]=_):_=t[13];let $=_,N;t[14]===Symbol.for("react.memo_cache_sentinel")?(N=e=>{e.preventDefault(),k(vo)},t[14]=N):N=t[14];let P=N,E=`field-${a}`,D;return t[15]!==n.name||t[16]!==$||t[17]!==S||t[18]!==i||t[19]!==a||t[20]!==c||t[21]!==y||t[22]!==x||t[23]!==u||t[24]!==E||t[25]!==w?(D=(0,p.jsxs)("div",{className:"field-type slug-field-component",children:[(0,p.jsx)("div",{className:"label-wrapper",children:(0,p.jsx)(aD,{htmlFor:E,label:i})}),(0,p.jsx)(uC,{AfterInput:c?void 0:(0,p.jsxs)("div",{className:"slug-field-component__actions",children:[!S&&(0,p.jsx)(tN,{buttonStyle:"none",className:"lock-button",id:`field-${a}-generate`,onClick:$,children:u("authentication:generate")}),(0,p.jsx)(tN,{buttonStyle:"none",className:"lock-button",id:`field-${a}-lock`,onClick:P,children:u(S?"general:unlock":"general:lock")})]}),onChange:y,path:a||n.name,readOnly:!!(c||S),showError:x,value:w})]}),t[15]=n.name,t[16]=$,t[17]=S,t[18]=i,t[19]=a,t[20]=c,t[21]=y,t[22]=x,t[23]=u,t[24]=E,t[25]=w,t[26]=D):D=t[26],D};function vo(e){return!e}var vs=()=>(0,p.jsx)("svg",{"aria-hidden":"true",className:"graphic code-block-icon",focusable:"false",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{className:"stroke",d:"M14 12.6667L16.6667 9.99999L14 7.33332M5.99999 7.33332L3.33333 9.99999L5.99999 12.6667M11.6667 4.66666L8.33333 15.3333",strokeLinecap:"square"})}),vc="minimize-maximize",vd=({className:e,isMinimized:t})=>{let n=[vc,t?`${vc}--minimized`:`${vc}--maximized`,e].filter(Boolean).join(" ");return(0,p.jsx)("svg",{className:n,height:"20",stroke:"currentColor",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:t?(0,p.jsx)("path",{d:"M7.33333 4H5.33333C4.97971 4 4.64057 4.14048 4.39052 4.39052C4.14048 4.64057 4 4.97971 4 5.33333V7.33333M16 7.33333V5.33333C16 4.97971 15.8595 4.64057 15.6095 4.39052C15.3594 4.14048 15.0203 4 14.6667 4H12.6667M4 12.6667V14.6667C4 15.0203 4.14048 15.3594 4.39052 15.6095C4.64057 15.8595 4.97971 16 5.33333 16H7.33333M12.6667 16H14.6667C15.0203 16 15.3594 15.8595 15.6095 15.6095C15.8595 15.3594 16 15.0203 16 14.6667V12.6667"}):(0,p.jsx)("path",{d:"M7.33333 4V6C7.33333 6.35362 7.19286 6.69276 6.94281 6.94281C6.69276 7.19286 6.35362 7.33333 6 7.33333H4M16 7.33333H14C13.6464 7.33333 13.3072 7.19286 13.0572 6.94281C12.8071 6.69276 12.6667 6.35362 12.6667 6V4M4 12.6667H6C6.35362 12.6667 6.69276 12.8071 6.94281 13.0572C7.19286 13.3072 7.33333 13.6464 7.33333 14V16M12.6667 16V14C12.6667 13.6464 12.8
47071 13.3072 13.0572 13.0572C13.3072 12.8071 13.6464 12.6667 14 12.6667H16"})})},vu=({ariaLabel:e,className:t})=>(0,p.jsx)("div",{"aria-label":e,className:[t,"gear"].filter(Boolean).join(" "),children:(0,p.jsx)("svg",{className:"icon icon--gear",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{d:"M9.33337 8.84671L6.66671 4.22671M9.33337 11.1534L6.66671 15.7734M10 16.6667V15.3334M10 15.3334C12.9456 15.3334 15.3334 12.9456 15.3334 10C15.3334 7.05452 12.9456 4.66671 10 4.66671M10 15.3334C7.05452 15.3334 4.66671 12.9456 4.66671 10M10 3.33337V4.66671M10 4.66671C7.05452 4.66671 4.66671 7.05452 4.66671 10M11.3334 10H16.6667M11.3334 10C11.3334 10.7364 10.7364 11.3334 10 11.3334C9.26366 11.3334 8.66671 10.7364 8.66671 10C8.66671 9.26366 9.26366 8.66671 10 8.66671C10.7364 8.66671 11.3334 9.26366 11.3334 10ZM13.3334 15.7734L12.6667 14.62M13.3334 4.22671L12.6667 5.38004M3.33337 10H4.66671M15.7734 13.3334L14.62 12.6667M15.7734 6.66671L14.62 7.33337M4.22671 13.3334L5.38004 12.6667M4.22671 6.66671L5.38004 7.33337",strokeLinecap:"round",strokeLinejoin:"round"})})});function vp(){return(0,p.jsxs)("svg",{className:"icon icon--move-folder",fill:"none",height:"24",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,p.jsx)("g",{filter:"url(#filter0_d_278_1086)",children:(0,p.jsx)("path",{d:"M5.33334 10V7.33334C5.33334 6.97971 5.47382 6.64058 5.72387 6.39053C5.97392 6.14048 6.31305 6 6.66668 6H9.26668C9.48967 5.99782 9.70965 6.0516 9.90648 6.15642C10.1033 6.26124 10.2707 6.41375 10.3933 6.6L10.9333 7.4C11.0547 7.58436 11.22 7.73568 11.4143 7.84041C11.6087 7.94513 11.8259 7.99997 12.0467 8H17.3333C17.687 8 18.0261 8.14048 18.2762 8.39053C18.5262 8.64058 18.6667 8.97971 18.6667 9.33334V16C18.6667 16.3536 18.5262 16.6928 18.2762 16.9428C18.0261 17.1929 17.687 17.3333 17.3333 17.3333H6.66668C6.31305 17.3333 5.97392 17.1929 5.72387 16.9428C5.47382 16.6928 5.33334 16.3536 5.33334 16V15.3333M5.33334 12.6667H12M12 12.6667L10 14.6667M12 12.6667L10 10.6667",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),(0,p.jsx)("defs",{children:(0,p.jsx)("filter",{colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",height:"26",id:"filter0_d_278_1086",width:"26",x:"-1",y:"-1",children:(0,p.jsx)("feBlend",{in:"SourceGraphic",in2:"effect1_dropShadow_278_1086",mode:"normal",result:"shape"})})})]})}var vh=()=>(0,p.jsxs)("svg",{className:"icon icon--grid-view",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[(0,p.jsx)("path",{d:"M8 4H4.66667C4.29848 4 4 4.29848 4 4.66667V8C4 8.36819 4.29848 8.66667 4.66667 8.66667H8C8.36819 8.66667 8.66667 8.36819 8.66667 8V4.66667C8.66667 4.29848 8.36819 4 8 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M15.3333 4H12C11.6318 4 11.3333 4.29848 11.3333 4.66667V8C11.3333 8.36819 11.6318 8.66667 12 8.66667H15.3333C15.7015 8.66667 16 8.36819 16 8V4.66667C16 4.29848 15.7015 4 15.3333 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M15.3333 11.3333H12C11.6318 11.3333 11.3333 11.6318 11.3333 12V15.3333C11.3333 15.7015 11.6318 16 12 16H15.3333C15.7015 16 16 15.7015 16 15.3333V12
47C16 11.6318 15.7015 11.3333 15.3333 11.3333Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{d:"M8 11.3333H4.66667C4.29848 11.3333 4 11.6318 4 12V15.3333C4 15.7015 4.29848 16 4.66667 16H8C8.36819 16 8.66667 15.7015 8.66667 15.3333V12C8.66667 11.6318 8.36819 11.3333 8 11.3333Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]}),vf=()=>(0,p.jsx)("svg",{className:"icon icon--list-view",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)("path",{d:"M4 10H16M4 14H16M4 6H16",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),vm=()=>(0,p.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,p.jsx)("path",{d:"M13 21C17.4183 21 21 17.4183 21 13C21 8.58172 17.4183 5 13 5C8.58172 5 5 8.58172 5 13C5 17.4183 8.58172 21 13 21Z",fill:"var(--theme-error-500)"}),(0,p.jsx)("path",{d:"M15.4001 10.5996L10.6001 15.3996M10.6001 10.5996L15.4001 15.3996",stroke:"var(--theme-error-50)",strokeLinecap:"round",strokeLinejoin:"round"})]}),vg=()=>(0,p.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,p.jsx)("path",{d:"M13 21C17.4183 21 21 17.4183 21 13C21 8.58172 17.4183 5 13 5C8.58172 5 5 8.58172 5 13C5 17.4183 8.58172 21 13 21Z",fill:"var(--theme-elevation-500)"}),(0,p.jsx)("path",{d:"M13 16.1998V12.9998M13 9.7998H13.0077",stroke:"var(--theme-elevation-50)",strokeLinecap:"round",strokeLinejoin:"round"})]}),vb=()=>(0,p.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,p.jsx)("path",{d:"M13 21C17.4183 21 21 17.4183 21 13C21 8.58172 17.4183 5 13 5C8.58172 5 5 8.58172 5 13C5 17.4183 8.58172 21 13 21Z",fill:"var(--theme-success-500)"}),(0,p.jsx)("path",{d:"M10.6001 13.0004L12.2001 14.6004L15.4001 11.4004",stroke:"var(--theme-success-50)",strokeLinecap:"round",strokeLinejoin:"round"})]}),vv=()=>(0,p.jsxs)("svg",{fill:"none",height:"26",viewBox:"0 0 26 26",width:"26",xmlns:"http://www.w3.org/2000/svg",children:[(0,p.jsx)("path",{d:"M13 21C17.4183 21 21 17.4183 21 13C21 8.58172 17.4183 5 13 5C8.58172 5 5 8.58172 5 13C5 17.4183 8.58172 21 13 21Z",fill:"var(--theme-warning-500)"}),(0,p.jsx)("path",{d:"M13 10V13.2M13 16.4H13.008",stroke:"var(--theme-warning-50)",strokeLinecap:"round",strokeLinejoin:"round"})]}),vy=o.createContext({addClientFunction:()=>null,removeClientFunction:()=>null}),vx=o.createContext({}),vw=e=>{let t=(0,g.c)(6),{children:n}=e,a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a={},t[0]=a):a=t[0];let[l,r]=o.useState(a),i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=e=>{r(t=>{let n={...t};return n[e.key]=e.func,n})},t[1]=i):i=t[1];let s=i,c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=e=>{r(t=>{let n={...t};return delete n[e.key],n})},t[2]=c):c=t[2];let d=c,u;return t[3]!==n||t[4]!==l?(u=(0,p.jsx)(vy,{value:{addClientFunction:s,removeClientFunction:d},children:(0,p.jsx)(vx,{value:l,children:n})}),t[3]=n,t[4]=l,t[5]=u):u=t[5],u},vj=(e,t)=>{let n=(0,g.c)(6),{addClientFunction:a,removeClientFunction:l}=o.use(vy),r,i;n[0]!==a||n[1]!==t||n[2]!==e||n[3]!==l?(r=()=>(a({func:t,key:e}),()=>{l({func:t,key:e})}),i=[t,e,a,l],n[0]=a,n[1]=t,n[2]=e,n[3]=l,n[4]=r,n[5]=i):(r=n[4],i=n[5]),o.useEffect(r,i)},vC=()=>o.use(vx),vS=e=>{if(!e)return!1;try{let t="string"==typeof e?new URL(e,window.location.origin):e;return"http:"===t.protocol||"https:"===t.protocol}catch{return!1}},vk=e=>{try{let t=new URL(e,window.location.origin);return e.startsWith("http://")||e.startsWith("https://")?e:vS(t)?t.href:void 0}catch{return}},v_=({collisionRect:e,droppableContainers:t,...n})=>{let a=t.find(({id:e})=>"live-preview-area"===e),l=(0,v.Qo)({...n,collisionRect:e,droppableContainers:[a]});if(0===l.length)return l;let r=a?.rect?.current;if(e.top>=r.top&&e.left>=r.left&&e.bottom<=r.bottom&&e.right<=r.right)return l},v$=(e,t)=>{switch(t.type){case"height":return{...e,height:t.value};case"width":return{...e,width:t.value};default:return{...e,...t?.value||{}}}},vN=({breakpoints:e,children:t,isLivePreviewEnabled:n,isLivePreviewing:a,isPreviewEnabled:l,previewURL:r,typeofLivePreviewURL:i,url:s})=>{let[d,u]=(0,o.useState)("iframe"),[h,f]=(0,o.useState)(a),[m,b]=(0,o.useState)(h),y=(0,o.useCallback)(e=>{e&&b(!0),f(e)},[]),x=(0,o.useMemo)(()=>[...e||[],{name:"responsive",height:"100%",label:"Responsive",width:"100%"}],[e]),[w,j]=(0,o.useState)(""),[C,S]=(0,o.useState)(),k=(0,o.useCallback)(e=>{S(vS(e)?e:void 0)},[]);(0,o.useEffect)(()=>{k(r)},[r,k]);let{isPopupOpen:_,openPopupWindow:$,popupRef:N}=(e=>{let t,n,a=(0,g.c)(15),{eventType:l,onMessage:r,url:i}=e,s=(0,o.useRef)(!1),[d,u]=(0,o.useState)(!1),{config:p}=(0,c.c)(),{serverURL:h}=p,f=(0,o.useRef)(null),m,b;a[0]!==l||a[1]!==d||a[2]!==r||a[3]!==h||a[4]!==i?(m=()=>{let e=async e=>{e.origin!==window.location.origin||e.origin!==i||e.origin!==h||"function"!=typeof r||e.data?.type!==l||s.current||(s.current=!0,await r(e.data?.searchParams),s.current=!1)};return d&&f.current&&window.addEventListener("message",e,!1),()=>{window.removeEventListener("message",e)}},b=[r,l,i,h,d],a[0]=l,a[1]=d,a[2]=r,a[3]=h,a[4]=i,a[5]=m,a[6]=b):(m=a[5],b=a[6]),(0,o.useEffect)(m,b),a[7]!==i?(t=e=>{e&&e.preventDefault();let t={height:700,left:"auto",menubar:"no",popup:"yes",toolbar:"no",top:"auto",width:800},n=Object.entries(t).reduce((e,n)=>{let[a,l]=n,r=e;if("auto"===l){if("top"===a){let e=Math.round(window.innerHeight/2-t.height/2);r+=`top=${e},`}else if("left"===a){let e=Math.round(window.innerWidth/2-t.width/2);r+=`left=${e},`}return r}return r+`${a}=${l},`},"").slice(0,-1);f.current=window.open(i,"_blank",n),u(!0)},a[7]=i,a[8]=t):t=a[8];let v=t,y,x;return a[9]!==d?(y=()=>{let e;return d?e=setInterval(function(){f.current.closed&&(clearInterval(e),u(!1))},1e3):clearInterval(e),()=>{e&&clearInterval(e)}},x=[d,f],a[9]=d,a[10]=y,a[11]=x):(y=a[10],x=a[11]),(0,o.useEffect)(y,x),a[12]!==d||a[13]!==v?(n={isPopupOpen:d,openPopupWindow:v,popupRef:f},a[12]=d,a[13]=v,a[14]=n):n=a[14],n})({eventType:"payload-live-preview",url:w}),[P,E]=(0,o.useState)(!1),[D,T]=(0,o.useState)(!1),{collectionSlug:A,globalSlug:R}=lE(),L=(0,o.useRef)(!0),{setPreference:F}=lS(),O=o.useRef(null),[M,I]=(0,o.useState)(),[B,z]=(0,o.useState)(1),[U,V]=(0,o.useState)({x:0,y:0}),[H,q]=o.useReducer(v$,{height:0,width:0}),[W,K]=(0,o.useState)({height:0,width:0}),[Q,Y]=o.useState("responsive"),G=(0,o.useCallback)(e=>{let t;"string"==typeof e&&(t=vk(e)),t||y(!1),t!==w&&(E(!1),j(t))},[w]);(0,o.useEffect)(()=>{"string"==typeof s&&j(vk(s))},[s]);let X=(0,o.useCallback)(e=>{q({type:"width",value:e})},[q]),Z=(0,o.useCallback)(e=>{q({type:"height",value:e})},[q]);(0,o.useEffect)(()=>{let e=x?.find(e=>e.name===Q);e&&"responsive"!==Q&&"custom"!==Q&&"number"==typeof e?.width&&"number"==typeof e?.height&&q({type:"reset",value:{height:e.height,width:e.width}})},[Q,x]),(0,o.useEffect)(()=>{let e=e=>{w?.startsWith(e.origin)&&e.data&&"object"==typeof e.data&&"payload-live-preview"===e.data.type&&e.data.ready&&E(!0)};return window.addEventListener("message",e),T(!0),()=>{window.removeEventListener("message",e)}},[w,D]);let J=(0,o.useCallback)(e=>{E(!1),u(e),"popup"===e&&$()},[$]);(0,o.useEffect)(()=>{(_?"popup":"iframe")!==d&&J("iframe")},[d,_,J]),(0,o.useEffect)(()=>
47{if(L.current){L.current=!1;return}F(A?`collection-${A}`:`global-${R}`,{editViewType:h?"live-preview":"default"},!0)},[h,F,A,R]);let ee=(0,o.useId)();return(0,p.jsx)(mV,{value:{appIsReady:P,breakpoint:Q,breakpoints:x,iframeRef:O,isLivePreviewEnabled:n,isLivePreviewing:h,isPopupOpen:_,isPreviewEnabled:l,listeningForMessages:D,loadedURL:M,measuredDeviceSize:W,openPopupWindow:$,popupRef:N,previewURL:C,previewWindowType:d,setAppIsReady:E,setBreakpoint:Y,setHeight:Z,setIsLivePreviewing:y,setLoadedURL:I,setMeasuredDeviceSize:K,setPreviewURL:k,setPreviewWindowType:J,setSize:q,setToolbarPosition:V,setURL:G,setWidth:X,setZoom:z,shouldRenderIframe:m,size:H,toolbarPosition:U,typeofLivePreviewURL:i,url:w,zoom:B},children:(0,p.jsx)(v.Mp,{collisionDetection:v_,id:ee,onDragEnd:e=>{e.over&&"live-preview-area"===e.over.id&&V({x:U.x+e.delta.x,y:U.y+e.delta.y})},children:t})})},vP="progress-bar",vE=()=>{let e=(0,g.c)(9),{isTransitioning:t,transitionProgress:n}=te(),[a,l]=o.useState(null),r=(0,o.useRef)(!0),i,s;if(e[0]!==t||e[1]!==n?(i=()=>{let e,a;return t?r.current?a=setTimeout(()=>{l(n),r.current=!1},150):l(n):(r.current=!0,l(1),e=setTimeout(()=>{l(null)},400)),()=>{clearTimeout(e),clearTimeout(a)}},s=[t,n],e[0]=t,e[1]=n,e[2]=i,e[3]=s):(i=e[2],s=e[3]),(0,o.useEffect)(i,s),"number"==typeof a){let t=1===a&&`${vP}--fade-out`,n;e[4]!==t?(n=[vP,t].filter(Boolean),e[4]=t,e[5]=n):n=e[5];let l=n.join(" "),r;return e[6]!==a||e[7]!==l?(r=(0,p.jsx)("div",{className:l,style:{"--transition-duration":"200ms"},children:(0,p.jsx)("div",{className:`${vP}__progress`,style:{width:`${100*(a||0)}%`}})}),e[6]=a,e[7]=l,e[8]=r):r=e[8],r}return null},vD=(0,o.createContext)({}),vT=e=>{let t=(0,g.c)(6),{children:n,visibleEntities:a}=e,l;t[0]!==a?(l=e=>{let{collectionSlug:t,globalSlug:n}=e;return t?a.collections.includes(t):!!n&&a.globals.includes(n)},t[0]=a,t[1]=l):l=t[1];let r=l,i;return t[2]!==n||t[3]!==r||t[4]!==a?(i=(0,p.jsx)(vD,{value:{isEntityVisible:r,visibleEntities:a},children:n}),t[2]=n,t[3]=r,t[4]=a,t[5]=i):i=t[5],i},vA=()=>(0,o.use)(vD),vR=(0,o.createContext)({}),vL=e=>{let t=(0,g.c)(3),{children:n}=e,a=(0,m.useParams)(),l;return t[0]!==n||t[1]!==a?(l=(0,p.jsx)(vR,{value:a,children:n}),t[0]=n,t[1]=a,t[2]=l):l=t[2],l},vF=()=>(0,o.use)(vR),vO=(0,o.createContext)({}),vM=()=>(0,o.useContext)(vO),vI=(e,t)=>{let{timestamp:n,animationRef:a}=t;a.current=null;let{x:l,y:r,xDirection:i,yDirection:o,eventsFired:s,hasScrolled:c}=e,d=c||!!n,u=d?window.pageXOffset:0,p=d?window.pageYOffset:0,h=u-l,f=p-r,m=u/(document.body.scrollWidth-window.innerWidth)*100,g=p/(document.body.scrollHeight-window.innerHeight)*100;return{x:u,y:p,xDifference:h,yDifference:f,xDirection:h>0?"right":h<0?"left":i,yDirection:f>0?"down":f<0?"up":o,xPercentage:m,yPercentage:g,totalPercentage:(m+g)/2,eventsFired:d?s+1:s,hasScrolled:d}},vB=e=>{let{children:t}=e,n=(0,o.useRef)(null),[a,l]=(0,o.useReducer)(vI,{x:0,y:0,xDifference:0,yDifference:0,xDirection:void 0,yDirection:void 0,xPercentage:0,yPercentage:0,totalPercentage:0,eventsFired:0,hasScrolled:!1}),r=(0,o.useCallback)(e=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(t=>{l({e:e,timestamp:t,animationRef:n})})},[]);return(0,o.useEffect)(()=>(window.addEventListener("scroll",r),()=>{window.removeEventListener("scroll",r)}),[r]),o.createElement(vO.Provider,{value:Object.assign({},a)},t&&t)};function vz(){let e,t=(0,g.c)(6),{closeAllModals:n}=nN(),a=(0,m.usePathname)(),l;t[0]!==n?(l=()=>{n()},t[0]=n,t[1]=l):l=t[1];let r=tv(l),i=(0,o.useRef)(!0),s;return t[2]!==r?(s=()=>{if(i.current){i.current=!1;return}r()},t[2]=r,t[3]=s):s=t[3],t[4]!==a?(e=[a],t[4]=a,t[5]=e):e=t[5],(0,o.useEffect)(s,e),null}var{WindowInfoProvider:vU}=hl&&"WindowInfoProvider"in hl?hl:{WindowInfoProvider:void 0},{useWindowInfo:vV}=hl&&"useWindowInfo"in hl?hl:{useWindowInfo:void 0},vH=(0,o.createContext)({searchParams:{},stringifyParams:()=>""}),vq=({children:e})=>{let t=(0,m.useSearchParams)().toString(),n=o.useMemo(()=>N.q(t,{depth:10,ignoreQueryPrefix:!0}),[t]),a=o.useCallback(({params:e,replace:t=!1})=>x.A({...t?{}:n,...e},{addQueryPrefix:!0}),[n]);return(0,p.jsx)(vH,{value:{searchParams:n,stringifyParams:a},children:e})},vW=()=>(0,o.use)(vH),vK=({config:e})=>{let{admin:{toast:{duration:t,expand:n,limit:a,position:l}={}}={}}=e;return(0,p.jsx)(e8,{className:"payload-toast-container",closeButton:!0,dir:"undefined",duration:t??4e3,expand:n??!1,gap:8,icons:{error:(0,p.jsx)(vm,{}),info:(0,p.jsx)(vg,{}),success:(0,p.jsx)(vb,{}),warning:(0,p.jsx)(vv,{})},offset:"calc(var(--gutter-h) / 2)",position:l??"bottom-right",toastOptions:{classNames:{closeButton:"payload-toast-close-button",content:"toast-content",error:"toast-error",icon:"toast-icon",info:"toast-info",success:"toast-success",title:"toast-title",toast:"payload-toast-item",warning:"toast-warning"},unstyled:!0},visibleToasts:a??5})},vQ=e=>{let t=(0,g.c)(16),{children:n,config:a,dateFNSKey:l,fallbackLang:r,isNavOpen:i,languageCode:s,languageOptions:u,locale:h,permissions:f,serverFunction:m,switchLanguageServerAction:b,theme:y,translations:x,user:w}=e,j=o.useId(),C;return t[0]!==n||t[1]!==a||t[2]!==l||t[3]!==j||t[4]!==r||t[5]!==i||t[6]!==s||t[7]!==u||t[8]!==h||t[9]!==f||t[10]!==m||t[11]!==b||t[12]!==y||t[13]!==x||t[14]!==w?(C=(0,p.jsxs)(gS,{children:[(0,p.jsx)(cm,{serverFunction:m,children:(0,p.jsx)(e7,{children:(0,p.jsx)(pl,{cachingEnabled:"true"===en.env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH,children:(0,p.jsx)(c.b,{config:a,children:(0,p.jsx)(vw,{children:(0,p.jsx)(d.c,{dateFNSKey:l,fallbackLang:r,language:s,languageOptions:u,switchLanguageServerAction:b,translations:x,children:(0,p.jsx)(vU,{breakpoints:{l:"(max-width: 1440px)",m:"(max-width: 1024px)",s:"(max-width: 768px)",xs:"(max-width: 400px)"},children:(0,p.jsx)(vB,{children:(0,p.jsx)(vq,{children:(0,p.jsxs)(al,{classPrefix:"payload",transTime:0,zIndex:"var(--z-modal)",children:[(0,p.jsx)(vz,{}),(0,p.jsxs)(aw,{permissions:f,user:w,children:[(0,p.jsx)(lC,{children:(0,p.jsx)(c.i,{theme:y,children:(0,p.jsx)(vL,{children:(0,p.jsx)(a_,{locale:h,children:(0,p.jsx)(mw,{children:(0,p.jsx)(c$,{children:(0,p.jsx)(dU,{children:(0,p.jsx)(mm,{initialIsOpen:i,children:(0,p.jsx)(us,{children:(0,p.jsx)(v.Mp,{collisionDetection:v.TT,id:j,children:n})})})})})})})})})}),(0,p.jsx)(nQ,{}),(0,p.jsx)(av,{})]})]})})})})})})})})})}
47),(0,p.jsx)(vK,{config:a})]}),t[0]=n,t[1]=a,t[2]=l,t[3]=j,t[4]=r,t[5]=i,t[6]=s,t[7]=u,t[8]=h,t[9]=f,t[10]=m,t[11]=b,t[12]=y,t[13]=x,t[14]=w,t[15]=C):C=t[15],C};function vY(e){let{className:t,loginWithUsername:n,operation:a,permissions:l,readOnly:r,t:i}=e;function o(e,t){return(0,C.P)({field:{name:e,type:"text"},operation:"create"===a?"create":t,parentName:"",permissions:l}).operation}let s="object"==typeof l&&"email"in l&&l.email,c="object"==typeof l&&"username"in l&&l.username,d=s?{read:o("email","read"),update:o("email","update")}:{read:!0,update:!0},u=c?{read:o("username","read"),update:o("username","update")}:{read:!0,update:!0},h=(!n||n?.requireEmail||n?.allowEmailLogin)&&d.read,f=!!n&&u.read;if(h||f)return(0,p.jsxs)("div",{className:["login-fields",t&&t].filter(Boolean).join(" "),children:[h?(0,p.jsx)(lF,{value:"email",children:(0,p.jsx)(s2,{field:{name:"email",admin:{autoComplete:"off"},label:i("general:email"),required:!n||n&&n.requireEmail},path:"email",readOnly:r||!d.update,schemaPath:"email",validate:Q.Rp})}):null,f&&(0,p.jsx)(lF,{value:"username",children:(0,p.jsx)(u_,{field:{name:"username",admin:{autoComplete:"off"},label:i("authentication:username"),required:n&&n.requireUsername},path:"username",readOnly:r||!u.update,schemaPath:"username",validate:Q.Xh})})]})}var vG="select-all",vX=()=>{let e=(0,g.c)(7),{selectAll:t,toggleAll:n}=mO(),{i18n:a}=(0,d.d)(),l;if(e[0]!==a||e[1]!==t||e[2]!==n){let r,i;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=[vG,`${vG}__checkbox`],e[4]=r):r=e[4],e[5]!==n?(i=()=>n(),e[5]=n,e[6]=i):i=e[6],l=(0,p.jsx)(lY,{"aria-label":t===mA.None?a.t("general:selectAllRows"):a.t("general:deselectAllRows"),checked:t===mA.AllInPage||t===mA.AllAvailable,className:r.join(" "),id:"select-all",name:"select-all",onToggle:i,partialChecked:t===mA.Some}),e[0]=a,e[1]=t,e[2]=n,e[3]=l}else l=e[3];return l},vZ="select-row",vJ=e=>{let t,n,a,l=(0,g.c)(13),{rowData:r}=e,{user:i}=aj(),{selected:o,setSelection:s}=mO(),c;if(l[0]!==r||l[1]!==i?.id){c=Symbol.for("react.early_return_sentinel");e:{let{_isLocked:e,_userEditing:t}=r||{};if(e&&t&&t.id!==i?.id){c=(0,p.jsx)(m6,{user:t});break e}}l[0]=r,l[1]=i?.id,l[2]=c}else c=l[2];if(c!==Symbol.for("react.early_return_sentinel"))return c;l[3]!==r.id||l[4]!==o?(t=o.get(r.id),l[3]=r.id,l[4]=o,l[5]=t):t=l[5];let d=!!t,u;return l[6]===Symbol.for("react.memo_cache_sentinel")?(u=[vZ,`${vZ}__checkbox`],l[6]=u):u=l[6],l[7]!==r.id||l[8]!==s?(n=()=>s(r.id),l[7]=r.id,l[8]=s,l[9]=n):n=l[9],l[10]!==d||l[11]!==n?(a=(0,p.jsx)(lY,{checked:d,className:u.join(" "),onToggle:n}),l[10]=d,l[11]=n,l[12]=a):a=l[12],a},v0=e=>{let{onClick:t}=e,{count:n,selected:a}=mO(),{t:l}=(0,d.d)();return a&&n?(0,p.jsxs)(ra,{onClick:()=>{"function"==typeof t&&t(a)},pillStyle:"white",size:"small",children:[l("general:select")," ",n]}):null},v1="collection-list";function v3(e){let{AfterList:t,AfterListTable:n,beforeActions:a,BeforeList:l,BeforeListTable:r,collectionSlug:i,columnState:s,Description:u,disableBulkDelete:f,disableBulkEdit:g,disableQueryPresets:b,enableRowSelections:v,hasCreatePermission:x,hasDeletePermission:w,hasTrashPermission:j,listMenuItems:C,newDocumentURL:S,queryPreset:k,queryPresetPermissions:_,renderedFilters:$,resolvedFilterOptions:N,Table:P,viewType:E}=e,[D]=(0,c.a)(P),{allowCreate:T,createNewDrawerSlug:A,isInDrawer:R,onBulkSelect:L}=ci(),F=void 0!==T?T&&x:x,{config:{routes:{admin:O},serverURL:M},getEntityConfig:I}=(0,c.c)(),B=(0,m.useRouter)(),{data:z,isGroupingBy:U}=cc(),{openModal:V}=nN(),{drawerSlug:H,setCollectionSlug:q,setOnSuccess:W}=h$(),Q=I({collectionSlug:i}),{labels:Y,upload:G}=Q,X=!!G,Z=X&&Q.upload.bulkUpload,J=!!Q.trash,{i18n:ee}=(0,d.d)(),{setStepNav:et}=my(),{breakpoints:{s:en}}=vV(),ea=o.useMemo(()=>X?z.docs.map(e=>({...e,filesize:(0,K.B)(e.filesize)})):z?.docs,[z?.docs,X]),el=o.useCallback(()=>{q(i),V(H),W(()=>B.refresh())},[B,i,H,V,q,W]);return(0,o.useEffect)(()=>{if(!R){let e={label:(0,h.s)(Y?.plural,ee),url:J&&"trash"===E?(0,y.Q)({adminRoute:O,path:`/collections/${i}`}):void 0},t={label:ee.t("general:trash")};et(J&&"trash"===E?[e,t]:[e])}},[O,et,M,Y,R,J,E,ee,i]),(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(cv,{collectionSlug:i,columnState:s,children:(0,p.jsx)("div",{className:`${v1} ${v1}--${i}`,children:(0,p.jsxs)(mF,{docs:ea,totalDocs:z?.totalDocs,children:[l,(0,p.jsxs)(ai,{className:`${v1}__wrap`,children:[(0,p.jsx)(bh,{collectionConfig:Q,Description:u||Q?.admin?.description?(0,p.jsx)("div",{className:`${v1}__sub-header`,children:(0,p.jsx)(em,{CustomComponent:u,Fallback:(0,p.jsx)(f5,{collectionSlug:i,description:Q?.admin?.description})})}):void 0,disableBulkDelete:f,disableBulkEdit:g,hasCreatePermission:F,hasDeletePermission:w,hasTrashPermission:j,i18n:ee,isBulkUploadEnabled:Z&&!G.hideFileInputOnCreate,isTrashEnabled:J,newDocumentURL:S,openBulkUpload:el,smallBreak:en,viewType:E}),(0,p.jsx)(gZ,{beforeActions:v&&"function"==typeof L?a?[...a,(0,p.jsx)(v0,{onClick:L},"select-many")]:[(0,p.jsx)(v0,{onClick:L},"select-many")]:a,collectionConfig:Q,collectionSlug:i,disableQueryPresets:Q?.enableQueryPresets!==!0||b,listMenuItems:C,queryPreset:k,queryPresetPermissions:_,renderedFilters:$,resolvedFilterOptions:N}),r,ea?.length>0&&(0,p.jsx)("div",{className:`${v1}__tables`,children:(0,p.jsx)(cY,{children:D})}),ea?.length===0&&(0,p.jsx)(cq,{Actions:F&&S&&"trash"!==E?[R?(0,p.jsx)(tN,{el:"button",onClick:()=>V(A),children:ee.t("general:createNewLabel",{label:(0,h.s)(Y?.singular,ee)})},"create"):(0,p.jsx)(tN,{el:"link",to:S,children:ee.t("general:createNewLabel",{label:(0,h.s)(Y?.singular,ee)})},"create")]:[],Message:"trash"===E?(0,p.jsx)("p",{children:ee.t("general:noTrashResults",{label:(0,h.s)(Y?.plural,ee)})}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("h3",{children:ee.t("general:noResultsFound")}),(0,p.jsx)("p",{children:ee.t("general:noResultsDescription")})]})}),n,ea?.length>0&&!U&&(0,p.jsx)(bw,{AfterPageControls:en?(0,p.jsxs)("div",{className:`${v1}__list-selection`,children:[(0,p.jsx)(g7,{collectionConfig:Q,disableBulkDelete:f,disableBulkEdit:g,label:(0,h.s)(Q.labels.plural,ee),showSelectAllAcrossPages:!U}),(0,p.jsx)("div",{className:`${v1}__list-selection-actions`,children:v&&"function"==typeof L?a?[...a,(0,p.jsx)(v0,{onClick:L},"select-many")]:[(0,p.jsx)(v0,{onClick:L},"select-many")]:a})]}):null,collectionConfig:Q})]}),t]})})}),ea?.length>0&&U&&z.totalPages>1&&(0,p.jsx)(bj,{children:(0,p.jsx)(bw,{collectionConfig:Q})})]})}var v2=e=>{let t,n,a,l,r=(0,g.c)(20),{id:i,collectionSlug:s,isOpen:c,onOpenChange:d,...u}=e,h=nc(),f=o.useId(),{closeModal:m,modalState:b,openModal:v}=nN(),y;
47r[0]!==s||r[1]!==h||r[2]!==i||r[3]!==f?(y=cB({id:i,collectionSlug:s,depth:h,uuid:f}),r[0]=s,r[1]=h,r[2]=i,r[3]=f,r[4]=y):y=r[4];let x=y,w=!!b[x]?.isOpen,j=o.useRef(w),C,S;return r[5]!==m||r[6]!==x||r[7]!==w||r[8]!==c||r[9]!==v?(C=()=>{c&&!w&&v(x),!c&&w&&m(x)},S=[m,x,w,c,v],r[5]=m,r[6]=x,r[7]=w,r[8]=c,r[9]=v,r[10]=C,r[11]=S):(C=r[10],S=r[11]),o.useEffect(C,S),r[12]!==w||r[13]!==d?(t=()=>{j.current!==w&&(j.current=w,d?.(w))},n=[w,d],r[12]=w,r[13]=d,r[14]=t,r[15]=n):(t=r[14],n=r[15]),o.useEffect(t,n),r[16]!==m||r[17]!==x?(a=()=>()=>{m(x)},l=[m,x],r[16]=m,r[17]=x,r[18]=a,r[19]=l):(a=r[18],l=r[19]),o.useEffect(a,l),(0,p.jsx)(cU,{...u,collectionSlug:s,drawerSlug:x,id:i})},v6="move-to-folder--current-folder",v5="confirm-many-delete";function v4({className:e}){let t=(0,m.useRouter)(),{startRouteTransition:n}=te(),{breadcrumbs:a,currentFolder:l,folderCollectionConfig:r,folderCollectionSlug:i,folderFieldName:s,folderID:u,getFolderRoute:f,moveToFolder:g}=pn(),[b,,{closeDrawer:v,openDrawer:x}]=cV({id:u,collectionSlug:i}),{clearRouteCache:w}=pr(),{config:j}=(0,c.c)(),{routes:C}=j,{closeModal:S,openModal:k}=nN(),{i18n:_,t:$}=(0,d.d)(),N=o.useCallback(async()=>{await fetch((0,y.Q)({apiRoute:C.api,path:`/${i}/${u}?depth=0`}),{credentials:"include",method:"DELETE"}),n(()=>{t.push(f(a[a.length-2]?.id||null))})},[a,i,u,f,t,C.api,n]);return u?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(tC,{button:(0,p.jsx)(gI,{}
47),className:["current-folder-actions",e].filter(Boolean).join(" "),render:()=>(0,p.jsxs)(tp.ButtonGroup,{children:[(0,p.jsx)(tp.Button,{onClick:()=>{x()},children:$("general:editLabel",{label:(0,h.s)(r.labels.singular,_)})}),(0,p.jsx)(tp.Button,{onClick:()=>{k(v6)},children:$("folder:moveFolder")}),(0,p.jsx)(tp.Button,{onClick:()=>{k(v5)},children:$("folder:deleteFolder")})]})}),(0,p.jsx)(pv,{action:"moveItemToFolder",drawerSlug:v6,folderAssignedCollections:l?.value.folderType,folderCollectionSlug:i,folderFieldName:s,fromFolderID:l?.value.id,fromFolderName:l?.value._folderOrDocumentTitle,itemsToMove:[l],onConfirm:async({id:e,name:t})=>{await g({itemsToMove:[l],toFolderID:e}),e?e3.success($("folder:itemHasBeenMoved",{folderName:`"${t}"`,title:l.value._folderOrDocumentTitle})):e3.success($("folder:itemHasBeenMovedToRoot",{title:l.value._folderOrDocumentTitle})),S(v6)},title:l.value._folderOrDocumentTitle}),(0,p.jsx)(ag,{body:(0,p.jsx)(pu,{elements:{1:({children:e})=>(0,p.jsx)("strong",{children:e})},i18nKey:"general:aboutToDelete",t:$,variables:{label:(0,h.s)(r.labels.singular,_),title:l.value._folderOrDocumentTitle}}),confirmingLabel:$("general:deleting"),heading:$("general:confirmDeletion"),modalSlug:v5,onConfirm:N}),(0,p.jsx)(b,{onSave:()=>{v(),w()}})]}):null}var v8="drag-overlay-selection";function v7({item:e,selectedCount:t}){return(0,p.jsx)(v.Hd,{dropAnimation:null,modifiers:[v9],style:{height:"unset",maxWidth:"220px"},children:(0,p.jsxs)("div",{className:`${v8}__cards`,children:[Array.from({length:t>1?2:1}).map((t,n)=>(0,p.jsx)("div",{className:`${v8}__card`,style:{right:`${3*n}px`,top:`-${3*n}px`},children:(0,p.jsx)(b1,{id:null,isSelected:!0,itemKey:"overlay-card",title:e.value._folderOrDocumentTitle,type:"folder"})},n)),t>1?(0,p.jsx)("span",{className:`${v8}__card-count`,children:t}):null]})})}var v9=({activatorEvent:e,draggingNodeRect:t,transform:n})=>{if(t&&e){let a=function(e){if(function(e){if(!e)return!1;let{TouchEvent:t}=tU(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return"clientX"in e&&"clientY"in e?{x:e.clientX,y:e.clientY}:null}(e);if(!a)return n;let l=a.x-t.left,r=a.y-t.top;return{...n,x:n.x+l+5,y:n.y+r+5}}return n},ye="sort-by-pill",yt=[{label:e=>e("general:name"),value:"name"},{label:e=>e("general:createdAt"),value:"createdAt"},{label:e=>e("general:updatedAt"),value:"updatedAt"}],yn=[{label:e=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(fe,{}),e("general:ascending")]}),value:"asc"},{label:e=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(h9,{}),e("general:descending")]}),value:"desc"}];function ya(){let{refineFolderData:e,sort:t}=pn(),{t:n}=(0,d.d)(),a=t.startsWith("-")?"desc":"asc",[l]=yt.filter(({value:e})=>e===(t.startsWith("-")?t.slice(1):t))||yt,[r]=yn.filter(({value:e})=>e===a);return(0,p.jsx)(tC,{button:(0,p.jsxs)(ra,{className:`${ye}__trigger`,icon:(0,p.jsx)(to,{}),size:"small",children:["asc"===a?(0,p.jsx)(fe,{className:`${ye}__sort-icon`}):(0,p.jsx)(h9,{className:`${ye}__sort-icon`}),l?.label(n)]}),className:ye,horizontalAlign:"right",render:({close:t})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(tp.GroupLabel,{label:"Sort by"}),(0,p.jsx)(tp.ButtonGroup,{children:yt.map(({label:r,value:i})=>(0,p.jsx)(tp.Button,{active:l?.value===i,onClick:()=>{e({query:{page:"1",sort:"desc"===a?`-${i}`:i},updateURL:!0}),t()},children:r(n)},i))}),(0,p.jsx)(tp.Divider,{}),(0,p.jsx)(tp.GroupLabel,{label:"Order"}),(0,p.jsx)(tp.ButtonGroup,{children:yn.map(({label:i,value:o})=>(0,p.jsx)(tp.Button,{active:r?.value===o,className:`${ye}__order-option`,onClick:()=>{a!==o&&(e({query:{page:"1",sort:"desc"===o?`-${l?.value}`:l?.value},updateURL:!0}),t())},children:i(n)},o))})]}),showScrollbar:!0,verticalAlign:"bottom"})}var yl="folder-view-toggle-button";function yr({activeView:e,setActiveView:t}){return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(tN,{buttonStyle:"pill",className:[yl,"grid"===e&&`${yl}--active`].filter(Boolean).join(" "),icon:(0,p.jsx)(vh,{}),margin:!1,onClick:()=>{t("grid")}}),(0,p.jsx)(tN,{buttonStyle:"pill",className:[yl,"list"===e&&`${yl}
47--active`].filter(Boolean).join(" "),icon:(0,p.jsx)(vf,{}),margin:!1,onClick:()=>{t("list")}})]})}var yi=({id:e,folderCollectionSlug:t})=>{let{clearRouteCache:n}=pr(),{t:a}=(0,d.d)(),[l,,{closeDrawer:r,openDrawer:i}]=cV({id:e,collectionSlug:t});return e?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(mB,{onClick:i,type:"button",children:a("general:edit")}),(0,p.jsx)(l,{onSave:()=>{r(),n()}})]}):null},yo="move-to-folder--list",ys=e=>{let t=(0,g.c)(17),{disableBulkDelete:n,disableBulkEdit:a,folderAssignedCollections:l}=e,{clearSelections:r,currentFolder:i,folderCollectionSlug:s,folderFieldName:u,folderID:h,getSelectedItems:f,moveToFolder:m}=pn(),{clearRouteCache:b}=pr(),{config:v}=(0,c.c)(),{t:y}=(0,d.d)(),{closeModal:x,openModal:w}=nN(),j,C;if(t[0]!==b||t[1]!==r||t[2]!==x||t[3]!==v||t[4]!==i?.value?._folderOrDocumentTitle||t[5]!==n||t[6]!==a||t[7]!==l||t[8]!==s||t[9]!==u||t[10]!==h||t[11]!==f||t[12]!==m||t[13]!==w||t[14]!==y){C=Symbol.for("react.early_return_sentinel");e:{let e=f(),t=e.reduce(yc,{}),c=e.length,d=1===Object.keys(t).length&&Object.keys(t)[0]!==s,g=d?v.collections.find(e=>e.slug===Object.keys(t)[0]):null;if(0===c){C=null;break e}let S=d&&t[Object.keys(t)[0]]?.ids||[];j=(0,p.jsx)(mI,{count:c,ListActions:[c>0&&(0,p.jsx)(mB,{onClick:()=>r(),children:y("general:clearAll")},"clear-all")].filter(Boolean),SelectionActions:[!a&&S.length&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(gA,{collection:g,count:c,ids:S,selectAll:!1}),(0,p.jsx)(g1,{collection:g,count:c,ids:S,selectAll:!1}),(0,p.jsx)(g8,{collection:g,count:c,ids:S,selectAll:!1})]},"bulk-actions"),1===c&&!d&&(0,p.jsx)(yi,{folderCollectionSlug:s,id:t[s].ids[0]},"edit-folder-action"),c>0?(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(mB,{onClick:()=>{w(yo)},type:"button",children:y("general:move")}),(0,p.jsx)(pv,{action:"moveItemsToFolder",drawerSlug:yo,folderAssignedCollections:l,folderCollectionSlug:s,folderFieldName:u,fromFolderID:h,fromFolderName:i?.value?._folderOrDocumentTitle,itemsToMove:f(),onConfirm:async e=>{let{id:t,name:n}=e;await m({itemsToMove:f(),toFolderID:t}),t?e3.success(y("folder:itemsMovedToFolder",{folderName:`"${n}"`,title:`${c} ${c>1?y("general:items"):y("general:item")}`})):e3.success(y("folder:itemsMovedToRoot",{title:`${c} ${c>1?y("general:items"):y("general:item")}`})),b(),x(yo)}})]},yo):null,!n&&(0,p.jsx)(mU,{afterDelete:()=>{b(),r()},hasDeletePermission:!0,selections:t},"bulk-delete")].filter(Boolean)})}t[0]=b,t[1]=r,t[2]=x,t[3]=v,t[4]=i?.value?._folderOrDocumentTitle,t[5]=n,t[6]=a,t[7]=l,t[8]=s,t[9]=u,t[10]=h,t[11]=f,t[12]=m,t[13]=w,t[14]=y,t[15]=j,t[16]=C}else j=t[15],C=t[16];return C!==Symbol.for("react.early_return_sentinel")?C:j};function yc(e,t){return t&&(e[t.relationTo]?(e[t.relationTo].ids.push((0,q.r)(t.value)),e[t.relationTo].totalCount=e[t.relationTo].totalCount+1):e[t.relationTo]={ids:[(0,q.r)(t.value)],totalCount:1}),e}var yd="collection-folder-list";function yu({allCollectionFolderSlugs:e,allowCreateCollectionSlugs:t,baseFolderPath:n,breadcrumbs:a,documents:l,folderFieldName:r,folderID:i,FolderResultsComponent:o,search:s,sort:c,subfolders:d,...u}){return(0,p.jsx)(pt,{allCollectionFolderSlugs:e,allowCreateCollectionSlugs:t,baseFolderPath:n,breadcrumbs:a,documents:l,folderFieldName:r,folderID:i,FolderResultsComponent:o,search:s,sort:c,subfolders:d,children:(0,p.jsx)(yp,{...u})})}function yp(e){let t,n=(0,g.c)(9),{AfterFolderList:a,AfterFolderListTable:l,BeforeFolderList:r,BeforeFolderListTable:i,collectionSlug:s,Description:u,disableBulkDelete:f,disableBulkEdit:b,search:v,viewPreference:x}=e,{config:w,getEntityConfig:j}=(0,c.c)(),{i18n:C,t:S}=(0,d.d)(),k=nc(),{setStepNav:_}=my(),{setPreference:$}=lS(),{allowCreateCollectionSlugs:N,breadcrumbs:P,documents:E,dragOverlayItem:D,folderCollectionConfig:T,folderCollectionSlug:A,folderFieldName:R,folderID:F,FolderResultsComponent:O,folderType:M,getSelectedItems:I,moveToFolder:B,refineFolderData:z,selectedItemKeys:U,setIsDragging:V,subfolders:H}=pn(),q=(0,m.useRouter)(),{startRouteTransition:W}=te(),{clearRouteCache:K}=pr(),Q=j({collectionSlug:s}),{labels:Y,upload:G}=Q,X=!!G&&Q.upload.bulkUpload,{breakpoints:Z}=vV(),{s:J}=Z,[ee,et]=o.useState(),en;n[0]!==K||n[1]!==I||n[2]!==B?(en=async e=>{if(e.over&&"folder"===e.over.data.current.type&&"id"in e.over.data.current){try{await B({itemsToMove:I(),toFolderID:e.over.data.current.id})}catch(e){console.error("Error moving items:",e)}K()}},n[0]=K,n[1]=I,n[2]=B,n[3]=en):en=n[3];let ea=en,el=async e=>{await $(`${s}-collection-folder`,{viewPreference:e}),K()},er=ee||A,ei;n[4]!==er?(ei=e=>{let{slug:t}=e;return t===er},n[4]=er,n[5]=ei):ei=n[5];let eo=w.collections.find(ei),es=er===A;o.useEffect(()=>{k||_([P.length?{label:(0,p.jsxs)(pf,{className:[`${yd}__step-nav-droppable`,`${yd}
47__step-nav-icon-label`].filter(Boolean).join(" "),id:null,onClick:()=>{W(()=>{w.folders&&q.push((0,y.Q)({adminRoute:w.routes.admin,path:`/collections/${s}/${w.folders.slug}`}))})},children:[(0,p.jsx)(pm,{}),(0,h.s)(Y?.plural,C)]},"root")}:{label:(0,p.jsxs)("div",{className:`${yd}__step-nav-icon-label`,children:[(0,p.jsx)(pm,{}),(0,h.s)(Y?.plural,C)]},"root")},...P.map((e,t)=>({label:t===P.length-1?e.name:(0,p.jsx)(pf,{className:`${yd}__step-nav-droppable`,id:e.id,onClick:()=>{W(()=>{w.folders&&q.push((0,y.Q)({adminRoute:w.routes.admin,path:`/collections/${s}/${w.folders.slug}/${e.id}`}))})},children:e.name},e.id)}))])},[P,s,w.folders,w.routes.admin,w.serverURL,k,C,Y?.plural,q,_,W]);let ec=E.length+H.length,ed=Array.isArray(M)?M:[s],eu=e=>{et(e)},ep;return n[6]!==z?(ep=e=>z({query:{search:e},updateURL:!0}),n[6]=z,n[7]=ep):ep=n[7],n[8]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{e||et(void 0)},n[8]=t):t=n[8],(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(yh,{onDragEnd:ea,setIsDragging:V}),(0,p.jsxs)("div",{className:`${yd} ${yd}--${s}`,children:[r,(0,p.jsxs)(ai,{className:`${yd}__wrap`,children:[(0,p.jsx)(ba,{Actions:[!J&&(0,p.jsx)(ys,{disableBulkDelete:Q.disableBulkDelete??f,disableBulkEdit:Q.disableBulkEdit??b,folderAssignedCollections:Array.isArray(M)?M:[s]},"list-selection"),(0,p.jsx)(bt,{collectionConfig:Q,config:w,viewType:"folders"},"default-list-actions")].filter(Boolean),AfterListHeaderContent:u,title:(0,h.s)(Y?.plural,C),TitleActions:[N.length&&(0,p.jsx)(bc,{buttonLabel:N.length>1?S("general:createNew"):`${S("general:create")} ${(0,h.s)(T.labels?.singular,C).toLowerCase()}`,collectionSlugs:N,onRequestCreate:eu},"create-new-button"),(0,p.jsx)(bi,{collectionSlug:s,hasCreatePermission:N.includes(s),isBulkUploadEnabled:X},"bulk-upload-button")].filter(Boolean)}),(0,p.jsx)(gG,{Actions:[(0,p.jsx)(ya,{},"sort-by-pill"),(0,p.jsx)(yr,{activeView:x,setActiveView:el},"toggle-view-buttons"),(0,p.jsx)(v4,{},"current-folder-actions")].filter(Boolean),label:S("general:searchBy",{label:S("general:name")}),onSearchChange:ep,searchQueryParam:v}),i,ec>0&&O,0===ec&&(0,p.jsx)(cq,{Actions:[N.includes(A)&&(0,p.jsx)(bc,{buttonLabel:`${S("general:create")} ${(0,h.s)(T.labels?.singular,C).toLowerCase()}`,buttonSize:"medium",buttonStyle:"primary",collectionSlugs:[T.slug],onRequestCreate:eu},"create-folder"),N.includes(s)&&(0,p.jsx)(bc,{buttonLabel:`${S("general:create")} ${S("general:document").toLowerCase()}`,buttonSize:"medium",buttonStyle:"primary",collectionSlugs:[s],onRequestCreate:eu},"create-document")].filter(Boolean),Message:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("h3",{children:C.t("general:noResultsFound")}),(0,p.jsx)("p",{children:C.t("general:noResultsDescription")})]})}),l]}),a]}),U.size>0&&D&&(0,p.jsx)(v7,{item:D,selectedCount:U.size}),(0,p.jsx)(v2,{collectionSlug:er,initialData:{[R]:F,...es?{folderType:ed}:{}},isOpen:!!ee,onOpenChange:t,onSave:e=>{let{operation:t}=e,n=(0,L.s8)(eo);(n||"create"===t)&&K(),"create"!==t||n||et(void 0)},redirectAfterCreate:!1})]})}function yh(e){let t=(0,g.c)(3),{onDragEnd:n,setIsDragging:a}=e,l;return t[0]!==n||t[1]!==a?(l={onDragCancel(){a(!1)},onDragEnd(e){a(!1),n(e)},onDragStart(){a(!0)}},t[0]=n,t[1]=a,t[2]=l):l=t[2],(0,v.E5)(l),null}var yf="checkbox-popup";function ym({Button:e,className:t,onChange:n,options:a,selectedValues:l,...r}){return(0,p.jsx)(tC,{button:e,className:[yf,t].filter(Boolean).join(" "),horizontalAlign:"right",render:({close:e})=>(0,p.jsx)("div",{className:`${yf}__options`,children:a.map(({label:t,value:a})=>(0,p.jsx)(lY,{checked:l?.includes(a),label:t,onToggle:()=>{n({close:e,selectedValues:l?.includes(a)?l.filter(e=>e!==a):[...l,a]})}},a))}),showScrollbar:!0,verticalAlign:"bottom",...r})}function yg(){let e=(0,g.c)(13),{activeCollectionFolderSlugs:t,allCollectionFolderSlugs:n,folderCollectionSlug:a,refineFolderData:l}=pn(),{i18n:r,t:i}=(0,d.d)(),{config:s,getEntityConfig:u}=(0,c.c)(),f;e[0]!==s||e[1]!==a||e[2]!==n||e[3]!==u||e[4]!==r?(f=()=>s.collections.reduce((e,t)=>(t.folders&&n.includes(t.slug)&&e.push({label:(0,h.s)(t.labels?.plural,r),value:t.slug}),e),[{label:(0,h.s)(u({collectionSlug:a}).labels?.plural,r),value:a}]),e[0]=s,e[1]=a,e[2]=n,e[3]=u,e[4]=r,e[5]=f):f=e[5];let[m]=o.useState(f),b;if(e[6]!==m||e[7]!==l||e[8]!==i||e[9]!==t){let n;e[11]!==l?(n=e=>{let{selectedValues:t}=e;l({query:{relationTo:t},updateURL:!0})},e[11]=l,e[12]=n):n=e[12],b=(0,p.jsx)(ym,{Button:(0,p.jsxs)(tN,{buttonStyle:"pill",el:"div",icon:"chevron",margin:!1,size:"small",children:[t.length?(0,p.jsx)("span",{className:"collection-type__count",children:t.length}):null,i("version:type")]}),onChange:n,options:m,selectedValues:t}
47,"relation-to-selection-popup"),e[6]=m,e[7]=l,e[8]=i,e[9]=t,e[10]=b}else b=e[10];return b}var yb="folder-list";function yv({activeCollectionFolderSlugs:e,allCollectionFolderSlugs:t,allowCreateCollectionSlugs:n,baseFolderPath:a,breadcrumbs:l,documents:r,folderFieldName:i,folderID:o,FolderResultsComponent:s,search:c,subfolders:d,...u}){return(0,p.jsx)(pt,{activeCollectionFolderSlugs:e,allCollectionFolderSlugs:t,allowCreateCollectionSlugs:n,baseFolderPath:a,breadcrumbs:l,documents:r,folderFieldName:i,folderID:o,FolderResultsComponent:s,search:c,subfolders:d,children:(0,p.jsx)(yy,{...u})})}function yy(e){let t,n=(0,g.c)(23),{AfterFolderList:a,AfterFolderListTable:l,BeforeFolderList:r,BeforeFolderListTable:i,Description:s,disableBulkDelete:u,disableBulkEdit:f,folderAssignedCollections:b,viewPreference:v}=e,y=(0,m.useRouter)(),{config:x}=(0,c.c)(),{i18n:w,t:j}=(0,d.d)(),C=nc(),{setStepNav:S}=my(),{startRouteTransition:k}=te(),{clearRouteCache:_}=pr(),{breakpoints:$}=vV(),{s:N}=$,{setPreference:P}=lS(),{allowCreateCollectionSlugs:E,breadcrumbs:D,documents:T,dragOverlayItem:A,folderCollectionConfig:R,folderFieldName:F,folderID:O,folderType:M,getFolderRoute:I,getSelectedItems:B,moveToFolder:z,refineFolderData:U,search:V,selectedItemKeys:H,setIsDragging:q,subfolders:W}=pn(),[K,Q]=o.useState(),[Y,G]=o.useState(v||"grid"),X;n[0]!==D||n[1]!==R.labels?.plural||n[2]!==w||n[3]!==j?(X=()=>j("folder:searchByNameInFolder",{folderName:0===D.length?(0,h.s)(R.labels?.plural,w):D[D.length-1].name}),n[0]=D,n[1]=R.labels?.plural,n[2]=w,n[3]=j,n[4]=X):X=n[4];let[Z]=o.useState(X),ee;n[5]!==_||n[6]!==B||n[7]!==z?(ee=async e=>{e.over&&"folder"===e.over.data.current.type&&"id"in e.over.data.current&&(await z({itemsToMove:B(),toFolderID:e.over.data.current.id||null}),_())},n[5]=_,n[6]=B,n[7]=z,n[8]=ee):ee=n[8];let et=ee,en=T.length+W.length,ea=D.length?D[D.length-1].name:j("folder:browseByFolder"),el=K||R.slug,er;n[9]!==el?(er=e=>{let{slug:t}=e;return t===el},n[9]=el,n[10]=er):er=n[10];let ei=x.collections.find(er),eo=el===R.slug,es,ec;n[11]!==D||n[12]!==C||n[13]!==I||n[14]!==y||n[15]!==S||n[16]!==k||n[17]!==j?(es=()=>{C||S([D.length?{label:(0,p.jsxs)(pf,{className:[`${yb}__step-nav-droppable`,`${yb}__step-nav-icon-label`].filter(Boolean).join(" "),id:null,onClick:()=>{k(()=>{y.push(I(null))})},children:[(0,p.jsx)(pm,{}),j("folder:browseByFolder")]},"root")}:{label:(0,p.jsxs)("div",{className:`${yb}__step-nav-icon-label`,children:[(0,p.jsx)(pm,{}),j("folder:browseByFolder")]},"root")},...D.map((e,t)=>({label:t===D.length-1?e.name:(0,p.jsx)(pf,{className:`${yb}__step-nav-droppable`,id:e.id,onClick:()=>{k(()=>{y.push(I(e.id))})},children:e.name},e.id)}))])},ec=[D,C,I,y,S,k,j],n[11]=D,n[12]=C,n[13]=I,n[14]=y,n[15]=S,n[16]=k,n[17]=j,n[18]=es,n[19]=ec):(es=n[18],ec=n[19]),o.useEffect(es,ec);let ed=E.filter(e=>e!==R.slug),eu=Array.isArray(M)?M:[],ep=e=>{Q(e)},eh;return n[20]!==U?(eh=e=>U({query:{search:e},updateURL:!0}),n[20]=U,n[21]=eh):eh=n[21],n[22]===Symbol.for("react.memo_cache_sentinel")?(t=e=>{e||Q(void 0)},n[22]=t):t=n[22],(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(yx,{onDragEnd:et,setIsDragging:q}),(0,p.jsxs)("div",{className:`${yb} ${yb}--folders`,children:[r,(0,p.jsxs)(ai,{className:`${yb}__wrap`,children:[(0,p.jsx)(ba,{Actions:[!N&&(0,p.jsx)(ys,{disableBulkDelete:u,disableBulkEdit:f,folderAssignedCollections:b},"list-selection")].filter(Boolean),AfterListHeaderContent:s,title:ea,TitleActions:[E.length&&(0,p.jsx)(bc,{buttonLabel:E.length>1?j("general:createNew"):`${j("general:create")} ${(0,h.s)(R.labels?.singular,w).toLowerCase()}`,collectionSlugs:E,onRequestCreate:ep},"create-new-button")].filter(Boolean)}),(0,p.jsx)(gG,{Actions:[(0,p.jsx)(ya,{},"sort-by-pill"),O&&(0,p.jsx)(yg,{},"collection-type"),(0,p.jsx)(yr,{activeView:Y,setActiveView:e=>{P(J.x.BROWSE_BY_FOLDER,{viewPreference:e}),G(e)}},"toggle-view-buttons"),(0,p.jsx)(v4,{},"current-folder-actions")].filter(Boolean),label:Z,onSearchChange:eh,searchQueryParam:V}),i,en>0&&(0,p.jsx)(p.Fragment,{children:"grid"===Y?(0,p.jsxs)("div",{children:[W.length?(0,p.jsx)(p.Fragment,{children:(0,p.jsx)(b5,{items:W,title:"Folders",type:"folder"})}):null,T.length?(0,p.jsx)(p.Fragment,{children:(0,p.jsx)(b5,{items:T,subfolderCount:W.length,title:"Documents",type:"file"})}):null]}):(0,p.jsx)(bX,{})}),0===en&&(0,p.jsx)(cq,{Actions:[E.includes(R.slug)&&(0,p.jsx)(bc,{buttonLabel:`${j("general:create")} ${(0,h.s)(R.labels?.singular,w).toLowerCase()}`,buttonSize:"medium",buttonStyle:"primary",collectionSlugs:[R.slug],onRequestCreate:ep},"create-folder"),O&&ed.length>0&&(0,p.jsx)(bc,{buttonLabel:`${j("general:create")} ${j("general:document").toLowerCase()}`,buttonSize:"medium",buttonStyle:"primary",collectionSlugs:ed,onRequestCreate:ep}
47,"create-document")].filter(Boolean),Message:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("h3",{children:w.t("general:noResultsFound")}),(0,p.jsx)("p",{children:w.t("general:noResultsDescription")})]})}),l]}),a]}),H.size>0&&A&&(0,p.jsx)(v7,{item:A,selectedCount:H.size}),(0,p.jsx)(v2,{collectionSlug:el,initialData:{[F]:O,...eo?{folderType:eu}:{}},isOpen:!!K,onOpenChange:t,onSave:e=>{let{operation:t}=e,n=(0,L.s8)(ei);(n||"create"===t)&&_(),"create"!==t||n||Q(void 0)},redirectAfterCreate:!1})]})}function yx(e){let t=(0,g.c)(3),{onDragEnd:n,setIsDragging:a}=e,l;return t[0]!==n||t[1]!==a?(l={onDragCancel(){a(!1)},onDragEnd(e){a(!1),n(e)},onDragStart(){a(!0)}},t[0]=n,t[1]=a,t[2]=l):l=t[2],(0,v.E5)(l),null}var yw="leave-without-saving-doc-drawer",yj=e=>{let t=(0,g.c)(15),{AfterHeader:n,drawerSlug:a,showDocumentID:l}=e,r=void 0===l||l,{closeModal:i,openModal:o}=nN(),{t:s}=(0,d.d)(),c=eM(),u;t[0]!==i||t[1]!==a||t[2]!==c||t[3]!==o?(u=()=>{c?o(yw):i(a)},t[0]=i,t[1]=a,t[2]=c,t[3]=o,t[4]=u):u=t[4];let h=u,f;if(t[5]!==n||t[6]!==i||t[7]!==a||t[8]!==h||t[9]!==r||t[10]!==s){let e;t[12]!==i||t[13]!==a?(e=()=>i(a),t[12]=i,t[13]=a,t[14]=e):e=t[14],f=(0,p.jsxs)(ai,{className:`${cI}__header`,children:[(0,p.jsxs)("div",{className:`${cI}__header-content`,children:[(0,p.jsx)("h2",{className:`${cI}__header-text`,children:(0,p.jsx)(b9,{element:"span"})}),(0,p.jsx)("button",{"aria-label":s("general:close"),className:`${cI}__header-close`,onClick:h,type:"button",children:(0,p.jsx)(d.a,{})})]}),r&&(0,p.jsx)(yC,{}),n?(0,p.jsx)("div",{className:`${cI}__after-header`,children:n}):null,(0,p.jsx)(fZ,{modalSlug:yw,onConfirm:e})]}),t[5]=n,t[6]=i,t[7]=a,t[8]=h,t[9]=r,t[10]=s,t[11]=f}else f=t[11];return f},yC=()=>{let e=(0,g.c)(3),{id:t}=lE(),{title:n}=ly(),a;return e[0]!==t||e[1]!==n?(a=t&&t!==n?(0,p.jsx)(b8,{id:t.toString()}):null,e[0]=t,e[1]=n,e[2]=a):a=e[2],a},yS="document-stale-data",yk="document-stale-data",y_=e=>{let t,n=(0,g.c)(14),{isActive:a,onReload:l}=e,{closeModal:r,openModal:i}=nN(),{clearRouteCache:s}=pr(),{t:c}=(0,d.d)(),u,h;if(n[0]!==r||n[1]!==a||n[2]!==i?(u=()=>{a?i(yS):r(yS)},h=[a,i,r],n[0]=r,n[1]=a,n[2]=i,n[3]=u,n[4]=h):(u=n[3],h=n[4]),(0,o.useEffect)(u,h),n[5]!==s||n[6]!==r||n[7]!==l||n[8]!==c){let e;n[10]!==s||n[11]!==r||n[12]!==l?(e=async()=>{r(yS),s(),await l()},n[10]=s,n[11]=r,n[12]=l,n[13]=e):e=n[13],t=(0,p.jsx)(nq,{className:yk,closeOnBlur:!1,slug:yS,children:(0,p.jsxs)("div",{className:`${yk}__wrapper`,children:[(0,p.jsxs)("div",{className:`${yk}__content`,children:[(0,p.jsx)("h1",{children:c("general:documentModified")}),(0,p.jsx)("p",{children:c("general:documentOutOfDate")})]}),(0,p.jsx)("div",{className:`${yk}__controls`,children:(0,p.jsx)(tN,{buttonStyle:"primary",id:`${yS}-reload`,margin:!1,onClick:e,size:"medium",children:c("general:reloadDocument")})})]})}),n[5]=s,n[6]=r,n[7]=l,n[8]=c,n[9]=t}else t=n[9];return t},y$="iframe-loader",yN=({onLoad:e,src:t,title:n,...a})=>{let[l,r]=(0,o.useState)(!!t),[i,s]=(0,o.useState)(!1),d=(0,o.useRef)(0),u=(0,o.useRef)(null),h=(0,o.useRef)(null),f=(0,o.useCallback)(()=>{u.current&&(clearTimeout(u.current),u.current=null),h.current&&(clearTimeout(h.current),h.current=null)},[]);(0,o.useEffect)(()=>{if(f(),r(!!t),s(!1),d.current=0,t)return u.current=setTimeout(()=>{s(!0),d.current=Date.now(),u.current=null},1e3),()=>{u.current&&(clearTimeout(u.current),u.current=null)}},[f,t]),(0,o.useEffect)(()=>()=>{f()},[f]);let m=(0,o.useCallback)(t=>{if("function"==typeof e&&e(t),r(!1),u.current&&(clearTimeout(u.current),u.current=null),!i)return;let n=Math.max(0,300-(Date.now()-d.current));0===n?s(!1):h.current=setTimeout(()=>{s(!1),h.current=null},n)},[i,e]);return(0,p.jsxs)("div",{className:`${y$}__container`,children:[i&&(0,p.jsx)(c.f,{"aria-live":"polite",height:"100%",role:"status",transparent:!0}),(0,p.jsx)("iframe",{...a,className:[`${y$}__iframe`,l&&`${y$}__iframe--is-loading`].filter(Boolean).join(" "),onLoad:m,sandbox:"allow-same-origin allow-scripts allow-forms allow-popups allow-modals allow-downloads",src:t,title:n})]})},yP=e=>{let{children:t}=e,n=o.useRef(null),a=o.useRef(null),{breakpoint:l,setMeasuredDeviceSize:r,size:i,zoom:s}=mH(),{size:c}=h8(n.current),{size:d}=h8(a.current);(0,o.useEffect)(()=>{c&&r(c)},[c,r]);let u="0",h="0";if(l&&"responsive"!==l&&(u="-50%",i&&c&&"number"==typeof s&&"number"==typeof i.width&&"number"==typeof i.height&&"number"==typeof c.width&&"number"==typeof c.height)){h="0 auto";let e=i.width/s,t=c.width*s,n=e-i.width;if(t>d.width)if(s>1){let e=c.width-d.width;u=e<0?`${e/2}px`:"0"}else u="0";else s>=1?u=`${n/2}px`:(u=`${(d.width-t)/2}px`,h="0")}let f=s?`${100/s}
47%`:"100%",m=s?`${100/s}%`:"100%";return"responsive"!==l&&(f=`${i?.width/("number"==typeof s?s:1)}px`,m=`${i?.height/("number"==typeof s?s:1)}px`),(0,p.jsx)("div",{ref:a,style:{height:"100%",width:"100%"},children:(0,p.jsx)("div",{ref:n,style:{height:m,margin:h,transform:`translate3d(${u}, 0, 0)`,width:f},children:t})})},yE=e=>{let t=(0,g.c)(18),{axis:n}=e,{breakpoint:a,measuredDeviceSize:l,setBreakpoint:r,setSize:i,size:s,zoom:c}=mH(),[d,u]=o.useState(("x"===n?l?.width:l?.height)||0),h;t[0]!==n||t[1]!==l?.height||t[2]!==l?.width||t[3]!==r||t[4]!==i||t[5]!==c?(h=e=>{let t=Number(e.target.value);t<0&&(t=0),u(t),r("custom"),i({type:"reset",value:{height:"y"===n?t:Number(l?.height.toFixed(0))*c,width:"x"===n?t:Number(l?.width.toFixed(0))*c}})},t[0]=n,t[1]=l?.height,t[2]=l?.width,t[3]=r,t[4]=i,t[5]=c,t[6]=h):h=t[6];let f=h,m,b;t[7]!==n||t[8]!==a||t[9]!==l||t[10]!==s||t[11]!==c?(m=()=>{"responsive"===a&&l&&u("x"===n?Number(l.width.toFixed(0))*c:Number(l.height.toFixed(0))*c),"responsive"!==a&&s&&u("x"===n?s.width:s.height)},b=[a,n,l,s,c],t[7]=n,t[8]=a,t[9]=l,t[10]=s,t[11]=c,t[12]=m,t[13]=b):(m=t[12],b=t[13]),(0,o.useEffect)(m,b);let v="x"===n?"live-preview-width":"live-preview-height",y=d||0,x;return t[14]!==f||t[15]!==v||t[16]!==y?(x=(0,p.jsx)("input",{className:"toolbar-input",min:0,name:v,onChange:f,step:1,type:"number",value:y}),t[14]=f,t[15]=v,t[16]=y,t[17]=x):x=t[17],x},yD="live-preview-toolbar-controls",yT=[50,75,100,125,150,200],yA=()=>{let e=(0,g.c)(14),{breakpoint:t,breakpoints:n,setBreakpoint:a,setPreviewWindowType:l,setZoom:r,url:i,zoom:s}=mH(),{t:c}=(0,d.d)(),u;if(e[0]!==t||e[1]!==n||e[2]!==a||e[3]!==l||e[4]!==r||e[5]!==c||e[6]!==i||e[7]!==s){let h,f={label:c("general:custom"),value:"custom"},m;e[9]!==r||e[10]!==s?(m=e=>{let{close:t}=e;return(0,p.jsx)(tp.ButtonGroup,{children:(0,p.jsx)(o.Fragment,{children:yT.map(e=>(0,p.jsxs)(tp.Button,{active:100*s==e,onClick:()=>{r(e/100),t()},children:[e,"%"]},e))})})},e[9]=r,e[10]=s,e[11]=m):m=e[11],e[12]!==l?(h=e=>{e.preventDefault(),l("popup")},e[12]=l,e[13]=h):h=e[13],u=(0,p.jsxs)("div",{className:yD,children:[n?.length>0&&(0,p.jsx)(tC,{button:(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)("span",{children:n.find(e=>e.name==t)?.label??f.label}),(0,p.jsx)(to,{className:`${yD}__chevron`})]}),className:`${yD}__breakpoint`,horizontalAlign:"right",render:e=>{let{close:l}=e;return(0,p.jsx)(tp.ButtonGroup,{children:(0,p.jsxs)(o.Fragment,{children:[n.map(e=>(0,p.jsx)(tp.Button,{active:e.name==t,onClick:()=>{a(e.name),l()},children:e.label},e.name)),"custom"===t&&(0,p.jsx)(tp.Button,{active:t==f.value,onClick:()=>{a(f.value),l()},children:f.label})]})})},showScrollbar:!0,verticalAlign:"bottom"}),(0,p.jsxs)("div",{className:`${yD}__device-size`,children:[(0,p.jsx)(yE,{axis:"x"}),(0,p.jsx)("span",{className:`${yD}__size-divider`,children:(0,p.jsx)(d.a,{})}),(0,p.jsx)(yE,{axis:"y"})]}),(0,p.jsx)(tC,{button:(0,p.jsxs)(o.Fragment,{children:[(0,p.jsxs)("span",{children:[100*s,"%"]}),(0,p.jsx)(to,{className:`${yD}__chevron`})]}),className:`${yD}__zoom`,horizontalAlign:"right",render:m,showScrollbar:!0,verticalAlign:"bottom"}),(0,p.jsx)("a",{className:`${yD}__external`,href:i,onClick:h,target:"_blank",title:c("general:openInNewWindow"),type:"button",children:(0,p.jsx)(m4,{})})]}),e[0]=t,e[1]=n,e[2]=a,e[3]=l,e[4]=r,e[5]=c,e[6]=i,e[7]=s,e[8]=u}else u=e[8];return u},yR="live-preview-toolbar",yL=e=>{let t=(0,g.c)(10),{toolbarPosition:n}=mH(),a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a={id:"live-preview-toolbar"},t[0]=a):a=t[0];let{attributes:l,listeners:r,setNodeRef:i,transform:o}=(0,v.PM)(a),s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=[yR,`${yR}--draggable`],t[1]=s):s=t[1];let c=`${n.x}px`,d=`${n.y}px`,u;return t[2]!==l||t[3]!==r||t[4]!==e||t[5]!==i||t[6]!==c||t[7]!==d||t[8]!==o?(u=(0,p.jsxs)("div",{className:s.join(" "),style:{left:c,top:d,...o?{transform:o?`translate3d(${o?.x||0}px, ${o?.y||0}px, 0)`:void 0}:{}},children:[(0,p.jsx)("button",{...r,...l,className:`${yR}__drag-handle`,ref:i,type:"button",children:(0,p.jsx)(l3,{})}),(0,p.jsx)(yA,{...e})]}),t[2]=l,t[3]=r,t[4]=e,t[5]=i,t[6]=c,t[7]=d,t[8]=o,t[9]=u):u=t[9],u},yF=e=>(0,p.jsx)("div",{className:[yR,`${yR}--static`].join(" "),children:(0,p.jsx)(yA,{...e})}),yO=e=>{let{draggable:t}=e;return t?(0,p.jsx)(yL,{...e}):(0,p.jsx)(yF,{...e})},yM="live-preview-window",yI=e=>{let{appIsReady:t,breakpoint:n,iframeRef:a,isLivePreviewing:l,loadedURL:r,popupRef:i,previewWindowType:s,setLoadedURL:c,shouldRenderIframe:d,url:u,zoom:h}=mH(),f=aN(),{mostRecentUpdate:m}=dV(),[g]=ez(),{id:b,collectionSlug:v,globalSlug:y}=lE();return(0,o.useEffect)(()=>
47{if(!(!l||!t)&&g){let e=(0,M.r)(g,!0);e.id||(e.id=b);let t={type:"payload-live-preview",collectionSlug:v,data:e,externallyUpdatedRelationship:m,globalSlug:y,locale:f.code};"popup"===s&&i.current&&i.current.postMessage(t,u),"iframe"===s&&a.current&&a.current.contentWindow?.postMessage(t,u)}},[g,u,v,y,b,s,i,t,a,m,f,l,r]),(0,o.useEffect)(()=>{if(!l||!t)return;let e={type:"payload-document-event"};"popup"===s&&i.current&&i.current.postMessage(e,u),"iframe"===s&&a.current&&a.current.contentWindow?.postMessage(e,u)},[m,a,i,s,u,l,t]),"iframe"!==s?null:(0,p.jsx)("div",{className:[yM,l&&`${yM}--is-live-previewing`,n&&"responsive"!==n&&`${yM}--has-breakpoint`].filter(Boolean).join(" "),children:(0,p.jsxs)("div",{className:`${yM}__wrapper`,children:[(0,p.jsx)(yO,{...e}),(0,p.jsx)("div",{className:`${yM}__main`,children:(0,p.jsx)(yP,{children:d&&(0,p.jsx)(yN,{className:"live-preview-iframe",id:"live-preview-iframe",onLoad:()=>{c(u)},ref:a,src:u,style:{transform:"number"==typeof h?`scale(${h}) `:void 0}})})})]})})},yB=async({id:e,clearRouteCache:t,collectionSlug:n,documentLockStateRef:a,globalSlug:l,isLockingEnabled:r,isWithinDoc:i,setCurrentEditor:o,setIsReadOnlyForIncomingUser:s,updateDocumentEditor:c,user:d})=>{if(r)try{await c(e,n??l,d),i||(a.current.hasShownLockedModal=!0),a.current={hasShownLockedModal:a.current?.hasShownLockedModal,isLocked:!0,user:d},o(d),i&&s&&s(!1),t&&t()}catch(e){console.error("Error during document takeover:",e)}},yz={16:{fill:"M8 3.5a4.5 4.5 0 0 0-4.473 4c-.03.275-.25.5-.527.5a.467.467 0 0 1-.478-.5 5.5 5.5 0 0 1 9.758-2.954.467.467 0 0 1-.12.68c-.23.154-.538.09-.715-.122A4.49 4.49 0 0 0 8 3.5m-4.16 7.274a.467.467 0 0 0-.12.68A5.5 5.5 0 0 0 13.478 8.5.467.467 0 0 0 13 8c-.276 0-.497.225-.527.5a4.5 4.5 0 0 1-7.918 2.396c-.177-.212-.486-.276-.715-.123",stroke:"M12.5 3v2.5H10m-4 5H3.5V13"},24:{fill:"M17.523 12.036a.5.5 0 0 1 .449.546A5.999 5.999 0 0 1 7 15.315V17.5a.5.5 0 0 1-1 0v-3a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1H8.002q.066.089.137.175a5 5 0 0 0 8.838-2.69.5.5 0 0 1 .546-.45M17.5 6a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1 0-1h1.498a5 5 0 0 0-8.975 2.515.5.5 0 1 1-.995-.097A6 6 0 0 1 17 8.684V6.5a.5.5 0 0 1 .5-.5"}},yU=({className:e,size:t=16})=>
47(0,p.jsxs)("svg",{className:["icon","icon--refresh",e].filter(Boolean).join(" "),fill:"none",height:t,viewBox:`0 0 ${t} ${t}`,width:t,xmlns:"http://www.w3.org/2000/svg",children:[16===t&&yz[16].stroke&&(0,p.jsx)("path",{d:yz[16].stroke,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,p.jsx)("path",{clipRule:"evenodd",d:yz[t].fill,fill:"currentColor",fillRule:"evenodd"})]}),yV="apiKey",yH="api-key",yq="•".repeat(24),yW=({readOnly:e,reveal:t})=>{let[n,a]=(0,o.useState)(!1),[l,r]=(0,o.useState)(null),[i,s]=(0,o.useState)(!1),[u,f]=(0,o.useState)(null),[m,g]=(0,o.useState)(!1),[b,v]=(0,o.useState)(!1),x=eM(),w=(0,o.useRef)(x),{i18n:j,t:C}=(0,d.d)(),{toggleModal:S}=nN(),{config:k,getEntityConfig:_}=(0,c.c)(),{id:$,collectionSlug:N,setData:P,setLastUpdateTime:E}=lE(),{code:D}=aN(),T=`revoke-api-key-${$}`,A=eB(([e])=>e&&e.hasAPIKey||null),R=eB(([,e])=>e),L=_({collectionSlug:N})?.fields?.find(e=>"name"in e&&"apiKey"===e.name),{setValue:F,value:O}=lI({path:yV,validate:e=>(0,Q.Qq)(e,{name:"apiKey",type:"text",blockData:{},data:{},event:"onChange",maxLength:48,minLength:24,path:["apiKey"],preferences:{fields:{}},req:{payload:{config:k},t:C},siblingData:{}})}),M=u||O,I=l??!!A?.value,B=t&&I&&!u,z=(0,o.useMemo)(()=>{let e="API Key";return L?.label&&(e=L.label),(0,h.s)(e,j)},[L,j]),U=()=>{a(!0)},V=async e=>{if(!$)return!1;try{let t=await fetch((0,y.Q)({apiRoute:k.routes.api,path:`/${N}/${encodeURIComponent(String($))}?depth=0&fallback-locale=null&locale=${D}`}),{body:JSON.stringify({apiKey:e,enableAPIKey:!!e}),headers:{"Content-Type":"application/json"},method:"PATCH"});if(!t.ok)throw Error("API key update failed");let n=await t.json();return r(!!e),R({type:"REMOVE",path:yV}),R({type:"REMOVE",path:"enableAPIKey"}),n.doc?.updatedAt&&(P(n.doc),E(new Date(n.doc.updatedAt).getTime())),!0}catch{return e3.error("Failed to update the API key."),!1}},H=async()=>{let e=ru();return $?!!await V(e)&&(f(e),g(!0),v(!0),U(),!0):(F(e,!0),g(!0),v(!0),U(),!0)},q=async()=>{await V(null)&&(f(null),r(!1),a(!1),g(!1),v(!1),e3.success("API key revoked successfully."))},W=async()=>{if(!i){s(!0);try{let e=await fetch((0,y.Q)({apiRoute:k.routes.api,path:`/${N}/${encodeURIComponent(String($))}/api-key/reveal`}),{method:"POST"});if(!e.ok)return void e3.error("Failed to reveal the API key.");let t=await e.json();f(t.apiKey),g(!1),v(!0)}catch{e3.error("Failed to reveal the API key.")}finally{s(!1)}}};return(0,o.useEffect)(()=>{w.current&&!x&&M&&(r(!0),a(!1),f(null),g(!1),R({type:"REMOVE",path:yV}),v(!1)),w.current=x},[M,R,x]),(0,p.jsxs)(o.Fragment,{children:[(0,p.jsxs)("div",{className:["field-type","api-key","read-only"].filter(
47Boolean).join(" "),children:[(0,p.jsxs)("label",{className:`${yH}__label field-label`,htmlFor:"apiKey",children:[(0,p.jsx)("span",{children:z}),M&&(0,p.jsx)(pK,{value:M})]}),(0,p.jsxs)("div",{className:[`${yH}__input-wrap`,!e&&I&&`${yH}__input-wrap--has-regenerate`,n&&`${yH}__input-wrap--highlighted`].filter(Boolean).join(" "),children:[(0,p.jsx)("input",{"aria-label":z,disabled:!0,id:"apiKey",name:"apiKey",type:M&&!b?"password":"text",value:M||(I?yq:"")}),(M||B||!e&&I)&&(0,p.jsxs)("div",{className:`${yH}__toggle-button-wrap`,children:[(M||B)&&(0,p.jsx)(tN,{"aria-label":B?"Reveal API key":"Toggle API key visibility",buttonStyle:"none",className:[`${yH}__visibility-button`,!e&&I&&`${yH}__visibility-button--with-regenerate`].filter(Boolean).join(" "),disabled:i,extraButtonProps:{"aria-busy":i},icon:i?(0,p.jsx)(bN,{loadingText:null,size:"sm"}):(0,p.jsx)(mJ,{active:b}),id:B?"reveal-api-key":"toggle-api-key-visibility",onClick:B?W:()=>v(e=>!e)}),!e&&I&&(0,p.jsx)(gL,{highlightField:U,icon:(0,p.jsx)(yU,{}),id:"regenerate-api-key",setKey:H})]})]}),M&&m&&(0,p.jsx)(nr,{description:t?"Make sure to copy your API key. You may not have access to reveal it again.":"Make sure to copy your API key. It will not be displayed again.",path:yV})]}),!e&&!M&&!I&&($?(0,p.jsx)(gL,{highlightField:U,id:"generate-api-key",setKey:H,willInvalidateExistingKey:!1}):(0,p.jsx)(tN,{buttonStyle:"secondary",id:"generate-api-key",onClick:()=>{H()},size:"small",children:C("authentication:generateNewAPIKey")})),!e&&I&&(0,p.jsxs)("div",{className:`${yH}__actions`,children:[(0,p.jsx)(tN,{buttonStyle:"secondary",className:`${yH}__revoke-button`,id:"revoke-api-key",onClick:()=>S(T),size:"small",children:"Revoke API key"}),(0,p.jsx)(ag,{body:(0,p.jsxs)("span",{children:["Are you sure you want to revoke the API key for user ",(0,p.jsx)("strong",{children:$}),"? The key will no longer be usable, and this action cannot be undone."]}),confirmLabel:"Revoke",heading:"Revoke API key?",modalSlug:T,onConfirm:q})]})]})},yK="auth-fields",yQ=e=>{let t,n=(0,g.c)(21),{className:a,collectionSlug:l,disableLocalStrategy:r,email:i,loginWithUsername:s,operation:u,readOnly:h,requirePassword:f,setValidateBeforeSubmit:m,useAPIKey:b,username:v,verify:x}=e,[w,j]=(0,o.useState)(f),S=eB(yY),k=eM(),{i18n:_,t:$}=(0,d.d)(),{docPermissions:N,isEditing:P,isInitializing:E,isTrashed:D}=lE(),{config:T}=(0,c.c)(),{routes:A}=T,{api:R}=A,L=!0,F=!0,O="object"==typeof N.fields&&"password"in N.fields,M="object"==typeof N.fields&&("username"in N.fields||"email"in N.fields);if(O){let{permissions:e}=(0,C.P)({field:{name:"password",type:"text"},operation:u,parentName:"",permissions:N?.fields});L="create"===u?!0===e||"object"==typeof e&&e.create:!0===e||"object"==typeof e&&e.update}if(M){let e=s&&(s.requireEmail||s.allowEmailLogin),t;n[0]!==N.fields?(t=(0,C.P)({field:{name:"email",type:"text"},operation:"read",parentName:"",permissions:N?.fields}),n[0]=N.fields,n[1]=t):t=n[1];let{operation:a}=t,l;n[2]!==N.fields?(l=(0,C.P)({field:{name:"username",type:"text"},operation:"read",parentName:"",permissions:N?.fields}),n[2]=N.fields,n[3]=l):l=n[3];let{operation:r}=l;F=e?r||a:s&&!e?r:a}let I=(!r||"object"==typeof r&&!0===r.enableFields)&&(F||L),B=h||E||D,z=N?.fields===!0||N?.fields?.apiKey,U=!0===z||"object"==typeof z&&!!z?.[u],V;e:{if(N){V=!!("unlock"in N&&N.unlock);break e}V=!1}let H=V,q;n[4]!==S||n[5]!==m||n[6]!==$?(q=e=>{e?(m(!0),S({type:"UPDATE",errorMessage:$("validation:required"),path:"password",valid:!1}),S({type:"UPDATE",errorMessage:$("validation:required"),path:"confirm-password",valid:!1})):(m(!1),S({type:"REMOVE",path:"password"}),S({type:"REMOVE",path:"confirm-password"})),j(e)},n[4]=S,n[5]=m,n[6]=$,n[7]=q):q=n[7];let W=q,K;n[8]!==R||n[9]!==l||n[10]!==i||n[11]!==_||n[12]!==s||n[13]!==$||n[14]!==v?(K=async()=>{let e=(0,y.Q)({apiRoute:R,path:`/${l}/unlock`});200===(await fetch(e,{body:JSON.stringify(s&&v?{username:v}:{email:i}),credentials:"include",headers:{"Accept-Language":_.language,"Content-Type":"application/json"},method:"post"})).status?e3.success($("authentication:successfullyUnlocked")):e3.error($("authentication:failedToUnlock"))},n[8]=R,n[9]=l,n[10]=i,n[11]=_,n[12]=s,n[13]=$,n[14]=v,n[15]=K):K=n[15];let Q=K,Y,G;n[16]!==k?(Y=()=>{k||j(!1)},G=[k],n[16]=k,n[17]=Y,n[18]=G):(Y=n[17],G=n[18]),(0,o.useEffect)(Y,G);let X=b&&U;
47return I||X||x&&P?(n[19]!==a?(t=[yK,a].filter(Boolean),n[19]=a,n[20]=t):t=n[20],(0,p.jsxs)("div",{className:t.join(" "),children:[I&&(0,p.jsxs)(o.Fragment,{children:[(0,p.jsx)(vY,{loginWithUsername:s,operation:u,permissions:N?.fields,readOnly:h||D,t:$}),(w||f)&&(!r||!I)&&(0,p.jsxs)("div",{className:`${yK}__changing-password`,children:[(0,p.jsx)(hG,{autoComplete:"new-password",field:{name:"password",label:$("authentication:newPassword"),required:!0},indexPath:"",parentPath:"",parentSchemaPath:"",path:"password",schemaPath:"password"}),(0,p.jsx)(hK,{disabled:h||D})]}),(0,p.jsxs)("div",{className:`${yK}__controls`,children:[w&&!f&&(0,p.jsx)(tN,{buttonStyle:"secondary",disabled:B,id:"cancel-change-password",onClick:()=>W(!1),size:"medium",children:$("general:cancel")}),!w&&!f&&!r&&L&&(0,p.jsx)(tN,{buttonStyle:"secondary",disabled:B,id:"change-password",onClick:()=>W(!0),size:"medium",children:$("authentication:changePassword")}),!w&&"update"===u&&H&&(0,p.jsx)(tN,{buttonStyle:"secondary",disabled:B||!F,id:"force-unlock",onClick:()=>{Q()},size:"medium",children:$("authentication:forceUnlock")})]})]}),X&&(0,p.jsx)("div",{className:`${yK}__api-key`,children:(0,p.jsx)(yW,{readOnly:B,reveal:"object"==typeof b&&!0===b.reveal})}),x&&P&&(0,p.jsx)(lX,{field:{name:"_verified",admin:{disabled:B,readOnly:h},label:$("authentication:verified")},path:"_verified",schemaPath:`${l}._verified`})]})):null};function yY(e){return e[1]}var yG=e=>{let t,n=(0,g.c)(37),{id:a,collectionSlug:l,globalSlug:r,isTrashed:i,pluralLabel:s,useAsTitle:u}=e,p=e?.view||void 0,{isEditing:f,isInitializing:m}=lE(),{title:b}=ly(),{isEntityVisible:v}=vA(),x;n[0]!==l||n[1]!==r||n[2]!==v?(x=v({collectionSlug:l,globalSlug:r}),n[0]=l,n[1]=r,n[2]=v,n[3]=x):x=n[3];let w=x,{setStepNav:j}=my(),{i18n:C,t:S}=(0,d.d)(),{config:k}=(0,c.c)(),{routes:_,serverURL:$}=k,{admin:N}=_,P;return n[4]!==N||n[5]!==l||n[6]!==r||n[7]!==C||n[8]!==a||n[9]!==f||n[10]!==m||n[11]!==i||n[12]!==w||n[13]!==s||n[14]!==j||n[15]!==S||n[16]!==b||n[17]!==u||n[18]!==p?(P=()=>{let e=[];m||(l?(e.push({label:(0,h.s)(s,C),url:w?(0,y.Q)({adminRoute:N,path:`/collections/${l}`}):void 0}),i&&e.push({label:S("general:trash"),url:w?(0,y.Q)({adminRoute:N,path:`/collections/${l}/trash`}):void 0}),f?e.push({label:u&&"id"!==u&&b||`${a}`,url:w?(0,y.Q)({adminRoute:N,path:i?`/collections/${l}/trash/${a}`:`/collections/${l}/${a}`}):void 0}):e.push({label:S("general:createNew")})):r&&e.push({label:b,url:w?(0,y.Q)({adminRoute:N,path:`/globals/${r}`}):void 0}),p&&e.push({label:p}),j(e))},n[4]=N,n[5]=l,n[6]=r,n[7]=C,n[8]=a,n[9]=f,n[10]=m,n[11]=i,n[12]=w,n[13]=s,n[14]=j,n[15]=S,n[16]=b,n[17]=u,n[18]=p,n[19]=P):P=n[19],n[20]!==N||n[21]!==l||n[22]!==r||n[23]!==C||n[24]!==a||n[25]!==f||n[26]!==m||n[27]!==i||n[28]!==w||n[29]!==s||n[30]!==$||n[31]!==j||n[32]!==S||n[33]!==b||n[34]!==u||n[35]!==p?(t=[j,m,f,s,a,i,u,N,S,C,b,l,r,$,p,w],n[20]=N,n[21]=l,n[22]=r,n[23]=C,n[24]=a,n[25]=f,n[26]=m,n[27]=i,n[28]=w,n[29]=s,n[30]=$,n[31]=j,n[32]=S,n[33]=b,n[34]=u,n[35]=p,n[36]=t):t=n[36],(0,o.useEffect)(P,t),null},yX=e=>{let t=(0,g.c)(14),{collectionConfig:n,config:a,fallback:l,globalConfig:r}=e,i=n?.admin?.useAsTitle,s;t[0]!==i?(s=e=>{let[t]=e;return i&&t&&t?.[i]||null},t[0]=i,t[1]=s):s=t[1];let c=eB(s),u=(0,o.useRef)(!1),{i18n:p}=(0,d.d)(),{setDocumentTitle:h}=ly(),f=a?.admin?.dateFormat,m=c?.value||"",b;t[2]!==n||t[3]!==f||t[4]!==l||t[5]!==r||t[6]!==p||t[7]!==m||t[8]!==i?(b=lb({collectionConfig:n,data:{id:"",[i]:m},dateFormat:f,fallback:l,globalConfig:r,i18n:p}),t[2]=n,t[3]=f,t[4]=l,t[5]=r,t[6]=p,t[7]=m,t[8]=i,t[9]=b):b=t[9];let v=b,y,x;return t[10]!==h||t[11]!==v?(y=()=>{if(!u.current){u.current=!0;return}let e=requestAnimationFrame(()=>{h(v)});return()=>cancelAnimationFrame(e)},x=[h,v],t[10]=h,t[11]=v,t[12]=y,t[13]=x):(y=t[12],x=t[13]),(0,o.useEffect)(y,x),null},yZ="collection-edit",yJ="payload-pending-success-toast";function y0({BeforeDocumentControls:e,Description:t,EditMenuItems:n,LivePreview:a,PreviewButton:l,PublishButton:r,SaveButton:i,SaveDraftButton:s,Status:d,UnpublishButton:u,Upload:h,UploadControls:f}){let{id:g,action:b,AfterDocument:v,AfterFields:x,apiURL:w,BeforeFields:j,collectionSlug:C,currentEditor:S,data:k,disableActions:_,disableCreate:$,disableLeaveWithoutSaving:N,docPermissions:P,documentIsLocked:E,documentLockState:D,getDocPermissions:T,getDocPreferences:A,globalSlug:R,hasPublishPermission:F,hasSavePermission:O,incrementVersionCount:M,initialState:I,isEditing:
47B,isInitializing:z,isLocked:U,isTrashed:V,lastUpdateTime:H,redirectAfterCreate:q,redirectAfterDelete:W,redirectAfterDuplicate:K,redirectAfterRestore:Q,setCurrentEditor:Y,setData:G,setDocumentIsLocked:X,setLastUpdateTime:Z,unlockDocument:J,updateDocumentEditor:ee}=lE(),{clearDoc:et,drawerSlug:en,onDelete:ea,onDuplicate:el,onRestore:er,onSave:ei}=cO(),eo=!!en,{refreshCookieAsync:es,user:ec}=aj(),{config:ed,config:{admin:{user:eu},routes:{admin:ep},serverURL:eh},getEntityConfig:ef}=(0,c.c)(),em=ef({collectionSlug:C}),eg=ef({globalSlug:R}),eb=nc(),ev=(0,m.useRouter)(),ey=(0,m.useSearchParams)(),{reportUpdate:ex}=dV(),{resetUploadEdits:ew}=l$(),{getFormState:ej}=cf(),{startRouteTransition:eC}=te(),{clearRouteCache:eS}=pr(),{isLivePreviewEnabled:ek,isLivePreviewing:e_,previewWindowType:e$,setURL:eN,typeofLivePreviewURL:eP,url:eE}=mH(),{isPreviewEnabled:eD,setPreviewURL:eT}=mq(),eA=(0,o.useRef)(null),eR=(0,o.useRef)(null),eL=ey.get("locale"),eF=em?.slug||eg?.slug,eO=C&&!g?"create":"update",eM=em?em.auth:void 0,eI=em?em.upload:void 0,eB=em||eg,ez=eB?.lockDocuments===void 0||eB?.lockDocuments,eU=!1!==ez,eV=("object"==typeof ez?ez.duration:300)*1e3,eH=(0,L.s8)(eB),[eq,eW]=(0,o.useState)(!1),[eK,eQ]=(0,o.useState)(!1),[eY,eG]=(0,o.useState)(!1),[eX,eZ]=(0,o.useState)(Date.now()),eJ=(0,o.useRef)(!1),e0=(0,o.useRef)(k?.updatedAt),e1=(0,o.useRef)(0),e2=(0,o.useRef)(!1),e6=H+eV,e5=Date.now()>e6,e4=!eq&&("u">typeof N?!N:!eH),e8=(0,o.useMemo)(()=>[eF],[eF]),[e7,e9]=(0,o.useState)(()=>!!("create"===eO&&eM&&!eM.disableLocalStrategy)),tt=o.useRef(null),tn=(0,o.useCallback)(e=>{X(!0);let t="object"==typeof D.current?.user?D.current?.user?.id:D.current?.user;if(e&&e.user){let n="string"==typeof e.user||"number"==typeof e.user?e.user:e.user.id;D.current&&n===t||(t===ec.id&&n!==ec.id&&(eQ(!0),D.current.hasShownLockedModal=!0),D.current={hasShownLockedModal:D.current?.hasShownLockedModal||!1,isLocked:!0,user:e.user},Y(e.user)),e.lastEditedAt&&Z(new Date(e.lastEditedAt).getTime())}},[D,Y,X,Z,ec?.id]),ta=(0,o.useCallback)(()=>{eG(!1),ev.refresh()},[ev]),tl=(0,o.useCallback)(e=>{tt.current=e},[]),tr=(0,o.useCallback)(async()=>{let e=D.current?.user,t="object"==typeof e?e?.id===ec?.id:e===ec?.id;if(eU&&E&&(g||R)){let e=tt.current?new URL(tt.current).pathname:"",n=["/preview","/api","/versions"].some(t=>e.includes(t));if(t&&!n)try{await J(g,C??R),X(!1),Y(null)}catch(e){console.error("Failed to unlock before leave",e)}}},[C,E,D,R,g,eU,Y,X,J,ec?.id]),ti=(0,o.useCallback)(async(e,t)=>{let{context:n,formState:a}=t||{},l=cR(eR),r=e?.doc||e?.result,i=r?.updatedAt||new Date().toISOString();if(ec&&C===eu&&g===ec.id&&es(),Z(new Date(i).getTime()),e0.current=i,eJ.current=!1,e2.current=!1,n?.incrementVersionCount!==!1&&M(),"function"==typeof G&&G(r||{}),"function"==typeof ei){let t=g?"update":"create";ei({...e,context:n,operation:t,updatedAt:"update"===t?new Date().toISOString():r?.updatedAt||new Date().toISOString()})}if(!B&&eb<2&&!1!==q){e.message&&"u">typeof window&&window.sessionStorage.setItem(yJ,e.message);let t=(0,y.Q)({adminRoute:ep,path:`/collections/${C}/${r?.id}${eL?`?locale=${eL}`:""}`});eC(()=>ev.push(t))}else ew();if(n?.getDocPermissions!==!1&&await T(e),g||R){let e=await A(),{livePreviewURL:t,previewURL:n,state:o}=await ej({id:g,collectionSlug:C,data:r,docPermissions:P,docPreferences:e,formState:a,globalSlug:R,operation:eO,renderAllFields:!1,returnLivePreviewURL:ek&&"function"===eP,returnLockStatus:!1,returnPreviewURL:eD,schemaPath:e8.join("."),signal:l.signal,skipValidation:!0});return eI&&o&&delete o.file,eU&&X(!1),ek&&"function"===eP&&eN(t),eD&&eT(n),ex({id:g,doc:r,drawerSlug:en,entitySlug:eF,operation:"update",updatedAt:i}),eR.current=null,o}ex({id:g,doc:r,drawerSlug:en,entitySlug:eF,operation:"create",updatedAt:i})},[ec,C,eu,g,Z,G,ei,B,eb,q,R,es,M,ep,eL,eC,ev,ew,T,A,ej,P,eO,ek,eP,eD,e8,eI,eU,ex,en,eF,X,eN,eT]),to=(0,o.useCallback)(async({formState:e,submitted:t})=>{let n=cR(eA),a=e1.current,l=e2.current;k?.updatedAt&&k.updatedAt>e0.current&&(e0.current=k.updatedAt,eJ.current=!1);let r=Date.now(),i=r-eX,o=eU&&i>=1e4;o&&eZ(r);let s=!eJ.current&&e0.current&&"update"===eO&&!V&&!eH;
47s&&(eJ.current=!0);let c=await A(),d=await ej({id:g,checkForStaleData:s,collectionSlug:C,docPermissions:P,docPreferences:c,formState:e,globalSlug:R,operation:eO,originalUpdatedAt:s?e0.current:void 0,readOnly:V||eq,renderAllFields:!1,returnLockStatus:eU,schemaPath:e8.join("."),signal:n.signal,skipValidation:!t,updateLastEdited:o});if(!d)return;let{lockedState:u,staleDataState:p,state:h}=d;return eU&&tn(u),p?.isStale&&!l&&e1.current===a&&eG(!0),eA.current=null,h},[k?.updatedAt,eX,eU,A,ej,g,C,P,R,eO,e8,tn,eH,V,eq]);(0,o.useEffect)(()=>()=>{eQ(!1)},[]),(0,o.useEffect)(()=>{let e=eA.current,t=eR.current;return()=>{cA(e),cA(t)}},[]),(0,o.useEffect)(()=>{if(!z&&"u">typeof window){let e=window.sessionStorage.getItem(yJ);e&&(window.sessionStorage.removeItem(yJ),e3.success(e))}},[z]);let ts=E&&S&&("object"==typeof S?S.id!==ec?.id:S!==ec?.id)&&!eq&&!eK&&!D.current?.hasShownLockedModal&&!e5,tc=ed.folders&&C===ed.folders?.slug;return(0,p.jsx)("main",{className:[yZ,(g||R)&&`${yZ}--is-editing`,R&&`global-edit--${R}`,C&&`collection-edit--${C}`,e_&&"iframe"===e$&&`${yZ}--is-live-previewing`].filter(Boolean).join(" "),children:(0,p.jsx)(lR,{operation:eO,children:(0,p.jsxs)(ub,{action:b,className:`${yZ}__form`,disabled:eq||z||!O||V,disableSuccessStatus:!B&&eb<2&&!1!==q,disableValidationOnSubmit:!e7,initialState:!z&&I,isDocumentForm:!0,isInitializing:z,method:g?"PATCH":"POST",onChange:[to],onSubmit:()=>{e1.current+=1,e2.current=!0},onSuccess:ti,children:[eo&&(0,p.jsx)(yj,{AfterHeader:t,drawerSlug:en,showDocumentID:!tc}),eU&&ts&&(0,p.jsx)(f6,{handleGoBack:()=>(({adminRoute:e,collectionSlug:t,router:n,serverURL:a})=>{let l=(0,y.Q)({adminRoute:e,path:t?`/collections/${t}`:"/"});n.push(l)})({adminRoute:ep,collectionSlug:C,router:ev,serverURL:eh}),isActive:ts,onReadOnly:()=>{eW(!0),eQ(!1)},onTakeOver:()=>yB({id:g,clearRouteCache:eS,collectionSlug:C,documentLockStateRef:D,globalSlug:R,isLockingEnabled:eU,isWithinDoc:!1,setCurrentEditor:Y,updateDocumentEditor:ee,user:ec}),updatedAt:H,user:S}),eU&&eK&&(0,p.jsx)(f1,{handleBackToDashboard:()=>(({adminRoute:e,router:t,serverURL:n})=>{let a=(0,y.Q)({adminRoute:e,path:"",serverURL:n});t.push(a)})({adminRoute:ep,router:ev,serverURL:eh}),isActive:eK,onReadOnly:()=>{eW(!0),eQ(!1)}}),eY&&(0,p.jsx)(y_,{isActive:eY,onReload:ta}),e4&&(0,p.jsx)(fX,{onConfirm:tr,onPrevent:tl}),!eo&&(0,p.jsx)(yG,{collectionSlug:em?.slug,globalSlug:eg?.slug,id:g,isTrashed:V,pluralLabel:em?.labels?.plural,useAsTitle:em?.admin?.useAsTitle}),(0,p.jsx)(yX,{collectionConfig:em,config:ed,fallback:eb<=1?g?.toString():void 0,globalConfig:eg}),(0,p.jsx)(gp,{apiURL:w,BeforeDocumentControls:e,customComponents:{PreviewButton:l,PublishButton:r,SaveButton:i,SaveDraftButton:s,Status:d,UnpublishButton:u},data:k,disableActions:_||tc||V,disableCreate:$,EditMenuItems:n,hasPublishPermission:F,hasSavePermission:O,id:g,isEditing:B,isInDrawer:eo,isTrashed:V,onDelete:ea,onDrawerCreateNew:et,onDuplicate:el,onRestore:er,onSave:ti,onTakeOver:()=>yB({id:g,clearRouteCache:eS,collectionSlug:C,documentLockStateRef:D,globalSlug:R,isLockingEnabled:eU,isWithinDoc:!0,setCurrentEditor:Y,setIsReadOnlyForIncomingUser:eW,updateDocumentEditor:ee,user:ec}),permissions:P,readOnlyForIncomingUser:eq,redirectAfterDelete:W,redirectAfterDuplicate:K,redirectAfterRestore:Q,slug:em?.slug||eg?.slug,user:S}),(0,p.jsxs)("div",{className:[`${yZ}__main-wrapper`,"popup"===e$&&`${yZ}--detached`].filter(Boolean).join(" "),children:[(0,p.jsxs)("div",{className:[`${yZ}__main`,"popup"===e$&&`${yZ}__main--popup-open`].filter(Boolean).join(" "),children:[(0,p.jsx)(u7,{AfterFields:x,BeforeFields:j||(0,p.jsxs)(o.Fragment,{children:[eM&&(0,p.jsx)(yQ,{className:`${yZ}__auth`,collectionSlug:em.slug,disableLocalStrategy:em.auth?.disableLocalStrategy,email:k?.email,loginWithUsername:eM?.loginWithUsername,operation:eO,readOnly:!O,requirePassword:!g,setValidateBeforeSubmit:e9,useAPIKey:eM.useAPIKey,username:k?.username,verify:eM.verify}),eI&&(0,p.jsx)(o.Fragment,{children:(0,p.jsx)(uD,{children:h||(0,p.jsx)(p7,{collectionSlug:em.slug,initialState:I,uploadConfig:eI,UploadControls:f})})})]}),Description:t,docPermissions:P,fields:eB.fields,forceSidebarWrap:e_,isTrashed:V,readOnly:eq||!O||V,schemaPathSegments:e8}),v]}),ek&&!eo&&eE&&(0,p.jsx)(p.Fragment,{children:a||(0,p.jsx)(yI,{collectionSlug:C,globalSlug:R})})]})]},`${U}`)})})}var y1=({children:e})=>(0,p.jsx)("div",{className:"field-diff-label",children:e}),y3="field-diff",y2=e=>{let{className:t,From:n,i18n:a,label:{label:l,locale:r},nestingLevel:i=0,To:o}=e;return(0,p.jsxs)("div",{className:`${y3}-container${t?` ${t}`:""} nested-level-${i}`,style:i?{"--left-offset":`calc(50%  - (${i} * calc( calc(var(--base)* 0.5) - 2.5px  )))`}:{"--left-offset":"50%"},children:[(0,p.jsxs)(y1,{children:[r&&(0,p.jsx)("span",{className:`${y3}__locale-label`,children:r}),"function"!=typeof l&&(0,h.s)(l||"",a)]}),(0,p.jsxs)("div",{className:`${y3}-content`,style:i?{gridTemplateColumns:"calc(var(--left-offset) - calc(var(--base)*0.5) )     calc(50% - calc(var(--base)*0.5) + calc(50% - var(--left-offset)))"}:void 0,children:[n,o]})]})}}}]);
48//# chunkId=01a10d69-c813-7073-b111-5e69f8a48042

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.