@payloadcms/ui 4.0.0-internal.011fd46 → 4.0.0-internal.17c142b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
  2. package/dist/elements/BulkUpload/FormsManager/index.js +13 -0
  3. package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
  4. package/dist/elements/Card/index.css +1 -1
  5. package/dist/elements/ColumnSelection/Popup.d.ts.map +1 -1
  6. package/dist/elements/ColumnSelection/Popup.js +5 -1
  7. package/dist/elements/ColumnSelection/Popup.js.map +1 -1
  8. package/dist/elements/RenderServerComponent/clientOnly.d.ts +8 -0
  9. package/dist/elements/RenderServerComponent/clientOnly.d.ts.map +1 -0
  10. package/dist/elements/RenderServerComponent/clientOnly.js +56 -0
  11. package/dist/elements/RenderServerComponent/clientOnly.js.map +1 -0
  12. package/dist/exports/client/index.js +2 -86
  13. package/dist/exports/client/index.js.map +4 -4
  14. package/dist/exports/server.d.ts +3 -0
  15. package/dist/exports/server.d.ts.map +1 -0
  16. package/dist/exports/server.js +2 -0
  17. package/dist/exports/server.js.map +1 -0
  18. package/dist/providers/Auth/index.d.ts +3 -1
  19. package/dist/providers/Auth/index.d.ts.map +1 -1
  20. package/dist/providers/Auth/index.js +8 -3
  21. package/dist/providers/Auth/index.js.map +1 -1
  22. package/dist/styles.css +1361 -1
  23. package/dist/utilities/getVersions.d.ts.map +1 -1
  24. package/dist/utilities/getVersions.js +5 -2
  25. package/dist/utilities/getVersions.js.map +1 -1
  26. package/dist/utilities/handleLivePreview.d.ts.map +1 -1
  27. package/dist/utilities/serverFunctionRegistry.d.ts +13 -0
  28. package/dist/utilities/serverFunctionRegistry.d.ts.map +1 -0
  29. package/dist/utilities/serverFunctionRegistry.js +25 -0
  30. package/dist/utilities/serverFunctionRegistry.js.map +1 -0
  31. package/dist/views/List/index.d.ts.map +1 -1
  32. package/dist/views/List/index.js +7 -1
  33. package/dist/views/List/index.js.map +1 -1
  34. package/dist/views/Logout/LogoutClient.d.ts +14 -0
  35. package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
  36. package/dist/views/Logout/LogoutClient.js +38 -32
  37. package/dist/views/Logout/LogoutClient.js.map +1 -1
  38. package/dist/views/Logout/index.d.ts.map +1 -1
  39. package/dist/views/Logout/index.js +7 -2
  40. package/dist/views/Logout/index.js.map +1 -1
  41. package/dist/widgets/CollectionCards/getCollectionCardsData.d.ts +20 -0
  42. package/dist/widgets/CollectionCards/getCollectionCardsData.d.ts.map +1 -0
  43. package/dist/widgets/CollectionCards/getCollectionCardsData.js +29 -0
  44. package/dist/widgets/CollectionCards/getCollectionCardsData.js.map +1 -0
  45. package/dist/widgets/CollectionCards/index.client.d.ts +5 -0
  46. package/dist/widgets/CollectionCards/index.client.d.ts.map +1 -0
  47. package/dist/widgets/CollectionCards/index.client.js +139 -0
  48. package/dist/widgets/CollectionCards/index.client.js.map +1 -0
  49. package/package.json +562 -8
  50. package/dist/exports/client/CodeEditor-T3624SG3.js +0 -14
  51. package/dist/exports/client/CodeEditor-T3624SG3.js.map +0 -7
  52. package/dist/exports/client/DatePicker-6KF52Z3G.js +0 -14
  53. package/dist/exports/client/DatePicker-6KF52Z3G.js.map +0 -7
  54. package/dist/exports/client/chunk-5LKBKI4T.js +0 -14
  55. package/dist/exports/client/chunk-5LKBKI4T.js.map +0 -7
  56. package/dist/exports/client/chunk-7T64ULOM.js +0 -29
  57. package/dist/exports/client/chunk-7T64ULOM.js.map +0 -7
  58. package/dist/exports/client/chunk-DMFYTMX6.js +0 -27
  59. package/dist/exports/client/chunk-DMFYTMX6.js.map +0 -7
@@ -10,90 +10,6 @@ function require(m) {
10
10
  }
11
11
  // Workaround end
12
12
 
13
- import{a as Lr,b as Uv,c as G,d as xk,e as wk,f as Wd,g as Us,h as Yv,i as Ct,j as Ik,k as Jv,l as Rk}from"./chunk-DMFYTMX6.js";import{a as Ck,b as Re,c as Ao,d as lt,e as Gv,f as Wv,g as ve,h as Ud,i as Sk,j as ct,k as Xv,l as Zv,m as N,n as Lc,o as w4,p as S4,q as tl,r as bh,s as _k,t as _4,u as Tk,v as Dk,w as Ak}from"./chunk-7T64ULOM.js";import{c as Dn,d as x4,e as Ji}from"./chunk-5LKBKI4T.js";var L4=Dn(Et=>{"use strict";function ey(t,e){var o=t.length;t.push(e);e:for(;0<o;){var n=o-1>>>1,r=t[n];if(0<vh(r,e))t[n]=e,t[o]=r,o=n;else break e}}function An(t){return t.length===0?null:t[0]}function Ch(t){if(t.length===0)return null;var e=t[0],o=t.pop();if(o!==e){t[0]=o;e:for(var n=0,r=t.length,s=r>>>1;n<s;){var i=2*(n+1)-1,a=t[i],l=i+1,c=t[l];if(0>vh(a,o))l<r&&0>vh(c,a)?(t[n]=c,t[l]=o,n=l):(t[n]=a,t[i]=o,n=i);else if(l<r&&0>vh(c,o))t[n]=c,t[l]=o,n=l;else break e}}return e}function vh(t,e){var o=t.sortIndex-e.sortIndex;return o!==0?o:t.id-e.id}Et.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(I4=performance,Et.unstable_now=function(){return I4.now()}):(qv=Date,R4=qv.now(),Et.unstable_now=function(){return qv.now()-R4});var I4,qv,R4,ms=[],qi=[],Pk=1,dn=null,Qo=3,xh=!1,ol=!1,Zd=!1,A4=typeof setTimeout=="function"?setTimeout:null,P4=typeof clearTimeout=="function"?clearTimeout:null,T4=typeof setImmediate<"u"?setImmediate:null;function yh(t){for(var e=An(qi);e!==null;){if(e.callback===null)Ch(qi);else if(e.startTime<=t)Ch(qi),e.sortIndex=e.expirationTime,ey(ms,e);else break;e=An(qi)}}function ty(t){if(Zd=!1,yh(t),!ol)if(An(ms)!==null)ol=!0,oy();else{var e=An(qi);e!==null&&ry(ty,e.startTime-t)}}var wh=!1,Yd=-1,F4=5,N4=-1;function E4(){return!(Et.unstable_now()-N4<F4)}function Qv(){if(wh){var t=Et.unstable_now();N4=t;var e=!0;try{e:{ol=!1,Zd&&(Zd=!1,P4(Yd),Yd=-1),xh=!0;var o=Qo;try{t:{for(yh(t),dn=An(ms);dn!==null&&!(dn.expirationTime>t&&E4());){var n=dn.callback;if(typeof n=="function"){dn.callback=null,Qo=dn.priorityLevel;var r=n(dn.expirationTime<=t);if(t=Et.unstable_now(),typeof r=="function"){dn.callback=r,yh(t),e=!0;break t}dn===An(ms)&&Ch(ms),yh(t)}else Ch(ms);dn=An(ms)}if(dn!==null)e=!0;else{var s=An(qi);s!==null&&ry(ty,s.startTime-t),e=!1}}break e}finally{dn=null,Qo=o,xh=!1}e=void 0}}finally{e?Xd():wh=!1}}}var Xd;typeof T4=="function"?Xd=function(){T4(Qv)}:typeof MessageChannel<"u"?(Kv=new MessageChannel,D4=Kv.port2,Kv.port1.onmessage=Qv,Xd=function(){D4.postMessage(null)}):Xd=function(){A4(Qv,0)};var Kv,D4;function oy(){wh||(wh=!0,Xd())}function ry(t,e){Yd=A4(function(){t(Et.unstable_now())},e)}Et.unstable_IdlePriority=5;Et.unstable_ImmediatePriority=1;Et.unstable_LowPriority=4;Et.unstable_NormalPriority=3;Et.unstable_Profiling=null;Et.unstable_UserBlockingPriority=2;Et.unstable_cancelCallback=function(t){t.callback=null};Et.unstable_continueExecution=function(){ol||xh||(ol=!0,oy())};Et.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F4=0<t?Math.floor(1e3/t):5};Et.unstable_getCurrentPriorityLevel=function(){return Qo};Et.unstable_getFirstCallbackNode=function(){return An(ms)};Et.unstable_next=function(t){switch(Qo){case 1:case 2:case 3:var e=3;break;default:e=Qo}var o=Qo;Qo=e;try{return t()}finally{Qo=o}};Et.unstable_pauseExecution=function(){};Et.unstable_requestPaint=function(){};Et.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var o=Qo;Qo=t;try{return e()}finally{Qo=o}};Et.unstable_scheduleCallback=function(t,e,o){var n=Et.unstable_now();switch(typeof o=="object"&&o!==null?(o=o.delay,o=typeof o=="number"&&0<o?n+o:n):o=n,t){case 1:var r=-1;break;case 2:r=250;break;case 5:r=1073741823;break;case 4:r=1e4;break;default:r=5e3}return r=o+r,t={id:Pk++,callback:e,priorityLevel:t,startTime:o,expirationTime:r,sortIndex:-1},o>n?(t.sortIndex=o,ey(qi,t),An(ms)===null&&t===An(qi)&&(Zd?(P4(Yd),Yd=-1):Zd=!0,ry(ty,o-n))):(t.sortIndex=r,ey(ms,t),ol||xh||(ol=!0,oy())),t};Et.unstable_shouldYield=E4;Et.unstable_wrapCallback=function(t){var e=Qo;return function(){var o=Qo;Qo=e;try{return t.apply(this,arguments)}finally{Qo=o}}}});var j4=Dn((q1e,$4)=>{"use strict";$4.exports=L4()});var Yh=Dn((Zbe,G3)=>{var Ry=Math.floor(Math.random()*16777215),B3=Pt.index=parseInt(Math.random()*16777215,10),O3=(typeof process>"u"||typeof process.pid!="number"?Math.floor(Math.random()*1e5):process.pid)%65535,V3=(()=>{try{return _Buffer}catch{try{return Buffer}catch{return null}}})(),Zh=function(t){return!!(t!=null&&t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t))},z3=[];for(kr=0;kr<256;kr++)z3[kr]=(kr<=15?"0":"")+kr.toString(16);var kr,H3=new RegExp("^[0-9a-fA-F]{24}$"),om=[];kr=0;for(;kr<10;)om[48+kr]=kr++;for(;kr<16;)om[55+kr]=om[87+kr]=kr++;function Pt(t){if(!(this instanceof Pt))return new Pt(t);if(t&&(t instanceof Pt||t._bsontype==="ObjectID"))return t;if(this._bsontype="ObjectID",t==null||typeof t=="number"){this.id=this.generate(t);return}var e=Pt.isValid(t);if(!e&&t!=null)throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(e&&typeof t=="string"&&t.length===24)return Pt.createFromHexString(t);if(t!=null&&t.length===12)this.id=t;else{if(t!=null&&typeof t.toHexString=="function")return t;throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters")}}G3.exports=Pt;Pt.default=Pt;Pt.createFromTime=function(t){return t=parseInt(t,10)%4294967295,new Pt(ZB(8,t)+"0000000000000000")};Pt.createFromHexString=function(t){if(typeof t>"u"||t!=null&&t.length!==24)throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");for(var e="",o=0;o<24;)e+=String.fromCharCode(om[t.charCodeAt(o++)]<<4|om[t.charCodeAt(o++)]);return new Pt(e)};Pt.isValid=function(t){return t==null?!1:typeof t=="number"?!0:typeof t=="string"?t.length===12||t.length===24&&H3.test(t):t instanceof Pt?!0:Zh(t)?Pt.isValid(t.toString("hex")):typeof t.toHexString=="function"&&V3&&(t.id instanceof V3||typeof t.id=="string")?t.id.length===12||t.id.length===24&&H3.test(t.id):!1};Pt.prototype={constructor:Pt,toHexString:function(){if(!this.id||!this.id.length)throw new Error("invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is ["+JSON.stringify(this.id)+"]");if(this.id.length===24)return this.id;if(Zh(this.id))return this.id.toString("hex");for(var t="",e=0;e<this.id.length;e++)t+=z3[this.id.charCodeAt(e)];return t},equals:function(t){return t instanceof Pt?this.toString()===t.toString():typeof t=="string"&&Pt.isValid(t)&&t.length===12&&Zh(this.id)?t===this.id.toString("binary"):typeof t=="string"&&Pt.isValid(t)&&t.length===24?t.toLowerCase()===this.toHexString():typeof t=="string"&&Pt.isValid(t)&&t.length===12?t===this.id:t!=null&&(t instanceof Pt||t.toHexString)?t.toHexString()===this.toHexString():!1},getTimestamp:function(){var t=new Date,e;return Zh(this.id)?e=this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24:e=this.id.charCodeAt(3)|this.id.charCodeAt(2)<<8|this.id.charCodeAt(1)<<16|this.id.charCodeAt(0)<<24,t.setTime(Math.floor(e)*1e3),t},generate:function(t){typeof t!="number"&&(t=~~(Date.now()/1e3)),t=parseInt(t,10)%4294967295;var e=XB();return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,t&255,Ry>>16&255,Ry>>8&255,Ry&255,O3>>8&255,O3&255,e>>16&255,e>>8&255,e&255)}};function XB(){return B3=(B3+1)%16777215}function ZB(t,e){return e=e.toString(16),e.length===t?e:"00000000".substring(e.length,t)+e}var YB=Symbol&&Symbol.for&&Symbol.for("nodejs.util.inspect.custom")||"inspect";Pt.prototype[YB]=function(){return"ObjectID("+this+")"};Pt.prototype.toJSON=Pt.prototype.toHexString;Pt.prototype.toString=Pt.prototype.toHexString});var aT=Dn(Tt=>{"use strict";var ko=typeof Symbol=="function"&&Symbol.for,EC=ko?Symbol.for("react.element"):60103,LC=ko?Symbol.for("react.portal"):60106,J1=ko?Symbol.for("react.fragment"):60107,q1=ko?Symbol.for("react.strict_mode"):60108,Q1=ko?Symbol.for("react.profiler"):60114,K1=ko?Symbol.for("react.provider"):60109,eg=ko?Symbol.for("react.context"):60110,$C=ko?Symbol.for("react.async_mode"):60111,tg=ko?Symbol.for("react.concurrent_mode"):60111,og=ko?Symbol.for("react.forward_ref"):60112,rg=ko?Symbol.for("react.suspense"):60113,_G=ko?Symbol.for("react.suspense_list"):60120,ng=ko?Symbol.for("react.memo"):60115,sg=ko?Symbol.for("react.lazy"):60116,IG=ko?Symbol.for("react.block"):60121,RG=ko?Symbol.for("react.fundamental"):60117,TG=ko?Symbol.for("react.responder"):60118,DG=ko?Symbol.for("react.scope"):60119;function Kr(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case EC:switch(t=t.type,t){case $C:case tg:case J1:case Q1:case q1:case rg:return t;default:switch(t=t&&t.$$typeof,t){case eg:case og:case sg:case ng:case K1:return t;default:return e}}case LC:return e}}}function iT(t){return Kr(t)===tg}Tt.AsyncMode=$C;Tt.ConcurrentMode=tg;Tt.ContextConsumer=eg;Tt.ContextProvider=K1;Tt.Element=EC;Tt.ForwardRef=og;Tt.Fragment=J1;Tt.Lazy=sg;Tt.Memo=ng;Tt.Portal=LC;Tt.Profiler=Q1;Tt.StrictMode=q1;Tt.Suspense=rg;Tt.isAsyncMode=function(t){return iT(t)||Kr(t)===$C};Tt.isConcurrentMode=iT;Tt.isContextConsumer=function(t){return Kr(t)===eg};Tt.isContextProvider=function(t){return Kr(t)===K1};Tt.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===EC};Tt.isForwardRef=function(t){return Kr(t)===og};Tt.isFragment=function(t){return Kr(t)===J1};Tt.isLazy=function(t){return Kr(t)===sg};Tt.isMemo=function(t){return Kr(t)===ng};Tt.isPortal=function(t){return Kr(t)===LC};Tt.isProfiler=function(t){return Kr(t)===Q1};Tt.isStrictMode=function(t){return Kr(t)===q1};Tt.isSuspense=function(t){return Kr(t)===rg};Tt.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===J1||t===tg||t===Q1||t===q1||t===rg||t===_G||typeof t=="object"&&t!==null&&(t.$$typeof===sg||t.$$typeof===ng||t.$$typeof===K1||t.$$typeof===eg||t.$$typeof===og||t.$$typeof===RG||t.$$typeof===TG||t.$$typeof===DG||t.$$typeof===IG)};Tt.typeOf=Kr});var cT=Dn((hAe,lT)=>{"use strict";lT.exports=aT()});var gT=Dn((gAe,hT)=>{"use strict";var jC=cT(),AG={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},PG={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},FG={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},fT={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},kC={};kC[jC.ForwardRef]=FG;kC[jC.Memo]=fT;function uT(t){return jC.isMemo(t)?fT:kC[t.$$typeof]||AG}var NG=Object.defineProperty,EG=Object.getOwnPropertyNames,dT=Object.getOwnPropertySymbols,LG=Object.getOwnPropertyDescriptor,$G=Object.getPrototypeOf,mT=Object.prototype;function pT(t,e,o){if(typeof e!="string"){if(mT){var n=$G(e);n&&n!==mT&&pT(t,n,o)}var r=EG(e);dT&&(r=r.concat(dT(e)));for(var s=uT(t),i=uT(e),a=0;a<r.length;++a){var l=r[a];if(!PG[l]&&!(o&&o[l])&&!(i&&i[l])&&!(s&&s[l])){var c=LG(e,l);try{NG(t,l,c)}catch{}}}}return t}hT.exports=pT});var h2=Dn((JHe,WP)=>{function p2(t){return t===void 0}function Hq(t){return t===null}function zq(t){return typeof t=="boolean"}function u0(t){return t===Object(t)}function zP(t){return Array.isArray(t)}function Gq(t){return t instanceof Date}function GP(t,e){return e?u0(t)&&!p2(t.uri):u0(t)&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.slice=="function"}function Wq(t,e){return GP(t,e)&&typeof t.name=="string"&&(u0(t.lastModifiedDate)||typeof t.lastModified=="number")}function Xl(t){return p2(t)?!1:t}function f2(t,e,o,n){e=e||{},o=o||new FormData,e.indices=Xl(e.indices),e.nullsAsUndefineds=Xl(e.nullsAsUndefineds),e.booleansAsIntegers=Xl(e.booleansAsIntegers),e.allowEmptyArrays=Xl(e.allowEmptyArrays),e.noAttributesWithArrayNotation=Xl(e.noAttributesWithArrayNotation),e.noFilesWithArrayNotation=Xl(e.noFilesWithArrayNotation),e.dotsForObjectNotation=Xl(e.dotsForObjectNotation);let r=typeof o.getParts=="function";return p2(t)||(Hq(t)?e.nullsAsUndefineds||o.append(n,""):zq(t)?e.booleansAsIntegers?o.append(n,t?1:0):o.append(n,t):zP(t)?t.length?t.forEach((s,i)=>{let a=n+"["+(e.indices?i:"")+"]";(e.noAttributesWithArrayNotation||e.noFilesWithArrayNotation&&Wq(s,r))&&(a=n),f2(s,e,o,a)}):e.allowEmptyArrays&&o.append(e.noAttributesWithArrayNotation?n:n+"[]",""):Gq(t)?o.append(n,t.toISOString()):u0(t)&&!GP(t,r)?Object.keys(t).forEach(s=>{let i=t[s];if(zP(i))for(;s.length>2&&s.lastIndexOf("[]")===s.length-2;)s=s.substring(0,s.length-2);let a=n?e.dotsForObjectNotation?n+"."+s:n+"["+s+"]":s;f2(i,e,o,a)}):o.append(n,t)),o}WP.exports={serialize:f2}});var XN=Dn((jlt,UN)=>{(function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(o,n){return o<<n|o>>>32-n},rotr:function(o,n){return o<<32-n|o>>>n},endian:function(o){if(o.constructor==Number)return e.rotl(o,8)&16711935|e.rotl(o,24)&4278255360;for(var n=0;n<o.length;n++)o[n]=e.endian(o[n]);return o},randomBytes:function(o){for(var n=[];o>0;o--)n.push(Math.floor(Math.random()*256));return n},bytesToWords:function(o){for(var n=[],r=0,s=0;r<o.length;r++,s+=8)n[s>>>5]|=o[r]<<24-s%32;return n},wordsToBytes:function(o){for(var n=[],r=0;r<o.length*32;r+=8)n.push(o[r>>>5]>>>24-r%32&255);return n},bytesToHex:function(o){for(var n=[],r=0;r<o.length;r++)n.push((o[r]>>>4).toString(16)),n.push((o[r]&15).toString(16));return n.join("")},hexToBytes:function(o){for(var n=[],r=0;r<o.length;r+=2)n.push(parseInt(o.substr(r,2),16));return n},bytesToBase64:function(o){for(var n=[],r=0;r<o.length;r+=3)for(var s=o[r]<<16|o[r+1]<<8|o[r+2],i=0;i<4;i++)r*8+i*6<=o.length*8?n.push(t.charAt(s>>>6*(3-i)&63)):n.push("=");return n.join("")},base64ToBytes:function(o){o=o.replace(/[^A-Z0-9+\/]/ig,"");for(var n=[],r=0,s=0;r<o.length;s=++r%4)s!=0&&n.push((t.indexOf(o.charAt(r-1))&Math.pow(2,-2*s+8)-1)<<s*2|t.indexOf(o.charAt(r))>>>6-s*2);return n}};UN.exports=e})()});var A5=Dn((klt,ZN)=>{var D5={utf8:{stringToBytes:function(t){return D5.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(D5.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],o=0;o<t.length;o++)e.push(t.charCodeAt(o)&255);return e},bytesToString:function(t){for(var e=[],o=0;o<t.length;o++)e.push(String.fromCharCode(t[o]));return e.join("")}}};ZN.exports=D5});var qN=Dn((Mlt,JN)=>{JN.exports=function(t){return t!=null&&(YN(t)||rne(t)||!!t._isBuffer)};function YN(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function rne(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&YN(t.slice(0,0))}});var KN=Dn((Blt,QN)=>{(function(){var t=XN(),e=A5().utf8,o=qN(),n=A5().bin,r=function(s,i){s.constructor==String?i&&i.encoding==="binary"?s=n.stringToBytes(s):s=e.stringToBytes(s):o(s)?s=Array.prototype.slice.call(s,0):!Array.isArray(s)&&s.constructor!==Uint8Array&&(s=s.toString());for(var a=t.bytesToWords(s),l=s.length*8,c=1732584193,u=-271733879,d=-1732584194,f=271733878,m=0;m<a.length;m++)a[m]=(a[m]<<8|a[m]>>>24)&16711935|(a[m]<<24|a[m]>>>8)&4278255360;a[l>>>5]|=128<<l%32,a[(l+64>>>9<<4)+14]=l;for(var p=r._ff,h=r._gg,g=r._hh,b=r._ii,m=0;m<a.length;m+=16){var v=c,C=u,y=d,x=f;c=p(c,u,d,f,a[m+0],7,-680876936),f=p(f,c,u,d,a[m+1],12,-389564586),d=p(d,f,c,u,a[m+2],17,606105819),u=p(u,d,f,c,a[m+3],22,-1044525330),c=p(c,u,d,f,a[m+4],7,-176418897),f=p(f,c,u,d,a[m+5],12,1200080426),d=p(d,f,c,u,a[m+6],17,-1473231341),u=p(u,d,f,c,a[m+7],22,-45705983),c=p(c,u,d,f,a[m+8],7,1770035416),f=p(f,c,u,d,a[m+9],12,-1958414417),d=p(d,f,c,u,a[m+10],17,-42063),u=p(u,d,f,c,a[m+11],22,-1990404162),c=p(c,u,d,f,a[m+12],7,1804603682),f=p(f,c,u,d,a[m+13],12,-40341101),d=p(d,f,c,u,a[m+14],17,-1502002290),u=p(u,d,f,c,a[m+15],22,1236535329),c=h(c,u,d,f,a[m+1],5,-165796510),f=h(f,c,u,d,a[m+6],9,-1069501632),d=h(d,f,c,u,a[m+11],14,643717713),u=h(u,d,f,c,a[m+0],20,-373897302),c=h(c,u,d,f,a[m+5],5,-701558691),f=h(f,c,u,d,a[m+10],9,38016083),d=h(d,f,c,u,a[m+15],14,-660478335),u=h(u,d,f,c,a[m+4],20,-405537848),c=h(c,u,d,f,a[m+9],5,568446438),f=h(f,c,u,d,a[m+14],9,-1019803690),d=h(d,f,c,u,a[m+3],14,-187363961),u=h(u,d,f,c,a[m+8],20,1163531501),c=h(c,u,d,f,a[m+13],5,-1444681467),f=h(f,c,u,d,a[m+2],9,-51403784),d=h(d,f,c,u,a[m+7],14,1735328473),u=h(u,d,f,c,a[m+12],20,-1926607734),c=g(c,u,d,f,a[m+5],4,-378558),f=g(f,c,u,d,a[m+8],11,-2022574463),d=g(d,f,c,u,a[m+11],16,1839030562),u=g(u,d,f,c,a[m+14],23,-35309556),c=g(c,u,d,f,a[m+1],4,-1530992060),f=g(f,c,u,d,a[m+4],11,1272893353),d=g(d,f,c,u,a[m+7],16,-155497632),u=g(u,d,f,c,a[m+10],23,-1094730640),c=g(c,u,d,f,a[m+13],4,681279174),f=g(f,c,u,d,a[m+0],11,-358537222),d=g(d,f,c,u,a[m+3],16,-722521979),u=g(u,d,f,c,a[m+6],23,76029189),c=g(c,u,d,f,a[m+9],4,-640364487),f=g(f,c,u,d,a[m+12],11,-421815835),d=g(d,f,c,u,a[m+15],16,530742520),u=g(u,d,f,c,a[m+2],23,-995338651),c=b(c,u,d,f,a[m+0],6,-198630844),f=b(f,c,u,d,a[m+7],10,1126891415),d=b(d,f,c,u,a[m+14],15,-1416354905),u=b(u,d,f,c,a[m+5],21,-57434055),c=b(c,u,d,f,a[m+12],6,1700485571),f=b(f,c,u,d,a[m+3],10,-1894986606),d=b(d,f,c,u,a[m+10],15,-1051523),u=b(u,d,f,c,a[m+1],21,-2054922799),c=b(c,u,d,f,a[m+8],6,1873313359),f=b(f,c,u,d,a[m+15],10,-30611744),d=b(d,f,c,u,a[m+6],15,-1560198380),u=b(u,d,f,c,a[m+13],21,1309151649),c=b(c,u,d,f,a[m+4],6,-145523070),f=b(f,c,u,d,a[m+11],10,-1120210379),d=b(d,f,c,u,a[m+2],15,718787259),u=b(u,d,f,c,a[m+9],21,-343485551),c=c+v>>>0,u=u+C>>>0,d=d+y>>>0,f=f+x>>>0}return t.endian([c,u,d,f])};r._ff=function(s,i,a,l,c,u,d){var f=s+(i&a|~i&l)+(c>>>0)+d;return(f<<u|f>>>32-u)+i},r._gg=function(s,i,a,l,c,u,d){var f=s+(i&l|a&~l)+(c>>>0)+d;return(f<<u|f>>>32-u)+i},r._hh=function(s,i,a,l,c,u,d){var f=s+(i^a^l)+(c>>>0)+d;return(f<<u|f>>>32-u)+i},r._ii=function(s,i,a,l,c,u,d){var f=s+(a^(i|~l))+(c>>>0)+d;return(f<<u|f>>>32-u)+i},r._blocksize=16,r._digestsize=16,QN.exports=function(s,i){if(s==null)throw new Error("Illegal argument "+s);var a=t.wordsToBytes(r(s,i));return i&&i.asBytes?a:i&&i.asString?n.bytesToString(a):t.bytesToHex(a)}})()});import{jsx as dy}from"react/jsx-runtime";import"react";function le({CustomComponent:t,Fallback:e}){return t!==void 0?t:e}import{jsx as zk}from"react/jsx-runtime";import cy from"react";import{createContext as Qi,use as Ki}from"react";var Jd=Ji(j4(),1);import{createElement as Fk,createContext as Nk,useContext as Ek,useEffect as Lk,useLayoutEffect as $k,useReducer as jk,useRef as ny,useState as kk}from"react";var Sh=Symbol(),Mk=Symbol(),Bk=typeof window>"u"||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent),k4=Bk?Lk:$k,Ok=Jd.unstable_runWithPriority?t=>{try{(0,Jd.unstable_runWithPriority)(Jd.unstable_NormalPriority,t)}catch(e){if(e.message==="Not implemented.")t();else throw e}}:t=>t(),Vk=t=>({value:o,children:n})=>{let r=ny(o),s=ny(0),[i,a]=kk(null);i&&(i(o),a(null));let l=ny();if(!l.current){let c=new Set,u=(d,f)=>{s.current+=1;let m={n:s.current};f?.suspense&&(m.n*=-1,m.p=new Promise(p=>{a(()=>h=>{m.v=h,delete m.p,p(h)})})),c.forEach(p=>p(m)),d()};l.current={[Sh]:{v:r,n:s,l:c,u}}}return k4(()=>{r.current=o,s.current+=1,Ok(()=>{l.current[Sh].l.forEach(c=>{c({n:s.current,v:o})})})},[o]),Fk(t,{value:l.current},n)},Hk=t=>t;function M4(t){let e=Nk({[Sh]:{v:{current:t},n:{current:-1},l:new Set,u:o=>o()}});return e[Mk]=e.Provider,e.Provider=Vk(e.Provider),delete e.Consumer,e}function sy(t,e){let o=Ek(t)[Sh],{v:{current:n},n:{current:r},l:s}=o,i=e(n),[a,l]=jk((c,u)=>{if(!u)return[n,i];if("p"in u)throw u.p;if(u.n===r)return Object.is(c[1],i)?c:[n,i];try{if("v"in u){if(Object.is(c[0],u.v))return c;let d=e(u.v);return Object.is(c[1],d)?c:[u.v,d]}}catch{}return[...c]},[n,i]);return Object.is(a[1],i)||l(),k4(()=>(s.add(l),()=>{s.delete(l)}),[s]),a[1]}function B4(t){return sy(t,Hk)}var _h=Qi({}),Ih=Qi({}),Rh=Qi({}),Th=Qi(!1),Dh=Qi(!1),iy=Qi(!1),Ah=Qi(!1),ay=Qi(!1),qd=M4([{},()=>null]),Ge=()=>Ki(_h),$c=()=>Ki(Ih),Ph=()=>Ki(Rh),vo=()=>Ki(Th),mn=()=>Ki(Dh),ly=()=>Ki(iy),Kt=()=>Ki(Ah),Xs=()=>Ki(ay),Ht=t=>sy(qd,t),ea=()=>B4(qd);var O4=cy.createContext({data:{},path:"",rowNumber:void 0}),uy=({children:t,path:e,rowNumber:o})=>{let{getDataByPath:n,getSiblingData:r}=Ph(),s=r(e),a=n(e)||s,l=cy.useMemo(()=>({data:a,path:e,rowNumber:o}),[a,e,o]);return zk(O4,{value:l,children:t})},Gk=()=>cy.use(O4);var Wk="row-label",Ur=t=>{let{className:e,CustomComponent:o,label:n,path:r,rowNumber:s}=t;return dy(uy,{path:r,rowNumber:s,children:dy(le,{CustomComponent:o,Fallback:typeof n=="string"?dy("span",{className:[Wk,e].filter(Boolean).join(" "),style:{pointerEvents:"none"},children:n}):n})})};import{jsx as Io,jsxs as oc}from"react/jsx-runtime";import Z4,{useMemo as Lh,useRef as py,useEffect as $h,useState as eM,useContext as tM}from"react";import{useDndContext as oM,getClientRect as rM,useDroppable as nM,useDraggable as sM,closestCorners as iM,getFirstCollision as aM,getScrollableAncestors as lM,KeyboardCode as ta}from"@dnd-kit/core";import{useMemo as V4,useLayoutEffect as Uk,useEffect as Xk,useRef as pge,useCallback as hge}from"react";function H4(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return V4(()=>n=>{e.forEach(r=>r(n))},e)}var Zk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Yk(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Jk(t){return"nodeType"in t}function z4(t){var e,o;return t?Yk(t)?t:Jk(t)&&(e=(o=t.ownerDocument)==null?void 0:o.defaultView)!=null?e:window:window}var fy=Zk?Uk:Xk;var my={};function G4(t,e){return V4(()=>{if(e)return e;let o=my[t]==null?0:my[t]+1;return my[t]=o,t+"-"+o},[t,e])}function qk(t){return function(e){for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];return n.reduce((s,i)=>{let a=Object.entries(i);for(let[l,c]of a){let u=s[l];u!=null&&(s[l]=u+t*c)}return s},{...e})}}var W4=qk(-1);function Qk(t){return"clientX"in t&&"clientY"in t}function U4(t){if(!t)return!1;let{KeyboardEvent:e}=z4(t.target);return e&&t instanceof e}function Kk(t){if(!t)return!1;let{TouchEvent:e}=z4(t.target);return e&&t instanceof e}function X4(t){if(Kk(t)){if(t.touches&&t.touches.length){let{clientX:e,clientY:o}=t.touches[0];return{x:e,y:o}}else if(t.changedTouches&&t.changedTouches.length){let{clientX:e,clientY:o}=t.changedTouches[0];return{x:e,y:o}}}return Qk(t)?{x:t.clientX,y:t.clientY}:null}var Qd=Object.freeze({Translate:{toString(t){if(!t)return;let{x:e,y:o}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(o?Math.round(o):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;let{scaleX:e,scaleY:o}=t;return"scaleX("+e+") scaleY("+o+")"}},Transform:{toString(t){if(t)return[Qd.Translate.toString(t),Qd.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:o,easing:n}=t;return e+" "+o+"ms "+n}}});function jc(t,e,o){let n=t.slice();return n.splice(o<0?n.length+o:o,0,n.splice(e,1)[0]),n}function cM(t,e){return t.reduce((o,n,r)=>{let s=e.get(n);return s&&(o[r]=s),o},Array(t.length))}function Fh(t){return t!==null&&t>=0}function uM(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==e[o])return!1;return!0}function dM(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}var Nh={scaleX:1,scaleY:1},Y4=t=>{var e;let{rects:o,activeNodeRect:n,activeIndex:r,overIndex:s,index:i}=t,a=(e=o[r])!=null?e:n;if(!a)return null;let l=mM(o,i,r);if(i===r){let c=o[s];return c?{x:r<s?c.left+c.width-(a.left+a.width):c.left-a.left,y:0,...Nh}:null}return i>r&&i<=s?{x:-a.width-l,y:0,...Nh}:i<r&&i>=s?{x:a.width+l,y:0,...Nh}:{x:0,y:0,...Nh}};function mM(t,e,o){let n=t[e],r=t[e-1],s=t[e+1];return!n||!r&&!s?0:o<e?r?n.left-(r.left+r.width):s.left-(n.left+n.width):s?s.left-(n.left+n.width):n.left-(r.left+r.width)}var J4=t=>{let{rects:e,activeIndex:o,overIndex:n,index:r}=t,s=jc(e,n,o),i=e[r],a=s[r];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}};var Eh={scaleX:1,scaleY:1},kh=t=>{var e;let{activeIndex:o,activeNodeRect:n,index:r,rects:s,overIndex:i}=t,a=(e=s[o])!=null?e:n;if(!a)return null;if(r===o){let c=s[i];return c?{x:0,y:o<i?c.top+c.height-(a.top+a.height):c.top-a.top,...Eh}:null}let l=fM(s,r,o);return r>o&&r<=i?{x:0,y:-a.height-l,...Eh}:r<o&&r>=i?{x:0,y:a.height+l,...Eh}:{x:0,y:0,...Eh}};function fM(t,e,o){let n=t[e],r=t[e-1],s=t[e+1];return n?o<e?r?n.top-(r.top+r.height):s?s.top-(n.top+n.height):0:s?s.top-(n.top+n.height):r?n.top-(r.top+r.height):0:0}var q4="Sortable",Q4=Z4.createContext({activeIndex:-1,containerId:q4,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:J4,disabled:{draggable:!1,droppable:!1}});function K4(t){let{children:e,id:o,items:n,strategy:r=J4,disabled:s=!1}=t,{active:i,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=oM(),d=G4(q4,o),f=a.rect!==null,m=Lh(()=>n.map(w=>typeof w=="object"&&"id"in w?w.id:w),[n]),p=i!=null,h=i?m.indexOf(i.id):-1,g=c?m.indexOf(c.id):-1,b=py(m),v=!uM(m,b.current),C=g!==-1&&h===-1||v,y=dM(s);fy(()=>{v&&p&&u(m)},[v,m,p,u]),$h(()=>{b.current=m},[m]);let x=Lh(()=>({activeIndex:h,containerId:d,disabled:y,disableTransforms:C,items:m,overIndex:g,useDragOverlay:f,sortedRects:cM(m,l),strategy:r}),[h,d,y.draggable,y.droppable,C,m,g,l,f,r]);return Z4.createElement(Q4.Provider,{value:x},e)}var pM=t=>{let{id:e,items:o,activeIndex:n,overIndex:r}=t;return jc(o,n,r).indexOf(e)},hM=t=>{let{containerId:e,isSorting:o,wasDragging:n,index:r,items:s,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=t;return!c||!n||a!==s&&r===i?!1:o?!0:i!==r&&e===l},gM={duration:200,easing:"ease"},e3="transform",bM=Qd.Transition.toString({property:e3,duration:0,easing:"linear"}),vM={roleDescription:"sortable"};function yM(t){let{disabled:e,index:o,node:n,rect:r}=t,[s,i]=eM(null),a=py(o);return fy(()=>{if(!e&&o!==a.current&&n.current){let l=r.current;if(l){let c=rM(n.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&i(u)}}o!==a.current&&(a.current=o)},[e,o,n,r]),$h(()=>{s&&i(null)},[s]),s}function t3(t){let{animateLayoutChanges:e=hM,attributes:o,disabled:n,data:r,getNewIndex:s=pM,id:i,strategy:a,resizeObserverConfig:l,transition:c=gM}=t,{items:u,containerId:d,activeIndex:f,disabled:m,disableTransforms:p,sortedRects:h,overIndex:g,useDragOverlay:b,strategy:v}=tM(Q4),C=CM(n,m),y=u.indexOf(i),x=Lh(()=>({sortable:{containerId:d,index:y,items:u},...r}),[d,r,y,u]),w=Lh(()=>u.slice(u.indexOf(i)),[u,i]),{rect:S,node:_,isOver:I,setNodeRef:A}=nM({id:i,data:x,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:w,...l}}),{active:D,activatorEvent:T,activeNodeRect:R,attributes:P,setNodeRef:E,listeners:F,isDragging:L,over:M,setActivatorNodeRef:$,transform:B}=sM({id:i,data:x,attributes:{...vM,...o},disabled:C.draggable}),j=H4(A,E),k=!!D,O=k&&!p&&Fh(f)&&Fh(g),V=!b&&L,H=V&&O?B:null,W=O?H??(a??v)({rects:h,activeNodeRect:R,activeIndex:f,overIndex:g,index:y}):null,U=Fh(f)&&Fh(g)?s({id:i,items:u,activeIndex:f,overIndex:g}):y,X=D?.id,Q=py({activeId:X,items:u,newIndex:U,containerId:d}),J=u!==Q.current.items,oe=e({active:D,containerId:d,isDragging:L,isSorting:k,id:i,index:y,items:u,newIndex:Q.current.newIndex,previousItems:Q.current.items,previousContainerId:Q.current.containerId,transition:c,wasDragging:Q.current.activeId!=null}),Y=yM({disabled:!oe,index:y,node:_,rect:S});return $h(()=>{k&&Q.current.newIndex!==U&&(Q.current.newIndex=U),d!==Q.current.containerId&&(Q.current.containerId=d),u!==Q.current.items&&(Q.current.items=u)},[k,U,d,u]),$h(()=>{if(X===Q.current.activeId)return;if(X!=null&&Q.current.activeId==null){Q.current.activeId=X;return}let ee=setTimeout(()=>{Q.current.activeId=X},50);return()=>clearTimeout(ee)},[X]),{active:D,activeIndex:f,attributes:P,data:x,rect:S,index:y,newIndex:U,items:u,isOver:I,isSorting:k,isDragging:L,listeners:F,node:_,overIndex:g,over:M,setNodeRef:j,setActivatorNodeRef:$,setDroppableNodeRef:A,setDraggableNodeRef:E,transform:Y??W,transition:K()};function K(){if(Y||J&&Q.current.newIndex===y)return bM;if(!(V&&!U4(T)||!c)&&(k||oe))return Qd.Transition.toString({...c,property:e3})}}function CM(t,e){var o,n;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(o=t?.draggable)!=null?o:e.draggable,droppable:(n=t?.droppable)!=null?n:e.droppable}}function jh(t){if(!t)return!1;let e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}var xM=[ta.Down,ta.Right,ta.Up,ta.Left],o3=(t,e)=>{let{context:{active:o,collisionRect:n,droppableRects:r,droppableContainers:s,over:i,scrollableAncestors:a}}=e;if(xM.includes(t.code)){if(t.preventDefault(),!o||!n)return;let l=[];s.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;let f=r.get(d.id);if(f)switch(t.code){case ta.Down:n.top<f.top&&l.push(d);break;case ta.Up:n.top>f.top&&l.push(d);break;case ta.Left:n.left>f.left&&l.push(d);break;case ta.Right:n.left<f.left&&l.push(d);break}});let c=iM({active:o,collisionRect:n,droppableRects:r,droppableContainers:l,pointerCoordinates:null}),u=aM(c,"id");if(u===i?.id&&c.length>1&&(u=c[1].id),u!=null){let d=s.get(o.id),f=s.get(u),m=f?r.get(f.id):null,p=f?.node.current;if(p&&m&&d&&f){let g=lM(p).some((w,S)=>a[S]!==w),b=r3(d,f),v=wM(d,f),C=g||!b?{x:0,y:0}:{x:v?n.width-m.width:0,y:v?n.height-m.height:0},y={x:m.left,y:m.top};return C.x&&C.y?y:W4(y,C)}}}};function r3(t,e){return!jh(t)||!jh(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function wM(t,e){return!jh(t)||!jh(e)||!r3(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}import{getTranslation as F0}from"@payloadcms/translations";import Qee,{useCallback as Sn,useId as Kee,useMemo as DF}from"react";import je,{forwardRef as SM,isValidElement as hy}from"react";import _M from"react-dom";import jr from"react";import n3 from"react";import LM from"react";var IM=t=>{switch(t){case"success":return DM;case"info":return PM;case"warning":return AM;case"error":return FM;default:return null}},RM=Array(12).fill(0),TM=({visible:t,className:e})=>jr.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},jr.createElement("div",{className:"sonner-spinner"},RM.map((o,n)=>jr.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),DM=jr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},jr.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"})),AM=jr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},jr.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"})),PM=jr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},jr.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"})),FM=jr.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},jr.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"})),NM=jr.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"},jr.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jr.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),EM=()=>{let[t,e]=n3.useState(document.hidden);return n3.useEffect(()=>{let o=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",o),()=>window.removeEventListener("visibilitychange",o)},[]),t},gy=1,$M=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:o,...n}=t,r=typeof t?.id=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:gy++,s=this.toasts.find(a=>a.id===r),i=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),s?this.toasts=this.toasts.map(a=>a.id===r?(this.publish({...a,...t,id:r,title:o}),{...a,...t,id:r,dismissible:i,title:o}):a):this.addToast({title:o,...n,dismissible:i,id:r}),r},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(o=>o({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let o;e.loading!==void 0&&(o=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let n=t instanceof Promise?t:t(),r=o!==void 0,s,i=n.then(async l=>{if(s=["resolve",l],LM.isValidElement(l))r=!1,this.create({id:o,type:"default",message:l});else if(kM(l)&&!l.ok){r=!1;let c=typeof e.error=="function"?await e.error(`HTTP error! status: ${l.status}`):e.error,u=typeof e.description=="function"?await e.description(`HTTP error! status: ${l.status}`):e.description;this.create({id:o,type:"error",message:c,description:u})}else if(e.success!==void 0){r=!1;let c=typeof e.success=="function"?await e.success(l):e.success,u=typeof e.description=="function"?await e.description(l):e.description;this.create({id:o,type:"success",message:c,description:u})}}).catch(async l=>{if(s=["reject",l],e.error!==void 0){r=!1;let c=typeof e.error=="function"?await e.error(l):e.error,u=typeof e.description=="function"?await e.description(l):e.description;this.create({id:o,type:"error",message:c,description:u})}}).finally(()=>{var l;r&&(this.dismiss(o),o=void 0),(l=e.finally)==null||l.call(e)}),a=()=>new Promise((l,c)=>i.then(()=>s[0]==="reject"?c(s[1]):l(s[1])).catch(c));return typeof o!="string"&&typeof o!="number"?{unwrap:a}:Object.assign(o,{unwrap:a})},this.custom=(t,e)=>{let o=e?.id||gy++;return this.create({jsx:t(o),id:o,...e}),o},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},$r=new $M,jM=(t,e)=>{let o=e?.id||gy++;return $r.addToast({title:t,...e,id:o}),o},kM=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",MM=jM,BM=()=>$r.toasts,OM=()=>$r.getActiveToasts(),se=Object.assign(MM,{success:$r.success,info:$r.info,warning:$r.warning,error:$r.error,custom:$r.custom,message:$r.message,promise:$r.promise,dismiss:$r.dismiss,loading:$r.loading},{getHistory:BM,getToasts:OM});function VM(t,{insertAt:e}={}){if(!t||typeof document>"u")return;let o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e==="top"&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}VM(`: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;left: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}: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%);--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%)}
14
- `);function Mh(t){return t.label!==void 0}var HM=3,zM="32px",GM="16px",s3=4e3,WM=356,UM=14,XM=20,ZM=200;function Pn(...t){return t.filter(Boolean).join(" ")}function YM(t){let[e,o]=t.split("-"),n=[];return e&&n.push(e),o&&n.push(o),n}var JM=t=>{var e,o,n,r,s,i,a,l,c,u,d;let{invert:f,toast:m,unstyled:p,interacting:h,setHeights:g,visibleToasts:b,heights:v,index:C,toasts:y,expanded:x,removeToast:w,defaultRichColors:S,closeButton:_,style:I,cancelButtonStyle:A,actionButtonStyle:D,className:T="",descriptionClassName:R="",duration:P,position:E,gap:F,loadingIcon:L,expandByDefault:M,classNames:$,icons:B,closeButtonAriaLabel:j="Close toast",pauseWhenPageIsHidden:k}=t,[O,V]=je.useState(null),[H,z]=je.useState(null),[W,U]=je.useState(!1),[X,Q]=je.useState(!1),[J,oe]=je.useState(!1),[Y,K]=je.useState(!1),[ee,te]=je.useState(!1),[re,me]=je.useState(0),[we,Ae]=je.useState(0),de=je.useRef(m.duration||P||s3),xe=je.useRef(null),$e=je.useRef(null),Le=C===0,rt=C+1<=b,q=m.type,pe=m.dismissible!==!1,fe=m.className||"",Pe=m.descriptionClassName||"",ge=je.useMemo(()=>v.findIndex(Be=>Be.toastId===m.id)||0,[v,m.id]),ae=je.useMemo(()=>{var Be;return(Be=m.closeButton)!=null?Be:_},[m.closeButton,_]),Se=je.useMemo(()=>m.duration||P||s3,[m.duration,P]),ne=je.useRef(0),Te=je.useRef(0),he=je.useRef(0),_e=je.useRef(null),[Ze,ut]=E.split("-"),De=je.useMemo(()=>v.reduce((Be,qe,ce)=>ce>=ge?Be:Be+qe.height,0),[v,ge]),it=EM(),pt=m.invert||f,Vt=q==="loading";Te.current=je.useMemo(()=>ge*F+De,[ge,De]),je.useEffect(()=>{de.current=Se},[Se]),je.useEffect(()=>{U(!0)},[]),je.useEffect(()=>{let Be=$e.current;if(Be){let qe=Be.getBoundingClientRect().height;return Ae(qe),g(ce=>[{toastId:m.id,height:qe,position:m.position},...ce]),()=>g(ce=>ce.filter(ze=>ze.toastId!==m.id))}},[g,m.id]),je.useLayoutEffect(()=>{if(!W)return;let Be=$e.current,qe=Be.style.height;Be.style.height="auto";let ce=Be.getBoundingClientRect().height;Be.style.height=qe,Ae(ce),g(ze=>ze.find(He=>He.toastId===m.id)?ze.map(He=>He.toastId===m.id?{...He,height:ce}:He):[{toastId:m.id,height:ce,position:m.position},...ze])},[W,m.title,m.description,g,m.id]);let Nt=je.useCallback(()=>{Q(!0),me(Te.current),g(Be=>Be.filter(qe=>qe.toastId!==m.id)),setTimeout(()=>{w(m)},ZM)},[m,w,g,Te]);je.useEffect(()=>{if(m.promise&&q==="loading"||m.duration===1/0||m.type==="loading")return;let Be;return x||h||k&&it?(()=>{if(he.current<ne.current){let qe=new Date().getTime()-ne.current;de.current=de.current-qe}he.current=new Date().getTime()})():de.current!==1/0&&(ne.current=new Date().getTime(),Be=setTimeout(()=>{var qe;(qe=m.onAutoClose)==null||qe.call(m,m),Nt()},de.current)),()=>clearTimeout(Be)},[x,h,m,q,k,it,Nt]),je.useEffect(()=>{m.delete&&Nt()},[Nt,m.delete]);function Do(){var Be,qe,ce;return B!=null&&B.loading?je.createElement("div",{className:Pn($?.loader,(Be=m?.classNames)==null?void 0:Be.loader,"sonner-loader"),"data-visible":q==="loading"},B.loading):L?je.createElement("div",{className:Pn($?.loader,(qe=m?.classNames)==null?void 0:qe.loader,"sonner-loader"),"data-visible":q==="loading"},L):je.createElement(TM,{className:Pn($?.loader,(ce=m?.classNames)==null?void 0:ce.loader),visible:q==="loading"})}return je.createElement("li",{tabIndex:0,ref:$e,className:Pn(T,fe,$?.toast,(e=m?.classNames)==null?void 0:e.toast,$?.default,$?.[q],(o=m?.classNames)==null?void 0:o[q]),"data-sonner-toast":"","data-rich-colors":(n=m.richColors)!=null?n:S,"data-styled":!(m.jsx||m.unstyled||p),"data-mounted":W,"data-promise":!!m.promise,"data-swiped":ee,"data-removed":X,"data-visible":rt,"data-y-position":Ze,"data-x-position":ut,"data-index":C,"data-front":Le,"data-swiping":J,"data-dismissible":pe,"data-type":q,"data-invert":pt,"data-swipe-out":Y,"data-swipe-direction":H,"data-expanded":!!(x||M&&W),style:{"--index":C,"--toasts-before":C,"--z-index":y.length-C,"--offset":`${X?re:Te.current}px`,"--initial-height":M?"auto":`${we}px`,...I,...m.style},onDragEnd:()=>{oe(!1),V(null),_e.current=null},onPointerDown:Be=>{Vt||!pe||(xe.current=new Date,me(Te.current),Be.target.setPointerCapture(Be.pointerId),Be.target.tagName!=="BUTTON"&&(oe(!0),_e.current={x:Be.clientX,y:Be.clientY}))},onPointerUp:()=>{var Be,qe,ce,ze;if(Y||!pe)return;_e.current=null;let He=Number(((Be=$e.current)==null?void 0:Be.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),at=Number(((qe=$e.current)==null?void 0:qe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ye=new Date().getTime()-((ce=xe.current)==null?void 0:ce.getTime()),ot=O==="x"?He:at,Ie=Math.abs(ot)/Ye;if(Math.abs(ot)>=XM||Ie>.11){me(Te.current),(ze=m.onDismiss)==null||ze.call(m,m),z(O==="x"?He>0?"right":"left":at>0?"down":"up"),Nt(),K(!0),te(!1);return}oe(!1),V(null)},onPointerMove:Be=>{var qe,ce,ze,He;if(!_e.current||!pe||((qe=window.getSelection())==null?void 0:qe.toString().length)>0)return;let at=Be.clientY-_e.current.y,Ye=Be.clientX-_e.current.x,ot=(ce=t.swipeDirections)!=null?ce:YM(E);!O&&(Math.abs(Ye)>1||Math.abs(at)>1)&&V(Math.abs(Ye)>Math.abs(at)?"x":"y");let Ie={x:0,y:0};O==="y"?(ot.includes("top")||ot.includes("bottom"))&&(ot.includes("top")&&at<0||ot.includes("bottom")&&at>0)&&(Ie.y=at):O==="x"&&(ot.includes("left")||ot.includes("right"))&&(ot.includes("left")&&Ye<0||ot.includes("right")&&Ye>0)&&(Ie.x=Ye),(Math.abs(Ie.x)>0||Math.abs(Ie.y)>0)&&te(!0),(ze=$e.current)==null||ze.style.setProperty("--swipe-amount-x",`${Ie.x}px`),(He=$e.current)==null||He.style.setProperty("--swipe-amount-y",`${Ie.y}px`)}},ae&&!m.jsx?je.createElement("button",{"aria-label":j,"data-disabled":Vt,"data-close-button":!0,onClick:Vt||!pe?()=>{}:()=>{var Be;Nt(),(Be=m.onDismiss)==null||Be.call(m,m)},className:Pn($?.closeButton,(r=m?.classNames)==null?void 0:r.closeButton)},(s=B?.close)!=null?s:NM):null,m.jsx||hy(m.title)?m.jsx?m.jsx:typeof m.title=="function"?m.title():m.title:je.createElement(je.Fragment,null,q||m.icon||m.promise?je.createElement("div",{"data-icon":"",className:Pn($?.icon,(i=m?.classNames)==null?void 0:i.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||Do():null,m.type!=="loading"?m.icon||B?.[q]||IM(q):null):null,je.createElement("div",{"data-content":"",className:Pn($?.content,(a=m?.classNames)==null?void 0:a.content)},je.createElement("div",{"data-title":"",className:Pn($?.title,(l=m?.classNames)==null?void 0:l.title)},typeof m.title=="function"?m.title():m.title),m.description?je.createElement("div",{"data-description":"",className:Pn(R,Pe,$?.description,(c=m?.classNames)==null?void 0:c.description)},typeof m.description=="function"?m.description():m.description):null),hy(m.cancel)?m.cancel:m.cancel&&Mh(m.cancel)?je.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||A,onClick:Be=>{var qe,ce;Mh(m.cancel)&&pe&&((ce=(qe=m.cancel).onClick)==null||ce.call(qe,Be),Nt())},className:Pn($?.cancelButton,(u=m?.classNames)==null?void 0:u.cancelButton)},m.cancel.label):null,hy(m.action)?m.action:m.action&&Mh(m.action)?je.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||D,onClick:Be=>{var qe,ce;Mh(m.action)&&((ce=(qe=m.action).onClick)==null||ce.call(qe,Be),!Be.defaultPrevented&&Nt())},className:Pn($?.actionButton,(d=m?.classNames)==null?void 0:d.actionButton)},m.action.label):null))};function i3(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function qM(t,e){let o={};return[t,e].forEach((n,r)=>{let s=r===1,i=s?"--mobile-offset":"--offset",a=s?GM:zM;function l(c){["top","right","bottom","left"].forEach(u=>{o[`${i}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof n=="number"||typeof n=="string"?l(n):typeof n=="object"?["top","right","bottom","left"].forEach(c=>{n[c]===void 0?o[`${i}-${c}`]=a:o[`${i}-${c}`]=typeof n[c]=="number"?`${n[c]}px`:n[c]}):l(a)}),o}var a3=SM(function(t,e){let{invert:o,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:s,closeButton:i,className:a,offset:l,mobileOffset:c,theme:u="light",richColors:d,duration:f,style:m,visibleToasts:p=HM,toastOptions:h,dir:g=i3(),gap:b=UM,loadingIcon:v,icons:C,containerAriaLabel:y="Notifications",pauseWhenPageIsHidden:x}=t,[w,S]=je.useState([]),_=je.useMemo(()=>Array.from(new Set([n].concat(w.filter(k=>k.position).map(k=>k.position)))),[w,n]),[I,A]=je.useState([]),[D,T]=je.useState(!1),[R,P]=je.useState(!1),[E,F]=je.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),L=je.useRef(null),M=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),$=je.useRef(null),B=je.useRef(!1),j=je.useCallback(k=>{S(O=>{var V;return(V=O.find(H=>H.id===k.id))!=null&&V.delete||$r.dismiss(k.id),O.filter(({id:H})=>H!==k.id)})},[]);return je.useEffect(()=>$r.subscribe(k=>{if(k.dismiss){S(O=>O.map(V=>V.id===k.id?{...V,delete:!0}:V));return}setTimeout(()=>{_M.flushSync(()=>{S(O=>{let V=O.findIndex(H=>H.id===k.id);return V!==-1?[...O.slice(0,V),{...O[V],...k},...O.slice(V+1)]:[k,...O]})})})}),[]),je.useEffect(()=>{if(u!=="system"){F(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?F("dark"):F("light")),typeof window>"u")return;let k=window.matchMedia("(prefers-color-scheme: dark)");try{k.addEventListener("change",({matches:O})=>{F(O?"dark":"light")})}catch{k.addListener(({matches:V})=>{try{F(V?"dark":"light")}catch(H){console.error(H)}})}},[u]),je.useEffect(()=>{w.length<=1&&T(!1)},[w]),je.useEffect(()=>{let k=O=>{var V,H;r.every(z=>O[z]||O.code===z)&&(T(!0),(V=L.current)==null||V.focus()),O.code==="Escape"&&(document.activeElement===L.current||(H=L.current)!=null&&H.contains(document.activeElement))&&T(!1)};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[r]),je.useEffect(()=>{if(L.current)return()=>{$.current&&($.current.focus({preventScroll:!0}),$.current=null,B.current=!1)}},[L.current]),je.createElement("section",{ref:e,"aria-label":`${y} ${M}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},_.map((k,O)=>{var V;let[H,z]=k.split("-");return w.length?je.createElement("ol",{key:k,dir:g==="auto"?i3():g,tabIndex:-1,ref:L,className:a,"data-sonner-toaster":!0,"data-theme":E,"data-y-position":H,"data-lifted":D&&w.length>1&&!s,"data-x-position":z,style:{"--front-toast-height":`${((V=I[0])==null?void 0:V.height)||0}px`,"--width":`${WM}px`,"--gap":`${b}px`,...m,...qM(l,c)},onBlur:W=>{B.current&&!W.currentTarget.contains(W.relatedTarget)&&(B.current=!1,$.current&&($.current.focus({preventScroll:!0}),$.current=null))},onFocus:W=>{W.target instanceof HTMLElement&&W.target.dataset.dismissible==="false"||B.current||(B.current=!0,$.current=W.relatedTarget)},onMouseEnter:()=>T(!0),onMouseMove:()=>T(!0),onMouseLeave:()=>{R||T(!1)},onDragEnd:()=>T(!1),onPointerDown:W=>{W.target instanceof HTMLElement&&W.target.dataset.dismissible==="false"||P(!0)},onPointerUp:()=>P(!1)},w.filter(W=>!W.position&&O===0||W.position===k).map((W,U)=>{var X,Q;return je.createElement(JM,{key:W.id,icons:C,index:U,toast:W,defaultRichColors:d,duration:(X=h?.duration)!=null?X:f,className:h?.className,descriptionClassName:h?.descriptionClassName,invert:o,visibleToasts:p,closeButton:(Q=h?.closeButton)!=null?Q:i,interacting:R,position:k,style:h?.style,unstyled:h?.unstyled,classNames:h?.classNames,cancelButtonStyle:h?.cancelButtonStyle,actionButtonStyle:h?.actionButtonStyle,removeToast:j,toasts:w.filter(J=>J.position==W.position),heights:I.filter(J=>J.position==W.position),setHeights:A,expandByDefault:s,gap:b,loadingIcon:v,expanded:D,pauseWhenPageIsHidden:x,swipeDirections:t.swipeDirections})})):null}))});import{jsx as Bh,jsxs as iB}from"react/jsx-runtime";import d3 from"react";import{jsx as l3}from"react/jsx-runtime";import"react";var QM={24:"M12 5C15.866 5 19 8.13401 19 12C19 15.866 15.866 19 12 19C8.13401 19 5 15.866 5 12C5 8.13401 8.13401 5 12 5ZM12 6C8.68629 6 6 8.68629 6 12C6 15.3137 8.68629 18 12 18C15.3137 18 18 15.3137 18 12C18 8.68629 15.3137 6 12 6ZM12 11C12.2761 11 12.5 11.2239 12.5 11.5V15C12.5 15.2761 12.2761 15.5 12 15.5C11.7239 15.5 11.5 15.2761 11.5 15V11.5C11.5 11.2239 11.7239 11 12 11ZM12 8.5C12.4142 8.5 12.75 8.83579 12.75 9.25C12.75 9.66421 12.4142 10 12 10C11.5858 10 11.25 9.66421 11.25 9.25C11.25 8.83579 11.5858 8.5 12 8.5Z"},Kd=({className:t,size:e=24})=>l3("svg",{className:["icon","icon--info",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:l3("path",{d:QM[e],fill:"currentColor"})});import{jsx as nB}from"react/jsx-runtime";import"react";import{c as KM}from"react/compiler-runtime";import{jsx as eB}from"react/jsx-runtime";import by,{startTransition as tB,useEffect as oB,useOptimistic as rB,useRef as c3}from"react";var vy=t=>{let e=KM(11),{children:o}=t,[n,r]=rB(!1),[s,i]=by.useState(0),a=c3(s),l=c3(null),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{l.current=setInterval(()=>{let g=a.current+(.93-a.current)*Math.random()*.2*Math.pow(Math.log(1+(1-a.current)*.75),.75);i(g),a.current=g},250)},e[0]=c):c=e[0];let u=c,d,f;e[1]!==n?(d=()=>{i(0),a.current=0,n?u():l.current&&clearInterval(l.current)},f=[n,u],e[1]=n,e[2]=d,e[3]=f):(d=e[2],f=e[3]),oB(d,f);let m;e[4]!==r?(m=g=>{tB(()=>{r(!0),typeof g=="function"&&g()})},e[4]=r,e[5]=m):m=e[5];let p=m,h;return e[6]!==o||e[7]!==n||e[8]!==p||e[9]!==s?(h=eB(u3,{value:{isTransitioning:n,startRouteTransition:p,transitionProgress:s},children:o}),e[6]=o,e[7]=n,e[8]=p,e[9]=s,e[10]=h):h=e[10],h},u3=by.createContext({isTransitioning:!1,startRouteTransition:t=>{typeof t=="function"&&t()},transitionProgress:0}),Ue=()=>by.use(u3);function sB(t){let o=t.currentTarget.getAttribute("target");return o&&o!=="_self"||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&t.nativeEvent.which===2}var jt=({children:t,forceReload:e=!1,href:o,onClick:n,preventDefault:r=!0,ref:s,replace:i,scroll:a,...l})=>{let c=Re(),{startRouteTransition:u}=Ue();return nB(Wv,{href:o,onClick:d=>{if(sB(d))return;n&&n(d),r&&d.preventDefault();let f=o;if(e){window.location.href=f;return}u(()=>{i?c.replace(f,{scroll:a}):c.push(f,{scroll:a})})},ref:s,...l,children:t})};var rl="banner",Xr=({type:t="default",alignIcon:e="left",children:o,className:n,icon:r,onClick:s,to:i})=>{let a=r===void 0?Bh(Kd,{}):r,l=[rl,`${rl}--type-${t}`,n&&n,i&&`${rl}--has-link`,(i||s)&&`${rl}--has-action`,a&&`${rl}--has-icon`,a&&`${rl}--align-icon-${e}`].filter(Boolean).join(" "),c="div";return s&&!i&&(c="button"),i&&(c=jt),iB(c,{className:l,href:i||null,onClick:s,children:[a&&e==="left"&&Bh(d3.Fragment,{children:a}),Bh("span",{className:`${rl}__content`,children:o}),a&&e==="right"&&Bh(d3.Fragment,{children:a})]})};import{jsx as pr,jsxs as Uh}from"react/jsx-runtime";import BB,{Fragment as OB}from"react";import{jsx as m3}from"react/jsx-runtime";import"react";var aB={16:"M9.86914 2.72438C10.2619 2.40402 10.8409 2.42662 11.207 2.79273L13.207 4.79273C13.5974 5.18327 13.5975 5.81631 13.207 6.2068L6.70703 12.7068C6.51951 12.8943 6.26516 12.9998 6 12.9998H4C3.44779 12.9998 3.00013 12.5519 3 11.9998V9.99977C3 9.7346 3.10551 9.48026 3.29297 9.29273L9.79297 2.79273L9.86914 2.72438ZM4 9.99977V11.9998H6L10.6465 7.35328L8.64648 5.35328L4 9.99977ZM9.35352 4.64625L11.3535 6.64625L12.5 5.49977L10.5 3.49977L9.35352 4.64625Z",24:"M5.514 6.664a1 1 0 0 1 1.15-1.15l2.684.447a2 2 0 0 1 1.086.559l7.42 7.42a1.5 1.5 0 0 1 0 2.12l-1.793 1.794a1.5 1.5 0 0 1-2.122 0l-7.42-7.42a2 2 0 0 1-.558-1.086zm9.883 6.233-5.67-5.67a1 1 0 0 0-.543-.28l-1.641-.273L6.5 6.5l.174 1.043.273 1.64a1 1 0 0 0 .28.544l5.67 5.67zm.707.707-2.5 2.5 1.043 1.043a.5.5 0 0 0 .707 0l1.793-1.793a.5.5 0 0 0 0-.707z"},fr=({className:t,size:e=16})=>m3("svg",{className:["icon","icon--edit",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:m3("path",{clipRule:"evenodd",d:aB[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as f3}from"react/jsx-runtime";import"react";var lB={16:"M8.38 6.381a.29.29 0 0 1 .347-.056q.293.161.541.408a2.5 2.5 0 0 1 0 3.535l-2 2a2.5 2.5 0 0 1-3.535-3.535l.571-.573c.25-.249.692-.107.81.224a.46.46 0 0 1-.098.478l-.576.578a1.5 1.5 0 1 0 2.121 2.12l2-2a1.5 1.5 0 0 0 0-2.12c-.23-.23-.493-.509-.358-.805a.9.9 0 0 1 .178-.254m.352-2.648a2.5 2.5 0 1 1 3.535 3.535l-.471.47c-.253.254-.717.082-.819-.261a.44.44 0 0 1 .102-.435l.481-.481A1.5 1.5 0 0 0 9.44 4.44l-2 2a1.5 1.5 0 0 0 0 2.12c.136.138.168.365.031.502l-.182.181c-.154.154-.403.179-.557.025a2.5 2.5 0 0 1 0-3.535z",24:"M12.4441 10.3708C12.6866 10.5041 12.9153 10.6721 13.1208 10.8776C14.2924 12.0492 14.2923 13.9482 13.1208 15.1198L11.1208 17.1198C9.94928 18.2914 8.05023 18.2914 6.87866 17.1198C5.70712 15.9482 5.7071 14.0492 6.87866 12.8776L8.14819 11.6071C8.41029 11.345 8.89378 11.5392 8.97436 11.9011C9.00665 12.0462 8.9691 12.2012 8.86401 12.3063L7.58569 13.5847C6.80466 14.3657 6.80468 15.6317 7.58569 16.4128C8.36674 17.1938 9.63277 17.1938 10.4138 16.4128L12.4138 14.4128C13.1947 13.6317 13.1948 12.3657 12.4138 11.5847C12.4047 11.5755 12.3958 11.5662 12.3865 11.5573C12.293 11.468 12.1989 11.3736 12.1619 11.2497C12.0729 10.9515 12.1453 10.6149 12.3806 10.3796C12.3974 10.3628 12.4233 10.3594 12.4441 10.3708ZM12.8787 6.87764C14.0502 5.70615 15.9493 5.70616 17.1208 6.87764C18.2924 8.04919 18.2924 9.94825 17.1208 11.1198L15.8513 12.3903C15.5892 12.6522 15.1058 12.4581 15.0251 12.0964C14.9928 11.9512 15.0313 11.7963 15.1365 11.6911L16.4138 10.4128C17.1948 9.63175 17.1948 8.3657 16.4138 7.58467C15.6328 6.80371 14.3667 6.8037 13.5857 7.58467L11.5857 9.58467C10.805 10.3657 10.8048 11.6319 11.5857 12.4128C11.5948 12.4219 11.6047 12.4303 11.614 12.4392C11.7069 12.5278 11.8004 12.622 11.8376 12.7448C11.9281 13.044 11.855 13.3827 11.6189 13.6188C11.6028 13.6347 11.5783 13.6383 11.5583 13.6276C11.3151 13.4942 11.0848 13.3259 10.8787 13.1198C9.70729 11.9484 9.70748 10.0492 10.8787 8.87764L12.8787 6.87764Z"},em=({className:t,size:e=24})=>f3("svg",{"aria-hidden":"true",className:["icon","icon--link",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:f3("path",{d:lB[e],fill:"currentColor"})});import{jsx as p3}from"react/jsx-runtime";import"react";var cB={16:"M8.5 3.5a.5.5 0 0 0-1 0v4h-4a.5.5 0 0 0 0 1h4v4a.5.5 0 0 0 1 0v-4h4a.5.5 0 0 0 0-1h-4z",24:"M12 6a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 12 6"},Po=({className:t,size:e=24})=>p3("svg",{className:["icon","icon--plus",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:p3("path",{clipRule:"evenodd",d:cB[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as h3}from"react/jsx-runtime";import"react";var uB={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",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",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"},dB={lg:24,md:24,sm:16},Oh=({className:t,size:e="sm"})=>{let o=dB[e];return h3("svg",{className:["icon icon--spinner",t].filter(Boolean).join(" "),fill:"none",height:o,viewBox:`0 0 ${o} ${o}`,width:o,xmlns:"http://www.w3.org/2000/svg",children:h3("path",{clipRule:"evenodd",d:uB[e],fill:"currentColor",fillRule:"evenodd"})})};import{jsx as g3}from"react/jsx-runtime";import"react";var yy=({className:t})=>g3("svg",{className:["icon","icon--swap",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:g3("path",{clipRule:"evenodd",d:"M8.354 6.354a.5.5 0 1 0-.708-.708l-2.5 2.5a.5.5 0 0 0 0 .708l2.5 2.5a.5.5 0 0 0 .708-.708L6.707 9H18.5a.5.5 0 0 0 0-1H6.707zm7.292 7a.5.5 0 0 1 .708-.708l2.5 2.5a.5.5 0 0 1 0 .708l-2.5 2.5a.5.5 0 0 1-.708-.708L17.293 16H5.5a.5.5 0 0 1 0-1h11.793z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as b3}from"react/jsx-runtime";import"react";var mB="M9.28 13.017c-.394 1.016.61 2.015 1.625 1.615l1.688-.666a1.5 1.5 0 0 0 .51-.335l3.743-3.742.707-.707a1.5 1.5 0 0 0 0-2.121l-.707-.708a1.5 1.5 0 0 0-2.122 0l-.707.708-3.74 3.74a1.5 1.5 0 0 0-.338.518zm1.258.684a.25.25 0 0 1-.325-.323l.659-1.698a.5.5 0 0 1 .112-.172l3.387-3.387 1.414 1.414-3.389 3.389a.5.5 0 0 1-.17.112zm5.954-4.873-1.414-1.414.354-.353a.5.5 0 0 1 .707 0l.707.707a.5.5 0 0 1 0 .707zM11.5 6a.5.5 0 0 1 0 1h-4a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h9a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 1 1 0v4a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 6 16.5v-9A1.5 1.5 0 0 1 7.5 6z",nl=({className:t,size:e=24})=>b3("svg",{className:["icon","icon--write",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:b3("path",{clipRule:"evenodd",d:mB,fill:"currentColor",fillRule:"evenodd"})});import{jsx as v3}from"react/jsx-runtime";import"react";var fB={16:"M11.146 4.146a.5.5 0 0 1 .707.707L8.708 8l3.146 3.146a.5.5 0 0 1-.707.707L8 8.708l-3.147 3.146a.5.5 0 0 1-.707-.707L7.293 8 4.146 4.853a.5.5 0 1 1 .707-.707L8 7.293z",24:"M16.854 7.146a.5.5 0 0 1 0 .707L12.707 12l4.147 4.146a.5.5 0 0 1-.708.707L12 12.708l-4.146 4.147a.5.5 0 1 1-.708-.708L11.293 12 7.146 7.854a.5.5 0 0 1 .708-.708L12 11.293l4.146-4.147a.5.5 0 0 1 .708 0"},xt=({className:t,size:e=24})=>v3("svg",{className:[t,"icon icon--x"].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:v3("path",{clipRule:"evenodd",d:fB[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as Mc,jsxs as Vh,Fragment as RB}from"react/jsx-runtime";var ue={};x4(ue,{Button:()=>Fn,ButtonGroup:()=>Ys,Divider:()=>C3,GroupLabel:()=>x3,MenuItem:()=>yB,RadioGroup:()=>CB,RadioGroupItem:()=>xB});import{jsx as Zs,jsxs as Cy}from"react/jsx-runtime";import"react";import{jsx as y3}from"react/jsx-runtime";import"react";var pB={16:"M12.277 3.584a.5.5 0 0 1 .139.693l-5 7.5a.5.5 0 0 1-.77.077l-3-3a.5.5 0 0 1 .708-.708l2.568 2.57 4.662-6.993a.5.5 0 0 1 .693-.139",24:"M17.91 7.285a.5.5 0 0 0-.82-.57l-5.916 8.518-3.328-3.194a.5.5 0 1 0-.692.722l3.75 3.6a.5.5 0 0 0 .757-.076z"},Vo=({className:t,size:e=16})=>y3("svg",{className:["icon","icon--check",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:y3("path",{clipRule:"evenodd",d:pB[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as hB}from"react/jsx-runtime";import"react";var gB="popup-divider",C3=()=>hB("hr",{className:gB});import{jsx as bB}from"react/jsx-runtime";import"react";var vB="popup-list-group-label",x3=({label:t})=>bB("p",{className:vB,children:t});var Ko="popup-button-list",Ys=({buttonSize:t="default",children:e,className:o,textAlign:n="left"})=>{let r=[Ko,o,`${Ko}__text-align--${n}`,`${Ko}__button-size--${t}`].filter(Boolean).join(" ");return Zs("div",{className:r,children:e})},yB=({children:t,className:e,size:o="large"})=>{let n=[Ko,e,`${Ko}--with-actions`,o==="large"&&`${Ko}--large`].filter(Boolean).join(" ");return Zs("div",{className:n,children:t})},CB=({children:t,className:e})=>{let o=[Ko,e,`${Ko}--with-icons`].filter(Boolean).join(" ");return Zs("div",{className:o,children:t})},Fn=({id:t,active:e,children:o,className:n,disabled:r,href:s,icon:i,onClick:a})=>{let l=[`${Ko}__button`,r&&`${Ko}__disabled`,e&&`${Ko}__button--selected`,n].filter(Boolean).join(" "),c=Zs("span",{className:`${Ko}__icon`,children:i});if(!r){if(s)return Cy(jt,{className:l,href:s,id:t,onClick:u=>{a&&a(u)},prefetch:!1,children:[c,Zs("span",{className:`${Ko}__label`,children:o})]});if(a)return Cy("button",{className:l,id:t,onClick:u=>{a&&a(u)},type:"button",children:[c,Zs("span",{className:`${Ko}__label`,children:o})]})}return Cy("div",{className:l,id:t,children:[c,Zs("span",{className:`${Ko}__label`,children:o})]})},xB=t=>Zs(Fn,{...t,className:[`${Ko}__button--radio-group-item`,t.className].filter(Boolean).join(" "),icon:t.active?Zs(Vo,{size:16}):void 0});import{createContext as TB,use as DB,useCallback as AB,useEffect as Sy,useRef as Hh,useState as _y}from"react";import{createPortal as PB}from"react-dom";import xy,{useCallback as wB,useInsertionEffect as SB,useRef as _B}from"react";var et="useEffectEvent"in xy&&typeof xy.useEffectEvent=="function"?xy.useEffectEvent:t=>{let e=_B(t);return SB(()=>{e.current=t},[t]),wB((...o)=>{let n=e.current;return n(...o)},[])};import{jsx as wy,Fragment as IB}from"react/jsx-runtime";import"react";var kc="popup-button",w3=t=>{let{active:e,button:o,buttonType:n,className:r,disabled:s,noBackground:i,renderButton:a,setActive:l,size:c}=t,u=[kc,r,`${kc}--${n}`,!i&&`${kc}--background`,c&&`${kc}--size-${c}`,s&&`${kc}--disabled`,e&&`${kc}--active`].filter(Boolean).join(" "),d=()=>{l(!e,!1)},f=m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),l(!e,!0))};return a?wy(IB,{children:a({active:e,"aria-expanded":e,"aria-haspopup":!0,onClick:d,onKeyDown:f})}):n==="custom"?wy("div",{className:u,onClick:d,onKeyDown:f,role:"button",tabIndex:0,children:o}):wy("button",{className:u,disabled:s,onClick:d,onKeyDown:f,tabIndex:0,type:"button",children:o})};var Zr="popup",S3=TB(null),_3=["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(t=>`${t}:not([tabindex="-1"])`).join(", "),FB=t=>{let e=t?.parentElement;for(;e&&e!==document.body;){if(window.getComputedStyle(e).position==="fixed")return!0;e=e.parentElement}return!1},Ve=t=>{let{id:e,button:o,buttonClassName:n,buttonSize:r,buttonType:s="default",caret:i=!0,children:a,className:l,disabled:c,forceOpen:u,horizontalAlign:d="left",initActive:f=!1,noBackground:m,onToggleClose:p,onToggleOpen:h,portalClassName:g,render:b,renderButton:v,showOnHover:C=!1,showScrollbar:y=!1,side:x,size:w="medium",theme:S="dark",verticalAlign:_="bottom"}=t,I=Hh(null),A=Hh(null),D=Hh(!1),T=Hh(!1),R=DB(S3),[P,E]=_y(!1),[F,L]=_y(f),[M,$]=_y(_==="top");Sy(()=>{E(!0)},[]);let B=AB((z,W=!1)=>{z?(T.current=W,h?.(!0)):p?.(),L(z)},[p,h]),j=et(()=>{let z=A.current,W=I.current;if(!z||!W)return;let U=z.getBoundingClientRect(),X=W.getBoundingClientRect(),Q=D.current,J=Q?0:window.scrollY,oe=Q?0:window.scrollX,Y=10,K=4,ee,te,re;if(x){ee=U.top+J;let xe=J+window.innerHeight-X.height-Y;ee=Math.max(J+Y,Math.min(ee,xe));let $e=R?.popupRef.current?R.popupRef.current.getBoundingClientRect():U;x==="left"?(te=$e.left-X.width-K,te<Y&&(te=$e.right+K)):(te=$e.right+K,te+X.width+Y>window.innerWidth&&(te=$e.left-X.width-K)),te=te+oe,re=X.width/2,$(!1)}else{let xe=_==="top";if(_==="bottom"){if(ee=U.bottom+J+Y,U.bottom+X.height+Y>window.innerHeight){let Le=U.top+J-X.height-Y;Le>=J&&(ee=Le,xe=!0)}}else ee=U.top+J-X.height-Y,U.top-X.height-Y<0&&(ee=U.bottom+J+Y,xe=!1);$(xe),te=d==="right"?U.right-X.width:d==="center"?U.left+U.width/2-X.width/2:U.left,te=Math.max(Y,Math.min(te,window.innerWidth-X.width-Y));let $e=U.left+U.width/2;re=Math.max(12,Math.min($e-te,X.width-12))}let me=`${Math.round(ee)}px`,we=`${Math.round(te+oe)}px`,Ae=`${Math.round(re)}px`,de=Q?"fixed":"";W.style.position!==de&&(W.style.position=de),W.style.top!==me&&(W.style.top=me),W.style.left!==we&&(W.style.left=we),W.style.getPropertyValue("--caret-left")!==Ae&&W.style.setProperty("--caret-left",Ae)}),k=et(z=>{let W=z.target,U=!I.current?.contains(W),X=!A.current?.contains(W),Q=W.closest?.(".popup__content"),J=Q&&!Q.contains(A.current);U&&X&&!J&&B(!1)}),O=et(z=>{let W=I.current;if(!(!W||!F)){if(z.key==="Escape"){z.preventDefault(),B(!1),A.current?.querySelector('button, [tabindex="0"]')?.focus();return}if(z.key==="Tab"||z.key==="ArrowDown"||z.key==="ArrowUp"){let U=Array.from(W.querySelectorAll(_3));if(U.length===0)return;z.preventDefault();let X=U.findIndex(oe=>oe===document.activeElement),Q=z.key==="ArrowUp"||z.key==="Tab"&&z.shiftKey,J;X===-1?J=Q?U.length-1:0:Q?J=X===0?U.length-1:X-1:J=X===U.length-1?0:X+1,U[J].focus()}}}),V=et(z=>{let W=z.target;if(W.closest("[data-popup-prevent-close]"))return;let U=W.closest('button, a[href], [role="button"], [role="menuitem"]');if(U&&I.current?.contains(U)){if(U.closest(`.${Zr}__trigger-wrap`))return;B(!1)}});Sy(()=>{if(!F){let U=I.current;U&&(U.style.position="",U.style.top="",U.style.left="");return}let z=I.current;if(!z)return;D.current=FB(A.current),j();let W=requestAnimationFrame(()=>{j()});return T.current&&requestAnimationFrame(()=>{z.querySelector(_3)?.focus()}),window.addEventListener("resize",j),window.addEventListener("scroll",j,{capture:!0,passive:!0}),document.addEventListener("mousedown",k),document.addEventListener("keydown",O),z.addEventListener("click",V),()=>{cancelAnimationFrame(W),window.removeEventListener("resize",j),window.removeEventListener("scroll",j,{capture:!0}),document.removeEventListener("mousedown",k),document.removeEventListener("keydown",O),z.removeEventListener("click",V)}},[F]),Sy(()=>{u!==void 0&&B(u)},[u,B]);let H=Mc(w3,{active:F,button:o,buttonType:s,className:n,disabled:c,noBackground:m,renderButton:v,setActive:B,size:r});return Vh("div",{className:[Zr,l].filter(Boolean).join(" "),id:e,children:[Mc("div",{className:`${Zr}__trigger-wrap`,ref:A,children:C?Mc("div",{className:`${Zr}__on-hover-watch`,onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),role:"button",tabIndex:0,children:H}):H}),P?PB(Mc(S3,{value:{popupRef:I},children:Vh("div",{className:F?[`${Zr}__content`,`${Zr}--size-${w}`,x?`${Zr}--side-${x}`:M?`${Zr}--v-top`:`${Zr}--v-bottom`,g].filter(Boolean).join(" "):`${Zr}__hidden-content`,"data-popup-id":e||void 0,"data-theme":S==="auto"?void 0:S,ref:I,children:[Mc("div",{className:`${Zr}__scroll-container${y?` ${Zr}__scroll-container--show-scrollbar`:""}`,children:S==="auto"?Vh(RB,{children:[b?.({close:()=>B(!1)}),a]}):Vh(Wd,{theme:S,children:[b?.({close:()=>B(!1)}),a]})}),i&&!x&&Mc("div",{className:`${Zr}__caret`})]})}),document.body):null]})};import{c as $B}from"react/compiler-runtime";import{jsx as oa,jsxs as zh}from"react/jsx-runtime";import Gh,{useCallback as jB,useEffect as R3,useLayoutEffect as kB,useState as T3}from"react";import{c as NB}from"react/compiler-runtime";import{useEffect as EB,useRef as LB,useState as I3}from"react";var Js=(t,e)=>{let o=NB(8),{root:n,rootMargin:r,threshold:s}=t===void 0?{}:t,i=n===void 0?null:n,a=r===void 0?"0px":r,l=s===void 0?0:s,[c,u]=I3(),[d,f]=I3(null),m=LB(typeof window<"u"&&"IntersectionObserver"in window&&!e?new window.IntersectionObserver(b=>{let[v]=b;return u(v)},{root:i,rootMargin:a,threshold:l}):null),p,h;o[0]!==e||o[1]!==d?(p=()=>{if(e)return;let{current:b}=m;return b.disconnect(),d&&b.observe(d),()=>b.disconnect()},h=[d,e],o[0]=e,o[1]=d,o[2]=p,o[3]=h):(p=o[2],h=o[3]),EB(p,h);let g;return o[4]!==c||o[5]!==d||o[6]!==f?(g=[f,c,d],o[4]=c,o[5]=d,o[6]=f,o[7]=g):g=o[7],g};var D3=4,MB=t=>{let e=t?.parentElement||null;for(;e;){let{overflowX:o}=window.getComputedStyle(e);if(o==="auto"||o==="clip"||o==="hidden"||o==="scroll")return e.getBoundingClientRect();e=e.parentElement}return null},A3=()=>{let t=$B(2),e=Gh.useId(),o;return t[0]!==e?(o=zh("svg",{"aria-hidden":"true",className:"tooltip__caret",height:"14",viewBox:"0 0 14 14",width:"15",children:[oa("clipPath",{id:e,children:oa("rect",{height:"14",width:"15",x:"-0.5",y:"0.5"})}),oa("path",{className:"tooltip__caret-stroke",clipPath:`url(#${e})`,d:"M0,0 H14 L7.875,6.125 Q7,7 6.125,6.125 Z"}),oa("path",{className:"tooltip__caret-fill",d:"M0,0 H14 L7.875,6.125 Q7,7 6.125,6.125 Z"})]}),t[0]=e,t[1]=o):o=t[1],o},io=t=>{let{alignCaret:e="center",boundingRef:o,children:n,className:r,delay:s=500,position:i,show:a=!0,staticPositioning:l=!1}=t,[c,u]=Gh.useState(a),[d,f]=Gh.useState("top"),[m,p]=T3(0),[h,g]=T3(null),[b,v,C]=Js({root:o?.current||null,rootMargin:"-145px 0px 0px 100px",threshold:0},l);R3(()=>{let x;return s&&a?x=setTimeout(()=>{u(a)},s):u(a),()=>{x&&clearTimeout(x)}},[a,s]),R3(()=>{l||f(v?.isIntersecting?"top":"bottom")},[v,l]);let y=jB(()=>{if(l||!C||!((i||d)==="top"||(i||d)==="bottom")){p(0),g(null);return}let w=C.getBoundingClientRect(),S=o?.current?.getBoundingClientRect()??MB(C)??void 0,_=(S?.left??0)+D3,I=(S?.right??window.innerWidth)-D3,A=I-_,D=w.width>A?A:null;g(D);let T=w.left+w.width/2,R=D??w.width,P=T-R/2,E=T+R/2,F=0;E>I&&(F=I-E),P+F<_&&(F=_-P),p(F)},[o,C,d,i,l]);return kB(()=>{if(c)return y(),window.addEventListener("resize",y),()=>{window.removeEventListener("resize",y)}},[c,y]),zh(Gh.Fragment,{children:[!l&&zh("aside",{"aria-hidden":"true",className:["tooltip",r,`tooltip--caret-${e}`,"tooltip--position-top"].filter(Boolean).join(" "),ref:b,style:{opacity:"0"},children:[oa(A3,{}),oa("div",{className:"tooltip-content",children:n})]}),zh("aside",{className:["tooltip",r,c&&"tooltip--show",h&&"tooltip--wrap",`tooltip--caret-${e}`,`tooltip--position-${i||d}`].filter(Boolean).join(" "),style:{...h?{"--tooltip-max-width":`${h}px`}:{},...m?{"--tooltip-caret-x":`${-m}px`,"--tooltip-x":`calc(-50% + ${m}px)`}:{}},children:[oa(A3,{}),oa("div",{className:"tooltip-content",children:n})]})]})};var VB={chevron:ve,edit:fr,link:em,plus:Po,swap:yy,write:nl,x:xt},eo="btn",Wh=({children:t,icon:e,loading:o,showTooltip:n,tooltip:r})=>{let s=typeof e=="string"?VB[e]:void 0,i=e&&typeof e!="string";return Uh(OB,{children:[r&&pr(io,{className:`${eo}__tooltip`,show:n,children:r}),o&&pr("span",{className:`${eo}__loading`,children:pr(Oh,{})}),Uh("span",{className:`${eo}__content`,children:[t&&pr("span",{className:`${eo}__label`,children:t}),e&&Uh("span",{className:`${eo}__icon`,children:[i&&e,s&&pr(s,{size:24})]})]})]})},Z=t=>{let{id:e,type:o="button","aria-label":n,buttonStyle:r="primary",children:s,className:i,disabled:a,el:l="button",enableSubMenu:c,extraButtonProps:u={},icon:d,iconPosition:f="right",loading:m,margin:p=!0,newTab:h,onClick:g,onMouseDown:b,popupIconSize:v,ref:C,round:y,selected:x,size:w="medium",SubMenuPopupContent:S,to:_,tooltip:I,url:A}=t,[D,T]=BB.useState(!1),R=a===!0||m===!0,P=[eo,i&&i,d&&`${eo}--icon`,d&&!s&&`${eo}--icon-only`,w&&`${eo}--size-${w}`,d&&f&&`${eo}--icon-position-${f}`,I&&`${eo}--has-tooltip`,!S&&`${eo}--withoutPopup`,!p&&`${eo}--no-margin`,m&&`${eo}--loading`,d&&!s&&`${eo}--icon-only`].filter(Boolean).join(" ");function E($){T(!1),o!=="submit"&&g&&$.preventDefault(),g&&g($)}let F=[r&&`${eo}--style-${r}`,R&&`${eo}--disabled`,y&&`${eo}--round`,x&&`${eo}--selected`,S?`${eo}--withPopup`:`${eo}--withoutPopup`].filter(Boolean).join(" "),L={id:e,type:o,"aria-disabled":R,"aria-label":n,className:S?P:[P,F].join(" "),disabled:R,onClick:R?void 0:E,onMouseDown:R?void 0:b,onPointerEnter:I?()=>T(!0):void 0,onPointerLeave:I?()=>T(!1):void 0,rel:h?"noopener noreferrer":void 0,target:h?"_blank":void 0,title:I?void 0:n,...u},M;switch(l){case"anchor":M=pr("a",{...L,href:R?void 0:A,ref:C,children:pr(Wh,{icon:d,loading:m,showTooltip:D,tooltip:I,children:s})});break;case"link":R&&(M=pr("div",{...L,children:pr(Wh,{icon:d,loading:m,showTooltip:D,tooltip:I,children:s})})),M=pr(jt,{...L,href:_||A,prefetch:!1,children:pr(Wh,{icon:d,loading:m,showTooltip:D,tooltip:I,children:s})});break;default:M=pr(l,{ref:C,...L,children:pr(Wh,{icon:d,loading:m,showTooltip:D,tooltip:I,children:s})});break}return S?Uh("div",{className:F,children:[M,pr(Ve,{button:pr(ve,{size:v}),buttonSize:w,className:a&&!c?`${eo}--popup-disabled`:"",disabled:a&&!c,horizontalAlign:"right",id:`${e}-popup`,noBackground:!0,render:({close:$})=>S({close:()=>$()}),size:"small",verticalAlign:"bottom"})]}):M};import{fieldAffectsData as P3,fieldHasSubFields as F3}from"payload/shared";function N3({data:t,path:e,...o}){return typeof t>"u"||!e||!o.type?!1:o.type==="blocks"?HB({blocksFromClipboard:o.blocks,blocksFromConfig:o.schemaBlocks}):Iy({fieldsFromClipboard:o.fields,fieldsFromConfig:o.schemaFields})}function Iy({fieldsFromClipboard:t,fieldsFromConfig:e}){return!e||t.length!==e?.length?!1:t.every((o,n)=>{let r=e[n];if(o.type!==r.type||P3(o)&&P3(r)&&o.name!==r.name)return!1;let i=F3(r),a=F3(o);return a!==i?!1:a&&i?Iy({fieldsFromClipboard:o.fields,fieldsFromConfig:r.fields}):!0})}function HB({blocksFromClipboard:t,blocksFromConfig:e}){let o=new Map(e?.map(r=>[r.slug,r]));if(!o.size)return!1;let n=new Set;for(let r of t){let s=r.slug;if(!n.has(s)){let i=o.get(s);if(!i||!Iy({fieldsFromClipboard:r.fields,fieldsFromConfig:i.fields}))return!1;n.add(s)}}return!0}var E3="_payloadClipboard";function Bc(t){let{getDataToCopy:e,t:o,...n}=t,r={data:e(),...n};try{return localStorage.setItem(E3,JSON.stringify(r)),!0}catch{return o("error:unableToCopy")}}function Oc({onPaste:t,path:e,t:o,...n}){let r;try{let i=localStorage.getItem(E3);if(!i)return o("error:invalidClipboardData");r=JSON.parse(i)}catch{return o("error:invalidClipboardData")}let s={...r,...n,fieldPath:e};return N3(s)?(t(r),!0):o("error:invalidClipboardData")}import{jsx as Vc,jsxs as UB}from"react/jsx-runtime";import{useCallback as k3}from"react";import{jsx as L3}from"react/jsx-runtime";import"react";var zB="M10 6h4v1h-4zM9 6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1 2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2m0 1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1 1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1m1 3.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5m.5 2.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z",tm=({className:t,size:e=24})=>L3("svg",{className:["icon","icon--clipboard",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:"0 0 24 24",width:e,xmlns:"http://www.w3.org/2000/svg",children:L3("path",{clipRule:"evenodd",d:zB,fill:"currentColor",fillRule:"evenodd"})});import{jsx as $3}from"react/jsx-runtime";import"react";var GB={16:"M3.5 2A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5v1.5A1.5 1.5 0 0 0 6.5 14h6a1.5 1.5 0 0 0 1.5-1.5v-6A1.5 1.5 0 0 0 12.5 5H11V3.5A1.5 1.5 0 0 0 9.5 2zM11 6v3.5A1.5 1.5 0 0 1 9.5 11H6v1.5a.5.5 0 0 0 .5.5h6a.5.5 0 0 0 .5-.5v-6a.5.5 0 0 0-.5-.5zM3 3.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5h-6a.5.5 0 0 1-.5-.5z",24:"M7.5 6A1.5 1.5 0 0 0 6 7.5v6A1.5 1.5 0 0 0 7.5 15h6a1.5 1.5 0 0 0 1.5-1.5v-6A1.5 1.5 0 0 0 13.5 6zM7 7.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5h-6a.5.5 0 0 1-.5-.5zm2 9a.5.5 0 0 1 1 0 .5.5 0 0 0 .5.5h6a.5.5 0 0 0 .5-.5v-6a.5.5 0 0 0-.5-.5.5.5 0 0 1 0-1 1.5 1.5 0 0 1 1.5 1.5v6a1.5 1.5 0 0 1-1.5 1.5h-6A1.5 1.5 0 0 1 9 16.5"},sl=({className:t,size:e=24})=>$3("svg",{className:["icon","icon--copy",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:$3("path",{clipRule:"evenodd",d:GB[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as j3}from"react/jsx-runtime";import"react";var WB={16:"M5 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M7.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m6 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m4.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},il=({className:t,size:e=24})=>j3("svg",{className:["icon","icon--more",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:j3("path",{clipRule:"evenodd",d:WB[e],fill:"currentColor",fillRule:"evenodd"})});var M3="clipboard-action",Xh=({allowCopy:t,allowPaste:e,className:o,copyClassName:n,disabled:r,isRow:s,onPaste:i,pasteClassName:a,path:l,...c})=>{let{t:u}=N(),d=[`${M3}__popup`,o].filter(Boolean).join(" "),f=k3(()=>{let p=Bc({path:l,t:u,...c});typeof p=="string"?se.error(p):se.success(u("general:copied"))},[u,c,l]),m=k3(()=>{let p=Oc(c.type==="array"?{onPaste:i,path:l,schemaFields:c.fields,t:u}:{onPaste:i,path:l,schemaBlocks:c.blocks,t:u});typeof p=="string"&&se.error(p)},[i,c,l,u]);return!e&&!t?null:Vc(Ve,{button:Vc(il,{}),buttonClassName:`${M3}__button`,caret:!1,className:d,disabled:r,horizontalAlign:"right",render:({close:p})=>UB(ue.MenuItem,{children:[Vc(ue.Button,{className:n,disabled:!t,icon:Vc(sl,{size:24}),onClick:()=>{f(),p()},children:u(s?"general:copyRow":"general:copyField")}),Vc(ue.Button,{className:a,disabled:!e,icon:Vc(tm,{}),onClick:()=>{m(),p()},children:u(s?"general:pasteRow":"general:pasteField")})]}),verticalAlign:"bottom"})};var Jh=Ji(Yh(),1),W3="default"in Jh.default?Jh.default.default:Jh.default;function Hc({formState:t,path:e,rowIndex:o}){let n={},r=typeof o!="number"?e:`${e}.${o}`;for(let s in t){if(!s.startsWith(r))continue;let{customComponents:i,validate:a,...l}=t[s];Array.isArray(l.rows)&&(l.rows=l.rows.map(c=>{if(!c||typeof c!="object")return c;let{customComponents:u,...d}=c;return d})),n[s]=l}return n}function zc({dataFromClipboard:t,formState:e,path:o,rowIndex:n}){let{type:r,data:s,path:i,rowIndex:a}=t,l=typeof a!="number",c=typeof n!="number",u=!l&&c,d=r==="array",f;l&&c?f=i:l?f=`${i}.${n}`:f=`${i}.${a}`;let m;if(c?u?m=`${o}.0`:m=o:m=`${o}.${n}`,u){let h=`${o}.0`,g=s[`${f}.id`]?.value,b=e[o].rows?.length;e[o].rows=[{...b&&d?e[o].rows[0]:{},id:g,isLoading:!1,lastRenderedPath:h}],e[o].value=1,e[o].initialValue=1,e[o].disableFormData=!0;for(let v in e)v!==o&&!v.startsWith(h)&&v.startsWith(o)&&delete e[v]}let p=new Map;for(let h in s){if(!c&&h===`${f}.id`||!h.startsWith(f))continue;let g=h.replace(f,m),b=d?e[g]?.customComponents:void 0,v=d?e[g]?.validate:void 0;if(h.endsWith(".id")&&s[h]?.value){let C=s[h].value;if(typeof C=="string"&&W3.isValid(C)){let y=new W3().toHexString();p.set(h,y),e[g]={customComponents:b,validate:v,...s[h],initialValue:y,value:y};continue}}e[g]={customComponents:b,validate:v,...s[h]}}for(let[h,g]of p){let v=h.replace(`${f}.`,"").split(".");if(v.length>=2){let C=parseInt(v[v.length-2],10),y=v.slice(0,v.length-2).join("."),x=y?`${m}.${y}`:m;if(e[x]&&Array.isArray(e[x].rows)){let w=e[x].rows;!isNaN(C)&&w[C]&&(w[C].id=g)}}else if(v.length===1&&v[0]==="id"){let C=m.split("."),y=C[C.length-1],x=isNaN(parseInt(y,10))?0:parseInt(y,10),w=isNaN(parseInt(y,10))?m:C.slice(0,-1).join(".");if(e[w]&&Array.isArray(e[w].rows)){let S=e[w].rows;S[x]&&(S[x].id=g)}}}return e}import{c as JB}from"react/compiler-runtime";import{jsx as qh,jsxs as qB}from"react/jsx-runtime";import{Fragment as QB}from"react";var Qh=t=>{let e=JB(8),{onClick:o}=t,{t:n}=N(),r;e[0]!==o?(r=()=>o(!0),e[0]=o,e[1]=r):r=e[1];let s;if(e[2]!==o||e[3]!==n||e[4]!==r){let i;e[6]!==o?(i=()=>o(!1),e[6]=o,e[7]=i):i=e[7],s=qB(QB,{children:[qh("li",{children:qh(Z,{buttonStyle:"ghost",onClick:r,children:n("fields:collapseAll")})}),qh("li",{children:qh(Z,{buttonStyle:"ghost",onClick:i,children:n("fields:showAll")})})]}),e[2]=o,e[3]=n,e[4]=r,e[5]=s}else s=e[5];return s};import{c as eO}from"react/compiler-runtime";import{jsx as tO}from"react/jsx-runtime";import{Fragment as oO}from"react";import{c as KB}from"react/compiler-runtime";var qs=t=>{let e=KB(18),{id:o,disabled:n}=t,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={duration:250,easing:"cubic-bezier(0, 0.2, 0.2, 1)"},e[0]=r):r=e[0];let s;e[1]!==n||e[2]!==o?(s={id:o,disabled:n,transition:r},e[1]=n,e[2]=o,e[3]=s):s=e[3];let{attributes:i,isDragging:a,isOver:l,isSorting:c,listeners:u,setNodeRef:d,transform:f,transition:m}=t3(s),p;e[4]!==m?(p={transition:m},e[4]=m,e[5]=p):p=e[5];let h;e[6]!==i||e[7]!==p?(h={...i,style:p},e[6]=i,e[7]=p,e[8]=h):h=e[8];let g=f&&`translate3d(${f.x}px, ${f.y}px, 0)`,b;return e[9]!==a||e[10]!==l||e[11]!==c||e[12]!==u||e[13]!==d||e[14]!==h||e[15]!==g||e[16]!==m?(b={attributes:h,isDragging:a,isOver:l,isSorting:c,listeners:u,setNodeRef:d,transform:g,transition:m},e[9]=a,e[10]=l,e[11]=c,e[12]=u,e[13]=d,e[14]=h,e[15]=g,e[16]=m,e[17]=b):b=e[17],b};var Yr=t=>{let e=eO(11),{id:o,children:n,disabled:r}=t,s;e[0]!==r||e[1]!==o?(s={id:o,disabled:r},e[0]=r,e[1]=o,e[2]=s):s=e[2];let{attributes:i,isDragging:a,listeners:l,setNodeRef:c,transform:u,transition:d}=qs(s),f;return e[3]!==i||e[4]!==n||e[5]!==a||e[6]!==l||e[7]!==c||e[8]!==u||e[9]!==d?(f=tO(oO,{children:n({attributes:i,isDragging:a,listeners:l,setNodeRef:c,transform:u,transition:d})}),e[3]=i,e[4]=n,e[5]=a,e[6]=l,e[7]=c,e[8]=u,e[9]=d,e[10]=f):f=e[10],f};import{jsx as Py,Fragment as fO}from"react/jsx-runtime";import"react";import{c as mO}from"react/compiler-runtime";import{jsx as Nn,jsxs as Ay}from"react/jsx-runtime";import{useState as q3}from"react";import{jsx as U3}from"react/jsx-runtime";import"react";var rO={16:"M5 4.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5M5 8a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5A.5.5 0 0 1 5 8m6 3.5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h5a.5.5 0 0 0 .5-.5",24:"M18.5 15C18.7761 15 19 15.2239 19 15.5C19 15.7761 18.7761 16 18.5 16H5.5C5.22386 16 5 15.7761 5 15.5C5 15.2239 5.22386 15 5.5 15H18.5ZM18.5 11C18.7761 11 19 11.2239 19 11.5C19 11.7761 18.7761 12 18.5 12H5.5C5.22386 12 5 11.7761 5 11.5C5 11.2239 5.22386 11 5.5 11H18.5ZM18.5 7C18.7761 7 19 7.22386 19 7.5C19 7.77614 18.7761 8 18.5 8H5.5C5.22386 8 5 7.77614 5 7.5C5 7.22386 5.22386 7 5.5 7H18.5Z"},Ho=({className:t,size:e=16})=>U3("svg",{className:["icon","icon--align-justified",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:U3("path",{clipRule:"evenodd",d:rO[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as Z3}from"react/jsx-runtime";import Kh,{useEffect as aO,useRef as Dy}from"react";import{useEffect as nO,useMemo as sO,useRef as Ty,useState as iO}from"react";var X3=({containerRef:t,contentRef:e,duration:o,open:n})=>{let r=sO(()=>typeof CSS<"u"&&CSS&&CSS.supports?CSS.supports("interpolate-size","allow-keywords"):!1,[]),s=Ty(!1),i=Ty(n),[a,l]=iO(!1),c=Ty(null);return nO(()=>{let u=t.current,d=e.current;if(!u||!d||r)return;let f=h=>{u.style.height=h},m=()=>{u&&(u.style.transition="",u.style.height=n?"auto":"0px",l(!1))};return(()=>{if(!s.current&&n){f("auto"),l(!1);return}s.current=!0,i.current!==n&&f(n?"0px":`${d.scrollHeight}px`),u.offsetHeight,l(!0),u.style.transition=`height ${o}ms ease`,f(n?`${d.scrollHeight}px`:"0px");let h=()=>{m(),u.removeEventListener("transitionend",h)};u.addEventListener("transitionend",h)})(),i.current=n,c.current=new ResizeObserver(()=>{a&&(u.style.height=n?`${d.scrollHeight}px`:"0px")}),c.current.observe(d),()=>{u&&(u.style.transition="",u.style.height=""),c.current?.disconnect()}},[n,o,t,e,r]),{browserSupportsKeywordAnimation:r}};var rm=({id:t,children:e,className:o,duration:n=300,height:r})=>{let[s,i]=Kh.useState(()=>!!r),a=Dy(s),[l,c]=Kh.useState(()=>s?"":"none"),[u,d]=Kh.useState(()=>s?"":"hidden"),[f,m]=Kh.useState(!1),p=Dy(null),h=Dy(null);return aO(()=>{let g,b,v=!!r,C=a.current!==v;return a.current=v,C&&(m(!0),d("hidden"),v?c(""):g=window.setTimeout(()=>{c("none")},n),i(v),b=window.setTimeout(()=>{d(""),m(!1)},n)),()=>{g&&clearTimeout(g),b&&clearTimeout(b)}},[r,n]),X3({containerRef:p,contentRef:h,duration:n,open:s}),Z3("div",{"aria-hidden":!s,className:[o,"rah-static",s&&r==="auto"&&"rah-static--height-auto",f&&`rah-animating--${s?"down":"up"}`,f&&r==="auto"&&"rah-animating--to-height-auto"].filter(Boolean).join(" "),id:t,ref:p,style:{overflow:u,transition:`height ${n}ms ease`},children:Z3("div",{ref:h,...l?{style:{display:l}}:{},children:e})})};import{jsx as lO}from"react/jsx-runtime";import cO,{createContext as uO,use as dO}from"react";var Y3=uO({isCollapsed:void 0,isVisible:void 0,isWithinCollapsible:void 0,toggle:()=>{}}),J3=({children:t,isCollapsed:e,isWithinCollapsible:o=!0,toggle:n})=>{let{isCollapsed:r,isVisible:s}=ra(),i=cO.useMemo(()=>({isCollapsed:e,isVisible:s&&!r,isWithinCollapsible:o,toggle:n}),[e,o,n,r,s]);return lO(Y3,{value:i,children:t})},ra=()=>dO(Y3);var er="collapsible";var Qs=t=>{let e=mO(25),{actions:o,AfterCollapsible:n,children:r,className:s,collapsibleStyle:i,disableHeaderToggle:a,disableToggleIndicator:l,dragHandleProps:c,header:u,initCollapsed:d,isCollapsed:f,onToggle:m}=t,p=i===void 0?"default":i,h=a===void 0?!1:a,g=l===void 0?!1:l,[b,v]=q3(!!d),[C,y]=q3(!1),{isWithinCollapsible:x}=ra(),{t:w}=N(),S=typeof f=="boolean"?f:b,_;e[0]!==S||e[1]!==m?(_=()=>{typeof m=="function"&&m(!S),v(!S)},e[0]=S,e[1]=m,e[2]=_):_=e[2];let I=_,A=c&&`${er}--has-drag-handle`,D=S&&`${er}--collapsed`,T=x&&`${er}--nested`,R=C&&!h&&`${er}--hovered`,P=`${er}--style-${p}`,E;e[3]!==s||e[4]!==A||e[5]!==D||e[6]!==T||e[7]!==R||e[8]!==P?(E=[er,s,A,D,T,R,P].filter(Boolean),e[3]=s,e[4]=A,e[5]=D,e[6]=T,e[7]=R,e[8]=P,e[9]=E):E=e[9];let F=E.join(" "),L=`${er}__toggle-wrap${h?" toggle-disabled":""}`,M,$;e[10]===Symbol.for("react.memo_cache_sentinel")?(M=()=>y(!0),$=()=>y(!1),e[10]=M,e[11]=$):(M=e[10],$=e[11]);let B;return e[12]!==n||e[13]!==o||e[14]!==r||e[15]!==h||e[16]!==g||e[17]!==c||e[18]!==u||e[19]!==S||e[20]!==w||e[21]!==F||e[22]!==L||e[23]!==I?(B=Nn("div",{className:F,children:Ay(J3,{isCollapsed:S,toggle:I,children:[Ay("div",{className:L,onMouseEnter:M,onMouseLeave:$,children:[!h&&Nn("button",{className:[`${er}__toggle`,`${er}__toggle--${S?"collapsed":"open"}`].filter(Boolean).join(" "),onClick:I,type:"button",children:Nn("span",{children:w("fields:toggleBlock")})}),c&&Nn("div",{className:`${er}__drag`,...c.attributes,...c.listeners,children:Nn(Ho,{})}),u?Nn("div",{className:[`${er}__header-wrap`,c&&`${er}__header-wrap--has-drag-handle`].filter(Boolean).join(" "),children:u}):null,Ay("div",{className:`${er}__actions-wrap`,children:[o?Nn("div",{className:`${er}__actions`,children:o}):null,!g&&Nn("button",{className:`${er}__indicator`,onClick:I,tabIndex:-1,type:"button",children:Nn(ve,{direction:S?void 0:"up"})})]})]}),Nn(rm,{height:S?0:"auto",children:Nn("div",{className:`${er}__content`,children:r})}),n]})}),e[12]=n,e[13]=o,e[14]=r,e[15]=h,e[16]=g,e[17]=c,e[18]=u,e[19]=S,e[20]=w,e[21]=F,e[22]=L,e[23]=I,e[24]=B):B=e[24],B};var pO="drag-overlay-preview",e1=({header:t})=>Py("div",{className:pO,children:Py(Qs,{collapsibleStyle:"default",dragHandleProps:{id:"",attributes:{},listeners:void 0},header:t,isCollapsed:!0,children:Py(fO,{})})});import{c as hO}from"react/compiler-runtime";import{jsx as Fy,jsxs as gO}from"react/jsx-runtime";import{closestCenter as bO,DndContext as vO,DragOverlay as yO,KeyboardSensor as CO,MouseSensor as xO,TouchSensor as wO,useDroppable as SO,useSensor as Ny,useSensors as _O}from"@dnd-kit/core";import{useEffect as IO,useId as Q3,useState as RO}from"react";var hr=t=>{let e=hO(27),{children:o,className:n,ids:r,onDragEnd:s,onDragStart:i,renderDragOverlay:a,sortingStrategy:l}=t,[c,u]=RO(null),d,f;e[0]!==c?(d=()=>{if(c!==null)return document.body.classList.add("is-dragging"),TO},f=[c],e[0]=c,e[1]=d,e[2]=f):(d=e[1],f=e[2]),IO(d,f);let m=Q3(),p=Q3(),h;e[3]!==m?(h={id:m},e[3]=m,e[4]=h):h=e[4];let{setNodeRef:g}=SO(h),b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b={activationConstraint:{distance:5}},e[5]=b):b=e[5];let v;e[6]===Symbol.for("react.memo_cache_sentinel")?(v={activationConstraint:{delay:200,tolerance:5}},e[6]=v):v=e[6];let C;e[7]===Symbol.for("react.memo_cache_sentinel")?(C={coordinateGetter:o3},e[7]=C):C=e[7];let y=_O(Ny(xO,b),Ny(wO,v),Ny(CO,C)),x;e[8]!==r||e[9]!==s?(x=T=>{let{active:R,over:P}=T;T.activatorEvent.stopPropagation(),u(null),!(!R||!P)&&typeof s=="function"&&s({event:T,moveFromIndex:r.findIndex(E=>E===R.id),moveToIndex:r.findIndex(E=>E===P.id)})},e[8]=r,e[9]=s,e[10]=x):x=e[10];let w=x,S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{u(null)},e[11]=S):S=e[11];let _=S,I;e[12]!==i?(I=T=>{let{active:R}=T;R&&(u(R.id),typeof i=="function"&&i({id:R.id,event:T}))},e[12]=i,e[13]=I):I=e[13];let A=I,D;return e[14]!==c||e[15]!==o||e[16]!==n||e[17]!==m||e[18]!==w||e[19]!==A||e[20]!==r||e[21]!==a||e[22]!==y||e[23]!==g||e[24]!==p||e[25]!==l?(D=gO(vO,{collisionDetection:bO,id:m,onDragCancel:_,onDragEnd:w,onDragStart:A,sensors:y,children:[Fy(K4,{id:p,items:r,strategy:l,children:Fy("div",{className:n,ref:g,children:o})}),a&&c!==null&&Fy(yO,{dropAnimation:null,children:a(c)})]}),e[14]=c,e[15]=o,e[16]=n,e[17]=m,e[18]=w,e[19]=A,e[20]=r,e[21]=a,e[22]=y,e[23]=g,e[24]=p,e[25]=l,e[26]=D):D=e[26],D};function TO(){document.body.classList.remove("is-dragging")}import{jsx as K3,jsxs as DO}from"react/jsx-runtime";import"react";var t1="error-pill",yo=t=>{let{className:e,count:o,i18n:n,withMessage:r}=t,s=!r&&o<99,i=[t1,s&&`${t1}--fixed-width`,e&&e].filter(Boolean).join(" ");return o===0?null:K3("div",{className:i,children:DO("div",{className:`${t1}__content`,children:[K3("span",{className:`${t1}__count`,children:o}),r&&` ${o>1?n.t("general:errors").toLowerCase():n.t("general:error").toLowerCase()}`]})})};import{c as AO}from"react/compiler-runtime";import{jsx as PO}from"react/jsx-runtime";import{getTranslation as FO}from"@payloadcms/translations";import"react";var e_="field-description",Xe=t=>{let e=AO(8),{className:o,description:n,marginPlacement:r,path:s}=t,{i18n:i}=N();if(n){let a=`field-description-${s?.replace(/\./g,"__")}`,l=r&&`${e_}--margin-${r}`,c;e[0]!==o||e[1]!==a||e[2]!==l?(c=[e_,o,a,l].filter(Boolean),e[0]=o,e[1]=a,e[2]=l,e[3]=c):c=e[3];let u=c.join(" "),d;return e[4]!==n||e[5]!==i||e[6]!==u?(d=PO("div",{className:u,children:FO(n,i)}),e[4]=n,e[5]=i,e[6]=u,e[7]=d):d=e[7],d}return null};import{c as NO}from"react/compiler-runtime";import{jsx as EO}from"react/jsx-runtime";import"react";var LO="field-error",tt=t=>{let e=NO(8),{alignCaret:o,message:n,path:r,showError:s}=t,i=o===void 0?"right":o,a=vo(),l;e[0]!==r?(l=d=>{let[f]=d;return f&&f?.[r]||null},e[0]=r,e[1]=l):l=e[1];let c=Ht(l),u;if(e[2]!==i||e[3]!==c||e[4]!==a||e[5]!==n||e[6]!==s){u=Symbol.for("react.early_return_sentinel");e:{let{errorMessage:d,valid:f}=c||{},m=n||d;if((s||a&&f===!1)&&m?.length){u=EO(io,{alignCaret:i,className:LO,delay:0,staticPositioning:!0,children:m});break e}}e[2]=i,e[3]=c,e[4]=a,e[5]=n,e[6]=s,e[7]=u}else u=e[7];return u!==Symbol.for("react.early_return_sentinel")?u:null};import{jsx as QV,jsxs as G_}from"react/jsx-runtime";import{getTranslation as KV}from"@payloadcms/translations";import"react";import{c as $O}from"react/compiler-runtime";import{jsx as jO}from"react/jsx-runtime";import{createContext as kO,use as MO}from"react";var t_=kO(0),Ks=t=>{let e=$O(3),{children:o}=t,r=vt()+1,s;return e[0]!==o||e[1]!==r?(s=jO(t_,{value:r,children:o}),e[0]=o,e[1]=r,e[2]=s):s=e[2],s},vt=()=>MO(t_);import{c as WV}from"react/compiler-runtime";import{jsx as M_}from"react/jsx-runtime";import{formatAdminURL as UV}from"payload/shared";import XV,{createContext as O_,use as V_,useEffect as B_,useRef as ZV,useState as YV}from"react";var na=(t,e)=>!t?.locales||t.locales.length===0?null:t.locales.find(o=>o?.code===e);import{jsx as VV}from"react/jsx-runtime";import{jsx as Vy}from"react/jsx-runtime";import{useRef as m_,useEffect as cl,useState as Hy}from"react";import QO from"react-dom";function ke(){return ke=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var n in o)({}).hasOwnProperty.call(o,n)&&(t[n]=o[n])}return t},ke.apply(null,arguments)}function Gc(t,e){if(t==null)return{};var o={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;o[n]=t[n]}return o}function Wc(t,e){return Wc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,n){return o.__proto__=n,o},Wc(t,e)}function o1(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Wc(t,e)}function Ey(t,e){return t.classList?!!e&&t.classList.contains(e):(" "+(t.className.baseVal||t.className)+" ").indexOf(" "+e+" ")!==-1}function Ly(t,e){t.classList?t.classList.add(e):Ey(t,e)||(typeof t.className=="string"?t.className=t.className+" "+e:t.setAttribute("class",(t.className&&t.className.baseVal||"")+" "+e))}function o_(t,e){return t.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function $y(t,e){t.classList?t.classList.remove(e):typeof t.className=="string"?t.className=o_(t.className,e):t.setAttribute("class",o_(t.className&&t.className.baseVal||"",e))}import n_ from"react";import n1 from"react";import s1 from"react-dom";var jy={disabled:!1};import BO from"react";var ky=BO.createContext(null);var r1=function(e){return e.scrollTop};var nm="unmounted",al="exited",ll="entering",Xc="entered",My="exiting",ei=(function(t){o1(e,t);function e(n,r){var s;s=t.call(this,n,r)||this;var i=r,a=i&&!i.isMounting?n.enter:n.appear,l;return s.appearStatus=null,n.in?a?(l=al,s.appearStatus=ll):l=Xc:n.unmountOnExit||n.mountOnEnter?l=nm:l=al,s.state={status:l},s.nextCallback=null,s}e.getDerivedStateFromProps=function(r,s){var i=r.in;return i&&s.status===nm?{status:al}:null};var o=e.prototype;return o.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},o.componentDidUpdate=function(r){var s=null;if(r!==this.props){var i=this.state.status;this.props.in?i!==ll&&i!==Xc&&(s=ll):(i===ll||i===Xc)&&(s=My)}this.updateStatus(!1,s)},o.componentWillUnmount=function(){this.cancelNextCallback()},o.getTimeouts=function(){var r=this.props.timeout,s,i,a;return s=i=a=r,r!=null&&typeof r!="number"&&(s=r.exit,i=r.enter,a=r.appear!==void 0?r.appear:i),{exit:s,enter:i,appear:a}},o.updateStatus=function(r,s){if(r===void 0&&(r=!1),s!==null)if(this.cancelNextCallback(),s===ll){if(this.props.unmountOnExit||this.props.mountOnEnter){var i=this.props.nodeRef?this.props.nodeRef.current:s1.findDOMNode(this);i&&r1(i)}this.performEnter(r)}else this.performExit();else this.props.unmountOnExit&&this.state.status===al&&this.setState({status:nm})},o.performEnter=function(r){var s=this,i=this.props.enter,a=this.context?this.context.isMounting:r,l=this.props.nodeRef?[a]:[s1.findDOMNode(this),a],c=l[0],u=l[1],d=this.getTimeouts(),f=a?d.appear:d.enter;if(!r&&!i||jy.disabled){this.safeSetState({status:Xc},function(){s.props.onEntered(c)});return}this.props.onEnter(c,u),this.safeSetState({status:ll},function(){s.props.onEntering(c,u),s.onTransitionEnd(f,function(){s.safeSetState({status:Xc},function(){s.props.onEntered(c,u)})})})},o.performExit=function(){var r=this,s=this.props.exit,i=this.getTimeouts(),a=this.props.nodeRef?void 0:s1.findDOMNode(this);if(!s||jy.disabled){this.safeSetState({status:al},function(){r.props.onExited(a)});return}this.props.onExit(a),this.safeSetState({status:My},function(){r.props.onExiting(a),r.onTransitionEnd(i.exit,function(){r.safeSetState({status:al},function(){r.props.onExited(a)})})})},o.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},o.safeSetState=function(r,s){s=this.setNextCallback(s),this.setState(r,s)},o.setNextCallback=function(r){var s=this,i=!0;return this.nextCallback=function(a){i&&(i=!1,s.nextCallback=null,r(a))},this.nextCallback.cancel=function(){i=!1},this.nextCallback},o.onTransitionEnd=function(r,s){this.setNextCallback(s);var i=this.props.nodeRef?this.props.nodeRef.current:s1.findDOMNode(this),a=r==null&&!this.props.addEndListener;if(!i||a){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[i,this.nextCallback],c=l[0],u=l[1];this.props.addEndListener(c,u)}r!=null&&setTimeout(this.nextCallback,r)},o.render=function(){var r=this.state.status;if(r===nm)return null;var s=this.props,i=s.children,a=s.in,l=s.mountOnEnter,c=s.unmountOnExit,u=s.appear,d=s.enter,f=s.exit,m=s.timeout,p=s.addEndListener,h=s.onEnter,g=s.onEntering,b=s.onEntered,v=s.onExit,C=s.onExiting,y=s.onExited,x=s.nodeRef,w=Gc(s,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return n1.createElement(ky.Provider,{value:null},typeof i=="function"?i(r,w):n1.cloneElement(n1.Children.only(i),w))},e})(n1.Component);ei.contextType=ky;ei.propTypes={};function Uc(){}ei.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Uc,onEntering:Uc,onEntered:Uc,onExit:Uc,onExiting:Uc,onExited:Uc};ei.UNMOUNTED=nm;ei.EXITED=al;ei.ENTERING=ll;ei.ENTERED=Xc;ei.EXITING=My;var r_=ei;var OO=function(e,o){return e&&o&&o.split(" ").forEach(function(n){return Ly(e,n)})},By=function(e,o){return e&&o&&o.split(" ").forEach(function(n){return $y(e,n)})},Oy=(function(t){o1(e,t);function e(){for(var n,r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=t.call.apply(t,[this].concat(s))||this,n.appliedClasses={appear:{},enter:{},exit:{}},n.onEnter=function(a,l){var c=n.resolveArguments(a,l),u=c[0],d=c[1];n.removeClasses(u,"exit"),n.addClass(u,d?"appear":"enter","base"),n.props.onEnter&&n.props.onEnter(a,l)},n.onEntering=function(a,l){var c=n.resolveArguments(a,l),u=c[0],d=c[1],f=d?"appear":"enter";n.addClass(u,f,"active"),n.props.onEntering&&n.props.onEntering(a,l)},n.onEntered=function(a,l){var c=n.resolveArguments(a,l),u=c[0],d=c[1],f=d?"appear":"enter";n.removeClasses(u,f),n.addClass(u,f,"done"),n.props.onEntered&&n.props.onEntered(a,l)},n.onExit=function(a){var l=n.resolveArguments(a),c=l[0];n.removeClasses(c,"appear"),n.removeClasses(c,"enter"),n.addClass(c,"exit","base"),n.props.onExit&&n.props.onExit(a)},n.onExiting=function(a){var l=n.resolveArguments(a),c=l[0];n.addClass(c,"exit","active"),n.props.onExiting&&n.props.onExiting(a)},n.onExited=function(a){var l=n.resolveArguments(a),c=l[0];n.removeClasses(c,"exit"),n.addClass(c,"exit","done"),n.props.onExited&&n.props.onExited(a)},n.resolveArguments=function(a,l){return n.props.nodeRef?[n.props.nodeRef.current,a]:[a,l]},n.getClassNames=function(a){var l=n.props.classNames,c=typeof l=="string",u=c&&l?l+"-":"",d=c?""+u+a:l[a],f=c?d+"-active":l[a+"Active"],m=c?d+"-done":l[a+"Done"];return{baseClassName:d,activeClassName:f,doneClassName:m}},n}var o=e.prototype;return o.addClass=function(r,s,i){var a=this.getClassNames(s)[i+"ClassName"],l=this.getClassNames("enter"),c=l.doneClassName;s==="appear"&&i==="done"&&c&&(a+=" "+c),i==="active"&&r&&r1(r),a&&(this.appliedClasses[s][i]=a,OO(r,a))},o.removeClasses=function(r,s){var i=this.appliedClasses[s],a=i.base,l=i.active,c=i.done;this.appliedClasses[s]={},a&&By(r,a),l&&By(r,l),c&&By(r,c)},o.render=function(){var r=this.props,s=r.classNames,i=Gc(r,["classNames"]);return n_.createElement(r_,ke({},i,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},e})(n_.Component);Oy.defaultProps={classNames:""};Oy.propTypes={};var sm=Oy;function s_(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}import{useContext as HO}from"react";import{createContext as VO}from"react";var i1=VO({});var ie=()=>HO(i1);var a1=t=>t?{appear:`${t}--appear`,appearActive:`${t}--appearActive`,appearDone:`${t}--appearDone`,enter:`${t}--enter`,enterActive:`${t}--enterActive`,enterDone:`${t}--enterDone`,exit:`${t}--exit`,exitActive:`${t}--exitActive`,exitDone:`${t}--exitDone`}:{};_k();function i_(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),o.push.apply(o,n)}return o}function a_(t){for(var e=1;e<arguments.length;e++){var o=arguments[e]!=null?arguments[e]:{};e%2?i_(Object(o),!0).forEach(function(n){zO(t,n,o[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):i_(Object(o)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(o,n))})}return t}function zO(t,e,o){return e=WO(e),e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function GO(t,e){if(typeof t!="object"||t===null)return t;var o=t[Symbol.toPrimitive];if(o!==void 0){var n=o.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function WO(t){var e=GO(t,"string");return typeof e=="symbol"?e:String(e)}var l_={activateTrap:function(e,o){if(e.length>0){var n=e[e.length-1];n!==o&&n.pause()}var r=e.indexOf(o);r===-1||e.splice(r,1),e.push(o)},deactivateTrap:function(e,o){var n=e.indexOf(o);n!==-1&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}},UO=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},XO=function(e){return e?.key==="Escape"||e?.key==="Esc"||e?.keyCode===27},am=function(e){return e?.key==="Tab"||e?.keyCode===9},ZO=function(e){return am(e)&&!e.shiftKey},YO=function(e){return am(e)&&e.shiftKey},c_=function(e){return setTimeout(e,0)},u_=function(e,o){var n=-1;return e.every(function(r,s){return o(r)?(n=s,!1):!0}),n},im=function(e){for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];return typeof e=="function"?e.apply(void 0,n):e},l1=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},JO=[],d_=function(e,o){var n=o?.document||document,r=o?.trapStack||JO,s=a_({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:ZO,isKeyBackward:YO},o),i={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},a,l=function(T,R,P){return T&&T[R]!==void 0?T[R]:s[P||R]},c=function(T,R){var P=typeof R?.composedPath=="function"?R.composedPath():void 0;return i.containerGroups.findIndex(function(E){var F=E.container,L=E.tabbableNodes;return F.contains(T)||P?.includes(F)||L.find(function(M){return M===T})})},u=function(T){var R=s[T];if(typeof R=="function"){for(var P=arguments.length,E=new Array(P>1?P-1:0),F=1;F<P;F++)E[F-1]=arguments[F];R=R.apply(void 0,E)}if(R===!0&&(R=void 0),!R){if(R===void 0||R===!1)return R;throw new Error("`".concat(T,"` was specified but was not a node, or did not return a node"))}var L=R;if(typeof R=="string"&&(L=n.querySelector(R),!L))throw new Error("`".concat(T,"` as selector refers to no known node"));return L},d=function(){var T=u("initialFocus");if(T===!1)return!1;if(T===void 0||!bh(T,s.tabbableOptions))if(c(n.activeElement)>=0)T=n.activeElement;else{var R=i.tabbableGroups[0],P=R&&R.firstTabbableNode;T=P||u("fallbackFocus")}if(!T)throw new Error("Your focus-trap needs to have at least one focusable element");return T},f=function(){if(i.containerGroups=i.containers.map(function(T){var R=w4(T,s.tabbableOptions),P=S4(T,s.tabbableOptions),E=R.length>0?R[0]:void 0,F=R.length>0?R[R.length-1]:void 0,L=P.find(function(B){return tl(B)}),M=P.slice().reverse().find(function(B){return tl(B)}),$=!!R.find(function(B){return Lc(B)>0});return{container:T,tabbableNodes:R,focusableNodes:P,posTabIndexesFound:$,firstTabbableNode:E,lastTabbableNode:F,firstDomTabbableNode:L,lastDomTabbableNode:M,nextTabbableNode:function(j){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,O=R.indexOf(j);return O<0?k?P.slice(P.indexOf(j)+1).find(function(V){return tl(V)}):P.slice(0,P.indexOf(j)).reverse().find(function(V){return tl(V)}):R[O+(k?1:-1)]}}}),i.tabbableGroups=i.containerGroups.filter(function(T){return T.tabbableNodes.length>0}),i.tabbableGroups.length<=0&&!u("fallbackFocus"))throw new 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(T){return T.posTabIndexesFound})&&i.containerGroups.length>1)throw new 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.")},m=function D(T){var R=T.activeElement;if(R)return R.shadowRoot&&R.shadowRoot.activeElement!==null?D(R.shadowRoot):R},p=function D(T){if(T!==!1&&T!==m(document)){if(!T||!T.focus){D(d());return}T.focus({preventScroll:!!s.preventScroll}),i.mostRecentlyFocusedNode=T,UO(T)&&T.select()}},h=function(T){var R=u("setReturnFocus",T);return R||(R===!1?!1:T)},g=function(T){var R=T.target,P=T.event,E=T.isBackward,F=E===void 0?!1:E;R=R||l1(P),f();var L=null;if(i.tabbableGroups.length>0){var M=c(R,P),$=M>=0?i.containerGroups[M]:void 0;if(M<0)F?L=i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:L=i.tabbableGroups[0].firstTabbableNode;else if(F){var B=u_(i.tabbableGroups,function(z){var W=z.firstTabbableNode;return R===W});if(B<0&&($.container===R||bh(R,s.tabbableOptions)&&!tl(R,s.tabbableOptions)&&!$.nextTabbableNode(R,!1))&&(B=M),B>=0){var j=B===0?i.tabbableGroups.length-1:B-1,k=i.tabbableGroups[j];L=Lc(R)>=0?k.lastTabbableNode:k.lastDomTabbableNode}else am(P)||(L=$.nextTabbableNode(R,!1))}else{var O=u_(i.tabbableGroups,function(z){var W=z.lastTabbableNode;return R===W});if(O<0&&($.container===R||bh(R,s.tabbableOptions)&&!tl(R,s.tabbableOptions)&&!$.nextTabbableNode(R))&&(O=M),O>=0){var V=O===i.tabbableGroups.length-1?0:O+1,H=i.tabbableGroups[V];L=Lc(R)>=0?H.firstTabbableNode:H.firstDomTabbableNode}else am(P)||(L=$.nextTabbableNode(R))}}else L=u("fallbackFocus");return L},b=function(T){var R=l1(T);if(!(c(R,T)>=0)){if(im(s.clickOutsideDeactivates,T)){a.deactivate({returnFocus:s.returnFocusOnDeactivate});return}im(s.allowOutsideClick,T)||T.preventDefault()}},v=function(T){var R=l1(T),P=c(R,T)>=0;if(P||R instanceof Document)P&&(i.mostRecentlyFocusedNode=R);else{T.stopImmediatePropagation();var E,F=!0;if(i.mostRecentlyFocusedNode)if(Lc(i.mostRecentlyFocusedNode)>0){var L=c(i.mostRecentlyFocusedNode),M=i.containerGroups[L].tabbableNodes;if(M.length>0){var $=M.findIndex(function(B){return B===i.mostRecentlyFocusedNode});$>=0&&(s.isKeyForward(i.recentNavEvent)?$+1<M.length&&(E=M[$+1],F=!1):$-1>=0&&(E=M[$-1],F=!1))}}else i.containerGroups.some(function(B){return B.tabbableNodes.some(function(j){return Lc(j)>0})})||(F=!1);else F=!1;F&&(E=g({target:i.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(i.recentNavEvent)})),p(E||i.mostRecentlyFocusedNode||d())}i.recentNavEvent=void 0},C=function(T){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;i.recentNavEvent=T;var P=g({event:T,isBackward:R});P&&(am(T)&&T.preventDefault(),p(P))},y=function(T){if(XO(T)&&im(s.escapeDeactivates,T)!==!1){T.preventDefault(),a.deactivate();return}(s.isKeyForward(T)||s.isKeyBackward(T))&&C(T,s.isKeyBackward(T))},x=function(T){var R=l1(T);c(R,T)>=0||im(s.clickOutsideDeactivates,T)||im(s.allowOutsideClick,T)||(T.preventDefault(),T.stopImmediatePropagation())},w=function(){if(i.active)return l_.activateTrap(r,a),i.delayInitialFocusTimer=s.delayInitialFocus?c_(function(){p(d())}):p(d()),n.addEventListener("focusin",v,!0),n.addEventListener("mousedown",b,{capture:!0,passive:!1}),n.addEventListener("touchstart",b,{capture:!0,passive:!1}),n.addEventListener("click",x,{capture:!0,passive:!1}),n.addEventListener("keydown",y,{capture:!0,passive:!1}),a},S=function(){if(i.active)return n.removeEventListener("focusin",v,!0),n.removeEventListener("mousedown",b,!0),n.removeEventListener("touchstart",b,!0),n.removeEventListener("click",x,!0),n.removeEventListener("keydown",y,!0),a},_=function(T){var R=T.some(function(P){var E=Array.from(P.removedNodes);return E.some(function(F){return F===i.mostRecentlyFocusedNode})});R&&p(d())},I=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(_):void 0,A=function(){I&&(I.disconnect(),i.active&&!i.paused&&i.containers.map(function(T){I.observe(T,{subtree:!0,childList:!0})}))};return a={get active(){return i.active},get paused(){return i.paused},activate:function(T){if(i.active)return this;var R=l(T,"onActivate"),P=l(T,"onPostActivate"),E=l(T,"checkCanFocusTrap");E||f(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=n.activeElement,R?.();var F=function(){E&&f(),w(),A(),P?.()};return E?(E(i.containers.concat()).then(F,F),this):(F(),this)},deactivate:function(T){if(!i.active)return this;var R=a_({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},T);clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,S(),i.active=!1,i.paused=!1,A(),l_.deactivateTrap(r,a);var P=l(R,"onDeactivate"),E=l(R,"onPostDeactivate"),F=l(R,"checkCanReturnFocus"),L=l(R,"returnFocus","returnFocusOnDeactivate");P?.();var M=function(){c_(function(){L&&p(h(i.nodeFocusedBeforeActivation)),E?.()})};return L&&F?(F(h(i.nodeFocusedBeforeActivation)).then(M,M),this):(M(),this)},pause:function(T){if(i.paused||!i.active)return this;var R=l(T,"onPause"),P=l(T,"onPostPause");return i.paused=!0,R?.(),S(),A(),P?.(),this},unpause:function(T){if(!i.paused||!i.active)return this;var R=l(T,"onUnpause"),P=l(T,"onPostUnpause");return i.paused=!1,R?.(),f(),w(),A(),P?.(),this},updateContainerElements:function(T){var R=[].concat(T).filter(Boolean);return i.containers=R.map(function(P){return typeof P=="string"?n.querySelector(P):P}),i.active&&f(),A(),this}},a.updateContainerElements(e),a};var qO=function(t,e){var o={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(o[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(o[n[r]]=t[n[r]]);return o},ti="modal-item",f_=(t,e)=>n=>{let r=ie(),s=m_(null),[i,a]=Hy(!1),l=m_(!1),[c,u]=Hy(null),{modalState:d,classPrefix:f,containerRef:m,transTime:p,setCloseOnBlur:h,setBodyScrollLock:g,openModal:b}=r,{className:v,htmlElement:C="dialog",slug:y="",closeOnBlur:x=!0,lockBodyScroll:w=!0,classPrefix:S,onEnter:_,onEntering:I,onEntered:A,onExit:D,onExiting:T,onExited:R,openOnInit:P,trapFocus:E=!0,focusTrapOptions:F={}}=n,L=qO(n,["className","htmlElement","slug","closeOnBlur","lockBodyScroll","classPrefix","onEnter","onEntering","onEntered","onExit","onExiting","onExited","openOnInit","trapFocus","focusTrapOptions"]),M=S||f,$=e||y,B=d[$]&&d[$].isOpen;cl(()=>{if(E){let O=s.current;if(l.current===!1&&O){let V=d_(O,Object.assign(Object.assign({},F),{fallbackFocus:F?.fallbackFocus||O,allowOutsideClick:typeof F.allowOutsideClick<"u"?F.allowOutsideClick:!0}));u(V),l.current=!0}}},[E,i,F]),cl(()=>{a(!0)},[]),cl(()=>(c&&(B?c.activate():c.deactivate()),()=>{c&&c.deactivate()}),[B,c]),cl(()=>{B&&h(x)},[B,x,h]),cl(()=>{let O=s.current;return O&&g(!!(B&&w),O),()=>{O&&g(!1,O)}},[B,w,g]);let[j,k]=Hy(B);if(cl(()=>{B?k(B):setTimeout(()=>k(!1),p)},[B,p]),cl(()=>{P&&b($)},[$,P,b]),m.current){let O=M?`${M}__${ti}`:ti,V=[O,`${O}--slug-${$}`,v].filter(Boolean).join(" "),H=Object.assign({role:C!=="dialog"?"dialog":void 0,open:C==="dialog"?j||B:void 0,"aria-modal":!0,"aria-label":L["aria-labelledby"]?void 0:$},L);return QO.createPortal(Vy(sm,{nodeRef:s,timeout:p,in:B,classNames:a1(O),appear:!0,onEnter:_,onEntering:I,onEntered:A,onExit:D,onExiting:T,onExited:R,children:Vy(C,Object.assign({ref:s,id:L?.id||$,className:V},H,{children:Vy(t,Object.assign({},n,{isOpen:B,modal:r}))}))}),m.current)}return null};import{jsx as p_}from"react/jsx-runtime";import{Fragment as h_}from"react";var KO=t=>{let{children:e}=t;return e?typeof e=="function"?p_(h_,{children:e(t)}):p_(h_,{children:e}):null},En=f_(KO);import{jsx as g_}from"react/jsx-runtime";var eV=function(t,e){var o={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(o[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(t);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(t,n[r])&&(o[n[r]]=t[n[r]]);return o},oi="modal-container",zy=t=>{let{oneModalIsOpen:e,classPrefix:o,transTime:n,setContainerRef:r,containerRef:s,closeAllModals:i,closeOnBlur:a}=ie(),{className:l,htmlElement:c="div",children:u,onClick:d}=t,f=eV(t,["className","htmlElement","children","onClick"]),m=o?`${o}__${oi}`:oi,p=[m,l].filter(Boolean).join(" "),h=Object.assign(Object.assign({},f),{onClick:g=>{a&&i(),typeof d=="function"&&d(g)}});return g_(sm,{nodeRef:s,in:e,timeout:n,classNames:a1(m),appear:!0,children:g_(c,Object.assign({className:p,ref:r},h,{children:u&&u}))})};import{jsx as S_,jsxs as lV}from"react/jsx-runtime";import{Fragment as cV,useState as m1,useRef as __,useEffect as f1,useCallback as sa,useReducer as uV}from"react";function tV(t){if(Array.isArray(t)){for(var e=0,o=Array(t.length);e<t.length;e++)o[e]=t[e];return o}else return Array.from(t)}var Wy=!1;typeof window<"u"&&(Gy={get passive(){Wy=!0}},window.addEventListener("testPassive",null,Gy),window.removeEventListener("testPassive",null,Gy));var Gy,c1=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1),dl=[],u1=!1,b_=-1,lm=void 0,ul=void 0,cm=void 0,v_=function(e){return dl.some(function(o){return!!(o.options.allowTouchMove&&o.options.allowTouchMove(e))})},d1=function(e){var o=e||window.event;return v_(o.target)||o.touches.length>1?!0:(o.preventDefault&&o.preventDefault(),!1)},oV=function(e){if(cm===void 0){var o=!!e&&e.reserveScrollBarGap===!0,n=window.innerWidth-document.documentElement.clientWidth;if(o&&n>0){var r=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);cm=document.body.style.paddingRight,document.body.style.paddingRight=r+n+"px"}}lm===void 0&&(lm=document.body.style.overflow,document.body.style.overflow="hidden")},rV=function(){cm!==void 0&&(document.body.style.paddingRight=cm,cm=void 0),lm!==void 0&&(document.body.style.overflow=lm,lm=void 0)},nV=function(){return window.requestAnimationFrame(function(){if(ul===void 0){ul={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var e=window,o=e.scrollY,n=e.scrollX,r=e.innerHeight;document.body.style.position="fixed",document.body.style.top=-o,document.body.style.left=-n,setTimeout(function(){return window.requestAnimationFrame(function(){var s=r-window.innerHeight;s&&o>=r&&(document.body.style.top=-(o+s))})},300)}})},sV=function(){if(ul!==void 0){var e=-parseInt(document.body.style.top,10),o=-parseInt(document.body.style.left,10);document.body.style.position=ul.position,document.body.style.top=ul.top,document.body.style.left=ul.left,window.scrollTo(o,e),ul=void 0}},iV=function(e){return e?e.scrollHeight-e.scrollTop<=e.clientHeight:!1},aV=function(e,o){var n=e.targetTouches[0].clientY-b_;return v_(e.target)?!1:o&&o.scrollTop===0&&n>0||iV(o)&&n<0?d1(e):(e.stopPropagation(),!0)},y_=function(e,o){if(!e){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}if(!dl.some(function(r){return r.targetElement===e})){var n={targetElement:e,options:o||{}};dl=[].concat(tV(dl),[n]),c1?nV():oV(o),c1&&(e.ontouchstart=function(r){r.targetTouches.length===1&&(b_=r.targetTouches[0].clientY)},e.ontouchmove=function(r){r.targetTouches.length===1&&aV(r,e)},u1||(document.addEventListener("touchmove",d1,Wy?{passive:!1}:void 0),u1=!0))}};var C_=function(e){if(!e){console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");return}dl=dl.filter(function(o){return o.targetElement!==e}),c1&&(e.ontouchstart=null,e.ontouchmove=null,u1&&dl.length===0&&(document.removeEventListener("touchmove",d1,Wy?{passive:!1}:void 0),u1=!1)),c1?sV():rV()};var x_=({classPrefix:t,zIndex:e})=>{let o=t?`${t}__`:"";return`
15
- .${o}${oi} {
16
- top: 0;
17
- right: 0;
18
- bottom: 0;
19
- left: 0;
20
- position: fixed;
21
- pointer-events: none;
22
- visibility: hidden;
23
- z-index: -1;
24
- }
25
-
26
- .${o}${oi}--appear,
27
- .${o}${oi}--appearDone,
28
- .${o}${oi}--enter,
29
- .${o}${oi}--enterDone,
30
- .${o}${oi}--exit {
31
- pointer-events: all;
32
- visibility: visible;
33
- z-index: ${e};
34
- }
35
-
36
- .${o}${ti} {
37
- position: absolute;
38
- visibility: hidden;
39
- }
40
-
41
- .${o}${ti}--appear,
42
- .${o}${ti}--appearDone,
43
- .${o}${ti}--enter,
44
- .${o}${ti}--enterDone,
45
- .${o}${ti}--exit {
46
- visibility: visible;
47
- }
48
- `};var w_=(t,e)=>{let o=Object.assign({},t),{type:n,payload:r}=e;switch(n){case"UPDATE_MODAL":{let{slug:s}=r;s&&(o[s]=Object.assign(Object.assign({},o[s]),r));break}case"OPEN_MODAL":{let{slug:s}=r;s&&(s in o&&o[s].isOpen||(o[s]=Object.assign(Object.assign({},o[s]),{slug:s,openedOn:Date.now(),isOpen:!0})));break}case"TOGGLE_MODAL":{let{slug:s}=r;if(s){let i=s in o&&o[s].isOpen;o[s]=Object.assign(Object.assign({},o[s]),{slug:s,openedOn:i?void 0:Date.now(),isOpen:!i})}break}case"CLOSE_MODAL":{let{slug:s}=r;s&&(o[s]=Object.assign(Object.assign({},o[s]),{slug:s,openedOn:void 0,isOpen:!1}));break}case"REMOVE_MODAL":{let{slug:s}=r;s&&s in o&&delete o[s];break}case"CLOSE_LATEST_MODAL":{let s=Object.keys(o).reduce((i,a)=>{let l=o[a];return l.isOpen&&typeof l.openedOn=="number"&&(!i||typeof i.openedOn=="number"&&l.openedOn>i.openedOn)?l:i},void 0);s&&(o[s.slug]=Object.assign(Object.assign({},o[s.slug]),{isOpen:!1,openedOn:void 0}));break}case"CLOSE_ALL_MODALS":{o=Object.entries(o).reduce((s,[i,a])=>(s[i]=Object.assign(Object.assign({},a),{isOpen:!1,openedOn:void 0}),s),{});break}default:break}return o};var dV=()=>{if(typeof window<"u")return new URLSearchParams(window.location.search)},mV=()=>{let t=dV(),e=[];if(t){let o=t.get("modal");o&&(o.includes(",")?e=o.split(","):e=[o])}return e},Uy=t=>{let{classPrefix:e,minifyCSS:o=!0,generateCSS:n=!0,zIndex:r=9999,handleParamChange:s,children:i,transTime:a=250}=t,l=__(null),[c,u]=uV(w_,{},()=>mV().reduce((E,F)=>(E[F]={slug:F,isOpen:!0,openedOn:Date.now()},E),{})),[d,f]=m1(!1),[m,p]=m1(!1),[h,g]=m1(!1),[b,v]=m1(""),C=__(!1),y=sa(R=>{R.keyCode===27&&u({type:"CLOSE_LATEST_MODAL"})},[]);f1(()=>(C.current||(document.addEventListener("keydown",R=>y(R),!1),C.current=!0),()=>{C.current&&document.removeEventListener("keydown",R=>y(R),!1)}),[y]),f1(()=>{if(n){let R="";R=x_({classPrefix:e,zIndex:r}),o&&(R=R.replace(/\n/g,"").replace(/\s\s+/g," ")),v(R)}},[n,o,r,e]),f1(()=>{if(typeof s=="function"&&s(c),typeof s=="boolean"&&s){let R=Object.keys(c).filter(L=>c[L].isOpen),P=new URLSearchParams;for(let L of R)P.append("modal",L);let E=P.toString()?`?${P}`:"",F=`${window.location.pathname}${E}`;window.history.pushState({},"",F)}},[c,s]),f1(()=>{let R=Object.keys(c).some(P=>c[P].isOpen);f(R)},[c]);let x=sa((R,P)=>{P&&(R?(y_(P),g(!0)):(C_(P),g(!1)))},[]),w=sa(R=>{l.current=R},[]),S=sa(R=>{u({type:"OPEN_MODAL",payload:{slug:R}})},[]),_=sa(R=>{u({type:"CLOSE_MODAL",payload:{slug:R}})},[]),I=sa(()=>{u({type:"CLOSE_ALL_MODALS"})},[]),A=sa(R=>{u({type:"TOGGLE_MODAL",payload:{slug:R}})},[]),D=sa(R=>c[R]&&c[R].isOpen,[c]),T=Object.assign({},t);return delete T.children,lV(cV,{children:[n&&S_("style",{dangerouslySetInnerHTML:{__html:b}}),S_(i1.Provider,{value:Object.assign(Object.assign({},T),{transTime:a,containerRef:l,modalState:c,oneModalIsOpen:d,isModalOpen:D,closeOnBlur:m,bodyScrollIsLocked:h,classPrefix:e,closeAllModals:I,setCloseOnBlur:p,openModal:S,closeModal:_,toggleModal:A,setBodyScrollLock:x,setContainerRef:w}),children:i})]})};import{formatAdminURL as ml}from"payload/shared";import*as j_ from"qs-esm";import b1,{createContext as HV,use as zV,useCallback as fl,useEffect as v1,useState as Jc}from"react";import{c as MV}from"react/compiler-runtime";import{jsx as BV}from"react/jsx-runtime";import{formatAdminURL as OV}from"payload/shared";import"react";import{jsx as Yc,jsxs as E_}from"react/jsx-runtime";import"react";import{jsx as fV}from"react/jsx-runtime";import"react";var pV="dialog",fs=({children:t})=>fV("div",{className:`${pV}__body`,children:t});import{c as bV}from"react/compiler-runtime";import{jsx as vV}from"react/jsx-runtime";import"react";import{createContext as hV,use as gV}from"react";var Xy=hV(null),Zc=()=>{let t=gV(Xy);if(!t)throw new Error("Dialog sub-components must be rendered inside <DialogModal>");return t};var ia=t=>{let e=bV(11),{label:o,onClick:n}=t,{slug:r,isConfirming:s}=Zc(),{closeModal:i}=ie(),{t:a}=N(),l;e[0]!==i||e[1]!==s||e[2]!==n||e[3]!==r?(l=()=>{s||(i(r),n?.())},e[0]=i,e[1]=s,e[2]=n,e[3]=r,e[4]=l):l=e[4];let c=l,u;return e[5]!==c||e[6]!==s||e[7]!==o||e[8]!==r||e[9]!==a?(u=vV(Z,{buttonStyle:"secondary",disabled:s,extraButtonProps:{"data-dialog-action":"cancel"},id:`${r}-cancel`,margin:!1,onClick:c,size:"medium",children:o??a("general:cancel")}),e[5]=c,e[6]=s,e[7]=o,e[8]=r,e[9]=a,e[10]=u):u=e[10],u};import{c as yV}from"react/compiler-runtime";import{jsx as CV}from"react/jsx-runtime";import"react";var ps=t=>{let e=yV(13),{label:o,loadingLabel:n,onClick:r}=t,{slug:s,isConfirming:i,setConfirming:a}=Zc(),{closeModal:l}=ie(),{t:c}=N(),u;e[0]!==l||e[1]!==i||e[2]!==r||e[3]!==a||e[4]!==s?(u=async()=>{i||(a(!0),await r(),a(!1),l(s))},e[0]=l,e[1]=i,e[2]=r,e[3]=a,e[4]=s,e[5]=u):u=e[5];let d=u,f;if(e[6]!==d||e[7]!==i||e[8]!==o||e[9]!==n||e[10]!==s||e[11]!==c){let m=o??c("general:confirm");f=CV(Z,{disabled:i,extraButtonProps:{"data-dialog-action":"confirm"},id:`${s}-confirm`,margin:!1,onClick:d,size:"medium",children:i&&n?n:m}),e[6]=d,e[7]=i,e[8]=o,e[9]=n,e[10]=s,e[11]=c,e[12]=f}else f=e[12];return f};import{jsx as xV}from"react/jsx-runtime";import"react";var wV="dialog",hs=({children:t})=>t?xV("div",{className:`${wV}__footer`,children:t}):null;import{c as SV}from"react/compiler-runtime";import{jsx as p1,jsxs as _V}from"react/jsx-runtime";import"react";var h1="dialog",gs=t=>{let e=SV(10),{children:o,showClose:n,title:r}=t,{slug:s,isConfirming:i}=Zc(),{closeModal:a}=ie();if(!r&&!o&&!n)return null;let l=n&&`${h1}__header--has-close`,c;e[0]!==l?(c=[`${h1}__header`,l].filter(Boolean),e[0]=l,e[1]=c):c=e[1];let u=c.join(" "),d;return e[2]!==o||e[3]!==a||e[4]!==i||e[5]!==n||e[6]!==s||e[7]!==u||e[8]!==r?(d=_V("div",{className:u,children:[r?p1("h4",{className:`${h1}__title`,children:r}):null,o?p1("div",{className:`${h1}__header-extras`,children:o}):null,n?p1(Z,{"aria-label":"Close",buttonStyle:"ghost",disabled:i,icon:p1(xt,{}),margin:!1,onClick:()=>a(s)}):null]}),e[2]=o,e[3]=a,e[4]=i,e[5]=n,e[6]=s,e[7]=u,e[8]=r,e[9]=d):d=e[9],d};import{c as LV}from"react/compiler-runtime";import{jsx as Qy}from"react/jsx-runtime";import{useEffect as $V,useState as jV}from"react";import{c as Yy}from"react/compiler-runtime";import{jsx as Mr,jsxs as g1}from"react/jsx-runtime";import{createContext as R_,use as T_,useCallback as I_,useEffect as TV,useId as DV,useLayoutEffect as AV,useMemo as PV,useState as D_}from"react";import{c as IV}from"react/compiler-runtime";import{useId as RV}from"react";var um=t=>{let e=IV(3),o=RV(),n=vt(),r=`${t}-${o}`,s;return e[0]!==n||e[1]!==r?(s=Zy({slug:r,depth:n}),e[0]=n,e[1]=r,e[2]=s):s=e[2],s};var Ln="drawer",Jy=100,Zy=({slug:t,depth:e})=>`drawer_${e}_${t}`,Jr=t=>{let e=Yy(4),{slug:o,buttonStyle:n,children:r,className:s,disabled:i,onClick:a,...l}=t,{openModal:c}=ie(),u;e[0]!==a||e[1]!==c||e[2]!==o?(u=f=>{c(o),typeof a=="function"&&a(f)},e[0]=a,e[1]=c,e[2]=o,e[3]=u):u=e[3];let d=u;return n?Mr(Z,{buttonStyle:n,className:s,disabled:i,onClick:d,...l,children:r}):Mr("button",{className:s,disabled:i,onClick:d,type:"button",...l,children:r})},It=t=>Mr(qy,{children:Mr(FV,{...t})}),FV=t=>{let e=Yy(28),{slug:o,children:n,className:r,Header:s,headerActions:i,hoverTitle:a,title:l}=t,{t:c}=N(),{closeModal:u,modalState:d}=ie(),f=aa(),m=DV(),{openDrawerDepths:p,registerDrawer:h,unregisterDrawer:g}=NV(),b=!!d[o]?.isOpen,v,C;e[0]!==f||e[1]!==b||e[2]!==h||e[3]!==m||e[4]!==g?(v=()=>{if(b)return h(m,f),()=>g(m)},C=[b,m,f,h,g],e[0]=f,e[1]=b,e[2]=h,e[3]=m,e[4]=g,e[5]=v,e[6]=C):(v=e[5],C=e[6]),TV(v,C);let y=p.filter(I=>I>f).length,[x,w]=D_(b),S,_;if(e[7]!==b?(S=()=>{w(b)},_=[b],e[7]=b,e[8]=S,e[9]=_):(S=e[8],_=e[9]),AV(S,_),b){let I=x&&`${Ln}--is-open`,A;e[10]!==r||e[11]!==I?(A=[r,Ln,I].filter(Boolean),e[10]=r,e[11]=I,e[12]=A):A=e[12];let D=A.join(" "),T=`calc(${y} * var(--spacer-3))`,R=Jy+f,P;if(e[13]!==s||e[14]!==n||e[15]!==u||e[16]!==i||e[17]!==a||e[18]!==o||e[19]!==c||e[20]!==D||e[21]!==T||e[22]!==R||e[23]!==l){let E;e[25]!==u||e[26]!==o?(E=()=>u(o),e[25]=u,e[26]=o,e[27]=E):E=e[27],P=g1(En,{className:D,closeOnBlur:!1,slug:o,style:{"--drawer-layer-offset":T,zIndex:R},children:[Mr("div",{className:`${Ln}__blur-bg`}),Mr("button",{"aria-label":c("general:close"),className:`${Ln}__close`,id:`close-drawer__${o}`,onClick:E,type:"button"}),g1("div",{className:`${Ln}__content`,children:[Mr("div",{className:`${Ln}__blur-bg-content`}),g1("div",{className:`${Ln}__content-children`,children:[s,s===void 0&&g1("div",{className:`${Ln}__header`,children:[Mr(Z,{"aria-label":c("general:close"),buttonStyle:"ghost",className:`${Ln}__header__close`,icon:Mr(ve,{direction:"left",size:24}),onClick:()=>u(o)}),Mr("h2",{className:`${Ln}__header__title`,title:a?l:null,children:l}),i&&i.length>0&&Mr("div",{className:`${Ln}__header__actions`,children:i.map(EV)})]}),n]})]})]}),e[13]=s,e[14]=n,e[15]=u,e[16]=i,e[17]=a,e[18]=o,e[19]=c,e[20]=D,e[21]=T,e[22]=R,e[23]=l,e[24]=P}else P=e[24];return P}return null},A_=R_(0),qy=t=>{let e=Yy(3),{children:o}=t,r=aa()+1,s;return e[0]!==o||e[1]!==r?(s=Mr(A_,{value:r,children:o}),e[0]=o,e[1]=r,e[2]=s):s=e[2],s},aa=()=>T_(A_),P_=R_({openDrawerDepths:[],registerDrawer:()=>{},unregisterDrawer:()=>{}}),F_=({children:t})=>{let[e,o]=D_({}),n=I_((i,a)=>{o(l=>l[i]===a?l:{...l,[i]:a})},[]),r=I_(i=>{o(a=>{if(!(i in a))return a;let l={...a};return delete l[i],l})},[]),s=PV(()=>({openDrawerDepths:Object.values(e),registerDrawer:n,unregisterDrawer:r}),[e,n,r]);return Mr(P_,{value:s,children:t})},NV=()=>T_(P_);function EV(t,e){return Mr(Z,{buttonStyle:t.style||"secondary",disabled:t.disabled,margin:!1,onClick:t.onClick,size:"medium",children:t.label},e)}var N_="dialog",fn=t=>{let e=LV(15),{slug:o,children:n,className:r,closeOnBlur:s,closeOnEsc:i,focusTrapOptions:a,size:l}=t,c=s===void 0?!1:s,u=i===void 0?!0:i,d=l===void 0?"small":l,[f,m]=jV(!1),p=aa(),h,g;e[0]!==u?(h=()=>{if(u)return;let v=kV;return document.addEventListener("keydown",v,!0),()=>document.removeEventListener("keydown",v,!0)},g=[u],e[0]=u,e[1]=h,e[2]=g):(h=e[1],g=e[2]),$V(h,g);let b;if(e[3]!==n||e[4]!==r||e[5]!==c||e[6]!==p||e[7]!==a||e[8]!==f||e[9]!==d||e[10]!==o){let v=`${N_}--${d}`,C;e[12]!==r||e[13]!==v?(C=[N_,v,r].filter(Boolean),e[12]=r,e[13]=v,e[14]=C):C=e[14],b=Qy(Xy,{value:{slug:o,isConfirming:f,setConfirming:m},children:Qy(En,{closeOnBlur:c,focusTrapOptions:a,slug:o,style:{zIndex:Jy+p+1},children:Qy("div",{className:C.join(" "),role:"document",children:n})})}),e[3]=n,e[4]=r,e[5]=c,e[6]=p,e[7]=a,e[8]=f,e[9]=d,e[10]=o,e[11]=b}else b=e[11];return b};function kV(t){t.key==="Escape"&&(t.stopImmediatePropagation(),t.preventDefault())}function nt(t){let{body:e,cancelLabel:o,className:n,confirmingLabel:r,confirmLabel:s,heading:i,modalSlug:a,onCancel:l,onConfirm:c}=t;return E_(fn,{className:n,slug:a,children:[Yc(gs,{showClose:!0,title:i}),Yc(fs,{children:Yc("div",{className:"confirmation-modal__body",children:typeof e=="string"?Yc("p",{children:e}):e})}),E_(hs,{children:[Yc(ia,{label:o,onClick:l}),Yc(ps,{label:s,loadingLabel:r,onClick:c})]})]})}var Ky="stay-logged-in",L_=()=>{let t=MV(11),{refreshCookie:e}=ye(),o=Re(),{config:n}=G(),{admin:r,routes:s}=n,{routes:i}=r,{logout:a}=i,{admin:l}=s,{t:c}=N(),{startRouteTransition:u}=Ue(),d;t[0]!==l||t[1]!==a||t[2]!==o||t[3]!==u?(d=()=>u(()=>o.push(OV({adminRoute:l,path:a}))),t[0]=l,t[1]=a,t[2]=o,t[3]=u,t[4]=d):d=t[4];let f=d,m;t[5]!==e?(m=()=>{e()},t[5]=e,t[6]=m):m=t[6];let p=m,h;return t[7]!==p||t[8]!==f||t[9]!==c?(h=BV(nt,{body:c("authentication:youAreInactive"),cancelLabel:c("authentication:stayLoggedIn"),confirmLabel:c("authentication:logOut"),heading:c("authentication:stayLoggedIn"),modalSlug:Ky,onCancel:p,onConfirm:f}),t[7]=p,t[8]=f,t[9]=c,t[10]=h):h=t[10],h};import*as $_ from"qs-esm";var We={delete:(t,e={headers:{}})=>{let o=e&&e.headers?{...e.headers}:{},n={...e,credentials:"include",headers:{...o},method:"delete"};return fetch(t,n)},get:(t,e={headers:{}})=>{let o="";return e.params&&(o=$_.stringify(e.params,{addQueryPrefix:!0})),fetch(`${t}${o}`,{credentials:"include",...e})},patch:(t,e={headers:{}})=>{let o=e&&e.headers?{...e.headers}:{},n={...e,credentials:"include",headers:{...o},method:"PATCH"};return fetch(t,n)},post:(t,e={headers:{}})=>{let o=e&&e.headers?{...e.headers}:{},n={...e,credentials:"include",headers:{...o},method:"post"};return fetch(`${t}`,n)},put:(t,e={headers:{}})=>{let o=e&&e.headers?{...e.headers}:{},n={...e,credentials:"include",headers:{...o},method:"put"};return fetch(t,n)}};var k_=HV({}),GV=2147483647;function eC({children:t,permissions:e,user:o}){let n=Ao(),r=Re(),{config:s}=G(),{admin:{autoLogin:i,autoRefresh:a,routes:{inactivity:l},user:c},routes:{admin:u,api:d}}=s,{i18n:f}=N(),{closeAllModals:m,openModal:p}=ie(),{startRouteTransition:h}=Ue(),[g,b]=Jc(o),[v,C]=Jc(),[y,x]=Jc(),[w,S]=Jc(e),[_,I]=Jc(12e4),[A,D]=Jc(!1),T=b1.useRef(null),R=b1.useRef(null),P=b1.useRef(null),E=g?.id,F=fl(()=>{let W=ml({adminRoute:u,path:""});h(()=>r.replace(ml({adminRoute:u,path:`${l}${window.location.pathname.startsWith(W)?`?redirect=${encodeURIComponent(window.location.pathname)}`:""}`}))),m()},[r,u,l,m,h]),L=fl(()=>{b(null),C(void 0),x(void 0),clearTimeout(T.current)},[]),M=et(()=>{a?H():p(Ky)}),$=fl(W=>{if(clearTimeout(R.current),clearTimeout(P.current),W?.user){b(W.user),C(W.token??W.refreshedToken),x(W.exp*1e3);let U=Math.max(0,Math.min((W.exp??0)*1e3-Date.now(),GV));if(U){let X=Math.min(6e4,U/2);I(X),R.current=setTimeout(M,Math.max(U-X,0)),P.current=setTimeout(()=>{L(),F()},U)}}else L()},[F,L]),B=fl(W=>{if(!E)return;let U=Math.max(0,(y??0)-Date.now());(W||y&&U<_*2)&&(clearTimeout(T.current),T.current=setTimeout(async()=>{try{let X=await We.post(ml({apiRoute:d,path:`/${c}/refresh-token?refresh`}),{headers:{"Accept-Language":f.language}});if(X.status===200){let Q=await X.json();$(Q)}else $(null),F()}catch(X){se.error(X.message)}},1e3))},[d,f.language,F,$,y,c,_,E]),j=fl(async W=>{try{let U=await We.post(ml({apiRoute:d,path:`/${c}/refresh-token`}),{headers:{"Accept-Language":f.language}});if(U.status===200){let X=await U.json();return W||$(X),X.user}g&&($(null),F())}catch(U){se.error(`Refreshing token failed: ${U.message}`)}return null},[d,f.language,F,$,c,g]),k=fl(async()=>{try{g&&g.collection&&($(null),await We.post(ml({apiRoute:d,path:`/${g.collection}/logout`})))}catch{}return!0},[d,$,g]),O=fl(async({locale:W}={})=>{let U=j_.stringify({locale:W},{addQueryPrefix:!0});try{let X=await We.get(ml({apiRoute:d,path:`/access${U}`}),{headers:{"Accept-Language":f.language}});if(X.status===200){let Q=await X.json();S(Q)}else throw new Error(`Fetching permissions failed with status code ${X.status}`)}catch(X){se.error(`Refreshing permissions failed: ${X.message}`)}},[d,f]),V=b1.useCallback(async()=>{try{let W=await We.get(ml({apiRoute:d,path:`/${c}/me`}),{credentials:"include",headers:{"Accept-Language":f.language}});if(W.status===200){let U=await W.json();return $(U),U?.user||null}}catch(W){se.error(`Fetching user failed: ${W.message}`)}return null},[d,c,f.language,$]),H=et(B);v1(()=>{H()},[n]);let z=et(V);return v1(()=>{async function W(){await z(),D(!0)}W()},[]),v1(()=>{!g&&i&&!i.prefillOnly&&z()},[g,i]),v1(()=>()=>{clearTimeout(T.current),clearTimeout(R.current),clearTimeout(P.current)},[]),!g&&!A?null:VV(k_,{value:{fetchFullUser:V,logOut:k,permissions:w,refreshCookie:B,refreshCookieAsync:j,refreshPermissions:O,setPermissions:S,setUser:$,token:v,tokenExpirationMs:y,user:g},children:t})}var ye=()=>zV(k_);var H_=O_({}),z_=O_({localeIsLoading:!1,setLocaleIsLoading:t=>{}}),JV=async(t,e)=>await fetch(`${e}/payload-preferences/${t}`,{credentials:"include",headers:{"Content-Type":"application/json"},method:"GET"})?.then(o=>o.json()),tC=t=>{let e=WV(28),{children:o,locale:n}=t,{config:r}=G(),{localization:s,routes:i}=r,a=s===void 0?!1:s,{api:l}=i,{user:c}=ye(),u=a?a.defaultLocale:"en",d=lt(),f;e[0]!==d?(f=d.get("locale"),e[0]=d,e[1]=f):f=e[1];let m=f,p;e[2]!==u||e[3]!==n||e[4]!==m||e[5]!==a?(p=()=>!a||a&&!a.locales.length?{}:na(a,m)||na(a,n)||na(a,u)||na(a,a.locales[0].code),e[2]=u,e[3]=n,e[4]=m,e[5]=a,e[6]=p):p=e[6];let[h,g]=XV.useState(p),[b,v]=YV(!1),C=ZV(h),y,x;e[7]!==h?(y=()=>{h.code!==C.current.code&&v(!1),C.current=h},x=[h],e[7]=h,e[8]=y,e[9]=x):(y=e[8],x=e[9]),B_(y,x);let w;e[10]!==l?(w=UV({apiRoute:l,path:""}),e[10]=l,e[11]=w):w=e[11];let S=w,_;e[12]!==u||e[13]!==S||e[14]!==m||e[15]!==a||e[16]!==c?.id?(_=()=>{(async function(){if(a&&c?.id){let P=m||await JV("locale",S)?.then(qV),E=na(a,P)||na(a,u)||na(a,a?.locales?.[0]?.code);E&&g(E)}})()},e[12]=u,e[13]=S,e[14]=m,e[15]=a,e[16]=c?.id,e[17]=_):_=e[17];let I=c?.id,A;e[18]!==u||e[19]!==S||e[20]!==m||e[21]!==a||e[22]!==I?(A=[u,a,S,m,I],e[18]=u,e[19]=S,e[20]=m,e[21]=a,e[22]=I,e[23]=A):A=e[23],B_(_,A);let D;return e[24]!==o||e[25]!==b||e[26]!==h?(D=M_(H_,{value:h,children:M_(z_,{value:{localeIsLoading:b,setLocaleIsLoading:v},children:o})}),e[24]=o,e[25]=b,e[26]=h,e[27]=D):D=e[27],D},y1=()=>V_(z_),Ce=()=>V_(H_);function qV(t){return t.value}var C1=(t,e,o)=>{if(t)return`field-${t.replace(/\./g,"__")}${e>1?`-${e}`:""}${o?`-${o}`:""}`};var Fe=t=>{let{as:e,hideLocale:o,htmlFor:n,label:r,localized:s,path:i,required:a,unstyled:l}=t,c=e===void 0?"label":e,u=o===void 0?!1:o,d=s===void 0?!1:s,f=a===void 0?!1:a,m=l===void 0?!1:l,{uuid:p}=Ge(),h=vt(),g=n||C1(i,h,p),{i18n:b}=N(),{code:v,label:C}=Ce(),y=c==="label"?g?"label":"span":c||"span";return r?G_(y,{className:`field-label${m?" unstyled":""}`,htmlFor:g,children:[KV(r,b),f&&!m&&QV("span",{className:"required",children:"*"}),d&&!u&&G_("span",{className:"localized",children:["\u2014 ",typeof C=="string"?C:v]})]}):null};var x1=({collapsed:t,rowID:e,rows:o})=>o.reduce((n,r)=>(e===r.id&&(r.collapsed=t),r.collapsed&&n.collapsedIDs.push(r.id),n.updatedRows.push(r),n),{collapsedIDs:[],updatedRows:[]}),w1=({collapsed:t,rows:e})=>e.reduce((o,n)=>(n.collapsed=t,t&&o.collapsedIDs.push(n.id),o.updatedRows.push(n),o),{collapsedIDs:[],updatedRows:[]});import{c as nz}from"react/compiler-runtime";import{jsx as UI}from"react/jsx-runtime";import*as XI from"react";import{jsx as bm,jsxs as ez}from"react/jsx-runtime";import{rtlLanguages as tz}from"@payloadcms/translations";import{useCallback as WI,useMemo as oz}from"react";import{c as UH}from"react/compiler-runtime";import hC,{useRef as OI}from"react";import{c as eH}from"react/compiler-runtime";import{useEffect as tH,useRef as oH}from"react";var pl=(t,e,o)=>{let n=eH(9),r;n[0]!==o?(r=o===void 0?[]:o,n[0]=o,n[1]=r):r=n[1];let s=r,i;n[2]===Symbol.for("react.memo_cache_sentinel")?(i=Date.now(),n[2]=i):i=n[2];let a=oH(i),l;n[3]!==t||n[4]!==e?(l=()=>{let u=setTimeout(()=>{Date.now()-a.current>=e&&(t(),a.current=Date.now())},e-(Date.now()-a.current));return()=>{clearTimeout(u)}},n[3]=t,n[4]=e,n[5]=l):l=n[5];let c;n[6]!==e||n[7]!==s?(c=[e,...s],n[6]=e,n[7]=s,n[8]=c):c=n[8],tH(l,c)};import{jsx as A1}from"react/jsx-runtime";import{formatAdminURL as jH}from"payload/shared";import*as kI from"qs-esm";import kH,{createContext as MH,use as BH,useCallback as tu,useEffect as OH,useMemo as VH,useRef as jI,useState as pm}from"react";import{jsx as _H}from"react/jsx-runtime";import{createContext as IH,use as RH,useEffect as TH,useState as DH}from"react";import{getTranslation as SH}from"@payloadcms/translations";var rH={},dm={};function qc(t,e){try{let n=(rH[t]||=new Intl.DateTimeFormat("en-GB",{timeZone:t,hour:"numeric",timeZoneName:"longOffset"}).format)(e).split("GMT")[1]||"";return n in dm?dm[n]:W_(n,n.split(":"))}catch{if(t in dm)return dm[t];let o=t?.match(nH);return o?W_(t,o.slice(1)):NaN}}var nH=/([+-]\d\d):?(\d\d)?/;function W_(t,e){let o=+e[0],n=+(e[1]||0);return dm[t]=o>0?o*60+n:o*60-n}var ao=class t extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(qc(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),X_(this,NaN),oC(this)):this.setTime(Date.now())}static tz(e,...o){return o.length?new t(...o,e):new t(Date.now(),e)}withTimeZone(e){return new t(+this,e)}getTimezoneOffset(){return-qc(this.timeZone,this)}setTime(e){return Date.prototype.setTime.apply(this,arguments),oC(this),+this}[Symbol.for("constructDateFrom")](e){return new t(+new Date(e),this.timeZone)}},U_=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!U_.test(t))return;let e=t.replace(U_,"$1UTC");ao.prototype[e]&&(t.startsWith("get")?ao.prototype[t]=function(){return this.internal[e]()}:(ao.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),sH(this),+this},ao.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),oC(this),+this}))});function oC(t){t.internal.setTime(+t),t.internal.setUTCMinutes(t.internal.getUTCMinutes()-t.getTimezoneOffset())}function sH(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),X_(t)}function X_(t){let e=qc(t.timeZone,t),o=new Date(+t);o.setUTCHours(o.getUTCHours()-1);let n=-new Date(+t).getTimezoneOffset(),r=-new Date(+o).getTimezoneOffset(),s=n-r,i=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();s&&i&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+s);let a=n-e;a&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+a);let l=qc(t.timeZone,t),u=-new Date(+t).getTimezoneOffset()-l,d=l!==e,f=u-a;if(d&&f){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+f);let m=qc(t.timeZone,t),p=l-m;p&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+p),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+p))}}var iH=Math.pow(10,8)*24*60*60*1e3,n5e=-iH,S1=6048e5,Z_=864e5;var mm=43200,rC=1440;var aH=3600;var Y_=aH*24,s5e=Y_*7,lH=Y_*365.2425,cH=lH/12,i5e=cH*3,nC=Symbol.for("constructDateFrom");function Co(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&nC in t?t[nC](e):t instanceof Date?new t.constructor(e):new Date(e)}function ht(t,e){return Co(e||t,t)}var uH={};function bs(){return uH}function ri(t,e){let o=bs(),n=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0,r=ht(t,e?.in),s=r.getDay(),i=(s<n?7:0)+s-n;return r.setDate(r.getDate()-i),r.setHours(0,0,0,0),r}function hl(t,e){return ri(t,{...e,weekStartsOn:1})}function _1(t,e){let o=ht(t,e?.in),n=o.getFullYear(),r=Co(o,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);let s=hl(r),i=Co(o,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);let a=hl(i);return o.getTime()>=s.getTime()?n+1:o.getTime()>=a.getTime()?n:n-1}function Qc(t){let e=ht(t),o=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return o.setUTCFullYear(e.getFullYear()),+t-+o}function vs(t,...e){let o=Co.bind(null,t||e.find(n=>typeof n=="object"));return e.map(o)}function la(t,e){let o=ht(t,e?.in);return o.setHours(0,0,0,0),o}function J_(t,e,o){let[n,r]=vs(o?.in,t,e),s=la(n),i=la(r),a=+s-Qc(s),l=+i-Qc(i);return Math.round((a-l)/Z_)}function q_(t,e){let o=_1(t,e),n=Co(e?.in||t,0);return n.setFullYear(o,0,4),n.setHours(0,0,0,0),hl(n)}function Kc(t,e){let o=+ht(t)-+ht(e);return o<0?-1:o>0?1:o}function I1(t){return Co(t,Date.now())}function Q_(t,e,o){let[n,r]=vs(o?.in,t,e);return+la(n)==+la(r)}function K_(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function eI(t){return!(!K_(t)&&typeof t!="number"||isNaN(+ht(t)))}function tI(t,e,o){let[n,r]=vs(o?.in,t,e),s=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return s*12+i}function oI(t){return e=>{let n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function rI(t,e){return+ht(t)-+ht(e)}function R1(t,e){let o=ht(t,e?.in);return o.setHours(23,59,59,999),o}function nI(t,e){let o=ht(t,e?.in),n=o.getMonth();return o.setFullYear(o.getFullYear(),n+1,0),o.setHours(23,59,59,999),o}function sI(t,e){let o=ht(t,e?.in);return+R1(o,e)==+nI(o,e)}function iI(t,e,o){let[n,r,s]=vs(o?.in,t,t,e),i=Kc(r,s),a=Math.abs(tI(r,s));if(a<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*a);let l=Kc(r,s)===-i;sI(n)&&a===1&&Kc(n,s)===1&&(l=!1);let c=i*(a-+l);return c===0?0:c}function aI(t,e,o){let n=rI(t,e)/1e3;return oI(o?.roundingMethod)(n)}function lI(t,e){let o=ht(t,e?.in);return o.setFullYear(o.getFullYear(),0,1),o.setHours(0,0,0,0),o}function cI(t){return R1(Date.now(),t)}function uI(t,e){let o=ht(t,e?.in);return J_(o,lI(o))+1}function dI(t,e){let o=ht(t,e?.in),n=+hl(o)-+q_(o);return Math.round(n/S1)+1}function T1(t,e){let o=ht(t,e?.in),n=o.getFullYear(),r=bs(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,i=Co(e?.in||t,0);i.setFullYear(n+1,0,s),i.setHours(0,0,0,0);let a=ri(i,e),l=Co(e?.in||t,0);l.setFullYear(n,0,s),l.setHours(0,0,0,0);let c=ri(l,e);return+o>=+a?n+1:+o>=+c?n:n-1}function mI(t,e){let o=bs(),n=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,r=T1(t,e),s=Co(e?.in||t,0);return s.setFullYear(r,0,n),s.setHours(0,0,0,0),ri(s,e)}function fI(t,e){let o=ht(t,e?.in),n=+ri(o,e)-+mI(o,e);return Math.round(n/S1)+1}function wt(t,e){let o=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return o+n}var ni={y(t,e){let o=t.getFullYear(),n=o>0?o:1-o;return wt(e==="yy"?n%100:n,e.length)},M(t,e){let o=t.getMonth();return e==="M"?String(o+1):wt(o+1,2)},d(t,e){return wt(t.getDate(),e.length)},a(t,e){let o=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return o.toUpperCase();case"aaa":return o;case"aaaaa":return o[0];case"aaaa":default:return o==="am"?"a.m.":"p.m."}},h(t,e){return wt(t.getHours()%12||12,e.length)},H(t,e){return wt(t.getHours(),e.length)},m(t,e){return wt(t.getMinutes(),e.length)},s(t,e){return wt(t.getSeconds(),e.length)},S(t,e){let o=e.length,n=t.getMilliseconds(),r=Math.trunc(n*Math.pow(10,o-3));return wt(r,e.length)}};var eu={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},sC={G:function(t,e,o){let n=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return o.era(n,{width:"abbreviated"});case"GGGGG":return o.era(n,{width:"narrow"});case"GGGG":default:return o.era(n,{width:"wide"})}},y:function(t,e,o){if(e==="yo"){let n=t.getFullYear(),r=n>0?n:1-n;return o.ordinalNumber(r,{unit:"year"})}return ni.y(t,e)},Y:function(t,e,o,n){let r=T1(t,n),s=r>0?r:1-r;if(e==="YY"){let i=s%100;return wt(i,2)}return e==="Yo"?o.ordinalNumber(s,{unit:"year"}):wt(s,e.length)},R:function(t,e){let o=_1(t);return wt(o,e.length)},u:function(t,e){let o=t.getFullYear();return wt(o,e.length)},Q:function(t,e,o){let n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return wt(n,2);case"Qo":return o.ordinalNumber(n,{unit:"quarter"});case"QQQ":return o.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return o.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return o.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,o){let n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return wt(n,2);case"qo":return o.ordinalNumber(n,{unit:"quarter"});case"qqq":return o.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return o.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return o.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,o){let n=t.getMonth();switch(e){case"M":case"MM":return ni.M(t,e);case"Mo":return o.ordinalNumber(n+1,{unit:"month"});case"MMM":return o.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return o.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return o.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,o){let n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return wt(n+1,2);case"Lo":return o.ordinalNumber(n+1,{unit:"month"});case"LLL":return o.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return o.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return o.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,o,n){let r=fI(t,n);return e==="wo"?o.ordinalNumber(r,{unit:"week"}):wt(r,e.length)},I:function(t,e,o){let n=dI(t);return e==="Io"?o.ordinalNumber(n,{unit:"week"}):wt(n,e.length)},d:function(t,e,o){return e==="do"?o.ordinalNumber(t.getDate(),{unit:"date"}):ni.d(t,e)},D:function(t,e,o){let n=uI(t);return e==="Do"?o.ordinalNumber(n,{unit:"dayOfYear"}):wt(n,e.length)},E:function(t,e,o){let n=t.getDay();switch(e){case"E":case"EE":case"EEE":return o.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return o.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return o.day(n,{width:"short",context:"formatting"});case"EEEE":default:return o.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,o,n){let r=t.getDay(),s=(r-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return wt(s,2);case"eo":return o.ordinalNumber(s,{unit:"day"});case"eee":return o.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return o.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return o.day(r,{width:"short",context:"formatting"});case"eeee":default:return o.day(r,{width:"wide",context:"formatting"})}},c:function(t,e,o,n){let r=t.getDay(),s=(r-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return wt(s,e.length);case"co":return o.ordinalNumber(s,{unit:"day"});case"ccc":return o.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return o.day(r,{width:"narrow",context:"standalone"});case"cccccc":return o.day(r,{width:"short",context:"standalone"});case"cccc":default:return o.day(r,{width:"wide",context:"standalone"})}},i:function(t,e,o){let n=t.getDay(),r=n===0?7:n;switch(e){case"i":return String(r);case"ii":return wt(r,e.length);case"io":return o.ordinalNumber(r,{unit:"day"});case"iii":return o.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return o.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return o.day(n,{width:"short",context:"formatting"});case"iiii":default:return o.day(n,{width:"wide",context:"formatting"})}},a:function(t,e,o){let r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return o.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return o.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return o.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaa":default:return o.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,e,o){let n=t.getHours(),r;switch(n===12?r=eu.noon:n===0?r=eu.midnight:r=n/12>=1?"pm":"am",e){case"b":case"bb":return o.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return o.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return o.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return o.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,e,o){let n=t.getHours(),r;switch(n>=17?r=eu.evening:n>=12?r=eu.afternoon:n>=4?r=eu.morning:r=eu.night,e){case"B":case"BB":case"BBB":return o.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return o.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return o.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,e,o){if(e==="ho"){let n=t.getHours()%12;return n===0&&(n=12),o.ordinalNumber(n,{unit:"hour"})}return ni.h(t,e)},H:function(t,e,o){return e==="Ho"?o.ordinalNumber(t.getHours(),{unit:"hour"}):ni.H(t,e)},K:function(t,e,o){let n=t.getHours()%12;return e==="Ko"?o.ordinalNumber(n,{unit:"hour"}):wt(n,e.length)},k:function(t,e,o){let n=t.getHours();return n===0&&(n=24),e==="ko"?o.ordinalNumber(n,{unit:"hour"}):wt(n,e.length)},m:function(t,e,o){return e==="mo"?o.ordinalNumber(t.getMinutes(),{unit:"minute"}):ni.m(t,e)},s:function(t,e,o){return e==="so"?o.ordinalNumber(t.getSeconds(),{unit:"second"}):ni.s(t,e)},S:function(t,e){return ni.S(t,e)},X:function(t,e,o){let n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return hI(n);case"XXXX":case"XX":return gl(n);case"XXXXX":case"XXX":default:return gl(n,":")}},x:function(t,e,o){let n=t.getTimezoneOffset();switch(e){case"x":return hI(n);case"xxxx":case"xx":return gl(n);case"xxxxx":case"xxx":default:return gl(n,":")}},O:function(t,e,o){let n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+pI(n,":");case"OOOO":default:return"GMT"+gl(n,":")}},z:function(t,e,o){let n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+pI(n,":");case"zzzz":default:return"GMT"+gl(n,":")}},t:function(t,e,o){let n=Math.trunc(+t/1e3);return wt(n,e.length)},T:function(t,e,o){return wt(+t,e.length)}};function pI(t,e=""){let o=t>0?"-":"+",n=Math.abs(t),r=Math.trunc(n/60),s=n%60;return s===0?o+String(r):o+String(r)+e+wt(s,2)}function hI(t,e){return t%60===0?(t>0?"-":"+")+wt(Math.abs(t)/60,2):gl(t,e)}function gl(t,e=""){let o=t>0?"-":"+",n=Math.abs(t),r=wt(Math.trunc(n/60),2),s=wt(n%60,2);return o+r+e+s}var gI=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},bI=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},dH=(t,e)=>{let o=t.match(/(P+)(p+)?/)||[],n=o[1],r=o[2];if(!r)return gI(t,e);let s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",gI(n,e)).replace("{{time}}",bI(r,e))},vI={p:bI,P:dH};var mH=/^D+$/,fH=/^Y+$/,pH=["D","DD","YY","YYYY"];function yI(t){return mH.test(t)}function CI(t){return fH.test(t)}function xI(t,e,o){let n=hH(t,e,o);if(console.warn(n),pH.includes(t))throw new RangeError(n)}function hH(t,e,o){let n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${n} to the input \`${o}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var gH=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,bH=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,vH=/^'([^]*?)'?$/,yH=/''/g,CH=/[a-zA-Z]/;function iC(t,e,o){let n=bs(),r=o?.locale??n.locale??Ud,s=o?.firstWeekContainsDate??o?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=o?.weekStartsOn??o?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,a=ht(t,o?.in);if(!eI(a))throw new RangeError("Invalid time value");let l=e.match(bH).map(u=>{let d=u[0];if(d==="p"||d==="P"){let f=vI[d];return f(u,r.formatLong)}return u}).join("").match(gH).map(u=>{if(u==="''")return{isToken:!1,value:"'"};let d=u[0];if(d==="'")return{isToken:!1,value:xH(u)};if(sC[d])return{isToken:!0,value:u};if(d.match(CH))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});r.localize.preprocessor&&(l=r.localize.preprocessor(a,l));let c={firstWeekContainsDate:s,weekStartsOn:i,locale:r};return l.map(u=>{if(!u.isToken)return u.value;let d=u.value;(!o?.useAdditionalWeekYearTokens&&CI(d)||!o?.useAdditionalDayOfYearTokens&&yI(d))&&xI(d,e,String(t));let f=sC[d[0]];return f(a,d,r.localize,c)}).join("")}function xH(t){let e=t.match(vH);return e?e[1].replace(yH,"'"):t}function wI(t,e,o){let n=bs(),r=o?.locale??n.locale??Ud,s=2520,i=Kc(t,e);if(isNaN(i))throw new RangeError("Invalid time value");let a=Object.assign({},o,{addSuffix:o?.addSuffix,comparison:i}),[l,c]=vs(o?.in,...i>0?[e,t]:[t,e]),u=aI(c,l),d=(Qc(c)-Qc(l))/1e3,f=Math.round((u-d)/60),m;if(f<2)return o?.includeSeconds?u<5?r.formatDistance("lessThanXSeconds",5,a):u<10?r.formatDistance("lessThanXSeconds",10,a):u<20?r.formatDistance("lessThanXSeconds",20,a):u<40?r.formatDistance("halfAMinute",0,a):u<60?r.formatDistance("lessThanXMinutes",1,a):r.formatDistance("xMinutes",1,a):f===0?r.formatDistance("lessThanXMinutes",1,a):r.formatDistance("xMinutes",f,a);if(f<45)return r.formatDistance("xMinutes",f,a);if(f<90)return r.formatDistance("aboutXHours",1,a);if(f<rC){let p=Math.round(f/60);return r.formatDistance("aboutXHours",p,a)}else{if(f<s)return r.formatDistance("xDays",1,a);if(f<mm){let p=Math.round(f/rC);return r.formatDistance("xDays",p,a)}else if(f<mm*2)return m=Math.round(f/mm),r.formatDistance("aboutXMonths",m,a)}if(m=iI(c,l),m<12){let p=Math.round(f/mm);return r.formatDistance("xMonths",p,a)}else{let p=m%12,h=Math.trunc(m/12);return p<3?r.formatDistance("aboutXYears",h,a):p<9?r.formatDistance("overXYears",h,a):r.formatDistance("almostXYears",h+1,a)}}function SI(t,e){return wI(t,I1(t),e)}function $n(t,e){let o=wH(e)?new e(0):Co(e,0);return o.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),o.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),o}function wH(t){return typeof t=="function"&&t.prototype?.constructor===t}function _I(t,e){return Q_(Co(e?.in||t,t),I1(e?.in||t))}var lo=({date:t,i18n:e,pattern:o,timezone:n})=>{let r=new ao(new Date(t));if(n){let s=ao.tz(n),i=r.withTimeZone(n),a=$n(i,s);return e.dateFNS?iC(a,o,{locale:e.dateFNS}):`${e.t("general:loading")}...`}return e.dateFNS?iC(r,o,{locale:e.dateFNS}):`${e.t("general:loading")}...`},ca=({date:t,i18n:e})=>{let o=typeof t=="string"?new Date(t):t;return e?.dateFNS?SI(o,{locale:e.dateFNS}):""};function aC(t){return typeof t=="object"&&"root"in t}function D1(t,e){for(let o of t)"text"in o&&o.text?e+=o.text:"children"in o||(e+=`[${o.type}]`),"children"in o&&o.children&&(e+=D1(o.children,e));return e}var II=t=>Array.isArray(t)?t.map(e=>typeof e=="object"&&e!==null?e.id:String(e)).filter(Boolean).join(", "):typeof t=="object"&&t!==null?t.id||"":String(t);var Br=({collectionConfig:t,data:e,dateFormat:o,fallback:n,globalConfig:r,i18n:s})=>{let i;if(t){let a=t?.admin?.useAsTitle;if(a&&(i=e?.[a],i)){let l=t.fields.find(d=>"name"in d&&d.name===a),c=l?.type==="date",u=l?.type==="relationship";if(c){let d="date"in l.admin&&l?.admin?.date?.displayFormat||o;i=lo({date:i,i18n:s,pattern:d})||i}u&&(i=II(e[a]))}}return r&&(i=SH(r?.label,s)||r?.slug),i&&aC(i)&&(i=D1(i.root.children?.[0]?.children||[],"")),!i&&aC(n)&&(i=D1(n.root.children?.[0]?.children||[],"")),i||(i=typeof n=="string"?n:`[${s.t("general:untitled")}]`),i};var RI=IH({}),zo=()=>RH(RI),TI=({children:t})=>{let{id:e,collectionSlug:o,data:n,docConfig:r,globalSlug:s,initialData:i}=be(),{config:{admin:{dateFormat:a}}}=G(),{i18n:l}=N(),[c,u]=DH(()=>Br({collectionConfig:o?r:void 0,data:{...i||{},id:e},dateFormat:a,fallback:e?.toString(),globalConfig:s?r:void 0,i18n:l}));return TH(()=>{u(Br({collectionConfig:o?r:void 0,data:{...n,id:e},dateFormat:a,fallback:e?.toString(),globalConfig:s?r:void 0,i18n:l}))},[n,a,l,e,o,r,s]),_H(RI,{value:{setDocumentTitle:u,title:c},children:t})};import{jsx as AH}from"react/jsx-runtime";import{dequal as DI}from"dequal/lite";import{formatAdminURL as cC}from"payload/shared";import{createContext as PH,use as FH,useCallback as AI,useEffect as NH,useRef as uC}from"react";function lC(t,e){let o={...t};for(let n in e)n==="__proto__"||n==="constructor"||n==="prototype"||Object.prototype.hasOwnProperty.call(e,n)&&(typeof e[n]=="object"&&!Array.isArray(e[n])&&t[n]?o[n]=lC(t[n],e[n]):o[n]=e[n]);return o}var FI=PH({}),PI=(t,e)=>({body:JSON.stringify({value:t}),headers:{"Accept-Language":e,"Content-Type":"application/json"}}),dC=({children:t})=>{let e=uC({}),o=uC({}),n=uC({}),{config:r}=G(),{user:s}=ye(),{i18n:i}=N(),{routes:{api:a}}=r;NH(()=>{s||(o.current={})},[s]);let l=AI(async u=>{let d=o.current;if(typeof d[u]<"u")return d[u];let f=new Promise(m=>{(async()=>{let p=await We.get(cC({apiRoute:a,path:`/payload-preferences/${u}`}),{credentials:"include",headers:{"Accept-Language":i.language}}),h=null;p.status===200&&(h=(await p.json()).value),o.current[u]=h,m(h)})()});return d[u]=f,f},[i.language,a,o]),c=AI(async(u,d,f=!1)=>{if(f===!1){o.current[u]=d,await We.post(cC({apiRoute:a,path:`/payload-preferences/${u}`}),PI(d,i.language));return}let m=d,p=await l(u);if(typeof d=="object"&&typeof p=="object"&&typeof m=="object"){if(p&&(m=lC(p,m)),DI(m,p))return;n.current[u]={...n.current[u],...m}}else{if(m===p)return;n.current[u]=m}let h=async()=>{DI(n.current[u],o.current[u])||(o.current[u]=n.current[u],await We.post(cC({apiRoute:a,path:`/payload-preferences/${u}`}),PI(o.current[u],i.language)),delete n.current[u])};setTimeout(()=>{h()})},[a,l,i.language,n]);return e.current.getPreference=l,e.current.setPreference=c,AH(FI,{value:e.current,children:t})},Jt=()=>FH(FI);import{c as EH}from"react/compiler-runtime";import{jsx as LH}from"react/jsx-runtime";import mC from"react";var NI=mC.createContext({getUploadEdits:()=>{},resetUploadEdits:void 0,updateUploadEdits:void 0,uploadEdits:void 0}),fC=t=>{let e=EH(10),{children:o,initialUploadEdits:n}=t,r;e[0]!==n?(r=n||{},e[0]=n,e[1]=r):r=e[1];let[s,i]=mC.useState(r),a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{i({})},e[2]=a):a=e[2];let l=a,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=p=>{i(h=>({...h||{},...p||{}}))},e[3]=c):c=e[3];let u=c,d;e[4]!==s?(d=()=>s,e[4]=s,e[5]=d):d=e[5];let f=d,m;return e[6]!==o||e[7]!==f||e[8]!==s?(m=LH(NI,{value:{getUploadEdits:f,resetUploadEdits:l,updateUploadEdits:u,uploadEdits:s},children:o}),e[6]=o,e[7]=f,e[8]=s,e[9]=m):m=e[9],m},bl=()=>mC.use(NI);import{formatAdminURL as LI}from"payload/shared";import*as pC from"qs-esm";import $H from"react";var fm=t=>{let{collectionSlug:e,docPermissions:o,globalSlug:n,isEditing:r}=t;return e?!!(r&&o?.update||!r&&o?.create):n?!!o?.update:!1};var EI=({id:t,collectionSlug:e,globalSlug:o})=>!!(o||e&&t);var $I=({id:t,api:e,collectionSlug:o,globalSlug:n,i18n:r,locale:s,permissions:i,setDocPermissions:a,setHasPublishPermission:l,setHasSavePermission:c})=>$H.useCallback(async u=>{let d={locale:s||void 0},f=u?.id||t,m=EI({id:f,collectionSlug:o,globalSlug:n});if(m){let p=o?`/${o}/access/${f}`:n?`/globals/${n}/access`:null;if(p){let g=await(await fetch(LI({apiRoute:e,path:`${p}${pC.stringify(d,{addQueryPrefix:!0})}`}),{body:JSON.stringify({...u?.doc||u||{},_status:"draft"}),credentials:"include",headers:{"Accept-Language":r.language,"Content-Type":"application/json"},method:"post"})).json(),b=await fetch(LI({apiRoute:e,path:`${p}${pC.stringify(d,{addQueryPrefix:!0})}`}),{body:JSON.stringify({...u?.doc||u||{},_status:"published"}),credentials:"include",headers:{"Accept-Language":r.language,"Content-Type":"application/json"},method:"POST"}).then(v=>v.json());a(g),c(fm({collectionSlug:o,docPermissions:g,globalSlug:n,isEditing:m})),l(b?.update)}}else{let p=o?i?.collections?.[o]:i?.globals?.[n];a(p),c(fm({collectionSlug:o,docPermissions:p,globalSlug:n,isEditing:m}))}},[s,t,o,n,e,r.language,a,c,l,i?.collections,i?.globals]);var MI=MH({}),be=()=>BH(MI),HH=({children:t,...e})=>{let{id:o,collectionSlug:n,currentEditor:r,docPermissions:s,globalSlug:i,hasPublishedDoc:a,hasPublishPermission:l,hasSavePermission:c,hasScheduledPublish:u,initialData:d,initialState:f,isLocked:m,lastUpdateTime:p,mostRecentVersionIsAutosaved:h,unpublishedVersionCount:g,versionCount:b}=e,[v,C]=Lr(s),[y,x]=Lr(c),[w,S]=Lr(l),{permissions:_}=ye(),{config:{admin:{dateFormat:I},collections:A,routes:{api:D}},getEntityConfig:T}=G(),R=T({collectionSlug:n}),P=T({globalSlug:i}),E=A.some(De=>De.slug==="payload-locked-documents"),F=jI(new AbortController),L=R||P,{i18n:M}=N(),{uploadEdits:$}=bl(),[B,j]=pm(h),[k,O]=pm(b),[V,H]=pm(a),[z,W]=pm(g),[U,X]=pm(!!u),[Q,J]=Lr(m),[oe,Y]=Lr(r),[K,ee]=Lr(p),[te,re]=Lr(d),[me,we]=Lr("idle"),Ae=jI({hasShownLockedModal:!1,isLocked:!1,user:null}),de=tu(De=>{we(De)},[we]),{getPreference:xe,setPreference:$e}=Jt(),{code:Le}=Ce(),{localeIsLoading:rt}=y1(),q=VH(()=>f===void 0||d===void 0||rt,[d,f,rt]),pe=jH({apiRoute:D,path:""}),fe,Pe,ge;i&&(fe=i,Pe="globals",ge=`global-${fe}`),n&&(fe=n,Pe="collections",o&&(ge=`collection-${fe}-${o}`));let ae=tu(async(De,it)=>{if(E)try{let pt=it===i,Vt=await We.get(`${pe}/payload-locked-documents`,{credentials:"include",params:pt?{"where[globalSlug][equals]":it}:{"where[document.relationTo][equals]":it,"where[document.value][equals]":De}}),{docs:Nt}=await Vt.json();if(Nt?.length>0){let Do=Nt[0].id;await We.delete(`${pe}/payload-locked-documents/${Do}`,{credentials:"include",headers:{"Content-Type":"application/json"}}),J(!1)}}catch(pt){console.error("Failed to unlock the document",pt)}},[pe,i,J,E]),Se=tu(async(De,it,pt)=>{if(E)try{let Vt=it===i,Nt=await We.get(`${pe}/payload-locked-documents`,{credentials:"include",params:Vt?{"where[globalSlug][equals]":it}:{"where[document.relationTo][equals]":it,"where[document.value][equals]":De}}),{docs:Do}=await Nt.json();if(Do?.length>0){let Be=Do[0].id,qe=typeof pt=="object"?{relationTo:pt.collection,value:pt.id}:{relationTo:"users",value:pt};await We.patch(`${pe}/payload-locked-documents/${Be}`,{body:JSON.stringify({user:qe}),credentials:"include",headers:{"Content-Type":"application/json"}})}}catch(Vt){console.error("Failed to update the document editor",Vt)}},[pe,i,E]),ne=$I({id:o,api:D,collectionSlug:n,globalSlug:i,i18n:M,locale:Le,permissions:_,setDocPermissions:C,setHasPublishPermission:S,setHasSavePermission:x}),Te=tu(()=>xe(ge),[xe,ge]),he=tu(async(De,it)=>{let pt=await Te();if(ge)try{await $e(ge,{...pt,fields:{...pt?.fields||{},[De]:{...pt?.fields?.[De],...it}}})}catch(Vt){console.error(Vt)}},[$e,ge,Te]),_e=tu(()=>{let De=k+1;R&&R.versions?R.versions.maxPerDoc>0?O(Math.min(De,R.versions.maxPerDoc)):O(De):P&&P.versions&&(P.versions.max>0?O(Math.min(De,P.versions.max)):O(De))},[R,P,k]);OH(()=>{let De=F.current;return()=>{if(De)try{De.abort()}catch{}}},[]);let Ze=kH.useMemo(()=>{let De=`${Pe==="globals"?"/globals":""}/${fe}${o?`/${o}`:""}`;return`${pe}${De}${kI.stringify({depth:0,"fallback-locale":"null",locale:Le,uploadEdits:$||void 0},{addQueryPrefix:!0})}`},[pe,Le,Pe,o,fe,$]),ut={...e,action:Ze,currentEditor:oe,data:te,docConfig:L,docPermissions:v,documentIsLocked:Q,documentLockState:Ae,getDocPermissions:ne,getDocPreferences:Te,hasPublishedDoc:V,hasPublishPermission:w,hasSavePermission:y,hasScheduledPublish:U,incrementVersionCount:_e,initialData:d,initialState:f,isInitializing:q,lastUpdateTime:K,mostRecentVersionIsAutosaved:B,preferencesKey:ge,savedDocumentData:te,setCurrentEditor:Y,setData:re,setDocFieldPreferences:he,setDocumentIsLocked:J,setHasPublishedDoc:H,setHasScheduledPublish:X,setLastUpdateTime:ee,setMostRecentVersionIsAutosaved:j,setUnpublishedVersionCount:W,setUploadStatus:de,unlockDocument:ae,unpublishedVersionCount:z,updateDocumentEditor:Se,updateSavedDocumentData:re,uploadStatus:me,versionCount:k};return A1(MI,{value:ut,children:A1(TI,{children:t})})},hm=t=>A1(fC,{children:A1(HH,{...t})});import{jsx as zH}from"react/jsx-runtime";import{createContext as GH,use as WH}from"react";var P1=GH(""),vl=({children:t,operation:e})=>zH(P1,{value:e,children:t}),qr=()=>WH(P1);import BI from"react";var si=BI.createContext(void 0),F1=()=>{let t=BI.useContext(si);if(t)return t};var XH=t=>{let e=UH(65),o;e[0]!==t?(o=t||{},e[0]=t,e[1]=o):o=e[1];let{disableFormData:n,hasRows:r,path:s,potentiallyStalePath:i,validate:a}=o,l=n===void 0?!1:n,c=F1(),u=s||c||i,d=vo(),f=mn(),m=Xs(),{user:p}=ye(),{id:h,collectionSlug:g}=be(),b=qr(),v=Ht(ZH),C;e[2]!==u?(C=te=>{let[re]=te;return re&&re?.[u]||null},e[2]=u,e[3]=C):C=e[3];let y=Ht(C),{t:x}=N(),{config:w}=G(),{getData:S,getDataByPath:_,getSiblingData:I,setModified:A}=Ge(),D=$c(),T=y?.filterOptions,R=y?.value,P=y?.initialValue,E=typeof y?.valid=="boolean"?y.valid:!0,F=E===!1&&d,L=OI(E),M=OI(y?.errorMessage),$;e[4]!==u?($=u?u.split("."):[],e[4]=u,e[5]=$):$=e[5];let B=$,j;e[6]!==l||e[7]!==v||e[8]!==r||e[9]!==u||e[10]!==A?(j=(te,re)=>{let me=re===void 0?!1:re,Ae=te&&typeof te=="object"&&typeof te.preventDefault=="function"&&typeof te.stopPropagation=="function"?te.target.value:te;v({type:"UPDATE",disableFormData:l||r&&Ae>0,path:u,value:Ae}),me||A(!0)},e[6]=l,e[7]=v,e[8]=r,e[9]=u,e[10]=A,e[11]=j):j=e[11];let k=j,O=y?.blocksFilterOptions,V=y?.customComponents,H=f||m,z=y?.errorMessage,W;e[12]!==y?.errorPaths?(W=y?.errorPaths||[],e[12]=y?.errorPaths,e[13]=W):W=e[13];let U=y?.rows,X=y?.selectFilterOptions,Q=y?.valid,J;e[14]!==T||e[15]!==P||e[16]!==m||e[17]!==u||e[18]!==f||e[19]!==k||e[20]!==F||e[21]!==d||e[22]!==U||e[23]!==X||e[24]!==Q||e[25]!==O||e[26]!==V||e[27]!==H||e[28]!==z||e[29]!==W||e[30]!==R?(J={blocksFilterOptions:O,customComponents:V,disabled:H,errorMessage:z,errorPaths:W,filterOptions:T,formInitializing:m,formProcessing:f,formSubmitted:d,initialValue:P,path:u,rows:U,selectFilterOptions:X,setValue:k,showError:F,valid:Q,value:R},e[14]=T,e[15]=P,e[16]=m,e[17]=u,e[18]=f,e[19]=k,e[20]=F,e[21]=d,e[22]=U,e[23]=X,e[24]=Q,e[25]=O,e[26]=V,e[27]=H,e[28]=z,e[29]=W,e[30]=R,e[31]=J):J=e[31];let oe=J,Y;e[32]!==g||e[33]!==w||e[34]!==l||e[35]!==v||e[36]!==D||e[37]!==y||e[38]!==S||e[39]!==_||e[40]!==I||e[41]!==r||e[42]!==h||e[43]!==b||e[44]!==u||e[45]!==B||e[46]!==x||e[47]!==p||e[48]!==a||e[49]!==R?(Y=()=>{(async()=>{let re=R;y?.rows&&Array.isArray(y.rows)&&(re=_(u));let me=M.current,we=L.current,Ae=S(),de=typeof a=="function"?await a(re,{id:h,blockData:void 0,collectionSlug:g,data:D?.getData?D.getData():Ae,event:"onChange",operation:b,path:B,preferences:{},req:{payload:{config:w},t:x,user:p},siblingData:I(u)}):typeof M.current=="string"?M.current:L.current;if(typeof de=="string"?(we=!1,me=de):typeof de=="boolean"&&(we=de,me=void 0),we!==L.current||me!==M.current){L.current=we,M.current=me;let xe={type:"UPDATE",errorMessage:me,path:u,rows:y?.rows,valid:we,validate:a,value:R};(l||r&&typeof R=="number"&&R>0)&&(xe.disableFormData=!0),typeof v=="function"&&v(xe)}})()},e[32]=g,e[33]=w,e[34]=l,e[35]=v,e[36]=D,e[37]=y,e[38]=S,e[39]=_,e[40]=I,e[41]=r,e[42]=h,e[43]=b,e[44]=u,e[45]=B,e[46]=x,e[47]=p,e[48]=a,e[49]=R,e[50]=Y):Y=e[50];let K=y?.rows,ee;return e[51]!==g||e[52]!==l||e[53]!==v||e[54]!==S||e[55]!==_||e[56]!==I||e[57]!==h||e[58]!==b||e[59]!==u||e[60]!==K||e[61]!==p||e[62]!==a||e[63]!==R?(ee=[R,l,v,S,I,_,h,b,u,p,a,K,g],e[51]=g,e[52]=l,e[53]=v,e[54]=S,e[55]=_,e[56]=I,e[57]=h,e[58]=b,e[59]=u,e[60]=K,e[61]=p,e[62]=a,e[63]=R,e[64]=ee):ee=e[64],pl(Y,150,ee),oe},VI=hC.createContext(void 0),Ne=t=>{let e=F1(),o=hC.use(VI),n=hC.useRef(null);if(n.current===null){let r=t?.path||e||t?.potentiallyStalePath;n.current=!!(o&&r&&o.path===r)}if(n.current===!0){if(!o)throw new Error("FieldContext was removed after mount. This breaks hook ordering.");return o}return XH(t)};function ZH(t){let[,e]=t;return e}import{jsx as HI}from"react/jsx-runtime";import"react";import{c as YH}from"react/compiler-runtime";var gC=t=>{let e=YH(2),{children:o,path:n}=t,r;e[0]!==n?(r=a=>{let[l]=a;return l&&l?.[n]||null},e[0]=n,e[1]=r):r=e[1];let s=Ht(r),{passesCondition:i}=s||{};return i===!1?null:o};var Je=t=>o=>{let{path:n}=o;return HI(gC,{path:n,children:HI(t,{...o})})};var st=t=>({...t?.admin?.style||{},...t?.admin?.width?{"--field-width":t.admin.width}:{flex:"1 1 0%"},...t?.admin?.style?.flex?{flex:t.admin.style.flex}:{}});var Ee="field-type";function yl({fieldLocalized:t,fieldRTL:e,locale:o,localizationConfig:n}){let r=o&&n&&n.locales&&n.locales.length>1,s=o?.code===n?.defaultLocale;return e!==!1&&o?.rtl===!0&&(t||!t&&!r||!t&&s)||e===!0}import{c as qH}from"react/compiler-runtime";import{jsx as ou,jsxs as N1}from"react/jsx-runtime";import{useEffect as QH,useId as KH,useState as GI}from"react";import{jsx as zI}from"react/jsx-runtime";import"react";var JH={16:"M4 7.5H12V8.5H4Z",24:"M6 11.5H18V12.5H6Z"},gm=({className:t,size:e=24})=>zI("svg",{className:["icon","icon--line",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:zI("path",{clipRule:"evenodd",d:JH[e],fill:"currentColor",fillRule:"evenodd"})});var ii="checkbox-input",Ft=t=>{let e=qH(35),{id:o,name:n,AfterInput:r,BeforeInput:s,checked:i,className:a,Error:l,inputRef:c,Label:u,label:d,localized:f,onToggle:m,partialChecked:p,readOnly:h,required:g,tooltip:b,variant:v}=t,C=v===void 0?"default":v,[y,x]=GI(!1),[w,S]=GI(!1),_=KH(),I=o||_,A,D;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{x(!0)},D=[],e[0]=A,e[1]=D):(A=e[0],D=e[1]),QH(A,D);let T=h||!y,R=i&&`${ii}--checked`,P=T&&`${ii}--read-only`,E=b&&`${ii}--has-tooltip`,F=C!=="default"&&`${ii}--${C}`,L;e[2]!==a||e[3]!==R||e[4]!==P||e[5]!==E||e[6]!==F?(L=[a,ii,R,P,E,F].filter(Boolean),e[2]=a,e[3]=R,e[4]=P,e[5]=E,e[6]=F,e[7]=L):L=e[7];let M=L.join(" "),$;e[8]!==b?($=b?()=>S(!0):void 0,e[8]=b,e[9]=$):$=e[9];let B;e[10]!==b?(B=b?()=>S(!1):void 0,e[10]=b,e[11]=B):B=e[11];let j=!!i,k;if(e[12]!==r||e[13]!==s||e[14]!==l||e[15]!==u||e[16]!==i||e[17]!==I||e[18]!==c||e[19]!==d||e[20]!==f||e[21]!==n||e[22]!==m||e[23]!==p||e[24]!==T||e[25]!==g||e[26]!==w||e[27]!==$||e[28]!==B||e[29]!==j||e[30]!==M||e[31]!==b){let O=ou("input",{"aria-label":"","aria-labelledby":n,checked:j,disabled:T,id:I,name:n,onChange:m,ref:c,required:g,title:n,type:"checkbox"}),V=!i&&p?"partial":"check",H;e[33]!==V?(H=[`${ii}__icon`,V].filter(Boolean),e[33]=V,e[34]=H):H=e[34],k=N1("div",{className:M,onPointerEnter:$,onPointerLeave:B,children:[s,N1("div",{className:`${ii}__wrap`,children:[N1("div",{className:`${ii}__input`,children:[O,N1("span",{className:H.join(" "),children:[i&&ou(Vo,{}),!i&&p&&ou(gm,{})]})]}),ou(le,{CustomComponent:u,Fallback:ou(Fe,{htmlFor:I,label:d,localized:f,required:g})}),l]}),b&&ou(io,{alignCaret:"left",className:`${ii}__tooltip`,show:w,children:b}),r]}),e[12]=r,e[13]=s,e[14]=l,e[15]=u,e[16]=i,e[17]=I,e[18]=c,e[19]=d,e[20]=f,e[21]=n,e[22]=m,e[23]=p,e[24]=T,e[25]=g,e[26]=w,e[27]=$,e[28]=B,e[29]=j,e[30]=M,e[31]=b,e[32]=k}else k=e[32];return k};var bC="checkbox";var rz=t=>{let{id:e,checked:o,disableFormData:n,field:r,field:{admin:{className:s,description:i}={},label:a,required:l}={},onChange:c,partialChecked:u,path:d,readOnly:f,validate:m}=t,{uuid:p}=Ge(),h=vt(),{i18n:{language:g}}=N(),b=tz.includes(g),v=WI((L,M)=>{if(typeof m=="function")return m(L,{...M,required:l})},[m,l]),{customComponents:{AfterInput:C,BeforeInput:y,Description:x,Error:w,Label:S}={},disabled:_,path:I,setValue:A,showError:D,value:T}=Ne({disableFormData:n,potentiallyStalePath:d,validate:v}),R=WI(()=>{f||(A(!T),typeof c=="function"&&c(!T))},[c,f,A,T]),P=o||!!T,E=e||C1(I,h,p),F=oz(()=>st(r),[r]);return ez("div",{className:[Ee,bC,D&&"error",s,T&&`${bC}--checked`,(f||_)&&`${bC}--read-only`].filter(Boolean).join(" "),style:F,children:[bm(Ft,{AfterInput:C,BeforeInput:y,checked:P,Error:bm(le,{CustomComponent:w,Fallback:bm(tt,{alignCaret:b?"right":"left",path:I,showError:D})}),id:E,inputRef:null,Label:S,label:a,name:I,onToggle:R,partialChecked:u,readOnly:f||_,required:l}),bm(le,{CustomComponent:x,Fallback:bm(Xe,{description:i,path:I})})]})},gr=Je(rz);var sz="nullify-locale-field",vm=t=>{let e=nz(13),{fieldValue:o,localized:n,path:r,readOnly:s}=t,i=s===void 0?!1:s,{code:a}=Ce(),{config:l}=G(),{localization:c}=l,[u,d]=XI.useState(typeof o!="number"),{t:f}=N(),{dispatchFields:m,setModified:p}=Ge();if(!n||!c||c.defaultLocale===a||!c.fallback)return null;let h;e[0]!==u||e[1]!==m||e[2]!==o||e[3]!==r||e[4]!==p?(h=()=>{let v=!u;m({type:"UPDATE",path:r,value:v?null:o||0}),p(!0),d(v)},e[0]=u,e[1]=m,e[2]=o,e[3]=r,e[4]=p,e[5]=h):h=e[5];let g=h;if(o){let v=!1;if(typeof o=="number"&&o>0&&(v=!0),Array.isArray(o)&&o.length>0&&(v=!0),v)return u&&d(!1),null}let b;return e[6]!==u||e[7]!==o||e[8]!==g||e[9]!==r||e[10]!==i||e[11]!==f?(b=UI(Xr,{className:sz,children:!o&&i?f("general:fallbackToDefaultLocale"):UI(gr,{checked:u,field:{name:"",label:f("general:fallbackToDefaultLocale")},id:`field-${r.replace(/\./g,"__")}`,onChange:g,path:r,schemaPath:""})}),e[6]=u,e[7]=o,e[8]=g,e[9]=r,e[10]=i,e[11]=f,e[12]=b):b=e[12],b};import{jsx as ZI}from"react/jsx-runtime";import"react";var iz={16:"M8 3C10.7614 3 13 5.23858 13 8C13 10.7614 10.7614 13 8 13C5.23858 13 3 10.7614 3 8C3 5.23858 5.23858 3 8 3ZM8 4C5.79086 4 4 5.79086 4 8C4 10.2091 5.79086 12 8 12C10.2091 12 12 10.2091 12 8C12 5.79086 10.2091 4 8 4ZM8 5.5C8.27614 5.5 8.5 5.72386 8.5 6V7.5H10C10.2761 7.5 10.5 7.72386 10.5 8C10.5 8.27614 10.2761 8.5 10 8.5H8.5V10C8.5 10.2761 8.27614 10.5 8 10.5C7.72386 10.5 7.5 10.2761 7.5 10V8.5H6C5.72386 8.5 5.5 8.27614 5.5 8C5.5 7.72386 5.72386 7.5 6 7.5H7.5V6C7.5 5.72386 7.72386 5.5 8 5.5Z",24:"M12 5C15.866 5 19 8.13401 19 12C19 15.866 15.866 19 12 19C8.13401 19 5 15.866 5 12C5 8.13401 8.13401 5 12 5ZM12 6C8.68629 6 6 8.68629 6 12C6 15.3137 8.68629 18 12 18C15.3137 18 18 15.3137 18 12C18 8.68629 15.3137 6 12 6ZM12 9C12.2761 9 12.5 9.22386 12.5 9.5V11.5H14.5C14.7761 11.5 15 11.7239 15 12C15 12.2761 14.7761 12.5 14.5 12.5H12.5V14.5C12.5 14.7761 12.2761 15 12 15C11.7239 15 11.5 14.7761 11.5 14.5V12.5H9.5C9.22386 12.5 9 12.2761 9 12C9 11.7239 9.22386 11.5 9.5 11.5H11.5V9.5C11.5 9.22386 11.7239 9 12 9Z"},ai=({className:t,size:e=24})=>ZI("svg",{className:["icon","icon--circle-plus",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ZI("path",{d:iz[e],fill:"currentColor"})});var ru=t=>{let e=document.getElementById(t);if(e){let o=e.getBoundingClientRect();window.scrollBy({behavior:"smooth",top:o.top-100})}};import{c as Yee}from"react/compiler-runtime";import{jsx as Ea,jsxs as Jee}from"react/jsx-runtime";import{getTranslation as qee}from"@payloadcms/translations";import"react";import{c as cz}from"react/compiler-runtime";import{jsx as tr,jsxs as qI}from"react/jsx-runtime";import uz from"react";import{jsx as YI}from"react/jsx-runtime";import"react";var az={16:"M8 12a.5.5 0 0 1-.5-.5V4.707L4.354 7.854a.5.5 0 1 1-.708-.707l4-4a.5.5 0 0 1 .708 0l4 4a.5.5 0 0 1-.708.707L8.5 4.707V11.5a.5.5 0 0 1-.5.5",24:"M12 16a.5.5 0 0 1-.5-.5V8.707l-3.146 3.147a.5.5 0 0 1-.708-.708l4-4a.5.5 0 0 1 .708 0l4 4a.5.5 0 0 1-.708.708L12.5 8.707V15.5a.5.5 0 0 1-.5.5"},E1=({className:t,direction:e="up",size:o=24})=>YI("svg",{className:["icon","icon--arrow",t].filter(Boolean).join(" "),fill:"none",height:o,style:{transform:e==="down"?"rotate(180deg)":void 0},viewBox:`0 0 ${o} ${o}`,width:o,xmlns:"http://www.w3.org/2000/svg",children:YI("path",{clipRule:"evenodd",d:az[o],fill:"currentColor",fillRule:"evenodd"})});import{jsx as JI}from"react/jsx-runtime";import"react";var lz={16:"M4 4h5v2H7a1 1 0 0 0-1 1v2H4zm8 2h-2V4a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h2v2a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1m0 1H7v5h5zm-2 1.5a.5.5 0 0 0-1 0V9h-.5a.5.5 0 0 0 0 1H9v.5a.5.5 0 0 0 1 0V10h.5a.5.5 0 0 0 0-1H10z",24:"M7.5 7h6a.5.5 0 0 1 .5.5V9h-3.5A1.5 1.5 0 0 0 9 10.5V14H7.5a.5.5 0 0 1-.5-.5v-6a.5.5 0 0 1 .5-.5m9 2H15V7.5A1.5 1.5 0 0 0 13.5 6h-6A1.5 1.5 0 0 0 6 7.5v6A1.5 1.5 0 0 0 7.5 15H9v1.5a1.5 1.5 0 0 0 1.5 1.5h6a1.5 1.5 0 0 0 1.5-1.5v-6A1.5 1.5 0 0 0 16.5 9m-6 1a.5.5 0 0 0-.5.5v6a.5.5 0 0 0 .5.5h6a.5.5 0 0 0 .5-.5v-6a.5.5 0 0 0-.5-.5zm3.5 2a.5.5 0 0 0-1 0v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1z"},vC=({className:t,size:e=24})=>JI("svg",{className:["icon","icon--duplicate",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:JI("path",{clipRule:"evenodd",d:lz[e],fill:"currentColor",fillRule:"evenodd"})});var br="array-actions",L1=t=>{let e=cz(12),{addRow:o,copyRow:n,duplicateRow:r,hasMaxRows:s,index:i,isSortable:a,moveRow:l,pasteRow:c,removeRow:u,rowCount:d}=t,{t:f}=N(),m;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s||e[4]!==i||e[5]!==a||e[6]!==l||e[7]!==c||e[8]!==u||e[9]!==d||e[10]!==f?(m=tr(Ve,{button:tr(il,{}),buttonClassName:`${br}__button`,caret:!1,className:br,horizontalAlign:"right",render:p=>{let{close:h}=p;return qI(ue.MenuItem,{children:[a&&i!==0&&tr(ue.Button,{className:`${br}__action ${br}__move-up`,icon:tr(E1,{direction:"up",size:24}),onClick:()=>{l(i,i-1),h()},children:f("general:moveUp")}),a&&i<d-1&&tr(ue.Button,{className:`${br}__action`,icon:tr(E1,{direction:"down",size:24}),onClick:()=>{l(i,i+1),h()},children:f("general:moveDown")}),!s&&qI(uz.Fragment,{children:[tr(ue.Button,{className:`${br}__action ${br}__add`,icon:tr(Po,{size:24}),onClick:()=>{o(i+1),h()},children:f("general:addBelow")}),tr(ue.Button,{className:`${br}__action ${br}__duplicate`,icon:tr(vC,{size:24}),onClick:()=>{r(i),h()},children:f("general:duplicate")})]}),tr(ue.Button,{className:`${br}__action ${br}__copy`,icon:tr(sl,{size:24}),onClick:()=>{n(i),h()},children:f("general:copyRow")}),tr(ue.Button,{className:`${br}__action ${br}__paste`,icon:tr(tm,{size:24}),onClick:()=>{c(i),h()},children:f("general:pasteRow")}),tr(ue.Button,{className:`${br}__action ${br}__remove`,icon:tr(xt,{size:24}),onClick:()=>{u(i),h()},children:f("general:remove")})]})},size:"medium"}),e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=l,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=m):m=e[11],m};import{c as Gee}from"react/compiler-runtime";import{jsx as V2}from"react/jsx-runtime";import{fieldIsHiddenOrDisabled as Wee,getFieldPaths as Uee,getFieldPermissions as Xee}from"payload/shared";import"react";import{c as dz}from"react/compiler-runtime";import{jsx as mz}from"react/jsx-runtime";import QI from"react";var KI=t=>{let e=dz(9),{children:o,className:n,forceRender:r}=t,[s,i]=QI.useState(!!r),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={rootMargin:"1000px"},e[0]=a):a=e[0];let[l,c]=Js(a,!!r),u=!!c?.isIntersecting,d=c?.boundingClientRect?.top<0,f=r||u||d,m,p;e[1]!==s||e[2]!==f?(m=()=>{f&&!s&&i(!0)},p=[f,s],e[1]=s,e[2]=f,e[3]=m,e[4]=p):(m=e[3],p=e[4]),QI.useEffect(m,p);let h=s?o:null,g;return e[5]!==n||e[6]!==l||e[7]!==h?(g=mz("div",{className:n,ref:l,children:h}),e[5]=n,e[6]=l,e[7]=h,e[8]=g):g=e[8],g};import{c as zee}from"react/compiler-runtime";import{jsx as Qt}from"react/jsx-runtime";import"react";import{jsx as kt,jsxs as ui,Fragment as zz}from"react/jsx-runtime";import{getTranslation as k1}from"@payloadcms/translations";import Gz,{Fragment as Wz,useCallback as kn,useMemo as vR}from"react";import{c as fz}from"react/compiler-runtime";import{jsx as ym,jsxs as pz}from"react/jsx-runtime";import"react";var ys="pill",hz=t=>{let e=fz(12),{id:o,className:n}=t,r;e[0]!==o?(r={id:o},e[0]=o,e[1]=r):r=e[1];let{attributes:s,isDragging:i,listeners:a,setNodeRef:l,transform:c}=qs(r),u=i&&`${ys}--is-dragging`,d;e[2]!==n||e[3]!==u?(d=[u,n].filter(Boolean),e[2]=n,e[3]=u,e[4]=d):d=e[4];let f=d.join(" "),m;return e[5]!==s||e[6]!==a||e[7]!==t||e[8]!==l||e[9]!==f||e[10]!==c?(m=ym(eR,{...t,className:f,elementProps:{...a,...s,ref:l,style:{transform:c}}}),e[5]=s,e[6]=a,e[7]=t,e[8]=l,e[9]=f,e[10]=c,e[11]=m):m=e[11],m},eR=t=>{let{id:e,alignIcon:o="right","aria-checked":n,"aria-controls":r,"aria-expanded":s,"aria-label":i,children:a,className:l,draggable:c,elementProps:u,icon:d,pillStyle:f="light",rounded:m,size:p="medium"}=t,h=[ys,`${ys}--style-${f}`,`${ys}--size-${p}`,l&&l,d&&`${ys}--has-icon`,d&&`${ys}--align-icon-${o}`,c&&`${ys}--draggable`,m&&`${ys}--rounded`].filter(Boolean).join(" ");return pz("div",{...u,"aria-checked":n,"aria-controls":r,"aria-expanded":s,"aria-label":i,className:h,id:e,children:[ym("span",{className:`${ys}__label`,children:a}),!!d&&ym("span",{className:`${ys}__icon`,children:d})]})},vr=t=>{let{draggable:e}=t;return e?ym(hz,{...t}):ym(eR,{...t})};import{c as Oz}from"react/compiler-runtime";import{jsx as jn,jsxs as gR,Fragment as Vz}from"react/jsx-runtime";import{getTranslation as Hz}from"@payloadcms/translations";import"react";import{useEffect as gz,useState as bz}from"react";function $1(t,e){let[o,n]=bz(t);return gz(()=>{let r=setTimeout(()=>{n(t)},e);return()=>{clearTimeout(r)}},[t,e]),o}import{c as kz}from"react/compiler-runtime";import{jsx as dR,jsxs as Mz}from"react/jsx-runtime";import mR from"react";import{c as Lz}from"react/compiler-runtime";import{jsx as cR}from"react/jsx-runtime";import{getTranslation as $z}from"@payloadcms/translations";import{useEffect as jz,useState as uR}from"react";import{jsx as Cs,jsxs as lR}from"react/jsx-runtime";import{getTranslation as xC}from"@payloadcms/translations";import{Fragment as Az,useEffect as Pz,useMemo as Fz,useState as Nz}from"react";import{c as vz}from"react/compiler-runtime";import{jsx as tR,jsxs as yz}from"react/jsx-runtime";import"react";var nu="thumbnail-card",Cm=t=>{let e=vz(15),{alignLabel:o,className:n,collection:r,doc:s,isSelected:i,label:a,onClick:l,onDoubleClick:c,thumbnail:u}=t,{config:d}=G(),{i18n:f}=N(),m=typeof l=="function"&&`${nu}--has-on-click`,p=i&&`${nu}--selected`,h=o&&`${nu}--align-label-${o}`,g;e[0]!==n||e[1]!==m||e[2]!==p||e[3]!==h?(g=[nu,n,m,p,h].filter(Boolean),e[0]=n,e[1]=m,e[2]=p,e[3]=h,e[4]=g):g=e[4];let b=g.join(" "),v;if(e[5]!==b||e[6]!==r||e[7]!==d||e[8]!==s||e[9]!==f||e[10]!==a||e[11]!==l||e[12]!==c||e[13]!==u){let C=a;C||(C=Br({collectionConfig:r,data:s,dateFormat:d.admin.dateFormat,fallback:s?.filename,i18n:f})),v=yz("button",{className:b,onClick:l,onDoubleClick:c,title:C,type:"button",children:[tR("div",{className:`${nu}__thumbnail`,children:u}),tR("div",{className:`${nu}__label`,children:C})]}),e[5]=b,e[6]=r,e[7]=d,e[8]=s,e[9]=f,e[10]=a,e[11]=l,e[12]=c,e[13]=u,e[14]=v}else v=e[14];return v};import{jsx as li,jsxs as rR}from"react/jsx-runtime";import{useState as Sz}from"react";var Go=[];for(let t=0;t<256;++t)Go.push((t+256).toString(16).slice(1));function oR(t,e=0){return(Go[t[e+0]]+Go[t[e+1]]+Go[t[e+2]]+Go[t[e+3]]+"-"+Go[t[e+4]]+Go[t[e+5]]+"-"+Go[t[e+6]]+Go[t[e+7]]+"-"+Go[t[e+8]]+Go[t[e+9]]+"-"+Go[t[e+10]]+Go[t[e+11]]+Go[t[e+12]]+Go[t[e+13]]+Go[t[e+14]]+Go[t[e+15]]).toLowerCase()}var Cz=new Uint8Array(16);function yC(){return crypto.getRandomValues(Cz)}function xz(t,e,o){return!e&&!t&&crypto.randomUUID?crypto.randomUUID():wz(t,e,o)}function wz(t,e,o){t=t||{};let n=t.random??t.rng?.()??yC();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(o=o||0,o<0||o+16>e.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);for(let r=0;r<16;++r)e[o+r]=n[r];return e}return oR(n)}var Qr=xz;var xm=()=>{let[t]=Sz(()=>`pattern${Qr()}`);return rR("svg",{fill:"none",height:"151",preserveAspectRatio:"xMidYMid slice",viewBox:"0 0 231 151",width:"231",xmlns:"http://www.w3.org/2000/svg",children:[rR("g",{clipPath:`url(#${t})`,children:[li("rect",{fill:"#D9D9D9",height:"100%",rx:"2",width:"100%"}),li("rect",{fill:"#BCBCBC",height:"116.063",transform:"rotate(52.0687 33.7051 79.3051)",width:"85.8593",x:"33.7051",y:"79.3051"}),li("rect",{fill:"#BCBCBC",height:"116.063",transform:"rotate(52.0687 86.1219 92.6272)",width:"85.8593",x:"86.1219",y:"92.6272"}),li("circle",{cx:"189",cy:"45",fill:"#BCBCBC",r:"19"}),li("rect",{fill:"#B8B8B8",height:"5",rx:"2.5",width:"98",x:"66",y:"70"}),li("rect",{fill:"#B8B8B8",height:"5",rx:"2.5",width:"76",x:"77",y:"82"})]}),li("defs",{children:li("clipPath",{id:`${t}`,children:li("rect",{fill:"white",height:"151",width:"231"})})})]})};import{c as Tz}from"react/compiler-runtime";import{jsx as sR}from"react/jsx-runtime";import{useState as Dz}from"react";import{c as Iz}from"react/compiler-runtime";import{jsx as j1,jsxs as Rz}from"react/jsx-runtime";import"react";import{jsx as nR}from"react/jsx-runtime";import"react";var _z={24:"M10.5 5C13.5376 5 16 7.46243 16 10.5C16 11.8512 15.5115 13.0875 14.7031 14.0449C14.7574 14.0691 14.8089 14.1019 14.8535 14.1465L17.8535 17.1465C18.0488 17.3417 18.0488 17.6583 17.8535 17.8535C17.6582 18.0486 17.3417 18.0487 17.1465 17.8535L14.1465 14.8535C14.102 14.809 14.0691 14.7574 14.0449 14.7031C13.0875 15.5115 11.8512 16 10.5 16C7.46243 16 5 13.5376 5 10.5C5 7.46243 7.46243 5 10.5 5ZM10.5 6C8.01472 6 6 8.01472 6 10.5C6 12.9853 8.01472 15 10.5 15C12.9853 15 15 12.9853 15 10.5C15 8.01472 12.9853 6 10.5 6Z"},Cl=({className:t,size:e=24})=>nR("svg",{className:["icon","icon--search",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:nR("path",{d:_z[e],fill:"currentColor"})});var CC="search-input",xl=t=>{let e=Iz(19),{id:o,"aria-label":n,className:r,disabled:s,onChange:i,onClear:a,onSearch:l,placeholder:c,value:u}=t,{t:d}=N(),f;e[0]!==l||e[1]!==u?(f=b=>{b.key==="Enter"&&u.length>0&&l(u)},e[0]=l,e[1]=u,e[2]=f):f=e[2];let m=f,p;e[3]!==r?(p=[CC,r].filter(Boolean),e[3]=r,e[4]=p):p=e[4];let h=p.join(" "),g;if(e[5]!==n||e[6]!==s||e[7]!==m||e[8]!==o||e[9]!==i||e[10]!==a||e[11]!==l||e[12]!==c||e[13]!==d||e[14]!==h||e[15]!==u){let b;e[17]!==i?(b=v=>i(v.target.value),e[17]=i,e[18]=b):b=e[18],g=Rz("div",{className:h,children:[j1(Cl,{}),j1("input",{"aria-label":n??c,className:`${CC}__input`,disabled:s,id:o,onChange:b,onKeyDown:l?m:void 0,placeholder:c,type:"text",value:u}),a&&u.length>0&&j1(Z,{"aria-label":d("general:clear"),buttonStyle:"ghost",className:`${CC}__clear`,icon:j1(xt,{size:16}),margin:!1,onClick:a,round:!0,size:"medium"})]}),e[5]=n,e[6]=s,e[7]=m,e[8]=o,e[9]=i,e[10]=a,e[11]=l,e[12]=c,e[13]=d,e[14]=h,e[15]=u,e[16]=g}else g=e[16];return g};var iR="block-search",aR=t=>{let e=Tz(8),{setSearchTerm:o}=t,{t:n}=N(),[r,s]=Dz(""),i;e[0]!==o?(i=c=>{s(c),o(c)},e[0]=o,e[1]=i):i=e[1];let a=i,l;if(e[2]!==a||e[3]!==n||e[4]!==r){let c;e[6]!==a?(c=()=>a(""),e[6]=a,e[7]=c):c=e[7],l=sR("div",{className:iR,children:sR(xl,{"aria-label":n("fields:searchForBlock"),className:`${iR}__input`,onChange:a,onClear:c,placeholder:n("fields:searchForBlock"),value:r})}),e[2]=a,e[3]=n,e[4]=r,e[5]=l}else l=e[5];return l};var ua="blocks-drawer",Ez=(t,e)=>typeof t.labels.singular=="string"?t.labels.singular.toLowerCase():typeof t.labels.singular=="object"?xC(t.labels.singular,e).toLowerCase():"",wC=t=>{let{blocks:e,onDoubleClick:o,onSelect:n,searchTerm:r,selectedBlock:s}=t,[i,a]=Lr(r??""),[l,c]=Nz(e),{i18n:u}=N(),{config:d}=G(),f=Fz(()=>{let m={_none:[]};return l.forEach(p=>{if(typeof p=="object"&&p.admin?.group){let h=p.admin.group,g=typeof h=="string"?h:xC(h,u);Object.hasOwn(m,g)?m[g].push(p):m[g]=[p]}else m._none.push(p)}),m},[l,u]);return Pz(()=>{let m=i.toLowerCase(),p=e?.reduce((h,g)=>{let b=typeof g=="string"?d.blocksMap[g]:g;return Ez(b,u).includes(m)&&h.push(b),h},[]);c(p)},[i,e,u,d.blocksMap]),lR(Az,{children:[Cs(aR,{setSearchTerm:a}),Cs("div",{className:`${ua}__blocks-wrapper`,children:Cs("ul",{className:`${ua}__block-groups`,children:Object.entries(f).map(([m,p])=>p.length?lR("li",{className:[`${ua}__block-group`,m==="_none"&&`${ua}__block-group-none`].filter(Boolean).join(" "),children:[m!=="_none"&&Cs("h3",{className:`${ua}__block-group-label`,children:m}),Cs("ul",{className:`${ua}__blocks`,children:p.map((h,g)=>{let b=typeof h=="string"?d.blocksMap[h]:h,{slug:v,admin:C,imageAltText:y,imageURL:x,labels:w}=b,S=C?.images?.thumbnail?typeof C.images.thumbnail=="string"?C.images.thumbnail:C.images.thumbnail.url:x,_=C?.images?.thumbnail&&typeof C.images.thumbnail!="string"?C.images.thumbnail.alt:y;return Cs("li",{className:`${ua}__block`,children:Cs(Cm,{alignLabel:"left",isSelected:s===v,label:xC(w?.singular,u),onClick:()=>{typeof n=="function"&&n(v)},onDoubleClick:()=>{typeof o=="function"&&o(v)},thumbnail:Cs("div",{className:`${ua}__default-image`,children:S?Cs("img",{alt:_,src:S}):Cs(xm,{})})})},g)})})]},m):null)})})]})};var wm=t=>{let e=Lz(26),{addRow:o,addRowIndex:n,blocks:r,drawerSlug:s,labels:i}=t,{closeModal:a,isModalOpen:l}=ie(),{i18n:c,t:u}=N(),[d,f]=uR(""),[m,p]=uR(null),h,g;e[0]!==s||e[1]!==l?(h=()=>{l(s)||(f(""),p(null))},g=[l,s],e[0]=s,e[1]=l,e[2]=h,e[3]=g):(h=e[2],g=e[3]),jz(h,g);let b;e[4]!==o||e[5]!==n||e[6]!==a||e[7]!==s||e[8]!==m?(b=()=>{m&&(o(n,m),a(s))},e[4]=o,e[5]=n,e[6]=a,e[7]=s,e[8]=m,e[9]=b):b=e[9];let v=b,C;e[10]!==o||e[11]!==n||e[12]!==a||e[13]!==s?(C=S=>{o(n,S),a(s)},e[10]=o,e[11]=n,e[12]=a,e[13]=s,e[14]=C):C=e[14];let y=C,x=!m,w;return e[15]!==r||e[16]!==s||e[17]!==y||e[18]!==v||e[19]!==c||e[20]!==i.singular||e[21]!==d||e[22]!==m||e[23]!==u||e[24]!==x?(w=cR(It,{headerActions:[{disabled:x,label:"Insert",onClick:v,style:"primary"}],slug:s,title:u("fields:addLabel",{label:$z(i.singular,c)}),children:cR(wC,{blocks:r,onDoubleClick:y,onSelect:p,searchTerm:d,selectedBlock:m})}),e[15]=r,e[16]=s,e[17]=y,e[18]=v,e[19]=c,e[20]=i.singular,e[21]=d,e[22]=m,e[23]=u,e[24]=x,e[25]=w):w=e[25],w};var fR=t=>{let e=kz(28),{addRow:o,blocks:n,blockType:r,copyRow:s,duplicateRow:i,hasMaxRows:a,isSortable:l,labels:c,moveRow:u,pasteRow:d,removeRow:f,rowCount:m,rowIndex:p}=t,{closeModal:h,openModal:g}=ie(),b=um("blocks-drawer"),[v,C]=mR.useState(null),y;e[0]!==o||e[1]!==h||e[2]!==b||e[3]!==v?(y=(w,S)=>{typeof o=="function"&&o(v,S),h(b)},e[0]=o,e[1]=h,e[2]=b,e[3]=v,e[4]=y):y=e[4];let x;if(e[5]!==r||e[6]!==n||e[7]!==s||e[8]!==b||e[9]!==i||e[10]!==a||e[11]!==l||e[12]!==c||e[13]!==u||e[14]!==g||e[15]!==d||e[16]!==f||e[17]!==m||e[18]!==p||e[19]!==y){let w;e[21]!==b||e[22]!==g?(w=_=>{C(_),g(b)},e[21]=b,e[22]=g,e[23]=w):w=e[23];let S;e[24]!==r||e[25]!==i||e[26]!==p?(S=()=>i(p,r),e[24]=r,e[25]=i,e[26]=p,e[27]=S):S=e[27],x=Mz(mR.Fragment,{children:[dR(wm,{addRow:y,addRowIndex:p,blocks:n,drawerSlug:b,labels:c}),dR(L1,{addRow:w,copyRow:s,duplicateRow:S,hasMaxRows:a,index:p,isSortable:l,moveRow:u,pasteRow:d,removeRow:f,rowCount:m})]}),e[5]=r,e[6]=n,e[7]=s,e[8]=b,e[9]=i,e[10]=a,e[11]=l,e[12]=c,e[13]=u,e[14]=g,e[15]=d,e[16]=f,e[17]=m,e[18]=p,e[19]=y,e[20]=x}else x=e[20];return x};import{c as Bz}from"react/compiler-runtime";import{jsx as pR}from"react/jsx-runtime";import"react";var hR="section-title",SC=t=>{let e=Bz(13),{customOnChange:o,customValue:n,path:r,readOnly:s}=t,i;e[0]!==r?(i={path:r},e[0]=r,e[1]=i):i=e[1];let{setValue:a,value:l}=Ne(i),{t:c}=N(),u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=[hR].filter(Boolean),e[2]=u):u=e[2];let d=u.join(" "),f;e[3]!==o||e[4]!==a?(f=o||(h=>{h.stopPropagation(),h.preventDefault(),a(h.target.value)}),e[3]=o,e[4]=a,e[5]=f):f=e[5];let m=f,p;return e[6]!==n||e[7]!==m||e[8]!==r||e[9]!==s||e[10]!==c||e[11]!==l?(p=pR("div",{className:d,"data-value":n||l||c("general:untitled"),children:pR("input",{className:`${hR}__input`,id:r,name:r,onChange:m,placeholder:c("general:untitled"),readOnly:s,type:"text",value:n||l||""})}),e[6]=n,e[7]=m,e[8]=r,e[9]=s,e[10]=c,e[11]=l,e[12]=p):p=e[12],p};var ci="blocks-field",bR=t=>{let e=Oz(45),{addRow:o,attributes:n,block:r,blocks:s,copyRow:i,duplicateRow:a,errorCount:l,fields:c,hasMaxRows:u,isDragging:d,isLoading:f,isSortable:m,Label:p,labels:h,listeners:g,moveRow:b,parentPath:v,pasteRow:C,path:y,permissions:x,readOnly:w,removeRow:S,row:_,rowCount:I,rowIndex:A,schemaPath:D,setCollapse:T,setNodeRef:R,transform:P,transition:E}=t,F=$1(f,500),{i18n:L}=N(),$=vo()&&l>0,B=!r.admin?.disableBlockName,j=$?`${ci}__row--has-errors`:`${ci}__row--no-errors`,k=d&&`${ci}__row--is-dragging`,O;e[0]!==j||e[1]!==k?(O=[`${ci}__row`,j,k].filter(Boolean),e[0]=j,e[1]=k,e[2]=O):O=e[2];let V=O.join(" "),H;if(e[3]!==p||e[4]!==o||e[5]!==n||e[6]!==r.fields||e[7]!==r.labels||e[8]!==r.slug||e[9]!==s||e[10]!==V||e[11]!==i||e[12]!==a||e[13]!==l||e[14]!==$||e[15]!==c||e[16]!==u||e[17]!==L||e[18]!==d||e[19]!==F||e[20]!==m||e[21]!==h||e[22]!==g||e[23]!==b||e[24]!==v||e[25]!==C||e[26]!==y||e[27]!==x||e[28]!==w||e[29]!==S||e[30]!==_.blockType||e[31]!==_.collapsed||e[32]!==_.id||e[33]!==I||e[34]!==A||e[35]!==D||e[36]!==T||e[37]!==R||e[38]!==B||e[39]!==P||e[40]!==E){let z;if(x===!0)z=!0;else{let U=x?.blocks?.[r.slug]||x?.blocks;if(U===!0)z=!0;else if(U?.fields)z=U.fields;else if(typeof x=="object"&&x&&!U){let X=x.read===!0,Q=!x.create||!x.update;X&&(Q||typeof x=="object"&&Object.keys(x).length===1&&x.read)?z={read:!0}:z=U?.fields}else z=U?.fields}let W;e[42]!==_.id||e[43]!==T?(W=U=>T(_.id,U),e[42]=_.id,e[43]=T,e[44]=W):W=e[44],H=jn("div",{id:`${v?.split(".").join("-")}-row-${A}`,ref:R,style:{transform:P,transition:E,zIndex:d?1:void 0},children:jn(Qs,{actions:w?void 0:jn(fR,{addRow:o,blocks:s,blockType:_.blockType,copyRow:i,duplicateRow:a,fields:r.fields,hasMaxRows:u,isSortable:m,labels:h,moveRow:b,pasteRow:C,removeRow:S,rowCount:I,rowIndex:A}),className:V,collapsibleStyle:$?"error":"default",dragHandleProps:m&&!w?{id:_.id,attributes:n,listeners:g}:void 0,header:F?jn(Ct,{height:"1rem",width:"8rem"}):gR("div",{className:`${ci}__block-header`,children:[jn(Ur,{CustomComponent:p,label:gR(Vz,{children:[jn("span",{className:`${ci}__block-number`,children:String(A+1).padStart(2,"0")}),jn(vr,{className:`${ci}__block-pill ${ci}__block-pill-${_.blockType}`,pillStyle:"white",size:"small",children:Hz(r.labels.singular,L)}),B&&jn(SC,{path:`${y}.blockName`,readOnly:w})]}),path:y,rowNumber:A}),$&&jn(yo,{count:l,i18n:L,withMessage:!0})]}),isCollapsed:_.collapsed,onToggle:W,children:F?jn(Ct,{}):jn(co,{className:`${ci}__fields`,fields:c,parentIndexPath:"",parentPath:y,parentSchemaPath:D,permissions:z,readOnly:w})},_.id)},`${v}-row-${_.id}`),e[3]=p,e[4]=o,e[5]=n,e[6]=r.fields,e[7]=r.labels,e[8]=r.slug,e[9]=s,e[10]=V,e[11]=i,e[12]=a,e[13]=l,e[14]=$,e[15]=c,e[16]=u,e[17]=L,e[18]=d,e[19]=F,e[20]=m,e[21]=h,e[22]=g,e[23]=b,e[24]=v,e[25]=C,e[26]=y,e[27]=x,e[28]=w,e[29]=S,e[30]=_.blockType,e[31]=_.collapsed,e[32]=_.id,e[33]=I,e[34]=A,e[35]=D,e[36]=T,e[37]=R,e[38]=B,e[39]=P,e[40]=E,e[41]=H}else H=e[41];return H};var yr="blocks-field",Uz=t=>{let{i18n:e,t:o}=N(),{field:n,field:{name:r,type:s,admin:{className:i,description:a,isSortable:l=!0}={},blocks:c,label:u,labels:d,localized:f,maxRows:m,minRows:p,required:h},path:g,permissions:b,readOnly:v,schemaPath:C,validate:y}=t,x=C??r,w=p??(h?1:0),{setDocFieldPreferences:S}=be(),{addFieldRow:_,dispatchFields:I,getFields:A,moveFieldRow:D,removeFieldRow:T,replaceState:R,setModified:P}=Ge(),{code:E}=Ce(),{config:{localization:F},config:L}=G(),M=um("blocks-drawer"),$=vo(),B={plural:o("fields:blocks"),singular:o("fields:block"),...d},j=(()=>{if(F&&F.fallback){let he=F.defaultLocale;return E===he}return!0})(),k=kn((he,_e)=>{if(!j&&he===null)return!0;if(typeof y=="function")return y(he,{..._e,maxRows:m,minRows:w,required:h})},[m,w,h,y,j]),{blocksFilterOptions:O,customComponents:{AfterInput:V,BeforeInput:H,Description:z,Error:W,Label:U}={},disabled:X,errorPaths:Q,path:J,rows:oe=[],showError:Y,valid:K,value:ee}=Ne({hasRows:!0,potentiallyStalePath:g,validate:k}),{clientBlocks:te,clientBlocksAfterFilter:re}=vR(()=>{let he=[];for(let _e of c){let Ze=typeof _e=="string"?L.blocksMap[_e]:_e;Ze&&he.push(Ze)}if(Array.isArray(O)){let _e=he.filter(Ze=>{let ut=typeof Ze=="string"?Ze:Ze.slug;return O.includes(ut)});return{clientBlocks:he,clientBlocksAfterFilter:_e}}return{clientBlocks:he,clientBlocksAfterFilter:he}},[c,O,L.blocksMap]),me=he=>L.blocksMap[he]??te.find(_e=>_e.slug===he),we=kn((he,_e)=>{_({blockType:_e,path:J,rowIndex:he,schemaPath:x}),setTimeout(()=>{ru(`${J}-row-${he+1}`)},0)},[_,J,x]),Ae=kn(he=>{I({type:"DUPLICATE_ROW",path:J,rowIndex:he}),P(!0),setTimeout(()=>{ru(`${J}-row-${he+1}`)},0)},[I,J,P]),de=kn(he=>{T({path:J,rowIndex:he})},[J,T]),xe=kn((he,_e)=>{D({moveFromIndex:he,moveToIndex:_e,path:J})},[D,J]),$e=kn(he=>{let{collapsedIDs:_e,updatedRows:Ze}=w1({collapsed:he,rows:oe});I({type:"SET_ALL_ROWS_COLLAPSED",path:J,updatedRows:Ze}),S(J,{collapsed:_e})},[I,J,oe,S]),Le=kn((he,_e)=>{let{collapsedIDs:Ze,updatedRows:ut}=x1({collapsed:_e,rowID:he,rows:oe});I({type:"SET_ROW_COLLAPSED",path:J,updatedRows:ut}),S(J,{collapsed:Ze})},[I,J,oe,S]),rt=kn(he=>{let _e=Bc({type:s,blocks:te,getDataToCopy:()=>Hc({formState:{...A()},path:J,rowIndex:he}),path:J,rowIndex:he,t:o});typeof _e=="string"?se.error(_e):se.success(o("general:copied"))},[te,J,o,s,A]),q=kn(he=>{let Ze=Oc({onPaste:ut=>{let De={...A()},it=zc({dataFromClipboard:ut,formState:De,path:J,rowIndex:he});R(it),P(!0)},path:J,schemaBlocks:te,t:o});typeof Ze=="string"&&se.error(Ze)},[te,A,J,R,P,o]),pe=kn(he=>{let _e={...A()},Ze=zc({dataFromClipboard:he,formState:_e,path:J});R(Ze),P(!0)},[A,J,R,P]),fe=m&&oe.length>=m,Pe=Q.length,ge=$&&Pe+(K?0:1)>0,ae=oe.length<w||h&&oe.length===0,Se=v&&oe.length===0,ne=vR(()=>st(n),[n]),Te=kn(he=>{let _e=oe.findIndex(pt=>pt.id===he);if(_e===-1)return null;let Ze=oe[_e],ut=me(Ze.blockType);if(!ut)return null;let it=!ut.admin?.disableBlockName?A()?.[`${J}.${_e}.blockName`]?.value:void 0;return kt(e1,{header:kt("div",{className:`${yr}__block-header`,children:kt(Ur,{CustomComponent:oe?.[_e]?.customComponents?.RowLabel,label:ui(zz,{children:[kt("span",{className:`${yr}__block-number`,children:String(_e+1).padStart(2,"0")}),kt(vr,{className:`${yr}__block-pill ${yr}__block-pill-${Ze.blockType}`,pillStyle:"white",size:"small",children:k1(ut.labels.singular,e)}),it&&kt("span",{className:"section-title__text",children:it})]}),path:`${J}.${_e}`,rowNumber:_e})})})},[oe,L.blocksMap,te,e,J,A]);return ui("div",{className:[Ee,yr,i,ge?`${yr}--has-error`:`${yr}--has-no-error`].filter(Boolean).join(" "),id:`field-${J?.replace(/\./g,"__")}`,style:ne,children:[Y&&kt(le,{CustomComponent:W,Fallback:kt(tt,{path:J,showError:Y})}),ui("header",{className:`${yr}__header`,children:[ui("div",{className:`${yr}__header-wrap`,children:[ui("div",{className:`${yr}__header-content`,children:[kt("h3",{className:`${yr}__title`,children:kt(le,{CustomComponent:U,Fallback:kt(Fe,{as:"span",label:u,localized:f,path:J,required:h})})}),ge&&Pe>0&&kt(yo,{count:Pe,i18n:e,withMessage:!0})]}),ui("ul",{className:`${yr}__header-actions`,children:[oe.length>0&&kt(Qh,{onClick:$e}),kt("li",{children:kt(Xh,{allowCopy:oe?.length>0,allowPaste:!v,blocks:te,className:`${yr}__header-action`,disabled:X,getDataToCopy:()=>Hc({formState:{...A()},path:J}),onPaste:pe,path:J,type:s})})]})]}),kt(le,{CustomComponent:z,Fallback:kt(Xe,{description:a,path:J})})]}),H,kt(vm,{fieldValue:ee,localized:f,path:J,readOnly:v}),(oe.length>0||!K&&(Se||ae))&&ui(hr,{className:`${yr}__rows`,ids:oe.map(he=>he.id),onDragEnd:({moveFromIndex:he,moveToIndex:_e})=>xe(he,_e),renderDragOverlay:l&&!v&&!X?Te:void 0,sortingStrategy:kh,children:[oe.map((he,_e)=>{let{blockType:Ze,isLoading:ut}=he,De=me(Ze);if(De){let it=`${J}.${_e}`,pt=Q.filter(Vt=>Vt.startsWith(it+".")).length;return kt(Yr,{disabled:v||X||!l,id:he.id,children:Vt=>kt(bR,{...Vt,addRow:we,block:De,blocks:te,copyRow:rt,duplicateRow:Ae,errorCount:pt,fields:De.fields,hasMaxRows:fe,isLoading:ut,isSortable:l,Label:oe?.[_e]?.customComponents?.RowLabel,labels:B,moveRow:xe,parentPath:J,pasteRow:q,path:it,permissions:b,readOnly:v||X,removeRow:de,row:he,rowCount:oe.length,rowIndex:_e,schemaPath:x+De.slug,setCollapse:Le})},he.id)}return null}),!K&&ui(Gz.Fragment,{children:[ae&&kt(Xr,{type:"danger",children:o("validation:requiresAtLeast",{count:w,label:k1(w>1?B.plural:B.singular,e)||o(w>1?"general:row":"general:rows")})}),Se&&kt(Xr,{children:o("validation:fieldHasNo",{label:k1(B.plural,e)})})]})]}),!fe&&ui(Wz,{children:[kt(Jr,{className:`${yr}__drawer-toggler`,disabled:v||X,slug:M,children:kt(Z,{buttonStyle:"ghost",disabled:v||X,el:"span",icon:kt(ai,{}),iconPosition:"left",children:o("fields:addLabel",{label:k1(B.singular,e)})})}),kt(wm,{addRow:we,addRowIndex:oe?.length||0,blocks:re,drawerSlug:M,labels:B})]}),V]})},Sm=Je(Uz);import{jsx as Sl,jsxs as yR}from"react/jsx-runtime";import CR,{useCallback as xR,useEffect as Jz,useMemo as qz,useState as Qz}from"react";import{jsx as _C}from"react/jsx-runtime";import{lazy as Xz,Suspense as Zz}from"react";var Yz=Xz(()=>import("./CodeEditor-T3624SG3.js")),wl=t=>{let e=t.minHeight||46;return _C(Zz,{fallback:_C(Ct,{height:e}),children:_C(Yz,{...t,minHeight:e})})};var Kz={js:"javascript",ts:"typescript",tsx:"typescript"},eG="code-field",tG=t=>{let{field:e,field:{admin:{className:o,description:n,editorOptions:r,editorProps:s,language:i="javascript"}={},label:a,localized:l,required:c},onMount:u,path:d,readOnly:f,validate:m}=t,p=CR.useRef("formState"),[h,g]=Qz(Date.now()),b=xR((F,L)=>{if(typeof m=="function")return m(F,{...L,required:c})},[m,c]),{customComponents:{AfterInput:v,BeforeInput:C,Description:y,Error:x,Label:w}={},disabled:S,initialValue:_,path:I,setValue:A,showError:D,value:T}=Ne({potentiallyStalePath:d,validate:b}),R=CR.useRef((T||_)!==void 0?T??_:void 0),P=xR(F=>{if(!(f||S)){p.current="internalEditor";try{A(F||null),R.current=F}catch{A(F||null),R.current=F}}},[f,S,A]);Jz(()=>{p.current==="formState"&&(R.current=(T||_)!==void 0?T??_:void 0,g(Date.now())),p.current="formState"},[_,I,T]);let E=qz(()=>st(e),[e]);return yR("div",{className:[Ee,eG,o,D&&"error",(f||S)&&"read-only"].filter(Boolean).join(" "),style:E,children:[Sl(le,{CustomComponent:w,Fallback:Sl(Fe,{label:a,localized:l,path:I,required:c})}),yR("div",{className:`${Ee}__wrap`,children:[Sl(le,{CustomComponent:x,Fallback:Sl(tt,{path:I,showError:D})}),C,Sl(wl,{defaultLanguage:Kz[i]||i,onChange:P,onMount:u,options:r,readOnly:f||S,recalculatedHeightAt:h,value:R.current,wrapperProps:{id:`field-${I?.replace(/\./g,"__")}`},...s||{}}),v]}),Sl(le,{CustomComponent:y,Fallback:Sl(Xe,{description:n,path:I})})]})},_m=Je(tG);import{jsx as Il,jsxs as IC}from"react/jsx-runtime";import{getTranslation as rG}from"@payloadcms/translations";import{Fragment as nG,useCallback as sG,useEffect as iG,useMemo as aG,useState as SR}from"react";import{c as oG}from"react/compiler-runtime";import{fieldAffectsData as wR}from"payload/shared";var M1=t=>t.reduce((e,o)=>{let n="fields"in o?o.fields:void 0;return n?wR(o)?e.push(`${o.name}.`):e.push(...M1(n)):o.type==="tabs"?"tabs"in o&&o.tabs?.forEach(r=>{"name"in r?e.push(`${r.name}.`):e.push(...M1(r.fields))}):wR(o)&&e.push(o.name),e},[]);var _l=t=>{let e=oG(12),{fields:o,path:n,setErrorCount:r}=t,[s]=ea(),i=vo(),a;e[0]!==o?(a=M1(o),e[0]=o,e[1]=a):a=e[1];let l=a,c;e[2]!==s||e[3]!==i||e[4]!==n||e[5]!==l||e[6]!==r?(c=()=>{if(i){let d=0;Object.entries(s).forEach(f=>{let[m]=f;if(l?.some(h=>{let g=[...n,h].join(".");if(g.endsWith(".")){let b=g.slice(0,-1);return m.startsWith(g)||m===b}return m===g})){let h=s[m];"valid"in h&&!h.valid&&(d=d+1)}}),r(d)}},e[2]=s,e[3]=i,e[4]=n,e[5]=l,e[6]=r,e[7]=c):c=e[7];let u;return e[8]!==o||e[9]!==s||e[10]!==i?(u=[s,i,o],e[8]=o,e[9]=s,e[10]=i,e[11]=u):u=e[11],pl(c,250,u),null};var Im="collapsible-field",lG=t=>{let{field:e,field:{admin:{className:o,description:n,initCollapsed:r=!1}={},fields:s,label:i}={},indexPath:a,parentPath:l,parentSchemaPath:c,path:u,permissions:d,readOnly:f}=t,{i18n:m}=N(),{getPreference:p,setPreference:h}=Jt(),{preferencesKey:g}=be(),[b,v]=SR(),C=`collapsible-${u?.replace(/\./g,"__")}`,[y,x]=SR(0),w=y>0,{customComponents:{AfterInput:S,BeforeInput:_,Description:I,Label:A}={},disabled:D}=Ne({path:u}),T=sG(async P=>{let E=await p(g);g&&h(g,{...E,...u?{fields:{...E?.fields||{},[u]:{...E?.fields?.[u],collapsed:P}}}:{fields:{...E?.fields||{},[C]:{...E?.fields?.[C],collapsed:P}}}})},[g,C,p,h,u]);iG(()=>{(async()=>{if(g){let E=await p(g),F=u?E?.fields?.[u]?.collapsed:E?.fields?.[C]?.collapsed;v(F!==void 0?!!F:typeof r=="boolean"?r:!1)}else v(typeof r=="boolean"?r:!1)})()},[p,g,C,r,u]);let R=aG(()=>st(e),[e]);return typeof b!="boolean"?null:IC(nG,{children:[Il(_l,{fields:s,path:u.split(".").slice(0,-1),setErrorCount:x}),IC("div",{className:[Ee,Im,o,w?`${Im}--has-error`:`${Im}--has-no-error`].filter(Boolean).join(" "),id:`field-${C}`,style:R,children:[_,Il(Qs,{className:`${Im}__collapsible`,collapsibleStyle:w?"error":"default",header:IC("div",{className:`${Im}__row-label-wrap`,children:[Il(Ur,{CustomComponent:A,label:rG(i,m),path:u}),w&&Il(yo,{count:y,i18n:m,withMessage:!0})]}),initCollapsed:b,onToggle:T,children:Il(co,{fields:s,parentIndexPath:a,parentPath:l,parentSchemaPath:c,permissions:d,readOnly:f||D})}),S,Il(le,{CustomComponent:I,Fallback:Il(Xe,{description:n,path:u})})]})]})},Rm=Je(lG);import{jsx as ha,jsxs as RA}from"react/jsx-runtime";import{getTranslation as yX}from"@payloadcms/translations";import{useCallback as lx,useMemo as cx}from"react";import{jsx as RC}from"react/jsx-runtime";import{lazy as cG,Suspense as uG}from"react";var dG=cG(()=>import("./DatePicker-6KF52Z3G.js")),su=t=>RC(uG,{fallback:RC(Ct,{height:"var(--field-min-height)"}),children:RC(dG,{...t})});import{jsx as pa,jsxs as ax}from"react/jsx-runtime";import{useMemo as hX}from"react";function Mn(t){"@babel/helpers - typeof";return Mn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mn(t)}function _R(t,e){if(Mn(t)!="object"||!t)return t;var o=t[Symbol.toPrimitive];if(o!==void 0){var n=o.call(t,e||"default");if(Mn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function B1(t){var e=_R(t,"string");return Mn(e)=="symbol"?e:e+""}function Rl(t,e,o){return(e=B1(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function IR(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),o.push.apply(o,n)}return o}function Me(t){for(var e=1;e<arguments.length;e++){var o=arguments[e]!=null?arguments[e]:{};e%2?IR(Object(o),!0).forEach(function(n){Rl(t,n,o[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):IR(Object(o)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(o,n))})}return t}function RR(t){if(Array.isArray(t))return t}function TR(t,e){var o=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(o!=null){var n,r,s,i,a=[],l=!0,c=!1;try{if(s=(o=o.call(t)).next,e===0){if(Object(o)!==o)return;l=!1}else for(;!(l=(n=s.call(o)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&o.return!=null&&(i=o.return(),Object(i)!==i))return}finally{if(c)throw r}}return a}}function Tm(t,e){(e==null||e>t.length)&&(e=t.length);for(var o=0,n=Array(e);o<e;o++)n[o]=t[o];return n}function O1(t,e){if(t){if(typeof t=="string")return Tm(t,e);var o={}.toString.call(t).slice(8,-1);return o==="Object"&&t.constructor&&(o=t.constructor.name),o==="Map"||o==="Set"?Array.from(t):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?Tm(t,e):void 0}}function DR(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
49
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bn(t,e){return RR(t)||TR(t,e)||O1(t,e)||DR()}function Or(t,e){if(t==null)return{};var o,n,r=Gc(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(n=0;n<s.length;n++)o=s[n],e.indexOf(o)===-1&&{}.propertyIsEnumerable.call(t,o)&&(r[o]=t[o])}return r}import{useState as TC,useCallback as V1}from"react";var mG=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function H1(t){var e=t.defaultInputValue,o=e===void 0?"":e,n=t.defaultMenuIsOpen,r=n===void 0?!1:n,s=t.defaultValue,i=s===void 0?null:s,a=t.inputValue,l=t.menuIsOpen,c=t.onChange,u=t.onInputChange,d=t.onMenuClose,f=t.onMenuOpen,m=t.value,p=Or(t,mG),h=TC(a!==void 0?a:o),g=Bn(h,2),b=g[0],v=g[1],C=TC(l!==void 0?l:r),y=Bn(C,2),x=y[0],w=y[1],S=TC(m!==void 0?m:i),_=Bn(S,2),I=_[0],A=_[1],D=V1(function(M,$){typeof c=="function"&&c(M,$),A(M)},[c]),T=V1(function(M,$){var B;typeof u=="function"&&(B=u(M,$)),v(B!==void 0?B:M)},[u]),R=V1(function(){typeof f=="function"&&f(),w(!0)},[f]),P=V1(function(){typeof d=="function"&&d(),w(!1)},[d]),E=a!==void 0?a:b,F=l!==void 0?l:x,L=m!==void 0?m:I;return Me(Me({},p),{},{inputValue:E,menuIsOpen:F,onChange:D,onInputChange:T,onMenuClose:P,onMenuOpen:R,value:L})}import*as zD from"react";import{forwardRef as jU,useMemo as R6e}from"react";function AR(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function PR(t,e){for(var o=0;o<e.length;o++){var n=e[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,B1(n.key),n)}}function FR(t,e,o){return e&&PR(t.prototype,e),o&&PR(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}function NR(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Wc(t,e)}function Dm(t){return Dm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Dm(t)}function DC(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(DC=function(){return!!t})()}function ER(t,e){if(e&&(Mn(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return s_(t)}function LR(t){var e=DC();return function(){var o,n=Dm(t);if(e){var r=Dm(this).constructor;o=Reflect.construct(n,arguments,r)}else o=n.apply(this,arguments);return ER(this,o)}}function $R(t){if(Array.isArray(t))return Tm(t)}function jR(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function kR(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
50
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function da(t){return $R(t)||jR(t)||O1(t)||kR()}import*as Rt from"react";import{useMemo as km,Fragment as qC,useRef as yu,useCallback as fa,useEffect as ND,Component as QW}from"react";import*as hn from"react";import{useContext as GG,forwardRef as WG}from"react";var fG=!1;function pG(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}function hG(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key),t.nonce!==void 0&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}var MR=(function(){function t(o){var n=this;this._insertTag=function(r){var s;n.tags.length===0?n.insertionPoint?s=n.insertionPoint.nextSibling:n.prepend?s=n.container.firstChild:s=n.before:s=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(r,s),n.tags.push(r)},this.isSpeedy=o.speedy===void 0?!fG:o.speedy,this.tags=[],this.ctr=0,this.nonce=o.nonce,this.key=o.key,this.container=o.container,this.prepend=o.prepend,this.insertionPoint=o.insertionPoint,this.before=null}var e=t.prototype;return e.hydrate=function(n){n.forEach(this._insertTag)},e.insert=function(n){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(hG(this));var r=this.tags[this.tags.length-1];if(this.isSpeedy){var s=pG(r);try{s.insertRule(n,s.cssRules.length)}catch{}}else r.appendChild(document.createTextNode(n));this.ctr++},e.flush=function(){this.tags.forEach(function(n){var r;return(r=n.parentNode)==null?void 0:r.removeChild(n)}),this.tags=[],this.ctr=0},t})();var Wo="-ms-",Am="-moz-",yt="-webkit-",z1="comm",iu="rule",au="decl";var BR="@import";var G1="@keyframes";var OR="@layer";var VR=Math.abs,Tl=String.fromCharCode,HR=Object.assign;function zR(t,e){return uo(t,0)^45?(((e<<2^uo(t,0))<<2^uo(t,1))<<2^uo(t,2))<<2^uo(t,3):0}function W1(t){return t.trim()}function AC(t,e){return(t=e.exec(t))?t[0]:t}function gt(t,e,o){return t.replace(e,o)}function Pm(t,e){return t.indexOf(e)}function uo(t,e){return t.charCodeAt(e)|0}function ma(t,e,o){return t.slice(e,o)}function Cr(t){return t.length}function lu(t){return t.length}function cu(t,e){return e.push(t),t}function PC(t,e){return t.map(e).join("")}var U1=1,uu=1,GR=0,xr=0,xo=0,mu="";function Fm(t,e,o,n,r,s,i){return{value:t,root:e,parent:o,type:n,props:r,children:s,line:U1,column:uu,length:i,return:""}}function fu(t,e){return HR(Fm("",null,null,"",null,null,0),t,{length:-t.length},e)}function WR(){return xo}function UR(){return xo=xr>0?uo(mu,--xr):0,uu--,xo===10&&(uu=1,U1--),xo}function wr(){return xo=xr<GR?uo(mu,xr++):0,uu++,xo===10&&(uu=1,U1++),xo}function pn(){return uo(mu,xr)}function Nm(){return xr}function pu(t,e){return ma(mu,t,e)}function du(t){switch(t){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 X1(t){return U1=uu=1,GR=Cr(mu=t),xr=0,[]}function Z1(t){return mu="",t}function hu(t){return W1(pu(xr-1,FC(t===91?t+2:t===40?t+1:t)))}function XR(t){for(;(xo=pn())&&xo<33;)wr();return du(t)>2||du(xo)>3?"":" "}function ZR(t,e){for(;--e&&wr()&&!(xo<48||xo>102||xo>57&&xo<65||xo>70&&xo<97););return pu(t,Nm()+(e<6&&pn()==32&&wr()==32))}function FC(t){for(;wr();)switch(xo){case t:return xr;case 34:case 39:t!==34&&t!==39&&FC(xo);break;case 40:t===41&&FC(t);break;case 92:wr();break}return xr}function YR(t,e){for(;wr()&&t+xo!==57;)if(t+xo===84&&pn()===47)break;return"/*"+pu(e,xr-1)+"*"+Tl(t===47?t:wr())}function JR(t){for(;!du(pn());)wr();return pu(t,xr)}function KR(t){return Z1(Y1("",null,null,null,[""],t=X1(t),0,[0],t))}function Y1(t,e,o,n,r,s,i,a,l){for(var c=0,u=0,d=i,f=0,m=0,p=0,h=1,g=1,b=1,v=0,C="",y=r,x=s,w=n,S=C;g;)switch(p=v,v=wr()){case 40:if(p!=108&&uo(S,d-1)==58){Pm(S+=gt(hu(v),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:S+=hu(v);break;case 9:case 10:case 13:case 32:S+=XR(p);break;case 92:S+=ZR(Nm()-1,7);continue;case 47:switch(pn()){case 42:case 47:cu(gG(YR(wr(),Nm()),e,o),l);break;default:S+="/"}break;case 123*h:a[c++]=Cr(S)*b;case 125*h:case 59:case 0:switch(v){case 0:case 125:g=0;case 59+u:b==-1&&(S=gt(S,/\f/g,"")),m>0&&Cr(S)-d&&cu(m>32?QR(S+";",n,o,d-1):QR(gt(S," ","")+";",n,o,d-2),l);break;case 59:S+=";";default:if(cu(w=qR(S,e,o,c,u,r,a,C,y=[],x=[],d),s),v===123)if(u===0)Y1(S,e,w,w,y,s,d,a,x);else switch(f===99&&uo(S,3)===110?100:f){case 100:case 108:case 109:case 115:Y1(t,w,w,n&&cu(qR(t,w,w,0,0,r,a,C,r,y=[],d),x),r,x,d,a,n?y:x);break;default:Y1(S,w,w,w,[""],x,0,a,x)}}c=u=m=0,h=b=1,C=S="",d=i;break;case 58:d=1+Cr(S),m=p;default:if(h<1){if(v==123)--h;else if(v==125&&h++==0&&UR()==125)continue}switch(S+=Tl(v),v*h){case 38:b=u>0?1:(S+="\f",-1);break;case 44:a[c++]=(Cr(S)-1)*b,b=1;break;case 64:pn()===45&&(S+=hu(wr())),f=pn(),u=d=Cr(C=S+=JR(Nm())),v++;break;case 45:p===45&&Cr(S)==2&&(h=0)}}return s}function qR(t,e,o,n,r,s,i,a,l,c,u){for(var d=r-1,f=r===0?s:[""],m=lu(f),p=0,h=0,g=0;p<n;++p)for(var b=0,v=ma(t,d+1,d=VR(h=i[p])),C=t;b<m;++b)(C=W1(h>0?f[b]+" "+v:gt(v,/&\f/g,f[b])))&&(l[g++]=C);return Fm(t,e,o,r===0?iu:a,l,c,u)}function gG(t,e,o){return Fm(t,e,o,z1,Tl(WR()),ma(t,2,-2),0)}function QR(t,e,o,n){return Fm(t,e,o,au,ma(t,0,n),ma(t,n+1,-1),n)}function Dl(t,e){for(var o="",n=lu(t),r=0;r<n;r++)o+=e(t[r],r,t,e)||"";return o}function eT(t,e,o,n){switch(t.type){case OR:if(t.children.length)break;case BR:case au:return t.return=t.return||t.value;case z1:return"";case G1:return t.return=t.value+"{"+Dl(t.children,n)+"}";case iu:t.value=t.props.join(",")}return Cr(o=Dl(t.children,n))?t.return=t.value+"{"+o+"}":""}function tT(t){var e=lu(t);return function(o,n,r,s){for(var i="",a=0;a<e;a++)i+=t[a](o,n,r,s)||"";return i}}function oT(t){return function(e){e.root||(e=e.return)&&t(e)}}function rT(t){var e=Object.create(null);return function(o){return e[o]===void 0&&(e[o]=t(o)),e[o]}}var bG=function(e,o,n){for(var r=0,s=0;r=s,s=pn(),r===38&&s===12&&(o[n]=1),!du(s);)wr();return pu(e,xr)},vG=function(e,o){var n=-1,r=44;do switch(du(r)){case 0:r===38&&pn()===12&&(o[n]=1),e[n]+=bG(xr-1,o,n);break;case 2:e[n]+=hu(r);break;case 4:if(r===44){e[++n]=pn()===58?"&\f":"",o[n]=e[n].length;break}default:e[n]+=Tl(r)}while(r=wr());return e},yG=function(e,o){return Z1(vG(X1(e),o))},nT=new WeakMap,CG=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var o=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;n.type!=="rule";)if(n=n.parent,!n)return;if(!(e.props.length===1&&o.charCodeAt(0)!==58&&!nT.get(n))&&!r){nT.set(e,!0);for(var s=[],i=yG(o,s),a=n.props,l=0,c=0;l<i.length;l++)for(var u=0;u<a.length;u++,c++)e.props[c]=s[l]?i[l].replace(/&\f/g,a[u]):a[u]+" "+i[l]}}},xG=function(e){if(e.type==="decl"){var o=e.value;o.charCodeAt(0)===108&&o.charCodeAt(2)===98&&(e.return="",e.value="")}};function sT(t,e){switch(zR(t,e)){case 5103:return yt+"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 yt+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return yt+t+Am+t+Wo+t+t;case 6828:case 4268:return yt+t+Wo+t+t;case 6165:return yt+t+Wo+"flex-"+t+t;case 5187:return yt+t+gt(t,/(\w+).+(:[^]+)/,yt+"box-$1$2"+Wo+"flex-$1$2")+t;case 5443:return yt+t+Wo+"flex-item-"+gt(t,/flex-|-self/,"")+t;case 4675:return yt+t+Wo+"flex-line-pack"+gt(t,/align-content|flex-|-self/,"")+t;case 5548:return yt+t+Wo+gt(t,"shrink","negative")+t;case 5292:return yt+t+Wo+gt(t,"basis","preferred-size")+t;case 6060:return yt+"box-"+gt(t,"-grow","")+yt+t+Wo+gt(t,"grow","positive")+t;case 4554:return yt+gt(t,/([^-])(transform)/g,"$1"+yt+"$2")+t;case 6187:return gt(gt(gt(t,/(zoom-|grab)/,yt+"$1"),/(image-set)/,yt+"$1"),t,"")+t;case 5495:case 3959:return gt(t,/(image-set\([^]*)/,yt+"$1$`$1");case 4968:return gt(gt(t,/(.+:)(flex-)?(.*)/,yt+"box-pack:$3"+Wo+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+yt+t+t;case 4095:case 3583:case 4068:case 2532:return gt(t,/(.+)-inline(.+)/,yt+"$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(Cr(t)-1-e>6)switch(uo(t,e+1)){case 109:if(uo(t,e+4)!==45)break;case 102:return gt(t,/(.+:)(.+)-([^]+)/,"$1"+yt+"$2-$3$1"+Am+(uo(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~Pm(t,"stretch")?sT(gt(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(uo(t,e+1)!==115)break;case 6444:switch(uo(t,Cr(t)-3-(~Pm(t,"!important")&&10))){case 107:return gt(t,":",":"+yt)+t;case 101:return gt(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+yt+(uo(t,14)===45?"inline-":"")+"box$3$1"+yt+"$2$3$1"+Wo+"$2box$3")+t}break;case 5936:switch(uo(t,e+11)){case 114:return yt+t+Wo+gt(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return yt+t+Wo+gt(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return yt+t+Wo+gt(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return yt+t+Wo+t+t}return t}var wG=function(e,o,n,r){if(e.length>-1&&!e.return)switch(e.type){case au:e.return=sT(e.value,e.length);break;case G1:return Dl([fu(e,{value:gt(e.value,"@","@"+yt)})],r);case iu:if(e.length)return PC(e.props,function(s){switch(AC(s,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Dl([fu(e,{props:[gt(s,/:(read-\w+)/,":"+Am+"$1")]})],r);case"::placeholder":return Dl([fu(e,{props:[gt(s,/:(plac\w+)/,":"+yt+"input-$1")]}),fu(e,{props:[gt(s,/:(plac\w+)/,":"+Am+"$1")]}),fu(e,{props:[gt(s,/:(plac\w+)/,Wo+"input-$1")]})],r)}return""})}},SG=[wG],NC=function(e){var o=e.key;if(o==="css"){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(h){var g=h.getAttribute("data-emotion");g.indexOf(" ")!==-1&&(document.head.appendChild(h),h.setAttribute("data-s",""))})}var r=e.stylisPlugins||SG,s={},i,a=[];i=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+o+' "]'),function(h){for(var g=h.getAttribute("data-emotion").split(" "),b=1;b<g.length;b++)s[g[b]]=!0;a.push(h)});var l,c=[CG,xG];{var u,d=[eT,oT(function(h){u.insert(h)})],f=tT(c.concat(r,d)),m=function(g){return Dl(KR(g),f)};l=function(g,b,v,C){u=v,m(g?g+"{"+b.styles+"}":b.styles),C&&(p.inserted[b.name]=!0)}}var p={key:o,sheet:new MR({key:o,container:i,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:s,registered:{},insert:l};return p.sheet.hydrate(a),p};var jG=!0;function MC(t,e,o){var n="";return o.split(" ").forEach(function(r){t[r]!==void 0?e.push(t[r]+";"):r&&(n+=r+" ")}),n}var ig=function(e,o,n){var r=e.key+"-"+o.name;(n===!1||jG===!1)&&e.registered[r]===void 0&&(e.registered[r]=o.styles)},BC=function(e,o,n){ig(e,o,n);var r=e.key+"-"+o.name;if(e.inserted[o.name]===void 0){var s=o;do e.insert(o===s?"."+r:"",s,e.sheet,!0),s=s.next;while(s!==void 0)}};function bT(t){for(var e=0,o,n=0,r=t.length;r>=4;++n,r-=4)o=t.charCodeAt(n)&255|(t.charCodeAt(++n)&255)<<8|(t.charCodeAt(++n)&255)<<16|(t.charCodeAt(++n)&255)<<24,o=(o&65535)*1540483477+((o>>>16)*59797<<16),o^=o>>>24,e=(o&65535)*1540483477+((o>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(r){case 3:e^=(t.charCodeAt(n+2)&255)<<16;case 2:e^=(t.charCodeAt(n+1)&255)<<8;case 1:e^=t.charCodeAt(n)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var vT={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};var kG=!1,MG=/[A-Z]|^ms/g,BG=/_EMO_([^_]+?)_([^]*?)_EMO_/g,wT=function(e){return e.charCodeAt(1)===45},yT=function(e){return e!=null&&typeof e!="boolean"},OC=rT(function(t){return wT(t)?t:t.replace(MG,"-$&").toLowerCase()}),CT=function(e,o){switch(e){case"animation":case"animationName":if(typeof o=="string")return o.replace(BG,function(n,r,s){return xs={name:r,styles:s,next:xs},r})}return vT[e]!==1&&!wT(e)&&typeof o=="number"&&o!==0?o+"px":o},OG="Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";function Em(t,e,o){if(o==null)return"";var n=o;if(n.__emotion_styles!==void 0)return n;switch(typeof o){case"boolean":return"";case"object":{var r=o;if(r.anim===1)return xs={name:r.name,styles:r.styles,next:xs},r.name;var s=o;if(s.styles!==void 0){var i=s.next;if(i!==void 0)for(;i!==void 0;)xs={name:i.name,styles:i.styles,next:xs},i=i.next;var a=s.styles+";";return a}return VG(t,e,o)}case"function":{if(t!==void 0){var l=xs,c=o(t);return xs=l,Em(t,e,c)}break}}var u=o;if(e==null)return u;var d=e[u];return d!==void 0?d:u}function VG(t,e,o){var n="";if(Array.isArray(o))for(var r=0;r<o.length;r++)n+=Em(t,e,o[r])+";";else for(var s in o){var i=o[s];if(typeof i!="object"){var a=i;e!=null&&e[a]!==void 0?n+=s+"{"+e[a]+"}":yT(a)&&(n+=OC(s)+":"+CT(s,a)+";")}else{if(s==="NO_COMPONENT_SELECTOR"&&kG)throw new Error(OG);if(Array.isArray(i)&&typeof i[0]=="string"&&(e==null||e[i[0]]===void 0))for(var l=0;l<i.length;l++)yT(i[l])&&(n+=OC(s)+":"+CT(s,i[l])+";");else{var c=Em(t,e,i);switch(s){case"animation":case"animationName":{n+=OC(s)+":"+c+";";break}default:n+=s+"{"+c+"}"}}}}return n}var xT=/label:\s*([^\s;{]+)\s*(;|$)/g,xs;function ag(t,e,o){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var n=!0,r="";xs=void 0;var s=t[0];if(s==null||s.raw===void 0)n=!1,r+=Em(o,e,s);else{var i=s;r+=i[0]}for(var a=1;a<t.length;a++)if(r+=Em(o,e,t[a]),n){var l=s;r+=l[a]}xT.lastIndex=0;for(var c="",u;(u=xT.exec(r))!==null;)c+="-"+u[1];var d=bT(r)+c;return{name:d,styles:r,next:xs}}import*as lg from"react";var HG=function(e){return e()},zG=lg.useInsertionEffect?lg.useInsertionEffect:!1,VC=zG||HG;var ST=!1,_T=hn.createContext(typeof HTMLElement<"u"?NC({key:"css"}):null),EAe=_T.Provider;var IT=function(e){return WG(function(o,n){var r=GG(_T);return e(o,r,n)})},RT=hn.createContext({});var cg={}.hasOwnProperty,HC="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",TT=function(e,o){var n={};for(var r in o)cg.call(o,r)&&(n[r]=o[r]);return n[HC]=e,n},UG=function(e){var o=e.cache,n=e.serialized,r=e.isStringTag;return ig(o,n,r),VC(function(){return BC(o,n,r)}),null},XG=IT(function(t,e,o){var n=t.css;typeof n=="string"&&e.registered[n]!==void 0&&(n=e.registered[n]);var r=t[HC],s=[n],i="";typeof t.className=="string"?i=MC(e.registered,s,t.className):t.className!=null&&(i=t.className+" ");var a=ag(s,void 0,hn.useContext(RT));i+=e.key+"-"+a.name;var l={};for(var c in t)cg.call(t,c)&&c!=="css"&&c!==HC&&!ST&&(l[c]=t[c]);return l.className=i,o&&(l.ref=o),hn.createElement(hn.Fragment,null,hn.createElement(UG,{cache:e,serialized:a,isStringTag:typeof r=="string"}),hn.createElement(r,l))}),DT=XG;import*as gu from"react";var zAe=Ji(gT()),Oe=function(e,o){var n=arguments;if(o==null||!cg.call(o,"css"))return gu.createElement.apply(void 0,n);var r=n.length,s=new Array(r);s[0]=DT,s[1]=TT(e,o);for(var i=2;i<r;i++)s[i]=n[i];return gu.createElement.apply(null,s)};(function(t){var e;e||(e=t.JSX||(t.JSX={}))})(Oe||(Oe={}));function Lm(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return ag(e)}function AT(){var t=Lm.apply(void 0,arguments),e="animation-"+t.name;return{name:e,styles:"@keyframes "+e+"{"+t.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}function PT(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}Tk();import{useContext as YG,useRef as WC,useState as fg,useMemo as JG,useCallback as zC,createContext as qG}from"react";import{createPortal as QG}from"react-dom";import{useLayoutEffect as ZG}from"react";var ug=ZG;var KG=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],$m=function(){};function eW(t,e){return e?e[0]==="-"?t+e:t+"__"+e:t}function NT(t,e){for(var o=arguments.length,n=new Array(o>2?o-2:0),r=2;r<o;r++)n[r-2]=arguments[r];var s=[].concat(n);if(e&&t)for(var i in e)e.hasOwnProperty(i)&&e[i]&&s.push("".concat(eW(t,i)));return s.filter(function(a){return a}).map(function(a){return String(a).trim()}).join(" ")}var bu=function(e){return iW(e)?e.filter(Boolean):Mn(e)==="object"&&e!==null?[e]:[]},ET=function(e){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;var o=Or(e,KG);return Me({},o)},to=function(e,o,n){var r=e.cx,s=e.getStyles,i=e.getClassNames,a=e.className;return{css:s(o,e),className:r(n??{},i(o,e),a)}};function jm(t){return[document.documentElement,document.body,window].indexOf(t)>-1}function tW(t){return jm(t)?window.innerHeight:t.clientHeight}function LT(t){return jm(t)?window.pageYOffset:t.scrollTop}function pg(t,e){if(jm(t)){window.scrollTo(0,e);return}t.scrollTop=e}function oW(t){var e=getComputedStyle(t),o=e.position==="absolute",n=/(auto|scroll)/;if(e.position==="fixed")return document.documentElement;for(var r=t;r=r.parentElement;)if(e=getComputedStyle(r),!(o&&e.position==="static")&&n.test(e.overflow+e.overflowY+e.overflowX))return r;return document.documentElement}function rW(t,e,o,n){return o*((t=t/n-1)*t*t+1)+e}function dg(t,e){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:$m,r=LT(t),s=e-r,i=10,a=0;function l(){a+=i;var c=rW(a,r,s,o);pg(t,c),a<o?window.requestAnimationFrame(l):n(t)}l()}function UC(t,e){var o=t.getBoundingClientRect(),n=e.getBoundingClientRect(),r=e.offsetHeight/3;n.bottom+r>o.bottom?pg(t,Math.min(e.offsetTop+e.clientHeight-t.offsetHeight+r,t.scrollHeight)):n.top-r<o.top&&pg(t,Math.max(e.offsetTop-r,0))}function nW(t){var e=t.getBoundingClientRect();return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width}}function XC(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function $T(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var jT=!1,sW={get passive(){return jT=!0}},mg=typeof window<"u"?window:{};mg.addEventListener&&mg.removeEventListener&&(mg.addEventListener("p",$m,sW),mg.removeEventListener("p",$m,!1));var kT=jT;function MT(t){return t!=null}function iW(t){return Array.isArray(t)}function Al(t,e,o){return t?e:o}var BT=function(e){for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];var s=Object.entries(e).filter(function(i){var a=Bn(i,1),l=a[0];return!n.includes(l)});return s.reduce(function(i,a){var l=Bn(a,2),c=l[0],u=l[1];return i[c]=u,i},{})},aW=["children","innerProps"],lW=["children","innerProps"];function cW(t){var e=t.maxHeight,o=t.menuEl,n=t.minHeight,r=t.placement,s=t.shouldScroll,i=t.isFixedPosition,a=t.controlHeight,l=oW(o),c={placement:"bottom",maxHeight:e};if(!o||!o.offsetParent)return c;var u=l.getBoundingClientRect(),d=u.height,f=o.getBoundingClientRect(),m=f.bottom,p=f.height,h=f.top,g=o.offsetParent.getBoundingClientRect(),b=g.top,v=i?window.innerHeight:tW(l),C=LT(l),y=parseInt(getComputedStyle(o).marginBottom,10),x=parseInt(getComputedStyle(o).marginTop,10),w=b-x,S=v-h,_=w+C,I=d-C-h,A=m-v+C+y,D=C+h-x,T=160;switch(r){case"auto":case"bottom":if(S>=p)return{placement:"bottom",maxHeight:e};if(I>=p&&!i)return s&&dg(l,A,T),{placement:"bottom",maxHeight:e};if(!i&&I>=n||i&&S>=n){s&&dg(l,A,T);var R=i?S-y:I-y;return{placement:"bottom",maxHeight:R}}if(r==="auto"||i){var P=e,E=i?w:_;return E>=n&&(P=Math.min(E-y-a,e)),{placement:"top",maxHeight:P}}if(r==="bottom")return s&&pg(l,A),{placement:"bottom",maxHeight:e};break;case"top":if(w>=p)return{placement:"top",maxHeight:e};if(_>=p&&!i)return s&&dg(l,D,T),{placement:"top",maxHeight:e};if(!i&&_>=n||i&&w>=n){var F=e;return(!i&&_>=n||i&&w>=n)&&(F=i?w-x:_-x),s&&dg(l,D,T),{placement:"top",maxHeight:F}}return{placement:"bottom",maxHeight:e};default:throw new Error('Invalid placement provided "'.concat(r,'".'))}return c}function uW(t){var e={bottom:"top",top:"bottom"};return t?e[t]:"bottom"}var OT=function(e){return e==="auto"?"bottom":e},VT=function(e,o){var n,r=e.placement,s=e.theme,i=s.borderRadius,a=s.spacing,l=s.colors;return Me((n={label:"menu"},Rl(n,uW(r),"100%"),Rl(n,"position","absolute"),Rl(n,"width","100%"),Rl(n,"zIndex",1),n),o?{}:{backgroundColor:l.neutral0,borderRadius:i,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:a.menuGutter,marginTop:a.menuGutter})},HT=qG(null),zT=function(e){var o=e.children,n=e.minMenuHeight,r=e.maxMenuHeight,s=e.menuPlacement,i=e.menuPosition,a=e.menuShouldScrollIntoView,l=e.theme,c=YG(HT)||{},u=c.setPortalPlacement,d=WC(null),f=fg(r),m=Bn(f,2),p=m[0],h=m[1],g=fg(null),b=Bn(g,2),v=b[0],C=b[1],y=l.spacing.controlHeight;return ug(function(){var x=d.current;if(x){var w=i==="fixed",S=a&&!w,_=cW({maxHeight:r,menuEl:x,minHeight:n,placement:s,shouldScroll:S,isFixedPosition:w,controlHeight:y});h(_.maxHeight),C(_.placement),u?.(_.placement)}},[r,s,i,a,n,u,y]),o({ref:d,placerProps:Me(Me({},e),{},{placement:v||OT(s),maxHeight:p})})},dW=function(e){var o=e.children,n=e.innerRef,r=e.innerProps;return Oe("div",ke({},to(e,"menu",{menu:!0}),{ref:n},r),o)},mW=dW,GT=function(e,o){var n=e.maxHeight,r=e.theme.spacing.baseUnit;return Me({maxHeight:n,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},o?{}:{paddingBottom:r,paddingTop:r})},fW=function(e){var o=e.children,n=e.innerProps,r=e.innerRef,s=e.isMulti;return Oe("div",ke({},to(e,"menuList",{"menu-list":!0,"menu-list--is-multi":s}),{ref:r},n),o)},WT=function(e,o){var n=e.theme,r=n.spacing.baseUnit,s=n.colors;return Me({textAlign:"center"},o?{}:{color:s.neutral40,padding:"".concat(r*2,"px ").concat(r*3,"px")})},UT=WT,XT=WT,pW=function(e){var o=e.children,n=o===void 0?"No options":o,r=e.innerProps,s=Or(e,aW);return Oe("div",ke({},to(Me(Me({},s),{},{children:n,innerProps:r}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),r),n)},hW=function(e){var o=e.children,n=o===void 0?"Loading...":o,r=e.innerProps,s=Or(e,lW);return Oe("div",ke({},to(Me(Me({},s),{},{children:n,innerProps:r}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),r),n)},ZT=function(e){var o=e.rect,n=e.offset,r=e.position;return{left:o.left,position:r,top:n,width:o.width,zIndex:1}},gW=function(e){var o=e.appendTo,n=e.children,r=e.controlElement,s=e.innerProps,i=e.menuPlacement,a=e.menuPosition,l=WC(null),c=WC(null),u=fg(OT(i)),d=Bn(u,2),f=d[0],m=d[1],p=JG(function(){return{setPortalPlacement:m}},[]),h=fg(null),g=Bn(h,2),b=g[0],v=g[1],C=zC(function(){if(r){var S=nW(r),_=a==="fixed"?0:window.pageYOffset,I=S[f]+_;(I!==b?.offset||S.left!==b?.rect.left||S.width!==b?.rect.width)&&v({offset:I,rect:S})}},[r,a,f,b?.offset,b?.rect.left,b?.rect.width]);ug(function(){C()},[C]);var y=zC(function(){typeof c.current=="function"&&(c.current(),c.current=null),r&&l.current&&(c.current=_4(r,l.current,C,{elementResize:"ResizeObserver"in window}))},[r,C]);ug(function(){y()},[y]);var x=zC(function(S){l.current=S,y()},[y]);if(!o&&a!=="fixed"||!b)return null;var w=Oe("div",ke({ref:x},to(Me(Me({},e),{},{offset:b.offset,position:a,rect:b.rect}),"menuPortal",{"menu-portal":!0}),s),n);return Oe(HT.Provider,{value:p},o?QG(w,o):w)},YT=function(e){var o=e.isDisabled,n=e.isRtl;return{label:"container",direction:n?"rtl":void 0,pointerEvents:o?"none":void 0,position:"relative"}},bW=function(e){var o=e.children,n=e.innerProps,r=e.isDisabled,s=e.isRtl;return Oe("div",ke({},to(e,"container",{"--is-disabled":r,"--is-rtl":s}),n),o)},JT=function(e,o){var n=e.theme.spacing,r=e.isMulti,s=e.hasValue,i=e.selectProps.controlShouldRenderValue;return Me({alignItems:"center",display:r&&s&&i?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},o?{}:{padding:"".concat(n.baseUnit/2,"px ").concat(n.baseUnit*2,"px")})},vW=function(e){var o=e.children,n=e.innerProps,r=e.isMulti,s=e.hasValue;return Oe("div",ke({},to(e,"valueContainer",{"value-container":!0,"value-container--is-multi":r,"value-container--has-value":s}),n),o)},qT=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},yW=function(e){var o=e.children,n=e.innerProps;return Oe("div",ke({},to(e,"indicatorsContainer",{indicators:!0}),n),o)},FT,CW=["size"],xW=["innerProps","isRtl","size"];var wW={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},QT=function(e){var o=e.size,n=Or(e,CW);return Oe("svg",ke({height:o,width:o,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:wW},n))},ZC=function(e){return Oe(QT,ke({size:20},e),Oe("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"}))},KT=function(e){return Oe(QT,ke({size:20},e),Oe("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"}))},eD=function(e,o){var n=e.isFocused,r=e.theme,s=r.spacing.baseUnit,i=r.colors;return Me({label:"indicatorContainer",display:"flex",transition:"color 150ms"},o?{}:{color:n?i.neutral60:i.neutral20,padding:s*2,":hover":{color:n?i.neutral80:i.neutral40}})},tD=eD,SW=function(e){var o=e.children,n=e.innerProps;return Oe("div",ke({},to(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),n),o||Oe(KT,null))},oD=eD,_W=function(e){var o=e.children,n=e.innerProps;return Oe("div",ke({},to(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),n),o||Oe(ZC,null))},rD=function(e,o){var n=e.isDisabled,r=e.theme,s=r.spacing.baseUnit,i=r.colors;return Me({label:"indicatorSeparator",alignSelf:"stretch",width:1},o?{}:{backgroundColor:n?i.neutral10:i.neutral20,marginBottom:s*2,marginTop:s*2})},IW=function(e){var o=e.innerProps;return Oe("span",ke({},o,to(e,"indicatorSeparator",{"indicator-separator":!0})))},RW=AT(FT||(FT=PT([`
51
- 0%, 80%, 100% { opacity: 0; }
52
- 40% { opacity: 1; }
53
- `]))),nD=function(e,o){var n=e.isFocused,r=e.size,s=e.theme,i=s.colors,a=s.spacing.baseUnit;return Me({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:r,lineHeight:1,marginRight:r,textAlign:"center",verticalAlign:"middle"},o?{}:{color:n?i.neutral60:i.neutral20,padding:a*2})},GC=function(e){var o=e.delay,n=e.offset;return Oe("span",{css:Lm({animation:"".concat(RW," 1s ease-in-out ").concat(o,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:n?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},TW=function(e){var o=e.innerProps,n=e.isRtl,r=e.size,s=r===void 0?4:r,i=Or(e,xW);return Oe("div",ke({},to(Me(Me({},i),{},{innerProps:o,isRtl:n,size:s}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),o),Oe(GC,{delay:0,offset:n}),Oe(GC,{delay:160,offset:!0}),Oe(GC,{delay:320,offset:!n}))},sD=function(e,o){var n=e.isDisabled,r=e.isFocused,s=e.theme,i=s.colors,a=s.borderRadius,l=s.spacing;return Me({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:l.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},o?{}:{backgroundColor:n?i.neutral5:i.neutral0,borderColor:n?i.neutral10:r?i.primary:i.neutral20,borderRadius:a,borderStyle:"solid",borderWidth:1,boxShadow:r?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:r?i.primary:i.neutral30}})},DW=function(e){var o=e.children,n=e.isDisabled,r=e.isFocused,s=e.innerRef,i=e.innerProps,a=e.menuIsOpen;return Oe("div",ke({ref:s},to(e,"control",{control:!0,"control--is-disabled":n,"control--is-focused":r,"control--menu-is-open":a}),i,{"aria-disabled":n||void 0}),o)},AW=DW,PW=["data"],iD=function(e,o){var n=e.theme.spacing;return o?{}:{paddingBottom:n.baseUnit*2,paddingTop:n.baseUnit*2}},FW=function(e){var o=e.children,n=e.cx,r=e.getStyles,s=e.getClassNames,i=e.Heading,a=e.headingProps,l=e.innerProps,c=e.label,u=e.theme,d=e.selectProps;return Oe("div",ke({},to(e,"group",{group:!0}),l),Oe(i,ke({},a,{selectProps:d,theme:u,getStyles:r,getClassNames:s,cx:n}),c),Oe("div",null,o))},aD=function(e,o){var n=e.theme,r=n.colors,s=n.spacing;return Me({label:"group",cursor:"default",display:"block"},o?{}:{color:r.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:s.baseUnit*3,paddingRight:s.baseUnit*3,textTransform:"uppercase"})},NW=function(e){var o=ET(e);o.data;var n=Or(o,PW);return Oe("div",ke({},to(e,"groupHeading",{"group-heading":!0}),n))},EW=FW,LW=["innerRef","isDisabled","isHidden","inputClassName"],lD=function(e,o){var n=e.isDisabled,r=e.value,s=e.theme,i=s.spacing,a=s.colors;return Me(Me({visibility:n?"hidden":"visible",transform:r?"translateZ(0)":""},$W),o?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:a.neutral80})},cD={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},$W={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":Me({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},cD)},jW=function(e){return Me({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},cD)},kW=function(e){var o=e.cx,n=e.value,r=ET(e),s=r.innerRef,i=r.isDisabled,a=r.isHidden,l=r.inputClassName,c=Or(r,LW);return Oe("div",ke({},to(e,"input",{"input-container":!0}),{"data-value":n||""}),Oe("input",ke({className:o({input:!0},l),ref:s,style:jW(a),disabled:i},c)))},MW=kW,uD=function(e,o){var n=e.theme,r=n.spacing,s=n.borderRadius,i=n.colors;return Me({label:"multiValue",display:"flex",minWidth:0},o?{}:{backgroundColor:i.neutral10,borderRadius:s/2,margin:r.baseUnit/2})},dD=function(e,o){var n=e.theme,r=n.borderRadius,s=n.colors,i=e.cropWithEllipsis;return Me({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},o?{}:{borderRadius:r/2,color:s.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},mD=function(e,o){var n=e.theme,r=n.spacing,s=n.borderRadius,i=n.colors,a=e.isFocused;return Me({alignItems:"center",display:"flex"},o?{}:{borderRadius:s/2,backgroundColor:a?i.dangerLight:void 0,paddingLeft:r.baseUnit,paddingRight:r.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},fD=function(e){var o=e.children,n=e.innerProps;return Oe("div",n,o)},BW=fD,OW=fD;function VW(t){var e=t.children,o=t.innerProps;return Oe("div",ke({role:"button"},o),e||Oe(ZC,{size:14}))}var HW=function(e){var o=e.children,n=e.components,r=e.data,s=e.innerProps,i=e.isDisabled,a=e.removeProps,l=e.selectProps,c=n.Container,u=n.Label,d=n.Remove;return Oe(c,{data:r,innerProps:Me(Me({},to(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),s),selectProps:l},Oe(u,{data:r,innerProps:Me({},to(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},o),Oe(d,{data:r,innerProps:Me(Me({},to(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(o||"option")},a),selectProps:l}))},zW=HW,pD=function(e,o){var n=e.isDisabled,r=e.isFocused,s=e.isSelected,i=e.theme,a=i.spacing,l=i.colors;return Me({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},o?{}:{backgroundColor:s?l.primary:r?l.primary25:"transparent",color:n?l.neutral20:s?l.neutral0:"inherit",padding:"".concat(a.baseUnit*2,"px ").concat(a.baseUnit*3,"px"),":active":{backgroundColor:n?void 0:s?l.primary:l.primary50}})},GW=function(e){var o=e.children,n=e.isDisabled,r=e.isFocused,s=e.isSelected,i=e.innerRef,a=e.innerProps;return Oe("div",ke({},to(e,"option",{option:!0,"option--is-disabled":n,"option--is-focused":r,"option--is-selected":s}),{ref:i,"aria-disabled":n},a),o)},WW=GW,hD=function(e,o){var n=e.theme,r=n.spacing,s=n.colors;return Me({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},o?{}:{color:s.neutral50,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2})},UW=function(e){var o=e.children,n=e.innerProps;return Oe("div",ke({},to(e,"placeholder",{placeholder:!0}),n),o)},XW=UW,gD=function(e,o){var n=e.isDisabled,r=e.theme,s=r.spacing,i=r.colors;return Me({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},o?{}:{color:n?i.neutral40:i.neutral80,marginLeft:s.baseUnit/2,marginRight:s.baseUnit/2})},ZW=function(e){var o=e.children,n=e.isDisabled,r=e.innerProps;return Oe("div",ke({},to(e,"singleValue",{"single-value":!0,"single-value--is-disabled":n}),r),o)},YW=ZW,oo={ClearIndicator:_W,Control:AW,DropdownIndicator:SW,DownChevron:KT,CrossIcon:ZC,Group:EW,GroupHeading:NW,IndicatorsContainer:yW,IndicatorSeparator:IW,Input:MW,LoadingIndicator:TW,Menu:mW,MenuList:fW,MenuPortal:gW,LoadingMessage:hW,NoOptionsMessage:pW,MultiValue:zW,MultiValueContainer:BW,MultiValueLabel:OW,MultiValueRemove:VW,Option:WW,Placeholder:XW,SelectContainer:bW,SingleValue:YW,ValueContainer:vW},bD=function(e){return Me(Me({},oo),e.components)};var vD=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function JW(t,e){return!!(t===e||vD(t)&&vD(e))}function qW(t,e){if(t.length!==e.length)return!1;for(var o=0;o<t.length;o++)if(!JW(t[o],e[o]))return!1;return!0}function yD(t,e){e===void 0&&(e=qW);var o=null;function n(){for(var r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];if(o&&o.lastThis===this&&e(r,o.lastArgs))return o.lastResult;var i=t.apply(this,r);return o={lastResult:i,lastArgs:r,lastThis:this},i}return n.clear=function(){o=null},n}var KW={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"},eU=function(e){return Oe("span",ke({css:KW},e))},CD=eU,tU={guidance:function(e){var o=e.isSearchable,n=e.isMulti,r=e.tabSelectsValue,s=e.context,i=e.isInitialFocus;switch(s){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(r?", press Tab to select the option and exit the menu":"",".");case"input":return i?"".concat(e["aria-label"]||"Select"," is focused ").concat(o?",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 o=e.action,n=e.label,r=n===void 0?"":n,s=e.labels,i=e.isDisabled;switch(o){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(r,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(s.length>1?"s":""," ").concat(s.join(","),", selected.");case"select-option":return i?"option ".concat(r," is disabled. Select another option."):"option ".concat(r,", selected.");default:return""}},onFocus:function(e){var o=e.context,n=e.focused,r=e.options,s=e.label,i=s===void 0?"":s,a=e.selectValue,l=e.isDisabled,c=e.isSelected,u=e.isAppleDevice,d=function(h,g){return h&&h.length?"".concat(h.indexOf(g)+1," of ").concat(h.length):""};if(o==="value"&&a)return"value ".concat(i," focused, ").concat(d(a,n),".");if(o==="menu"&&u){var f=l?" disabled":"",m="".concat(c?" selected":"").concat(f);return"".concat(i).concat(m,", ").concat(d(r,n),".")}return""},onFilter:function(e){var o=e.inputValue,n=e.resultsMessage;return"".concat(n).concat(o?" for search term "+o:"",".")}},oU=function(e){var o=e.ariaSelection,n=e.focusedOption,r=e.focusedValue,s=e.focusableOptions,i=e.isFocused,a=e.selectValue,l=e.selectProps,c=e.id,u=e.isAppleDevice,d=l.ariaLiveMessages,f=l.getOptionLabel,m=l.inputValue,p=l.isMulti,h=l.isOptionDisabled,g=l.isSearchable,b=l.menuIsOpen,v=l.options,C=l.screenReaderStatus,y=l.tabSelectsValue,x=l.isLoading,w=l["aria-label"],S=l["aria-live"],_=km(function(){return Me(Me({},tU),d||{})},[d]),I=km(function(){var E="";if(o&&_.onChange){var F=o.option,L=o.options,M=o.removedValue,$=o.removedValues,B=o.value,j=function(U){return Array.isArray(U)?null:U},k=M||F||j(B),O=k?f(k):"",V=L||$||void 0,H=V?V.map(f):[],z=Me({isDisabled:k&&h(k,a),label:O,labels:H},o);E=_.onChange(z)}return E},[o,_,h,a,f]),A=km(function(){var E="",F=n||r,L=!!(n&&a&&a.includes(n));if(F&&_.onFocus){var M={focused:F,label:f(F),isDisabled:h(F,a),isSelected:L,options:s,context:F===n?"menu":"value",selectValue:a,isAppleDevice:u};E=_.onFocus(M)}return E},[n,r,f,h,_,s,a,u]),D=km(function(){var E="";if(b&&v.length&&!x&&_.onFilter){var F=C({count:s.length});E=_.onFilter({inputValue:m,resultsMessage:F})}return E},[s,m,b,_,v,C,x]),T=o?.action==="initial-input-focus",R=km(function(){var E="";if(_.guidance){var F=r?"value":b?"menu":"input";E=_.guidance({"aria-label":w,context:F,isDisabled:n&&h(n,a),isMulti:p,isSearchable:g,tabSelectsValue:y,isInitialFocus:T})}return E},[w,n,r,p,h,g,b,_,a,y,T]),P=Oe(qC,null,Oe("span",{id:"aria-selection"},I),Oe("span",{id:"aria-focused"},A),Oe("span",{id:"aria-results"},D),Oe("span",{id:"aria-guidance"},R));return Oe(qC,null,Oe(CD,{id:c},T&&P),Oe(CD,{"aria-live":S,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!T&&P))},rU=oU,QC=[{base:"A",letters:"A\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"},{base:"AA",letters:"\uA732"},{base:"AE",letters:"\xC6\u01FC\u01E2"},{base:"AO",letters:"\uA734"},{base:"AU",letters:"\uA736"},{base:"AV",letters:"\uA738\uA73A"},{base:"AY",letters:"\uA73C"},{base:"B",letters:"B\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181"},{base:"C",letters:"C\u24B8\uFF23\u0106\u0108\u010A\u010C\xC7\u1E08\u0187\u023B\uA73E"},{base:"D",letters:"D\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779"},{base:"DZ",letters:"\u01F1\u01C4"},{base:"Dz",letters:"\u01F2\u01C5"},{base:"E",letters:"E\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E"},{base:"F",letters:"F\u24BB\uFF26\u1E1E\u0191\uA77B"},{base:"G",letters:"G\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E"},{base:"H",letters:"H\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"},{base:"I",letters:"I\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"},{base:"J",letters:"J\u24BF\uFF2A\u0134\u0248"},{base:"K",letters:"K\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"},{base:"L",letters:"L\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"},{base:"LJ",letters:"\u01C7"},{base:"Lj",letters:"\u01C8"},{base:"M",letters:"M\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C"},{base:"N",letters:"N\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4"},{base:"NJ",letters:"\u01CA"},{base:"Nj",letters:"\u01CB"},{base:"O",letters:"O\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C"},{base:"OI",letters:"\u01A2"},{base:"OO",letters:"\uA74E"},{base:"OU",letters:"\u0222"},{base:"P",letters:"P\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"},{base:"Q",letters:"Q\u24C6\uFF31\uA756\uA758\u024A"},{base:"R",letters:"R\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"},{base:"S",letters:"S\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"},{base:"T",letters:"T\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"},{base:"TZ",letters:"\uA728"},{base:"U",letters:"U\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244"},{base:"V",letters:"V\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"},{base:"VY",letters:"\uA760"},{base:"W",letters:"W\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"},{base:"X",letters:"X\u24CD\uFF38\u1E8A\u1E8C"},{base:"Y",letters:"Y\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"},{base:"Z",letters:"Z\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"},{base:"a",letters:"a\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250"},{base:"aa",letters:"\uA733"},{base:"ae",letters:"\xE6\u01FD\u01E3"},{base:"ao",letters:"\uA735"},{base:"au",letters:"\uA737"},{base:"av",letters:"\uA739\uA73B"},{base:"ay",letters:"\uA73D"},{base:"b",letters:"b\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253"},{base:"c",letters:"c\u24D2\uFF43\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"},{base:"d",letters:"d\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A"},{base:"dz",letters:"\u01F3\u01C6"},{base:"e",letters:"e\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD"},{base:"f",letters:"f\u24D5\uFF46\u1E1F\u0192\uA77C"},{base:"g",letters:"g\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F"},{base:"h",letters:"h\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"},{base:"hv",letters:"\u0195"},{base:"i",letters:"i\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"},{base:"j",letters:"j\u24D9\uFF4A\u0135\u01F0\u0249"},{base:"k",letters:"k\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"},{base:"l",letters:"l\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747"},{base:"lj",letters:"\u01C9"},{base:"m",letters:"m\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"},{base:"n",letters:"n\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5"},{base:"nj",letters:"\u01CC"},{base:"o",letters:"o\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\u0254\uA74B\uA74D\u0275"},{base:"oi",letters:"\u01A3"},{base:"ou",letters:"\u0223"},{base:"oo",letters:"\uA74F"},{base:"p",letters:"p\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755"},{base:"q",letters:"q\u24E0\uFF51\u024B\uA757\uA759"},{base:"r",letters:"r\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"},{base:"s",letters:"s\u24E2\uFF53\xDF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B"},{base:"t",letters:"t\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"},{base:"tz",letters:"\uA729"},{base:"u",letters:"u\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289"},{base:"v",letters:"v\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"},{base:"vy",letters:"\uA761"},{base:"w",letters:"w\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"},{base:"x",letters:"x\u24E7\uFF58\u1E8B\u1E8D"},{base:"y",letters:"y\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"},{base:"z",letters:"z\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"}],nU=new RegExp("["+QC.map(function(t){return t.letters}).join("")+"]","g"),ED={};for(hg=0;hg<QC.length;hg++)for(gg=QC[hg],bg=0;bg<gg.letters.length;bg++)ED[gg.letters[bg]]=gg.base;var gg,bg,hg,LD=function(e){return e.replace(nU,function(o){return ED[o]})},sU=yD(LD),xD=function(e){return e.replace(/^\s+|\s+$/g,"")},iU=function(e){return"".concat(e.label," ").concat(e.value)},aU=function(e){return function(o,n){if(o.data.__isNew__)return!0;var r=Me({ignoreCase:!0,ignoreAccents:!0,stringify:iU,trim:!0,matchFrom:"any"},e),s=r.ignoreCase,i=r.ignoreAccents,a=r.stringify,l=r.trim,c=r.matchFrom,u=l?xD(n):n,d=l?xD(a(o)):a(o);return s&&(u=u.toLowerCase(),d=d.toLowerCase()),i&&(u=sU(u),d=LD(d)),c==="start"?d.substr(0,u.length)===u:d.indexOf(u)>-1}},lU=["innerRef"];function cU(t){var e=t.innerRef,o=Or(t,lU),n=BT(o,"onExited","in","enter","exit","appear");return Oe("input",ke({ref:e},n,{css:Lm({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 uU=function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()};function dU(t){var e=t.isEnabled,o=t.onBottomArrive,n=t.onBottomLeave,r=t.onTopArrive,s=t.onTopLeave,i=yu(!1),a=yu(!1),l=yu(0),c=yu(null),u=fa(function(g,b){if(c.current!==null){var v=c.current,C=v.scrollTop,y=v.scrollHeight,x=v.clientHeight,w=c.current,S=b>0,_=y-x-C,I=!1;_>b&&i.current&&(n&&n(g),i.current=!1),S&&a.current&&(s&&s(g),a.current=!1),S&&b>_?(o&&!i.current&&o(g),w.scrollTop=y,I=!0,i.current=!0):!S&&-b>C&&(r&&!a.current&&r(g),w.scrollTop=0,I=!0,a.current=!0),I&&uU(g)}},[o,n,r,s]),d=fa(function(g){u(g,g.deltaY)},[u]),f=fa(function(g){l.current=g.changedTouches[0].clientY},[]),m=fa(function(g){var b=l.current-g.changedTouches[0].clientY;u(g,b)},[u]),p=fa(function(g){if(g){var b=kT?{passive:!1}:!1;g.addEventListener("wheel",d,b),g.addEventListener("touchstart",f,b),g.addEventListener("touchmove",m,b)}},[m,f,d]),h=fa(function(g){g&&(g.removeEventListener("wheel",d,!1),g.removeEventListener("touchstart",f,!1),g.removeEventListener("touchmove",m,!1))},[m,f,d]);return ND(function(){if(e){var g=c.current;return p(g),function(){h(g)}}},[e,p,h]),function(g){c.current=g}}var wD=["boxSizing","height","overflow","paddingRight","position"],SD={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function _D(t){t.cancelable&&t.preventDefault()}function ID(t){t.stopPropagation()}function RD(){var t=this.scrollTop,e=this.scrollHeight,o=t+this.offsetHeight;t===0?this.scrollTop=1:o===e&&(this.scrollTop=t-1)}function TD(){return"ontouchstart"in window||navigator.maxTouchPoints}var DD=!!(typeof window<"u"&&window.document&&window.document.createElement),Mm=0,vu={capture:!1,passive:!1};function mU(t){var e=t.isEnabled,o=t.accountForScrollbars,n=o===void 0?!0:o,r=yu({}),s=yu(null),i=fa(function(l){if(DD){var c=document.body,u=c&&c.style;if(n&&wD.forEach(function(p){var h=u&&u[p];r.current[p]=h}),n&&Mm<1){var d=parseInt(r.current.paddingRight,10)||0,f=document.body?document.body.clientWidth:0,m=window.innerWidth-f+d||0;Object.keys(SD).forEach(function(p){var h=SD[p];u&&(u[p]=h)}),u&&(u.paddingRight="".concat(m,"px"))}c&&TD()&&(c.addEventListener("touchmove",_D,vu),l&&(l.addEventListener("touchstart",RD,vu),l.addEventListener("touchmove",ID,vu))),Mm+=1}},[n]),a=fa(function(l){if(DD){var c=document.body,u=c&&c.style;Mm=Math.max(Mm-1,0),n&&Mm<1&&wD.forEach(function(d){var f=r.current[d];u&&(u[d]=f)}),c&&TD()&&(c.removeEventListener("touchmove",_D,vu),l&&(l.removeEventListener("touchstart",RD,vu),l.removeEventListener("touchmove",ID,vu)))}},[n]);return ND(function(){if(e){var l=s.current;return i(l),function(){a(l)}}},[e,i,a]),function(l){s.current=l}}var fU=function(e){var o=e.target;return o.ownerDocument.activeElement&&o.ownerDocument.activeElement.blur()},pU={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function hU(t){var e=t.children,o=t.lockEnabled,n=t.captureEnabled,r=n===void 0?!0:n,s=t.onBottomArrive,i=t.onBottomLeave,a=t.onTopArrive,l=t.onTopLeave,c=dU({isEnabled:r,onBottomArrive:s,onBottomLeave:i,onTopArrive:a,onTopLeave:l}),u=mU({isEnabled:o}),d=function(m){c(m),u(m)};return Oe(qC,null,o&&Oe("div",{onClick:fU,css:pU}),e(d))}var gU={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},bU=function(e){var o=e.name,n=e.onFocus;return Oe("input",{required:!0,name:o,tabIndex:-1,"aria-hidden":"true",onFocus:n,css:gU,value:"",onChange:function(){}})},vU=bU;function KC(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function yU(){return KC(/^iPhone/i)}function $D(){return KC(/^Mac/i)}function CU(){return KC(/^iPad/i)||$D()&&navigator.maxTouchPoints>1}function xU(){return yU()||CU()}function wU(){return $D()||xU()}var SU=function(e){return e.label},ex=function(e){return e.label},tx=function(e){return e.value},_U=function(e){return!!e.isDisabled},IU={clearIndicator:oD,container:YT,control:sD,dropdownIndicator:tD,group:iD,groupHeading:aD,indicatorsContainer:qT,indicatorSeparator:rD,input:lD,loadingIndicator:nD,loadingMessage:XT,menu:VT,menuList:GT,menuPortal:ZT,multiValue:uD,multiValueLabel:dD,multiValueRemove:mD,noOptionsMessage:UT,option:pD,placeholder:hD,singleValue:gD,valueContainer:JT};var RU={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%)"},TU=4,jD=4,DU=38,AU=jD*2,PU={baseUnit:jD,controlHeight:DU,menuGutter:AU},YC={borderRadius:TU,colors:RU,spacing:PU},FU={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:XC(),captureMenuScroll:!XC(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:aU(),formatGroupLabel:SU,getOptionLabel:ex,getOptionValue:tx,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:_U,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!$T(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var o=e.count;return"".concat(o," result").concat(o!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function AD(t,e,o,n){var r=BD(t,e,o),s=OD(t,e,o),i=MD(t,e),a=yg(t,e);return{type:"option",data:e,isDisabled:r,isSelected:s,label:i,value:a,index:n}}function vg(t,e){return t.options.map(function(o,n){if("options"in o){var r=o.options.map(function(i,a){return AD(t,i,e,a)}).filter(function(i){return FD(t,i)});return r.length>0?{type:"group",data:o,options:r,index:n}:void 0}var s=AD(t,o,e,n);return FD(t,s)?s:void 0}).filter(MT)}function kD(t){return t.reduce(function(e,o){return o.type==="group"?e.push.apply(e,da(o.options.map(function(n){return n.data}))):e.push(o.data),e},[])}function PD(t,e){return t.reduce(function(o,n){return n.type==="group"?o.push.apply(o,da(n.options.map(function(r){return{data:r.data,id:"".concat(e,"-").concat(n.index,"-").concat(r.index)}}))):o.push({data:n.data,id:"".concat(e,"-").concat(n.index)}),o},[])}function NU(t,e){return kD(vg(t,e))}function FD(t,e){var o=t.inputValue,n=o===void 0?"":o,r=e.data,s=e.isSelected,i=e.label,a=e.value;return(!HD(t)||!s)&&VD(t,{label:i,value:a,data:r},n)}function EU(t,e){var o=t.focusedValue,n=t.selectValue,r=n.indexOf(o);if(r>-1){var s=e.indexOf(o);if(s>-1)return o;if(r<e.length)return e[r]}return null}function LU(t,e){var o=t.focusedOption;return o&&e.indexOf(o)>-1?o:e[0]}var JC=function(e,o){var n,r=(n=e.find(function(s){return s.data===o}))===null||n===void 0?void 0:n.id;return r||null},MD=function(e,o){return e.getOptionLabel(o)},yg=function(e,o){return e.getOptionValue(o)};function BD(t,e,o){return typeof t.isOptionDisabled=="function"?t.isOptionDisabled(e,o):!1}function OD(t,e,o){if(o.indexOf(e)>-1)return!0;if(typeof t.isOptionSelected=="function")return t.isOptionSelected(e,o);var n=yg(t,e);return o.some(function(r){return yg(t,r)===n})}function VD(t,e,o){return t.filterOption?t.filterOption(e,o):!0}var HD=function(e){var o=e.hideSelectedOptions,n=e.isMulti;return o===void 0?n:o},$U=1,Bm=(function(t){NR(o,t);var e=LR(o);function o(n){var r;if(AR(this,o),r=e.call(this,n),r.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:""},r.blockOptionHover=!1,r.isComposing=!1,r.commonProps=void 0,r.initialTouchX=0,r.initialTouchY=0,r.openAfterFocus=!1,r.scrollToFocusedOptionOnUpdate=!1,r.userIsDragging=void 0,r.isAppleDevice=wU(),r.controlRef=null,r.getControlRef=function(l){r.controlRef=l},r.focusedOptionRef=null,r.getFocusedOptionRef=function(l){r.focusedOptionRef=l},r.menuListRef=null,r.getMenuListRef=function(l){r.menuListRef=l},r.inputRef=null,r.getInputRef=function(l){r.inputRef=l},r.focus=r.focusInput,r.blur=r.blurInput,r.onChange=function(l,c){var u=r.props,d=u.onChange,f=u.name;c.name=f,r.ariaOnChange(l,c),d(l,c)},r.setValue=function(l,c,u){var d=r.props,f=d.closeMenuOnSelect,m=d.isMulti,p=d.inputValue;r.onInputChange("",{action:"set-value",prevInputValue:p}),f&&(r.setState({inputIsHiddenAfterUpdate:!m}),r.onMenuClose()),r.setState({clearFocusValueOnUpdate:!0}),r.onChange(l,{action:c,option:u})},r.selectOption=function(l){var c=r.props,u=c.blurInputOnSelect,d=c.isMulti,f=c.name,m=r.state.selectValue,p=d&&r.isOptionSelected(l,m),h=r.isOptionDisabled(l,m);if(p){var g=r.getOptionValue(l);r.setValue(m.filter(function(b){return r.getOptionValue(b)!==g}),"deselect-option",l)}else if(!h)d?r.setValue([].concat(da(m),[l]),"select-option",l):r.setValue(l,"select-option");else{r.ariaOnChange(l,{action:"select-option",option:l,name:f});return}u&&r.blurInput()},r.removeValue=function(l){var c=r.props.isMulti,u=r.state.selectValue,d=r.getOptionValue(l),f=u.filter(function(p){return r.getOptionValue(p)!==d}),m=Al(c,f,f[0]||null);r.onChange(m,{action:"remove-value",removedValue:l}),r.focusInput()},r.clearValue=function(){var l=r.state.selectValue;r.onChange(Al(r.props.isMulti,[],null),{action:"clear",removedValues:l})},r.popValue=function(){var l=r.props.isMulti,c=r.state.selectValue,u=c[c.length-1],d=c.slice(0,c.length-1),f=Al(l,d,d[0]||null);u&&r.onChange(f,{action:"pop-value",removedValue:u})},r.getFocusedOptionId=function(l){return JC(r.state.focusableOptionsWithIds,l)},r.getFocusableOptionsWithIds=function(){return PD(vg(r.props,r.state.selectValue),r.getElementId("option"))},r.getValue=function(){return r.state.selectValue},r.cx=function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];return NT.apply(void 0,[r.props.classNamePrefix].concat(c))},r.getOptionLabel=function(l){return MD(r.props,l)},r.getOptionValue=function(l){return yg(r.props,l)},r.getStyles=function(l,c){var u=r.props.unstyled,d=IU[l](c,u);d.boxSizing="border-box";var f=r.props.styles[l];return f?f(d,c):d},r.getClassNames=function(l,c){var u,d;return(u=(d=r.props.classNames)[l])===null||u===void 0?void 0:u.call(d,c)},r.getElementId=function(l){return"".concat(r.state.instancePrefix,"-").concat(l)},r.getComponents=function(){return bD(r.props)},r.buildCategorizedOptions=function(){return vg(r.props,r.state.selectValue)},r.getCategorizedOptions=function(){return r.props.menuIsOpen?r.buildCategorizedOptions():[]},r.buildFocusableOptions=function(){return kD(r.buildCategorizedOptions())},r.getFocusableOptions=function(){return r.props.menuIsOpen?r.buildFocusableOptions():[]},r.ariaOnChange=function(l,c){r.setState({ariaSelection:Me({value:l},c)})},r.onMenuMouseDown=function(l){l.button===0&&(l.stopPropagation(),l.preventDefault(),r.focusInput())},r.onMenuMouseMove=function(l){r.blockOptionHover=!1},r.onControlMouseDown=function(l){if(!l.defaultPrevented){var c=r.props.openMenuOnClick;r.state.isFocused?r.props.menuIsOpen?l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&r.onMenuClose():c&&r.openMenu("first"):(c&&(r.openAfterFocus=!0),r.focusInput()),l.target.tagName!=="INPUT"&&l.target.tagName!=="TEXTAREA"&&l.preventDefault()}},r.onDropdownIndicatorMouseDown=function(l){if(!(l&&l.type==="mousedown"&&l.button!==0)&&!r.props.isDisabled){var c=r.props,u=c.isMulti,d=c.menuIsOpen;r.focusInput(),d?(r.setState({inputIsHiddenAfterUpdate:!u}),r.onMenuClose()):r.openMenu("first"),l.preventDefault()}},r.onClearIndicatorMouseDown=function(l){l&&l.type==="mousedown"&&l.button!==0||(r.clearValue(),l.preventDefault(),r.openAfterFocus=!1,l.type==="touchend"?r.focusInput():setTimeout(function(){return r.focusInput()}))},r.onScroll=function(l){typeof r.props.closeMenuOnScroll=="boolean"?l.target instanceof HTMLElement&&jm(l.target)&&r.props.onMenuClose():typeof r.props.closeMenuOnScroll=="function"&&r.props.closeMenuOnScroll(l)&&r.props.onMenuClose()},r.onCompositionStart=function(){r.isComposing=!0},r.onCompositionEnd=function(){r.isComposing=!1},r.onTouchStart=function(l){var c=l.touches,u=c&&c.item(0);u&&(r.initialTouchX=u.clientX,r.initialTouchY=u.clientY,r.userIsDragging=!1)},r.onTouchMove=function(l){var c=l.touches,u=c&&c.item(0);if(u){var d=Math.abs(u.clientX-r.initialTouchX),f=Math.abs(u.clientY-r.initialTouchY),m=5;r.userIsDragging=d>m||f>m}},r.onTouchEnd=function(l){r.userIsDragging||(r.controlRef&&!r.controlRef.contains(l.target)&&r.menuListRef&&!r.menuListRef.contains(l.target)&&r.blurInput(),r.initialTouchX=0,r.initialTouchY=0)},r.onControlTouchEnd=function(l){r.userIsDragging||r.onControlMouseDown(l)},r.onClearIndicatorTouchEnd=function(l){r.userIsDragging||r.onClearIndicatorMouseDown(l)},r.onDropdownIndicatorTouchEnd=function(l){r.userIsDragging||r.onDropdownIndicatorMouseDown(l)},r.handleInputChange=function(l){var c=r.props.inputValue,u=l.currentTarget.value;r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange(u,{action:"input-change",prevInputValue:c}),r.props.menuIsOpen||r.onMenuOpen()},r.onInputFocus=function(l){r.props.onFocus&&r.props.onFocus(l),r.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(r.openAfterFocus||r.props.openMenuOnFocus)&&r.openMenu("first"),r.openAfterFocus=!1},r.onInputBlur=function(l){var c=r.props.inputValue;if(r.menuListRef&&r.menuListRef.contains(document.activeElement)){r.inputRef.focus();return}r.props.onBlur&&r.props.onBlur(l),r.onInputChange("",{action:"input-blur",prevInputValue:c}),r.onMenuClose(),r.setState({focusedValue:null,isFocused:!1})},r.onOptionHover=function(l){if(!(r.blockOptionHover||r.state.focusedOption===l)){var c=r.getFocusableOptions(),u=c.indexOf(l);r.setState({focusedOption:l,focusedOptionId:u>-1?r.getFocusedOptionId(l):null})}},r.shouldHideSelectedOptions=function(){return HD(r.props)},r.onValueInputFocus=function(l){l.preventDefault(),l.stopPropagation(),r.focus()},r.onKeyDown=function(l){var c=r.props,u=c.isMulti,d=c.backspaceRemovesValue,f=c.escapeClearsValue,m=c.inputValue,p=c.isClearable,h=c.isDisabled,g=c.menuIsOpen,b=c.onKeyDown,v=c.tabSelectsValue,C=c.openMenuOnFocus,y=r.state,x=y.focusedOption,w=y.focusedValue,S=y.selectValue;if(!h&&!(typeof b=="function"&&(b(l),l.defaultPrevented))){switch(r.blockOptionHover=!0,l.key){case"ArrowLeft":if(!u||m)return;r.focusValue("previous");break;case"ArrowRight":if(!u||m)return;r.focusValue("next");break;case"Delete":case"Backspace":if(m)return;if(w)r.removeValue(w);else{if(!d)return;u?r.popValue():p&&r.clearValue()}break;case"Tab":if(r.isComposing||l.shiftKey||!g||!v||!x||C&&r.isOptionSelected(x,S))return;r.selectOption(x);break;case"Enter":if(l.keyCode===229)break;if(g){if(!x||r.isComposing)return;r.selectOption(x);break}return;case"Escape":g?(r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange("",{action:"menu-close",prevInputValue:m}),r.onMenuClose()):p&&f&&r.clearValue();break;case" ":if(m)return;if(!g){r.openMenu("first");break}if(!x)return;r.selectOption(x);break;case"ArrowUp":g?r.focusOption("up"):r.openMenu("last");break;case"ArrowDown":g?r.focusOption("down"):r.openMenu("first");break;case"PageUp":if(!g)return;r.focusOption("pageup");break;case"PageDown":if(!g)return;r.focusOption("pagedown");break;case"Home":if(!g)return;r.focusOption("first");break;case"End":if(!g)return;r.focusOption("last");break;default:return}l.preventDefault()}},r.state.instancePrefix="react-select-"+(r.props.instanceId||++$U),r.state.selectValue=bu(n.value),n.menuIsOpen&&r.state.selectValue.length){var s=r.getFocusableOptionsWithIds(),i=r.buildFocusableOptions(),a=i.indexOf(r.state.selectValue[0]);r.state.focusableOptionsWithIds=s,r.state.focusedOption=i[a],r.state.focusedOptionId=JC(s,i[a])}return r}return FR(o,[{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&&UC(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(r){var s=this.props,i=s.isDisabled,a=s.menuIsOpen,l=this.state.isFocused;(l&&!i&&r.isDisabled||l&&a&&!r.menuIsOpen)&&this.focusInput(),l&&i&&!r.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!l&&!i&&r.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(UC(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(r,s){this.props.onInputChange(r,s)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(r){var s=this,i=this.state,a=i.selectValue,l=i.isFocused,c=this.buildFocusableOptions(),u=r==="first"?0:c.length-1;if(!this.props.isMulti){var d=c.indexOf(a[0]);d>-1&&(u=d)}this.scrollToFocusedOptionOnUpdate=!(l&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:c[u],focusedOptionId:this.getFocusedOptionId(c[u])},function(){return s.onMenuOpen()})}},{key:"focusValue",value:function(r){var s=this.state,i=s.selectValue,a=s.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var l=i.indexOf(a);a||(l=-1);var c=i.length-1,u=-1;if(i.length){switch(r){case"previous":l===0?u=0:l===-1?u=c:u=l-1;break;case"next":l>-1&&l<c&&(u=l+1);break}this.setState({inputIsHidden:u!==-1,focusedValue:i[u]})}}}},{key:"focusOption",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",s=this.props.pageSize,i=this.state.focusedOption,a=this.getFocusableOptions();if(a.length){var l=0,c=a.indexOf(i);i||(c=-1),r==="up"?l=c>0?c-1:a.length-1:r==="down"?l=(c+1)%a.length:r==="pageup"?(l=c-s,l<0&&(l=0)):r==="pagedown"?(l=c+s,l>a.length-1&&(l=a.length-1)):r==="last"&&(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?typeof this.props.theme=="function"?this.props.theme(YC):Me(Me({},YC),this.props.theme):YC}},{key:"getCommonProps",value:function(){var r=this.clearValue,s=this.cx,i=this.getStyles,a=this.getClassNames,l=this.getValue,c=this.selectOption,u=this.setValue,d=this.props,f=d.isMulti,m=d.isRtl,p=d.options,h=this.hasValue();return{clearValue:r,cx:s,getStyles:i,getClassNames:a,getValue:l,hasValue:h,isMulti:f,isRtl:m,options:p,selectOption:c,selectProps:d,setValue:u,theme:this.getTheme()}}},{key:"hasValue",value:function(){var r=this.state.selectValue;return r.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var r=this.props,s=r.isClearable,i=r.isMulti;return s===void 0?i:s}},{key:"isOptionDisabled",value:function(r,s){return BD(this.props,r,s)}},{key:"isOptionSelected",value:function(r,s){return OD(this.props,r,s)}},{key:"filterOption",value:function(r,s){return VD(this.props,r,s)}},{key:"formatOptionLabel",value:function(r,s){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,a=this.state.selectValue;return this.props.formatOptionLabel(r,{context:s,inputValue:i,selectValue:a})}else return this.getOptionLabel(r)}},{key:"formatGroupLabel",value:function(r){return this.props.formatGroupLabel(r)}},{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 r=this.props,s=r.isDisabled,i=r.isSearchable,a=r.inputId,l=r.inputValue,c=r.tabIndex,u=r.form,d=r.menuIsOpen,f=r.required,m=this.getComponents(),p=m.Input,h=this.state,g=h.inputIsHidden,b=h.ariaSelection,v=this.commonProps,C=a||this.getElementId("input"),y=Me(Me(Me({"aria-autocomplete":"list","aria-expanded":d,"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":f,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},d&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?b?.action==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?Rt.createElement(p,ke({},v,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:C,innerRef:this.getInputRef,isDisabled:s,isHidden:g,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:c,form:u,type:"text",value:l},y)):Rt.createElement(cU,ke({id:C,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:$m,onFocus:this.onInputFocus,disabled:s,tabIndex:c,inputMode:"none",form:u,value:""},y))}},{key:"renderPlaceholderOrValue",value:function(){var r=this,s=this.getComponents(),i=s.MultiValue,a=s.MultiValueContainer,l=s.MultiValueLabel,c=s.MultiValueRemove,u=s.SingleValue,d=s.Placeholder,f=this.commonProps,m=this.props,p=m.controlShouldRenderValue,h=m.isDisabled,g=m.isMulti,b=m.inputValue,v=m.placeholder,C=this.state,y=C.selectValue,x=C.focusedValue,w=C.isFocused;if(!this.hasValue()||!p)return b?null:Rt.createElement(d,ke({},f,{key:"placeholder",isDisabled:h,isFocused:w,innerProps:{id:this.getElementId("placeholder")}}),v);if(g)return y.map(function(_,I){var A=_===x,D="".concat(r.getOptionLabel(_),"-").concat(r.getOptionValue(_));return Rt.createElement(i,ke({},f,{components:{Container:a,Label:l,Remove:c},isFocused:A,isDisabled:h,key:D,index:I,removeProps:{onClick:function(){return r.removeValue(_)},onTouchEnd:function(){return r.removeValue(_)},onMouseDown:function(R){R.preventDefault()}},data:_}),r.formatOptionLabel(_,"value"))});if(b)return null;var S=y[0];return Rt.createElement(u,ke({},f,{data:S,isDisabled:h}),this.formatOptionLabel(S,"value"))}},{key:"renderClearIndicator",value:function(){var r=this.getComponents(),s=r.ClearIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,u=this.state.isFocused;if(!this.isClearable()||!s||l||!this.hasValue()||c)return null;var d={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return Rt.createElement(s,ke({},i,{innerProps:d,isFocused:u}))}},{key:"renderLoadingIndicator",value:function(){var r=this.getComponents(),s=r.LoadingIndicator,i=this.commonProps,a=this.props,l=a.isDisabled,c=a.isLoading,u=this.state.isFocused;if(!s||!c)return null;var d={"aria-hidden":"true"};return Rt.createElement(s,ke({},i,{innerProps:d,isDisabled:l,isFocused:u}))}},{key:"renderIndicatorSeparator",value:function(){var r=this.getComponents(),s=r.DropdownIndicator,i=r.IndicatorSeparator;if(!s||!i)return null;var a=this.commonProps,l=this.props.isDisabled,c=this.state.isFocused;return Rt.createElement(i,ke({},a,{isDisabled:l,isFocused:c}))}},{key:"renderDropdownIndicator",value:function(){var r=this.getComponents(),s=r.DropdownIndicator;if(!s)return null;var i=this.commonProps,a=this.props.isDisabled,l=this.state.isFocused,c={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return Rt.createElement(s,ke({},i,{innerProps:c,isDisabled:a,isFocused:l}))}},{key:"renderMenu",value:function(){var r=this,s=this.getComponents(),i=s.Group,a=s.GroupHeading,l=s.Menu,c=s.MenuList,u=s.MenuPortal,d=s.LoadingMessage,f=s.NoOptionsMessage,m=s.Option,p=this.commonProps,h=this.state.focusedOption,g=this.props,b=g.captureMenuScroll,v=g.inputValue,C=g.isLoading,y=g.loadingMessage,x=g.minMenuHeight,w=g.maxMenuHeight,S=g.menuIsOpen,_=g.menuPlacement,I=g.menuPosition,A=g.menuPortalTarget,D=g.menuShouldBlockScroll,T=g.menuShouldScrollIntoView,R=g.noOptionsMessage,P=g.onMenuScrollToTop,E=g.onMenuScrollToBottom;if(!S)return null;var F=function(O,V){var H=O.type,z=O.data,W=O.isDisabled,U=O.isSelected,X=O.label,Q=O.value,J=h===z,oe=W?void 0:function(){return r.onOptionHover(z)},Y=W?void 0:function(){return r.selectOption(z)},K="".concat(r.getElementId("option"),"-").concat(V),ee={id:K,onClick:Y,onMouseMove:oe,onMouseOver:oe,tabIndex:-1,role:"option","aria-selected":r.isAppleDevice?void 0:U};return Rt.createElement(m,ke({},p,{innerProps:ee,data:z,isDisabled:W,isSelected:U,key:K,label:X,type:H,value:Q,isFocused:J,innerRef:J?r.getFocusedOptionRef:void 0}),r.formatOptionLabel(O.data,"menu"))},L;if(this.hasOptions())L=this.getCategorizedOptions().map(function(k){if(k.type==="group"){var O=k.data,V=k.options,H=k.index,z="".concat(r.getElementId("group"),"-").concat(H),W="".concat(z,"-heading");return Rt.createElement(i,ke({},p,{key:z,data:O,options:V,Heading:a,headingProps:{id:W,data:k.data},label:r.formatGroupLabel(k.data)}),k.options.map(function(U){return F(U,"".concat(H,"-").concat(U.index))}))}else if(k.type==="option")return F(k,"".concat(k.index))});else if(C){var M=y({inputValue:v});if(M===null)return null;L=Rt.createElement(d,p,M)}else{var $=R({inputValue:v});if($===null)return null;L=Rt.createElement(f,p,$)}var B={minMenuHeight:x,maxMenuHeight:w,menuPlacement:_,menuPosition:I,menuShouldScrollIntoView:T},j=Rt.createElement(zT,ke({},p,B),function(k){var O=k.ref,V=k.placerProps,H=V.placement,z=V.maxHeight;return Rt.createElement(l,ke({},p,B,{innerRef:O,innerProps:{onMouseDown:r.onMenuMouseDown,onMouseMove:r.onMenuMouseMove},isLoading:C,placement:H}),Rt.createElement(hU,{captureEnabled:b,onTopArrive:P,onBottomArrive:E,lockEnabled:D},function(W){return Rt.createElement(c,ke({},p,{innerRef:function(X){r.getMenuListRef(X),W(X)},innerProps:{role:"listbox","aria-multiselectable":p.isMulti,id:r.getElementId("listbox")},isLoading:C,maxHeight:z,focusedOption:h}),L)}))});return A||I==="fixed"?Rt.createElement(u,ke({},p,{appendTo:A,controlElement:this.controlRef,menuPlacement:_,menuPosition:I}),j):j}},{key:"renderFormField",value:function(){var r=this,s=this.props,i=s.delimiter,a=s.isDisabled,l=s.isMulti,c=s.name,u=s.required,d=this.state.selectValue;if(u&&!this.hasValue()&&!a)return Rt.createElement(vU,{name:c,onFocus:this.onValueInputFocus});if(!(!c||a))if(l)if(i){var f=d.map(function(h){return r.getOptionValue(h)}).join(i);return Rt.createElement("input",{name:c,type:"hidden",value:f})}else{var m=d.length>0?d.map(function(h,g){return Rt.createElement("input",{key:"i-".concat(g),name:c,type:"hidden",value:r.getOptionValue(h)})}):Rt.createElement("input",{name:c,type:"hidden",value:""});return Rt.createElement("div",null,m)}else{var p=d[0]?this.getOptionValue(d[0]):"";return Rt.createElement("input",{name:c,type:"hidden",value:p})}}},{key:"renderLiveRegion",value:function(){var r=this.commonProps,s=this.state,i=s.ariaSelection,a=s.focusedOption,l=s.focusedValue,c=s.isFocused,u=s.selectValue,d=this.getFocusableOptions();return Rt.createElement(rU,ke({},r,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:a,focusedValue:l,isFocused:c,selectValue:u,focusableOptions:d,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var r=this.getComponents(),s=r.Control,i=r.IndicatorsContainer,a=r.SelectContainer,l=r.ValueContainer,c=this.props,u=c.className,d=c.id,f=c.isDisabled,m=c.menuIsOpen,p=this.state.isFocused,h=this.commonProps=this.getCommonProps();return Rt.createElement(a,ke({},h,{className:u,innerProps:{id:d,onKeyDown:this.onKeyDown},isDisabled:f,isFocused:p}),this.renderLiveRegion(),Rt.createElement(s,ke({},h,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:f,isFocused:p,menuIsOpen:m}),Rt.createElement(l,ke({},h,{isDisabled:f}),this.renderPlaceholderOrValue(),this.renderInput()),Rt.createElement(i,ke({},h,{isDisabled:f}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(r,s){var i=s.prevProps,a=s.clearFocusValueOnUpdate,l=s.inputIsHiddenAfterUpdate,c=s.ariaSelection,u=s.isFocused,d=s.prevWasFocused,f=s.instancePrefix,m=r.options,p=r.value,h=r.menuIsOpen,g=r.inputValue,b=r.isMulti,v=bu(p),C={};if(i&&(p!==i.value||m!==i.options||h!==i.menuIsOpen||g!==i.inputValue)){var y=h?NU(r,v):[],x=h?PD(vg(r,v),"".concat(f,"-option")):[],w=a?EU(s,v):null,S=LU(s,y),_=JC(x,S);C={selectValue:v,focusedOption:S,focusedOptionId:_,focusableOptionsWithIds:x,focusedValue:w,clearFocusValueOnUpdate:!1}}var I=l!=null&&r!==i?{inputIsHidden:l,inputIsHiddenAfterUpdate:void 0}:{},A=c,D=u&&d;return u&&!D&&(A={value:Al(b,v,v[0]||null),options:v,action:"initial-input-focus"},D=!d),c?.action==="initial-input-focus"&&(A=null),Me(Me(Me({},C),I),{},{prevProps:r,ariaSelection:A,prevWasFocused:D})}}]),o})(QW);Bm.defaultProps=FU;import"react-dom";var kU=jU(function(t,e){var o=H1(t);return zD.createElement(Bm,ke({ref:e},o))}),GD=kU;import{jsx as WD}from"react/jsx-runtime";import"react";var MU={16:"M8 2a6 6 0 1 1 0 12A6 6 0 0 1 8 2m0 1a5 5 0 1 0 0 10A5 5 0 0 0 8 3m2.354 2.146a.5.5 0 0 1 0 .708L8.707 8l1.647 1.646a.5.5 0 0 1-.708.708L8 8.707l-1.646 1.647a.5.5 0 0 1-.708-.708L7.293 8 5.646 6.354a.5.5 0 1 1 .708-.708L8 7.293l1.646-1.647a.5.5 0 0 1 .708 0",24:"M12 5a7 7 0 1 1 0 14 7 7 0 0 1 0-14m0 1a6 6 0 1 0 0 12 6 6 0 0 0 0-12m2.225 3.082a.5.5 0 0 1 .693.693l-.064.079L12.707 12l2.147 2.146.064.079a.5.5 0 0 1-.693.693l-.078-.064L12 12.707l-2.146 2.146a.5.5 0 1 1-.707-.707L11.293 12 9.147 9.854l-.065-.079a.5.5 0 0 1 .694-.693l.078.064L12 11.293l2.147-2.147z"},Om=({className:t,size:e=16})=>WD("svg",{className:["icon","icon--circled-x",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:WD("path",{clipRule:"evenodd",d:MU[e],fill:"currentColor",fillRule:"evenodd"})});import{c as iX}from"react/compiler-runtime";import{jsx as ws}from"react/jsx-runtime";import{getTranslation as aX}from"@payloadcms/translations";import{useCallback as wA,useEffect as lX,useId as cX,useLayoutEffect as uX,useMemo as SA,useRef as dX,useState as Cu}from"react";import*as YD from"react";import{forwardRef as VU}from"react";import{useMemo as UD,useCallback as BU}from"react";var OU=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],XD=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=String(e).toLowerCase(),s=String(n.getOptionValue(o)).toLowerCase(),i=String(n.getOptionLabel(o)).toLowerCase();return s===r||i===r},ox={formatCreateLabel:function(e){return'Create "'.concat(e,'"')},isValidNewOption:function(e,o,n,r){return!(!e||o.some(function(s){return XD(e,s,r)})||n.some(function(s){return XD(e,s,r)}))},getNewOptionData:function(e,o){return{label:o,value:e,__isNew__:!0}}};function ZD(t){var e=t.allowCreateWhileLoading,o=e===void 0?!1:e,n=t.createOptionPosition,r=n===void 0?"last":n,s=t.formatCreateLabel,i=s===void 0?ox.formatCreateLabel:s,a=t.isValidNewOption,l=a===void 0?ox.isValidNewOption:a,c=t.getNewOptionData,u=c===void 0?ox.getNewOptionData:c,d=t.onCreateOption,f=t.options,m=f===void 0?[]:f,p=t.onChange,h=Or(t,OU),g=h.getOptionValue,b=g===void 0?tx:g,v=h.getOptionLabel,C=v===void 0?ex:v,y=h.inputValue,x=h.isLoading,w=h.isMulti,S=h.value,_=h.name,I=UD(function(){return l(y,bu(S),m,{getOptionValue:b,getOptionLabel:C})?u(y,i(y)):void 0},[i,u,C,b,y,l,m,S]),A=UD(function(){return(o||!x)&&I?r==="first"?[I].concat(da(m)):[].concat(da(m),[I]):m},[o,r,x,I,m]),D=BU(function(T,R){if(R.action!=="select-option")return p(T,R);var P=Array.isArray(T)?T:[T];if(P[P.length-1]===I){if(d)d(y);else{var E=u(y,y),F={action:"create-option",name:_,option:E};p(Al(w,[].concat(da(bu(S)),[E]),E),F)}return}p(T,R)},[u,y,w,_,I,d,p,S]);return Me(Me({},h),{},{options:A,onChange:D})}import"react-dom";var HU=VU(function(t,e){var o=H1(t),n=ZD(o);return YD.createElement(Bm,ke({ref:e},n))}),JD=HU;import{c as zU}from"react/compiler-runtime";import{useEffect as qD,useState as GU}from"react";function Vm(t,e,o){let n=zU(11),r;n[0]!==t?(r=()=>t,n[0]=t,n[1]=r):r=n[1];let[s,i]=GU(r),a;n[2]!==o||n[3]!==t?(a=()=>{let d=setTimeout(()=>{i(()=>t)},o);return()=>{clearTimeout(d)}},n[2]=o,n[3]=t,n[4]=a):a=n[4];let l;n[5]!==o||n[6]!==e?(l=[...e,o],n[5]=o,n[6]=e,n[7]=l):l=n[7],qD(a,l);let c,u;n[8]!==s?(c=()=>{s()},u=[s],n[8]=s,n[9]=c,n[10]=u):(c=n[9],u=n[10]),qD(c,u)}import{jsx as QD}from"react/jsx-runtime";import"react";var KD="clear-indicator",eA=t=>{let{clearValue:e,innerProps:{ref:o,...n}}=t;return QD("div",{className:KD,ref:o,...n,onKeyDown:r=>{r.key==="Enter"&&(e(),r.stopPropagation())},role:"button",tabIndex:0,children:QD(Om,{className:`${KD}__icon`,size:24})})};import{jsx as tA}from"react/jsx-runtime";import WU from"react";var oA=t=>{let{children:e,innerProps:o,selectProps:{customProps:{disableKeyDown:n,disableMouseDown:r}={}}={}}=t;return tA(WU.Fragment,{children:tA(oo.Control,{...t,innerProps:{...o,onKeyDown:s=>{if(n){s.stopPropagation();let i=new CustomEvent("bypassKeyDown",{detail:s});document.dispatchEvent(i)}},onMouseDown:s=>{r||o.onMouseDown(s)}},children:e})})};import{jsx as rA}from"react/jsx-runtime";import"react";var nA="dropdown-indicator",sA=t=>{let{innerProps:{ref:e,...o}}=t;return rA("button",{className:nA,ref:e,...o,onKeyDown:n=>{n.key==="Enter"&&(n.key=" ")},type:"button",children:rA(ve,{className:`${nA}__icon`,size:16})})};var iA=({captureMenuScroll:t,menuPortalTarget:e})=>typeof t=="boolean"?t:!0;var aA=t=>(e,o)=>({...e,...t?.menuList?.(e,o)});import{jsx as lA}from"react/jsx-runtime";import UU from"react";var cA=t=>lA(UU.Fragment,{children:lA(oo.Input,{...t,"aria-activedescendant":void 0})});import{c as XU}from"react/compiler-runtime";import{jsx as uA}from"react/jsx-runtime";import ZU from"react";var dA="multi-value";function rx(t,e){return typeof e=="function"?e(t):t?.value}var mA=t=>{let e=XU(24),{className:o,data:n,innerProps:r,isDisabled:s,selectProps:i}=t,a;e[0]!==i?(a=i===void 0?{}:i,e[0]=i,e[1]=a):a=e[1];let{customProps:l,getOptionValue:c,isSortable:u}=a,d;e[2]!==l?(d=l===void 0?{}:l,e[2]=l,e[3]=d):d=e[3];let{disableMouseDown:f}=d,m;e[4]!==n||e[5]!==c?(m=rx(n,c),e[4]=n,e[5]=c,e[6]=m):m=e[6];let p=m,h=!u,g;e[7]!==p||e[8]!==h?(g={id:p,disabled:h},e[7]=p,e[8]=h,e[9]=g):g=e[9];let{attributes:b,isDragging:v,listeners:C,setNodeRef:y,transform:x}=qs(g),w=!s&&u&&"draggable",S=v&&`${dA}--is-dragging`,_;e[10]!==o||e[11]!==w||e[12]!==S?(_=[dA,o,w,S].filter(Boolean),e[10]=o,e[11]=w,e[12]=S,e[13]=_):_=e[13];let I=_.join(" "),A;if(e[14]!==b||e[15]!==I||e[16]!==f||e[17]!==r||e[18]!==u||e[19]!==C||e[20]!==t||e[21]!==y||e[22]!==x){let{onMouseDown:D,...T}=C||{};A=uA(ZU.Fragment,{children:uA(oo.MultiValue,{...t,className:I,innerProps:{...u?{...b,...T}:{},...r,onMouseDown:R=>{u&&D&&D(R),f||R.stopPropagation()},ref:y,style:u?{transform:x,...b?.style}:{}}})}),e[14]=b,e[15]=I,e[16]=f,e[17]=r,e[18]=u,e[19]=C,e[20]=t,e[21]=y,e[22]=x,e[23]=A}else A=e[23];return A};import{c as YU}from"react/compiler-runtime";import{jsx as fA}from"react/jsx-runtime";import{getTranslation as JU}from"@payloadcms/translations";import"react";var nx="multi-value-label",pA=t=>{let e=YU(2),{data:o,selectProps:n}=t,{customProps:r,isDisabled:s}=n===void 0?{}:n,{draggableProps:i,editableProps:a}=r===void 0?{}:r,{i18n:l}=N(),c=`${nx}__text`,u=o.label?JU(o.label,l):"",d=typeof u=="string"?u:"",f=s?`${nx}--disabled`:"",m;return e[0]!==f?(m=[nx,f].filter(Boolean),e[0]=f,e[1]=m):m=e[1],fA("div",{className:m.join(" "),title:d,children:fA(oo.MultiValueLabel,{...t,innerProps:{className:c,...a&&a(o,c,t.selectProps)||{},...i||{}}})})};import{c as qU}from"react/compiler-runtime";import{jsx as hA,jsxs as QU}from"react/jsx-runtime";import KU from"react";var sx="multi-value-remove",gA=t=>{let e=qU(12),{innerProps:o,selectProps:n}=t,{className:r,onClick:s,onTouchEnd:i}=o,{isDisabled:a}=n,[l,c]=KU.useState(!1),{t:u}=N();if(a)return null;let d;if(e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==l||e[4]!==u){let f=u("general:remove"),m;e[6]!==r?(m=[sx,r].filter(Boolean),e[6]=r,e[7]=m):m=e[7];let p;e[8]!==s?(p=b=>{c(!1),s(b)},e[8]=s,e[9]=p):p=e[9];let h,g;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(!0),g=()=>c(!1),e[10]=h,e[11]=g):(h=e[10],g=e[11]),d=QU("button",{"aria-label":f,className:m.join(" "),onClick:p,onKeyDown:eX,onMouseDown:tX,onMouseEnter:h,onMouseLeave:g,onTouchEnd:i,type:"button",children:[hA(io,{className:`${sx}__tooltip`,show:l,children:u("general:remove")}),hA(xt,{className:`${sx}__icon`,size:16})]}),e[0]=r,e[1]=s,e[2]=i,e[3]=l,e[4]=u,e[5]=d}else d=e[5];return d};function eX(t){t.key==="Enter"&&t.stopPropagation()}function tX(t){return t.stopPropagation()}import{jsx as bA}from"react/jsx-runtime";import oX from"react";var rX="react-select--single-value",vA=t=>{let{children:e,className:o}=t;return bA(oX.Fragment,{children:bA(oo.SingleValue,{...t,className:[rX,o].filter(Boolean).join(" "),children:e})})};import{jsx as yA,jsxs as nX}from"react/jsx-runtime";import{getTranslation as sX}from"@payloadcms/translations";import"react";var CA="value-container",xA=t=>{let{selectProps:e}=t,{customProps:o,value:n}=e===void 0?{}:e,{i18n:r}=N(),s="";if(n&&!Array.isArray(n)&&typeof n=="object"&&"label"in n){let i=n.label?sX(n.label,r):"";s=typeof i=="string"?i:""}return nX("div",{className:CA,ref:o?.droppableRef,title:s,children:[o?.valueContainerLabel&&yA("span",{className:`${CA}__label`,children:o?.valueContainerLabel}),yA(oo.ValueContainer,{...t})]})};function mX(t){let e=iX(3),{theme:o}=Us(),r=t.selectProps?.customProps?.menuPortalTheme??o,s;return e[0]!==t||e[1]!==r?(s=ws(oo.MenuPortal,{...t,innerProps:{"data-theme":r}}),e[0]=t,e[1]=r,e[2]=s):s=e[2],s}var ix=300,fX=140,_A=16,IA=t=>{let{i18n:e,t:o}=N(),[n,r]=Cu(""),s=cX(),[i,a]=Cu(!1),[l,c]=Cu(!1),[u,d]=Cu(ix),[f,m]=Cu("auto"),p=dX(null),{captureMenuScroll:h,className:g,classNames:b,components:v,disabled:C=!1,filterOption:y=void 0,getOptionValue:x,isClearable:w=!0,isCreatable:S,isLoading:_,isSearchable:I=!0,menuPortalTarget:A,menuPosition:D,noOptionsMessage:T=()=>o("general:noOptions"),numberOnly:R=!1,onChange:P,onMenuClose:E,onMenuOpen:F,options:L,placeholder:M=o("general:selectValue"),showError:$,styles:B,value:j}=t,k=A===void 0?typeof document<"u"?document.body:null:A,O=D??(k?"fixed":void 0),V=iA({captureMenuScroll:h,menuPortalTarget:k}),H=wA(()=>{if(!l||typeof window>"u")return;let ee=p.current?.querySelector(".rs__control");if(!ee)return;let te=ee.getBoundingClientRect(),re=Math.max(window.innerHeight-te.bottom-_A,0),me=Math.max(te.top-_A,0),we=re<fX&&me>re,Ae=we?me:re;m(we?"top":"bottom"),d(Math.max(Math.min(Math.floor(Ae),ix),1))},[l]);lX(()=>{a(!0)},[]),uX(()=>{if(!l){m("auto"),d(ix);return}return H(),window.addEventListener("resize",H),window.addEventListener("scroll",H,!0),()=>{window.removeEventListener("resize",H),window.removeEventListener("scroll",H,!0)}},[l,H]);let[z,W]=Cu(!1);Vm(()=>{W(_)},[_],250);let U=()=>{c(!0),requestAnimationFrame(H),F?.()},X=()=>{c(!1),E?.()},Q=wA(ee=>{let te=ee.placement?`rs__menu--placement-${ee.placement}`:"",re=b?.menu?.(ee)??"";return[te,re].filter(Boolean).join(" ")},[b]),J=SA(()=>({...b,menu:Q,menuList:ee=>["scrollbar-thin",b?.menuList?.(ee)??""].filter(Boolean).join(" ")}),[b,Q]),oe=SA(()=>({ClearIndicator:eA,Control:oA,DropdownIndicator:sA,Input:cA,MenuPortal:mX,MultiValue:mA,MultiValueLabel:pA,MultiValueRemove:gA,SingleValue:vA,ValueContainer:xA,...v}),[v]),Y={captureMenuScroll:V,className:[g,"react-select",$&&"react-select--error"].filter(Boolean).join(" "),classNamePrefix:"rs",classNames:J,components:oe,filterOption:y,instanceId:s,isClearable:w,isDisabled:C,isLoading:z,isSearchable:I,loadingMessage:()=>o("general:loading")+"...",maxMenuHeight:u,menuPlacement:f,menuPortalTarget:k,menuPosition:O,menuShouldBlockScroll:!1,noOptionsMessage:T,onChange:P,onMenuClose:X,onMenuOpen:U,options:L,placeholder:aX(M,e),styles:{menu:(ee,te)=>({...ee,zIndex:void 0,...B?.menu?.(ee,te)}),...k&&{menuPortal:(ee,te)=>({...ee,zIndex:9999,...B?.menuPortal?.(ee,te)})},control:(ee,te)=>({...ee,minHeight:void 0,...B?.control?.(ee,te)}),option:(ee,te)=>({...ee,...B?.option?.(ee,te)}),menuList:aA(B)},unstyled:!0};return i?S?ws("div",{ref:p,children:ws(JD,{...t,...Y,inputValue:n,onInputChange:ee=>r(ee),onKeyDown:ee=>{if(R===!0){let te=["Tab","Escape","Backspace","Enter","ArrowRight","ArrowLeft","ArrowUp","ArrowDown"],re=!/\D/.test(ee.key),me=te.includes(ee.key);if(!re&&!me){ee.preventDefault();return}}if(!(!j||!n||n.trim()==="")&&!(y&&!y(null,n))&&!ee.nativeEvent.isComposing)switch(ee.key){case"Enter":case"Tab":P([...j,{label:n,value:n}]),r(""),ee.preventDefault();break;default:break}},value:j})}):ws("div",{ref:p,children:ws(GD,{...t,...Y,getOptionValue:x,value:j})}):ws(Ct,{height:"var(--field-min-height)"})},pX=t=>{let{getOptionValue:e,onChange:o,value:n}=t,r=[];return n&&(r=(Array.isArray(n)?n:[n]).map(s=>rx(s,e))),ws(hr,{className:"react-select-container",ids:r,onDragEnd:({moveFromIndex:s,moveToIndex:i})=>{let a=n;n&&Array.isArray(n)&&(a=jc(n,s,i)),o(a)},children:ws(IA,{...t})})},mt=t=>{let{isMulti:e,isSortable:o}=t;return e&&o?ws(pX,{...t}):ws(IA,{...t})};var Hm=t=>t.map(e=>typeof e=="object"&&(e.value||e.value==="")?e:{label:e,value:e});var gX=t=>{let{innerProps:{ref:e,...o}}=t;return pa("button",{className:"timezone-picker__dropdown-indicator",ref:e,...o,onKeyDown:n=>{n.key==="Enter"&&(n.key=" ")},type:"button",children:pa(ve,{size:16})})},bX=t=>{let{clearValue:e,innerProps:{ref:o,...n}}=t;return pa("div",{className:"timezone-picker__clear-indicator",ref:typeof o=="string"?null:o,...n,onKeyDown:r=>{r.key==="Enter"&&(e(),r.stopPropagation())},role:"button",tabIndex:0,children:pa(Om,{size:24})})},vX=t=>{let{children:e}=t;return ax(oo.Option,{...t,children:[pa(Vo,{className:"timezone-picker__option-check",size:16}),pa("span",{className:"timezone-picker__option-label",children:e})]})},zm=t=>{let{id:e,onChange:o,options:n,readOnly:r,required:s,selectedTimezone:i}=t,{t:a}=N(),l=Hm(n),c=hX(()=>l.find(d=>(typeof d=="string"?d:d.value)===i),[l,i]),u=!!r||l.length===1;return ax("div",{className:"timezone-picker-wrapper",children:[ax("span",{className:"timezone-picker__label",children:[a("general:timezone"),s&&pa("span",{className:"timezone-picker__required",children:"*"})]}),pa(mt,{className:"timezone-picker",classNames:{menu:()=>"timezone-picker__menu",menuList:()=>"timezone-picker__menu-list"},components:{ClearIndicator:bX,DropdownIndicator:gX,Option:vX},customProps:{menuPortalTheme:"dark"},disabled:u,inputId:e,isClearable:!s,isCreatable:!1,onChange:d=>{o&&o(d?.value||"")},options:l,placeholder:a("general:none"),styles:{control:d=>({...d,flexWrap:"nowrap"}),option:d=>({...d,alignItems:"center",display:"flex",gap:"var(--spacer-1)",minWidth:0})},value:c})]})};var TA="date-time-field",CX=t=>{let{field:e,field:{admin:{className:o,date:n,description:r,placeholder:s}={},label:i,localized:a,required:l,timezone:c},path:u,readOnly:d,validate:f}=t,m=n?.pickerAppearance||"default",p=Intl.DateTimeFormat().resolvedOptions().timeZone,{config:h}=G(),{i18n:g}=N(),{dispatchFields:b,setModified:v}=Ge(),C=lx((V,H)=>{if(typeof f=="function")return f(V,{...H,required:l})},[f,l]),{customComponents:{AfterInput:y,BeforeInput:x,Description:w,Error:S,Label:_}={},disabled:I,path:A,setValue:D,showError:T,value:R}=Ne({potentiallyStalePath:u,validate:C}),P=A+"_tz",E=Ht(([V,H])=>V?.[P]),F=cx(()=>c&&typeof c=="object"&&c.supportedTimezones?c.supportedTimezones:h.admin.timezones.supportedTimezones,[h.admin.timezones.supportedTimezones,c]),L=["dayOnly","default","monthOnly"].includes(m),M=E?.value,$=l||c&&typeof c=="object"&&c.required,B=cx(()=>{if(c&&M&&p&&R){let V=ao.tz(M),H=ao.tz(p),z=new ao(R).withTimeZone(M),W=$n(z,V);return $n(W,H).toISOString()}return R},[c,M,R,p]),j=cx(()=>st(e),[e]),k=lx(V=>{if(!(d||I))if(c&&M&&V){let H=ao.tz(M);if(L){let z=V.getTimezoneOffset()/60,W=V.getHours()+z;V.setHours(W);let U=$n(V,H);D(U.toISOString()||null)}else{let z=new ao(V),W=$n(z,H);D(W.toISOString()||null)}}else D(V?.toISOString()||null)},[d,I,c,M,L,D]),O=lx(V=>{P&&(b({type:"UPDATE",path:P,value:V}),v(!0))},[b,v,P]);return RA("div",{className:[Ee,TA,o,T&&`${TA}--has-error`,(d||I)&&"read-only"].filter(Boolean).join(" "),style:j,children:[ha(le,{CustomComponent:_,Fallback:ha(Fe,{label:i,localized:a,path:A,required:l})}),RA("div",{className:`${Ee}__wrap`,id:`field-${A.replace(/\./g,"__")}`,children:[ha(le,{CustomComponent:S,Fallback:ha(tt,{path:A,showError:T})}),x,ha(su,{...n,onChange:k,overrides:{...n?.overrides},placeholder:yX(s,g),readOnly:d||I,value:B}),c&&F.length>0&&ha(zm,{id:`${A}-timezone-picker`,onChange:O,options:F,readOnly:d||I,required:$,selectedTimezone:M}),y]}),ha(le,{CustomComponent:w,Fallback:ha(Xe,{description:r,path:A})})]})},Gm=Je(CX);import{jsx as Pl,jsxs as DA}from"react/jsx-runtime";import{getTranslation as xX}from"@payloadcms/translations";import{useCallback as wX,useMemo as SX}from"react";var _X=t=>{let{field:e,field:{admin:{autoComplete:o,className:n,description:r,placeholder:s}={},label:i,localized:a,required:l}={},path:c,readOnly:u,validate:d}=t,{i18n:f}=N(),m=wX((I,A)=>{if(typeof d=="function")return d(I,{...A,required:l})},[d,l]),{customComponents:{AfterInput:p,BeforeInput:h,Description:g,Error:b,Label:v}={},disabled:C,path:y,setValue:x,showError:w,value:S}=Ne({potentiallyStalePath:c,validate:m}),_=SX(()=>st(e),[e]);return DA("div",{className:[Ee,"email",n,w&&"error",(u||C)&&"read-only"].filter(Boolean).join(" "),style:_,children:[Pl(le,{CustomComponent:v,Fallback:Pl(Fe,{label:i,localized:a,path:y,required:l})}),DA("div",{className:`${Ee}__wrap`,children:[Pl(le,{CustomComponent:b,Fallback:Pl(tt,{path:y,showError:w})}),h,Pl("input",{autoComplete:o,className:"form-input",disabled:u||C,id:`field-${y.replace(/\./g,"__")}`,name:y,onChange:x,placeholder:xX(s,f),required:l,type:"email",value:S||""}),p]}),Pl(le,{CustomComponent:g,Fallback:Pl(Xe,{description:r,path:y})})]})},On=Je(_X);import{jsx as di,jsxs as Cg}from"react/jsx-runtime";import{getTranslation as LX}from"@payloadcms/translations";import{groupHasName as kA}from"payload/shared";import{useMemo as $X}from"react";import{jsx as IX}from"react/jsx-runtime";import{createContext as RX,use as TX}from"react";var AA=RX(!1),PA=({children:t,withinRow:e=!0})=>IX(AA,{value:e,children:t}),FA=()=>TX(AA);import{jsx as DX}from"react/jsx-runtime";import{createContext as AX,use as PX}from"react";var NA=AX(!1),ux=({children:t,withinTab:e=!0})=>DX(NA,{value:e,children:t}),EA=()=>PX(NA);import{jsx as FX}from"react/jsx-runtime";import{createContext as NX,use as EX}from"react";var LA=NX(!1),$A=({children:t,withinGroup:e=!0})=>FX(LA,{value:e,children:t}),jA=()=>EX(LA);var gn="group-field",jX=t=>{let{field:e,field:{admin:{className:o,description:n,hideGutter:r}={},fields:s,label:i},indexPath:a,parentPath:l,parentSchemaPath:c,path:u,permissions:d,readOnly:f,schemaPath:m}=t,p=m??(e.type==="group"&&kA(e)?e.name:u),{i18n:h}=N(),{isWithinCollapsible:g}=ra(),b=jA(),v=FA(),C=EA(),{customComponents:{AfterInput:y,BeforeInput:x,Description:w,Label:S}={},errorPaths:_}=Ne({path:u}),I=vo(),A=_.length,D=I&&A>0,T=!(g||b||v),R=$X(()=>st(e),[e]);return Cg("div",{className:[Ee,gn,T&&`${gn}--top-level`,g&&`${gn}--within-collapsible`,b&&`${gn}--within-group`,v&&`${gn}--within-row`,C&&`${gn}--within-tab`,!r&&b&&`${gn}--gutter`,D&&`${gn}--has-error`,o].filter(Boolean).join(" "),id:`field-${u?.replace(/\./g,"__")}`,style:R,children:[di($A,{children:Cg("div",{className:`${gn}__wrap`,children:[!!(S||w||i||D)&&Cg("div",{className:`${gn}__header`,children:[Cg("div",{className:`${gn}__title-row`,children:[!!(S||w||i)&&di(le,{CustomComponent:S,Fallback:di("h3",{className:`${gn}__title`,children:di(Fe,{as:"span",label:LX(i,h),localized:!1,path:u,required:!1})})}),D&&di(yo,{count:A,i18n:h,withMessage:!0})]}),di(le,{CustomComponent:w,Fallback:di(Xe,{description:n,path:u})})]}),x,kA(e)?di(co,{fields:s,parentIndexPath:"",parentPath:u,parentSchemaPath:p,permissions:d===!0?d:d?.fields,readOnly:f}):di(co,{fields:s,parentIndexPath:a,parentPath:l,parentSchemaPath:c,permissions:d,readOnly:f})]})}),y]})};var Wm=Je(jX);import{c as kX}from"react/compiler-runtime";import{jsx as MX}from"react/jsx-runtime";import{useEffect as BX}from"react";var OX=t=>{let e=kX(13),{disableModifyingForm:o,path:n,value:r}=t,s=o===void 0?!0:o,i;e[0]!==n?(i={potentiallyStalePath:n},e[0]=n,e[1]=i):i=e[1];let{formInitializing:a,path:l,setValue:c,value:u}=Ne(i),d,f;e[2]!==s||e[3]!==a||e[4]!==c||e[5]!==r?(d=()=>{r!==void 0&&!a&&c(r,s)},f=[r,c,s,a],e[2]=s,e[3]=a,e[4]=c,e[5]=r,e[6]=d,e[7]=f):(d=e[6],f=e[7]),BX(d,f);let m=`field-${l?.replace(/\./g,"__")}`,p=u||"",h;return e[8]!==l||e[9]!==c||e[10]!==m||e[11]!==p?(h=MX("input",{id:m,name:l,onChange:c,type:"hidden",value:p}),e[8]=l,e[9]=c,e[10]=m,e[11]=p,e[12]=h):h=e[12],h},Fl=Je(OX);var qg=Ji(Yh(),1);import{jsx as Pu,jsxs as fP}from"react/jsx-runtime";import{fieldAffectsData as RJ,flattenTopLevelFields as TJ}from"payload/shared";import{useMemo as pP}from"react";import{jsx as vn,jsxs as hi}from"react/jsx-runtime";import{getTranslation as dP}from"@payloadcms/translations";import{hoistQueryParamsToAnd as SJ,transformColumnsToPreferences as mP}from"payload/shared";import _J,{Fragment as Zx,useCallback as Jg,useEffect as sf,useRef as IJ,useState as va}from"react";import{jsx as zA}from"react/jsx-runtime";import{transformWhereQuery as WX,validateWhereQuery as UX}from"payload/shared";import*as px from"qs-esm";import XX,{useCallback as Um,useEffect as ZX,useMemo as GA,useRef as YX,useState as WA}from"react";import{jsx as VX}from"react/jsx-runtime";import{createContext as HX,use as zX}from"react";var MA=HX({}),dx=({children:t,...e})=>VX(MA,{value:{isInDrawer:!!e.drawerSlug,...e},children:t}),Sr=()=>{let t=zX(MA);if(!t)throw new Error("useListDrawerContext must be used within a ListDrawerContextProvider");return t};import*as BA from"qs-esm";function mo(t){let e=t.toString();return BA.parse(e,{depth:10,ignoreQueryPrefix:!0})}import{createContext as OA,use as GX}from"react";var mx=OA({}),bt=()=>GX(mx),VA=OA(!1);var HA=(t,e,o)=>{let n="page"in e?e.page:t?.page;["where","search","groupBy"].some(l=>l in e&&!["limit","page"].includes(l))&&(n=1);let s=["where","search","page","limit","groupBy","sort"].some(l=>l in e),i;return s||(i={...t?.queryByGroup||{},...e.queryByGroup?Object.fromEntries(Object.entries(e.queryByGroup).map(([l,c])=>[l,{...t?.queryByGroup?.[l]||{},...c}])):{}}),{...t,...e,columns:"columns"in e?e.columns:t.columns,groupBy:"groupBy"in e?e.groupBy:t?.groupBy??o?.defaults?.groupBy,limit:"limit"in e?e.limit:t?.limit??o?.defaults?.limit,page:n,preset:"preset"in e?e.preset:t?.preset,queryByGroup:i,search:"search"in e?e.search:t?.search,sort:"sort"in e?e.sort:t?.sort??o?.defaults?.sort,where:"where"in e?e.where:t?.where}};var fx=t=>{let e={...t};return Object.entries(e).forEach(([o,n])=>{if(o==="columns"&&(n==="[]"||Array.isArray(e[o])&&e[o].length===0)&&delete e[o],o==="where"&&typeof n=="object"&&n!==null&&!Object.keys(n).length&&delete e[o],(o==="limit"||o==="page")&&typeof n=="string"){let r=parseInt(n,10);e[o]=Number.isNaN(r)?void 0:r}o==="page"&&n===0&&delete e[o],n===""&&delete e[o]}),e};var hx=({children:t,collectionSlug:e,data:o,modifySearchParams:n,onQueryChange:r,orderableFieldName:s,query:i})=>{"use no memo";let a=Re(),l=lt(),{startRouteTransition:c}=Ue(),[u,d]=WA(!1),f=YX({});f.current.modified=u;let{onQueryChange:m}=Sr(),p=m||r,h=GA(()=>fx(mo(l)),[l]),[g,b]=WA(()=>n?h:{limit:i.limit,sort:i.sort}),v=Um(async(A,D)=>{d(D??!0);let T=HA(g,A,{defaults:{limit:i.limit,sort:i.sort}});if(n){let R=`?${px.stringify({...T,columns:JSON.stringify(T.columns),queryByGroup:JSON.stringify(T.queryByGroup)})}`;window.location.search!==R&&c(()=>a.replace(R,{scroll:!1}))}else typeof p=="function"&&p(T);b(T)},[g,i.limit,i.sort,n,p,c,a]),C=Um(async A=>{await v({page:A})},[v]),y=XX.useCallback(async A=>{await v({limit:A,page:1})},[v]),x=Um(async A=>{await v({search:A===""?void 0:A})},[v]),w=Um(async A=>{await v({sort:A})},[v]),S=Um(async A=>{await v({where:A})},[v]),_=et(()=>{let A=fx({...g||{},...i||{}}),D=`?${px.stringify({...A,columns:JSON.stringify(A.columns),queryByGroup:JSON.stringify(A.queryByGroup)})}`;window.location.search!==D&&(b(A),window.history.replaceState(null,"",D))});ZX(()=>{n&&i&&_()},[n,i]);let I=GA(()=>g?.where?((UX(g.where)?g.where:WX(g.where)).or??[]).some(D=>(D.and??[]).some(T=>{let R=Object.keys(T)[0];if(!R)return!1;let P=T[R];if(!P||typeof P!="object")return!1;let E=Object.keys(P)[0];return!!E&&P[E]!==void 0})):!1,[g?.where]);return zA(mx,{value:{collectionSlug:e,data:o,defaultLimit:o?.limit,handlePageChange:C,handlePerPageChange:y,handleSearchChange:x,handleSortChange:w,handleWhereChange:S,hasActiveFilters:I,isGroupingBy:!!g?.groupBy,orderableFieldName:s,query:g,refineListData:v,setModified:d,...f.current},children:zA(VA,{value:u,children:t})})};import{jsx as QX}from"react/jsx-runtime";import{transformColumnsToSearchParams as bx}from"payload/shared";import UA,{startTransition as xg,useCallback as wg,useEffect as KX,useRef as XA}from"react";import{createContext as JX,use as qX}from"react";var gx=JX({}),xu=()=>qX(gx);var Xm=({children:t,collectionSlug:e,columnState:o,LinkedCellOverride:n})=>{let{getEntityConfig:r}=G(),{query:s,refineListData:i}=bt(),{admin:{defaultColumns:a}={}}=r({collectionSlug:e}),[l,c]=UA.useOptimistic(o,(b,v)=>v),u=XA(o);KX(()=>{o!==u.current&&(u.current=o,xg(()=>{c(o)}))},[o,c]);let d=XA({}),f=wg(async b=>{let v=l||[];if(v.findIndex(x=>x.accessor===b)===-1)return;let y=v.map(x=>x.accessor===b?{...x,active:!x.active}:x);xg(()=>{c(y)}),await i({columns:bx(y)})},[i,l,c]),m=wg(async b=>{let{fromIndex:v,toIndex:C}=b,y=[...l||[]],[x]=y.splice(v,1);y.splice(C,0,x),xg(()=>{c(y)}),await i({columns:bx(y)})},[l,i,c]),p=wg(async b=>{let v=s.columns;b.forEach(C=>{let y=v.findIndex(x=>C===x);y!==void 0&&v[y][0]==="-"&&(v[y]=C.slice(1))}),await i({columns:v})},[s,i]),h=UA.useCallback(async()=>{await i({columns:a||[]})},[a,i]),g=wg(async b=>{xg(()=>{c(b)}),await i({columns:bx(b)})},[i,c]);return QX(gx,{value:{columns:l,LinkedCellOverride:n,moveColumn:m,resetColumnsState:h,setActiveColumns:p,setColumns:g,toggleColumn:f,...d.current},children:t})};import{c as bZ}from"react/compiler-runtime";import{jsx as Jm}from"react/jsx-runtime";import{useCallback as _x,useId as vZ,useMemo as Ix,useRef as Rx}from"react";import{c as eZ}from"react/compiler-runtime";import{useState as tZ}from"react";var Sg=t=>{let e=eZ(3),{getEntityConfig:o}=G(),n;e[0]!==o||e[1]!==t?(n=()=>t?(typeof t=="string"?[t]:t).map(i=>o({collectionSlug:i})):[],e[0]=o,e[1]=t,e[2]=n):n=e[2];let[r]=tZ(n);return r};import{jsx as o6,jsxs as pZ}from"react/jsx-runtime";import hZ,{useCallback as Ym,useEffect as r6,useRef as gZ,useState as Sx}from"react";import{c as KA}from"react/compiler-runtime";import{jsx as wx}from"react/jsx-runtime";import{getTranslation as lZ}from"@payloadcms/translations";import cZ from"react";import{jsx as rZ,jsxs as nZ}from"react/jsx-runtime";import Cx,{createContext as sZ}from"react";import{c as oZ}from"react/compiler-runtime";import*as ga from"react";var vx=t=>{let e=oZ(13),{delayBeforeShow:o,inTimeout:n,minShowTime:r,outTimeout:s,show:i}=t,a=n+r+s,[l,c]=Yv(o),[u,d]=ga.useState(!1),[f,m]=ga.useState(!1),p=ga.useRef(0),h=ga.useRef(void 0),g;e[0]!==s?(g=()=>{m(!0),h.current=setTimeout(()=>{d(!1),m(!1)},s)},e[0]=s,e[1]=g):g=e[1];let b=g,v,C;e[2]!==l||e[3]!==u||e[4]!==i||e[5]!==a||e[6]!==b?(v=()=>{let x=l&&!u&&i,w=u&&!i;if(x)p.current=Date.now(),d(!0);else if(w){let S=Date.now()-p.current,_=a-S;clearTimeout(h.current),h.current=setTimeout(b,Math.max(0,_))}},C=[u,i,b,a,l],e[2]=l,e[3]=u,e[4]=i,e[5]=a,e[6]=b,e[7]=v,e[8]=C):(v=e[7],C=e[8]),ga.useEffect(v,C);let y;return e[9]!==u||e[10]!==f||e[11]!==c?(y={isMounted:u,isUnmounting:f,triggerDelayedRender:c},e[9]=u,e[10]=f,e[11]=c,e[12]=y):y=e[12],y};var ZA={isLoading:!1,loaders:[],loadingText:"",overlayType:null},YA=(t,e)=>{let o=[...t.loaders],{type:n="fullscreen",key:r="user",loadingText:s}=e.payload;if(e.type==="add")o.push({type:n,key:r,loadingText:s});else if(e.type==="remove"){let a=o.findIndex(l=>l.key===r&&l.type===n);o.splice(a,1)}let i=o?.length>0?o[o.length-1]:null;return{isLoading:!!i,loaders:o,loadingText:i?.loadingText||t?.loadingText,overlayType:i?.type||t?.overlayType}};var yx=250,JA=sZ({isOnScreen:!1,toggleLoadingOverlay:void 0}),qA=({children:t})=>{let{t:e}=N(),o=e("general:loading"),[n,r]=Cx.useReducer(YA,ZA),{isMounted:s,isUnmounting:i,triggerDelayedRender:a}=vx({delayBeforeShow:1e3,inTimeout:yx,minShowTime:500,outTimeout:yx,show:n.isLoading}),l=Cx.useCallback(({type:c,isLoading:u,key:d,loadingText:f=o})=>{u?(a(),r({type:"add",payload:{type:c,key:d,loadingText:f}})):r({type:"remove",payload:{type:c,key:d}})},[a,o]);return nZ(JA,{value:{isOnScreen:s,toggleLoadingOverlay:l},children:[s&&rZ(en,{animationDuration:`${yx}ms`,loadingText:n.loadingText||o,overlayType:n.overlayType,show:!i}),t]})},_g=()=>{let t=Cx.use(JA);if(t===void 0)throw new Error("useLoadingOverlay must be used within a LoadingOverlayProvider");return t};import{c as iZ}from"react/compiler-runtime";import{jsx as QA,jsxs as aZ}from"react/jsx-runtime";import"react";var xx="spinner",tn=t=>{let e=iZ(7),{loadingText:o,size:n}=t,r=n===void 0?"md":n,{t:s}=N(),i=`${xx}--${r}`,a;e[0]!==i?(a=[xx,i].filter(Boolean),e[0]=i,e[1]=a):a=e[1];let l=a.join(" "),c;return e[2]!==o||e[3]!==r||e[4]!==s||e[5]!==l?(c=aZ("div",{className:l,children:[QA(Oh,{size:r}),o!==null&&QA("span",{className:`${xx}__text`,children:o||`${s("general:loading")}...`})]}),e[2]=o,e[3]=r,e[4]=s,e[5]=l,e[6]=c):c=e[6],c};var Ig="loading-overlay",en=({animationDuration:t,overlayType:e,show:o=!0})=>wx("div",{className:[Ig,o?`${Ig}--entering`:`${Ig}--exiting`,e?`${Ig}--${e}`:""].filter(Boolean).join(" "),style:{animationDuration:t||"500ms"},children:wx(tn,{size:"lg"})}),Rg=t=>{let e=KA(7),{name:o,type:n,loadingText:r,show:s}=t,i=n===void 0?"fullscreen":n,{toggleLoadingOverlay:a}=_g(),l,c;return e[0]!==o||e[1]!==r||e[2]!==s||e[3]!==a||e[4]!==i?(l=()=>(a({type:i,isLoading:s,key:o,loadingText:r||void 0}),()=>{a({type:i,isLoading:!1,key:o})}),c=[s,a,o,i,r],e[0]=o,e[1]=r,e[2]=s,e[3]=a,e[4]=i,e[5]=l,e[6]=c):(l=e[5],c=e[6]),cZ.useEffect(l,c),null},uZ=t=>{let e=KA(6),{name:o,type:n,action:r,formIsLoading:s,loadingSuffix:i}=t,a=n===void 0?"fullscreen":n,l=s===void 0?!1:s,c=mn(),{i18n:u,t:d}=N(),m=`${{create:d("general:creating"),loading:d("general:loading"),update:d("general:updating")}[r]} ${i?lZ(i,u):""}`,p;return e[0]!==l||e[1]!==c||e[2]!==o||e[3]!==m||e[4]!==a?(p=wx(Rg,{loadingText:m.trim(),name:o,show:l||c,type:a}),e[0]=l,e[1]=c,e[2]=o,e[3]=m,e[4]=a,e[5]=p):p=e[5],p};function Fo(t){if(t)try{t.abort()}catch{}}function _r(t){let e=new AbortController;if(t.current)try{t.current.abort()}catch{}return t.current=e,e}import{jsx as dZ}from"react/jsx-runtime";import{createContext as mZ,use as fZ}from"react";var e6=mZ({}),t6=({children:t,...e})=>dZ(e6,{value:{...e},children:t}),Zm=()=>{let t=fZ(e6);if(!t)throw new Error("useDocumentDrawerContext must be used within a DocumentDrawerProvider");return t};var n6=({id:t,collectionSlug:e,disableActions:o,drawerSlug:n,initialData:r,onDelete:s,onDuplicate:i,onSave:a,overrideEntityVisibility:l=!0,redirectAfterCreate:c,redirectAfterDelete:u,redirectAfterDuplicate:d,redirectAfterRestore:f})=>{let{getEntityConfig:m}=G(),[p]=Sx(()=>m({collectionSlug:e})),h=hZ.useRef(null),{closeModal:g}=ie(),{t:b}=N(),{renderDocument:v}=ct(),[C,y]=Sx(void 0),[x,w]=Sx(!0),S=gZ(!1),_=Ym((R,P=!1)=>{let E=_r(h);(async()=>{P&&w(!0);try{let L=await v({collectionSlug:e,disableActions:o,docID:R,drawerSlug:n,initialData:r,overrideEntityVisibility:l,redirectAfterCreate:c,redirectAfterDelete:u!==void 0?u:!1,redirectAfterDuplicate:d!==void 0?d:!1,redirectAfterRestore:f!==void 0?f:!1,signal:E.signal});L?.Document&&(y(L.Document),w(!1))}catch(L){se.error(L?.message||b("error:unspecific")),g(n)}h.current=null})()},[e,o,n,r,u,d,f,v,c,g,l,b]),I=Ym(R=>{R.operation==="create"&&_(R.doc.id),typeof a=="function"&&a({...R,collectionConfig:p})},[a,p,_]),A=Ym(R=>{_(R.doc.id),typeof i=="function"&&i({...R,collectionConfig:p})},[i,p,_]),D=Ym(R=>{typeof s=="function"&&s({...R,collectionConfig:p}),g(n)},[s,g,n,p]),T=Ym(()=>{_(void 0,!0)},[_]);return r6(()=>{!C&&!S.current&&(_(t,!0),S.current=!0)},[C,_,t]),r6(()=>{let R=h.current;return()=>{Fo(R)}},[]),pZ(t6,{clearDoc:T,drawerSlug:n,onDelete:D,onDuplicate:A,onSave:I,children:[!x&&o6("div",{className:"drawer__fade-in",children:C}),o6(en,{animationDuration:"200ms",overlayType:"drawer",show:x})]})};var Uo="doc-drawer",yZ=({id:t,collectionSlug:e,depth:o,uuid:n})=>`doc-drawer_${e}_${o}${t?`_${t}`:""}_${n}`,CZ=t=>{let e=bZ(2),{buttonStyle:o,children:n,className:r,collectionSlug:s,disabled:i,drawerSlug:a,onClick:l,operation:c,...u}=t,{t:d}=N(),[f]=Sg(s),m=d(c==="create"?"fields:addNewLabel":"general:editLabel",{label:f?.labels.singular}),p;return e[0]!==r?(p=[r,`${Uo}__toggler`].filter(Boolean),e[0]=r,e[1]=p):p=e[1],Jm(Jr,{"aria-label":m,buttonStyle:o,className:p.join(" "),disabled:i,onClick:l,slug:a,...u,children:n})},wu=t=>{let{drawerSlug:e}=t;return Jm(It,{className:Uo,Header:null,slug:e,children:Jm(n6,{...t})})},ro=({id:t,collectionSlug:e,drawerSlug:o,overrideEntityVisibility:n})=>{let r=vt(),s=vZ(),{closeModal:i,openModal:a,toggleModal:l}=ie(),c=o||yZ({id:t,collectionSlug:e,depth:r,uuid:s}),u=Rx(i),d=Rx(a),f=Rx(l);u.current=i,d.current=a,f.current=l;let m=_x(()=>{f.current(c)},[c]),p=_x(()=>{u.current(c)},[c]),h=_x(()=>{d.current(c)},[c]),g=Ix(()=>C=>Jm(wu,{...C,collectionSlug:e,drawerSlug:c,id:t,overrideEntityVisibility:n},c),[t,c,e,n]),b=Ix(()=>C=>Jm(CZ,{...C,collectionSlug:e,drawerSlug:c,operation:t?"update":"create"}),[t,c,e]),v=Ix(()=>({closeDrawer:p,drawerDepth:r,drawerSlug:c,isDrawerOpen:!1,openDrawer:h,toggleDrawer:m}),[r,c,m,p,h]);return[g,b,v]};import{c as jZ}from"react/compiler-runtime";import{jsx as kZ}from"react/jsx-runtime";import"react";import{c as $Z}from"react/compiler-runtime";import{jsx as Dg}from"react/jsx-runtime";import"react";import{c as _Z}from"react/compiler-runtime";import{jsx as So,jsxs as ba,Fragment as s6}from"react/jsx-runtime";import{getTranslation as IZ}from"@payloadcms/translations";import{fieldIsHiddenOrDisabled as RZ,fieldIsID as TZ,isFieldDisabled as DZ}from"payload/shared";import AZ,{useCallback as Dx,useId as PZ,useLayoutEffect as FZ,useMemo as i6,useRef as NZ,useState as a6}from"react";import{c as xZ}from"react/compiler-runtime";import{jsx as Tg,jsxs as wZ}from"react/jsx-runtime";import{useId as SZ}from"react";var Nl="switch",Tx=t=>{let e=xZ(16),{id:o,checked:n,className:r,disabled:s,label:i,onChange:a}=t,l=n===void 0?!1:n,c=s===void 0?!1:s,{t:u}=N(),d=SZ(),f=o||d,m;e[0]!==c||e[1]!==a?(m=C=>{!c&&a&&a(C.target.checked)},e[0]=c,e[1]=a,e[2]=m):m=e[2];let p=m,h=c&&`${Nl}--disabled`,g;e[3]!==r||e[4]!==h?(g=[Nl,h,r].filter(Boolean),e[3]=r,e[4]=h,e[5]=g):g=e[5];let b=g.join(" "),v;if(e[6]!==l||e[7]!==c||e[8]!==p||e[9]!==f||e[10]!==i||e[11]!==u||e[12]!==b){let C=Tg("input",{"aria-label":typeof i=="string"?i:u("general:toggle"),checked:l,className:`${Nl}__input`,disabled:c,id:f,onChange:p,type:"checkbox"}),y=l&&`${Nl}__track--checked`,x;e[14]!==y?(x=[`${Nl}__track`,y].filter(Boolean),e[14]=y,e[15]=x):x=e[15],v=wZ("label",{className:b,htmlFor:f,children:[C,Tg("span",{"aria-hidden":"true",className:x.join(" "),children:Tg("span",{className:`${Nl}__knob`})}),i?Tg("span",{className:`${Nl}__label`,children:i}):null]}),e[6]=l,e[7]=c,e[8]=p,e[9]=f,e[10]=i,e[11]=u,e[12]=b,e[13]=v}else v=e[13];return v};var wo="column-selector";function EZ(t){if(!t.includes(" > "))return[t];let e=t.split(" > ");return e.length<=3?e:[e[0],"...",e[e.length-1]]}var LZ=({label:t})=>{let e=EZ(t);return e.length===1?So(s6,{children:e[0]}):So(s6,{children:e.map((o,n)=>ba(AZ.Fragment,{children:[n>0&&So("span",{className:`${wo}__separator`,children:"/"}),o]},n))})},l6=t=>{let e=_Z(16),{id:o,active:n,labelText:r,onToggle:s}=t,{t:i}=N(),a;e[0]!==o?(a={id:o},e[0]=o,e[1]=a):a=e[1];let{attributes:l,isDragging:c,isOver:u,isSorting:d,listeners:f,setNodeRef:m,transform:p}=qs(a),h=!n&&`${wo}__item--inactive`,g=c&&`${wo}__item--dragging`,b=u&&d&&!c&&`${wo}__item--over`,v;e[2]!==h||e[3]!==g||e[4]!==b?(v=[`${wo}__item`,h,g,b].filter(Boolean),e[2]=h,e[3]=g,e[4]=b,e[5]=v):v=e[5];let C=v.join(" "),y=c?void 0:p,x;return e[6]!==n||e[7]!==l||e[8]!==r||e[9]!==f||e[10]!==s||e[11]!==m||e[12]!==i||e[13]!==C||e[14]!==y?(x=ba("div",{"aria-label":r,className:C,ref:m,style:{transform:y,...l.style},...l,children:[So("span",{"aria-label":i("general:dragToReorder"),className:`${wo}__drag-handle`,...f,children:So(Ho,{size:16})}),So("span",{className:`${wo}__item-label`,children:So(LZ,{label:r})}),So(Tx,{checked:n,onChange:s})]}),e[6]=n,e[7]=l,e[8]=r,e[9]=f,e[10]=s,e[11]=m,e[12]=i,e[13]=C,e[14]=y,e[15]=x):x=e[15],x},c6=({collectionSlug:t,columns:e,onChange:o,onClose:n})=>{let{i18n:r,t:s}=N(),i=Dx(y=>{o(e.map(x=>x.accessor===y?{...x,active:!x.active}:x))},[e,o]),a=Dx(({fromIndex:y,toIndex:x})=>{let w=[...e],[S]=w.splice(y,1);w.splice(x,0,S),o(w)},[e,o]),l=PZ(),c=vt(),[u,d]=a6(""),f=NZ(null),[m,p]=a6(null);FZ(()=>{f.current&&(u&&m===null?p(f.current.offsetWidth):!u&&m!==null&&p(null))},[u,m]);let h=i6(()=>e?.filter(y=>!(RZ(y.field)&&!TZ(y.field))&&!DZ(y.field,"column")),[e]),g=i6(()=>{if(!h)return{all:[],hidden:[],shown:[]};let y=h.map((w,S)=>{let{accessor:_,active:I,field:A}=w,D="labelWithPrefix"in A&&A.labelWithPrefix!==void 0?A.labelWithPrefix:"label"in A&&A.label!==void 0&&A.label!==!1?A.label:"name"in A&&A.name!==void 0?A.name:_,T=typeof D=="string"?D:IZ(D,r);return{id:`${t}-${_}-${S}${c?`-${c}-`:""}${l}`,accessor:_,active:I,index:S,label:D,labelText:T}}),x=u?y.filter(w=>w.labelText.toLowerCase().includes(u.toLowerCase())):y;return{all:y,hidden:x.filter(w=>!w.active),shown:x.filter(w=>w.active)}},[t,c,h,r,u,l]),b=Dx(({moveFromIndex:y,moveToIndex:x})=>{if(y===x)return;let w=[...g.shown,...g.hidden],S=g.shown.length,_=w[y],I=w[x];if(!_||!I)return;let A=y<S,D=x<S;if(A!==D){i(_.accessor);return}a({fromIndex:_.index,toIndex:I.index})},[g.shown,g.hidden,a,i]);if(!h)return null;let v=[...g.shown,...g.hidden].map(y=>y.id),C=m?{"--column-selector-locked-width":`${m}px`}:void 0;return ba("div",{className:wo,"data-popup-prevent-close":!0,"data-width-locked":m?"true":void 0,ref:f,style:C,children:[ba("div",{className:`${wo}__header`,children:[So("span",{className:`${wo}__title`,children:s("general:editColumns")}),n&&So(Z,{"aria-label":s("general:close"),buttonStyle:"ghost",className:`${wo}__close`,icon:So(xt,{size:24}),onClick:n})]}),So("div",{className:`${wo}__search`,children:ba("div",{className:`${wo}__search-bar`,children:[So(Cl,{size:24}),So("input",{"aria-label":s("general:searchColumns"),className:`${wo}__search-input`,onChange:y=>d(y.target.value),placeholder:s("general:searchColumns"),type:"text",value:u})]})}),So("div",{className:`${wo}__content`,children:ba(hr,{ids:v,onDragEnd:b,children:[g.shown.length===0&&g.hidden.length===0&&u&&So("div",{className:`${wo}__no-results`,children:s("general:noMatchesFound")}),g.shown.length>0&&ba("div",{className:`${wo}__section`,children:[So("div",{className:`${wo}__section-header`,children:s("general:shownInTable")}),g.shown.map(y=>So(l6,{active:y.active,id:y.id,labelText:y.labelText,onToggle:()=>{i(y.accessor)}},y.id))]}),g.hidden.length>0&&ba("div",{className:`${wo}__section`,children:[So("div",{className:`${wo}__section-header`,children:s("general:notShownInTable")}),g.hidden.map(y=>So(l6,{active:y.active,id:y.id,labelText:y.labelText,onToggle:()=>{i(y.accessor)}},y.id))]})]})})]})};var u6="columns-button",Ag=t=>{let e=$Z(9),{collectionSlug:o,columns:n,onChange:r}=t,{t:s}=N(),i;e[0]!==o||e[1]!==n||e[2]!==r?(i=c=>{let{close:u}=c;return Dg(c6,{collectionSlug:o,columns:n,onChange:r,onClose:u})},e[0]=o,e[1]=n,e[2]=r,e[3]=i):i=e[3];let a;e[4]!==s?(a=c=>{let{active:u,...d}=c;return Dg(Z,{...d,buttonStyle:"secondary",className:`${u6}__button`,icon:Dg(ve,{direction:u?"up":"down",size:16}),selected:u,size:"medium",children:s("general:columns")})},e[4]=s,e[5]=a):a=e[5];let l;return e[6]!==i||e[7]!==a?(l=Dg(Ve,{className:u6,horizontalAlign:"right",render:i,renderButton:a,theme:"auto",verticalAlign:"bottom"}),e[6]=i,e[7]=a,e[8]=l):l=e[8],l};var Pg=t=>{let e=jZ(4),{collectionSlug:o}=t,{columns:n,setColumns:r}=xu(),s;return e[0]!==o||e[1]!==n||e[2]!==r?(s=kZ(Ag,{collectionSlug:o,columns:n,onChange:r}),e[0]=o,e[1]=n,e[2]=r,e[3]=s):s=e[3],s};import{jsx as Fg,jsxs as MZ}from"react/jsx-runtime";import BZ from"react";var qm="no-results";function El({Actions:t,description:e,title:o,withMargin:n}){return MZ("div",{className:`${qm}${n?` ${qm}--with-margin`:""}`,children:[o?Fg("span",{className:`${qm}__title`,children:o}):null,e?Fg("p",{className:`${qm}__description`,children:e}):null,t&&t.length>0&&Fg("div",{className:`${qm}__actions`,children:t.map((r,s)=>Fg(BZ.Fragment,{children:r},s))})]})}import{c as zZ}from"react/compiler-runtime";import{jsx as GZ}from"react/jsx-runtime";import{appendUploadSelectFields as WZ,formatAdminURL as UZ}from"payload/shared";import*as m6 from"qs-esm";import{createContext as XZ,use as ZZ,useEffect as YZ,useReducer as JZ,useRef as qZ}from"react";import{c as OZ}from"react/compiler-runtime";import{useEffect as VZ,useState as HZ}from"react";function Vn(t,e){let o=OZ(4),[n,r]=HZ(t),s,i;return o[0]!==e||o[1]!==t?(s=()=>{let a=setTimeout(()=>{r(t)},e);return()=>{clearTimeout(a)}},i=[t,e],o[0]=e,o[1]=t,o[2]=s,o[3]=i):(s=o[2],i=o[3]),VZ(s,i),n}function d6(t,e){switch(e.type){case"ADD_LOADED":{let o={...t};typeof o[e.relationTo]!="object"&&(o[e.relationTo]={});let n=[...e.idsToLoad];return Array.isArray(e.docs)&&e.docs.forEach(r=>{n.splice(n.indexOf(r.id),1),o[e.relationTo][r.id]=r}),n.forEach(r=>{o[e.relationTo][r]=!1}),o}case"REQUEST":{let o={...t};return e.docs.forEach(({relationTo:n,value:r})=>{typeof o[n]!="object"&&(o[n]={}),o[n][r]=null}),o}default:return t}}var f6=XZ({}),Qm=t=>{let e=zZ(15),{children:o}=t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={},e[0]=n):n=e[0];let[r,s]=JZ(d6,n),i=Vn(r,100),{config:a}=G(),{collections:l,routes:c}=a,{api:u}=c,{i18n:d}=N(),{code:f}=Ce(),m=qZ(f),p;e[1]!==u||e[2]!==l||e[3]!==i||e[4]!==d||e[5]!==f?(p=x=>{let w=x===void 0?!1:x;Object.entries(i).forEach(async S=>{let[_,I]=S,A=[];if(Object.entries(I).forEach(D=>{let[T,R]=D;(R===null||w)&&A.push(T)}),A.length>0){let D=UZ({apiRoute:u,path:`/${_}`}),T=new URLSearchParams,R={};T.append("depth","0"),T.append("draft","true"),T.append("limit","250");let P=l.find($=>$.slug===_);if(!P)return;let E=P.admin.useAsTitle??"id";R[E]=!0,P.upload&&WZ({collectionConfig:P,select:R}),f&&T.append("locale",f);let F=A.map(QZ);T.append("where[id][in]",F.join(","));let L=`?${T.toString()}&${m6.stringify({select:R})}`,M=await fetch(`${D}${L}`,{credentials:"include",headers:{"Accept-Language":d.language}});if(M.ok){let $=await M.json();$.docs&&s({type:"ADD_LOADED",docs:$.docs,idsToLoad:A,relationTo:_})}else s({type:"ADD_LOADED",docs:[],idsToLoad:A,relationTo:_})}})},e[1]=u,e[2]=l,e[3]=i,e[4]=d,e[5]=f,e[6]=p):p=e[6];let h=p,g,b;e[7]!==h||e[8]!==f?(g=()=>{h(f&&m.current!==f),m.current=f},b=[f,h],e[7]=h,e[8]=f,e[9]=g,e[10]=b):(g=e[9],b=e[10]),YZ(g,b);let v;e[11]===Symbol.for("react.memo_cache_sentinel")?(v=x=>{s({type:"REQUEST",docs:x})},e[11]=v):v=e[11];let C=v,y;return e[12]!==o||e[13]!==r?(y=GZ(f6,{value:{documents:r,getRelationships:C},children:o}),e[12]=o,e[13]=r,e[14]=y):y=e[14],y},Km=()=>ZZ(f6);function QZ(t){return String(t)}import{jsx as Su}from"react/jsx-runtime";import{getTranslation as KZ}from"@payloadcms/translations";var Ax=({allowCreate:t,baseClass:e,buttonStyle:o,className:n,collections:r,i18n:s,icon:i,label:a,onClick:l,permissions:c,relationTo:u})=>t?Array.isArray(u)?Su("div",{className:`${e}__add-new-polymorphic-wrapper`,children:Su(Ve,{button:Su(Z,{buttonStyle:o,className:n,icon:i,children:a}),buttonType:"custom",horizontalAlign:"center",render:({close:f})=>Su(ue.ButtonGroup,{children:u.map(m=>c.collections[m]?.create?Su(ue.Button,{className:`${e}__relation-button--${m}`,onClick:()=>{f(),l(m)},children:KZ(r.find(p=>p.slug===m).labels.singular,s)},m):null)}),size:"medium"})}):Su(Z,{buttonStyle:o,className:[n,"doc-drawer__toggler"].filter(Boolean).join(" "),onClick:()=>l(),children:a}):null;import{c as CJ}from"react/compiler-runtime";import{jsx as Ux,jsxs as xJ}from"react/jsx-runtime";import"react";import{c as bJ}from"react/compiler-runtime";import{jsx as sP}from"react/jsx-runtime";import iP from"react";import{c as uJ}from"react/compiler-runtime";import{jsx as pi,jsxs as dJ}from"react/jsx-runtime";import{getTranslation as mJ}from"@payloadcms/translations";import{fieldAffectsData as fJ,fieldIsID as pJ,formatAdminURL as hJ}from"payload/shared";import"react";import{getTranslation as oY}from"@payloadcms/translations";import eY from"react";var tY=Symbol.for("react.lazy");function Ng(t){return eY.isValidElement(t)||t?.$$typeof===tY}var p6=(t,e,o)=>{if((e?.type==="select"||e?.type==="radio")&&Array.isArray(e.options)){let n=e.options.find(r=>typeof r=="object"?r.value===t:r===t);if(n)return typeof n=="object"&&"label"in n?Ng(n.label)?n.label:oY(n.label,o)||n.value:n}return t};import{jsx as h6}from"react/jsx-runtime";import"react";var Eg=({cellData:t,nowrap:e})=>{let o=t?.length>100?`${t.substring(0,100)}\u2026`:t;return h6("code",{className:"code-cell",style:e?{whiteSpace:"nowrap"}:{},children:h6("span",{children:o})})};import{jsx as kx,jsxs as EY}from"react/jsx-runtime";import{useCallback as LY,useEffect as $Y,useMemo as Mx,useRef as V6,useState as jY}from"react";import{jsx as g6}from"react/jsx-runtime";import"react";var rY={16:"M6.58594 3C6.98371 3.00004 7.36522 3.15818 7.64648 3.43945L9.20703 5H12C12.8284 5 13.5 5.67157 13.5 6.5V11.5C13.5 12.3284 12.8284 13 12 13H4C3.17157 13 2.5 12.3284 2.5 11.5V4.5C2.5 3.67157 3.17157 3 4 3H6.58594ZM4 4C3.72386 4 3.5 4.22386 3.5 4.5V11.5C3.5 11.7761 3.72386 12 4 12H12C12.2761 12 12.5 11.7761 12.5 11.5V6.5C12.5 6.22386 12.2761 6 12 6H8.79297L6.93945 4.14648C6.84572 4.05275 6.71849 4.00004 6.58594 4H4ZM11 10C11.2761 10 11.5 10.2239 11.5 10.5C11.5 10.7761 11.2761 11 11 11H5C4.72386 11 4.5 10.7761 4.5 10.5C4.5 10.2239 4.72386 10 5 10H11Z",24:"M10.58594 6C10.98371 6.00004 11.36522 6.15818 11.64648 6.43945L13.20703 8H16.5C17.3284 8 18 8.67157 18 9.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V7.5C6 6.67157 6.67157 6 7.5 6H10.58594ZM7.5 7C7.22386 7 7 7.22386 7 7.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V9.5C17 9.22386 16.7761 9 16.5 9H12.79297L10.93945 7.14648C10.84572 7.05275 10.71849 7.00004 10.58594 7H7.5ZM15.5 15C15.7761 15 16 15.2239 16 15.5C16 15.7761 15.7761 16 15.5 16H8.5C8.22386 16 8 15.7761 8 15.5C8 15.2239 8.22386 15 8.5 15H15.5Z"},ef=({className:t,size:e=24})=>g6("svg",{className:["icon","icon--folder",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:g6("path",{clipRule:"evenodd",d:rY[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as b6}from"react/jsx-runtime";import"react";var nY={16:"M7.793 3a2.5 2.5 0 0 1 1.768.732l3.853 3.854a2 2 0 0 1 0 2.828l-3 3a2 2 0 0 1-2.828 0L3.732 9.561A2.5 2.5 0 0 1 3 7.793V4.5A1.5 1.5 0 0 1 4.5 3zM4.5 4a.5.5 0 0 0-.5.5v3.293c0 .398.158.78.44 1.06l3.853 3.854a1 1 0 0 0 1.414 0l3-3a1 1 0 0 0 0-1.414L8.854 4.439A1.5 1.5 0 0 0 7.793 4zm2 1.5a1 1 0 1 1 0 2 1 1 0 0 1 0-2m1.59-.402.056.048a.5.5 0 0 0-.069-.057z",24:"M11.793 6a2.5 2.5 0 0 1 1.768.732l4.853 4.854a2 2 0 0 1 0 2.828l-4 4a2 2 0 0 1-2.828 0L6.733 13.56A2.5 2.5 0 0 1 6 11.794V7.5A1.5 1.5 0 0 1 7.5 6zM7.5 7l-.1.01a.5.5 0 0 0-.4.49v4.293c0 .398.158.78.44 1.06l4.853 4.854a1 1 0 0 0 1.414 0l4-4a1 1 0 0 0 0-1.414l-4.853-4.854A1.5 1.5 0 0 0 11.794 7zm2 1a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3m0 1a.5.5 0 1 0 0 1 .5.5 0 0 0 0-1m2.59-.902.057.048a.5.5 0 0 0-.07-.057z"};function Ll({className:t,size:e=24}){return b6("svg",{className:[t,"icon icon--tag"].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:b6("path",{d:nY[e],fill:"currentColor"})})}var Lg=!!(typeof window<"u"&&window.document&&window.document.createElement);import{jsx as M6}from"react/jsx-runtime";import{createElement as FY}from"react";import{useCallback as $x,useId as NY,useMemo as Vg,useRef as jx}from"react";import{jsx as aY}from"react/jsx-runtime";import{DEFAULT_HIERARCHY_TREE_LIMIT as v6,formatAdminURL as y6,PREFERENCE_KEYS as lY}from"payload/shared";import*as C6 from"qs-esm";import{createContext as cY,use as uY,useCallback as Hn,useState as Vr}from"react";import{c as sY}from"react/compiler-runtime";import{useRef as iY}from"react";var tf=(t,e)=>{let o=sY(3),n=iY(void 0),r;return o[0]!==t||o[1]!==e?(r=(...s)=>{let i=s,a=()=>{clearTimeout(n.current),t(...i)};clearTimeout(n.current),n.current=setTimeout(a,e)},o[0]=t,o[1]=e,o[2]=r):r=o[2],r};var x6=cY(void 0),Px=({children:t})=>{let{setPreference:e}=Jt(),o=Re(),{config:{routes:{admin:n,api:r},serverURL:s}}=G(),[i,a]=Vr(null),[l,c]=Vr(null),[u,d]=Vr(null),[f,m]=Vr(""),[p,h]=Vr(v6),[g,b]=Vr(null),[v,C]=Vr(null),[y,x]=Vr(null),[w,S]=Vr(()=>new Map),[_,I]=Vr(()=>new Map),[A,D]=Vr(()=>new Map),[T,R]=Vr(!1),[P,E]=Vr(null),[F,L]=Vr(()=>new Map),M=Hn(Y=>{if(!l)return[];let K=w.get(l);return K?K.docs.filter(ee=>{let te=ee[f];return Y===null?te==null:te!==null&&String(te)===String(Y)}):[]},[l,f,w]),$=Hn(Y=>{let{allowedCollections:K,baseFilter:ee,collectionSlug:te,expandedNodes:re,parent:me,parentFieldName:we,selectedFilters:Ae,treeData:de,treeLimit:xe,typeFieldName:$e,useAsTitle:Le}=Y;c(te),ee!==void 0&&a(ee??null),K&&x(K),we&&m(we),xe!==void 0&&h(xe),$e!==void 0&&b($e),me!==void 0&&d(me),Le!==void 0&&C(Le),de&&S(rt=>{let q=new Map(rt),pe=q.get(te);if(ee!==void 0||!pe)q.set(te,{...de,baseFilter:ee??null});else{let fe=new Set(pe.docs.map(ge=>ge.id)),Pe=de.docs.filter(ge=>!fe.has(ge.id));q.set(te,{baseFilter:pe.baseFilter,docs:[...pe.docs,...Pe],loadedParents:{...pe.loadedParents,...de.loadedParents}})}return q}),re&&re.length>0&&I(rt=>{let q=new Map(rt),pe=q.get(te)||new Set,fe=new Set([...pe,...re]);return q.set(te,fe),q}),Ae&&D(rt=>{let q=new Map(rt);return q.set(te,Ae),q})},[]),B=tf(async(Y,K)=>{let ee=`${lY.HIERARCHY_TREE}-${Y}`,te=_.get(Y)||new Set,re=A.get(Y)||[];await e(ee,{expandedNodes:Array.from(K.expanded??te),selectedFilters:K.filters??re})},500),j=Hn((Y,K)=>{I(ee=>{let te=new Map(ee),re=te.get(Y)||new Set,me=new Set(re);return me.has(K)?me.delete(K):me.add(K),te.set(Y,me),B(Y,{expanded:me}),te})},[B]),k=Hn(Y=>{l&&j(l,Y)},[l,j]),O=Hn(Y=>_.get(Y)||new Set,[_]),V=Hn(Y=>w.get(Y)||null,[w]),H=Hn(Y=>{l&&D(K=>{let ee=new Map(K);return ee.set(l,Y),B(l,{filters:Y}),ee})},[l,B]),z=Hn(Y=>{if(!l)return;let ee=y6({adminRoute:n,path:`/collections/${l}${Y!==null?`?${f||"parent"}=${Y}`:""}`});o.push(ee),o.refresh()},[n,l,f,o]),W=Hn(async Y=>{if(!l||T)return;let K=w.get(l);if(!K)return;let ee=Y===null?"root":String(Y),te=K.loadedParents[ee];if(!(!te||!te.hasMore)){R(!0),E(Y);try{let re=K.docs.filter(rt=>{let q=rt[f];return Y===null?q==null:q!==null&&String(q)===String(Y)}),me=Math.floor(re.length/p)+1,we=Y===null?{or:[{[f]:{exists:!1}},{[f]:{equals:null}}]}:{[f]:{equals:Y}},Ae=C6.stringify({limit:p,page:me,sort:v??"id",where:we},{addQueryPrefix:!0}),de=y6({apiRoute:r,path:`/${l}${Ae}`,serverURL:s}),xe=await fetch(de,{credentials:"include"});if(!xe.ok)throw new Error("Failed to fetch more children");let $e=await xe.json(),Le=$e.docs||[];S(rt=>{let q=new Map(rt),pe=q.get(l);if(pe){let fe=new Set(pe.docs.map(ge=>ge.id)),Pe=Le.filter(ge=>!fe.has(ge.id));q.set(l,{docs:[...pe.docs,...Pe],loadedParents:{...pe.loadedParents,[ee]:{hasMore:$e.hasNextPage||!1,totalDocs:$e.totalDocs||0}}})}return q})}catch{}finally{R(!1),E(null)}}},[r,l,T,f,s,w,p,v]),U=Hn(()=>{a(null),c(null),d(null),m(""),h(v6),b(null),C(null),S(new Map),I(new Map),D(new Map),R(!1),E(null)},[]),X=Hn(Y=>{S(K=>{let ee=new Map(K);return ee.delete(Y),ee}),L(K=>{let ee=new Map(K);return ee.set(Y,(ee.get(Y)??0)+1),ee})},[]),Q=l&&_.has(l)?_.get(l):new Set,J=l&&A.has(l)?A.get(l):[];return aY(x6,{value:{allowedCollections:y,baseFilter:i,collectionSlug:l,expandedNodes:Q,getExpandedNodesForCollection:O,getNodeChildren:M,getTreeDataForCollection:V,hydrate:$,isLoadingMore:T,loadingNodeId:P,loadMoreChildren:W,parent:u,parentFieldName:f,refreshTree:X,reset:U,selectedFilters:J,selectParent:z,setSelectedFilters:H,toggleNode:k,toggleNodeForCollection:j,treeLimit:p,treeRefreshKeys:F,typeFieldName:g,useAsTitle:v},children:t})},No=()=>{let t=uY(x6);if(!t)throw new Error("useHierarchy must be used within HierarchyProvider");return t};import{jsx as bn,jsxs as kl,Fragment as j6}from"react/jsx-runtime";import{getTranslation as RY}from"@payloadcms/translations";import TY,{useCallback as Tu,useEffect as DY,useImperativeHandle as AY,useMemo as Lx,useRef as $6,useState as of}from"react";import{c as fY}from"react/compiler-runtime";import{jsx as $g,jsxs as S6}from"react/jsx-runtime";import"react";import{c as dY}from"react/compiler-runtime";import{jsx as w6}from"react/jsx-runtime";import"react";var mY="form-submit",qt=t=>{let e=dY(7),{type:o,buttonId:n,children:r,disabled:s,onClick:i}=t,a=o===void 0?"submit":o,l=mn(),c=ly(),u=Xs(),{disabled:d}=Ge(),m=!(s||u||l||c||d)?void 0:!0,p;return e[0]!==r||e[1]!==n||e[2]!==i||e[3]!==t||e[4]!==m||e[5]!==a?(p=w6("div",{className:mY,children:w6(Z,{...t,disabled:m,id:n,onClick:i,type:a,children:r})}),e[0]=r,e[1]=n,e[2]=i,e[3]=t,e[4]=m,e[5]=a,e[6]=p):p=e[6],p};var jg="drawer-action-header",_6=t=>{let e=fY(10),{cancelLabel:o,className:n,onCancel:r,onSave:s,saveLabel:i,title:a}=t,{t:l}=N(),c;e[0]!==n?(c=[jg,n].filter(Boolean),e[0]=n,e[1]=c):c=e[1];let u=c.join(" "),d;return e[2]!==o||e[3]!==r||e[4]!==s||e[5]!==i||e[6]!==l||e[7]!==u||e[8]!==a?(d=$g("div",{className:u,children:S6("div",{className:`${jg}__content`,children:[$g("h1",{className:`${jg}__title`,children:a}),S6("div",{className:`${jg}__actions`,children:[$g(Z,{"aria-label":l("general:cancel"),buttonStyle:"secondary",margin:!1,onClick:r,children:o||l("general:cancel")}),$g(qt,{"aria-label":l("general:applyChanges"),margin:!1,onClick:s,children:i||l("general:applyChanges")})]})]})}),e[2]=o,e[3]=r,e[4]=s,e[5]=i,e[6]=l,e[7]=u,e[8]=a,e[9]=d):d=e[9],d};import{jsx as Mg,jsxs as vY}from"react/jsx-runtime";import{getTranslation as yY}from"@payloadcms/translations";import{combineWhereConstraints as CY,DEFAULT_HIERARCHY_TREE_LIMIT as xY,formatAdminURL as wY}from"payload/shared";import*as F6 from"qs-esm";import{useCallback as Bg,useEffect as A6,useImperativeHandle as SY,useRef as Ex,useState as P6}from"react";function $l(t,e){return!t||t.length===0?!0:e.every(o=>t.includes(o))}import{c as bY}from"react/compiler-runtime";import{jsx as Ru,jsxs as kg}from"react/jsx-runtime";import"react";import{c as pY}from"react/compiler-runtime";import{jsx as Fx,jsxs as I6,Fragment as R6}from"react/jsx-runtime";import"react";var Nx="load-more-row",_u=t=>{let e=pY(12),{className:o,currentCount:n,hasMore:r,isLoading:s,loadMoreButton:i,onLoadMore:a,style:l,totalDocs:c}=t,u=s===void 0?!1:s,{t:d}=N(),f;if(e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==u||e[4]!==i||e[5]!==a||e[6]!==l||e[7]!==d||e[8]!==c){let m=a&&Fx(Z,{buttonStyle:"ghost",className:`${Nx}__button`,disabled:u,margin:!1,onClick:a,children:d(u?"general:loading":"general:loadMore")}),p;e[10]!==o?(p=[Nx,o].filter(Boolean),e[10]=o,e[11]=p):p=e[11],f=Fx("div",{className:p.join(" "),style:l,children:Fx("p",{className:`${Nx}__text`,children:r?I6(R6,{children:["Showing ",n," of ",c," \u2014 ",i||m]}):I6(R6,{children:["Showing ",c," of ",c]})})}),e[0]=o,e[1]=n,e[2]=r,e[3]=u,e[4]=i,e[5]=a,e[6]=l,e[7]=d,e[8]=c,e[9]=f}else f=e[9];return f};import{c as hY}from"react/compiler-runtime";import{jsx as Iu,jsxs as gY}from"react/jsx-runtime";import"react";var mi="hierarchy-column-item",T6=t=>{let e=hY(27),{disabled:o,filterByCollection:n,hasSelectedDescendants:r,isExpanded:s,isSelected:i,item:a,onExpand:l,onSelect:c}=t,{id:u,allowedCollections:d,hasChildren:f,title:m}=a,p;e:{if(o){p=!0;break e}if(!n||n.length===0){p=!1;break e}p=!$l(d,n)}let h=p,g;e[0]!==u||e[1]!==h||e[2]!==c?(g=P=>{P.stopPropagation(),!h&&c({id:u})},e[0]=u,e[1]=h,e[2]=c,e[3]=g):g=e[3];let b=g,v;e[4]!==f||e[5]!==u||e[6]!==l?(v=P=>{P.target.closest(`.${mi}__checkbox`)||f&&l({id:u})},e[4]=f,e[5]=u,e[6]=l,e[7]=v):v=e[7];let C=v,y;e[8]!==f||e[9]!==u||e[10]!==l?(y=P=>{(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),f&&l({id:u}))},e[8]=f,e[9]=u,e[10]=l,e[11]=y):y=e[11];let x=y,w=s&&`${mi}--expanded`,S=i&&`${mi}--selected`,_=h&&`${mi}--disabled`,I;e[12]!==w||e[13]!==S||e[14]!==_?(I=[mi,w,S,_].filter(Boolean),e[12]=w,e[13]=S,e[14]=_,e[15]=I):I=e[15];let A=I.join(" "),D=h?void 0:C,T=h?-1:0,R;return e[16]!==b||e[17]!==x||e[18]!==f||e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==D||e[23]!==T||e[24]!==A||e[25]!==m?(R=gY("div",{className:A,onClick:D,onKeyDown:x,role:"button",tabIndex:T,children:[Iu("div",{className:`${mi}__checkbox`,children:Iu(Ft,{checked:i,onToggle:b,readOnly:h,variant:"muted"})}),Iu("span",{className:`${mi}__title`,title:m,children:m}),r&&!i&&Iu("span",{className:`${mi}__descendant-indicator`}),f&&Iu("span",{className:`${mi}__chevron`,children:Iu(ve,{direction:"right"})})]}),e[16]=b,e[17]=x,e[18]=f,e[19]=r,e[20]=h,e[21]=i,e[22]=D,e[23]=T,e[24]=A,e[25]=m,e[26]=R):R=e[26],R};var jl="hierarchy-column",D6=t=>{let e=bY(37),{ancestorsWithSelections:o,canCreate:n,collectionLabel:r,disabled:s,disabledIds:i,expandedId:a,filterByCollection:l,hasNextPage:c,isLoading:u,items:d,onCreateNew:f,onExpand:m,onLoadMore:p,onSelect:h,parentId:g,parentTitle:b,pathToColumn:v,selectedIds:C,totalDocs:y}=t,{t:x}=N(),w;if(e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s||e[4]!==i||e[5]!==a||e[6]!==l||e[7]!==c||e[8]!==u||e[9]!==d||e[10]!==f||e[11]!==m||e[12]!==p||e[13]!==h||e[14]!==g||e[15]!==b||e[16]!==v||e[17]!==C||e[18]!==x||e[19]!==y){let S=b||(g===null?x("general:all"):""),_;e[21]!==d||e[22]!==h||e[23]!==v?(_=R=>{let{id:P}=R,E=d.find(L=>L.id===P),F=E?[...v,{id:E.id,title:E.title}]:v;h({id:P,path:F})},e[21]=d,e[22]=h,e[23]=v,e[24]=_):_=e[24];let I=_,A;e[25]!==f||e[26]!==g?(A=()=>{f({parentId:g})},e[25]=f,e[26]=g,e[27]=A):A=e[27];let D=A,T;e[28]!==o||e[29]!==s||e[30]!==i||e[31]!==a||e[32]!==l||e[33]!==I||e[34]!==m||e[35]!==C?(T=R=>Ru(T6,{disabled:!!(s||i?.has(R.id)),filterByCollection:l,hasSelectedDescendants:o.has(R.id),isExpanded:a===R.id,isSelected:C.has(R.id),item:R,onExpand:m,onSelect:I},String(R.id)),e[28]=o,e[29]=s,e[30]=i,e[31]=a,e[32]=l,e[33]=I,e[34]=m,e[35]=C,e[36]=T):T=e[36],w=kg("div",{className:jl,children:[kg("div",{className:`${jl}__header`,children:[Ru("span",{className:`${jl}__header-title`,children:S}),n&&kg(Z,{buttonStyle:"ghost",className:`${jl}__add-button`,disabled:s,icon:Ru(Po,{size:16}),iconPosition:"left",margin:!1,onClick:D,size:"medium",children:["New ",r]})]}),kg("div",{className:`${jl}__items`,children:[d.map(T),u&&Ru("div",{className:`${jl}__loading`,children:Ru(tn,{loadingText:null,size:"sm"})}),!s&&!u&&y>0&&Ru(_u,{className:`${jl}__load-more`,currentCount:d.length,hasMore:c,onLoadMore:p,totalDocs:y})]})]}),e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=l,e[7]=c,e[8]=u,e[9]=d,e[10]=f,e[11]=m,e[12]=p,e[13]=h,e[14]=g,e[15]=b,e[16]=v,e[17]=C,e[18]=x,e[19]=y,e[20]=w}else w=e[20];return w};var Og="hierarchy-column-browser",N6=function({ancestorsWithSelections:e,baseFilter:o,disabledIds:n,filterByCollection:r,hierarchyCollectionSlug:s,initialExpandedPath:i,isLoadingPath:a,onCreateNew:l,onSelect:c,parentFieldName:u,ref:d,selectedIds:f,useAsTitle:m="id"}){let{i18n:p}=N(),{permissions:h}=ye(),{config:{routes:{api:g},serverURL:b},getEntityConfig:v}=G(),C=v({collectionSlug:s}),y=C?.hierarchy&&typeof C.hierarchy=="object"?C.hierarchy:void 0,x=y?.admin?.treeLimit??xY,w=C?yY(C.labels?.singular||s,p):s,S=!!h?.collections?.[s]?.create,[_,I]=P6([]),[A,D]=P6([]),T=Ex(null),R=Ex(null),P=Ex(!1),E=Bg(async({page:j,parentId:k})=>{let O=k===null?{[u]:{exists:!1}}:{[u]:{equals:k}},V=O;if(y?.collectionSpecific&&r!==void 0){let Y=y.collectionSpecific.fieldName;if(r.length>0){let K=Object.keys(y.relatedCollections||{});V={and:[O,{or:[{[Y]:{in:r}},{[Y]:{exists:!1}},...K.length>0?[{[Y]:{not_in:K}}]:[]]}]}}else V=O}let H=CY([V,o]),z=F6.stringify({limit:x,page:j,sort:m,where:H},{addQueryPrefix:!0}),W=wY({apiRoute:g,path:`/${s}${z}`,serverURL:b}),U=await fetch(W,{credentials:"include"});if(!U.ok)throw new Error("Failed to fetch items");let X=await U.json(),Q=y?.collectionSpecific?y.collectionSpecific.fieldName:void 0,J=(X.docs||[]).map(Y=>({id:Y.id,allowedCollections:Q?Y[Q]:void 0,hasChildren:!0,title:String(Y[m]||Y.id)})),oe=r&&r.length>0?J.filter(Y=>$l(Y.allowedCollections,r)):J;return{hasNextPage:X.hasNextPage||!1,items:oe,totalDocs:X.totalDocs||0}},[g,o,r,y,u,b,s,x,m]),F=Bg(async j=>{let k=_.findIndex(O=>O.parentId===j);if(k!==-1){I(O=>{let V=[...O];return V[k]={...V[k],isLoading:!0},V});try{let{hasNextPage:O,items:V,totalDocs:H}=await E({page:1,parentId:j});I(z=>{let W=[...z];return W[k]&&(W[k]={...W[k],hasNextPage:O,isLoading:!1,items:V,page:1,totalDocs:H}),W})}catch{I(O=>{let V=[...O];return V[k]&&(V[k]={...V[k],isLoading:!1}),V})}}},[_,E]);SY(d,()=>({refreshColumn:F}),[F]);let L=et(async j=>{let k=[null];j?.length&&k.push(...j),I(k.map(H=>({hasNextPage:!1,isLoading:!0,items:[],page:1,parentId:H,totalDocs:0}))),j?.length&&D(j);let O=await Promise.all(k.map(async(H,z)=>{try{let{hasNextPage:W,items:U,totalDocs:X}=await E({page:1,parentId:H}),Q;return z>0,{hasNextPage:W,isLoading:!1,items:U,page:1,parentId:H,parentTitle:Q,totalDocs:X}}catch{return{hasNextPage:!1,isLoading:!1,items:[],page:1,parentId:H,parentTitle:void 0,totalDocs:0}}})),V=O.map((H,z)=>{if(z===0||H.parentId===null)return H;let U=O[z-1]?.items.find(X=>X.id===H.parentId);return{...H,parentTitle:U?.title||String(H.parentId)}});I(V)});A6(()=>{a||P.current||(P.current=!0,L(i))},[i,a]),A6(()=>{R.current&&_.length>1&&R.current.scrollIntoView({behavior:"instant",inline:"start"})},[_.length]);let M=Bg(async({columnIndex:j,itemId:k})=>{let O=_[j];if(!O)return;let V=O.items.find(W=>W.id===k);if(!V)return;let H=[...A.slice(0,j),k];D(H);let z=_.slice(0,j+1);z.push({hasNextPage:!1,isLoading:!0,items:[],page:1,parentId:k,parentTitle:V.title,totalDocs:0}),I(z);try{let{hasNextPage:W,items:U,totalDocs:X}=await E({page:1,parentId:k});I(Q=>{let J=[...Q],oe=j+1;return J[oe]?.parentId===k&&(J[oe]={hasNextPage:W,isLoading:!1,items:U,page:1,parentId:k,parentTitle:V.title,totalDocs:X}),J})}catch{I(W=>{let U=[...W],X=j+1;return U[X]?.parentId===k&&(U[X]={hasNextPage:!1,isLoading:!1,items:[],page:1,parentId:k,parentTitle:V.title,totalDocs:0}),U})}},[_,A,E]),$=Bg(async({columnIndex:j})=>{let k=_[j];if(!k||k.isLoading||!k.hasNextPage)return;let O=k.page+1;I(V=>{let H=[...V];return H[j]={...H[j],isLoading:!0},H});try{let{hasNextPage:V,items:H}=await E({page:O,parentId:k.parentId});I(z=>{let W=[...z];return W[j]&&(W[j]={...W[j],hasNextPage:V,isLoading:!1,items:[...W[j].items,...H],page:O}),W})}catch{I(V=>{let H=[...V];return H[j]&&(H[j]={...H[j],isLoading:!1}),H})}},[_,E]),B=j=>{let k=[];for(let O=1;O<=j;O++){let V=_[O];V?.parentId!==null&&V?.parentId!==void 0&&k.push({id:V.parentId,title:V.parentTitle||String(V.parentId)})}return k};return vY("div",{className:Og,ref:T,children:[_.map((j,k)=>{let O=k===_.length-1&&!a,V=A[k]??null,H=B(k);return Mg("div",{className:`${Og}__column-wrapper`,ref:O?R:void 0,children:Mg(D6,{ancestorsWithSelections:e,canCreate:S&&!!l,collectionLabel:w,disabled:a,disabledIds:n,expandedId:V,filterByCollection:r,hasNextPage:j.hasNextPage,isLoading:j.isLoading,items:j.items,onCreateNew:l||(()=>{}),onExpand:({id:z})=>M({columnIndex:k,itemId:z}),onLoadMore:()=>$({columnIndex:k}),onSelect:c,parentId:j.parentId,parentTitle:j.parentTitle,pathToColumn:H,selectedIds:f,totalDocs:j.totalDocs})},`${j.parentId??"root"}-${k}`)}),a&&Mg("div",{className:`${Og}__column-wrapper ${Og}__column-wrapper--loading`,children:Mg(tn,{})})]})};import{formatAdminURL as _Y}from"payload/shared";import*as E6 from"qs-esm";var IY=20;async function L6({api:t,collectionSlug:e,itemId:o,parentFieldName:n,serverURL:r}){let s=E6.stringify({depth:IY,limit:1,select:{[n]:!0},where:{id:{equals:o}}},{addQueryPrefix:!0}),i=_Y({apiRoute:t,path:`/${e}${s}`,serverURL:r}),a=await fetch(i,{credentials:"include"});if(!a.ok)return[];let c=(await a.json()).docs?.[0];if(!c)return[];let u=[],d=c[n];for(;d!=null;){let f=typeof d=="object"?d.id:d;f!=null&&u.unshift(f),d=typeof d=="object"?d[n]:null}return u}var zn="hierarchy-drawer",PY=function({baseFilter:e,closeDrawer:o,columnBrowserRef:n,disabledIds:r,filterByCollection:s,hasMany:i=!1,hierarchyCollectionSlug:a,Icon:l,initialSelections:c,onCreateNew:u,onMoveToRoot:d,onSave:f,parentFieldName:m,ref:p,showMoveToRoot:h,useAsTitle:g}){let{i18n:b,t:v}=N(),{config:{routes:{api:C},serverURL:y},getEntityConfig:x}=G(),w=x({collectionSlug:a}),S=w?RY(w.labels?.plural||a,b):a,_=w?.hierarchy&&typeof w.hierarchy=="object"?w.hierarchy.parentFieldName:m,[I,A]=of(),[D,T]=of(!!c?.length),R=TY.useRef(!1),P=c?.[0],E=et(async H=>{if(!H){T(!1);return}try{let z=await L6({api:C,collectionSlug:a,itemId:H,parentFieldName:_,serverURL:y});A(z)}catch{}finally{T(!1)}});DY(()=>{R.current||(R.current=!0,E(P))},[P]);let[F,L]=of(()=>{let H=new Map;if(c)for(let z of c)H.set(z,{id:z,path:[]});return H}),M=Lx(()=>new Set(F.keys()),[F]),$=Lx(()=>new Set,[]),B=Tu(()=>{o()},[o]),j=Tu(()=>{f({closeDrawer:o,selections:F})},[f,F,o]),k=Tu(({id:H,path:z})=>{L(W=>{let U=new Map(W);return U.has(H)?U.delete(H):(i||U.clear(),U.set(H,{id:H,path:z})),U})},[i]),O=Tu(()=>{L(new Map)},[]);AY(p,()=>({selectItem:H=>{L(z=>{let W=new Map(z);return i||W.clear(),W.set(H,{id:H,path:[]}),W})}}),[i]);let V=F.size;return kl("div",{className:`${zn}__content`,children:[bn(_6,{onCancel:B,onSave:j,saveLabel:v("general:select"),title:v("general:selectValue",{label:S})}),kl("div",{className:`${zn}__subheader`,children:[kl("div",{className:`${zn}__subheader-left`,children:[l||bn(Ll,{}),bn("h4",{children:S})]}),kl("div",{className:`${zn}__subheader-right`,children:[h&&d&&bn("button",{className:`${zn}__move-to-root`,onClick:d,type:"button",children:v("hierarchy:moveToRoot")}),V>0&&kl(j6,{children:[kl("span",{className:`${zn}__selection-info`,children:[V," selected"]}),bn("span",{children:"\u2014"}),bn("button",{className:`${zn}__clear-all`,onClick:O,type:"button",children:v("general:clearAll")})]})]})]}),bn("div",{className:`${zn}__columns`,children:bn(N6,{ancestorsWithSelections:$,baseFilter:e,disabledIds:r,filterByCollection:s,hierarchyCollectionSlug:a,initialExpandedPath:I,isLoadingPath:D,onCreateNew:u,onSelect:k,parentFieldName:m,ref:n,selectedIds:M,useAsTitle:g})})]})},k6=t=>{let{drawerSlug:e,hierarchyCollectionSlug:o,parentFieldName:n}=t,{refreshTree:r}=No(),{getEntityConfig:s}=G(),i=s({collectionSlug:o}),a=i?.hierarchy&&typeof i.hierarchy=="object"?i.hierarchy.parentFieldName:n,[l,c]=of(null),u=$6(null),d=$6(null),[f,m]=of(0),p=`${e}-create-doc`,[h,,{closeDrawer:g,openDrawer:b}]=ro({collectionSlug:o,drawerSlug:p}),v=Tu(({parentId:x})=>{m(w=>w+1),c(x),setTimeout(()=>{b()},0)},[b]),C=Tu(({doc:x})=>{u.current&&l!==void 0&&u.current.refreshColumn(l),d.current&&x?.id&&d.current.selectItem(x.id),r(o),g()},[g,l,o,r]),y=Lx(()=>bn(PY,{...t,columnBrowserRef:u,onCreateNew:v,ref:d}),[v,t]);return kl(j6,{children:[bn(fn,{className:zn,closeOnBlur:!0,size:"large",slug:e,children:y}),bn(qy,{children:bn(h,{initialData:l!==null?{[a]:l}:void 0,onSave:C},f)})]})};var B6=({depth:t,uuid:e})=>`hierarchy-drawer_${t}_${e}`,O6=({children:t,className:e,disabled:o,drawerSlug:n,onClick:r,...s})=>M6(Jr,{className:[e,`${zn}__toggler`].filter(Boolean).join(" "),disabled:o,onClick:r,slug:n,...s,children:t}),fi=({disabledIds:t,filterByCollection:e,hierarchyCollectionSlug:o,Icon:n})=>{let{getEntityConfig:r}=G(),{allowedCollections:s,baseFilter:i}=No(),a=r({collectionSlug:o}),l=a?.admin?.useAsTitle,u=(a?.hierarchy&&typeof a.hierarchy=="object"?a.hierarchy:void 0)?.parentFieldName,d=Vg(()=>e!==void 0?e:s!==null?s.map(D=>D.slug):void 0,[e,s]),f=vt(),m=NY(),{closeModal:p,openModal:h,toggleModal:g}=ie(),b=B6({depth:f,uuid:m}),v=jx(p),C=jx(h),y=jx(g);v.current=p,C.current=h,y.current=g;let x=$x(()=>{y.current(b)},[b]),w=$x(()=>{v.current(b)},[b]),S=$x(()=>{C.current(b)},[b]),_=Vg(()=>T=>FY(k6,{...T,baseFilter:i,closeDrawer:w,disabledIds:t,drawerSlug:b,filterByCollection:d,hierarchyCollectionSlug:o,Icon:n,key:b,parentFieldName:u,useAsTitle:l}),[i,b,w,t,d,n,u,o,l]),I=Vg(()=>T=>M6(O6,{...T,drawerSlug:b}),[b]),A=Vg(()=>({closeDrawer:w,drawerDepth:f,drawerSlug:b,isDrawerOpen:!1,openDrawer:S,toggleDrawer:x}),[f,b,x,w,S]);return[_,I,A]};var H6="hierarchy-cell",z6=({cellData:t,collectionSlug:e,customCellProps:o,field:n,rowData:r})=>{let s="relationTo"in n?n.relationTo:void 0,i=n.hasMany??!1,{config:a,getEntityConfig:l}=G(),[c,u]=Js(),[d,f]=jY([]),{documents:m,getRelationships:p}=Km(),h=V6(!1),g=V6(void 0),{i18n:b,t:v}=N(),C=Lg?u?.boundingClientRect?.top<window.innerHeight:!1,y=typeof s=="string"?s:void 0,x=y?l({collectionSlug:y}):void 0,w=x?.hierarchy&&typeof x.hierarchy=="object"?x.hierarchy:void 0,S=o?.hierarchyIcon,_=o?.hierarchySmallIcon,I=Mx(()=>{if(S)return null;let $=w?.allowHasMany===!1?ef:Ll;return kx($,{})},[w,S]),A=S||I,D=_??A,[T,,{openDrawer:R}]=fi({hierarchyCollectionSlug:y||"",Icon:A});$Y(()=>{if(g.current!==t&&(g.current=t,h.current=!1),(t||typeof t=="number")&&C&&!h.current&&typeof s=="string"){let $=[];(Array.isArray(t)?t:[t]).forEach(j=>{typeof j=="object"&&"relationTo"in j&&"value"in j&&$.push(j),(typeof j=="number"||typeof j=="string")&&$.push({relationTo:s,value:j})}),p($),h.current=!0,f($)}},[t,s,C,p]);let P=Mx(()=>t?(Array.isArray(t)?t:[t]).map(B=>typeof B=="object"&&"value"in B?B.value:B):[],[t]),E=LY(async({closeDrawer:$,selections:B})=>{let j=Array.from(B.keys()),k=i?j:j[0]??null;try{if((await fetch(`${a.serverURL}${a.routes.api}/${e}/${r.id}`,{body:JSON.stringify({[n.name]:k}),credentials:"include",headers:{"Content-Type":"application/json"},method:"PATCH"})).ok&&typeof s=="string"){let V=j.map(H=>({relationTo:s,value:H}));f(V),V.length>0&&p(V)}}catch{}$()},[e,a,n.name,i,r,s,p]),F=Mx(()=>d.map(({relationTo:$,value:B})=>{let j=m[$]?.[B],k=l({collectionSlug:$});return Br({collectionConfig:k,data:j||null,dateFormat:a.admin.dateFormat,fallback:`${v("general:untitled")} - ID: ${B}`,i18n:b})}),[d,m,l,a.admin.dateFormat,v,b]),L=F.length>0?F.join(", "):v("general:none"),M=d.length>0&&d.some(({relationTo:$,value:B})=>m[$]?.[B]===null);return EY("div",{className:H6,ref:c,children:[kx(Z,{buttonStyle:"pill",className:`${H6}__pill`,icon:D,iconPosition:"left",margin:!1,onClick:R,size:"medium",children:M?`${v("general:loading")}...`:L}),y&&kx(T,{hasMany:i,initialSelections:P,onSave:E})]})};import{c as kY}from"react/compiler-runtime";import{jsx as MY}from"react/jsx-runtime";import{getTranslation as G6}from"@payloadcms/translations";import"react";var W6=t=>{let e=kY(2),{cellData:o,field:n}=t,{labels:r}=n,{i18n:s}=N(),i=o??[],a=i.length===1?`${i.length} ${G6(r?.singular||s.t("general:rows"),s)}`:`${i.length} ${G6(r?.plural||s.t("general:rows"),s)}`,l;return e[0]!==a?(l=MY("span",{children:a}),e[0]=a,e[1]=l):l=e[1],l};import{c as BY}from"react/compiler-runtime";import{jsx as OY}from"react/jsx-runtime";import{getTranslation as Hg}from"@payloadcms/translations";import"react";var U6=t=>{let e=BY(2),{cellData:o,field:n}=t,{blocks:r,labels:s}=n,{i18n:i}=N(),{config:a}=G(),l=Array.isArray(o)?o.map(VY):[],c=r.map(m=>{let p=typeof m=="string"?a.blocksMap[m]:m;return{slug:p.slug,label:Hg(p.labels.singular,i)}}),u=`0 ${Hg(s?.plural,i)}`,d=m=>m.map(p=>c.filter(g=>g.slug===p)?.[0]?.label).join(", ");if(l.length>5){let m=l.length-5;u=`${l.length} ${Hg(s?.plural,i)} - ${i.t("fields:itemsAndMore",{count:m,items:d(l.slice(0,5))})}`}else l.length>0&&(u=`${l.length} ${Hg(l.length===1?s?.singular:s?.plural,i)} - ${d(l)}`);let f;return e[0]!==u?(f=OY("span",{children:u}),e[0]=u,e[1]=f):f=e[1],f};function VY(t){let{blockType:e}=t;return e}import{c as HY}from"react/compiler-runtime";import{jsx as X6}from"react/jsx-runtime";import"react";var Z6=t=>{let e=HY(3),{cellData:o}=t,{t:n}=N(),r=`general:${o}`,s;return e[0]!==n||e[1]!==r?(s=X6("code",{className:"bool-cell",children:X6("span",{children:n(r).toLowerCase()})}),e[0]=n,e[1]=r,e[2]=s):s=e[2],s};import{jsx as zY}from"react/jsx-runtime";import{getObjectDotNotation as GY}from"payload/shared";import"react";var Bx=t=>{let{cellData:e,field:o,rowData:n}=t,{name:r,accessor:s,admin:i,timezone:a}=o,{date:l}=i===void 0?{}:i,{config:c}=G(),{admin:u}=c,{dateFormat:d}=u,{i18n:f}=N(),p=`${s||r}_tz`,h=a&&n?GY(n,p,void 0):void 0,g=l?.displayFormat||d;return zY("span",{children:!!e&&lo({date:e,i18n:f,pattern:g,timezone:h})})};import{jsx as Ox,jsxs as UY,Fragment as XY}from"react/jsx-runtime";import{getBestFitFromSizes as ZY,isImage as YY}from"payload/shared";import"react";import{jsx as Du,jsxs as J6}from"react/jsx-runtime";import Au from"react";import{jsx as Y6,jsxs as WY}from"react/jsx-runtime";import"react";var zg=()=>WY("svg",{height:"150",style:{backgroundColor:"#333333"},viewBox:"0 0 150 150",width:"150",xmlns:"http://www.w3.org/2000/svg",children:[Y6("path",{d:"M82.8876 50.5H55.5555V100.5H94.4444V61.9818H82.8876V50.5Z",fill:"white"}),Y6("path",{d:"M82.8876 61.9818H94.4444L82.8876 50.5V61.9818Z",fill:"#9A9A9A"})]});function Ml(t,e){if(!e)return t;let o=t.includes("?")?"&":"?";return`${t}${o}${encodeURIComponent(e)}`}var Gg="thumbnail",on=t=>{let{className:e="",doc:{filename:o}={},fileSrc:n,height:r,imageCacheTag:s,size:i,width:a}=t,[l,c]=Au.useState(void 0),u=[Gg,`${Gg}--size-${i||"medium"}`,e].join(" "),d=Au.useMemo(()=>n?Ml(n,s):null,[n,s]);return Au.useEffect(()=>{if(!d){c(!1);return}c(void 0);let f=new Image;f.src=d,f.onload=()=>{c(!0)},f.onerror=()=>{c(!1)}},[d]),J6("div",{className:u,children:[l===void 0&&Du(Ct,{height:"100%"}),l&&Du("img",{alt:o,height:r,src:d,width:a}),l===!1&&Du(zg,{})]})};function q6(t){let{alt:e,className:o="",filename:n,fileSrc:r,imageCacheTag:s,size:i}=t,[a,l]=Au.useState(void 0),c=[Gg,`${Gg}--size-${i||"medium"}`,o].join(" "),u=Au.useMemo(()=>r?Ml(r,s):null,[r,s]);return Au.useEffect(()=>{if(!u){l(!1);return}l(void 0);let d=new Image;d.src=u,d.onload=()=>{l(!0)},d.onerror=()=>{l(!1)}},[u]),J6("div",{className:c,children:[a===void 0&&Du(Ct,{height:"100%"}),a&&Du("img",{alt:e||n,src:u}),a===!1&&Du(zg,{})]})}var Vx="file",Wg=({cellData:t,collectionConfig:e,field:o,rowData:n})=>{if(("displayPreview"in o?o.displayPreview:void 0)??e.upload?.displayPreview??!0){let i=YY(n?.mimeType),a=i?n?.thumbnailURL||n?.url:n?.thumbnailURL;i&&(a=ZY({sizes:n?.sizes,thumbnailURL:n?.thumbnailURL,url:n?.url,width:n?.width}));let l=e?.upload,c=l?.cacheTags&&n?.updatedAt;return UY("div",{className:Vx,children:[Ox(on,{className:`${Vx}__thumbnail`,collectionSlug:e?.slug,doc:{...n,filename:t},fileSrc:a,imageCacheTag:c,size:"small",uploadConfig:l}),Ox("span",{className:`${Vx}__filename`,children:String(t)})]})}else return Ox(XY,{children:String(t)})};import{c as JY}from"react/compiler-runtime";import{jsx as Ug}from"react/jsx-runtime";import"react";function Q6(t,e){let o=JSON.stringify(t);return o.length/e>1.5?`${o.substring(0,e)}\u2026`:o}var K6=t=>{let e=JY(4),{cellData:o}=t,{t:n}=N();try{let r;if(e[0]!==o){let s=Q6(o,100);r=Ug("code",{className:"json-cell",children:Ug("span",{children:s})}),e[0]=o,e[1]=r}else r=e[1];return r}catch{let s;return e[2]!==n?(s=Ug("code",{className:"json-cell",children:Ug("span",{children:n("general:error")})}),e[2]=n,e[3]=s):s=e[3],s}};import{c as qY}from"react/compiler-runtime";import{jsx as QY,jsxs as eP}from"react/jsx-runtime";import{getTranslation as KY}from"@payloadcms/translations";import eJ,{useEffect as tP,useState as oP}from"react";var tJ="relationship-cell",Xg=3,Zg=t=>{let e=qY(39),{cellData:o,customCellProps:n,field:r,field:s}=t,{label:i}=s,a="relationTo"in r&&r.relationTo||"collection"in r&&r.collection,l="collection"in r?o?.docs:o,{config:c,getEntityConfig:u}=G(),{collections:d}=c,[f,m]=Js(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[0]=p):p=e[0];let[h,g]=oP(p),{documents:b,getRelationships:v}=Km(),[C,y]=oP(!1),{i18n:x,t:w}=N(),S=Lg?m?.boundingClientRect?.top<window.innerHeight:!1,_;e[1]!==l||e[2]!==v||e[3]!==C||e[4]!==S||e[5]!==a?(_=()=>{if((l||typeof l=="number")&&S&&!C){let R=[],P=Array.isArray(l)?l:[l];P.slice(0,P.length<Xg?P.length:Xg).forEach(E=>{typeof E=="object"&&"relationTo"in E&&"value"in E&&R.push(E),(typeof E=="number"||typeof E=="string")&&typeof a=="string"&&R.push({relationTo:a,value:E})}),v(R),y(!0),g(R)}},e[1]=l,e[2]=v,e[3]=C,e[4]=S,e[5]=a,e[6]=_):_=e[6];let I;e[7]!==l||e[8]!==d||e[9]!==v||e[10]!==C||e[11]!==S||e[12]!==a?(I=[l,a,d,S,C,v],e[7]=l,e[8]=d,e[9]=v,e[10]=C,e[11]=S,e[12]=a,e[13]=I):I=e[13],tP(_,I);let A;e[14]!==C?(A=()=>{C&&y(!1)},e[14]=C,e[15]=A):A=e[15];let D;e[16]!==l?(D=[l],e[16]=l,e[17]=D):D=e[17],tP(A,D);let T;if(e[18]!==l||e[19]!==c.admin||e[20]!==n||e[21]!==b||e[22]!==r||e[23]!==u||e[24]!==x||e[25]!==f||e[26]!==i||e[27]!==w||e[28]!==h){let R;e[30]!==c.admin||e[31]!==n||e[32]!==b||e[33]!==r||e[34]!==u||e[35]!==x||e[36]!==w||e[37]!==h.length?(R=(P,E)=>{let{relationTo:F,value:L}=P,M=b[F][L],$=u({collectionSlug:F}),B=Br({collectionConfig:$,data:M||null,dateFormat:c.admin.dateFormat,fallback:`${w("general:untitled")} - ID: ${L}`,i18n:x}),j=null;return r.type==="upload"&&(("displayPreview"in r?r.displayPreview:void 0)??$.upload?.displayPreview??!0)&&M&&(j=QY(Wg,{cellData:B,collectionConfig:$,collectionSlug:$.slug,customCellProps:n,field:r,rowData:M})),eP(eJ.Fragment,{children:[M===!1&&`${w("general:untitled")} - ID: ${L}`,M===null&&`${w("general:loading")}...`,M?j||B:null,h.length>E+1&&", "]},E)},e[30]=c.admin,e[31]=n,e[32]=b,e[33]=r,e[34]=u,e[35]=x,e[36]=w,e[37]=h.length,e[38]=R):R=e[38],T=eP("div",{className:tJ,ref:f,children:[h.map(R),Array.isArray(l)&&l.length>Xg&&w("fields:itemsAndMore",{count:l.length-Xg,items:""}),h.length===0&&w("general:noLabel",{label:KY(i||"",x)})]}),e[18]=l,e[19]=c.admin,e[20]=n,e[21]=b,e[22]=r,e[23]=u,e[24]=x,e[25]=f,e[26]=i,e[27]=w,e[28]=h,e[29]=T}else T=e[29];return T};import{c as oJ}from"react/compiler-runtime";import{jsx as rJ}from"react/jsx-runtime";import{getTranslation as nJ}from"@payloadcms/translations";import{optionsAreObjects as sJ}from"payload/shared";import"react";var Hx=t=>{let e=oJ(7),{cellData:o,field:n}=t,{options:r}=n,{i18n:s}=N(),i;e[0]!==s||e[1]!==r?(i=c=>c.map(u=>{let d=r.filter(f=>f.value===u)?.[0]?.label;return nJ(d,s)}).join(", "),e[0]=s,e[1]=r,e[2]=i):i=e[2];let a=i,l;if(e[3]!==o||e[4]!==a||e[5]!==r){let c;sJ(r)?c=Array.isArray(o)?a(o):a([o]):c=Array.isArray(o)?o.join(", "):o,l=rJ("span",{children:c}),e[3]=o,e[4]=a,e[5]=r,e[6]=l}else l=e[6];return l};import{c as iJ}from"react/compiler-runtime";import{jsx as rP}from"react/jsx-runtime";import{getTranslation as aJ}from"@payloadcms/translations";import{optionsAreObjects as lJ}from"payload/shared";import"react";var zx="status-cell",Yg=t=>{let e=iJ(6),{cellData:o,field:n}=t,{options:r}=n,{i18n:s}=N(),i;e[0]!==s||e[1]!==r?(i=u=>{if(lJ(r)){let d=r.find(f=>f.value===u);return d?aJ(d.label,s):u}return u},e[0]=s,e[1]=r,e[2]=i):i=e[2];let a=i;if(!o)return null;let l=Array.isArray(o)?o[0]:o,c;if(e[3]!==a||e[4]!==l){let u=a(l),d="draft";l==="published"?d="published":l==="changed"?d="changed":l==="previouslyPublished"&&(d="previously-published"),c=rP("span",{className:`${zx} ${zx}--${d}`,children:rP("span",{className:`${zx}__label`,children:u})}),e[3]=a,e[4]=l,e[5]=c}else c=e[5];return c};import{jsx as cJ}from"react/jsx-runtime";import"react";var nP=({cellData:t})=>{let e=t?.length>100?`${t.substring(0,100)}\u2026`:t;return cJ("span",{children:e})};var Gx={array:W6,blocks:U6,checkbox:Z6,code:Eg,date:Bx,File:Wg,join:Zg,json:K6,radio:Hx,relationship:Zg,select:Hx,status:Yg,textarea:nP,upload:Zg};var rf=t=>{let e=uJ(16),{cellData:o,className:n,collectionSlug:r,field:s,field:i,link:a,linkURL:l,onClick:c,rowData:u,viewType:d}=t,{admin:f}=i,{i18n:m}=N(),{config:p,getEntityConfig:h}=G(),{routes:g}=p,{admin:b}=g,v,C;if(e[0]!==f||e[1]!==b||e[2]!==o||e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==h||e[7]!==m||e[8]!==a||e[9]!==l||e[10]!==c||e[11]!==t||e[12]!==u||e[13]!==d){C=Symbol.for("react.early_return_sentinel");e:{let y=h({collectionSlug:r}),x=f&&"className"in f?f.className:void 0,w=n||(s.admin&&"className"in s.admin?s.admin.className:null)||x,S=c,_="span",I={className:w};if(a&&(I.prefetch=!1,_=jt,l?I.href=l:I.href=y?.slug?hJ({adminRoute:b,path:`/collections/${y?.slug}${d==="trash"?"/trash":""}/${encodeURIComponent(u.id)}`}):""),typeof S=="function"&&(_="button",I.type="button",I.onClick=()=>{S({cellData:o,collectionSlug:y?.slug,rowData:u})}),pJ(s)){C=pi(_,{...I,children:pi(Eg,{cellData:`ID: ${o}`,collectionConfig:y,collectionSlug:r,field:{...s,type:"code"},nowrap:!0,rowData:u})});break e}let A=p6(o,s,m);if(s.type==="relationship"&&(()=>{let P="relationTo"in s?s.relationTo:void 0;return typeof P!="string"?!1:!!h({collectionSlug:P})?.hierarchy})()&&s.type==="relationship"){C=pi(z6,{cellData:o,rowData:u,...t,field:s});break e}if(s.type==="select"&&"name"in s&&s.name==="_status"){C=pi(_,{...I,children:pi(Yg,{cellData:o,rowData:u,...t,field:s})});break e}let T=typeof o<"u"&&Gx[s.type],R=null;if(Ng(A))R=A;else if(T)R=pi(T,{cellData:o,rowData:u,...t});else if(!T)if(y?.upload&&fJ(s)&&s.name==="filename"&&s.type==="text"){let P=Gx.File;R=pi(P,{cellData:o,rowData:u,...t,collectionConfig:y,field:s})}else{C=dJ(_,{...I,children:[(A===""||typeof A>"u"||A===null)&&m.t("general:noLabel",{label:mJ(("label"in s?s.label:null)||"data",m)}),typeof A=="string"&&A,typeof A=="number"&&A,typeof A=="object"&&A!==null&&JSON.stringify(A)]});break e}if((s.type==="select"||s.type==="radio")&&s.options.length&&o){let P=Array.isArray(o)?o.map(gJ).join(" "):`selected--${o}`,E=[I.className,P].filter(Boolean).join(" ");C=pi(_,{...I,className:E,children:R});break e}v=pi(_,{...I,children:R})}e[0]=f,e[1]=b,e[2]=o,e[3]=n,e[4]=r,e[5]=s,e[6]=h,e[7]=m,e[8]=a,e[9]=l,e[10]=c,e[11]=t,e[12]=u,e[13]=d,e[14]=v,e[15]=C}else v=e[14],C=e[15];return C!==Symbol.for("react.early_return_sentinel")?C:v};function gJ(t){return`selected--${t}`}var vJ="default-cell",aP=iP.createContext(null),Wx=()=>iP.use(aP),yJ=t=>{let e=bJ(9),{clientProps:o,columnIndex:n,isLinkedColumn:r}=t,{drawerSlug:s,onSelect:i}=Sr(),{LinkedCellOverride:a}=xu(),l;if(e[0]!==a||e[1]!==o||e[2]!==n||e[3]!==s||e[4]!==r||e[5]!==i){let c={...o,columnIndex:n};if(r&&s&&o.link!==!1){c.className=`${vJ}__first-cell`,c.link=!1;let u;e[7]!==i?(u=d=>{let{collectionSlug:f,rowData:m}=d;typeof i=="function"&&i({collectionSlug:f,doc:m,docID:m.id})},e[7]=i,e[8]=u):u=e[8],c.onClick=u}l=sP(aP,{value:c,children:r&&a?a:sP(rf,{...c})}),e[0]=a,e[1]=o,e[2]=n,e[3]=s,e[4]=r,e[5]=i,e[6]=l}else l=e[6];return l};var lP=t=>{let e=CJ(7),{onDrawerOpen:o}=t,n=Wx(),{t:r}=N(),s;if(e[0]!==n||e[1]!==o||e[2]!==r){let i;e[4]!==n||e[5]!==o?(i=()=>{o(n.rowData.id,n.collectionSlug)},e[4]=n,e[5]=o,e[6]=i):i=e[6],s=xJ("div",{className:"drawer-link",children:[Ux(rf,{...n,className:"drawer-link__cell",link:!1,onClick:null}),Ux("button",{"aria-label":r("general:edit"),className:"drawer-link__doc-drawer-toggler",onClick:i,type:"button",children:Ux(nl,{})})]}),e[0]=n,e[1]=o,e[2]=r,e[3]=s}else s=e[3];return s};import{c as wJ}from"react/compiler-runtime";import{jsx as cP,jsxs as Xx}from"react/jsx-runtime";import"react";var nf="relationship-table-pagination",uP=()=>{let t=wJ(18),{data:e,handlePageChange:o}=bt(),{t:n}=N(),{hasNextPage:r,hasPrevPage:s,limit:i,nextPage:a,page:l,prevPage:c,totalDocs:u,totalPages:d}=e;if(!d||d<=1||!u||!l||!i)return null;let f=(l-1)*i+1,m=Math.min(l*i,u),p=!s,h;t[0]!==o||t[1]!==c?(h=()=>{o(c||1)},t[0]=o,t[1]=c,t[2]=h):h=t[2];let g;if(t[3]!==m||t[4]!==f||t[5]!==o||t[6]!==r||t[7]!==a||t[8]!==l||t[9]!==n||t[10]!==p||t[11]!==h||t[12]!==u){let b;t[14]!==o||t[15]!==a||t[16]!==l?(b=()=>{o(a||l+1)},t[14]=o,t[15]=a,t[16]=l,t[17]=b):b=t[17],g=Xx("div",{className:nf,children:[Xx("div",{className:`${nf}__nav`,children:[cP("button",{className:`${nf}__button`,disabled:p,onClick:h,type:"button",children:n("general:previous")}),cP("button",{className:`${nf}__button`,disabled:!r,onClick:b,type:"button",children:n("general:next")})]}),Xx("div",{className:`${nf}__count`,children:[f," \u2013 ",m," ",n("general:of")," ",u]})]}),t[3]=m,t[4]=f,t[5]=o,t[6]=r,t[7]=a,t[8]=l,t[9]=n,t[10]=p,t[11]=h,t[12]=u,t[13]=g}else g=t[13];return g};var Ss="relationship-table",Yx=t=>{let{AfterInput:e,allowCreate:o=!0,BeforeInput:n,disableTable:r=!1,field:s,fieldPath:i,filterOptions:a,initialData:l,initialDrawerData:c,Label:u,parent:d,relationTo:f}=t,[m,p]=va(null),{config:h,getEntityConfig:g}=G(),{i18n:b,t:v}=N(),[C,y]=va(),[x]=va(()=>g({collectionSlug:f})),w=Array.isArray(f),[S,_]=va(w?void 0:f),{permissions:I}=ye(),A=IJ(!1),[D,T]=va(void 0),[R,,{closeDrawer:P,isDrawerOpen:E,openDrawer:F}]=ro({id:D,collectionSlug:S}),[L,M]=va(!r),[$,B]=va(()=>l?{...l,docs:Array.isArray(l.docs)?l.docs.reduce((Y,K)=>typeof K=="string"||typeof K=="number"?[...Y,{id:K}]:[...Y,K],[]):[]}:void 0),[j,k]=va(),{getTableState:O}=ct(),V=Jg(async Y=>{let K={limit:s?.defaultLimit||x?.admin?.pagination?.defaultLimit,sort:s.defaultSort||x?.defaultSort,...C||{},where:{...C?.where||{}}};a&&(K.where=SJ(K.where,a));let ee=s.admin?.defaultColumns?s.admin.defaultColumns.map(Ae=>({accessor:Ae,active:!0})):void 0,te=typeof s.admin?.disableRowTypes=="boolean"?!s.admin.disableRowTypes:Array.isArray(f),{data:re,state:me,Table:we}=await O({collectionSlug:f,columns:mP(C?.columns)||ee,data:Y,enableRowSelections:!1,orderableFieldName:!s.orderable||Array.isArray(s.collection)?void 0:`_${s.collection}_${s.name}_order`,parent:d,query:K,renderRowTypes:te,tableAppearance:"condensed"});B(re),p(we),k(me),M(!1)},[s.defaultLimit,s.defaultSort,s.admin?.defaultColumns,s.admin?.disableRowTypes,s.collection,s.name,s.orderable,x?.admin?.pagination?.defaultLimit,x?.defaultSort,C,a,O,f,d]),H=et((Y,K)=>{!K&&(!m||Y)&&V()});sf(()=>{H(C,r)},[C,r]);let z=Jg(({doc:Y,operation:K})=>{K==="create"&&P();let ee=$?.docs?.findIndex(re=>re.id===Y.id),te={docs:[]};if(ee!==-1){let re=[...$.docs];re[ee]=Y,te.docs=re}else te.docs=[Y,...$.docs];V(te)},[$?.docs,V,P]),W=Jg(Y=>{let K=$.docs.filter(ee=>ee.id!==Y.id);V({...$,docs:K}),T(void 0)},[$,V]),U=Jg((Y,K)=>{A.current=!0,T(Y||void 0),_(K||void 0)},[]);sf(()=>{A.current&&(A.current=!1,F())},[F]),sf(()=>{E||T(void 0)},[E]);let X=o!==!1&&I?.collections?.[w?f[0]:f]?.create;sf(()=>{w&&S&&F()},[S,F,w]),sf(()=>{w&&!E&&S&&_(void 0)},[E]);let Q=_J.useMemo(()=>({columns:mP(j)?.map(({accessor:Y})=>Y),limit:s.defaultLimit??x?.admin?.pagination?.defaultLimit,sort:s.defaultSort??x?.defaultSort}),[j,s,x]),J=vn(Ax,{allowCreate:o!==!1,baseClass:Ss,buttonStyle:"ghost",className:`${Ss}__add-new${w?"-polymorphic":""}`,collections:h.collections,i18n:b,label:b.t("fields:addNew"),onClick:w?_:F,permissions:I,relationTo:f}),oe=vn(Pg,{collectionSlug:x?.slug});return hi("div",{className:Ss,children:[L?hi(Zx,{children:[hi("div",{className:`${Ss}__header`,children:[u,vn("div",{className:`${Ss}__actions`,children:J})]}),n,vn("p",{children:v("general:loading")})]}):hi(Zx,{children:[$?.docs&&$.docs.length===0&&hi(Zx,{children:[hi("div",{className:`${Ss}__header`,children:[u,vn("div",{className:`${Ss}__actions`,children:J})]}),n,vn(El,{Actions:X?[vn(Ax,{allowCreate:X,baseClass:Ss,collections:h.collections,i18n:b,label:b.t("general:createNewLabel",{label:w?b.t("general:document"):dP(x?.labels?.singular,b)}),onClick:w?_:F,permissions:I,relationTo:f},"create")]:[],description:b.t("general:noResults",{label:w?b.t("general:documents"):dP(x?.labels?.plural,b)}),title:b.t("general:noResultsFound")})]}),$?.docs&&$.docs.length>0&&vn(Qm,{children:vn(hx,{data:$,modifySearchParams:!1,onQueryChange:y,orderableFieldName:!s.orderable||Array.isArray(s.collection)?void 0:`_${s.collection}_${i.replaceAll(".","_")}_order`,query:Q,children:hi(Xm,{collectionSlug:w?f[0]:f,columnState:j,LinkedCellOverride:vn(lP,{currentDrawerID:D,onDrawerOpen:U}),children:[hi("div",{className:`${Ss}__header`,children:[u,hi("div",{className:`${Ss}__actions`,children:[J,oe]})]}),n,m,vn(uP,{})]})})})]}),e,vn(R,{initialData:c,onDelete:W,onSave:z})]})};var hP="default"in qg.default?qg.default.default:qg.default,Qg=({collectionSlug:t,config:e,docID:o,fields:n,segments:r})=>{let s=TJ(n,{keepPresentationalFields:!0}),i=r[0],a=s.find(c=>c.name===i);if(!a)return null;if(a.type==="relationship"||a.type==="upload"){let c=o;return Array.isArray(a.relationTo)&&(c={relationTo:t,value:o}),{[a.name]:a.hasMany?[c]:c}}let l=r.slice(1,r.length);if(a.type==="tab"||a.type==="group"&&RJ(a))return{[a.name]:Qg({collectionSlug:t,config:e,docID:o,fields:a.fields,segments:l})};if(a.type==="array"){let c=Qg({collectionSlug:t,config:e,docID:o,fields:a.fields,segments:l});return c.id=hP().toHexString(),{[a.name]:[c]}}if(a.type==="blocks")for(let c of a.blocks){let u=typeof c=="string"?e.blocksMap[c]:c,d=Qg({collectionSlug:t,config:e,docID:o,fields:u.fields,segments:l});if(d)return d.id=hP().toHexString(),d.blockType=u.slug,{[a.name]:[d]}}},DJ=t=>{let{field:e,field:{admin:{allowCreate:o,description:n}={},collection:r,label:s,localized:i,on:a,required:l},path:c}=t,{id:u,docConfig:d}=be(),{config:f,getEntityConfig:m}=G(),{i18n:p}=N(),{customComponents:{AfterInput:h,BeforeInput:g,Description:b,Label:v}={},errorPaths:C,path:y,showError:x,value:w}=Ne({potentiallyStalePath:c}),S=C?.length||(x?1:0),_=S>0,I=pP(()=>{if(!u)return null;let D=u;Array.isArray(e.targetField.relationTo)&&(D={relationTo:d.slug,value:D});let T=Array.isArray(r)?{}:{[a]:{equals:D}};return e.where?{and:[T,e.where]}:T},[u,r,e.targetField.relationTo,e.where,a,d?.slug]),A=pP(()=>{let D=m({collectionSlug:Array.isArray(e.collection)?e.collection[0]:e.collection});return Qg({collectionSlug:d?.slug,config:f,docID:u,fields:D?.fields,segments:e.on.split(".")})},[m,e.collection,e.on,d?.slug,u,f]);return d?fP("div",{className:[Ee,_&&"error","join"].filter(Boolean).join(" "),id:`field-${y?.replace(/\./g,"__")}`,children:[Pu(Yx,{AfterInput:h,allowCreate:typeof u<"u"&&o,BeforeInput:g,disableTable:I===null,field:e,fieldPath:y,filterOptions:I,initialData:u&&w?w:{docs:[]},initialDrawerData:A,Label:fP("div",{className:"join__header-wrapper",children:[Pu("h4",{children:v||Pu(Fe,{label:s,localized:i,path:y,required:l})}),_&&Pu(yo,{count:S,i18n:p,withMessage:!0})]}),parent:typeof u<"u"?{id:u,collectionSlug:d.slug,joinPath:y}:void 0,relationTo:r}),Pu(le,{CustomComponent:b,Fallback:Pu(Xe,{description:n,path:y})})]}):null},af=Je(DJ);import{jsx as Bl,jsxs as gP}from"react/jsx-runtime";import bP,{useCallback as Kg,useEffect as AJ,useMemo as PJ,useState as vP}from"react";var FJ="json-field",NJ=t=>{let{field:e,field:{admin:{className:o,description:n,editorOptions:r,maxHeight:s}={},jsonSchema:i,label:a,localized:l,required:c},path:u,readOnly:d,validate:f}=t,{insertSpaces:m=Jv.insertSpaces,tabSize:p=Jv.tabSize}=r||{},h=Kg(j=>{if(j!==void 0)return j===null?"":m?JSON.stringify(j,null,p):JSON.stringify(j,null," ")},[p,m]),[g,b]=vP(),v=bP.useRef("formState"),[C,y]=vP(Date.now()),x=Kg((j,k)=>{if(typeof f=="function")return f(j,{...k,jsonError:g,required:c})},[f,c,g]),{customComponents:{AfterInput:w,BeforeInput:S,Description:_,Error:I,Label:A}={},disabled:D,initialValue:T,path:R,setValue:P,showError:E,value:F}=Ne({potentiallyStalePath:u,validate:x}),L=bP.useRef(h(F??T)),M=Kg((j,k)=>{if(!i)return;k.languages.json.jsonDefaults.setDiagnosticsOptions({enableSchemaRequest:!0,schemas:[...k.languages.json.jsonDefaults.diagnosticsOptions.schemas||[],i],validate:!0});let O=i.uri,V=O.includes("?")?`${O}&${crypto.randomUUID?crypto.randomUUID():Qr()}`:`${O}?${crypto.randomUUID?crypto.randomUUID():Qr()}`;j.setModel(k.editor.createModel(h(F)||"","json",k.Uri.parse(V)))},[i,h,F]),$=Kg(j=>{if(!(d||D)){v.current="internalEditor";try{P(j?JSON.parse(j):null),L.current=j,b(void 0)}catch(k){P(j||null),L.current=j,b(k)}}},[d,D,P]);AJ(()=>{if(v.current==="formState"){let j=h(F??T);j!==L.current&&(L.current=j,y(Date.now()))}v.current="formState"},[T,R,h,F]);let B=PJ(()=>st(e),[e]);return gP("div",{className:[Ee,FJ,o,E&&"error",(d||D)&&"read-only"].filter(Boolean).join(" "),style:B,children:[Bl(le,{CustomComponent:A,Fallback:Bl(Fe,{label:a,localized:l,path:R,required:c})}),gP("div",{className:`${Ee}__wrap`,children:[Bl(le,{CustomComponent:I,Fallback:Bl(tt,{message:g,path:R,showError:E})}),S,Bl(wl,{defaultLanguage:"json",maxHeight:s,onChange:$,onMount:M,options:r,readOnly:d||D,recalculatedHeightAt:C,value:L.current,wrapperProps:{id:`field-${R?.replace(/\./g,"__")}`}}),w]}),Bl(le,{CustomComponent:_,Fallback:Bl(Xe,{description:n,path:R})})]})},lf=Je(NJ);import{jsx as OJ}from"react/jsx-runtime";import{useCallback as t0,useEffect as VJ,useMemo as HJ,useState as zJ}from"react";import{c as jJ}from"react/compiler-runtime";import{jsx as gi,jsxs as Jx}from"react/jsx-runtime";import{getTranslation as yP}from"@payloadcms/translations";import{isNumber as kJ}from"payload/shared";import"react";import{c as EJ}from"react/compiler-runtime";import{jsx as e0,jsxs as LJ}from"react/jsx-runtime";import"react";var $J="input-stepper",ya=t=>{let e=EJ(5),{disabled:o,onDecrement:n,onIncrement:r}=t,{t:s}=N(),i;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s?(i=LJ("div",{className:$J,children:[e0("button",{"aria-label":s("general:increment"),disabled:o,onClick:r,tabIndex:-1,type:"button",children:e0(ve,{direction:"up",size:16})}),e0("button",{"aria-label":s("general:decrement"),disabled:o,onClick:n,tabIndex:-1,type:"button",children:e0(ve,{direction:"down",size:16})})]}),e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=i):i=e[4],i};var MJ="number",CP=t=>{let e=jJ(32),{AfterInput:o,BeforeInput:n,className:r,Description:s,description:i,Error:a,hasMany:l,Label:c,label:u,localized:d,max:f,maxRows:m,min:p,onChange:h,onStep:g,path:b,placeholder:v,readOnly:C,required:y,showError:x,step:w,style:S,value:_,valueToRender:I}=t,A=f===void 0?1/0:f,D=m===void 0?1/0:m,T=p===void 0?-1/0:p,R=w===void 0?1:w,{i18n:P,t:E}=N(),F;if(e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==a||e[4]!==c||e[5]!==r||e[6]!==i||e[7]!==l||e[8]!==P||e[9]!==u||e[10]!==d||e[11]!==A||e[12]!==D||e[13]!==T||e[14]!==h||e[15]!==g||e[16]!==b||e[17]!==v||e[18]!==C||e[19]!==y||e[20]!==x||e[21]!==R||e[22]!==S||e[23]!==E||e[24]!==_||e[25]!==I){let L=yP(v,P)||(l?E("general:enterANumber"):void 0),M=x&&"error",$=C&&"read-only",B=l&&"has-many",j;e[27]!==r||e[28]!==M||e[29]!==$||e[30]!==B?(j=[Ee,MJ,r,M,$,B].filter(Boolean),e[27]=r,e[28]=M,e[29]=$,e[30]=B,e[31]=j):j=e[31],F=Jx("div",{className:j.join(" "),style:S,children:[gi(le,{CustomComponent:c,Fallback:gi(Fe,{label:u,localized:d,path:b,required:y})}),Jx("div",{className:`${Ee}__wrap`,children:[gi(le,{CustomComponent:a,Fallback:gi(tt,{path:b,showError:x})}),n,l?gi(mt,{className:`field-${b.replace(/\./g,"__")}`,components:{DropdownIndicator:null},disabled:C,filterOption:(k,O)=>{let V=Array.isArray(_)&&_.length>=D;return kJ(O)&&!V},isClearable:!0,isCreatable:!0,isMulti:!0,isSortable:!0,noOptionsMessage:()=>Array.isArray(_)&&_.length>=D?E("validation:limitReached",{max:D,value:_.length+1}):null,onChange:h,options:[],placeholder:L,showError:x,value:I}):Jx("div",{className:"form-input-group",children:[gi("input",{"aria-label":yP(u,P)||b,className:"form-input",disabled:C,id:`field-${b.replace(/\./g,"__")}`,max:A,min:T,name:b,onChange:h,onWheel:BJ,placeholder:L,step:R,type:"number",value:typeof _=="number"?_:""}),g&&gi(ya,{disabled:C,onDecrement:()=>g("down"),onIncrement:()=>g("up")})]}),o,gi(le,{CustomComponent:s,Fallback:gi(Xe,{description:i,path:b})})]})]}),e[0]=o,e[1]=n,e[2]=s,e[3]=a,e[4]=c,e[5]=r,e[6]=i,e[7]=l,e[8]=P,e[9]=u,e[10]=d,e[11]=A,e[12]=D,e[13]=T,e[14]=h,e[15]=g,e[16]=b,e[17]=v,e[18]=C,e[19]=y,e[20]=x,e[21]=R,e[22]=S,e[23]=E,e[24]=_,e[25]=I,e[26]=F}else F=e[26];return F};function BJ(t){t.target.blur()}var GJ=t=>{let{field:e,field:{admin:{className:o,description:n,placeholder:r,step:s=1}={},hasMany:i=!1,label:a,localized:l,max:c=1/0,maxRows:u=1/0,min:d=-1/0,required:f},onChange:m,path:p,readOnly:h,validate:g}=t,b=t0((M,$)=>{if(typeof g=="function")return g(M,{...$,max:c,min:d,required:f})},[g,d,c,f]),{customComponents:{AfterInput:v,BeforeInput:C,Description:y,Error:x,Label:w}={},disabled:S,path:_,setValue:I,showError:A,value:D}=Ne({potentiallyStalePath:p,validate:b}),T=t0(M=>{let $=parseFloat(M.target.value),B=$;Number.isNaN($)&&(B=null),typeof m=="function"&&m(B),I(B)},[m,I]),R=t0(M=>{if(h||S)return;let $=typeof D=="number"?D:0,B=M==="up"?$+s:$-s;B>c&&(B=c),B<d&&(B=d),typeof m=="function"&&m(B),I(B)},[S,c,d,m,h,I,s,D]),[P,E]=zJ([]),F=t0(M=>{if(!(h||S)){let $;M?Array.isArray(M)?$=M.map(B=>Number(B.value?.value||B.value)):$=[Number(M.value?.value||M.value)]:$=[],I($)}},[h,S,I]);VJ(()=>{i&&Array.isArray(D)&&E(D.map((M,$)=>({id:`${M}${$}`,label:`${M}`,value:{toString:()=>`${M}${$}`,value:M?.value||M}})))},[D,i]);let L=HJ(()=>st(e),[e]);return OJ(CP,{AfterInput:v,BeforeInput:C,className:o,Description:y,description:n,Error:x,hasMany:i,Label:w,label:a,localized:l,max:c,maxRows:u,min:d,onChange:i?F:T,onStep:R,path:_,placeholder:r,readOnly:h||S,required:f,showError:A,step:s,style:L,value:D,valueToRender:P})},Ol=Je(GJ);import{jsx as yn,jsxs as Fu}from"react/jsx-runtime";import{getTranslation as qx}from"@payloadcms/translations";import{useCallback as Qx,useMemo as WJ}from"react";var xP="point",UJ=t=>{let{field:e,field:{admin:{className:o,description:n,placeholder:r,step:s}={},label:i,localized:a,required:l},path:c,readOnly:u,validate:d}=t,{i18n:f,t:m}=N(),p=Qx((R,P)=>{if(typeof d=="function")return d(R,{...P,required:l})},[d,l]),{customComponents:{AfterInput:h,BeforeInput:g,Description:b,Error:v,Label:C}={},disabled:y,path:x,setValue:w,showError:S,value:_=[null,null]}=Ne({potentiallyStalePath:c,validate:p}),I=Qx((R,P)=>{let E=parseFloat(R.target.value);Number.isNaN(E)&&(E=R.target.value);let F=[..._];F[P]=E,w(F)},[w,_]),A=Qx((R,P)=>{if(u||y)return;let E=s??1,F=typeof _[R]=="number"?_[R]:0,L=P==="up"?F+E:F-E,M=[..._];M[R]=L,w(M)},[y,u,w,s,_]),D=R=>{let P=m(R==="longitude"?"fields:longitude":"fields:latitude"),E=i?qx(i,f):"";return`${E}${E?" - ":""}${P}`},T=WJ(()=>st(e),[e]);return Fu("div",{className:[Ee,xP,o,S&&"error",(u||y)&&"read-only"].filter(Boolean).join(" "),style:T,children:[Fu("ul",{className:`${xP}__wrap`,children:[Fu("li",{children:[yn(le,{CustomComponent:C,Fallback:yn(Fe,{label:D("longitude"),localized:a,path:x,required:l})}),g,Fu("div",{className:"form-input-group",children:[yn("input",{className:"form-input",disabled:u||y,id:`field-longitude-${x?.replace(/\./g,"__")}`,name:`${x}.longitude`,onChange:R=>I(R,0),placeholder:qx(r,f),step:s,type:"number",value:_&&typeof _[0]=="number"?_[0]:""}),yn(ya,{disabled:u||y,onDecrement:()=>A(0,"down"),onIncrement:()=>A(0,"up")})]}),h]}),Fu("li",{children:[yn(le,{CustomComponent:C,Fallback:yn(Fe,{label:D("latitude"),localized:a,path:x,required:l})}),Fu("div",{className:"form-input-group",children:[yn(le,{CustomComponent:v,Fallback:yn(tt,{path:x,showError:S})}),g,yn("input",{className:"form-input",disabled:u||y,id:`field-latitude-${x?.replace(/\./g,"__")}`,name:`${x}.latitude`,onChange:R=>I(R,1),placeholder:qx(r,f),step:s,type:"number",value:_&&typeof _[1]=="number"?_[1]:""}),yn(ya,{disabled:u||y,onDecrement:()=>A(1,"down"),onIncrement:()=>A(1,"up")})]}),h]})]}),yn(le,{CustomComponent:b,Fallback:yn(Xe,{description:n,path:x})})]})},cf=Je(UJ);import{jsx as bi,jsxs as Kx}from"react/jsx-runtime";import{optionIsObject as wP}from"payload/shared";import{useCallback as JJ,useMemo as qJ}from"react";import{c as XJ}from"react/compiler-runtime";import{jsx as o0,jsxs as ZJ}from"react/jsx-runtime";import{getTranslation as YJ}from"@payloadcms/translations";import"react";var uf="radio-input",df=t=>{let e=XJ(16),{isSelected:o,onChange:n,option:r,path:s,readOnly:i,uuid:a}=t,{i18n:l}=N(),c=vt(),u=`field-${s}-${r.value}${c>1?`-${c}`:""}${a?`-${a}`:""}`,d=o&&`${uf}--is-selected`,f;e[0]!==d?(f=[uf,d].filter(Boolean),e[0]=d,e[1]=f):f=e[1];let m=f.join(" "),p;e[2]!==n||e[3]!==r.value?(p=()=>typeof n=="function"?n(r.value):null,e[2]=n,e[3]=r.value,e[4]=p):p=e[4];let h;if(e[5]!==l||e[6]!==u||e[7]!==o||e[8]!==r.label||e[9]!==s||e[10]!==i||e[11]!==m||e[12]!==p){let g=o0("input",{checked:o,disabled:i,id:u,name:s,onChange:p,type:"radio"}),b=i&&`${uf}__styled-radio--disabled`,v;e[14]!==b?(v=[`${uf}__styled-radio`,b].filter(Boolean),e[14]=b,e[15]=v):v=e[15],h=o0("label",{htmlFor:u,children:ZJ("div",{className:m,children:[g,o0("span",{className:v.join(" ")}),o0("span",{className:`${uf}__label`,children:YJ(r.label,l)})]})}),e[5]=l,e[6]=u,e[7]=o,e[8]=r.label,e[9]=s,e[10]=i,e[11]=m,e[12]=p,e[13]=h}else h=e[13];return h};var r0="radio-group",QJ=t=>{let{disableModifyingForm:e,field:o,field:{admin:{className:n,description:r,layout:s="horizontal"}={},label:i,localized:a,options:l=[],required:c}={},onChange:u,path:d,readOnly:f,validate:m,value:p}=t,{uuid:h}=Ge(),g=JJ((R,P)=>{if(typeof m=="function")return m(R,{...P,options:l,required:c})},[m,l,c]),{customComponents:{AfterInput:b,BeforeInput:v,Description:C,Error:y,Label:x}={},disabled:w,path:S,setValue:_,showError:I,value:A}=Ne({potentiallyStalePath:d,validate:g}),D=A||p,T=qJ(()=>st(o),[o]);return Kx("div",{className:[Ee,r0,n,`${r0}--layout-${s}`,I&&"error",(f||w)&&`${r0}--read-only`].filter(Boolean).join(" "),style:T,children:[Kx("div",{children:[bi(le,{CustomComponent:y,Fallback:bi(tt,{alignCaret:"left",path:S,showError:I})}),bi(le,{CustomComponent:x,Fallback:bi(Fe,{label:i,localized:a,path:S,required:c})})]}),Kx("div",{className:`${Ee}__wrap`,children:[v,bi("ul",{className:`${r0}--group`,id:`field-${S.replace(/\./g,"__")}`,children:l.map(R=>{let P="";wP(R)?P=R.value:P=R;let E=String(P)===String(D),F=`field-${S}-${P}${h?`-${h}`:""}`;return bi("li",{children:bi(df,{id:F,isSelected:E,onChange:()=>{typeof u=="function"&&u(P),f||w||_(P,!!e)},option:wP(R)?R:{label:R,value:R},path:S,readOnly:f||w,uuid:h})},`${S} - ${P}`)})}),b,bi(le,{CustomComponent:C,Fallback:bi(Xe,{description:r,path:S})})]})]})},mf=Je(QJ);import{jsx as Nq}from"react/jsx-runtime";import c2,{useCallback as u2,useMemo as Eq}from"react";import{jsx as Gn,jsxs as a0}from"react/jsx-runtime";import{dequal as Dq}from"dequal/lite";import{formatAdminURL as i2,wordBoundariesRegex as Aq}from"payload/shared";import*as a2 from"qs-esm";import{useCallback as zl,useEffect as Eu,useMemo as Pq,useReducer as Fq,useRef as vf,useState as Ca}from"react";import{c as KJ}from"react/compiler-runtime";import{jsx as vi,jsxs as e2}from"react/jsx-runtime";import{getTranslation as SP}from"@payloadcms/translations";import{hasAutosaveEnabled as eq}from"payload/shared";import{Fragment as _P,useEffect as n0,useState as s0}from"react";var ff="relationship-add-new",IP=t=>{let e=KJ(44),{Button:o,hasMany:n,onChange:r,path:s,relationTo:i,unstyled:a,value:l}=t,c=Sg(i),{permissions:u}=ye(),[d,f]=s0(!1),[m,p]=s0(),h=c.length>1,g;e[0]!==c[0]||e[1]!==h?(g=()=>h?void 0:c[0],e[0]=c[0],e[1]=h,e[2]=g):g=e[2];let[b,v]=s0(g),[C,y]=s0(!1),{i18n:x,t:w}=N(),S=b?.slug,_;e[3]!==S?(_={collectionSlug:S},e[3]=S,e[4]=_):_=e[4];let[I,A,D]=ro(_),{isDrawerOpen:T,toggleDrawer:R}=D,P;e[5]!==b||e[6]!==n||e[7]!==r||e[8]!==l?(P=W=>{let{doc:U,operation:X}=W;if(X==="create"||X==="update"&&eq(b)){let Q;l?Q=Array.isArray(l)?!l.some(J=>J&&J.value===U.id):l.value!==U.id:Q=!0,Q&&r(n===!0?[...Array.isArray(l)?l:[],{relationTo:b?.slug,value:U.id}]:{relationTo:b?.slug,value:U.id}),p(void 0)}},e[5]=b,e[6]=n,e[7]=r,e[8]=l,e[9]=P):P=e[9];let E=P,F,L;e[10]!==u||e[11]!==c?(F=()=>{u&&(c.length===1?f(u.collections[c[0]?.slug]?.create):f(c.some(W=>u.collections[W?.slug]?.create)))},L=[u,c],e[10]=u,e[11]=c,e[12]=F,e[13]=L):(F=e[12],L=e[13]),n0(F,L);let M,$;e[14]!==c||e[15]!==h||e[16]!==m?(M=()=>{h&&m&&v(c.find(W=>W?.slug===m))},$=[m,h,c],e[14]=c,e[15]=h,e[16]=m,e[17]=M,e[18]=$):(M=e[17],$=e[18]),n0(M,$);let B,j;e[19]!==b||e[20]!==h||e[21]!==R?(B=()=>{h&&b&&(R(),p(void 0))},j=[R,h,b],e[19]=b,e[20]=h,e[21]=R,e[22]=B,e[23]=j):(B=e[22],j=e[23]),n0(B,j);let k,O;e[24]!==T||e[25]!==h?(k=()=>{h&&!T&&v(void 0)},O=[T,h],e[24]=T,e[25]=h,e[26]=k,e[27]=O):(k=e[26],O=e[27]),n0(k,O);let V=c[0]?.labels.singular,H,z;if(e[28]!==o||e[29]!==I||e[30]!==A||e[31]!==b||e[32]!==x||e[33]!==E||e[34]!==s||e[35]!==u||e[36]!==C||e[37]!==c||e[38]!==d||e[39]!==w||e[40]!==V||e[41]!==a){z=Symbol.for("react.early_return_sentinel");e:{let W=w("fields:addNewLabel",{label:SP(V,x)});if(!d){z=null;break e}H=e2("div",{className:ff,id:`${s}-add-new`,children:[c.length===1&&e2(_P,{children:[vi(A,{buttonStyle:"pill",className:[`${ff}__add-button`,a&&`${ff}__add-button--unstyled`].filter(Boolean).join(" "),tooltip:o?void 0:W,children:o||vi(Po,{})}),vi(I,{onSave:E})]}),c.length>1&&e2(_P,{children:[vi(Ve,{buttonType:"custom",horizontalAlign:"right",onToggleClose:()=>y(!1),onToggleOpen:()=>y(!0),render:U=>{let{close:X}=U;return vi(Ys,{children:c.map(Q=>u.collections[Q?.slug]?.create?vi(Fn,{className:`${ff}__relation-button--${Q?.slug}`,onClick:()=>{X(),p(Q?.slug)},children:SP(Q?.labels?.singular,x)},Q?.slug):null)})},renderButton:U=>{let{active:X,...Q}=U;return vi(Z,{className:`${ff}__add-button`,...Q,buttonStyle:"pill",selected:X,tooltip:C?"":w("fields:addNew"),children:vi(Po,{})})}}),b&&u.collections[b?.slug]?.create&&vi(I,{onSave:E})]})]})}e[28]=o,e[29]=I,e[30]=A,e[31]=b,e[32]=x,e[33]=E,e[34]=s,e[35]=u,e[36]=C,e[37]=c,e[38]=d,e[39]=w,e[40]=V,e[41]=a,e[42]=H,e[43]=z}else H=e[42],z=e[43];return z!==Symbol.for("react.early_return_sentinel")?z:H};import{c as rq}from"react/compiler-runtime";import{jsx as i0}from"react/jsx-runtime";import{createElement as nq}from"react";import{useEffect as AP,useId as sq,useState as PP}from"react";import{jsx as t2,jsxs as RP,Fragment as tq}from"react/jsx-runtime";import{hoistQueryParamsToAnd as oq}from"payload/shared";import{useCallback as pf,useEffect as TP,useState as o2}from"react";var DP=({allowCreate:t=!0,collectionSlugs:e,disableQueryPresets:o,drawerSlug:n,enableRowSelections:r,filterOptions:s,onBulkSelect:i,onSelect:a,overrideEntityVisibility:l=!0,selectedCollection:c})=>{let{closeModal:u,isModalOpen:d}=ie(),{serverFunction:f}=ct(),[m,p]=o2(void 0),[h,g]=o2(!0),{config:{collections:b},getEntityConfig:v}=G(),C=d(n),y=b.filter(({slug:F})=>e.includes(F)),[x,w]=o2(()=>{let F=c||y[0]?.slug,L=v({collectionSlug:F});return L?{label:L.labels,value:L.slug}:void 0}),[S,_,{drawerSlug:I}]=ro({collectionSlug:x.value}),A=et(F=>{F&&F!==x?.value&&w({label:v({collectionSlug:F})?.labels,value:F})});TP(()=>{A(c)},[c]);let D=pf(async({slug:F,query:L})=>{try{let M={...L||{},where:{...L?.where||{}}},$=s?.[F];if(s&&typeof $!="boolean"&&(M.where=oq(M.where,$)),F){let B=await f({name:"render-list",args:{collectionSlug:F,disableBulkDelete:!0,disableBulkEdit:!0,disableQueryPresets:o,drawerSlug:n,enableRowSelections:r,overrideEntityVisibility:l,query:M}});p(B?.List||null)}else p(null);g(!1)}catch(M){console.error("Error rendering List View: ",M),C&&u(n)}},[f,u,n,C,r,s,l,o]);TP(()=>{m||D({slug:x?.value})},[D,m,x.value]);let T=pf(({doc:F})=>{typeof a=="function"&&a({collectionSlug:x?.value,doc:F,docID:F.id}),u(I),u(n)},[u,I,n,a,x.value]),R=pf(F=>{D({slug:x?.value,query:F})},[D,x.value]),P=pf(F=>{w(F),D({slug:F?.value})},[D]),E=pf(async F=>{F&&w({label:v({collectionSlug:F})?.labels,value:F}),await D({slug:x.value||F})},[v,D,x.value]);return RP(dx,{allowCreate:t,createNewDrawerSlug:I,DocumentDrawerToggler:_,drawerSlug:n,enabledCollections:e,onBulkSelect:i,onQueryChange:R,onSelect:a,refresh:E,selectedOption:x,setSelectedOption:P,children:[!h&&RP(tq,{children:[t2("div",{className:"drawer__fade-in",children:m}),t2(S,{onSave:T})]}),t2(en,{animationDuration:"200ms",overlayType:"drawer",show:h})]})};var FP="list-drawer",iq=({depth:t,uuid:e})=>`list-drawer_${t}_${e}`,aq=({children:t,className:e,disabled:o,drawerSlug:n,onClick:r,...s})=>i0(Jr,{className:[e,`${FP}__toggler`].filter(Boolean).join(" "),disabled:o,onClick:r,slug:n,...s,children:t}),lq=t=>{let{drawerSlug:e}=t;return i0(It,{className:FP,Header:null,slug:e,children:i0(DP,{...t})})},Vl=t=>{let e=rq(42),{collectionSlugs:o,filterOptions:n,selectedCollection:r,uploads:s}=t,{config:i}=G(),{collections:a}=i,l=vt(),c=sq(),{closeModal:u,modalState:d,openModal:f,toggleModal:m}=ie(),[p,h]=PP(!1),[g,b]=PP(o),v;e[0]!==l||e[1]!==c?(v=iq({depth:l,uuid:c}),e[0]=l,e[1]=c,e[2]=v):v=e[2];let C=v,y,x;e[3]!==C||e[4]!==d?(y=()=>{h(!!d[C]?.isOpen)},x=[d,C],e[3]=C,e[4]=d,e[5]=y,e[6]=x):(y=e[5],x=e[6]),AP(y,x);let w,S;e[7]!==g||e[8]!==a||e[9]!==s?(w=()=>{if(!g||g.length===0){let j=a.filter(k=>{let{upload:O}=k;return s?!!O:!0});b(j.map(cq))}},S=[g,s,a],e[7]=g,e[8]=a,e[9]=s,e[10]=w,e[11]=S):(w=e[10],S=e[11]),AP(w,S);let _;e[12]!==C||e[13]!==m?(_=()=>{m(C)},e[12]=C,e[13]=m,e[14]=_):_=e[14];let I=_,A;e[15]!==u||e[16]!==C?(A=()=>{u(C)},e[15]=u,e[16]=C,e[17]=A):A=e[17];let D=A,T;e[18]!==C||e[19]!==f?(T=()=>{f(C)},e[18]=C,e[19]=f,e[20]=T):T=e[20];let R=T,P;e[21]!==D||e[22]!==g||e[23]!==C||e[24]!==n||e[25]!==r||e[26]!==s?(P=j=>nq(lq,{...j,closeDrawer:D,collectionSlugs:g,drawerSlug:C,filterOptions:n,key:C,selectedCollection:r,uploads:s}),e[21]=D,e[22]=g,e[23]=C,e[24]=n,e[25]=r,e[26]=s,e[27]=P):P=e[27];let E=P,F;e[28]!==C?(F=j=>i0(aq,{...j,drawerSlug:C}),e[28]=C,e[29]=F):F=e[29];let L=F,M;e[30]!==D||e[31]!==g||e[32]!==l||e[33]!==C||e[34]!==p||e[35]!==R||e[36]!==I?(M={closeDrawer:D,collectionSlugs:g,drawerDepth:l,drawerSlug:C,isDrawerOpen:p,openDrawer:R,setCollectionSlugs:b,toggleDrawer:I},e[30]=D,e[31]=g,e[32]=l,e[33]=C,e[34]=p,e[35]=R,e[36]=I,e[37]=M):M=e[37];let $=M,B;return e[38]!==E||e[39]!==$||e[40]!==L?(B=[E,L,$],e[38]=E,e[39]=$,e[40]=L,e[41]=B):B=e[41],B};function cq(t){let{slug:e}=t;return e}import{useCallback as uq,useRef as NP}from"react";function Hl(){let t=NP([]),e=NP(!1);return{queueTask:uq((n,r)=>{t.current.push(n);async function s(){if(!e.current&&!(typeof r?.beforeProcess=="function"&&r.beforeProcess()===!1))for(;t.current.length>0;){let i=t.current.pop();t.current=[],e.current=!0;try{await i()}catch(a){console.error("Error in queued function:",a)}finally{e.current=!1,typeof r?.afterProcess=="function"&&r.afterProcess()}}}s()},[])}}import{c as dq}from"react/compiler-runtime";import{jsx as mq}from"react/jsx-runtime";import{createContext as fq,use as pq,useState as hq}from"react";var EP=fq({mostRecentUpdate:null,reportUpdate:()=>null}),r2=t=>{let e=dq(3),{children:o}=t,[n,r]=hq(null),s;return e[0]!==o||e[1]!==n?(s=mq(EP,{value:{mostRecentUpdate:n,reportUpdate:r},children:o}),e[0]=o,e[1]=n,e[2]=s):s=e[2],s},yi=()=>pq(EP);var n2=t=>{for(let e in t){let o=t[e];if((e.toLowerCase()==="and"||e.toLowerCase()==="or")&&Array.isArray(o))for(let n of o)n2(n);else o&&typeof o=="object"&&"in"in o&&Array.isArray(o.in)&&o.in.length===0&&(t[e]={exists:!1})}return t};var s2=({hasMany:t,relationTo:e,value:o})=>{let n=e.reduce((r,s)=>({...r,[s]:[]}),{});if(o===null)return n;if(o){let r=(s,i)=>{(typeof i=="string"||typeof i=="number")&&typeof s=="string"&&(n[s]?n[s].push(i):n[s]=[i])};t===!0?o.forEach(s=>{s&&r(s.relationTo,s.value)}):r(o.relationTo,o.value)}return n};var LP=({allowEdit:t,options:e,value:o})=>{if(o||typeof o=="number"){if(Array.isArray(o))return o.map(r=>{let s;return e.forEach(i=>{s||(s=i.options.find(a=>a.value===r.value&&a.relationTo===r.relationTo))}),s?{allowEdit:t,...s}:void 0});let n;return e.forEach(r=>{n||(n=r.options.find(s=>s.value===o.value&&s.relationTo===o.relationTo))}),n?{allowEdit:t,...n}:void 0}};import{getTranslation as gq}from"@payloadcms/translations";var jP=t=>t.reduce((e,o)=>o.options?[...e,...jP(o.options)]:[...e,{id:o.value,relationTo:o.relationTo}],[]),$P=t=>t.sort((e,o)=>typeof e?.label?.localeCompare=="function"&&typeof o?.label?.localeCompare=="function"?e.label.localeCompare(o.label):0),kP=(t,e)=>{switch(e.type){case"ADD":{let{collection:o,config:n,docs:r,i18n:s,ids:i=[],sort:a}=e,l=o.slug,c=jP(t),u=[...t],d=u.find(m=>m.label===o.labels.plural),f=r.reduce((m,p)=>{if(c.filter(h=>h.id===p.id&&h.relationTo===l).length===0){c.push({id:p.id,relationTo:l});let h=Br({collectionConfig:o,data:p,dateFormat:n.admin.dateFormat,fallback:`${s.t("general:untitled")} - ID: ${p.id}`,i18n:s});return[...m,{label:h,relationTo:l,value:p.id}]}return m},[]);if(i.forEach(m=>{c.filter(p=>p.id===m&&p.relationTo===l).length===0&&(c.push({id:m,relationTo:l}),f.push({allowEdit:!1,label:`${s.t("general:untitled")} - ID: ${m}`,relationTo:l,value:m}))}),d){let m=[...d.options,...f];d.options=a?$P(m):m}else u.push({label:gq(o.labels.plural,s),options:a?$P(f):f});return u}case"CLEAR":{let o=e.exemptValues?Array.isArray(e.exemptValues)?e.exemptValues:[e.exemptValues]:[];return t.filter(r=>{let s=r.options.filter(i=>o?o.some(a=>a&&i.value===a.value):!1);return r.options=s,s.length>0})}case"REMOVE":{let{id:o,collection:n}=e,r=[...t],s=r.findIndex(i=>i.label===n.labels.plural);return s===-1||(r[s]={...r[s],options:r[s].options.filter(i=>i.value!==o)}),r}case"UPDATE":{let{collection:o,config:n,doc:r,i18n:s}=e,i=o.slug,a=[...t],l=Br({collectionConfig:o,data:r,dateFormat:n.admin.dateFormat,fallback:`${s.t("general:untitled")} - ID: ${r.id}`,i18n:s}),u=a.find(d=>d.label===o.labels.plural)?.options?.find(d=>d.value===r.id);return u&&(u.label=l,u.relationTo=i),a}default:return t}};import{jsx as hf,jsxs as bq}from"react/jsx-runtime";import{Fragment as vq}from"react";var gf="relationship--multi-value-label",MP=t=>{let{data:e,selectProps:o}=t,{allowEdit:n,label:r,relationTo:s,value:i}=e,{customProps:a}=o===void 0?{}:o,{draggableProps:l,onDocumentOpen:c}=a===void 0?{}:a,{permissions:u}=ye(),d=!!u?.collections?.[s]?.read;return bq("div",{className:gf,title:r||"",children:[hf("div",{className:`${gf}__content`,children:hf(oo.MultiValueLabel,{...t,innerProps:{className:`${gf}__text`,...l||{}}})}),s&&d&&n!==!1&&hf(vq,{children:hf("button",{"aria-label":`Edit ${r}`,className:`${gf}__drawer-toggler`,onClick:f=>{c({id:i,collectionSlug:s,hasReadPermission:d,openInNewTab:f.metaKey||f.ctrlKey})},onKeyDown:yq,onMouseDown:Cq,onTouchEnd:xq,type:"button",children:hf(fr,{className:`${gf}__icon`})})})]})};function yq(t){t.key==="Enter"&&t.stopPropagation()}function Cq(t){return t.stopPropagation()}function xq(t){return t.stopPropagation()}import{c as wq}from"react/compiler-runtime";import{jsx as Nu,jsxs as Sq}from"react/jsx-runtime";import{Fragment as _q}from"react";var bf="relationship--single-value",BP=t=>{let e=wq(15),{children:o,data:n,selectProps:r}=t,{allowEdit:s,label:i,relationTo:a,value:l}=n,c;e[0]!==r?(c=r===void 0?{}:r,e[0]=r,e[1]=c):c=e[1];let{customProps:u}=c,d;e[2]!==u?(d=u===void 0?{}:u,e[2]=u,e[3]=d):d=e[3];let{onDocumentOpen:f}=d,{t:m}=N(),{permissions:p}=ye(),h=!!p?.collections?.[a]?.read,g=i||"",b;return e[4]!==s||e[5]!==o||e[6]!==h||e[7]!==i||e[8]!==f||e[9]!==t||e[10]!==a||e[11]!==m||e[12]!==g||e[13]!==l?(b=Nu(oo.SingleValue,{...t,className:bf,children:Nu("div",{className:`${bf}__label`,title:g,children:Sq("div",{className:`${bf}__label-text`,children:[Nu("div",{className:`${bf}__text`,children:o}),a&&h&&s!==!1&&Nu(_q,{children:Nu("button",{"aria-label":m("general:editLabel",{label:i}),className:`${bf}__drawer-toggler`,onClick:v=>{f({id:l,collectionSlug:a,hasReadPermission:h,openInNewTab:v.metaKey||v.ctrlKey})},onKeyDown:Iq,onMouseDown:Rq,onTouchEnd:Tq,type:"button",children:Nu(fr,{})})})]})})}),e[4]=s,e[5]=o,e[6]=h,e[7]=i,e[8]=f,e[9]=t,e[10]=a,e[11]=m,e[12]=g,e[13]=l,e[14]=b):b=e[14],b};function Iq(t){t.key==="Enter"&&t.stopPropagation()}function Rq(t){return t.stopPropagation()}function Tq(t){return t.stopPropagation()}var Lu="relationship",l2=t=>{let{AfterInput:e,allowCreate:o=!0,allowEdit:n=!0,appearance:r="select",BeforeInput:s,className:i,description:a,Description:l,Error:c,filterOptions:u,formatDisplayedOptions:d,hasMany:f,initialValue:m,isSortable:p=!0,label:h,Label:g,localized:b,maxResultsPerRequest:v=10,onChange:C,path:y,placeholder:x,readOnly:w,relationTo:S,required:_,showError:I,sortOptions:A,style:D,value:T}=t,{config:R,getEntityConfig:P}=G(),{routes:{api:E},serverURL:F}=R,{i18n:L,t:M}=N(),{permissions:$}=ye(),{code:B}=Ce(),[j,k]=Ca({id:void 0,collectionSlug:void 0,hasReadPermission:!1}),[O,V]=Ca(-1),[H,z]=Ca({}),[W,U]=Ca(""),[X,Q]=Ca(""),[J,oe]=Ca(!1),[Y,K]=Ca(!1),[ee,te]=Ca(!1),re=vf(!1),{queueTask:me}=Hl(),[we,Ae]=Fq(kP,[]),de=vf(T),[xe,,{drawerSlug:$e,isDrawerOpen:Le,openDrawer:rt}]=ro({id:j.id,collectionSlug:j.collectionSlug}),q=Pq(()=>{let ce=u;if(T){let ze=(f===!1?[T]:T).reduce((He,at)=>(He[at.relationTo]||(He[at.relationTo]=[]),He[at.relationTo].push(at.value),He),{});(Array.isArray(S)?S:[S]).forEach(He=>{ce={...ce||{},[He]:{...typeof u?.[He]=="object"?u[He]:{},...ze[He]?{id:{not_in:ze[He]}}:{}}}})}return ce},[u,T,f,S]),[pe,,{closeDrawer:fe,isDrawerOpen:Pe,openDrawer:ge}]=Vl({collectionSlugs:S,filterOptions:q}),ae=zl(({collectionSlug:ce,doc:ze})=>{f?C([...Array.isArray(T)?T:[],{relationTo:ce,value:ze.id}]):f===!1&&C({relationTo:ce,value:ze.id}),fe()},[f,C,fe,T]),Se=vf(!1),ne=zl(({filterOptions:ce,hasMany:ze,lastFullyLoadedRelation:He,lastLoadedPage:at,onSuccess:Ye,search:ot,sort:Ie,value:Qe})=>{$&&me(async()=>{let Ke=typeof He<"u"?He:-1,dt=Array.isArray(S)?S:[S],Lt=Ke===-1?dt:dt.slice(Ke+1),$t=0,$o=s2(ze===!0?{hasMany:!0,relationTo:S,value:Qe}:{hasMany:!1,relationTo:S,value:Qe});W||(await Lt.reduce(async(dr,St)=>{let mr=ce?.[St],Er;if(X!==ot?Er=1:Er=(at[St]||0)+1,await dr,mr===!1)return V(dt.indexOf(St)),Promise.resolve();if($t<10){let qo=P({collectionSlug:St}),as=qo?.admin?.useAsTitle||"id",Ui=qo?.defaultSort||"id";typeof A=="string"?Ui=A:A?.[St]&&(Ui=A[St]);let zs={depth:0,draft:!0,limit:v,locale:B,page:Er,select:{[as]:!0},sort:Ui,where:{and:[{id:{not_in:$o[St]}}]}};ot&&zs.where.and.push({[as]:{like:ot}}),mr&&typeof mr!="boolean"&&zs.where.and.push(mr),n2(zs.where);let un=await fetch(i2({apiRoute:E,path:`/${St}`}),{body:a2.stringify(zs),credentials:"include",headers:{"Accept-Language":L.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"},method:"POST"});if(un.ok){let Wr=await un.json();z(Xi=>({...Xi,[St]:Er})),Wr.nextPage||V(dt.indexOf(St)),Wr.docs.length>0&&($t+=Wr.docs.length,Ae({type:"ADD",collection:qo,config:R,docs:Wr.docs,i18n:L,sort:Ie}))}else un.status===403?(V(dt.indexOf(St)),Ae({type:"ADD",collection:qo,config:R,docs:[],i18n:L,ids:$o[St],sort:Ie})):U(M("error:unspecific"))}},Promise.resolve()),typeof Ye=="function"&&Ye())})},[$,me,S,W,X,P,A,v,B,E,L,R,M]),Te=tf(({hasMany:ce,search:ze,value:He})=>{Nt({filterOptions:u,lastLoadedPage:{},onSuccess:()=>{oe(!1)},search:ze,sort:!0,...ce===!0?{hasMany:ce,value:He}:{hasMany:ce,value:He}}),Q(ze)},300),he=zl(ce=>{X!==ce.search&&(oe(!0),z({}),Te(ce))},[X,Te]),_e=et(({hasMany:ce,value:ze})=>{let He=s2(ce===!0?{hasMany:ce,relationTo:S,value:ze}:{hasMany:ce,relationTo:S,value:ze});Object.entries(He).reduce(async(at,[Ye,ot])=>{await at;let Ie=ot.filter(Qe=>!we.find(Ke=>Ke?.options?.find(dt=>dt.value===Qe&&dt.relationTo===Ye)));if(Ie.length>0){let Qe=P({collectionSlug:Ye}),Ke=Qe?.admin?.useAsTitle||"id",dt={depth:0,draft:!0,limit:Ie.length,locale:B,select:{[Ke]:!0},where:{id:{in:Ie}}};if(!W){let Lt=await fetch(i2({apiRoute:E,path:`/${Ye}`}),{body:a2.stringify(dt),credentials:"include",headers:{"Accept-Language":L.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"},method:"POST"}),$t=[];Lt.ok&&($t=(await Lt.json()).docs),Ae({type:"ADD",collection:Qe,config:R,docs:$t,i18n:L,ids:Ie,sort:!0})}}},Promise.resolve())}),{mostRecentUpdate:Ze}=yi(),ut=et(ce=>{if(!T)return!1;let ze=ce.doc.id,He=!1;if(ce.operation==="update"?f===!0?He=(Array.isArray(T)?T:[T]).some(ot=>ot.value===ze&&ot.relationTo===ce.entitySlug):f===!1&&(He=T?.value===ze&&T?.relationTo===ce.entitySlug):ce.operation==="create"&&(He=ce.drawerSlug===$e),!He)return;let at=P({collectionSlug:ce.entitySlug});if(Ae({type:"UPDATE",collection:at,config:R,doc:ce.doc,i18n:L}),f){let ot=(T?Array.isArray(T)?T:[T]:[]).map(Ie=>({relationTo:Ie.value===ze?ce.entitySlug:Ie.relationTo,value:Ie.value}));C(ot)}else f===!1&&C({relationTo:ce.entitySlug,value:ze})});Eu(()=>{Ze&&ut(Ze)},[Ze]);let De=zl(ce=>{Ae({type:"ADD",collection:ce.collectionConfig,config:R,docs:[ce.doc],i18n:L,sort:!0}),f?C(T?T.concat({relationTo:ce.collectionConfig.slug,value:ce.doc.id}):null):f===!1&&C({relationTo:ce.collectionConfig.slug,value:ce.doc.id})},[L,R,f,C,T]),it=zl(ce=>{Ae({id:ce.id,type:"REMOVE",collection:ce.collectionConfig,config:R,i18n:L}),C(f&&T?T.filter(ze=>ze.value!==ce.id):null)},[L,R,f,C,T]),pt=zl((ce,ze)=>{if(!ze)return!0;let He=Aq(ze||""),at=250,Ye=String(ce.label);for(;Ye.length>at;){let ot=Ye.indexOf(" ",ze.length);if(He.test(Ye.slice(0,ot===-1?ze.length:ot+1)))return!0;Ye=Ye.slice(ot===-1?ze.length:ot+1)}return He.test(Ye.slice(-at))},[]),Vt=zl(({id:ce,collectionSlug:ze,hasReadPermission:He,openInNewTab:at})=>{if(at){if(He&&ce&&ze){let Ye=i2({adminRoute:R.routes.admin,path:`/collections/${ze}/${ce}`,serverURL:F});window.open(Ye,"_blank")}}else Se.current=!0,k({id:ce,collectionSlug:ze,hasReadPermission:He})},[R.routes.admin,F]),Nt=et(ce=>ne(ce));Eu(()=>{re.current&&ee&&(oe(!0),Nt({filterOptions:u,lastLoadedPage:{},onSuccess:()=>{re.current=!0,oe(!1)},...f===!0?{hasMany:f,value:de.current}:{hasMany:f,value:de.current}})),Ae({type:"CLEAR",exemptValues:de.current}),V(-1),z({})},[S,u,B,y,ee,f]);let Do=vf(T),Be=vf(!0);Eu(()=>{(Be.current||!Dq(T,Do.current))&&_e(f===!0?{hasMany:f,value:T}:{hasMany:f,value:T}),Be.current=!1,Do.current=T},[T,f]),Eu(()=>{let ze=(Array.isArray(S)?S:[S]).reduce((He,at)=>(P({collectionSlug:at})?.admin?.useAsTitle||"id")==="id"&&He,!0);K(!ze)},[S,P]),Eu(()=>{Se.current&&(rt(),Se.current=!1)},[rt,j]),Eu(()=>{de.current=T},[T]);let qe=LP({allowEdit:n,options:we,value:T});return!Array.isArray(qe)&&qe?.value==="null"&&(qe.value=null),a0("div",{className:[Ee,Lu,i,I&&"error",W&&"error-loading",w&&`${Lu}--read-only`,!w&&o&&`${Lu}--allow-create`].filter(Boolean).join(" "),id:`field-${y.replace(/\./g,"__")}`,style:D,children:[Gn(le,{CustomComponent:g,Fallback:Gn(Fe,{label:h,localized:b,path:y,required:_})}),a0("div",{className:`${Ee}__wrap`,children:[s,W?Gn("div",{className:`${Lu}__error-loading`,children:W}):a0("div",{className:`${Lu}__wrap`,children:[a0("div",{className:`${Lu}__input-wrap`,children:[Gn(le,{CustomComponent:c,Fallback:Gn(tt,{path:y,showError:I})}),Gn(mt,{backspaceRemovesValue:!(Le||Pe),components:{MultiValueLabel:MP,SingleValue:BP,...r!=="select"&&{DropdownIndicator:null}},customProps:{disableKeyDown:Le||Pe,disableMouseDown:Le||Pe,onDocumentOpen:Vt},disabled:w||Le||Pe,filterOption:Y?pt:void 0,getOptionValue:ce=>{if(ce)return f&&Array.isArray(S)?`${ce.relationTo}_${ce.value}`:ce.value},isLoading:r==="select"&&J,isMulti:f,isSearchable:r==="select",isSortable:p,menuIsOpen:r==="select"?ee:!1,onChange:w?void 0:ce=>{f?ce===null?(de.current=[],C([])):(de.current=ce,C(ce)):f===!1&&(ce===null?(de.current=null,C(null)):(de.current=ce,C(ce)))},onInputChange:ce=>he({search:ce,...f===!0?{hasMany:f,value:T}:{hasMany:f,value:T}}),onMenuClose:()=>{te(!1)},onMenuOpen:()=>{r==="drawer"?ge():r==="select"&&(te(!0),re.current||(oe(!0),Nt({filterOptions:u,lastLoadedPage:{},onSuccess:()=>{re.current=!0,oe(!1)},...f===!0?{hasMany:f,value:T}:{hasMany:f,value:T}})))},onMenuScrollToBottom:()=>{oe(!0),Nt({filterOptions:u,lastFullyLoadedRelation:O,lastLoadedPage:H,onSuccess:()=>{oe(!1)},search:X,sort:!1,...f===!0?{hasMany:f,value:m}:{hasMany:f,value:m}})},options:typeof d=="function"?d(we):we,placeholder:x,showError:I,value:qe??null})]}),!w&&o&&Gn(IP,{path:y,relationTo:S,...f===!0?{hasMany:f,onChange:C,value:T}:{hasMany:f,onChange:C,value:T}})]}),e,Gn(le,{CustomComponent:l,Fallback:Gn(Xe,{description:a,path:y})})]}),j.collectionSlug&&j.hasReadPermission&&Gn(xe,{onDelete:it,onDuplicate:De}),r==="drawer"&&!w&&Gn(pe,{allowCreate:o,enableRowSelections:!1,onSelect:ae})]})};var Lq=t=>{let{field:e,field:{admin:{allowCreate:o=!0,allowEdit:n=!0,appearance:r="select",className:s,description:i,isSortable:a=!0,placeholder:l,sortOptions:c}={},hasMany:u,label:d,localized:f,relationTo:m,required:p},path:h,readOnly:g,validate:b}=t,v=u2((k,O)=>{if(typeof b=="function")return b(k,{...O,required:p})},[b,p]),{customComponents:{AfterInput:C,BeforeInput:y,Description:x,Error:w,Label:S}={},disabled:_,filterOptions:I,initialValue:A,path:D,setValue:T,showError:R,value:P}=Ne({potentiallyStalePath:h,validate:v}),E=Eq(()=>st(e),[e]),F=Array.isArray(m),[L]=c2.useState(()=>Array.isArray(m)?m:[m]),M=u2(k=>{if(!k){T(null,k===P);return}let O=!1;F?O=Array.isArray(P)&&Array.isArray(k)&&P.length===k.length&&P.every((H,z)=>{let W=k[z];return H.value===W.value&&H.relationTo===W.relationTo}):O=Array.isArray(P)&&Array.isArray(k)&&P.length===k.length&&P.every((H,z)=>H===k[z].value);let V=k.map(H=>F?H:H.value);T(V,O)},[F,T,P]),$=u2(k=>{if(!k){T(null,k===P);return}let O=!1;F?O=P&&k&&P.value===k.value&&P.relationTo===k.relationTo:O=P&&k&&P===k.value;let V=F?k:k.value;T(V,O)},[F,T,P]),B=c2.useMemo(()=>u===!0?Array.isArray(P)?P.map(k=>F?k:{relationTo:Array.isArray(L)?L[0]:L,value:k}):P:P&&(F?P:{relationTo:Array.isArray(L)?L[0]:L,value:P}),[u,P,F,L]),j=c2.useMemo(()=>u===!0?Array.isArray(A)?A.map(k=>F?k:{relationTo:Array.isArray(L)?L[0]:L,value:k}):A:A&&(F?A:{relationTo:Array.isArray(L)?L[0]:L,value:A}),[A,F,L,u]);return Nq(l2,{AfterInput:C,allowCreate:o,allowEdit:n,appearance:r,BeforeInput:y,className:s,Description:x,description:i,Error:w,filterOptions:I,formatDisplayedOptions:F?void 0:k=>k.map(O=>O.options).flat(),isSortable:a,Label:S,label:d,localized:f,maxResultsPerRequest:10,maxRows:e?.maxRows,minRows:e?.minRows,path:D,placeholder:l,readOnly:g||_,relationTo:L,required:p,showError:R,sortOptions:c,style:E,...u===!0?{hasMany:!0,initialValue:j,onChange:M,value:B}:{hasMany:!1,initialValue:j,onChange:$,value:B}})},yf=Je(Lq);var Cf=()=>null;import{jsx as d2}from"react/jsx-runtime";import"react";var OP="row",$q=t=>{let{field:{admin:{className:e,style:o}={},fields:n},forceRender:r=!1,indexPath:s="",parentPath:i="",parentSchemaPath:a="",permissions:l,readOnly:c}=t;return d2(PA,{children:d2("div",{className:[Ee,OP,e].filter(Boolean).join(" "),style:o||void 0,children:d2(co,{className:`${OP}__fields`,fields:n,forceRender:r,parentIndexPath:s,parentPath:i,parentSchemaPath:a,permissions:l,readOnly:c})})})},xf=Je($q);import{jsx as kq}from"react/jsx-runtime";import Mq,{useCallback as HP,useMemo as Bq}from"react";import{c as jq}from"react/compiler-runtime";import{jsx as Gl,jsxs as VP}from"react/jsx-runtime";import{getTranslation as m2}from"@payloadcms/translations";import"react";var _s=t=>{let e=jq(37),{id:o,AfterInput:n,BeforeInput:r,className:s,Description:i,description:a,Error:l,filterOption:c,hasMany:u,isClearable:d,isSortable:f,label:m,Label:p,localized:h,onChange:g,onInputChange:b,options:v,path:C,placeholder:y,readOnly:x,required:w,showError:S,style:_,value:I}=t,A=u===void 0?!1:u,D=d===void 0?!0:d,T=f===void 0?!0:f,{i18n:R}=N(),P;if(e[0]!==n||e[1]!==r||e[2]!==i||e[3]!==l||e[4]!==p||e[5]!==s||e[6]!==a||e[7]!==c||e[8]!==A||e[9]!==R||e[10]!==o||e[11]!==D||e[12]!==T||e[13]!==m||e[14]!==h||e[15]!==g||e[16]!==b||e[17]!==v||e[18]!==C||e[19]!==y||e[20]!==x||e[21]!==w||e[22]!==S||e[23]!==_||e[24]!==I){let E;if(A&&Array.isArray(I)){let B;e[26]!==R||e[27]!==v?(B=j=>{let k=v.find(O=>O.value===j);return{label:k?m2(k.label,R):j,value:k?.value??j}},e[26]=R,e[27]=v,e[28]=B):B=e[28],E=I.map(B)}else if(I){let B;e[29]!==I?(B=k=>k.value===I,e[29]=I,e[30]=B):B=e[30];let j=v.find(B);E={label:j?m2(j.label,R):I,value:j?.value??I}}else E=null;let F=S&&"error",L=x&&"read-only",M;e[31]!==s||e[32]!==F||e[33]!==L?(M=[Ee,"select",s,F,L].filter(Boolean),e[31]=s,e[32]=F,e[33]=L,e[34]=M):M=e[34];let $;e[35]!==R?($=B=>({...B,label:m2(B.label,R)}),e[35]=R,e[36]=$):$=e[36],P=VP("div",{className:M.join(" "),id:`field-${C.replace(/\./g,"__")}`,style:_,children:[Gl(le,{CustomComponent:p,Fallback:Gl(Fe,{label:m,localized:h,path:C,required:w})}),VP("div",{className:`${Ee}__wrap`,children:[Gl(le,{CustomComponent:l,Fallback:Gl(tt,{path:C,showError:S})}),r,Gl(mt,{disabled:x,filterOption:c,id:o,isClearable:D,isMulti:A,isSortable:T,onChange:g,onInputChange:b,options:v.map($),placeholder:y,showError:S,value:E}),n]}),Gl(le,{CustomComponent:i,Fallback:Gl(Xe,{description:a,path:C})})]}),e[0]=n,e[1]=r,e[2]=i,e[3]=l,e[4]=p,e[5]=s,e[6]=a,e[7]=c,e[8]=A,e[9]=R,e[10]=o,e[11]=D,e[12]=T,e[13]=m,e[14]=h,e[15]=g,e[16]=b,e[17]=v,e[18]=C,e[19]=y,e[20]=x,e[21]=w,e[22]=S,e[23]=_,e[24]=I,e[25]=P}else P=e[25];return P};var wf=t=>t.map(e=>typeof e=="object"&&(e.value||e.value==="")?e:{label:e,value:e}),Oq=t=>{let{field:e,field:{name:o,admin:{className:n,description:r,isClearable:s=!0,isSortable:i=!0,placeholder:a}={},hasMany:l=!1,label:c,localized:u,options:d=[],required:f},onChange:m,path:p,readOnly:h,validate:g}=t,b=Mq.useMemo(()=>wf(d),[d]),v=HP((F,L)=>{if(typeof g=="function")return g(F,{...L,hasMany:l,options:b,required:f})},[g,f,l,b]),{customComponents:{AfterInput:C,BeforeInput:y,Description:x,Error:w,Label:S}={},disabled:_,path:I,selectFilterOptions:A,setValue:D,showError:T,value:R}=Ne({potentiallyStalePath:p,validate:v}),P=HP(F=>{if(!h||_){let L=null;F&&l?Array.isArray(F)?L=F.map(M=>M.value):L=[]:F&&!Array.isArray(F)&&(L=F.value),typeof m=="function"&&m(L),D(L)}},[h,_,l,D,m]),E=Bq(()=>st(e),[e]);return kq(_s,{AfterInput:C,BeforeInput:y,className:n,Description:x,description:r,Error:w,filterOption:A?({label:F,value:L},M)=>A?.some($=>(typeof $=="string"?$:$.value)===L)&&F.toLowerCase().includes(M.toLowerCase()):void 0,hasMany:l,isClearable:s,isSortable:i,Label:S,label:c,localized:u,name:o,onChange:P,options:b,path:I,placeholder:a,readOnly:h||_,required:f,showError:T,style:E,value:R})},Wl=Je(Oq);import{c as a7}from"react/compiler-runtime";import{jsx as wa,jsxs as l7}from"react/jsx-runtime";import{getTranslation as TQ}from"@payloadcms/translations";import{getFieldPaths as DQ,toKebabCase as AQ}from"payload/shared";import{useEffect as i7,useState as PQ}from"react";import{jsx as $u}from"react/jsx-runtime";import"react";var Ul="tabs",Vq=({className:t,onChange:e,tabs:o,value:n})=>$u(l0,{className:t,children:o.map(r=>$u(c0,{disabled:r.disabled,hidden:r.hidden,isActive:r.value===n,onClick:()=>e(r.value),children:r.label},r.value))}),l0=({children:t,className:e,tabsClassName:o,tabsWrapClassName:n})=>$u("div",{className:[Ul,e].filter(Boolean).join(" "),children:$u("div",{className:[`${Ul}__tabs-wrap`,n].filter(Boolean).join(" "),children:$u("div",{className:[`${Ul}__tabs`,o].filter(Boolean).join(" "),role:"tablist",children:t})})}),c0=({children:t,className:e,disabled:o,hasError:n,hidden:r,isActive:s,modifierClassName:i,onClick:a})=>$u("button",{"aria-selected":s,className:[`${Ul}__tab-button`,e,n&&`${Ul}__tab-button--has-error`,n&&i&&`${i}--has-error`,s&&`${Ul}__tab-button--active`,s&&i&&`${i}--active`,r&&`${Ul}__tab-button--hidden`,r&&i&&`${i}--hidden`].filter(Boolean).join(" "),disabled:o,onClick:a,role:"tab",type:"button",children:t});var t7=Ji(h2(),1);import{jsx as Wn}from"react/jsx-runtime";import{dequal as KP}from"dequal/lite";import{deepCopyObjectSimpleWithoutReactComponents as e7,getDataByPath as gQ,getSiblingData as bQ,hasDraftValidationEnabled as vQ,reduceFieldsToValues as b2,wait as yQ}from"payload/shared";import CQ,{useCallback as or,useEffect as Zl,useReducer as xQ,useRef as Yl,useState as xa}from"react";import{c as Xq}from"react/compiler-runtime";import{jsx as ku,jsxs as XP,Fragment as Zq}from"react/jsx-runtime";import Yq from"react";import{jsx as UP}from"react/jsx-runtime";import"react";var Uq={16:"M6.285 2.915c.777-1.295 2.653-1.294 3.43 0l4.234 7.056c.8 1.333-.161 3.029-1.716 3.029H3.766c-1.554 0-2.515-1.696-1.716-3.03zm2.572.514a1 1 0 0 0-1.715 0l-4.234 7.056a1 1 0 0 0 .716 1.505l.142.01h8.467a1 1 0 0 0 .857-1.515zM8 9.499A.75.75 0 1 1 8 11a.75.75 0 0 1 0-1.5m.079-4.495a.73.73 0 0 1 .648.787l-.23 2.75a.5.5 0 0 1-.996 0L7.272 5.79A.73.73 0 0 1 8 5z",24:"M10.257 6.06c.764-1.36 2.722-1.36 3.486 0l5.04 8.96c.75 1.333-.213 2.98-1.743 2.98H6.96c-1.53 0-2.493-1.647-1.743-2.98l.87.49a1 1 0 0 0 .733 1.48l.14.01h10.08a1 1 0 0 0 .872-1.49l-.001-.001-5.04-8.96a1 1 0 0 0-1.742 0l-5.041 8.96-.871-.49zM12 14.003a.75.75 0 1 1 0 1.5.75.75 0 0 1 0-1.5M12 8.5c.425 0 .76.36.73.785l-.231 3.25a.5.5 0 0 1-.998 0l-.232-3.25A.733.733 0 0 1 12 8.5"},ju=({className:t,size:e=24})=>UP("svg",{className:["icon","icon--warning",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:UP("path",{clipRule:"evenodd",d:Uq[e],fill:"currentColor",fillRule:"evenodd"})});function Jq(t){let e=[];for(let o of t)if(o){let n=o.split(" \u2192 "),r=!1;for(let s=0;s<e.length;s++)if(e[s].startsWith(n[0])){e.splice(s+1,0,o),r=!0;break}r||e.push(o)}return e}function qq(t){let e=t.indexOf(":"),o=e>=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):void 0;if(!n)return{message:o};let r=n.split(",").map(s=>s.replaceAll(" > "," \u2192 ").trim());return r.length===1?{errors:r,message:`${o}: `}:{errors:Jq(r),message:`${o} (${r.length}):`}}function Sf(t){let e=Xq(5),{errorMessage:o}=t,n;e[0]!==o?(n=()=>qq(o),e[0]=o,e[1]=n):n=e[1];let[r]=Yq.useState(n),{errors:s,message:i}=r,a;return e[2]!==s||e[3]!==i?(a=XP(Zq,{children:[ku("div",{className:"toast-icon",children:ku(ju,{size:24})}),ku("div",{className:"toast-content","data-testid":"field-errors-toast",children:XP("div",{className:"toast-title",children:[i,Array.isArray(s)&&s.length>0?s.length===1?ku("span",{className:"field-error","data-testid":"field-error",children:s[0]}):ku("ul",{className:"field-errors","data-testid":"field-errors",children:s.map(Qq)}):null]})})]}),e[2]=s,e[3]=i,e[4]=a):a=e[4],a}function Qq(t,e){return ku("li",{children:t},e)}import{c as Kq}from"react/compiler-runtime";import{jsx as eQ}from"react/jsx-runtime";import ZP,{useState as tQ}from"react";var YP=ZP.createContext(null),g2=t=>{let e=Kq(6),{children:o}=t,[n,r]=tQ(oQ),s;e[0]!==n?(s=u=>{let{collectionSlug:d}=u;return n.get(d)},e[0]=n,e[1]=s):s=e[1];let i=s,a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=u=>{let{collectionSlug:d,handler:f}=u;r(m=>{let p=new Map(m);return p.set(d,f),p})},e[2]=a):a=e[2];let l=a,c;return e[3]!==o||e[4]!==i?(c=eQ(YP,{value:{getUploadHandler:i,setUploadHandler:l},children:o}),e[3]=o,e[4]=i,e[5]=c):c=e[5],c},_f=()=>{let t=ZP.use(YP);if(t===null)throw new Error("useUploadHandlers must be used within UploadHandlersProvider");return t};function oQ(){return new Map}var JP={413:"Your request was too large to submit successfully."};var d0=Ji(Yh(),1);import{dequal as sQ}from"dequal/lite";import{deepCopyObjectSimpleWithoutReactComponents as QP}from"payload/shared";import{dequal as rQ}from"dequal/lite";function nQ(t){let e=t.split("."),o=-1;for(let n=e.length-1;n>=0;n--)if(/^\d+$/.test(e[n])){o=n;break}return o===-1||o===e.length-1?null:{arrayPath:e.slice(0,o).join("."),fieldPath:e.slice(o+1).join("."),rowIndex:parseInt(e[o],10)}}var qP=({acceptValues:t,currentState:e={},incomingState:o})=>{let n={...e};for(let[r,s]of Object.entries(o||{})){if(!(r in e)&&!s.addedByServer)continue;let i=s.addedByServer||t===!0||typeof t=="object"&&t!==null&&t.overrideLocalChanges===!1&&!e[r]?.isModified;if(i&&!s.addedByServer&&t!==!0){let l=nQ(r);if(l){let{arrayPath:c,rowIndex:u}=l,d=e[c]?.rows?.[u]?.id,f=o[c]?.rows?.[u]?.id;(d===void 0||f&&d!==f)&&(i=!1)}}let a=s;if(!i){let{initialValue:l,value:c,...u}=s;a=u}n[r]={...e[r],...a},e[r]&&"errorPaths"in e[r]&&!("errorPaths"in s)&&(n[r].errorPaths=[]),Array.isArray(s.rows)&&r in e&&(t===!0?n[r].rows=s.rows.map((l,c)=>({...e[r]?.rows?.[c]||{},...l})):(n[r].rows=[...e[r]?.rows||[]],s.rows.forEach(l=>{let c=e[r].rows?.findIndex(u=>u.id===l.id);if(c>-1)n[r].rows[c]={...e[r].rows[c],...l};else if(l.addedByServer){let u={...l};delete u.addedByServer,n[r].rows.push(u)}}),"value"in s&&n[r].rows.length!==s.value&&(n[r].value=n[r].rows.length))),s.valid!==!1&&(n[r].valid=!0),s.passesCondition!==!1&&(n[r].passesCondition=!0),s.blocksFilterOptions||delete n[r].blocksFilterOptions,delete n[r].addedByServer}return rQ(n,e)?e:n};var Mu=(t,e)=>{let o={},n=Object.entries(e).reduce((r,[s,i])=>{let a=r;if(s.indexOf(`${t}.`)===0){let[l]=s.replace(`${t}.`,"").split(".");a[l]||(a[l]={}),a[l][s.replace(`${t}.${String(l)}.`,"")]={...i}}else o[s]=i;return a},[]);return{remainingFields:o,rows:n}},Bu=(t,e)=>e.reduce((o,n,r)=>({...o,...Object.entries(n).reduce((s,[i,a])=>({...s,[`${t}.${r}.${i}`]:{...a}}),{})}),{});var If="default"in d0.default?d0.default.default:d0.default;function Rf(t,e){switch(e.type){case"ADD_ROW":{let{blockType:o,path:n,rowIndex:r,subFieldState:s={}}=e,i=typeof r=="number"?r:t[n]?.rows?.length||0,a=[...t[n]?.rows||[]],l={id:s?.id?.value||new If().toHexString(),isLoading:!0};o&&(l.blockType=o),a.splice(i,0,l),o&&(s.blockType={initialValue:o,valid:!0,value:o});let{remainingFields:c,rows:u}=Mu(n,t);return u.splice(i,0,s),{...c,...Bu(n,u),[`${n}.${i}.id`]:{initialValue:l.id,passesCondition:!0,valid:!0,value:l.id},[n]:{...t[n],disableFormData:!0,rows:a,value:u.length}}}case"ADD_SERVER_ERRORS":{let o={...t},n=[];return e.errors.forEach(({message:r,path:s})=>{o[s]={...o[s]||{initialValue:null,value:null},errorMessage:r,valid:!1};let i=s.split(".");i.length>1&&n.push({fieldErrorPath:s,parentPath:i.slice(0,i.length-1).join(".")})}),o=Object.entries(o).reduce((r,[s,i])=>{let a=n.reduce((c,{fieldErrorPath:u,parentPath:d})=>(d.startsWith(s)&&c.push(u),c),[]),l=!1;if(a.length>0){let c=Array.isArray(i.errorPaths)?i.errorPaths:[];a.forEach(u=>{c.includes(u)||(c.push(u),l=!0)}),l&&(r[s]={...i,errorPaths:c})}return l||(r[s]=i),r},{}),o}case"DUPLICATE_ROW":{let{path:o,rowIndex:n}=e,{remainingFields:r,rows:s}=Mu(o,t),i=[...t[o].rows||[]],a=QP(i[n]),l=new If().toHexString();a.id&&(a.id=l),i[n]?.customComponents?.RowLabel&&(a.customComponents={RowLabel:i[n].customComponents.RowLabel});let c=QP(s[n]);c.id&&(c.id.value=l,c.id.initialValue=l);for(let d of Object.keys(c).filter(f=>f.endsWith(".id"))){let f=c[d],m=new If().toHexString();if(f&&typeof f.value=="string"&&If.isValid(f.value)){c[d].value=m,c[d].initialValue=m;let p=d.split("."),h=parseInt(p[p.length-2],10),g=p.slice(0,p.length-2).join("."),b=c?.[g]?.rows;c[g]&&Array.isArray(b)&&(b[h]?b[h].id=m:b[h]={id:m})}}return Object.keys(c).length>0&&(s.splice(n+1,0,c),i.splice(n+1,0,a)),{...r,...Bu(o,s),[o]:{...t[o],disableFormData:!0,rows:i,value:s.length}}}case"MERGE_SERVER_STATE":{let{acceptValues:o,prevStateRef:n,serverState:r}=e,s=qP({acceptValues:o,currentState:t||{},incomingState:r});return n.current=s,s}case"MOVE_ROW":{let{moveFromIndex:o,moveToIndex:n,path:r}=e,{remainingFields:s,rows:i}=Mu(r,t),a=i[o];i.splice(o,1),i.splice(n,0,a);let l=[...t[r]?.rows||[]],c={...l[o]};return l.splice(o,1),l.splice(n,0,c),{...s,...Bu(r,i),[r]:{...t[r],rows:l}}}case"REMOVE":{let o={...t};return o[e.path]&&delete o[e.path],o}case"REMOVE_ROW":{let{path:o,rowIndex:n}=e,{remainingFields:r,rows:s}=Mu(o,t),i=[...t[o]?.rows||[]];return s.splice(n,1),i.splice(n,1),{...r,[o]:{...t[o],disableFormData:s.length>0,rows:i,value:s.length},...Bu(o,s)}}case"REPLACE_ROW":{let{blockType:o,path:n,rowIndex:r,subFieldState:s={}}=e,{remainingFields:i,rows:a}=Mu(n,t),l=Math.max(0,Math.min(r,a?.length-1||0)),c=[...t[n]?.rows||[]];return c[l]={id:new If().toHexString(),blockType:o||void 0,collapsed:!1},o&&(s.blockType={initialValue:o,valid:!0,value:o}),a[l]=s,{...i,...Bu(n,a),[n]:{...t[n],disableFormData:!0,rows:c,value:a.length}}}case"REPLACE_STATE":{if(e.optimize!==!1){let o={};for(let[n,r]of Object.entries(e.state)){let s=t[n];r.valid!==!1&&(r.valid=!0),r.passesCondition!==!1&&(r.passesCondition=!0),sQ(s,r)?s&&(o[n]=s):o[n]=r}return o}if(e.sanitize)for(let o of Object.values(e.state))o.valid!==!1&&(o.valid=!0),o.passesCondition!==!1&&(o.passesCondition=!0);return e.state}case"SET_ALL_ROWS_COLLAPSED":{let{path:o,updatedRows:n}=e;return{...t,[o]:{...t[o],rows:n}}}case"SET_ROW_COLLAPSED":{let{path:o,updatedRows:n}=e;return{...t,[o]:{...t[o],rows:n}}}case"UPDATE":{let o=Object.entries(e).reduce((r,[s,i])=>["disableFormData","errorMessage","initialValue","rows","valid","validate","value"].includes(s)?{...r,[s]:i,...s==="value"?{isModified:!0}:{}}:r,t?.[e.path]||{}),n={...t,[e.path]:o};if("value"in e){for(let[r,s]of Object.entries(n))if(r!==e.path&&"isModified"in s){let{isModified:i,...a}=s;n[r]=a}}return n}case"UPDATE_MANY":{let o={...t};return Object.entries(e.formState).forEach(([n,r])=>{o[n]=r}),o}default:return t}}var iQ=()=>{},aQ=()=>{},lQ=()=>{},cQ=()=>{},uQ=()=>{},dQ=()=>{},mQ=()=>{},fQ=()=>{},pQ=()=>{},hQ=()=>{},m0={addFieldRow:()=>{},buildRowErrors:()=>{},createFormData:uQ,disabled:!1,dispatchFields:lQ,fields:{},formRef:null,getData:()=>{},getDataByPath:()=>{},getField:()=>{},getFields:()=>({}),getSiblingData:aQ,initializing:void 0,isValid:!0,moveFieldRow:()=>{},removeFieldRow:()=>{},replaceFieldRow:()=>{},replaceState:()=>{},reset:hQ,setBackgroundProcessing:fQ,setDisabled:()=>{},setIsValid:()=>{},setModified:dQ,setProcessing:mQ,setSubmitted:pQ,submit:iQ,validateForm:cQ};var wQ="form",fo=t=>{let{id:e,collectionSlug:o,docConfig:n,docPermissions:r,getDocPreferences:s,globalSlug:i}=be(),a=vQ(n),{action:l,beforeSubmit:c,children:u,className:d,disabled:f,disableSuccessStatus:m,disableValidationOnSubmit:p,el:h,handleResponse:g,initialState:b,isDocumentForm:v,isInitializing:C,onChange:y,onSubmit:x,onSuccess:w,redirect:S,submitted:_,uuid:I,waitForAutocomplete:A}=t,D="method"in t?t?.method:void 0,T=Re(),R=$c(),{code:P}=Ce(),{i18n:E,t:F}=N(),{refreshCookie:L,user:M}=ye(),$=qr(),{queueTask:B}=Hl(),{getFormState:j}=ct(),{startRouteTransition:k}=Ue(),{getUploadHandler:O}=_f(),{config:V}=G(),[H,z]=xa(f||!1),[W,U]=xa(!1),[X,Q]=xa(!1),[J,oe]=xa(!0),[Y,K]=xa(C),[ee,te]=xa(!1),[re,me]=xa(!1),we=Yl(re),Ae=Yl(!1),de=or(Ie=>{we.current=Ie,me(Ie)},[]),[xe,$e]=xa(!1),Le=or(Ie=>{we.current&&(Ae.current=!0),$e(Ie)},[]),rt=Yl(null),q=Yl({}),pe=Yl(null),fe=Yl(!0),Pe=xQ(Rf,{},()=>b),[ge,ae]=Pe;q.current.fields=ge;let Se=Yl(ge),ne=or(async()=>{let Ie={},Qe=!0,Ke=q.current.getData(),dt=Object.entries(q.current.fields).map(async([Lt,$t])=>{let $o=$t,dr=Lt?Lt.split("."):[];if($t.passesCondition!==!1){let St=$o.valid;if("validate"in $t&&typeof $t.validate=="function"){let mr=$t.value;$t?.rows&&Array.isArray($t.rows)&&(mr=q.current.getDataByPath(Lt)),St=await $t.validate(mr,{...$t,id:e,collectionSlug:o,blockData:void 0,data:R?.getData?R.getData():Ke,event:"submit",operation:$,path:dr,preferences:{},req:{payload:{config:V},t:F,user:M},siblingData:q.current.getSiblingData(Lt)}),typeof St=="string"?($o.errorMessage=St,$o.valid=!1):($o.valid=!0,$o.errorMessage=void 0)}$o.valid===!1&&(Qe=!1)}Ie[Lt]=$o});return await Promise.all(dt),KP(q.current.fields,Ie)||ae({type:"REPLACE_STATE",state:Ie}),oe(Qe),Qe},[o,V,ae,e,$,F,M,R]),Te=or(async(Ie,Qe)=>{let{acceptValues:Ke=!0,action:dt=l,context:Lt,disableFormWhileProcessing:$t=!0,disableSuccessStatus:$o,method:dr=D,overrides:St={},skipValidation:mr}=Ie||{},Er=$o??m;if(H){Qe&&Qe.preventDefault();return}let qo,as,Ui=new Promise((Yt,jo)=>{as=Yt,qo=jo}),zs=dt||typeof l=="string"||typeof l=="function";S||Er||!zs?(as=Yt=>se.success(Yt),qo=Yt=>se.error(Yt)):se.promise(Ui,{error:Yt=>Yt,loading:F("general:submitting"),success:Yt=>Yt}),Qe&&(Qe.stopPropagation(),Qe.preventDefault()),$t&&(te(!0),z(!0)),A&&await yQ(100);let un=b2(q.current.fields,!0),Wr=e7(q.current.fields,{excludeFiles:!0});if(Array.isArray(c)){let Yt;await c.reduce(async(Yi,Gs)=>{await Yi,Yt=await Gs({formState:Wr})},Promise.resolve());let jo=Object.entries(Yt).every(([,Yi])=>Yi.valid!==!1);if(oe(jo),!jo)return te(!1),Q(!0),z(!1),ae({type:"REPLACE_STATE",state:Yt})}let Xi=mr||p?!0:await q.current.validateForm();if(oe(Xi),!Xi){qo(F("error:correctInvalidFields")),te(!1),Q(!0),z(!1);return}let Zi={};if(typeof St=="function"?Zi=St(q.current.fields):typeof St=="object"&&(Zi=St),x){for(let[Yt,jo]of Object.entries(Zi))un[Yt]=jo;x(q.current.fields,un)}if(!zs){te(!1),Q(!0),z(!1);return}try{let Yt=await q.current.createFormData(Zi,{data:un,mergeOverrideData:typeof St!="function"}),jo;if(typeof dt=="string"?jo=await We[dr.toLowerCase()](dt,{body:Yt,headers:{"Accept-Language":E.language}}):typeof l=="function"&&(jo=await l(Yt)),Ae.current?Ae.current=!1:Le(!1),z(!1),typeof g=="function"){g(jo,as,qo);return}let Yi=jo.headers.get("content-type"),Gs=Yi&&Yi.indexOf("application/json")!==-1,ls={};if(Gs&&(ls=await jo.json()),jo.status<400){if(typeof w=="function"){let Ac=await w(ls,{context:Lt,formState:Wr});Ac&&ae({type:"MERGE_SERVER_STATE",acceptValues:Ke,prevStateRef:Se,serverState:Ac})}Q(!1),te(!1),S?k(()=>T.push(S)):Er||as(ls.message||F("general:submissionSuccessful"))}else{if(te(!1),Q(!0),St._status==="draft"&&(Le(!0),a||Q(!1)),q.current={...q.current},ls.message){qo(ls.message);return}if(Array.isArray(ls.errors)){let[Bd,gh]=ls.errors.reduce(([Od,Hv],Pc)=>{let Vd=[],Hd=[];return Pc?.message&&Hd.push(Pc),Array.isArray(Pc?.data?.errors)&&Pc.data?.errors.forEach(Fc=>{Fc?.path?Vd.push(Fc):Hd.push(Fc)}),[[...Od,...Vd],[...Hv,...Hd]]},[[],[]]);oe(!1),ae({type:"ADD_SERVER_ERRORS",errors:Bd}),gh.forEach(Od=>{qo(Wn(Sf,{errorMessage:Od.message||F("error:unknown")}))});return}let Ac=JP?.[jo.status]||jo?.statusText||F("error:unknown");qo(Ac)}return{formState:q.current.fields,res:jo}}catch(Yt){console.error("Error submitting form",Yt),te(!1),Q(!0),z(!1),qo(Yt.message)}},[c,k,l,m,p,H,ae,g,D,x,w,S,T,F,E,a,A,Le,Q]),he=or(()=>q.current.fields,[]),_e=or(Ie=>q.current.fields[Ie],[]),Ze=or(()=>b2(q.current.fields,!0),[]),ut=or(Ie=>bQ(q.current.fields,Ie),[]),De=or(Ie=>gQ(q.current.fields,Ie),[]),it=or(async(Ie,{data:Qe,mergeOverrideData:Ke=!0})=>{let dt=Qe||b2(q.current.fields,!0),Lt=dt?.file;if(n&&"upload"in n&&n.upload&&Lt){delete dt.file;let dr=O({collectionSlug:o});if(typeof dr=="function"){let St=Lt.name,mr=await dr({docPrefix:typeof dt?.prefix=="string"?dt.prefix:void 0,file:Lt,updateFilename:Er=>{St=Er}});Lt=JSON.stringify({clientUploadContext:mr,collectionSlug:o,filename:St,mimeType:Lt.type,size:Lt.size})}}Ke?dt={...dt,...Ie}:dt=Ie;let $t={_payload:JSON.stringify(dt)};return n&&"upload"in n&&n.upload&&Lt&&($t.file=Lt),(0,t7.serialize)($t,{indices:!0,nullsAsUndefineds:!1})},[o,n,O]),pt=or(async Ie=>{let Qe=_r(pe),Ke=await s(),{state:dt}=await j({id:e,collectionSlug:o,data:Ie,docPermissions:r,docPreferences:Ke,globalSlug:i,locale:P,operation:$,renderAllFields:!0,schemaPath:o||i,signal:Qe.signal,skipValidation:!0});q.current={...m0},Le(!1),ae({type:"REPLACE_STATE",state:dt}),pe.current=null},[o,ae,i,e,$,j,r,s,P,Le]),Vt=or(Ie=>{q.current={...m0},Le(!1),ae({type:"REPLACE_STATE",state:Ie})},[ae,Le]),Nt=or(({blockType:Ie,path:Qe,rowIndex:Ke,subFieldState:dt})=>{let Lt=De(Qe)||[],$t=Ke===void 0?Lt.length:Ke;ae({type:"ADD_ROW",blockType:Ie,path:Qe,rowIndex:$t,subFieldState:dt}),Le(!0)},[ae,De,Le]),Do=or(({moveFromIndex:Ie,moveToIndex:Qe,path:Ke})=>{ae({type:"MOVE_ROW",moveFromIndex:Ie,moveToIndex:Qe,path:Ke}),Le(!0)},[ae,Le]),Be=or(({path:Ie,rowIndex:Qe})=>{ae({type:"REMOVE_ROW",path:Ie,rowIndex:Qe}),Le(!0)},[ae,Le]),qe=or(({blockType:Ie,path:Qe,rowIndex:Ke,subFieldState:dt})=>{let Lt=De(Qe),$t=Ke===void 0?Lt.length:Ke;ae({type:"REPLACE_ROW",blockType:Ie,path:Qe,rowIndex:$t,subFieldState:dt}),Le(!0)},[ae,De,Le]);Zl(()=>{let Ie=pe.current;return()=>{Fo(Ie)}},[]),Zl(()=>{C!==void 0&&K(C)},[C]),q.current.submit=Te,q.current.getFields=he,q.current.getField=_e,q.current.getData=Ze,q.current.getSiblingData=ut,q.current.getDataByPath=De,q.current.validateForm=ne,q.current.createFormData=it,q.current.setModified=Le,q.current.setProcessing=te,q.current.setBackgroundProcessing=de,q.current.setSubmitted=Q,q.current.setIsValid=oe,q.current.disabled=H,q.current.setDisabled=z,q.current.formRef=rt,q.current.reset=pt,q.current.replaceState=Vt,q.current.dispatchFields=ae,q.current.addFieldRow=Nt,q.current.removeFieldRow=Be,q.current.moveFieldRow=Do,q.current.replaceFieldRow=qe,q.current.uuid=I,q.current.initializing=Y,q.current.isValid=J,Zl(()=>{U(!0)},[]),Zl(()=>{typeof f=="boolean"&&z(f)},[f]),Zl(()=>{typeof _=="boolean"&&Q(_)},[_]),Zl(()=>{b&&(q.current={...m0},ae({type:"REPLACE_STATE",optimize:!1,sanitize:!0,state:b}))},[b,ae]),pl(()=>{L()},15e3,[ge]);let ce=et(()=>{q.current={...q.current},Le(!1)});Zl(()=>{ce()},[P]);let ze=[d,wQ].filter(Boolean).join(" "),He=et(Ie=>{B(async()=>{if(Array.isArray(y)){let Qe;for(let Ke of y)Qe=await Ke({formState:e7(ge,{excludeFiles:!0}),submitted:Ie});ae({type:"MERGE_SERVER_STATE",prevStateRef:Se,serverState:Qe})}})});Vm(()=>{(fe.current||!KP(ge,Se.current))&&xe&&He(X),Se.current=ge,fe.current=!1},[xe,X,ge],250);let at=v?Ih:CQ.Fragment,Ye=v?{value:q.current}:{};return Wn(h||"form",{action:typeof l=="function"?void 0:l,className:ze,"data-form-ready":!ee&&W&&!Y,method:D,noValidate:!0,onSubmit:Ie=>{q.current.submit({},Ie)},ref:rt,children:Wn(at,{...Ye,children:Wn(_h,{value:q.current,children:Wn(Rh,{value:{fields:ge,...q.current},children:Wn(Th,{value:X,children:Wn(ay,{value:!W||W&&Y,children:Wn(Dh,{value:ee,children:Wn(iy,{value:re,children:Wn(Ah,{value:xe,children:Wn(qd.Provider,{value:Pe,children:u})})})})})})})})})})};import{c as SQ}from"react/compiler-runtime";import{jsx as o7,jsxs as r7}from"react/jsx-runtime";import{getTranslation as _Q}from"@payloadcms/translations";import{tabHasName as n7}from"payload/shared";import IQ,{useState as RQ}from"react";var s7="tabs-field__tab-button",v2=t=>{let e=SQ(9),{hidden:o,isActive:n,parentPath:r,setIsActive:s,tab:i}=t,{i18n:a}=N(),l=Xs(),[c,u]=RQ(void 0),d;if(e[0]!==c||e[1]!==o||e[2]!==a||e[3]!==n||e[4]!==l||e[5]!==r||e[6]!==s||e[7]!==i){let f=[...r?r.split(".").slice(0,-1):[],...n7(i)?[i.name]:[]],m=c>0;d=r7(IQ.Fragment,{children:[o7(_l,{fields:i.fields,path:f,setErrorCount:u}),r7(c0,{className:s7,disabled:l,hasError:m,hidden:o,isActive:n,modifierClassName:s7,onClick:s,children:[i.label?_Q(i.label,a):n7(i)?i.name:"",m&&o7(yo,{count:c,i18n:a})]})]}),e[0]=c,e[1]=o,e[2]=a,e[3]=n,e[4]=l,e[5]=r,e[6]=s,e[7]=i,e[8]=d}else d=e[8];return d};var Ci="tabs-field";var FQ=t=>{let e=a7(45),{field:o,forceRender:n,indexPath:r,parentPath:s,parentSchemaPath:i,path:a,permissions:l,readOnly:c,schemaPath:u}=t,{admin:d,tabs:f}=o,m;e[0]!==d?(m=d===void 0?{}:d,e[0]=d,e[1]=m):m=e[1];let{className:p}=m,h;e[2]!==f?(h=f===void 0?[]:f,e[2]=f,e[3]=h):h=e[3];let g=h,b=n===void 0?!1:n,v=r===void 0?"":r,C=s===void 0?"":s,y=i===void 0?"":i,x=a===void 0?"":a,w=u===void 0?"":u,{getPreference:S,setPreference:_}=Jt(),{preferencesKey:I}=be(),{i18n:A}=N(),{isWithinCollapsible:D}=ra(),T;e[4]!==g?(T=Y=>{let[K]=Y;return g.map((ee,te)=>{let re=ee?.id;return{index:te,passesCondition:K?.[re]?.passesCondition??!0,tab:ee}})},e[4]=g,e[5]=T):T=e[5];let R=Ht(T),P;e[6]!==R?(P=()=>R.filter(EQ)?.[0]?.index??0,e[6]=R,e[7]=P):P=e[7];let[E,F]=PQ(P),L=`tabs-${v}`,M=R[E],$=M?.tab,B=$?.admin?.description??$?.description,j=typeof B=="function"?B({i18n:A,t:A.t}):B,k=R.some(LQ),O;e[8]!==S||e[9]!==x||e[10]!==I||e[11]!==_||e[12]!==L?(O=async Y=>{F(Y);let K=await S(I);I&&_(I,{...K,...x?{fields:{...K?.fields||{},[x]:{...K?.fields?.[x],tabIndex:Y}}}:{fields:{...K?.fields,[L]:{...K?.fields?.[L],tabIndex:Y}}}})},e[8]=S,e[9]=x,e[10]=I,e[11]=_,e[12]=L,e[13]=O):O=e[13];let V=O,H;e[14]!==S||e[15]!==x||e[16]!==I||e[17]!==R.length||e[18]!==L?(H=()=>{I&&(async()=>{let K=await S(I),ee=x?K?.fields?.[x]?.tabIndex:K?.fields?.[L]?.tabIndex,te=typeof ee=="number"&&ee<R.length?ee:0;F(te)})()},e[14]=S,e[15]=x,e[16]=I,e[17]=R.length,e[18]=L,e[19]=H):H=e[19];let z;e[20]!==S||e[21]!==C||e[22]!==y||e[23]!==x||e[24]!==I||e[25]!==R.length||e[26]!==g||e[27]!==L?(z=[x,S,I,L,g,C,y,R.length],e[20]=S,e[21]=C,e[22]=y,e[23]=x,e[24]=I,e[25]=R.length,e[26]=g,e[27]=L,e[28]=z):z=e[28],i7(H,z);let W;e[29]!==M?.passesCondition||e[30]!==V||e[31]!==R?(W=()=>{if(M?.passesCondition===!1){let Y=R.find($Q);Y&&V(Y.index)}},e[29]=M?.passesCondition,e[30]=V,e[31]=R,e[32]=W):W=e[32];let U;e[33]!==M||e[34]!==V||e[35]!==R?(U=[M,R,V],e[33]=M,e[34]=V,e[35]=R,e[36]=U):U=e[36],i7(W,U);let X=D&&`${Ci}--within-collapsible`,Q=!k&&`${Ci}--hidden`,J;e[37]!==p||e[38]!==X||e[39]!==Q?(J=[Ee,p,Ci,X,Q].filter(Boolean),e[37]=p,e[38]=X,e[39]=Q,e[40]=J):J=e[40];let oe;return e[41]!==E||e[42]!==V||e[43]!==x?(oe=Y=>{let{index:K,passesCondition:ee,tab:te}=Y;return wa(v2,{hidden:!ee,isActive:E===K,parentPath:x,setIsActive:()=>{V(K)},tab:te},K)},e[41]=E,e[42]=V,e[43]=x,e[44]=oe):oe=e[44],wa("div",{className:J.join(" "),children:l7(ux,{children:[wa(l0,{tabsClassName:`${Ci}__tabs`,tabsWrapClassName:`${Ci}__tabs-wrap`,children:R.map(oe)}),wa("div",{className:`${Ci}__content-wrap`,children:$&&wa(NQ,{description:j,field:$,forceRender:b,hidden:!1,parentIndexPath:v,parentPath:x,parentSchemaPath:w,path:x,permissions:l&&typeof l=="object"&&"name"in $?l[$.name]&&typeof l[$.name]=="object"&&"fields"in l[$.name]?l[$.name].fields:l[$.name]:l,readOnly:c,tabIndex:E})})]})})},Tf=Je(FQ);function NQ(t){let e=a7(21),{description:o,field:n,forceRender:r,hidden:s,label:i,parentIndexPath:a,parentPath:l,parentSchemaPath:c,permissions:u,readOnly:d,tabIndex:f}=t,{i18n:m}=N(),{customComponents:p}=Ne(),h,g;if(e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s||e[4]!==m||e[5]!==i||e[6]!==a||e[7]!==l||e[8]!==c||e[9]!==u||e[10]!==d||e[11]!==p||e[12]!==f){g=Symbol.for("react.early_return_sentinel");e:{let{AfterInput:b,BeforeInput:v,Description:C,Field:y}=p===void 0?{}:p;if(y){g=y;break e}let{indexPath:x,path:w,schemaPath:S}=DQ({field:n,index:f,parentIndexPath:a,parentPath:l,parentSchemaPath:c}),_=s&&`${Ci}__tab--hidden`,I;e[15]!==m||e[16]!==i?(I=i&&`${Ci}__tabConfigLabel-${AQ(TQ(i,m))}`,e[15]=m,e[16]=i,e[17]=I):I=e[17];let A;e[18]!==_||e[19]!==I?(A=[_,`${Ci}__tab`,I].filter(Boolean),e[18]=_,e[19]=I,e[20]=A):A=e[20],h=l7("div",{className:A.join(" "),children:[wa(le,{CustomComponent:C,Fallback:wa(Xe,{description:o,marginPlacement:"bottom",path:l})}),v,wa(co,{fields:n.fields,forceRender:r,parentIndexPath:x,parentPath:w,parentSchemaPath:S,permissions:u,readOnly:d}),b]})}e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=m,e[5]=i,e[6]=a,e[7]=l,e[8]=c,e[9]=u,e[10]=d,e[11]=p,e[12]=f,e[13]=h,e[14]=g}else h=e[13],g=e[14];return g!==Symbol.for("react.early_return_sentinel")?g:h}function EQ(t){let{passesCondition:e}=t;return e}function LQ(t){let{passesCondition:e}=t;return e}function $Q(t){let{passesCondition:e}=t;return e}import{jsx as OQ}from"react/jsx-runtime";import{useCallback as u7,useEffect as VQ,useMemo as HQ,useState as zQ}from"react";import{c as jQ}from"react/compiler-runtime";import{jsx as Sa,jsxs as c7}from"react/jsx-runtime";import{getTranslation as kQ}from"@payloadcms/translations";import"react";var Df=t=>{let e=jQ(32),{AfterInput:o,BeforeInput:n,className:r,Description:s,description:i,Error:a,hasMany:l,htmlAttributes:c,inputRef:u,Label:d,label:f,localized:m,maxRows:p,onChange:h,onKeyDown:g,path:b,placeholder:v,readOnly:C,required:y,rtl:x,showError:w,style:S,value:_,valueToRender:I}=t,{i18n:A,t:D}=N(),T=BQ,R;if(e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==a||e[4]!==d||e[5]!==r||e[6]!==i||e[7]!==l||e[8]!==c||e[9]!==A||e[10]!==u||e[11]!==f||e[12]!==m||e[13]!==p||e[14]!==h||e[15]!==g||e[16]!==b||e[17]!==v||e[18]!==C||e[19]!==y||e[20]!==x||e[21]!==w||e[22]!==S||e[23]!==D||e[24]!==_||e[25]!==I){let P=kQ(v,A),E=w&&"error",F=C&&"read-only",L=l&&"has-many",M;e[27]!==r||e[28]!==E||e[29]!==F||e[30]!==L?(M=[Ee,"text",r,E,F,L].filter(Boolean),e[27]=r,e[28]=E,e[29]=F,e[30]=L,e[31]=M):M=e[31],R=c7("div",{className:M.join(" "),style:S,children:[Sa(le,{CustomComponent:d,Fallback:Sa(Fe,{label:f,localized:m,path:b,required:y})}),c7("div",{className:`${Ee}__wrap`,children:[Sa(le,{CustomComponent:a,Fallback:Sa(tt,{path:b,showError:w})}),n,l?Sa(mt,{className:`field-${b.replace(/\./g,"__")}`,components:{DropdownIndicator:null},customProps:{editableProps:T},disabled:C,filterOption:()=>p?!(Array.isArray(_)&&p&&_.length>=p):!0,isClearable:!1,isCreatable:!0,isMulti:!0,isSortable:!0,menuIsOpen:!1,noOptionsMessage:()=>Array.isArray(_)&&_.length>=p?D("validation:limitReached",{max:p,value:_.length+1}):null,onChange:h,options:[],placeholder:P,showError:w,value:I}):Sa("input",{className:"form-input","data-rtl":x,disabled:C,id:`field-${b?.replace(/\./g,"__")}`,name:b,onChange:h,onKeyDown:g,placeholder:P,ref:u,type:"text",value:_||"",...c??{}}),o,Sa(le,{CustomComponent:s,Fallback:Sa(Xe,{description:i,path:b})})]})]}),e[0]=o,e[1]=n,e[2]=s,e[3]=a,e[4]=d,e[5]=r,e[6]=i,e[7]=l,e[8]=c,e[9]=A,e[10]=u,e[11]=f,e[12]=m,e[13]=p,e[14]=h,e[15]=g,e[16]=b,e[17]=v,e[18]=C,e[19]=y,e[20]=x,e[21]=w,e[22]=S,e[23]=D,e[24]=_,e[25]=I,e[26]=R}else R=e[26];return R};function MQ(t){t.currentTarget.contentEditable="false"}function BQ(t,e,o){let n=`${e}--editable`;return{onBlur:MQ,onClick:r=>{r.currentTarget.contentEditable="true",r.currentTarget.classList.add(n),r.currentTarget.focus()},onKeyDown:r=>{if(!r.nativeEvent.isComposing&&(r.key==="Enter"||r.key==="Tab"||r.key==="Escape")){if(r.currentTarget.contentEditable="false",r.currentTarget.classList.remove(n),t.value.value=r.currentTarget.innerText,t.label=r.currentTarget.innerText,t.value.value.replaceAll(`
54
- `,""))o.onChange(o.value,{action:"create-option",option:t});else if(Array.isArray(o.value)){let s=o.value.filter(i=>i.id!==t.id);o.onChange(s,{action:"pop-value",removedValue:t})}r.preventDefault()}r.stopPropagation()}}}var GQ=t=>{let{field:e,field:{admin:{autoComplete:o,className:n,description:r,placeholder:s,rtl:i}={},hasMany:a,label:l,localized:c,maxLength:u,maxRows:d,minLength:f,minRows:m,required:p},inputRef:h,path:g,readOnly:b,validate:v}=t,C=Ce(),{config:{localization:y}}=G(),x=u7((j,k)=>{if(typeof v=="function")return v(j,{...k,maxLength:u,minLength:f,required:p})},[v,f,u,p]),{customComponents:{AfterInput:w,BeforeInput:S,Description:_,Error:I,Label:A}={},disabled:D,path:T,setValue:R,showError:P,value:E}=Ne({potentiallyStalePath:g,validate:x}),F=yl({fieldLocalized:c,fieldRTL:i,locale:C,localizationConfig:y||void 0}),[L,M]=zQ([]),$=u7(j=>{if(!(b||D)){let k;j?Array.isArray(j)?k=j.map(O=>O.value?.value||O.value):k=[j.value?.value||j.value]:k=[],R(k)}},[b,R,D]);VQ(()=>{a&&Array.isArray(E)&&M(E.map((j,k)=>({id:`${j}${k}`,label:`${j}`,value:{toString:()=>`${j}${k}`,value:j?.value||j}})))},[E,a]);let B=HQ(()=>st(e),[e]);return OQ(Df,{AfterInput:w,BeforeInput:S,className:n,Description:_,description:r,Error:I,hasMany:a,htmlAttributes:{autoComplete:o||void 0},inputRef:h,Label:A,label:l,localized:c,maxRows:d,minRows:m,onChange:a?$:j=>{R(j.target.value)},path:T,placeholder:s,readOnly:b||D,required:p,rtl:F,showError:P,style:B,value:E||"",valueToRender:L})},Cn=Je(GQ);import{jsx as XQ}from"react/jsx-runtime";import{getTranslation as ZQ}from"@payloadcms/translations";import{useCallback as YQ,useMemo as JQ}from"react";import{c as WQ}from"react/compiler-runtime";import{jsx as _a,jsxs as d7}from"react/jsx-runtime";import{getTranslation as UQ}from"@payloadcms/translations";import"react";var y2=t=>{let e=WQ(26),{AfterInput:o,BeforeInput:n,className:r,Description:s,description:i,Error:a,Label:l,label:c,localized:u,onChange:d,path:f,placeholder:m,readOnly:p,required:h,rows:g,rtl:b,showError:v,style:C,value:y}=t,{i18n:x}=N(),w=v&&"error",S=p&&"read-only",_;e[0]!==r||e[1]!==w||e[2]!==S?(_=[Ee,"textarea",r,w,S].filter(Boolean),e[0]=r,e[1]=w,e[2]=S,e[3]=_):_=e[3];let I=_.join(" "),A=`field-${f.replace(/\./g,"__")}`,D;return e[4]!==o||e[5]!==n||e[6]!==s||e[7]!==a||e[8]!==l||e[9]!==i||e[10]!==x||e[11]!==c||e[12]!==u||e[13]!==d||e[14]!==f||e[15]!==m||e[16]!==p||e[17]!==h||e[18]!==g||e[19]!==b||e[20]!==v||e[21]!==C||e[22]!==I||e[23]!==A||e[24]!==y?(D=d7("div",{className:I,style:C,children:[_a(le,{CustomComponent:l,Fallback:_a(Fe,{htmlFor:A,label:c,localized:u,path:f,required:h})}),d7("div",{className:`${Ee}__wrap`,children:[_a(le,{CustomComponent:a,Fallback:_a(tt,{path:f,showError:v})}),n,_a("div",{className:"textarea-outer",children:_a("textarea",{className:"form-input","data-rtl":b,disabled:p,id:`field-${f.replace(/\./g,"__")}`,name:f,onChange:d,placeholder:UQ(m,x),rows:g,style:{"--rows":g},value:y||""})}),o,_a(le,{CustomComponent:s,Fallback:_a(Xe,{description:i,path:f})})]})]}),e[4]=o,e[5]=n,e[6]=s,e[7]=a,e[8]=l,e[9]=i,e[10]=x,e[11]=c,e[12]=u,e[13]=d,e[14]=f,e[15]=m,e[16]=p,e[17]=h,e[18]=g,e[19]=b,e[20]=v,e[21]=C,e[22]=I,e[23]=A,e[24]=y,e[25]=D):D=e[25],D};var qQ=t=>{let{field:e,field:{admin:{className:o,description:n,placeholder:r,rows:s,rtl:i}={},label:a,localized:l,maxLength:c,minLength:u,required:d},path:f,readOnly:m,validate:p}=t,{i18n:h}=N(),{config:{localization:g}}=G(),b=Ce(),v=yl({fieldLocalized:l,fieldRTL:i,locale:b,localizationConfig:g||void 0}),C=YQ((E,F)=>{if(typeof p=="function")return p(E,{...F,maxLength:c,minLength:u,required:d})},[p,d,c,u]),{customComponents:{AfterInput:y,BeforeInput:x,Description:w,Error:S,Label:_}={},disabled:I,path:A,setValue:D,showError:T,value:R}=Ne({potentiallyStalePath:f,validate:C}),P=JQ(()=>st(e),[e]);return XQ(y2,{AfterInput:y,BeforeInput:x,className:o,Description:w,description:n,Error:S,Label:_,label:a,localized:l,onChange:E=>{D(E.target.value)},path:A,placeholder:ZQ(r,h),readOnly:m||I,required:d,rows:s,rtl:v,showError:T,style:P,value:R})},Af=Je(qQ);var Pf=()=>null;import{jsx as IF}from"react/jsx-runtime";import RF,{useMemo as Vee}from"react";import{c as hF}from"react/compiler-runtime";import{jsx as Si,jsxs as yee}from"react/jsx-runtime";import{validateMimeType as Cee}from"payload/shared";import Hr,{useEffect as xee}from"react";import{c as QQ}from"react/compiler-runtime";import{jsx as KQ}from"react/jsx-runtime";import{createContext as eK,use as tK,useState as C2}from"react";var m7=eK(void 0),Ou=t=>{let e=QQ(5),{children:o}=t,[n,r]=C2(null),[s,i]=C2(""),[a,l]=C2(null),c;return e[0]!==o||e[1]!==a||e[2]!==n||e[3]!==s?(c=KQ(m7,{value:{setUploadControlFile:l,setUploadControlFileName:r,setUploadControlFileUrl:i,uploadControlFile:a,uploadControlFileName:n,uploadControlFileUrl:s},children:o}),e[0]=o,e[1]=a,e[2]=n,e[3]=s,e[4]=c):c=e[4],c},x2=()=>{let t=tK(m7);if(!t)throw new Error("useUploadControls must be used within an UploadControlsProvider");return t};import{jsx as f0,jsxs as _2}from"react/jsx-runtime";import iK from"react";import{jsx as oK}from"react/jsx-runtime";import Ia from"react";var f7=t=>{t.preventDefault(),t.stopPropagation()},w2="dropzone";function Jl({children:t,className:e,disabled:o=!1,dropzoneStyle:n="default",hasError:r=!1,multipleFiles:s,onChange:i}){let a=Ia.useRef(null),[l,c]=Ia.useState(!1),u=Ia.useCallback(g=>{if(!s&&g.length>1){let b=new DataTransfer;b.items.add(g[0]),i(b.files)}else i(g)},[s,i]),d=Ia.useCallback(g=>{g.preventDefault(),g.stopPropagation(),g.clipboardData.files&&g.clipboardData.files.length>0&&u(g.clipboardData.files)},[u]),f=Ia.useCallback(g=>{g.preventDefault(),g.stopPropagation(),c(!0)},[]),m=Ia.useCallback(g=>{g.preventDefault(),g.stopPropagation(),c(!1)},[]),p=Ia.useCallback(g=>{if(g.preventDefault(),g.stopPropagation(),c(!1),g.dataTransfer.files&&g.dataTransfer.files.length>0){u(g.dataTransfer.files),c(!1);try{g.dataTransfer.clearData()}catch{}}},[u]);Ia.useEffect(()=>{let g=a.current;return g&&!o?(g.addEventListener("dragenter",f),g.addEventListener("dragleave",m),g.addEventListener("dragover",f7),g.addEventListener("drop",p),g.addEventListener("paste",d),()=>{g.removeEventListener("dragenter",f),g.removeEventListener("dragleave",m),g.removeEventListener("dragover",f7),g.removeEventListener("drop",p),g.removeEventListener("paste",d)}):()=>null},[o,f,m,p,d]);let h=[w2,e,l?"dragging":"",r&&`${w2}--has-error`,`${w2}--style-${n}`].filter(Boolean).join(" ");return oK("div",{className:h,ref:a,tabIndex:n==="none"?void 0:0,children:t})}import{c as rK}from"react/compiler-runtime";import{jsx as S2,jsxs as nK}from"react/jsx-runtime";import"react";var sK="bulk-upload--drawer-header";function Ra(t){let e=rK(4),{onClose:o,title:n}=t,{t:r}=N(),s;return e[0]!==o||e[1]!==r||e[2]!==n?(s=nK("div",{className:sK,children:[S2(Z,{"aria-label":r("general:close"),buttonStyle:"ghost",icon:S2(ve,{direction:"left",size:24}),onClick:o}),S2("h2",{title:n,children:n})]}),e[0]=o,e[1]=r,e[2]=n,e[3]=s):s=e[3],s}var p0="bulk-upload--add-files";function h0({acceptMimeTypes:t,onCancel:e,onDrop:o}){let{t:n}=N(),r=iK.useRef(null);return _2("div",{className:p0,children:[f0(Ra,{onClose:e,title:n("upload:addFiles")}),f0("div",{className:`${p0}__dropArea`,children:_2(Jl,{multipleFiles:!0,onChange:o,children:[f0(Z,{buttonStyle:"primary",iconPosition:"left",onClick:()=>{r.current&&r.current.click()},size:"medium",children:n("upload:selectFile")}),f0("input",{accept:t,"aria-hidden":"true",className:`${p0}__hidden-input`,hidden:!0,multiple:!0,onChange:s=>{s.target.files&&s.target.files.length>0&&o(s.target.files)},ref:r,type:"file"}),_2("p",{className:`${p0}__dragAndDropText`,children:[n("general:or")," ",n("upload:dragAndDrop")]})]})})]})}import{c as gee}from"react/compiler-runtime";import{jsx as Wf,jsxs as j2}from"react/jsx-runtime";import{getTranslation as bee}from"@payloadcms/translations";import{reduceFieldsToValues as vee}from"payload/shared";import"react";import{c as A7}from"react/compiler-runtime";import{jsx as Zn,jsxs as zu}from"react/jsx-runtime";import"react";import{c as IK}from"react/compiler-runtime";import{jsx as C0,jsxs as RK}from"react/jsx-runtime";import"react";import{jsx as b7,jsxs as lK}from"react/jsx-runtime";import{formatAdminURL as cK}from"payload/shared";import*as g0 from"qs-esm";import Dt from"react";var p7=Ji(h2(),1);import{reduceFieldsToValues as aK}from"payload/shared";async function h7(t={},e={},o,n){let r=aK(t,!0),s=r?.file;if(s&&delete r.file,s&&typeof n=="function"){let l=s.name,c=await n({docPrefix:typeof r?.prefix=="string"?r.prefix:void 0,file:s,updateFilename:u=>{l=u}});s=JSON.stringify({clientUploadContext:c,collectionSlug:o,filename:l,mimeType:s.type,size:s.size})}let i={...r,...e},a={_payload:JSON.stringify(i),file:s};return(0,p7.serialize)(a,{indices:!0,nullsAsUndefineds:!1})}function g7(t,e){switch(e.type){case"ADD_FORMS":{let o=[];for(let n=0;n<e.forms.length;n++)o[n]={errorCount:0,formID:e.forms[n].formID??(crypto.randomUUID?crypto.randomUUID():Qr()),formState:{...e.forms[n].initialState||{},file:{initialValue:e.forms[n].file,valid:!0,value:e.forms[n].file}},uploadEdits:{}};return{...t,activeIndex:0,forms:[...o,...t.forms]}}case"REMOVE_FORM":{let o=[...t.forms],[n]=o.splice(e.index,1),r=t.activeIndex>=e.index,s=t.activeIndex===e.index?e.index:r?t.activeIndex-1:t.activeIndex,i=Math.min(o.length-1,s);return{...t,activeIndex:r?i:t.activeIndex,forms:o,totalErrorCount:t.totalErrorCount-n.errorCount}}case"REPLACE":return{...t,...e.state};case"SET_ACTIVE_INDEX":return{...t,activeIndex:e.index};case"UPDATE_ERROR_COUNT":{let o=[...t.forms];return o[e.index].errorCount=e.count,{...t,forms:o,totalErrorCount:o.reduce((n,r)=>n+r.errorCount,0)}}case"UPDATE_FORM":{let o=[...t.forms];return o[e.index].errorCount=e.errorCount,o[e.index]={...o[e.index],formState:{...o[e.index].formState,...e.formState},uploadEdits:{...o[e.index].uploadEdits,...e.uploadEdits}},{...t,forms:o,totalErrorCount:o.reduce((n,r)=>n+r.errorCount,0)}}default:return t}}var v7=Dt.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:()=>{}}),uK={activeIndex:0,forms:[],totalErrorCount:0};function y7({children:t}){let{config:e,getEntityConfig:o}=G(),{routes:{api:n}}=e,{code:r}=Ce(),{i18n:s,t:i}=N(),{getDocumentSlots:a,getFormState:l}=ct(),{getUploadHandler:c}=_f(),[u,d]=Dt.useState({}),[f,m]=Dt.useState(!1),[p,h]=Dt.useState(),[g,b]=Dt.useState(!1),[v,C]=Dt.useState(!1),[y,x]=Dt.useState(!1),[w,S]=Dt.useState(!1),[_,I]=Dt.useState(!1),[A,D]=Dt.useReducer(g7,uK),{activeIndex:T,forms:R,totalErrorCount:P}=A,E=Dt.useRef(R);E.current=R;let{toggleLoadingOverlay:F}=_g(),{closeModal:L}=ie(),{collectionSlug:M,drawerSlug:$,initialFiles:B,initialForms:j,onSuccess:k,parentID:O,setInitialFiles:V,setInitialForms:H,setSuccessfullyUploaded:z}=nr(),W=o({collectionSlug:M}),U=W?.hierarchy?W.hierarchy.parentFieldName:void 0,[X,Q]=Dt.useState(!1),[J,oe]=Dt.useState(""),Y=Dt.useRef(!1),K=Dt.useRef(null),ee=Dt.useRef(()=>({})),te=cK({apiRoute:n,path:""}),re=`${te}/${M}`,me=Dt.useCallback(async()=>{let ae={locale:r||void 0},Se=`/${M}/access`,Te=await(await fetch(`${te}${Se}?${g0.stringify(ae)}`,{credentials:"include",headers:{"Accept-Language":s.language,"Content-Type":"application/json"},method:"POST"})).json(),he=await fetch(`${te}${Se}?${g0.stringify(ae)}`,{body:JSON.stringify({_status:"published"}),credentials:"include",headers:{"Accept-Language":s.language,"Content-Type":"application/json"},method:"POST"}).then(_e=>_e.json());h(Te),b(fm({collectionSlug:M,docPermissions:Te,isEditing:!1})),C(he?.update),S(!0)},[te,r,M,s.language]),we=Dt.useCallback(async ae=>{ae?.signal&&ae.abort("aborting previous fetch for initial form state without files");let Se=await a({collectionSlug:M});d(Se);try{let{state:ne}=await l({collectionSlug:M,docPermissions:p,docPreferences:{fields:{}},locale:r,operation:"create",renderAllFields:!0,schemaPath:M,skipValidation:!0});U&&ne?.[U]&&(ne[U]={...ne[U],customComponents:{...ne[U].customComponents,Field:void 0}}),K.current=ne,x(!0)}catch{}},[a,M,l,p,r,U]),Ae=Dt.useCallback(ae=>{let Se=ee.current();D({type:"REPLACE",state:{activeIndex:ae,forms:R.map((ne,Te)=>Te===T?{errorCount:ne.errorCount,formID:ne.formID,formState:Se,uploadEdits:ne.uploadEdits}:ne)}})},[R,T]),de=Dt.useCallback(ae=>O&&U&&ae?.[U]?{...ae,[U]:{...ae[U],initialValue:O,value:O}}:ae,[O,U]),xe=Dt.useCallback(async ae=>{R.length&&D({type:"UPDATE_FORM",errorCount:R[T].errorCount,formState:ee.current(),index:T}),F({isLoading:!0,key:"addingDocs"}),y||await we(),D({type:"ADD_FORMS",forms:Array.from(ae).map(Se=>({file:Se,initialState:de(K.current)}))}),F({isLoading:!1,key:"addingDocs"})},[we,y,F,T,R,de]),$e=et(xe),Le=et(async ae=>{F({isLoading:!0,key:"addingDocs"}),y||await we(),D({type:"ADD_FORMS",forms:ae.map(Se=>({...Se,initialState:de(Se?.initialState||K.current)}))}),F({isLoading:!1,key:"addingDocs"})}),rt=Dt.useCallback(ae=>{D({type:"REMOVE_FORM",index:ae})},[]),q=Dt.useCallback(({errorCount:ae,index:Se})=>{D({type:"UPDATE_ERROR_COUNT",count:ae,index:Se})},[]),pe=Dt.useCallback(async({overrides:ae}={})=>{let Se=ee.current(),ne=[...R];ne[T]={errorCount:ne[T].errorCount,formID:ne[T].formID,formState:Se,uploadEdits:ne[T].uploadEdits};let Te=ne[T]?.formID,he=[];Q(!0);for(let De=0;De<ne.length;De++)try{let it=ne[De],pt=it.formState?.file?.value;oe(i("general:uploadingBulk",{current:De+1,total:ne.length}));let Vt=`${re}${g0.stringify({locale:r,uploadEdits:it?.uploadEdits||void 0},{addQueryPrefix:!0})}`,Nt=await fetch(Vt,{body:await h7(it.formState,ae,M,c({collectionSlug:M})),credentials:"include",method:"POST"}),Do=await Nt.json(),Be=Nt.status===201&&Do?.doc;Be&&he.push({collectionSlug:M,doc:Do.doc,formID:it.formID});let[qe,ce]=(Do?.errors||[]).reduce(([Ye,ot],Ie)=>{let Qe=[],Ke=[];return Ie?.message&&Ke.push(Ie),Array.isArray(Ie?.data?.errors)&&Ie.data?.errors.forEach(dt=>{dt?.path?Qe.push(dt):Ke.push(dt)}),[[...Ye,...Qe],[...ot,...Ke]]},[[],[]]),ze=!pt&&Nt.status===400,He=pt&&Nt.status===413,at=pt&&typeof pt=="object"&&"name"in pt&&(!pt.name||pt.name==="");if(ze||He||at){ne[De].formState.file.valid=!1;let Ye=ne[De].formState.file?.value,ot={...ne[De].formState};Ye instanceof File&&(ot.file={...ot.file,value:{name:Ye.name}});let{state:Ie}=await l({collectionSlug:M,docPermissions:p,docPreferences:null,formState:ot,operation:"update",schemaPath:M});Ie&&(Ye instanceof File&&Ie.file&&(Ie.file={...Ie.file,value:Ye}),ne[De]={errorCount:Object.values(Ie).reduce((Qe,Ke)=>Ke?.valid===!1?Qe+1:Qe,0),formID:ne[De].formID,formState:Ie}),se.error(ce[0]?.message)}else{let Ye=qe.length;!Be&&Ye===0&&(Ye=ce.length||1),ne[De]={errorCount:Ye,formID:ne[De].formID,formState:Rf(ne[De].formState,{type:"ADD_SERVER_ERRORS",errors:qe})},Be||ce.forEach(ot=>{se.error(b7(Sf,{errorMessage:ot.message||i("error:unknown")}))})}}catch{}m(!0),oe(""),Q(!1);let _e=[];ne.forEach(({errorCount:De},it)=>{De&&_e.push(ne[it])});let Ze=Math.max(0,ne.length-_e.length),ut=ne.length-Ze;Ze&&(se.success(`Successfully saved ${Ze} files`),z(!0),typeof k=="function"&&k(he,ut)),ut?se.error(`Failed to save ${ut} files`):L($),D({type:"REPLACE",state:{activeIndex:_e.reduce((De,{formID:it},pt)=>it===Te?pt:De,0),forms:_e,totalErrorCount:_e.reduce((De,{errorCount:it})=>De+it,0)}}),_e.length===0&&(V(void 0),H(void 0))},[R,T,i,re,r,M,c,l,p,z,k,L,$,V,H]),fe=Dt.useCallback(async(ae,Se)=>{for(let ne=0;ne<R.length;ne++)if(Object.entries(ae).forEach(([Te,he])=>{R[ne].formState[Te]&&(R[ne].formState[Te].value=he,D({type:"UPDATE_FORM",errorCount:R[ne].errorCount,formState:R[ne].formState,index:ne}))}),typeof Se=="function"&&Se(),f){let{state:Te}=await l({collectionSlug:M,docPermissions:p,docPreferences:null,formState:R[ne].formState,operation:"create",schemaPath:M}),he=Object.values(Te).reduce((_e,Ze)=>Ze?.valid===!1?_e+1:_e,0);D({type:"UPDATE_FORM",errorCount:he,formState:Te,index:ne})}},[M,p,R,l,f]),Pe=Dt.useCallback(ae=>{D({type:"UPDATE_FORM",errorCount:R[T].errorCount,formState:R[T].formState,index:T,uploadEdits:ae})},[T,R]),ge=Dt.useCallback(()=>{D({type:"REPLACE",state:{forms:R.map(ae=>({...ae,uploadEdits:{}}))}})},[R]);return Dt.useEffect(()=>{M&&(y||we(),w||me(),(B||j)&&I(!y||!w),y&&(j?.length||B?.length)&&!Y.current&&(j?.length&&Le(j),B?.length&&$e(B),Y.current=!0))},[B,we,me,M,y,w,j]),lK(v7,{value:{activeIndex:A.activeIndex,addFiles:xe,bulkUpdateForm:fe,collectionSlug:M,docPermissions:p,documentSlots:u,forms:R,getFormDataRef:ee,hasPublishPermission:v,hasSavePermission:g,hasSubmitted:f,isInitializing:_,removeFile:rt,resetUploadEdits:ge,saveAllDocs:pe,setActiveIndex:Ae,setFormTotalErrorCount:q,totalErrorCount:P,updateUploadEdits:Pe},children:[X&&b7(en,{animationDuration:"250ms",loadingText:J,overlayType:"fullscreen",show:!0}),t]})}function rr(){return Dt.use(v7)}import{jsx as Un,jsxs as I2}from"react/jsx-runtime";import{getTranslation as xK}from"@payloadcms/translations";import{unflatten as I7}from"payload/shared";import wK,{useCallback as R2,useEffect as SK,useMemo as _K,useState as R7}from"react";import{c as gK}from"react/compiler-runtime";import{jsx as _7,jsxs as bK}from"react/jsx-runtime";import{useState as vK}from"react";var C7=t=>{let e=["file","mimeType","thumbnailURL","width","height","filesize","filename","url","focalX","focalY","sizes"];return t.filter(o=>!e.includes("name"in o&&o.name))};import{fieldAffectsData as dK,fieldHasSubFields as mK,fieldIsHiddenOrDisabled as fK,getFieldPermissions as pK,isFieldDisabled as hK}from"payload/shared";import{fieldAffectsData as x7}from"payload/shared";var Vu=(t,e)=>t?x7(e)&&e.name?`${t}.${e.name}`:t:x7(e)?e.name:"";import{jsx as b0,jsxs as w7}from"react/jsx-runtime";import{Fragment as S7}from"react";var Ff=({CustomLabel:t,field:e,prefix:o})=>w7(S7,{children:[o?w7(S7,{children:[b0("span",{style:{display:"inline-block"},children:o})," > "]}):null,b0("span",{style:{display:"inline-block"},children:b0(le,{CustomComponent:t,Fallback:b0(Fe,{label:"label"in e&&e.label})})})]});var v0=({fields:t,formState:e,labelPrefix:o=null,parentPath:n="",path:r="",permissions:s})=>{if(!t)return[];let i=e?.[r]?.customComponents?.Label;return t?.reduce((a,l)=>{let{operation:c,permissions:u,read:d}=pK({field:l,operation:"update",parentName:n?.includes(".")?n.split(".")[n.split(".").length-1]:n,permissions:s});if((dK(l)||l.type==="ui")&&(hK(l,"bulkEdit")||l.unique||fK(l)||"readOnly"in l&&l.readOnly||!c||!d))return a;if(!(l.type==="array"||l.type==="blocks")&&mK(l)){let m="label"in l&&l.label;return[...a,...v0({fields:l.fields,labelPrefix:m?Ff({CustomLabel:i,field:l,prefix:o}):o,parentPath:r,path:Vu(r,l),permissions:u})]}if(l.type==="tabs"&&"tabs"in l)return[...a,...l.tabs.reduce((m,p)=>{if("fields"in p){let h="name"in p&&p.name;return[...m,...v0({fields:p.fields,labelPrefix:o,parentPath:r,path:h?Vu(r,p):r,permissions:u})]}},[])];let f={label:Ff({CustomLabel:i,field:l,prefix:o}),value:{field:l,fieldPermissions:u,path:Vu(r,l)}};return[...a,f]},[])};var yK="field-select",y0=t=>{let e=gK(14),{fields:o,onChange:n,permissions:r}=t,{t:s}=N(),{dispatchFields:i,getFields:a}=Ge(),l;e[0]!==o||e[1]!==a||e[2]!==r?(l=()=>v0({fields:C7(o),formState:a(),permissions:r}),e[0]=o,e[1]=a,e[2]=r,e[3]=l):l=e[3];let[c]=vK(l),u;if(e[4]!==i||e[5]!==a||e[6]!==n||e[7]!==c||e[8]!==s){let d;e[10]!==i||e[11]!==a||e[12]!==n?(d=f=>n({dispatchFields:i,formState:a(),selected:f}),e[10]=i,e[11]=a,e[12]=n,e[13]=d):d=e[13],u=bK("div",{className:yK,children:[_7(Fe,{label:s("fields:selectFieldsToEdit")}),_7(mt,{getOptionValue:CK,isMulti:!0,onChange:d,options:c})]}),e[4]=i,e[5]=a,e[6]=n,e[7]=c,e[8]=s,e[9]=u}else u=e[9];return u};function CK(t){return typeof t.value=="object"&&"path"in t.value?String(t.value.path):String(t.value)}var T7=t=>{let{collection:{fields:e,labels:{plural:o,singular:n}}={},collection:r,drawerSlug:s,forms:i}=t,[a,l]=R7(!1),{permissions:c}=ye(),{i18n:u,t:d}=N(),{closeModal:f}=ie(),{bulkUpdateForm:m}=rr(),{getFormState:p}=ct(),h=wK.useRef(null),[g,b]=R7([]),v=c?.collections?.[r.slug],C=_K(()=>I7(g.reduce((_,I)=>(_[I.value.path]=!0,_),{})),[g]),y=R2(async({formState:_,submitted:I})=>{let A=_r(h),{state:D}=await p({collectionSlug:r.slug,docPermissions:v,docPreferences:null,formState:_,operation:"update",schemaPath:r.slug,select:C,signal:A.signal,skipValidation:!I});return h.current=null,D},[p,r,v,C]);SK(()=>{let _=h.current;return()=>{Fo(_)}},[]);let x=R2(_=>{let I=g.reduce((A,D)=>(_[D.value.path]&&(A[D.value.path]=_[D.value.path].value),A),{});m(I,()=>f(s))},[f,s,m,g]),w=R2(async({dispatchFields:_,formState:I,selected:A})=>{l(!0),b(A||[]);let{state:D}=await p({collectionSlug:r.slug,docPermissions:v,docPreferences:null,formState:I,operation:"update",schemaPath:r.slug,select:I7(A.reduce((T,R)=>(T[R.value.path]=!0,T),{})),skipValidation:!0});_({type:"UPDATE_MANY",formState:D}),l(!1)},[p,r,v]),S=d("general:editingLabel",{count:i.length,label:xK(i.length>1?o:n,u)});return I2(fo,{className:`${Xn}__form`,isInitializing:a,onChange:[y],onSubmit:x,children:[I2("div",{className:`${Xn}__header`,children:[Un(Z,{"aria-label":d("general:close"),buttonStyle:"ghost",className:`${Xn}__header__close`,icon:Un(ve,{direction:"left",size:24}),id:`close-drawer__${s}`,onClick:()=>f(s)}),Un("h2",{className:`${Xn}__header__title`,title:S,children:S}),Un("div",{className:`${Xn}__header__actions`,children:Un(Z,{disabled:g.length===0,size:"medium",type:"submit",children:d("general:applyChanges")})})]}),I2("div",{className:`${Xn}__body`,children:[Un("div",{className:`${Xn}__select-fields`,children:Un(y0,{fields:e,onChange:w,permissions:v.fields})}),g.length===0?null:Un("div",{className:`${Xn}__edit`,children:Un("div",{className:"render-fields",children:Un(si,{value:void 0,children:g.map((_,I)=>{let{value:{field:A,fieldPermissions:D,path:T}}=_;return Un(Hu,{clientFieldConfig:A,indexPath:"",parentPath:"",parentSchemaPath:"",path:T,permissions:D},`${T}-${I}`)})})})})]})]})};var Xn="edit-many-bulk-uploads",D7=t=>{let e=IK(5),{collection:o,collection:n}=t,{slug:r}=o===void 0?{}:o,{permissions:s}=ye(),{t:i}=N(),{forms:a}=rr(),c=s?.collections?.[r]?.update,u=`edit-${r}-bulk-uploads`;if(!c)return null;let d;return e[0]!==n||e[1]!==u||e[2]!==a||e[3]!==i?(d=RK("div",{className:Xn,children:[C0(Jr,{"aria-label":i("general:editAll"),buttonStyle:"secondary",className:`${Xn}__toggle`,slug:u,children:i("general:editAll")}),C0(Ks,{children:C0(It,{Header:null,slug:u,children:C0(T7,{collection:n,drawerSlug:u,forms:a})})})]}),e[0]=n,e[1]=u,e[2]=a,e[3]=i,e[4]=d):d=e[4],d};var ql="bulk-upload--actions-bar";function P7(t){let e=A7(6),{collectionConfig:o}=t,{activeIndex:n,forms:r,setActiveIndex:s}=rr(),{t:i}=N(),a;return e[0]!==n||e[1]!==o||e[2]!==r.length||e[3]!==s||e[4]!==i?(a=zu("div",{className:ql,children:[r.length>1&&zu("div",{className:`${ql}__multipleFiles`,children:[zu("div",{className:`${ql}__navigation`,children:[zu("p",{className:`${ql}__locationText`,children:[Zn("strong",{children:n+1}),` ${i("general:of")} `,Zn("strong",{children:r.length})]}),zu("div",{className:`${ql}__controls`,children:[Zn(Z,{"aria-label":i("general:previous"),buttonStyle:"secondary",icon:Zn(ve,{direction:"left"}),onClick:()=>{let l=n-1;l<0?s(r.length-1):s(l)},type:"button"}),Zn(Z,{"aria-label":i("general:next"),buttonStyle:"secondary",icon:Zn(ve,{direction:"right"}),onClick:()=>{let l=n+1;l===r.length?s(0):s(l)},type:"button"})]})]}),Zn(D7,{collection:o})]}),Zn(T2,{className:`${ql}__saveButtons`})]}),e[0]=n,e[1]=o,e[2]=r.length,e[3]=s,e[4]=i,e[5]=a):a=e[5],a}function T2(t){let e=A7(12),{className:o}=t,{getEntityConfig:n}=G(),{t:r}=N(),{collectionSlug:s,hasPublishPermission:i,hasSavePermission:a,saveAllDocs:l}=rr(),c;e[0]!==s||e[1]!==n?(c=n({collectionSlug:s}),e[0]=s,e[1]=n,e[2]=c):c=e[2];let u=c,d;e[3]!==o?(d=[`${ql}__buttons`,o].filter(Boolean),e[3]=o,e[4]=d):d=e[4];let f=d.join(" "),m;return e[5]!==u?.versions?.drafts||e[6]!==i||e[7]!==a||e[8]!==l||e[9]!==r||e[10]!==f?(m=zu("div",{className:f,children:[u?.versions?.drafts&&a?Zn(Z,{buttonStyle:"secondary",onClick:()=>{l({overrides:{_status:"draft"}})},children:r("version:saveDraft")}):null,u?.versions?.drafts&&i?Zn(Z,{onClick:()=>{l({overrides:{_status:"published"}})},children:r("version:publish")}):null,!u?.versions?.drafts&&a?Zn(Z,{onClick:()=>{l()},children:r("general:save")}):null]}),e[5]=u?.versions?.drafts,e[6]=i,e[7]=a,e[8]=l,e[9]=r,e[10]=f,e[11]=m):m=e[11],m}import{c as TK}from"react/compiler-runtime";import{jsx as DK}from"react/jsx-runtime";import"react";var Nf="bulk-upload--discard-without-saving";function F7(){let t=TK(9),{t:e}=N(),{closeModal:o}=ie(),{drawerSlug:n}=nr(),r;t[0]!==o?(r=()=>{o(Nf)},t[0]=o,t[1]=r):r=t[1];let s=r,i;t[2]!==o||t[3]!==n?(i=()=>{o(n),o(Nf)},t[2]=o,t[3]=n,t[4]=i):i=t[4];let a=i,l;return t[5]!==s||t[6]!==a||t[7]!==e?(l=DK(nt,{body:e("general:changesNotSaved"),cancelLabel:e("general:stayOnThisPage"),confirmLabel:e("general:leaveAnyway"),heading:e("general:leaveWithoutSaving"),modalSlug:Nf,onCancel:s,onConfirm:a}),t[5]=s,t[6]=a,t[7]=e,t[8]=l):l=t[8],l}import{c as qK}from"react/compiler-runtime";import{jsx as ec,jsxs as QK}from"react/jsx-runtime";import Gf,{useCallback as tF,useEffect as oF,useMemo as KK}from"react";import{jsx as Kl,jsxs as $7}from"react/jsx-runtime";import{fieldIsSidebar as EK}from"payload/shared";import{useMemo as LK}from"react";import{jsx as AK}from"react/jsx-runtime";import"react";var Ef="gutter",Is=t=>{let{children:e,className:o,left:n=!0,negativeLeft:r=!1,negativeRight:s=!1,ref:i,right:a=!0}=t,l=n&&!r,c=a&&!s;return AK("div",{className:[Ef,l&&`${Ef}--left`,c&&`${Ef}--right`,r&&`${Ef}--negative-left`,s&&`${Ef}--negative-right`,o].filter(Boolean).join(" "),ref:i,children:e})};import{jsx as E7}from"react/jsx-runtime";import{getTranslation as FK}from"@payloadcms/translations";import"react";import{jsx as N7}from"react/jsx-runtime";import"react";var PK={16:"M11.5 3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-.034l-.071 1H12a.5.5 0 0 1 0 1h-.677l-.29 4.071a1 1 0 0 1-.999.929H5.966a1 1 0 0 1-.998-.929L4.677 8H4a.5.5 0 0 1 0-1h.605l-.07-1H4.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm-5.534 9h4.068l.429-6H5.537zm2.68-4.354a.5.5 0 1 1 .708.708L8.707 9l.647.646a.5.5 0 1 1-.708.707L8 9.708l-.646.646a.5.5 0 1 1-.708-.707L7.293 9l-.647-.646a.5.5 0 1 1 .708-.708L8 8.293zM4.5 5h7V4h-7z",24:"M16.5 6a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-.04l-.08 1H17a.5.5 0 0 1 0 1h-.7l-.454 5.621A1.5 1.5 0 0 1 14.35 18H9.649a1.5 1.5 0 0 1-1.495-1.379L7.7 11H7a.5.5 0 0 1 0-1h.62l-.08-1H7.5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zM9.151 16.54a.5.5 0 0 0 .498.46h4.702a.5.5 0 0 0 .498-.46L15.458 9H8.542zm3.496-4.893a.5.5 0 1 1 .707.707l-.647.646.646.646a.5.5 0 1 1-.707.707L12 13.708l-.646.646a.5.5 0 1 1-.707-.707l.646-.646-.646-.646a.5.5 0 1 1 .707-.707l.646.646zM7.5 8h9V7h-9z",small:"M6.5 7a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-.039l-.08 1H17a.5.5 0 0 1 0 1h-.7l-.455 5.62A1.5 1.5 0 0 1 14.35 18h-4.7a1.5 1.5 0 0 1-1.495-1.38L7.7 11H7a.5.5 0 0 1 0-1h.62l-.081-1H7.5a1 1 0 0 1-1-1zm9.494 1h.506V7h-9v1zm-.536 1H8.542l.61 7.54a.5.5 0 0 0 .498.46h4.7a.5.5 0 0 0 .499-.46zM11.5 11.5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0zm2 0a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0z"};function Ql({className:t,size:e=24,small:o}){let n=o?24:e,r=o?"small":e;return N7("svg",{className:["icon","icon--trash",t].filter(Boolean).join(" "),fill:"none",height:n,viewBox:`0 0 ${n} ${n}`,width:n,xmlns:"http://www.w3.org/2000/svg",children:N7("path",{d:PK[r],fill:"currentColor"})})}var NK="trash-banner",L7=()=>{let{getEntityConfig:t}=G(),{collectionSlug:e}=be(),o=t({collectionSlug:e}),{labels:n}=o,{i18n:r}=N();return E7(Xr,{className:NK,icon:E7(Ql,{}),type:"warning",children:r.t("general:documentIsTrashed",{label:`${FK(n?.singular,r)}`})})};var Rs="document-fields",Lf=({AfterFields:t,BeforeFields:e,docPermissions:o,fields:n,forceSidebarWrap:r,isTrashed:s=!1,readOnly:i,schemaPathSegments:a})=>{let{hasSidebarFields:l,mainFields:c,sidebarFields:u}=LK(()=>n.reduce((d,f)=>(EK(f)?(d.sidebarFields.push(f),d.mainFields.push(null),d.hasSidebarFields=!0):(d.mainFields.push(f),d.sidebarFields.push(null)),d),{hasSidebarFields:!1,mainFields:[],sidebarFields:[]}),[n]);return $7("div",{className:[Rs,l?`${Rs}--has-sidebar`:`${Rs}--no-sidebar`,r&&`${Rs}--force-sidebar-wrap`].filter(Boolean).join(" "),children:[Kl("div",{className:`${Rs}__main`,children:$7(Is,{className:`${Rs}__edit`,children:[s&&Kl(L7,{}),e,Kl(co,{className:`${Rs}__fields`,fields:c,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:a.join("."),permissions:o?.fields,readOnly:i}),t]})}),l?Kl("div",{className:`${Rs}__sidebar-wrap`,children:Kl("div",{className:`${Rs}__sidebar`,children:Kl("div",{className:`${Rs}__sidebar-fields`,children:Kl(co,{fields:u,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:a.join("."),permissions:o?.fields,readOnly:i})})})}):null]})};import{c as Q7}from"react/compiler-runtime";import{jsx as Bt,jsxs as wn}from"react/jsx-runtime";import{formatAdminURL as XK,isImage as K7}from"payload/shared";import zf,{Fragment as ZK,useCallback as Of,useEffect as Vf,useRef as q7,useState as Hf}from"react";import{jsx as Wt,jsxs as Ir}from"react/jsx-runtime";import S0,{useRef as Xu,useState as Aa}from"react";import po,{PureComponent as $K,createRef as j7}from"react";var x0={x:0,y:0,width:0,height:0,unit:"px"},Gu=(t,e,o)=>Math.min(Math.max(t,e),o),jK=(...t)=>t.filter(e=>e&&typeof e=="string").join(" "),k7=(t,e)=>t===e||t.width===e.width&&t.height===e.height&&t.x===e.x&&t.y===e.y&&t.unit===e.unit;function Wu(t,e,o){return t.unit==="%"?{...x0,...t,unit:"%"}:{unit:"%",x:t.x?t.x/e*100:0,y:t.y?t.y/o*100:0,width:t.width?t.width/e*100:0,height:t.height?t.height/o*100:0}}function Ta(t,e,o){return t.unit?t.unit==="px"?{...x0,...t,unit:"px"}:{unit:"px",x:t.x?t.x*e/100:0,y:t.y?t.y*o/100:0,width:t.width?t.width*e/100:0,height:t.height?t.height*o/100:0}:{...x0,...t,unit:"px"}}function M7(t,e,o,n,r,s=0,i=0,a=n,l=r){let c={...t},u=Math.min(s,n),d=Math.min(i,r),f=Math.min(a,n),m=Math.min(l,r);e&&(e>1?(u=i?i*e:u,d=u/e,f=a*e):(d=s?s/e:d,u=d*e,m=l/e)),c.y<0&&(c.height=Math.max(c.height+c.y,d),c.y=0),c.x<0&&(c.width=Math.max(c.width+c.x,u),c.x=0);let p=n-(c.x+c.width);p<0&&(c.x=Math.min(c.x,n-u),c.width+=p);let h=r-(c.y+c.height);if(h<0&&(c.y=Math.min(c.y,r-d),c.height+=h),c.width<u&&((o==="sw"||o=="nw")&&(c.x-=u-c.width),c.width=u),c.height<d&&((o==="nw"||o=="ne")&&(c.y-=d-c.height),c.height=d),c.width>f&&((o==="sw"||o=="nw")&&(c.x-=f-c.width),c.width=f),c.height>m&&((o==="nw"||o=="ne")&&(c.y-=m-c.height),c.height=m),e){let g=c.width/c.height;if(g<e){let b=Math.max(c.width/e,d);(o==="nw"||o=="ne")&&(c.y-=b-c.height),c.height=b}else if(g>e){let b=Math.max(c.height*e,u);(o==="sw"||o=="nw")&&(c.x-=b-c.width),c.width=b}}return c}function kK(t,e,o,n){let r={...t};return e==="ArrowLeft"?n==="nw"?(r.x-=o,r.y-=o,r.width+=o,r.height+=o):n==="w"?(r.x-=o,r.width+=o):n==="sw"?(r.x-=o,r.width+=o,r.height+=o):n==="ne"?(r.y+=o,r.width-=o,r.height-=o):n==="e"?r.width-=o:n==="se"&&(r.width-=o,r.height-=o):e==="ArrowRight"&&(n==="nw"?(r.x+=o,r.y+=o,r.width-=o,r.height-=o):n==="w"?(r.x+=o,r.width-=o):n==="sw"?(r.x+=o,r.width-=o,r.height-=o):n==="ne"?(r.y-=o,r.width+=o,r.height+=o):n==="e"?r.width+=o:n==="se"&&(r.width+=o,r.height+=o)),e==="ArrowUp"?n==="nw"?(r.x-=o,r.y-=o,r.width+=o,r.height+=o):n==="n"?(r.y-=o,r.height+=o):n==="ne"?(r.y-=o,r.width+=o,r.height+=o):n==="sw"?(r.x+=o,r.width-=o,r.height-=o):n==="s"?r.height-=o:n==="se"&&(r.width-=o,r.height-=o):e==="ArrowDown"&&(n==="nw"?(r.x+=o,r.y+=o,r.width-=o,r.height-=o):n==="n"?(r.y+=o,r.height-=o):n==="ne"?(r.y+=o,r.width-=o,r.height-=o):n==="sw"?(r.x-=o,r.width+=o,r.height+=o):n==="s"?r.height+=o:n==="se"&&(r.width+=o,r.height+=o)),r}var Uu={capture:!0,passive:!1},Da=class Yn extends $K{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=j7(),this.mediaRef=j7(),this.initChangeCalled=!1,this.state={cropIsActive:!1,newCropIsBeingDrawn:!1},this.onCropPointerDown=e=>{let{crop:o,disabled:n}=this.props,r=this.getBox();if(!o)return;let s=Ta(o,r.width,r.height);if(n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let i=e.target.dataset.ord,a=!!i,l=e.clientX,c=e.clientY,u=s.x,d=s.y;if(i){let f=e.clientX-r.x,m=e.clientY-r.y,p=0,h=0;i==="ne"||i=="e"?(p=f-(s.x+s.width),h=m-s.y,u=s.x,d=s.y+s.height):i==="se"||i==="s"?(p=f-(s.x+s.width),h=m-(s.y+s.height),u=s.x,d=s.y):i==="sw"||i=="w"?(p=f-s.x,h=m-(s.y+s.height),u=s.x+s.width,d=s.y):(i==="nw"||i=="n")&&(p=f-s.x,h=m-s.y,u=s.x+s.width,d=s.y+s.height),l=u+r.x+p,c=d+r.y+h}this.evData={startClientX:l,startClientY:c,startCropX:u,startCropY:d,clientX:e.clientX,clientY:e.clientY,isResize:a,ord:i},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})},this.onComponentPointerDown=e=>{let{crop:o,disabled:n,locked:r,keepSelection:s,onChange:i}=this.props,a=this.getBox();if(n||r||s&&o)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let l=e.clientX-a.x,c=e.clientY-a.y,u={unit:"px",x:l,y:c,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:l,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,i(Ta(u,a.width,a.height),Wu(u,a.width,a.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})},this.onDocPointerMove=e=>{let{crop:o,disabled:n,onChange:r,onDragStart:s}=this.props,i=this.getBox();if(n||!o||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,s&&s(e));let{evData:a}=this;a.clientX=e.clientX,a.clientY=e.clientY;let l;a.isResize?l=this.resizeCrop():l=this.dragCrop(),k7(o,l)||r(Ta(l,i.width,i.height),Wu(l,i.width,i.height))},this.onComponentKeyDown=e=>{let{crop:o,disabled:n,onChange:r,onComplete:s}=this.props;if(n)return;let i=e.key,a=!1;if(!o)return;let l=this.getBox(),c=this.makePixelCrop(l),u=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?Yn.nudgeStepLarge:e.shiftKey?Yn.nudgeStepMedium:Yn.nudgeStep;if(i==="ArrowLeft"?(c.x-=u,a=!0):i==="ArrowRight"?(c.x+=u,a=!0):i==="ArrowUp"?(c.y-=u,a=!0):i==="ArrowDown"&&(c.y+=u,a=!0),a){e.cancelable&&e.preventDefault(),c.x=Gu(c.x,0,l.width-c.width),c.y=Gu(c.y,0,l.height-c.height);let d=Ta(c,l.width,l.height),f=Wu(c,l.width,l.height);r(d,f),s&&s(d,f)}},this.onHandlerKeyDown=(e,o)=>{let{aspect:n=0,crop:r,disabled:s,minWidth:i=0,minHeight:a=0,maxWidth:l,maxHeight:c,onChange:u,onComplete:d}=this.props,f=this.getBox();if(s||!r)return;if(e.key==="ArrowUp"||e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight")e.stopPropagation(),e.preventDefault();else return;let m=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?Yn.nudgeStepLarge:e.shiftKey?Yn.nudgeStepMedium:Yn.nudgeStep,p=Ta(r,f.width,f.height),h=kK(p,e.key,m,o),g=M7(h,n,o,f.width,f.height,i,a,l,c);if(!k7(r,g)){let b=Wu(g,f.width,f.height);u(g,b),d&&d(g,b)}},this.onDocPointerDone=e=>{let{crop:o,disabled:n,onComplete:r,onDragEnd:s}=this.props,i=this.getBox();this.unbindDocMove(),!(n||!o)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,s&&s(e),r&&r(Ta(o,i.width,i.height),Wu(o,i.width,i.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))},this.onDragFocus=e=>{var o;(o=this.componentRef.current)==null||o.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:o,y:n,width:r,height:s}=e.getBoundingClientRect();return{x:o,y:n,width:r,height:s}}componentDidUpdate(e){let{crop:o,onComplete:n}=this.props;if(n&&!e.crop&&o){let{width:r,height:s}=this.getBox();r&&s&&n(Ta(o,r,s),Wu(o,r,s))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,Uu),this.document.addEventListener("pointerup",this.onDocPointerDone,Uu),this.document.addEventListener("pointercancel",this.onDocPointerDone,Uu),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,Uu),this.document.removeEventListener("pointerup",this.onDocPointerDone,Uu),this.document.removeEventListener("pointercancel",this.onDocPointerDone,Uu),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,o=this.getBox(),n=this.makePixelCrop(o),r=e.clientX-e.startClientX,s=e.clientY-e.startClientY;return n.x=Gu(e.startCropX+r,0,o.width-n.width),n.y=Gu(e.startCropY+s,0,o.height-n.height),n}getPointRegion(e,o,n,r){let{evData:s}=this,i=s.clientX-e.x,a=s.clientY-e.y,l;r&&o?l=o==="nw"||o==="n"||o==="ne":l=a<s.startCropY;let c;return n&&o?c=o==="nw"||o==="w"||o==="sw":c=i<s.startCropX,c?l?"nw":"sw":l?"ne":"se"}resolveMinDimensions(e,o,n=0,r=0){let s=Math.min(n,e.width),i=Math.min(r,e.height);return!o||!s&&!i?[s,i]:o>1?s?[s,s/o]:[i*o,i]:i?[i*o,i]:[s,s/o]}resizeCrop(){let{evData:e}=this,{aspect:o=0,maxWidth:n,maxHeight:r}=this.props,s=this.getBox(),[i,a]=this.resolveMinDimensions(s,o,this.props.minWidth,this.props.minHeight),l=this.makePixelCrop(s),c=this.getPointRegion(s,e.ord,i,a),u=e.ord||c,d=e.clientX-e.startClientX,f=e.clientY-e.startClientY;(i&&u==="nw"||u==="w"||u==="sw")&&(d=Math.min(d,-i)),(a&&u==="nw"||u==="n"||u==="ne")&&(f=Math.min(f,-a));let m={unit:"px",x:0,y:0,width:0,height:0};c==="ne"?(m.x=e.startCropX,m.width=d,o?(m.height=m.width/o,m.y=e.startCropY-m.height):(m.height=Math.abs(f),m.y=e.startCropY-m.height)):c==="se"?(m.x=e.startCropX,m.y=e.startCropY,m.width=d,o?m.height=m.width/o:m.height=f):c==="sw"?(m.x=e.startCropX+d,m.y=e.startCropY,m.width=Math.abs(d),o?m.height=m.width/o:m.height=f):c==="nw"&&(m.x=e.startCropX+d,m.width=Math.abs(d),o?(m.height=m.width/o,m.y=e.startCropY-m.height):(m.height=Math.abs(f),m.y=e.startCropY+f));let p=M7(m,o,c,s.width,s.height,i,a,n,r);return o||Yn.xyOrds.indexOf(u)>-1?l=p:Yn.xOrds.indexOf(u)>-1?(l.x=p.x,l.width=p.width):Yn.yOrds.indexOf(u)>-1&&(l.y=p.y,l.height=p.height),l.x=Gu(l.x,0,s.width-l.width),l.y=Gu(l.y,0,s.height-l.height),l}createCropSelection(){let{ariaLabels:e=Yn.defaultProps.ariaLabels,disabled:o,locked:n,renderSelectionAddon:r,ruleOfThirds:s,crop:i}=this.props,a=this.getCropStyle();if(i)return po.createElement("div",{style:a,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":e.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!o&&!n&&po.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},po.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),po.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),po.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),po.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),po.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":e.nwDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"nw"),role:"button"}),po.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":e.nDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"n"),role:"button"}),po.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":e.neDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"ne"),role:"button"}),po.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":e.eDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"e"),role:"button"}),po.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":e.seDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"se"),role:"button"}),po.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":e.sDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"s"),role:"button"}),po.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":e.swDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"sw"),role:"button"}),po.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":e.wDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"w"),role:"button"})),r&&po.createElement("div",{className:"ReactCrop__selection-addon",onMouseDown:l=>l.stopPropagation()},r(this.state)),s&&po.createElement(po.Fragment,null,po.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),po.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){let o={...x0,...this.props.crop||{}};return Ta(o,e.width,e.height)}render(){let{aspect:e,children:o,circularCrop:n,className:r,crop:s,disabled:i,locked:a,style:l,ruleOfThirds:c}=this.props,{cropIsActive:u,newCropIsBeingDrawn:d}=this.state,f=s?this.createCropSelection():null,m=jK("ReactCrop",r,u&&"ReactCrop--active",i&&"ReactCrop--disabled",a&&"ReactCrop--locked",d&&"ReactCrop--new-crop",s&&e&&"ReactCrop--fixed-aspect",s&&n&&"ReactCrop--circular-crop",s&&c&&"ReactCrop--rule-of-thirds",!this.dragStarted&&s&&!s.width&&!s.height&&"ReactCrop--invisible-crop",n&&"ReactCrop--no-animate");return po.createElement("div",{ref:this.componentRef,className:m,style:l},po.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},o),f)}};Da.xOrds=["e","w"];Da.yOrds=["n","s"];Da.xyOrds=["nw","ne","se","sw"];Da.nudgeStep=1;Da.nudgeStepMedium=10;Da.nudgeStepLarge=100;Da.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 B7=Da;var Mt="edit-upload",w0=t=>{let{name:e,disabled:o,onChange:n,ref:r,value:s}=t;return Ir("div",{className:`${Mt}__input`,children:[e,Wt("input",{disabled:o,name:e,onChange:i=>n(i.target.value),ref:r,type:"number",value:s})]})},MK={height:100,unit:"%",width:100,x:0,y:0},D2=({fileName:t,fileSrc:e,imageCacheTag:o,initialCrop:n,initialFocalPoint:r,onSave:s,showCrop:i,showFocalPoint:a})=>{let{closeModal:l}=ie(),{t:c}=N(),[u,d]=Aa(()=>({...MK,...n||{}})),f={x:50,y:50},[m,p]=Aa(()=>({...f,...r})),[h,g]=Aa(!1),[b,v]=Aa(0),[C,y]=Aa(0),x=Xu(void 0),w=Xu(void 0),S=Xu(void 0),_=Xu(null),I=Xu(null),[A,D]=Aa(!1),T=$=>{v($.currentTarget.naturalHeight),y($.currentTarget.naturalWidth),D(!0)},R=({dimension:$,value:B})=>{let k=100*(parseInt(B)/($==="width"?C:b));if(k<=0||k>100)return null;d(O=>({...O,[$]:k}))},P=({coordinate:$,value:B})=>{let j=parseInt(B);j>=0&&j<=100&&p(k=>({...k,[$]:j}))},E=()=>{typeof s=="function"&&s({crop:u||void 0,focalPoint:m,heightInPixels:Number(_?.current?.value??b),widthInPixels:Number(I?.current?.value??C)}),l($f)},F=S0.useCallback(({x:$,y:B})=>{p({x:$,y:B}),g(!1)},[]),L=()=>{let $=x.current.getBoundingClientRect(),B=i?S.current.getBoundingClientRect():w.current.getBoundingClientRect(),j=(B.left-$.left+B.width/2)/$.width*100,k=(B.top-$.top+B.height/2)/$.height*100;p({x:j,y:k})},M=e&&Ml(e,o);return Ir("div",{className:Mt,children:[Ir("div",{className:`${Mt}__header`,children:[Ir("h2",{title:`${c("general:editing")} ${t}`,children:[c("general:editing")," ",t]}),Ir("div",{className:`${Mt}__actions`,children:[Wt(Z,{"aria-label":c("general:cancel"),buttonStyle:"secondary",className:`${Mt}__cancel`,onClick:()=>l($f),children:c("general:cancel")}),Wt(Z,{"aria-label":c("general:applyChanges"),buttonStyle:"primary",className:`${Mt}__save`,disabled:!A,onClick:E,children:c("general:applyChanges")})]})]}),Ir("div",{className:`${Mt}__toolWrap`,children:[Wt("div",{className:`${Mt}__crop`,children:Ir("div",{className:`${Mt}__focal-wrapper`,ref:x,style:{aspectRatio:`${C/b}`},children:[i?Wt(B7,{className:`${Mt}__reactCrop`,crop:u,onChange:($,B)=>d(B),onComplete:()=>g(!0),renderSelectionAddon:()=>Wt("div",{className:`${Mt}__crop-window`,ref:S}),children:Wt("img",{alt:c("upload:setCropArea"),onLoad:T,ref:w,src:M})}):Wt("img",{alt:c("upload:setFocalPoint"),onLoad:T,ref:w,src:M}),a&&Wt(BK,{boundsRef:i?S:w,checkBounds:i?h:!1,className:`${Mt}__focalPoint`,containerRef:x,initialPosition:m,onDragEnd:F,setCheckBounds:i?g:!1,children:Wt(Po,{})})]})}),(i||a)&&Ir("div",{className:`${Mt}__sidebar`,children:[i&&Ir("div",{className:`${Mt}__groupWrap`,children:[Wt("div",{children:Ir("div",{className:`${Mt}__titleWrap`,children:[Wt("h3",{children:c("upload:crop")}),Wt(Z,{buttonStyle:"ghost",className:`${Mt}__reset`,onClick:()=>d({height:100,unit:"%",width:100,x:0,y:0}),children:c("general:reset")})]})}),Wt("span",{className:`${Mt}__description`,children:c("upload:cropToolDescription")}),Ir("div",{className:`${Mt}__inputsWrap`,children:[Wt(w0,{disabled:!A,name:`${c("upload:width")} (px)`,onChange:$=>R({dimension:"width",value:$}),ref:I,value:(u.width/100*C).toFixed(0)}),Wt(w0,{disabled:!A,name:`${c("upload:height")} (px)`,onChange:$=>R({dimension:"height",value:$}),ref:_,value:(u.height/100*b).toFixed(0)})]})]}),a&&Ir("div",{className:`${Mt}__groupWrap`,children:[Wt("div",{children:Ir("div",{className:`${Mt}__titleWrap`,children:[Wt("h3",{children:c("upload:focalPoint")}),Wt(Z,{buttonStyle:"ghost",className:`${Mt}__reset`,onClick:L,children:c("general:reset")})]})}),Wt("span",{className:`${Mt}__description`,children:c("upload:focalPointDescription")}),Ir("div",{className:`${Mt}__inputsWrap`,children:[Wt(w0,{name:"X %",onChange:$=>P({coordinate:"x",value:$}),value:m.x.toFixed(0)}),Wt(w0,{name:"Y %",onChange:$=>P({coordinate:"y",value:$}),value:m.y.toFixed(0)})]})]})]})]})]})},BK=({boundsRef:t,checkBounds:e,children:o,className:n,containerRef:r,initialPosition:s={x:50,y:50},onDragEnd:i,setCheckBounds:a})=>{let[l,c]=Aa({x:s.x,y:s.y}),[u,d]=Aa(!1),f=Xu(void 0),m=S0.useCallback((b,v,C)=>{let y=r.current.getBoundingClientRect(),x=t.current.getBoundingClientRect(),w=b??x.left,S=v??x.top,_=w<x.left||w>x.right,I=S<x.top||S>x.bottom,A=(w-y.left)/y.width*100,D=(S-y.top)/y.height*100,T=(x.left-y.left+x.width/2)/y.width*100,R=(x.top-y.top+x.height/2)/y.height*100;return(_||I)&&(d(!1),w<x.left?A=(x.left-y.left)/y.width*100:w>x.right&&(A=(y.width-(y.right-x.right))/y.width*100),S<x.top?D=(x.top-y.top)/y.height*100:S>x.bottom&&(D=(y.height-(y.bottom-x.bottom))/y.height*100),C&&(A=_?T:A,D=I?R:D)),{x:A,y:D}},[t,r]),p=b=>{b.preventDefault(),d(!0)},h=b=>{if(!u)return null;let{x:v,y:C}=m(b.clientX,b.clientY);c({x:v,y:C})},g=()=>{d(!1),i(l)};return S0.useEffect(()=>{if(!(u||!f.current)&&e){let{height:b,left:v,top:C,width:y}=f.current.getBoundingClientRect(),{x,y:w}=m(v+y/2,C+b/2,!0);i({x,y:w}),c({x,y:w}),a(!1);return}},[m,u,e,a,l.x,l.y,i]),S0.useEffect(()=>{c({x:s.x,y:s.y})},[s.x,s.y]),Ir("div",{className:[`${Mt}__draggable-container`,u&&`${Mt}__draggable-container--dragging`].filter(Boolean).join(" "),onMouseMove:h,children:[Wt("button",{className:[`${Mt}__draggable`,n].filter(Boolean).join(" "),onMouseDown:p,onMouseUp:g,ref:f,style:{left:`${l.x}%`,top:`${l.y}%`},type:"button",children:o}),Wt("div",{})]})};import{jsx as X7}from"react/jsx-runtime";import"react";import{c as OK}from"react/compiler-runtime";import{jsx as xi,jsxs as A2}from"react/jsx-runtime";import"react";var Pa="file-details-draggable",O7=t=>{let e=OK(21),{collectionSlug:o,doc:n,hideRemoveFile:r,imageCacheTag:s,isSortable:i,removeItem:a,rowIndex:l,uploadConfig:c}=t,{id:u,filename:d,thumbnailURL:f,url:m}=n,p;e[0]!==o||e[1]!==u?(p={id:u,collectionSlug:o},e[0]=o,e[1]=u,e[2]=p):p=e[2];let[h,g]=ro(p),b;e[3]!==h||e[4]!==g||e[5]!==o||e[6]!==n||e[7]!==d||e[8]!==r||e[9]!==u||e[10]!==s||e[11]!==i||e[12]!==a||e[13]!==l||e[14]!==f||e[15]!==c||e[16]!==m?(b=C=>A2("div",{className:[Pa,C&&i&&`${Pa}--has-drag-handle`].filter(Boolean).join(" "),ref:C.setNodeRef,style:{transform:C.transform,transition:C.transition,zIndex:C.isDragging?1:void 0},children:[A2("div",{className:`${Pa}--drag-wrapper`,children:[i&&C&&xi("div",{className:`${Pa}__drag`,...C.attributes,...C.listeners,children:xi(Ho,{})}),xi(on,{className:`${Pa}__thumbnail`,collectionSlug:o,doc:n,fileSrc:f||m,imageCacheTag:s,uploadConfig:c})]}),xi("div",{className:`${Pa}__main-detail`,children:d}),A2("div",{className:`${Pa}__actions`,children:[xi(h,{}),xi(g,{children:xi(fr,{})}),!r&&a&&xi(Z,{buttonStyle:"ghost",className:`${Pa}__remove`,icon:"x",onClick:()=>a(l),round:!0})]})]},u),e[3]=h,e[4]=g,e[5]=o,e[6]=n,e[7]=d,e[8]=r,e[9]=u,e[10]=s,e[11]=i,e[12]=a,e[13]=l,e[14]=f,e[15]=c,e[16]=m,e[17]=b):b=e[17];let v;return e[18]!==u||e[19]!==b?(v=xi(Yr,{id:u,children:b},u),e[18]=u,e[19]=b,e[20]=v):v=e[20],v};import{jsx as Bf,jsxs as W7}from"react/jsx-runtime";import"react";import{jsx as z7,jsxs as kf}from"react/jsx-runtime";import{formatFilesize as GK}from"payload/shared";import G7 from"react";import{c as VK}from"react/compiler-runtime";import{jsx as HK,jsxs as V7}from"react/jsx-runtime";import{useState as H7}from"react";var zK="copy-to-clipboard",jf=t=>{let e=VK(11),{defaultMessage:o,successMessage:n,value:r}=t,[s,i]=H7(!1),[a,l]=H7(!1),{t:c}=N();if(r){let u;e[0]!==r?(u=async()=>{await navigator.clipboard.writeText(r),i(!0)},e[0]=r,e[1]=u):u=e[1];let d,f;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{l(!0),i(!1)},f=()=>{l(!1),i(!1)},e[2]=d,e[3]=f):(d=e[2],f=e[3]);let m;return e[4]!==s||e[5]!==o||e[6]!==a||e[7]!==n||e[8]!==c||e[9]!==u?(m=V7("button",{className:zK,onClick:u,onMouseEnter:d,onMouseLeave:f,type:"button",children:[HK(sl,{}),V7(io,{delay:s?0:void 0,show:a||s,children:[s&&(n??c("general:copied")),!s&&(o??c("general:copy"))]})]}),e[4]=s,e[5]=o,e[6]=a,e[7]=n,e[8]=c,e[9]=u,e[10]=m):m=e[10],m}return null};var P2="file-meta",Mf=t=>{let{filename:e,filesize:o,height:n,mimeType:r,url:s,width:i}=t;return kf("div",{className:P2,children:[kf("div",{className:`${P2}__url`,children:[z7("a",{href:s,rel:"noopener noreferrer",target:"_blank",children:e}),z7(jf,{defaultMessage:"Copy URL",value:s})]}),kf("div",{className:`${P2}__size-type`,children:[GK(o),typeof i=="number"&&typeof n=="number"&&kf(G7.Fragment,{children:["\xA0-\xA0",i,"x",n]}),r&&kf(G7.Fragment,{children:["\xA0-\xA0",r]})]})]})};var _0="file-details",U7=t=>{let{customUploadActions:e,doc:o,enableAdjustments:n,handleRemove:r,hasImageSizes:s,hideRemoveFile:i,imageCacheTag:a,uploadConfig:l}=t,{filename:c,filesize:u,height:d,mimeType:f,thumbnailURL:m,url:p,width:h}=o,g=l.displayPreview??!0;return Bf("div",{className:_0,children:W7("header",{children:[g&&Bf(on,{className:`${_0}__thumbnail`,doc:o,fileSrc:m||p,imageCacheTag:a,uploadConfig:l}),W7("div",{className:`${_0}__main-detail`,children:[Bf(Mf,{filename:c,filesize:u,height:d,mimeType:f,url:p,width:h}),(n||s&&o.filename||e)&&Bf(F2,{customActions:e,enableAdjustments:!!n,enablePreviewSizes:s&&o.filename,mimeType:f})]}),!i&&r&&Bf(Z,{buttonStyle:"ghost",className:`${_0}__remove`,icon:"x",onClick:r,round:!0})]})})};var N2=t=>{let{hasMany:e}=t;return e?X7(O7,{...t}):X7(U7,{...t})};import{jsx as Ts,jsxs as Zu}from"react/jsx-runtime";import{useEffect as WK,useMemo as UK,useState as Z7}from"react";var xn="preview-sizes",Y7=(t,e)=>{if(!e||e.length===0)return t;let o={};return e.forEach(({name:n})=>{t[n]&&(o[n]=t[n])}),o},J7=({name:t,active:e,alt:o,meta:n,onClick:r,previewSrc:s})=>Zu("div",{className:[`${xn}__sizeOption`,e&&`${xn}--selected`].filter(Boolean).join(" "),onClick:typeof r=="function"?r:void 0,onKeyDown:i=>{typeof r=="function"&&i.key==="Enter"&&r()},role:"button",tabIndex:0,children:[Ts("div",{className:`${xn}__image`,children:Ts("img",{alt:o,src:s})}),Zu("div",{className:`${xn}__sizeMeta`,children:[Ts("div",{className:`${xn}__sizeName`,children:t}),Ts(Mf,{...n})]})]}),E2=({doc:t,imageCacheTag:e,uploadConfig:o})=>{let{imageSizes:n}=o,{sizes:r}=t,s=t?.alt||t.filename||"",[i,a]=Z7(()=>Y7(r,n)),[l,c]=Z7(null),u=p=>{if(!p.filename)return null;if(p.url)return Ml(p.url,e)};WK(()=>{a(Y7(r,n))},[r,n,e]);let d=u(l?t.sizes[l]:t),f=UK(()=>({filename:t.filename,filesize:t.filesize,height:t.height,mimeType:t.mimeType,url:t.url,width:t.width}),[t]),m="Original";return Zu("div",{className:xn,children:[Zu("div",{className:`${xn}__imageWrap`,children:[Zu("div",{className:`${xn}__meta`,children:[Ts("div",{className:`${xn}__sizeName`,children:l||m}),Ts(Mf,{...l?i[l]:f})]}),Ts("img",{alt:s,className:`${xn}__preview`,src:d})]}),Ts("div",{className:`${xn}__listWrap`,children:Zu("div",{className:`${xn}__list`,children:[Ts(J7,{active:!l,alt:s,meta:f,name:m,onClick:()=>c(null),previewSrc:u(t)}),Object.entries(i).map(([p,h])=>{let g=l===p,b=u(h);return b?Ts(J7,{active:g,alt:s,meta:h,name:p,onClick:()=>c(p),previewSrc:b},p):null})]})})]})};var _o="file-field",$f="edit-upload",eF="preview-sizes",YK=t=>!t&&t!==void 0?"A file is required.":t&&(!t.name||t.name==="")?"A file name is required.":!0,F2=t=>{let e=Q7(8),{customActions:o,enableAdjustments:n,enablePreviewSizes:r,mimeType:s}=t,{t:i}=N(),{openModal:a}=ie(),l,c;if(e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s||e[4]!==a||e[5]!==i){c=Symbol.for("react.early_return_sentinel");e:{let u=K7(s)&&s!=="image/svg+xml"&&s!=="image/jxl";if(!u&&(!o||o.length===0)){c=null;break e}l=wn("div",{className:`${_o}__upload-actions`,children:[u&&wn(zf.Fragment,{children:[r&&Bt(Z,{buttonStyle:"pill",className:`${_o}__previewSizes`,margin:!1,onClick:()=>{a(eF)},size:"medium",children:i("upload:previewSizes")}),n&&Bt(Z,{buttonStyle:"pill",className:`${_o}__edit`,margin:!1,onClick:()=>{a($f)},size:"medium",children:i("upload:editImage")})]}),o&&o.map(JK)]})}e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=a,e[5]=i,e[6]=l,e[7]=c}else l=e[6],c=e[7];return c!==Symbol.for("react.early_return_sentinel")?c:l},L2=t=>{let e=Q7(5),{resetUploadEdits:o,updateUploadEdits:n,uploadEdits:r}=bl(),s;return e[0]!==t||e[1]!==o||e[2]!==n||e[3]!==r?(s=Bt(Ou,{children:Bt($2,{...t,resetUploadEdits:o,updateUploadEdits:n,uploadEdits:r})}),e[0]=t,e[1]=o,e[2]=n,e[3]=r,e[4]=s):s=e[4],s},$2=t=>{let{collectionSlug:e,customActions:o,initialState:n,onChange:r,resetUploadEdits:s,updateUploadEdits:i,uploadConfig:a,UploadControls:l,uploadEdits:c}=t,{setUploadControlFile:u,setUploadControlFileName:d,setUploadControlFileUrl:f,uploadControlFile:m,uploadControlFileName:p,uploadControlFileUrl:h}=x2(),{config:{routes:{api:g}}}=G(),{t:b}=N(),{setModified:v}=Ge(),{id:C,data:y,docPermissions:x,setUploadStatus:w}=be(),S=mn(),{errorMessage:_,setValue:I,showError:A,value:D}=Ne({path:"file",validate:YK}),[T,R]=Hf(null),[P,E]=Hf(!1),[F,L]=Hf(D?.name||""),[M,$]=Hf(!1),[B,j]=Hf(""),k=q7(null),O=q7(null),V=typeof a?.pasteURL=="object"&&a.pasteURL.allowList?.length>0,H=Of(({file:de,isNewFile:xe=!0})=>{xe&&de instanceof File&&R(URL.createObjectURL(de)),I(de),$(!1),f(""),d(null),u(null),typeof r=="function"&&r(de)},[r,I,u,d,f]),z=(de,xe)=>new File([de],xe,{type:de.type,lastModified:de.lastModified}),W=zf.useCallback(de=>{let xe=de.target.value;D&&(H({file:z(D,xe),isNewFile:!1}),L(xe))},[H,D]),U=Of(de=>{let xe=de?.[0];H({file:xe})},[H]),X=Of(()=>{E(!0),H({file:null}),R(""),j(""),s(),$(!1),f(""),d(null),u(null)},[H,s,u,d,f]),Q=Of(de=>{v(!0),i(de)},[v,i]),J=Of(async()=>{if(!(!B||a?.pasteURL===!1)){w("uploading");try{let de=await fetch(B);if(!de.ok)throw new Error(`Fetch failed with status: ${de.status}`);let xe=await de.blob(),$e=p||decodeURIComponent(B.split("/").pop()||""),Le=new File([xe],$e,{type:xe.type});H({file:Le}),w("idle");return}catch{if(!V){se.error("Failed to fetch the file."),w("failed");return}}try{let de=`/${e}/paste-url${C?`/${C}?`:"?"}src=${encodeURIComponent(B)}`,xe=await fetch(XK({apiRoute:g,path:de}));if(!xe.ok)throw new Error(`Fetch failed with status: ${xe.status}`);let $e=await xe.blob(),Le=decodeURIComponent(B.split("/").pop()||""),rt=new File([$e],Le,{type:$e.type});H({file:rt}),w("idle")}catch{se.error("The provided URL is not allowed."),w("failed")}}},[g,e,B,H,C,w,a,p,V]);Vf(()=>{n?.file?.value instanceof File&&(R(URL.createObjectURL(n.file.value)),E(!1))},[n]),Vf(()=>{M&&k.current},[M]),Vf(()=>{S&&E(!1)},[S]);let oe=x?.update,Y=a?.imageSizes?.length>0,K=!!a?.resizeOptions,ee=a?.focalPoint===!0,{crop:te=!0,focalPoint:re=!0}=a,me=re&&(Y||K||ee),we=a.mimeTypes?.join(", "),Ae=a?.cacheTags&&y?.updatedAt;return Vf(()=>{(async()=>h&&(j(h),await J()))()},[h,J]),Vf(()=>{m&&H({file:m})},[m,H]),wn("div",{className:[Ee,_o].filter(Boolean).join(" "),children:[Bt(tt,{message:_,showError:A}),y&&y.filename&&!P&&Bt(N2,{collectionSlug:e,customUploadActions:o,doc:y,enableAdjustments:te||me,handleRemove:oe?X:void 0,hasImageSizes:Y,hideRemoveFile:a.hideRemoveFile,imageCacheTag:Ae,uploadConfig:a}),(!a.hideFileInputOnCreate&&!y?.filename||P)&&wn("div",{className:`${_o}__upload`,children:[!D&&!M&&Bt(Jl,{onChange:U,children:wn("div",{className:`${_o}__dropzoneContent`,children:[wn("div",{className:`${_o}__dropzoneButtons`,children:[Bt(Z,{buttonStyle:"pill",onClick:()=>{O.current&&O.current.click()},size:"medium",children:b("upload:selectFile")}),Bt("input",{accept:we,"aria-hidden":"true",className:`${_o}__hidden-input`,hidden:!0,onChange:de=>{de.target.files&&de.target.files.length>0&&U(de.target.files)},ref:O,type:"file"}),a?.pasteURL!==!1&&wn(ZK,{children:[Bt("span",{className:`${_o}__orText`,children:b("general:or")}),Bt(Z,{buttonStyle:"pill",onClick:()=>{$(!0),f(""),u(null),d(null)},size:"medium",children:b("upload:pasteURL")})]}),l||null]}),wn("p",{className:`${_o}__dragAndDropText`,children:[b("general:or")," ",b("upload:dragAndDrop")]})]})}),M&&wn(zf.Fragment,{children:[wn("div",{className:`${_o}__remote-file-wrap`,children:[Bt("input",{className:`${_o}__remote-file`,onChange:de=>{j(de.target.value)},ref:k,title:B,type:"text",value:B}),Bt("div",{className:`${_o}__add-file-wrap`,children:Bt("button",{className:`${_o}__add-file`,onClick:()=>{J()},type:"button",children:b("upload:addFile")})})]}),Bt(Z,{buttonStyle:"ghost",className:`${_o}__remove`,icon:"x",onClick:()=>{$(!1),f(""),u(null),d(null)},round:!0,tooltip:b("general:cancel")})]}),D&&T&&wn(zf.Fragment,{children:[Bt("div",{className:`${_o}__thumbnail-wrap`,children:Bt(on,{collectionSlug:e,fileSrc:K7(D.type)?T:null})}),wn("div",{className:`${_o}__file-adjustments`,children:[Bt("input",{className:`${_o}__filename`,onChange:W,title:F||D.name,type:"text",value:F||D.name}),Bt(F2,{customActions:o,enableAdjustments:te||me,enablePreviewSizes:Y&&y?.filename&&!P,mimeType:D.type})]}),Bt(Z,{buttonStyle:"ghost",className:`${_o}__remove`,icon:"x",onClick:X,round:!0,tooltip:b("general:cancel")})]})]}),(D||y?.filename)&&Bt(Ks,{children:Bt(It,{Header:null,slug:$f,children:Bt(D2,{fileName:D?.name||y?.filename,fileSrc:y?.url||T,imageCacheTag:Ae,initialCrop:c?.crop??void 0,initialFocalPoint:{x:c?.focalPoint?.x||y?.focalX||50,y:c?.focalPoint?.y||y?.focalY||50},onSave:Q,showCrop:te,showFocalPoint:me})})}),y&&Y&&Bt(It,{className:`${_o}__previewDrawer`,hoverTitle:!0,slug:eF,title:b("upload:sizesFor",{label:y.filename}),children:Bt(E2,{doc:y,imageCacheTag:Ae,uploadConfig:a})})]})};function JK(t,e){return Bt(zf.Fragment,{children:t},e)}var eee="collection-edit";function rF({BeforeDocumentMeta:t,resetUploadEdits:e,submitted:o,updateUploadEdits:n,uploadEdits:r}){let{action:s,collectionSlug:i,docPermissions:a,getDocPreferences:l,hasSavePermission:c,initialState:u,isInitializing:d,Upload:f}=be(),{drawerSlug:m,onSave:p}=Zm(),{getFormState:h}=ct(),{getEntityConfig:g}=G(),b=Gf.useRef(null),v=g({collectionSlug:i}),{reportUpdate:C}=yi(),y=v.slug,[x]=Gf.useState(y),w=tF(_=>{C({doc:_?.doc||_?.result,drawerSlug:m,entitySlug:y,operation:"create",updatedAt:_?.result?.updatedAt||new Date().toISOString()}),typeof p=="function"&&p({..._,operation:"create"}),e()},[y,p,C,e,m]),S=tF(async({formState:_,submitted:I})=>{let A=_r(b),D=await l(),{state:T}=await h({collectionSlug:y,docPermissions:a,docPreferences:D,formState:_,operation:"create",schemaPath:x,signal:A.signal,skipValidation:!I});return b.current=null,T},[y,x,l,h,a]);return oF(()=>{let _=b.current;return()=>{Fo(_)}},[]),ec(vl,{operation:"create",children:QK(fo,{action:s,className:`${eee}__form`,disabled:d||!c,initialState:d?void 0:u,isInitializing:d,method:"POST",onChange:[S],onSuccess:w,submitted:o,children:[ec(Lf,{BeforeFields:ec(Gf.Fragment,{children:f||ec($2,{collectionSlug:v.slug,customActions:[t].filter(Boolean),initialState:u,resetUploadEdits:e,updateUploadEdits:n,uploadConfig:v.upload,uploadEdits:r})}),docPermissions:a,fields:v.fields,schemaPathSegments:[v.slug]}),ec(oee,{}),ec(tee,{})]})})}function tee(){let t=qK(7),{getField:e,getFields:o}=Ge(),{getFormDataRef:n}=rr(),r;t[0]!==o||t[1]!==n?(r=()=>{n.current=o},t[0]=o,t[1]=n,t[2]=r):r=t[2];let s;return t[3]!==e||t[4]!==o||t[5]!==n?(s=[o,e,n],t[3]=e,t[4]=o,t[5]=n,t[6]=s):s=t[6],oF(r,s),null}function oee(){let{docConfig:t}=be(),{activeIndex:e,forms:o,setFormTotalErrorCount:n}=rr(),r=Gf.useRef(0),s=KK(()=>o[e]?.formState?.file?.valid??!0,[e,o]),i=Gf.useCallback(a=>{let l=a;s||(l+=1),l!==r.current&&(n({errorCount:l,index:e}),r.current=l)},[e,n,s]);return t?ec(_l,{fields:t.fields,path:[],setErrorCount:i}):null}import{c as uee}from"react/compiler-runtime";import{jsx as Ot,jsxs as wi}from"react/jsx-runtime";var Fa={};x4(Fa,{WindowInfo:()=>iF,WindowInfoContext:()=>Yu,WindowInfoProvider:()=>cF,useWindowInfo:()=>sr,withWindowInfo:()=>uF});import{useContext as nee}from"react";import{createContext as ree}from"react";var Yu=ree({});var sr=()=>nee(Yu);import nF,{Fragment as sF}from"react";var iF=t=>{let{children:e}=t,o=sr();return e?typeof e=="function"?nF.createElement(sF,null,e(o)):nF.createElement(sF,null,e):null};import see,{useCallback as aF,useEffect as lF,useReducer as iee,useRef as aee}from"react";var lee=(t,e)=>{let{payload:{breakpoints:o,animationRef:n}}=e;n.current=null;let{eventsFired:r}=t,{documentElement:{style:s,clientWidth:i,clientHeight:a}}=document,{innerWidth:l,innerHeight:c}=window,u=`${i/100}px`,d=`${a/100}px`,f=o?Object.keys(o).reduce((p,h)=>Object.assign(Object.assign({},p),{[h]:window.matchMedia(o[h]).matches}),{}):{},m={width:l,height:c,"--vw":u,"--vh":d,breakpoints:f,eventsFired:r+1};return s.setProperty("--vw",u),s.setProperty("--vh",d),m},cF=t=>{let{breakpoints:e,children:o}=t,n=aee(null),[r,s]=iee(lee,{width:void 0,height:void 0,"--vw":"","--vh":"",breakpoints:{},eventsFired:0}),i=aF(()=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>s({type:"UPDATE",payload:{breakpoints:e,animationRef:n}}))},[e]),a=aF(()=>{setTimeout(()=>{i()},500)},[i]);return lF(()=>(window.addEventListener("resize",i),window.addEventListener("orientationchange",a),()=>{window.removeEventListener("resize",i),window.removeEventListener("orientationchange",a)}),[i,a]),lF(()=>{r.eventsFired===0&&s({type:"UPDATE",payload:{breakpoints:e,animationRef:n}})},[e,r]),see.createElement(Yu.Provider,{value:Object.assign({},r)},o&&o)};import cee from"react";var uF=t=>o=>{let n=sr();return cee.createElement(t,Object.assign({},o,{windowInfo:n}))};import{isImage as dee}from"payload/shared";import R0 from"react";var dF=t=>new Promise((e,o)=>{let n=new Image;n.src=URL.createObjectURL(t),n.onload=()=>{let s,i,a=n.height&&n.width?n.width/n.height:1;a>1?(i=280,s=280/a):(i=280*a,s=280);let l=new OffscreenCanvas(i,s),c=l.getContext("2d"),u=t.type==="image/png"?"image/png":"image/jpeg",d=t.type==="image/png"?void 0:.8;c.drawImage(n,0,0,i,s),l.convertToBlob({type:u,...d&&{quality:d}}).then(f=>{URL.revokeObjectURL(n.src);let m=new FileReader;m.onload=()=>e(m.result),m.onerror=o,m.readAsDataURL(f)}).catch(o)},n.onerror=r=>{URL.revokeObjectURL(n.src),o(r)}});var I0="bulk-upload-drawer--add-more-files",At="file-selections";function mF(){let t=uee(41),{activeIndex:e,addFiles:o,forms:n,isInitializing:r,removeFile:s,setActiveIndex:i,totalErrorCount:a}=rr(),{initialFiles:l,initialForms:c,maxFiles:u}=nr(),{i18n:d,t:f}=N(),{closeModal:m,openModal:p}=ie(),[h,g]=R0.useState(!1),{breakpoints:b}=sr(),v;t[0]!==s?(v=F=>{s(F)},t[0]=s,t[1]=v):v=t[1];let C=v,y;t[2]!==o||t[3]!==m?(y=F=>{o(F),m(I0)},t[2]=o,t[3]=m,t[4]=y):y=t[4];let x=y,w=pee,S=r?l?.length??c?.length:n.length,{collectionSlug:_,selectableCollections:I,setCollectionSlug:A}=nr(),{getEntityConfig:D}=G(),T=h&&`${At}__showingFiles`,R;t[5]!==T?(R=[At,T].filter(Boolean),t[5]=T,t[6]=R):R=t[6];let P=R.join(" "),E;if(t[7]!==e||t[8]!==b.m||t[9]!==_||t[10]!==m||t[11]!==n||t[12]!==D||t[13]!==x||t[14]!==C||t[15]!==d||t[16]!==l||t[17]!==c||t[18]!==r||t[19]!==u||t[20]!==p||t[21]!==I||t[22]!==i||t[23]!==A||t[24]!==h||t[25]!==f||t[26]!==P||t[27]!==a||t[28]!==S){let F=a>0&&`${At}__header--hasErrors`,L;t[30]!==F?(L=[`${At}__header`,F].filter(Boolean),t[30]=F,t[31]=L):L=t[31];let M;t[32]===Symbol.for("react.memo_cache_sentinel")?(M=()=>g(fee),t[32]=M):M=t[32];let $;t[33]!==m?($=()=>m(I0),t[33]=m,t[34]=$):$=t[34];let B;t[35]!==e||t[36]!==C||t[37]!==d||t[38]!==i||t[39]!==f?(B=(j,k)=>{let{errorCount:O,formID:V,formState:H}=j,z=H?.file?.value||{};return wi("div",{className:[`${At}__fileRowContainer`,k===e&&`${At}__fileRowContainer--active`,O&&O>0&&`${At}__fileRowContainer--error`].filter(Boolean).join(" "),children:[wi("button",{className:`${At}__fileRow`,onClick:()=>i(k),type:"button",children:[Ot(hee,{file:z,formID:V}),Ot("div",{className:`${At}__fileDetails`,children:Ot("p",{className:`${At}__fileName`,title:z.name,children:z.name||f("upload:noFile")})}),z instanceof File?Ot("p",{className:`${At}__fileSize`,children:w(z)}):null,Ot("div",{className:`${At}__remove ${At}__remove--underlay`,children:Ot(xt,{})}),O?Ot(yo,{className:`${At}__errorCount`,count:O,i18n:d}):null]}),Ot("button",{"aria-label":f("general:remove"),className:`${At}__remove ${At}__remove--overlay`,onClick:()=>C(k),type:"button",children:Ot(xt,{})})]},V)},t[35]=e,t[36]=C,t[37]=d,t[38]=i,t[39]=f,t[40]=B):B=t[40],E=wi("div",{className:P,children:[b.m&&h?Ot("div",{className:`${At}__mobileBlur`}):null,wi("div",{className:L.join(" "),children:[I?.length>1&&Ot(_s,{className:`${At}__collectionSelect`,isClearable:!1,name:"groupBy",onChange:j=>{let k=typeof j=="object"&&"value"in j?j?.value:j;A(k)},options:I?.map(j=>{let k=D({collectionSlug:j});return{label:k.labels.singular,value:k.slug}})||[],path:"groupBy",required:!0,value:_}),a>0?Ot("div",{className:`${At}__header__error`,children:Ot(yo,{count:a,i18n:d,withMessage:!0})}):null,wi("div",{className:`${At}__headerTopRow`,children:[Ot("p",{className:`${At}__selectedCount`,children:wi("strong",{title:`${S} ${f(S>1?"upload:filesToUpload":"upload:fileToUpload")}`,children:[S," ",f(S>1?"upload:filesToUpload":"upload:fileToUpload")]})}),wi("div",{className:`${At}__header__actions`,children:[typeof u!="number"||S<u?Ot(Z,{buttonStyle:"secondary",className:`${At}__header__addFile`,onClick:()=>p(I0),size:"medium",children:f("upload:addFile")}):null,Ot(Z,{buttonStyle:"secondary",className:`${At}__toggler`,icon:Ot(ve,{direction:h?"down":"up",size:16}),onClick:M,selected:h,children:wi("strong",{title:`${S} ${f(S>1?"upload:filesToUpload":"upload:fileToUpload")}`,children:[S," ",f(S>1?"upload:filesToUpload":"upload:fileToUpload")]})}),Ot(It,{Header:null,slug:I0,children:Ot(h0,{onCancel:$,onDrop:x})})]})]}),Ot("div",{className:`${At}__header__mobileDocActions`,children:Ot(T2,{})})]}),Ot("div",{className:`${At}__animateWrapper scrollbar-thin`,children:Ot(rm,{height:!b.m||h?"auto":0,children:wi("div",{className:`${At}__filesContainer`,children:[r&&n.length===0&&(l?.length>0||c?.length>0)?(l?Array.from(l):c).map(mee):null,n.map(B)]})})})]}),t[7]=e,t[8]=b.m,t[9]=_,t[10]=m,t[11]=n,t[12]=D,t[13]=x,t[14]=C,t[15]=d,t[16]=l,t[17]=c,t[18]=r,t[19]=u,t[20]=p,t[21]=I,t[22]=i,t[23]=A,t[24]=h,t[25]=f,t[26]=P,t[27]=a,t[28]=S,t[29]=E}else E=t[29];return E}function mee(t,e){return Ot(Ct,{animationDelay:`calc(${e} * 60ms)`,height:"35px"},e)}function fee(t){return!t}function pee(t){let e=t.size,o=e===0?0:Math.floor(Math.log(e)/Math.log(1024)),n=o>1?1:0;return(e/Math.pow(1024,o)).toFixed(n)+" "+["B","kB","MB","GB","TB"][o]}function hee({file:t,formID:e}){let[o,n]=R0.useState(null),[r,s]=R0.useState(!0);return R0.useEffect(()=>{let i=!1;async function a(){s(!0),n(null);try{if(dee(t.type)){let l=await dF(t);i||n(l)}else n(null)}catch{i||n(null)}finally{i||s(!1)}}return a(),()=>{i=!0}},[t]),r?Ot(Ct,{className:`${At}__thumbnail-shimmer`,disableInlineStyles:!0}):Ot(on,{className:`${At}__thumbnail`,fileSrc:o},`${e}-${o||"placeholder"}`)}var fF="bulk-upload--file-manager";function pF(){let t=gee(18),{activeIndex:e,collectionSlug:o,docPermissions:n,documentSlots:r,forms:s,hasPublishPermission:i,hasSavePermission:a,hasSubmitted:l,resetUploadEdits:c,updateUploadEdits:u}=rr(),d=s[e],{getEntityConfig:f}=G(),{i18n:m}=N(),{user:p}=ye(),{openModal:h}=ie(),g;if(t[0]!==d||t[1]!==e||t[2]!==o||t[3]!==n||t[4]!==r||t[5]!==s.length||t[6]!==f||t[7]!==i||t[8]!==a||t[9]!==l||t[10]!==m||t[11]!==h||t[12]!==c||t[13]!==u||t[14]!==p){let b=f({collectionSlug:o}),v;t[16]!==h?(v=()=>h(Nf),t[16]=h,t[17]=v):v=t[17],g=j2("div",{className:fF,children:[Wf(mF,{}),j2("div",{className:`${fF}__editView`,children:[Wf(Ra,{onClose:v,title:bee(b.labels.singular,m)}),d?j2(hm,{collectionSlug:o,currentEditor:p,docPermissions:n,hasPublishedDoc:!1,hasPublishPermission:i,hasSavePermission:a,id:null,initialData:vee(d.formState,!0),initialState:d.formState,isLocked:!1,lastUpdateTime:0,mostRecentVersionIsAutosaved:!1,unpublishedVersionCount:0,Upload:r.Upload,versionCount:0,children:[Wf(P7,{collectionConfig:b}),Wf(rF,{BeforeDocumentMeta:r.BeforeDocumentMeta,resetUploadEdits:c,submitted:l,updateUploadEdits:u,uploadEdits:d?.uploadEdits})]},`${e}-${s.length}`):null]}),Wf(F7,{})]}),t[0]=d,t[1]=e,t[2]=o,t[3]=n,t[4]=r,t[5]=s.length,t[6]=f,t[7]=i,t[8]=a,t[9]=l,t[10]=m,t[11]=h,t[12]=c,t[13]=u,t[14]=p,t[15]=g}else g=t[15];return g}var wee="bulk-upload-drawer-slug";function See(){let{addFiles:t,forms:e,isInitializing:o}=rr(),{closeModal:n}=ie(),{collectionSlug:r,drawerSlug:s}=nr(),{getEntityConfig:i}=G(),{t:a}=N(),u=i({collectionSlug:r})?.upload?.mimeTypes,d=Hr.useCallback(f=>{let m=new DataTransfer;for(let p of f)(u===void 0||u.length===0||Cee(p.type,u))&&m.items.add(p);m.files.length===0?se.error(a("error:invalidFileType")):t(m.files)},[t,a,u]);return r?!e.length&&!o?Si(h0,{acceptMimeTypes:u?.join(", "),onCancel:()=>n(s),onDrop:d}):Si(pF,{}):null}function gF(){let t=hF(18),{drawerSlug:e,onCancel:o,setInitialFiles:n,setInitialForms:r,setOnCancel:s,setOnSuccess:i,setParentID:a,setSelectableCollections:l,setSuccessfullyUploaded:c,successfullyUploaded:u}=nr(),{modalState:d}=ie(),f=Hr.useRef(d),m;t[0]!==e||t[1]!==o||t[2]!==n||t[3]!==r||t[4]!==s||t[5]!==i||t[6]!==a||t[7]!==l||t[8]!==c||t[9]!==u?(m=v=>{let C=f.current[e],y=v[e];typeof y>"u"&&typeof C>"u"||(C?.isOpen!==y?.isOpen&&(y?.isOpen||(u||typeof o=="function"&&o(),a(void 0),n(void 0),r(void 0),s(Ree),i(_ee),l(null),c(!1))),f.current=v)},t[0]=e,t[1]=o,t[2]=n,t[3]=r,t[4]=s,t[5]=i,t[6]=a,t[7]=l,t[8]=c,t[9]=u,t[10]=m):m=t[10];let p=et(m),h;t[11]!==d||t[12]!==p?(h=()=>{p(d)},t[11]=d,t[12]=p,t[13]=h):h=t[13];let g;t[14]!==d?(g=[d],t[14]=d,t[15]=g):g=t[15],xee(h,g);let b;return t[16]!==e?(b=Si(It,{Header:null,slug:e,children:Si(y7,{children:Si(Ou,{children:Si(Ks,{children:Si(See,{})})})})}),t[16]=e,t[17]=b):b=t[17],b}function _ee(){return Iee}function Iee(){return null}function Ree(){return Tee}function Tee(){return null}var bF=Hr.createContext({collectionSlug:"",drawerSlug:"",initialFiles:void 0,initialForms:[],maxFiles:void 0,onCancel:()=>null,onSuccess:()=>null,parentID:void 0,selectableCollections:null,setCollectionSlug:()=>null,setInitialFiles:()=>null,setInitialForms:()=>null,setMaxFiles:()=>null,setOnCancel:()=>null,setOnSuccess:()=>null,setParentID:()=>null,setSelectableCollections:()=>null,setSuccessfullyUploaded:()=>!1,successfullyUploaded:!1});function k2(t){let e=hF(18),{children:o,drawerSlugPrefix:n}=t,[r,s]=Hr.useState(null),[i,a]=Hr.useState(),[l,c]=Hr.useState(void 0),[u,d]=Hr.useState(),[f,m]=Hr.useState(),[p,h]=Hr.useState(void 0),[g,b]=Hr.useState(void 0),[v,C]=Hr.useState(void 0),[y,x]=Hr.useState(!1),w=`${n?`${n}-`:""}${vF()}`,S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S=P=>{d(()=>P)},e[0]=S):S=e[0];let _=S,I;e[1]===Symbol.for("react.memo_cache_sentinel")?(I=P=>{m(()=>P)},e[1]=I):I=e[1];let A=I,D;e[2]!==f?(D=()=>{typeof f=="function"&&f()},e[2]=f,e[3]=D):D=e[3];let T;e[4]!==u?(T=(P,E)=>{typeof u=="function"&&u(P,E)},e[4]=u,e[5]=T):T=e[5];let R;return e[6]!==o||e[7]!==i||e[8]!==w||e[9]!==p||e[10]!==g||e[11]!==v||e[12]!==l||e[13]!==r||e[14]!==y||e[15]!==D||e[16]!==T?(R=Si(bF,{value:{collectionSlug:i,drawerSlug:w,initialFiles:p,initialForms:g,maxFiles:v,onCancel:D,onSuccess:T,parentID:l,selectableCollections:r,setCollectionSlug:a,setInitialFiles:h,setInitialForms:b,setMaxFiles:C,setOnCancel:A,setOnSuccess:_,setParentID:c,setSelectableCollections:s,setSuccessfullyUploaded:x,successfullyUploaded:y},children:yee(Hr.Fragment,{children:[o,Si(gF,{})]})}),e[6]=o,e[7]=i,e[8]=w,e[9]=p,e[10]=g,e[11]=v,e[12]=l,e[13]=r,e[14]=y,e[15]=D,e[16]=T,e[17]=R):R=e[17],R}var nr=()=>Hr.use(bF);function vF(){let t=aa();return`${wee}-${t+1}`}import{jsx as ho,jsxs as Na,Fragment as Xf}from"react/jsx-runtime";import{formatAdminURL as Oee}from"payload/shared";import*as _F from"qs-esm";import Jn,{useCallback as B2,useEffect as SF,useMemo as O2}from"react";function yF(t,e){let o=Array.isArray(e);if(typeof t=="string"||typeof t=="number")return t;if(t&&typeof t=="object"&&"relationTo"in t&&"value"in t){let n=t.value;for(;n&&typeof n=="object"&&n!==null&&"value"in n;)n=n.value;return n&&typeof n=="object"&&n!==null&&"id"in n&&(n=n.id),o?{relationTo:t.relationTo,value:n}:n}return t&&typeof t=="object"&&"id"in t?t.id:t}import{c as Nee}from"react/compiler-runtime";import{jsx as tc,jsxs as Eee}from"react/jsx-runtime";import"react";import{c as Dee}from"react/compiler-runtime";import{jsx as Ds,jsxs as T0}from"react/jsx-runtime";import{getTranslation as Aee}from"@payloadcms/translations";import{formatFilesize as Pee}from"payload/shared";import"react";var _i="upload-relationship-details";function D0(t){let e=Dee(11),{id:o,allowEdit:n,allowRemove:r,alt:s,byteSize:i,className:a,collectionSlug:l,displayPreview:c,filename:u,mimeType:d,onRemove:f,reloadDoc:m,showCollectionSlug:p,src:h,thumbnailSrc:g,updatedAt:b,withMeta:v,x:C,y}=t,x=p===void 0?!1:p,w=v===void 0?!0:v,{config:S}=G(),{i18n:_,t:I}=N(),A="collections"in S?S.collections.find(O=>O.slug===l):void 0,D=o??void 0,T;e[0]!==l||e[1]!==D?(T={id:D,collectionSlug:l},e[0]=l,e[1]=D,e[2]=T):T=e[2];let[R,,P]=ro(T),{openDrawer:E}=P,F;e[3]!==l||e[4]!==m?(F=async O=>{let{doc:V}=O;return m(V.id,l)},e[3]=l,e[4]=m,e[5]=F):F=e[5];let L=F,M;e[6]!==C||e[7]!==y?(M=function(V,H){let z=[];return H&&z.push(Pee(H)),C&&y&&z.push(`${C}x${y}`),V&&z.push(V),z.join(" \u2014 ")},e[6]=C,e[7]=y,e[8]=M):M=e[8];let B=w?M(d,i):"",j=c??A?.upload?.displayPreview??!0,k;return e[9]!==a?(k=[_i,a].filter(Boolean),e[9]=a,e[10]=k):k=e[10],T0("div",{className:k.join(" "),children:[T0("div",{className:`${_i}__imageAndDetails`,children:[j&&Ds(q6,{alt:s,className:`${_i}__thumbnail`,filename:u,fileSrc:g,imageCacheTag:A?.upload?.cacheTags&&b,size:"small"}),x&&A?Ds(vr,{size:"small",children:Aee(A.labels.singular,_)}):null,T0("div",{className:`${_i}__details`,children:[Ds("p",{className:`${_i}__filename`,children:h?Ds("a",{href:h,target:"_blank",children:u}):u}),w?Ds("p",{className:`${_i}__meta`,children:B}):null]})]}),n!==!1||r!==!1?T0("div",{className:`${_i}__actions`,children:[n!==!1?Ds(Z,{"aria-label":I("general:edit"),buttonStyle:"ghost",className:`${_i}__action-btn`,icon:Ds(nl,{}),margin:!1,onClick:E}):null,r!==!1?Ds(Z,{"aria-label":I("general:remove"),buttonStyle:"ghost",className:`${_i}__action-btn`,icon:Ds(xt,{size:24}),margin:!1,onClick:()=>f()}):null,Ds(R,{onSave:L})]}):null]})}import{jsx as Fee}from"react/jsx-runtime";import"react";var M2="upload-field-card";function A0({children:t,className:e,readOnly:o,size:n="medium"}){return Fee("div",{className:[M2,e,`${M2}--size-${n}`,o&&`${M2}--readOnly`].filter(Boolean).join(" "),children:t})}import{getBestFitFromSizes as Lee,isImage as $ee}from"payload/shared";var Uf="upload upload--has-many";function CF(t){let e=Nee(29),{className:o,displayPreview:n,fileDocs:r,isSortable:s,onRemove:i,onReorder:a,readonly:l,reloadDoc:c,serverURL:u,showCollectionSlug:d}=t,f=d===void 0?!1:d,m;e[0]!==r||e[1]!==a?(m=(y,x)=>{if(y===x)return;let w=[...r],[S]=w.splice(y,1);w.splice(x,0,S),a(w)},e[0]=r,e[1]=a,e[2]=m):m=e[2];let p=m,h;e[3]!==r||e[4]!==i?(h=y=>{let x=[...r||[]];x.splice(y,1),i(x.length===0?[]:x)},e[3]=r,e[4]=i,e[5]=h):h=e[5];let g=h,b;e[6]!==o?(b=[Uf,o].filter(Boolean),e[6]=o,e[7]=b):b=e[7];let v=b.join(" "),C;if(e[8]!==n||e[9]!==r||e[10]!==s||e[11]!==p||e[12]!==l||e[13]!==c||e[14]!==g||e[15]!==u||e[16]!==f||e[17]!==v){let y;e[19]!==p?(y=w=>{let{moveFromIndex:S,moveToIndex:_}=w;return p(S,_)},e[19]=p,e[20]=y):y=e[20];let x;e[21]!==n||e[22]!==s||e[23]!==l||e[24]!==c||e[25]!==g||e[26]!==u||e[27]!==f?(x=(w,S)=>{let{relationTo:_,value:I}=w,A=String(I.id),D,T;if(I.url)try{D=new URL(I.url,u).toString()}catch{D=`${u}${I.url}`}if(I.thumbnailURL)try{T=new URL(I.thumbnailURL,u).toString()}catch{T=`${u}${I.thumbnailURL}`}return $ee(I.mimeType)&&(T=Lee({sizes:I.sizes,thumbnailURL:T,url:D,width:I.width})),tc(Yr,{disabled:!s||l,id:A,children:R=>tc("div",{className:[`${Uf}__dragItem`,R&&s&&`${Uf}--has-drag-handle`].filter(Boolean).join(" "),ref:R.setNodeRef,style:{transform:R.transform,transition:R.transition,zIndex:R.isDragging?1:void 0},children:Eee(A0,{readOnly:l,size:"small",children:[R&&s&&tc("div",{className:`${Uf}__drag`,...R.attributes,...R.listeners,children:tc(Ho,{})}),tc(D0,{allowEdit:!l,allowRemove:!l,alt:I?.alt||I?.filename,byteSize:I.filesize,collectionSlug:_,displayPreview:n,filename:I.filename,id:A,mimeType:I?.mimeType,onRemove:()=>g(S),reloadDoc:c,showCollectionSlug:f,src:D,thumbnailSrc:T,updatedAt:I.updatedAt,withMeta:!1,x:I?.width,y:I?.height})]})})},A)},e[21]=n,e[22]=s,e[23]=l,e[24]=c,e[25]=g,e[26]=u,e[27]=f,e[28]=x):x=e[28],C=tc("div",{className:v,children:tc(hr,{className:`${Uf}__draggable-rows`,ids:r?.map(jee),onDragEnd:y,children:r.map(x)})}),e[8]=n,e[9]=r,e[10]=s,e[11]=p,e[12]=l,e[13]=c,e[14]=g,e[15]=u,e[16]=f,e[17]=v,e[18]=C}else C=e[18];return C}function jee(t){let{value:e}=t;return String(e.id)}import{jsx as xF}from"react/jsx-runtime";import{getBestFitFromSizes as kee,isImage as Mee}from"payload/shared";import"react";var Bee="upload upload--has-one";function wF(t){let{className:e,displayPreview:o,fileDoc:n,onRemove:r,readonly:s,reloadDoc:i,serverURL:a,showCollectionSlug:l=!1}=t,{relationTo:c,value:u}=n,d=String(u?.id),f,m;if(u.url)try{f=new URL(u.url,a).toString()}catch{f=`${a}${u.url}`}if(u.thumbnailURL)try{m=new URL(u.thumbnailURL,a).toString()}catch{m=`${a}${u.thumbnailURL}`}return Mee(u.mimeType)&&(m=kee({sizes:u.sizes,thumbnailURL:m,url:f,width:u.width})),xF(A0,{className:[Bee,e].filter(Boolean).join(" "),readOnly:s,children:xF(D0,{allowEdit:!s,allowRemove:!s,alt:u?.alt||u?.filename,byteSize:u.filesize,collectionSlug:c,displayPreview:o,filename:u.filename,id:d,mimeType:u?.mimeType,onRemove:r,reloadDoc:i,showCollectionSlug:l,src:f,thumbnailSrc:m,updatedAt:u.updatedAt,x:u?.width,y:u?.height})})}var Ii="upload";function P0(t){let{AfterInput:e,allowCreate:o,api:n,BeforeInput:r,className:s,Description:i,description:a,displayPreview:l,Error:c,filterOptions:u,hasMany:d,isSortable:f,Label:m,label:p,localized:h,maxRows:g,onChange:b,path:v,readOnly:C,relationTo:y,required:x,serverURL:w,showError:S,style:_,value:I}=t,[A,D]=Jn.useState(),[T]=Jn.useState(Array.isArray(y)?y[0]:y),{openModal:R}=ie(),{drawerSlug:P,setCollectionSlug:E,setInitialFiles:F,setMaxFiles:L,setOnSuccess:M,setSelectableCollections:$}=nr(),{permissions:B}=ye(),{code:j}=Ce(),{i18n:k,t:O}=N(),V=O2(()=>Array.isArray(y)?y.filter(q=>B?.collections&&B.collections?.[q]?.create):[],[y,B]),H=O2(()=>{let q=Array.isArray(y);if(!I)return u;let pe={},fe=Array.isArray(I)?I:[I];for(let ae of fe)if(q&&typeof ae=="object"&&"relationTo"in ae)pe[ae.relationTo]||(pe[ae.relationTo]=[]),pe[ae.relationTo].push(ae.value);else if(!q){let Se=y;pe[Se]||(pe[Se]=[]);let ne=typeof ae=="object"&&"value"in ae?ae.value:ae;(typeof ne=="string"||typeof ne=="number")&&pe[Se].push(ne)}let Pe={...u};return(q?y:[y]).forEach(ae=>{let Se=pe[ae]||[];Pe[ae]={...u?.[ae]||{},id:{...u?.[ae]?.id||{},not_in:(u?.[ae]?.id?.not_in||[]).concat(Se)}}}),Pe},[I,u,y]),[z,,{closeDrawer:W,openDrawer:U}]=Vl({collectionSlugs:typeof y=="string"?[y]:y,filterOptions:H}),[X,,{closeDrawer:Q,openDrawer:J}]=ro({collectionSlug:T}),oe=Jn.useRef(null),Y=O2(()=>o?!!(typeof T=="string"&&B?.collections&&B.collections?.[T]?.create):!1,[T,B,o]),K=Jn.useCallback(q=>{typeof b=="function"&&b(q)},[b]),ee=Jn.useCallback(async q=>{if(!q?.length)return[];let pe={};q.forEach(({relationTo:Se,value:ne})=>{pe[Se]||(pe[Se]=[]);let Te=ne;ne&&typeof ne=="object"&&"value"in ne&&(Te=ne.value),pe[Se].push(Te)});let fe=Object.entries(pe).map(async([Se,ne])=>{let Te={depth:0,draft:!0,limit:ne.length,locale:j,where:{and:[{id:{in:ne}}]}},he=await fetch(Oee({apiRoute:n,path:`/${Se}`}),{body:_F.stringify(Te),credentials:"include",headers:{"Accept-Language":k.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"},method:"POST"}),_e=[];he.ok&&(_e=(await he.json()).docs);let Ze=_e.reduce((ut,De)=>(ut[De.id]=De,ut),{});return{collection:Se,docsById:Ze}}),Pe=await Promise.all(fe),ge={};return Pe.forEach(({collection:Se,docsById:ne})=>{ge[Se]=ne}),q.map(({relationTo:Se,value:ne})=>{let Te=ge[Se]?.[ne]||{id:ne,filename:`${O("general:untitled")} - ID: ${ne}`,isPlaceholder:!0};return{relationTo:Se,value:Te}})},[n,j,k.language,O]),te=B2(q=>yF(q,y),[y]),re=B2(q=>{let pe=Array.isArray(y);if(d){let fe=q.map(ae=>pe?{relationTo:ae.collectionSlug,value:ae.doc.id}:ae.doc.id),ge=[...Array.isArray(I)?I.map(te):[],...fe];K(ge),D(ae=>[...ae||[],...q.map(Se=>({relationTo:Se.collectionSlug,value:Se.doc}))])}else{let fe=q[0],Pe=pe?{relationTo:fe.collectionSlug,value:fe.doc.id}:fe.doc.id;K(Pe),D([{relationTo:fe.collectionSlug,value:fe.doc}])}},[I,K,d,y,te]),me=Jn.useCallback(q=>{let pe=q;if(!d&&q&&q.length>1){let Pe=new DataTransfer;Pe.items.add(q[0]),pe=Pe.files}pe&&F(pe);let fe=Array.isArray(y)?T:y;E(fe),Array.isArray(V)&&$(V),typeof g=="number"&&L(g),R(P)},[d,y,T,E,V,g,R,P,F,$,L]),we=Jn.useCallback(async q=>{let pe=Array.isArray(y),fe=[];for(let[ne,Te]of q)Te&&fe.push(ne);let Pe=fe.map(ne=>({relationTo:T,value:ne})),ge=await ee(Pe);ge&&D(ne=>[...ne||[],...ge]);let ae=fe.map(ne=>pe?{relationTo:T,value:ne}:ne),Se=Array.isArray(I)?I.map(te):[];K([...Se,...ae]),W()},[T,W,K,ee,I,y,te]),Ae=Jn.useCallback(q=>{let pe=Array.isArray(y);if(q.doc){D(Pe=>[...Pe||[],{relationTo:T,value:q.doc}]);let fe=pe?{relationTo:T,value:q.doc.id}:q.doc.id;K(fe)}Q()},[Q,T,K,y]),de=B2(async({collectionSlug:q,doc:pe})=>{let fe=Array.isArray(y),ge=(await ee([{relationTo:q,value:pe.id}]))?.[0]||null;if(D(ae=>ge?d?[...ae||[],ge]:[ge]:ae),d){let ae=fe?{relationTo:q,value:pe.id}:pe.id,ne=[...Array.isArray(I)?I.map(te):[],ae];K(ne)}else{let ae=fe?{relationTo:q,value:pe.id}:pe.id;K(ae)}W()},[W,d,ee,K,I,y,te]),xe=Jn.useCallback(async(q,pe)=>{let fe=await ee([{relationTo:pe,value:q}]);if(fe[0]){let Pe=[];D(ge=>{let ae=ge?.findIndex(Se=>(Se.value?.id===fe[0].value.id||Se.value?.isPlaceholder)&&Se.relationTo===pe);if(ae>-1){let Se=[...ge];return Se[ae]=fe[0],Pe=Se,Se}return ge}),Pe.length&&d&&K(Pe.map(ge=>ge.value?.id))}},[ee,K,d]),$e=Jn.useCallback(q=>{let pe=Array.isArray(y),fe=q.map(({relationTo:Pe,value:ge})=>pe?{relationTo:Pe,value:ge.id}:ge.id);K(fe),D(q)},[K,y]),Le=Jn.useCallback(q=>{let pe=Array.isArray(y);if(!q||q.length===0){K(d?[]:null),D(d?[]:null);return}let fe=q.map(({relationTo:Pe,value:ge})=>pe?{relationTo:Pe,value:ge.id}:ge.id);K(d?fe:fe[0]),D(q)},[K,d,y]);SF(()=>{async function q(){if(I){let fe=[];if(Array.isArray(y)&&(typeof I=="object"&&"relationTo"in I||Array.isArray(I)&&I.length>0&&typeof I[0]=="object"&&"relationTo"in I[0])?fe=(Array.isArray(I)?I:[I]).filter(ge=>typeof ge=="object"&&"relationTo"in ge).map(ge=>{let ae=ge.value;for(;ae&&typeof ae=="object"&&ae!==null&&"value"in ae;)ae=ae.value;return{relationTo:ge.relationTo,value:ae}}):Array.isArray(y)||(fe=(Array.isArray(I)?I:[I]).map(ge=>{let ae=ge;for(;ae&&typeof ae=="object"&&ae!==null&&"value"in ae;)ae=ae.value;return{relationTo:y,value:ae}})),fe.length>0){let Pe=await ee(fe);Pe&&(D(Pe),oe.current=I)}}else D([]),oe.current=null}oe.current!==I&&q()},[ee,I,y]),SF(()=>{M(re)},[I,v,re,M]);let rt=!I||d&&Array.isArray(I)&&(typeof g!="number"||I.length<g)||!d&&A?.[0]&&typeof A[0].value>"u";return Na("div",{className:[Ee,Ii,s,S&&"error",C&&"read-only"].filter(Boolean).join(" "),id:`field-${v?.replace(/\./g,"__")}`,style:_,children:[ho(le,{CustomComponent:m,Fallback:ho(Fe,{label:p,localized:h,path:v,required:x})}),r,Na("div",{className:`${Ee}__wrap`,children:[ho(le,{CustomComponent:c,Fallback:ho(tt,{path:v,showError:S})}),Na("div",{className:`${Ii}__dropzoneAndUpload`,children:[d&&Array.isArray(I)&&I.length>0?ho(Xf,{children:A&&A?.length>0?ho(CF,{displayPreview:l,fileDocs:A,isSortable:f&&!C,onRemove:Le,onReorder:$e,readonly:C,reloadDoc:xe,serverURL:w,showCollectionSlug:Array.isArray(y)}):ho("div",{className:`${Ii}__loadingRows`,children:I.map(q=>ho(Ct,{height:"40px"},typeof q=="object"?q.value:q))})}):null,!d&&I?ho(Xf,{children:A&&A?.length>0&&A[0].value?ho(wF,{displayPreview:l,fileDoc:A[0],onRemove:Le,readonly:C,reloadDoc:xe,serverURL:w,showCollectionSlug:Array.isArray(y)}):A&&I&&!A?.[0]?.value?Na(Xf,{children:[O("general:untitled")," - ID: ",I]}):ho(Ct,{height:"62px"})}):null,rt?ho(Jl,{disabled:C||!Y,multipleFiles:d,onChange:me,children:Na("div",{className:`${Ii}__dropzoneContent`,children:[Na("div",{className:`${Ii}__dropzoneContent__buttons`,children:[Y&&Na(Xf,{children:[ho(Z,{buttonStyle:"secondary",className:`${Ii}__createNewToggler`,disabled:C||!Y,onClick:()=>{C||(d?me():J())},size:"medium",children:O("general:createNew")}),ho("span",{className:`${Ii}__dropzoneContent__orText`,children:O("general:or")})]}),ho(Z,{buttonStyle:"secondary",className:`${Ii}__listToggler`,disabled:C,onClick:U,size:"medium",children:O("fields:chooseFromExisting")}),ho(X,{onSave:Ae}),ho(z,{allowCreate:Y,enableRowSelections:d,onBulkSelect:we,onSelect:de})]}),Y&&!C&&Na("p",{className:`${Ii}__dragAndDropText`,children:[O("general:or")," ",O("upload:dragAndDrop")]})]})}):ho(Xf,{children:!C&&!A&&(!I||typeof g!="number"||Array.isArray(I)&&I.length<g)?ho(Ct,{height:"40px"}):null})]})]}),e,ho(le,{CustomComponent:i,Fallback:ho(Xe,{description:a,path:v})})]})}function Hee(t){let{field:e,field:{admin:{allowCreate:o,className:n,description:r,isSortable:s}={},hasMany:i,label:a,localized:l,maxRows:c,relationTo:u,required:d},path:f,readOnly:m,validate:p}=t,{config:h}=G(),g=e.displayPreview,b=RF.useCallback((F,L)=>{if(typeof p=="function")return p(F,{...L,required:d})},[p,d]),{customComponents:{AfterInput:v,BeforeInput:C,Description:y,Error:x,Label:w}={},disabled:S,filterOptions:_,path:I,setValue:A,showError:D,value:T}=Ne({potentiallyStalePath:f,validate:b}),R=Array.isArray(u),P=RF.useMemo(()=>i===!0&&Array.isArray(T)?T.map(F=>R?F:{relationTo:Array.isArray(u)?u[0]:u,value:F}):T,[i,T,R,u]),E=Vee(()=>st(e),[e]);return IF(k2,{drawerSlugPrefix:f,children:IF(P0,{AfterInput:v,allowCreate:o!==!1,api:h.routes.api,BeforeInput:C,className:n,Description:y,description:r,displayPreview:g,Error:x,filterOptions:_,hasMany:i,isSortable:s,label:a,Label:w,localized:l,maxRows:c,onChange:A,path:I,readOnly:m||S,relationTo:u,required:d,serverURL:h.serverURL,showError:D,style:E,value:P})})}var Zf=Je(Hee);function Hu(t){let e=zee(13),{clientFieldConfig:o,forceRender:n,indexPath:r,parentPath:s,parentSchemaPath:i,path:a,permissions:l,readOnly:c,schemaPath:u}=t,d;e[0]!==a?(d=p=>{let[h]=p;return h&&h?.[a]?.customComponents?.Field},e[0]=a,e[1]=d):d=e[1];let f=Ht(d),m;if(e[2]!==f||e[3]!==o||e[4]!==n||e[5]!==r||e[6]!==s||e[7]!==i||e[8]!==a||e[9]!==l||e[10]!==c||e[11]!==u){m=Symbol.for("react.early_return_sentinel");e:{let p={forceRender:n,permissions:l,readOnly:c,schemaPath:u};if(o.admin?.hidden){m=Qt(Fl,{...p,path:a});break e}if(f!==void 0){m=f||null;break e}let h={...p,indexPath:r,parentPath:s,parentSchemaPath:i};switch(o.type){case"array":{m=Qt(Yf,{...h,field:o,path:a});break e}case"blocks":{m=Qt(Sm,{...h,field:o,path:a});break e}case"checkbox":{m=Qt(gr,{...p,field:o,path:a});break e}case"code":{m=Qt(_m,{...p,field:o,path:a});break e}case"collapsible":{m=Qt(Rm,{...h,field:o,path:a});break e}case"date":{m=Qt(Gm,{...p,field:o,path:a});break e}case"email":{m=Qt(On,{...p,field:o,path:a});break e}case"group":{m=Qt(Wm,{...h,field:o,path:a});break e}case"join":{m=Qt(af,{...p,field:o,path:a});break e}case"json":{m=Qt(lf,{...p,field:o,path:a});break e}case"number":{m=Qt(Ol,{...p,field:o,path:a});break e}case"point":{m=Qt(cf,{...p,field:o,path:a});break e}case"radio":{m=Qt(mf,{...p,field:o,path:a});break e}case"relationship":{m=Qt(yf,{...p,field:o,path:a});break e}case"richText":{m=Qt(Cf,{...p,field:o,path:a});break e}case"row":{m=Qt(xf,{...h,field:o,path:a});break e}case"select":{m=Qt(Wl,{...p,field:o,path:a});break e}case"tabs":{m=Qt(Tf,{...h,field:o,path:a});break e}case"text":{m=Qt(Cn,{...p,field:o,path:a});break e}case"textarea":{m=Qt(Af,{...p,field:o,path:a});break e}case"ui":{m=Qt(Pf,{});break e}case"upload":{m=Qt(Zf,{...p,field:o,path:a});break e}}}e[2]=f,e[3]=o,e[4]=n,e[5]=r,e[6]=s,e[7]=i,e[8]=a,e[9]=l,e[10]=c,e[11]=u,e[12]=m}else m=e[12];if(m!==Symbol.for("react.early_return_sentinel"))return m}var Zee="render-fields",co=t=>{let e=Gee(20),{className:o,fields:n,forceRender:r,parentIndexPath:s,parentPath:i,parentSchemaPath:a,permissions:l,readOnly:c}=t,u=qr();if(n&&n.length>0){let d;e[0]!==o?(d=[Zee,o].filter(Boolean),e[0]=o,e[1]=d):d=e[1];let f=d.join(" "),m;if(e[2]!==n||e[3]!==r||e[4]!==u||e[5]!==s||e[6]!==i||e[7]!==a||e[8]!==l||e[9]!==c||e[10]!==f){let p;e[12]!==r||e[13]!==u||e[14]!==s||e[15]!==i||e[16]!==a||e[17]!==l||e[18]!==c?(p=(h,g)=>{if(!h||Wee(h))return null;let{operation:b,permissions:v,read:C}=Xee({field:h,operation:u,parentName:i?.includes(".")?i.split(".")[i.split(".").length-1]:i,permissions:l});if("name"in h&&!C)return null;let y=c||h?.admin?.readOnly;y&&h.admin?.readOnly===!1&&(y=!1),"name"in h&&!b&&(y=!0);let{indexPath:x,path:w,schemaPath:S}=Uee({field:h,index:g,parentIndexPath:s,parentPath:i,parentSchemaPath:a});return V2(si,{value:w,children:V2(Hu,{clientFieldConfig:h,forceRender:r,indexPath:x,parentPath:i,parentSchemaPath:a,path:w,permissions:v,readOnly:y,schemaPath:S})},`${w}-${g}`)},e[12]=r,e[13]=u,e[14]=s,e[15]=i,e[16]=a,e[17]=l,e[18]=c,e[19]=p):p=e[19],m=V2(KI,{className:f,forceRender:r,children:n.map(p)}),e[2]=n,e[3]=r,e[4]=u,e[5]=s,e[6]=i,e[7]=a,e[8]=l,e[9]=c,e[10]=f,e[11]=m}else m=e[11];return m}return null};var Ju="array-field",TF=t=>{let e=Yee(42),{addRow:o,attributes:n,copyRow:r,CustomRowLabel:s,duplicateRow:i,errorCount:a,fields:l,forceRender:c,hasMaxRows:u,isDragging:d,isLoading:f,isSortable:m,labels:p,listeners:h,moveRow:g,parentPath:b,pasteRow:v,path:C,permissions:y,readOnly:x,removeRow:w,row:S,rowCount:_,rowIndex:I,schemaPath:A,scrollIdPrefix:D,setCollapse:T,setNodeRef:R,transform:P,transition:E}=t,F=c===void 0?!1:c,L=$1(f,500),{i18n:M}=N(),$=vo(),B=`${qee(p.singular,M)} ${String(I+1).padStart(2,"0")}`,j=a>0&&$,k=j?`${Ju}__row--has-errors`:`${Ju}__row--no-errors`,O=d&&`${Ju}__row--is-dragging`,V;e[0]!==k||e[1]!==O?(V=[`${Ju}__row`,k,O].filter(Boolean),e[0]=k,e[1]=O,e[2]=V):V=e[2];let H=V.join(" "),z=`${b.split(".").join("-")}-row-${I}`,W=d?1:void 0,U;if(e[3]!==s||e[4]!==o||e[5]!==n||e[6]!==H||e[7]!==r||e[8]!==i||e[9]!==a||e[10]!==B||e[11]!==j||e[12]!==l||e[13]!==F||e[14]!==u||e[15]!==M||e[16]!==L||e[17]!==m||e[18]!==h||e[19]!==g||e[20]!==b||e[21]!==v||e[22]!==C||e[23]!==y||e[24]!==x||e[25]!==w||e[26]!==S.collapsed||e[27]!==S.id||e[28]!==_||e[29]!==I||e[30]!==A||e[31]!==D||e[32]!==T||e[33]!==R||e[34]!==z||e[35]!==W||e[36]!==P||e[37]!==E){let X;e[39]!==S.id||e[40]!==T?(X=Q=>T(S.id,Q),e[39]=S.id,e[40]=T,e[41]=X):X=e[41],U=Ea("div",{id:z,ref:R,style:{transform:P,transition:E,zIndex:W},children:Ea(Qs,{actions:x?void 0:Ea(L1,{addRow:o,copyRow:r,duplicateRow:i,hasMaxRows:u,index:I,isSortable:m,moveRow:g,pasteRow:v,removeRow:w,rowCount:_}),className:H,collapsibleStyle:j?"error":"default",dragHandleProps:m?{id:S.id,attributes:n,listeners:h}:void 0,header:Jee("div",{className:`${Ju}__row-header`,id:`${D}-row-${I}`,children:[L?Ea(Ct,{height:"1rem",width:"8rem"}):Ea(Ur,{CustomComponent:s,label:B,path:C,rowNumber:I}),j&&Ea(yo,{count:a,i18n:M,withMessage:!0})]}),isCollapsed:S.collapsed,onToggle:X,children:L?Ea(Ct,{}):Ea(co,{className:`${Ju}__fields`,fields:l,forceRender:F,parentIndexPath:"",parentPath:C,parentSchemaPath:A,permissions:y===!0?y:y?.fields,readOnly:x})})},`${b}-row-${S.id}`),e[3]=s,e[4]=o,e[5]=n,e[6]=H,e[7]=r,e[8]=i,e[9]=a,e[10]=B,e[11]=j,e[12]=l,e[13]=F,e[14]=u,e[15]=M,e[16]=L,e[17]=m,e[18]=h,e[19]=g,e[20]=b,e[21]=v,e[22]=C,e[23]=y,e[24]=x,e[25]=w,e[26]=S.collapsed,e[27]=S.id,e[28]=_,e[29]=I,e[30]=A,e[31]=D,e[32]=T,e[33]=R,e[34]=z,e[35]=W,e[36]=P,e[37]=E,e[38]=U}else U=e[38];return U};var qn="array-field",ete=t=>{let{field:e,field:{name:o,type:n,admin:{className:r,description:s,isSortable:i=!0}={},fields:a,label:l,localized:c,maxRows:u,minRows:d,required:f},forceRender:m=!1,path:p,permissions:h,readOnly:g,schemaPath:b,validate:v}=t,C=b??o,y=d??(f?1:0),{setDocFieldPreferences:x}=be(),{addFieldRow:w,dispatchFields:S,getFields:_,moveFieldRow:I,removeFieldRow:A,replaceState:D,setModified:T}=Ge(),R=vo(),{code:P}=Ce(),{i18n:E,t:F}=N(),{config:{localization:L}}=G(),M=(()=>{if(L&&L.fallback){let ne=L.defaultLocale;return P===ne}return!0})(),B=(ne=>"labels"in ne&&ne?.labels?ne.labels:"labels"in ne.field&&ne.field.labels?{plural:ne.field.labels?.plural,singular:ne.field.labels?.singular}:"label"in ne.field&&ne.field.label?{plural:void 0,singular:ne.field.label}:{plural:F("general:rows"),singular:F("general:row")})(t),j=Sn((ne,Te)=>{if(!M&&ne===null)return!0;if(typeof v=="function")return v(ne,{...Te,maxRows:u,minRows:y,required:f})},[u,y,f,v,M]),{customComponents:{AfterInput:k,BeforeInput:O,Description:V,Error:H,Label:z}={},disabled:W,errorPaths:U,path:X,rows:Q=[],showError:J,valid:oe,value:Y}=Ne({hasRows:!0,potentiallyStalePath:p,validate:j}),K=Kee(),ee=DF(()=>`scroll-${K}`,[K]),te=Sn(ne=>{w({path:X,rowIndex:ne,schemaPath:C}),setTimeout(()=>{ru(`${ee}-row-${ne}`)},0)},[w,X,C,ee]),re=Sn(ne=>{S({type:"DUPLICATE_ROW",path:X,rowIndex:ne}),T(!0),setTimeout(()=>{ru(`${ee}-row-${ne}`)},0)},[S,X,ee,T]),me=Sn(ne=>{A({path:X,rowIndex:ne})},[A,X]),we=Sn((ne,Te)=>{I({moveFromIndex:ne,moveToIndex:Te,path:X})},[X,I]),Ae=Sn(ne=>{let{collapsedIDs:Te,updatedRows:he}=w1({collapsed:ne,rows:Q});x(X,{collapsed:Te}),S({type:"SET_ALL_ROWS_COLLAPSED",path:X,updatedRows:he})},[S,X,Q,x]),de=Sn((ne,Te)=>{let{collapsedIDs:he,updatedRows:_e}=x1({collapsed:Te,rowID:ne,rows:Q});S({type:"SET_ROW_COLLAPSED",path:X,updatedRows:_e}),x(X,{collapsed:he})},[S,X,Q,x]),xe=Sn(ne=>{let Te={..._()},he=Bc({type:n,fields:a,getDataToCopy:()=>Hc({formState:Te,path:X,rowIndex:ne}),path:X,rowIndex:ne,t:F});typeof he=="string"?se.error(he):se.success(F("general:copied"))},[a,_,X,F,n]),$e=Sn(ne=>{let Te={..._()},_e=Oc({onPaste:Ze=>{let ut=zc({dataFromClipboard:Ze,formState:Te,path:X,rowIndex:ne});D(ut),T(!0)},path:X,schemaFields:a,t:F});typeof _e=="string"&&se.error(_e)},[a,_,X,D,T,F]),Le=Sn(ne=>{let Te={..._()},he=zc({dataFromClipboard:ne,formState:Te,path:X});D(he),T(!0)},[_,X,D,T]),rt=Sn(()=>Hc({formState:{..._()},path:X}),[_,X]),q=u&&Q.length>=u,pe=U.length,fe=R&&U.length>0,Pe=(g||W)&&Q.length===0,ge=Q.length&&Q.length<y||f&&Q.length===0,ae=DF(()=>st(e),[e]),Se=Sn(ne=>{let Te=Q.findIndex(he=>he.id===ne);return Te===-1?null:Io(e1,{header:Io(Ur,{CustomComponent:Q?.[Te]?.customComponents?.RowLabel,label:`${F0(l,E)} ${String(Te+1).padStart(2,"0")}`,path:`${X}.${Te}`,rowNumber:Te})})},[Q,l,E,X]);return oc("div",{className:[Ee,qn,r,fe?`${qn}--has-error`:`${qn}--has-no-error`].filter(Boolean).join(" "),id:`field-${X.replace(/\./g,"__")}`,style:ae,children:[J&&Io(le,{CustomComponent:H,Fallback:Io(tt,{path:X,showError:J})}),oc("header",{className:`${qn}__header`,children:[oc("div",{className:`${qn}__header-wrap`,children:[oc("div",{className:`${qn}__header-content`,children:[Io("h3",{className:`${qn}__title`,children:Io(le,{CustomComponent:z,Fallback:Io(Fe,{as:"span",label:l,localized:c,path:X,required:f})})}),fe&&pe>0&&Io(yo,{count:pe,i18n:E,withMessage:!0})]}),oc("ul",{className:`${qn}__header-actions`,children:[Q?.length>0&&Io(Qh,{onClick:Ae}),Io("li",{children:Io(Xh,{allowCopy:Q?.length>0,allowPaste:!g,className:`${qn}__header-action`,disabled:W,fields:a,getDataToCopy:rt,onPaste:Le,path:X,type:n})})]})]}),Io(le,{CustomComponent:V,Fallback:Io(Xe,{description:s,path:X})})]}),Io(vm,{fieldValue:Y,localized:c,path:X,readOnly:g}),O,(Q?.length>0||!oe&&(Pe||ge))&&oc(hr,{className:`${qn}__draggable-rows`,ids:Q.map(ne=>ne.id),onDragEnd:({moveFromIndex:ne,moveToIndex:Te})=>we(ne,Te),renderDragOverlay:i&&!g&&!W?Se:void 0,sortingStrategy:kh,children:[Q.map((ne,Te)=>{let{id:he,isLoading:_e}=ne,Ze=`${X}.${Te}`,ut=U?.filter(De=>De.startsWith(Ze+".")).length;return Io(Yr,{disabled:g||W||!i,id:he,children:De=>Io(TF,{...De,addRow:te,copyRow:xe,CustomRowLabel:Q?.[Te]?.customComponents?.RowLabel,duplicateRow:re,errorCount:ut,fields:a,forceRender:m,hasMaxRows:q,isLoading:_e,isSortable:i,labels:B,moveRow:we,parentPath:X,pasteRow:$e,path:Ze,permissions:h,readOnly:g||W,removeRow:me,row:ne,rowCount:Q?.length,rowIndex:Te,schemaPath:C,scrollIdPrefix:ee,setCollapse:de})},he)}),!oe&&oc(Qee.Fragment,{children:[Pe&&Io(Xr,{children:F("validation:fieldHasNo",{label:F0(B.plural,E)})}),ge&&Io(Xr,{type:"danger",children:F("validation:requiresAtLeast",{count:y,label:F0(y>1?B.plural:B.singular,E)||F(y>1?"general:rows":"general:row")})})]})]}),!q&&!g&&Io(Z,{buttonStyle:"ghost",className:`${qn}__add-row`,disabled:W,icon:Io(ai,{}),iconPosition:"left",onClick:()=>{te(Y||0)},children:F("fields:addLabel",{label:F0(B.singular,E)})}),k]})},Yf=Je(ete);import{c as tte}from"react/compiler-runtime";import{jsx as Jf,jsxs as H2}from"react/jsx-runtime";import{confirmPassword as ote}from"payload/shared";import{useState as rte}from"react";import{jsx as AF}from"react/jsx-runtime";import"react";var PF={visible:{16:"M3.035 8.07 3.01 8l.026-.07q.064-.155.235-.412a5.6 5.6 0 0 1 1.053-1.121C5.257 5.627 6.54 5 8 5s2.743.628 3.677 1.397c.465.383.821.783 1.053 1.121.116.17.191.31.235.413L12.99 8l-.026.07q-.064.155-.235.412a5.6 5.6 0 0 1-1.053 1.121C10.743 10.373 9.46 11 8 11s-2.743-.628-3.677-1.397A5.6 5.6 0 0 1 3.27 8.482a2.5 2.5 0 0 1-.235-.413M2 8c0-1 2.5-4 6-4s6 3 6 4-2.5 4-6 4-6-3-6-4m6 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M6 12c0-.066.054-.358.313-.825a5.9 5.9 0 0 1 1.12-1.414C8.443 8.816 9.956 8 12 8s3.558.816 4.566 1.76c.508.477.88.98 1.121 1.415.258.467.313.76.313.825 0 .066-.055.358-.313.825-.24.435-.613.938-1.12 1.414C15.557 15.184 14.044 16 12 16s-3.558-.816-4.566-1.76a5.9 5.9 0 0 1-1.121-1.415C6.055 12.358 6 12.065 6 12m-1 0c0-1.25 2.333-5 7-5s7 3.75 7 5-2.333 5-7 5-7-3.75-7-5m8 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m1 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0"},hidden:{16:"M2.159 6.058c-.14-.292.103-.558.427-.558.38 0 .43.08.571.307q.047.076.113.175c.232.338.588.738 1.053 1.121C5.257 7.873 6.54 8.5 8 8.5s2.743-.628 3.677-1.397a5.6 5.6 0 0 0 1.053-1.121l.109-.168c.148-.235.198-.314.575-.314.324 0 .566.266.427.558-.234.491-.718 1.12-1.397 1.706l.972 1.459a.5.5 0 1 1-.832.554l-.94-1.41a7.2 7.2 0 0 1-1.59.784l.43 1.728a.5.5 0 0 1-.97.242l-.429-1.718a6.2 6.2 0 0 1-2.17 0l-.43 1.718a.5.5 0 0 1-.97-.242l.432-1.728a7.2 7.2 0 0 1-1.59-.784l-.941 1.41a.5.5 0 0 1-.832-.554l.972-1.459c-.68-.586-1.163-1.215-1.397-1.706",24:"M5.5 9c.276 0 .533.223.641.477q.065.153.172.348c.24.435.613.938 1.121 1.414C8.442 12.184 9.954 13 12 13s3.558-.816 4.566-1.76c.508-.477.88-.98 1.121-1.415q.107-.195.171-.348c.11-.254.366-.477.642-.477s.495.225.417.49c-.202.682-.77 1.65-1.705 2.515l1.142 1.141a.5.5 0 0 1-.708.708l-1.217-1.218a7.4 7.4 0 0 1-1.89.958l.446 1.785a.5.5 0 0 1-.97.242l-.443-1.77A8 8 0 0 1 12 14a8 8 0 0 1-1.572-.15l-.443 1.771a.5.5 0 0 1-.97-.242l.446-1.785a7.4 7.4 0 0 1-1.89-.958l-1.217 1.218a.5.5 0 0 1-.708-.708l1.142-1.142c-.935-.864-1.503-1.832-1.705-2.514-.078-.265.14-.49.417-.49"}},rc=({active:t=!0,className:e,size:o=16})=>{let n=t?PF.hidden[o]:PF.visible[o];return AF("svg",{className:["icon","icon--eye",e].filter(Boolean).join(" "),fill:"none",height:o,viewBox:`0 0 ${o} ${o}`,width:o,xmlns:"http://www.w3.org/2000/svg",children:AF("path",{clipRule:"evenodd",d:n,fill:"currentColor",fillRule:"evenodd"})})};var Ri=t=>{let e=tte(14),{disabled:o,path:n}=t,r=n===void 0?"confirm-password":n,{t:s}=N(),[i,a]=rte(!1),l;e[0]!==r?(l={path:r,validate:nte},e[0]=r,e[1]=l):l=e[1];let{disabled:c,setValue:u,showError:d,value:f}=Ne(l),m=!!(c||o),p=d&&"error",h=m&&"read-only",g;e[2]!==p||e[3]!==h?(g=[Ee,"confirm-password",p,h].filter(Boolean),e[2]=p,e[3]=h,e[4]=g):g=e[4];let b=g.join(" "),v;if(e[5]!==m||e[6]!==r||e[7]!==u||e[8]!==i||e[9]!==s||e[10]!==b||e[11]!==f){let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=()=>a(ste),e[13]=C):C=e[13],v=H2("div",{className:b,children:[Jf(Fe,{htmlFor:"field-confirm-password",label:s("authentication:confirmPassword"),required:!0}),H2("div",{className:`${Ee}__wrap`,children:[Jf(tt,{path:r}),H2("div",{className:"confirm-password__input-wrap",children:[Jf("input",{"aria-label":s("authentication:confirmPassword"),autoComplete:"off",className:"form-input",disabled:m,id:"field-confirm-password",name:"confirm-password",onChange:u,type:i?"text":"password",value:f||""}),Jf("button",{"aria-label":s(i?"fields:hidePassword":"fields:showPassword"),className:"confirm-password__toggle-button",disabled:m,onClick:C,type:"button",children:Jf(rc,{active:i,size:24})})]})]})]}),e[5]=m,e[6]=r,e[7]=u,e[8]=i,e[9]=s,e[10]=b,e[11]=f,e[12]=v}else v=e[12];return v};function nte(t,e){return ote(t,{name:"confirm-password",type:"text",required:!0,...e})}function ste(t){return!t}import{jsx as ute}from"react/jsx-runtime";import{isFieldDisabled as dte,password as mte}from"payload/shared";import{useCallback as fte,useMemo as pte}from"react";import{c as ite}from"react/compiler-runtime";import{jsx as Ti,jsxs as z2}from"react/jsx-runtime";import{getTranslation as FF}from"@payloadcms/translations";import{useState as ate}from"react";var lte="password",NF=t=>{let e=ite(31),{AfterInput:o,autoComplete:n,BeforeInput:r,className:s,description:i,Description:a,Error:l,inputRef:c,Label:u,label:d,localized:f,onChange:m,onKeyDown:p,path:h,placeholder:g,readOnly:b,required:v,rtl:C,showError:y,style:x,value:w,width:S}=t,_=n===void 0?"off":n,{i18n:I,t:A}=N(),[D,T]=ate(!1),R=y&&"error",P=b&&"read-only",E;e[0]!==s||e[1]!==R||e[2]!==P?(E=[Ee,lte,s,R,P].filter(Boolean),e[0]=s,e[1]=R,e[2]=P,e[3]=E):E=e[3];let F=E.join(" "),L;if(e[4]!==o||e[5]!==r||e[6]!==a||e[7]!==l||e[8]!==u||e[9]!==_||e[10]!==i||e[11]!==I||e[12]!==c||e[13]!==d||e[14]!==f||e[15]!==m||e[16]!==p||e[17]!==h||e[18]!==g||e[19]!==b||e[20]!==v||e[21]!==C||e[22]!==y||e[23]!==D||e[24]!==x||e[25]!==A||e[26]!==F||e[27]!==w||e[28]!==S){let M;e[30]===Symbol.for("react.memo_cache_sentinel")?(M=()=>T(cte),e[30]=M):M=e[30],L=z2("div",{className:F,style:{...x,width:S},children:[Ti(le,{CustomComponent:u,Fallback:Ti(Fe,{label:d,localized:f,path:h,required:v})}),z2("div",{className:`${Ee}__wrap`,children:[Ti(le,{CustomComponent:l,Fallback:Ti(tt,{path:h,showError:y})}),z2("div",{className:"password__input-wrap",children:[r,Ti("input",{"aria-label":FF(d,I),autoComplete:_,className:"form-input","data-rtl":C,disabled:b,id:`field-${h.replace(/\./g,"__")}`,name:h,onChange:m,onKeyDown:p,placeholder:FF(g,I),ref:c,type:D?"text":"password",value:w||""}),Ti("button",{"aria-label":A(D?"fields:hidePassword":"fields:showPassword"),className:"password__toggle-button",disabled:b,onClick:M,type:"button",children:Ti(rc,{active:D,size:24})}),o]}),Ti(le,{CustomComponent:a,Fallback:Ti(Xe,{description:i,path:h})})]})]}),e[4]=o,e[5]=r,e[6]=a,e[7]=l,e[8]=u,e[9]=_,e[10]=i,e[11]=I,e[12]=c,e[13]=d,e[14]=f,e[15]=m,e[16]=p,e[17]=h,e[18]=g,e[19]=b,e[20]=v,e[21]=C,e[22]=y,e[23]=D,e[24]=x,e[25]=A,e[26]=F,e[27]=w,e[28]=S,e[29]=L}else L=e[29];return L};function cte(t){return!t}var hte=t=>{let{autoComplete:e,field:o,field:{admin:{className:n,description:r,placeholder:s,rtl:i}={},label:a,localized:l,required:c}={},inputRef:u,path:d,validate:f}=t,{t:m}=N(),p=Ce(),{config:h}=G(),g=fte((T,R)=>{let P=d?d.split("."):[];return typeof f=="function"?f(T,{...R,required:c}):mte(T,{name:"password",type:"text",blockData:{},data:{},event:"onChange",path:P,preferences:{fields:{}},req:{payload:{config:h},t:m},required:!0,siblingData:{}})},[f,h,m,c,d]),{customComponents:{AfterInput:b,BeforeInput:v,Description:C,Error:y,Label:x}={},disabled:w,setValue:S,showError:_,value:I}=Ne({path:d,validate:g}),A=yl({fieldLocalized:!1,fieldRTL:i,locale:p,localizationConfig:h.localization||void 0}),D=pte(()=>st(o),[o]);return ute(NF,{AfterInput:b,autoComplete:e,BeforeInput:v,className:n,description:r,Description:C,Error:y,inputRef:u,Label:x,label:a,localized:l,onChange:T=>{S(T.target.value)},path:d,placeholder:s,readOnly:w||dte(o,"field"),required:c,rtl:A,showError:_,style:D,value:I||""})},Qn=Je(hte);var EF={array:Yf,blocks:Sm,checkbox:gr,code:_m,collapsible:Rm,confirmPassword:Ri,date:Gm,email:On,group:Wm,hidden:Fl,join:af,json:lf,number:Ol,password:Qn,point:cf,radio:mf,relationship:yf,richText:Cf,row:xf,select:Wl,tabs:Tf,text:Cn,textarea:Af,ui:Pf,upload:Zf},gte={...EF,Description:Xe,Error:tt,Label:Fe,RowLabel:Ur};import{c as bte}from"react/compiler-runtime";import{setsAreEqual as vte}from"payload/shared";import{useEffect as yte}from"react";var Di=new Map([]),Cte={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"},LF=t=>(Cte[t.toLowerCase()]||t).trim().toLowerCase().replace("key",""),xte=t=>{let e=LF(t);e==="meta"&&Di.forEach((o,n)=>n!=="meta"&&Di.delete(n)),Di.set(e,Date.now())},wte=t=>{let e=LF(t);e==="meta"&&Di.clear(),Di.delete(e)},Ai=(t,e)=>{let o=bte(9),{cmdCtrlKey:n,editDepth:r,keyCodes:s}=t,{modalState:i}=ie(),a;o[0]!==n||o[1]!==r||o[2]!==e||o[3]!==s||o[4]!==i?(a=f=>{let m=f.detail?.key?f.detail:f;if(m.key===void 0)return;Di.forEach(Ste),m.code&&xte(m.code);let p=window.navigator.userAgent.includes("Mac OS X"),h=[...Di.keys()].filter(_te);if(vte(new Set(h),new Set(s))&&(!n||p&&Di.has("meta")||!p&&m.ctrlKey)){if((Object.keys(i).filter(b=>i[b]?.isOpen)?.length+1||1)!==r)return;e(m)}},o[0]=n,o[1]=r,o[2]=e,o[3]=s,o[4]=i,o[5]=a):a=o[5];let l=a,c=Ite,u,d;o[6]!==l?(u=()=>(document.addEventListener("keydown",l,!1),document.addEventListener("bypassKeyDown",l,!1),document.addEventListener("keyup",c,!1),()=>{document.removeEventListener("keydown",l),document.removeEventListener("bypassKeyDown",l),document.removeEventListener("keyup",c)}),d=[l,c],o[6]=l,o[7]=u,o[8]=d):(u=o[7],d=o[8]),yte(u,d)};function Ste(t,e){Date.now()-t>3e3&&Di.delete(e)}function _te(t){return!["alt","ctrl","meta","shift"].includes(t)}function Ite(t){t.code&&wte(t.code)}import{c as Rte}from"react/compiler-runtime";import*as jF from"qs-esm";import{useEffect as $F,useRef as Tte,useState as N0}from"react";var Dte=(t,e)=>{let o=Rte(30),n;o[0]!==e?(n=e===void 0?{}:e,o[0]=e,o[1]=n):n=o[1];let r=n,{initialData:s,initialParams:i}=r,a;o[2]!==i?(a=i===void 0?{}:i,o[2]=i,o[3]=a):a=o[3];let l=a,{i18n:c}=N(),u;o[4]!==s?(u=s||{},o[4]=s,o[5]=u):u=o[5];let[d,f]=N0(u),[m,p]=N0(l),[h,g]=N0(!s),[b,v]=N0(!1),{code:C}=Ce(),y=Tte(!1),x;o[6]!==C||o[7]!==m?(x=jF.stringify({locale:C,...typeof m=="object"?m:{}},{addQueryPrefix:!0}),o[6]=C,o[7]=m,o[8]=x):x=o[8];let w=x,S;o[9]!==c.language||o[10]!==s||o[11]!==w||o[12]!==t?(S=()=>{if(s&&!y.current){y.current=!0;return}let P=new AbortController;return t?(async()=>{v(!1),g(!0);try{let F=await We.get(`${t}${w}`,{headers:{"Accept-Language":c.language},signal:P.signal});F.status>201&&v(!0);let L=await F.json();f(L),g(!1)}catch{P.signal.aborted||(v(!0),g(!1))}})():(v(!1),g(!1)),()=>{try{P.abort()}catch(F){let L=F}}},o[9]=c.language,o[10]=s,o[11]=w,o[12]=t,o[13]=S):S=o[13];let _;o[14]!==c.language||o[15]!==s||o[16]!==C||o[17]!==w||o[18]!==t?(_=[t,C,w,c.language,s],o[14]=c.language,o[15]=s,o[16]=C,o[17]=w,o[18]=t,o[19]=_):_=o[19],$F(S,_);let I,A;o[20]!==s?(I=()=>{s&&y.current&&f(s)},A=[s],o[20]=s,o[21]=I,o[22]=A):(I=o[21],A=o[22]),$F(I,A);let D;o[23]!==d||o[24]!==b||o[25]!==h?(D={data:d,isError:b,isLoading:h},o[23]=d,o[24]=b,o[25]=h,o[26]=D):D=o[26];let T;o[27]===Symbol.for("react.memo_cache_sentinel")?(T={setParams:p},o[27]=T):T=o[27];let R;return o[28]!==D?(R=[D,T],o[28]=D,o[29]=R):R=o[29],R};import{c as Ate}from"react/compiler-runtime";import{useEffect as Pte,useState as Fte}from"react";var E0=t=>{let e=Ate(5),[o,n]=Fte(),r,s;e[0]!==t?(r=()=>{let a;return t&&(a=new ResizeObserver(l=>{l.forEach(c=>{let{contentBoxSize:u,contentRect:d}=c,f=0,m=0;if(u){let p=Array.isArray(u)?u[0]:u;if(p){let{blockSize:h,inlineSize:g}=p;f=g,m=h}}else if(d){let{height:p,width:h}=d;f=h,m=p}n({height:m,width:f})})}),a.observe(t)),()=>{a&&a.unobserve(t)}},s=[t],e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]),Pte(r,s);let i;return e[3]!==o?(i={size:o},e[3]=o,e[4]=i):i=e[4],i};import{c as Nte}from"react/compiler-runtime";import{flattenTopLevelFields as Ete}from"payload/shared";var Lte=t=>{let e=Nte(4),{admin:o,fields:n}=t,{useAsTitle:r}=o,{i18n:s}=N(),i;return e[0]!==n||e[1]!==s||e[2]!==r?(i=Ete(n,{i18n:s,moveSubFieldsToTop:!0})?.find(l=>"name"in l&&l.name===r),e[0]=n,e[1]=s,e[2]=r,e[3]=i):i=e[3],i};import{jsx as $te}from"react/jsx-runtime";import{createContext as jte,use as kte}from"react";var kF=jte(null),G2=({activeTabSlug:t,children:e,reloadTabContent:o})=>$te(kF,{value:{activeTabSlug:t,reloadTabContent:o},children:e}),W2=()=>kte(kF);import{c as OF}from"react/compiler-runtime";import{jsx as BF}from"react/jsx-runtime";import"react";import{jsx as MF}from"react/jsx-runtime";import"react";var U2=({className:t})=>MF("svg",{className:["icon","icon--sort",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:MF("path",{clipRule:"evenodd",d:"M7.5 6a.5.5 0 0 0-.5.5v9.793l-1.147-1.146-.078-.065a.5.5 0 0 0-.693.693l.064.079 2 2 .079.064a.5.5 0 0 0 .628-.064l2-2a.5.5 0 0 0-.707-.707L8 16.293V6.5a.5.5 0 0 0-.5-.5M18 16.5a.5.5 0 0 0-.5-.5h-5a.5.5 0 1 0 0 1h5a.5.5 0 0 0 .5-.5m0-3a.5.5 0 0 0-.5-.5h-5a.5.5 0 1 0 0 1h5a.5.5 0 0 0 .5-.5m0-3a.5.5 0 0 0-.5-.5h-5a.5.5 0 1 0 0 1h5a.5.5 0 0 0 .5-.5m0-3a.5.5 0 0 0-.5-.5h-5a.5.5 0 1 0 0 1h5a.5.5 0 0 0 .5-.5",fill:"currentColor",fillRule:"evenodd"})});var X2="sort-header";function Mte(){let t=OF(7),{handleSortChange:e,orderableFieldName:o,query:n}=bt(),s=(Array.isArray(n.sort)?n.sort[0]:n.sort)===o,i;t[0]!==e||t[1]!==s||t[2]!==o?(i=()=>{s||e(o)},t[0]=e,t[1]=s,t[2]=o,t[3]=i):i=t[3];let a=i,l;return t[4]!==a||t[5]!==s?(l={handleSortPress:a,isActive:s},t[4]=a,t[5]=s,t[6]=l):l=t[6],l}var Bte=t=>{let e=OF(8),{appearance:o}=t,{handleSortPress:n,isActive:r}=Mte(),{t:s}=N(),i;if(e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s){let a=s("general:sortByLabelDirection",{direction:s("general:ascending"),label:"Order"}),l=o&&`${X2}--appearance-${o}`,c=r&&`${X2}--active`,u;e[5]!==l||e[6]!==c?(u=[X2,l,c].filter(Boolean),e[5]=l,e[6]=c,e[7]=u):u=e[7],i=BF("button",{"aria-label":a,className:u.join(" "),onClick:n,type:"button",children:BF(U2,{})}),e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=i}else i=e[4];return i};import{c as Ote}from"react/compiler-runtime";import{jsx as VF}from"react/jsx-runtime";import"react";var Vte="sort-row",Hte=()=>{let t=Ote(2),{orderableFieldName:e,query:o}=bt(),n=o.sort===e||o.sort===`-${e}`,r=`${Vte} ${n?"active":""}`,s;return t[0]!==r?(s=VF("div",{className:r,role:"button",tabIndex:0,children:VF(Ho,{})}),t[0]=r,t[1]=s):s=t[1],s};import{jsx as As,jsxs as J2}from"react/jsx-runtime";import{DragOverlay as zte}from"@dnd-kit/core";import{formatAdminURL as Gte}from"payload/shared";import{useEffect as Wte,useState as q2}from"react";import{jsx as L0}from"react/jsx-runtime";var Z2=({cellMap:t,columns:e,dragAttributes:o={},dragListeners:n={},rowId:r,...s})=>L0("tr",{...s,children:e.map((i,a)=>{let{accessor:l}=i,c=i.renderedCells[t[r]];return l==="_dragHandle"?L0("td",{className:`cell-${l}`,children:L0("div",{...o,...n,children:c})},a):L0("td",{className:[`cell-${l}`,i.isLinkedColumn&&"cell--linked"].filter(Boolean).join(" "),children:c},a)})});import{jsx as Y2}from"react/jsx-runtime";var HF=({children:t,className:e,rowId:o})=>typeof o>"u"?null:Y2("div",{className:e,children:Y2("table",{cellPadding:0,cellSpacing:0,children:Y2("tbody",{children:t})})});var $0="table",Ute=({appearance:t="default",BeforeTable:e,collection:o,columns:n,data:r})=>{let{config:s}=G(),{data:i,orderableFieldName:a,query:l}=bt(),{code:c}=Ce(),u=i?.docs||r,[d,f]=q2(u),[m,p]=q2({}),[h,g]=q2();Wte(()=>{f(u),p(Object.fromEntries(u.map((x,w)=>[String(x.id??x._id),w])))},[u]);let b=n?.filter(x=>x?.active);if(!b||b.filter(x=>!["_dragHandle","_select"].includes(x.accessor)).length===0)return As("div",{children:"No columns selected"});let v=async({moveFromIndex:x,moveToIndex:w})=>{if(l.sort!==a&&l.sort!==`-${a}`){se.warning('To reorder the rows you must first sort them by the "Order" column'),g(void 0);return}if(x===w){g(void 0);return}let S=d[x].id??d[x]._id,_=w>x?d[w]:d[w-1],I=w>x?d[w+1]:d[w],A=[...d];f(D=>{let T=[...D];return T[x][a]="pending",T.splice(w,0,T.splice(x,1)[0]),T});try{let D=_?{id:_.id??_._id,key:_[a]}:{id:I.id??I._id,key:I[a]},T=_&&l.sort===a||!_&&l.sort===`-${a}`?"greater":"less",R={collectionSlug:o.slug,docsToMove:[S],newKeyWillBe:T,orderableFieldName:a,target:D},P=await fetch(Gte({apiRoute:s.routes.api,path:`/reorder?locale=${c}`}),{body:JSON.stringify(R),credentials:"include",headers:{"Content-Type":"application/json"},method:"POST"});if(P.status===403)throw new Error("You do not have permission to reorder these rows");if(!P.ok)throw new Error("Failed to reorder. This can happen if you reorder several rows too quickly. Please try again.");if(P.status===200&&(await P.json()).message==="initial migration")throw new 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(D){let T=D instanceof Error?D.message:String(D);f(A),se.error(T)}finally{g(void 0)}},C=({id:x})=>{g(x)},y=d.map(x=>x.id??x._id);return J2("div",{className:[$0,t&&`${$0}--appearance-${t}`].filter(Boolean).join(" "),children:[e,J2(hr,{ids:y,onDragEnd:v,onDragStart:C,children:[J2("table",{cellPadding:"0",cellSpacing:"0",children:[As("thead",{children:As("tr",{children:b.map((x,w)=>As("th",{id:`heading-${x.accessor}`,children:x.Heading},w))})}),As("tbody",{children:d.map((x,w)=>As(Yr,{id:y[w],children:({attributes:S,isDragging:_,listeners:I,setNodeRef:A,transform:D,transition:T})=>As(Z2,{cellMap:m,className:`row-${w+1}`,columns:b,dragAttributes:S,dragListeners:I,ref:A,rowId:x.id??x._id,style:{opacity:_?0:1,transform:D,transition:T}})},y[w]))})]}),As(zte,{children:As(HF,{className:[$0,`${$0}--drag-preview`].join(" "),rowId:h,children:As(Z2,{cellMap:m,columns:b,rowId:h})})})]})]})};import{jsx as zF}from"react/jsx-runtime";import{toWords as Xte,transformColumnsToSearchParams as Zte}from"payload/shared";import"react";var Yte="query-preset-columns-cell",Jte=({cellData:t})=>zF("div",{className:Yte,children:t?Zte(t).map((e,o)=>{let n=!e.startsWith("-");return n?zF(vr,{pillStyle:n?"always-white":"light",size:"small",children:Xte(e)},o):null}):"No columns selected"});import{jsx as qte}from"react/jsx-runtime";import{toWords as j0}from"payload/shared";import"react";var Qte=t=>{if(t.or&&t.or.length>0&&t.or[0].and&&t.or[0].and.length>0){let o=t.or[0]?.and?.[0];if(!o||typeof o!="object")return"No where query";let n=Object.keys(o)[0];if(!n||!o[n]||typeof o[n]!="object")return"No where query";let r=Object.keys(o[n])[0],s=o[n][r];if(typeof s=="string")return`${j0(n)} ${r} ${j0(s)}`;if(Array.isArray(s))return`${j0(n)} ${r} ${s.map(i=>j0(i)).join(" or ")}`}return""},Kte=({cellData:t})=>qte("div",{children:t?Qte(t):"No where query"});import{jsx as GF,jsxs as WF}from"react/jsx-runtime";import{toWords as UF}from"payload/shared";import{Fragment as eoe}from"react";var toe=({cellData:t})=>{let e=["read","update","delete"];return GF("p",{children:e.reduce((o,n,r)=>{let s=t?.[n];return s&&s.constraint&&o.push(WF(eoe,{children:[WF("span",{children:[GF("strong",{children:UF(n)}),": ",UF(s.constraint)]}),r!==e.length-1&&", "]},n)),o},[])})};import{jsx as aoe,jsxs as loe}from"react/jsx-runtime";import{toWords as coe}from"payload/shared";import{useMemo as JF}from"react";import{getTranslation as Qf}from"@payloadcms/translations";import{fieldAffectsData as ZF,fieldIsHiddenOrDisabled as ioe,fieldIsID as YF,tabHasName as e5}from"payload/shared";var M0=[{label:"equals",value:"equals"},{label:"isNotEqualTo",value:"not_equals"}],ooe=[{label:"isIn",value:"in"},{label:"isNotIn",value:"not_in"}],La={label:"exists",value:"exists"},Pi=[...M0,...ooe,La],XF=[...Pi,{label:"isGreaterThan",value:"greater_than"},{label:"isLessThan",value:"less_than"},{label:"isLessThanOrEqualTo",value:"less_than_equal"},{label:"isGreaterThanOrEqualTo",value:"greater_than_equal"}],roe=[...M0,{label:"near",value:"near"}],noe={label:"within",value:"within"},soe={label:"intersects",value:"intersects"},Q2={label:"isLike",value:"like"},K2={label:"isNotLike",value:"not_like"},k0={label:"contains",value:"contains"},qu={checkbox:{component:"Text",operators:[...M0,La]},code:{component:"Text",operators:[...Pi,Q2,K2,k0]},date:{component:"Date",operators:[...XF,La]},email:{component:"Text",operators:[...Pi,k0]},json:{component:"Text",operators:[La]},number:{component:"Number",operators:[...XF,La]},point:{component:"Point",operators:[...roe,La,noe,soe]},radio:{component:"Select",operators:[...Pi]},relationship:{component:"Relationship",operators:[...Pi]},richText:{component:"Text",operators:[La]},select:{component:"Select",operators:[...Pi]},text:{component:"Text",operators:[...Pi,Q2,K2,k0]},textarea:{component:"Text",operators:[...Pi,Q2,K2,k0]},upload:{component:"Relationship",operators:[...Pi]}},qf=({field:t,operator:e})=>{let o=[];return t.type==="relationship"&&Array.isArray(t.relationTo)?o=[...M0,La]:o=[...qu[t.type].operators],{validOperator:e&&o.find(({value:n})=>n===e)?e:o[0].value,validOperators:o}};var _n=({fieldPermissions:t,fields:e,i18n:o,labelPrefix:n,pathPrefix:r})=>e.reduce((s,i)=>{let a=r;if(ioe(i)&&!YF(i)||"virtual"in i&&i.virtual===!0)return s;let l=!1;if("virtual"in i&&typeof i.virtual=="string"&&(a=a?a+"."+i.virtual:i.virtual,ZF(i)&&(l=!0)),i.type==="tabs"&&"tabs"in i)return i.tabs.forEach(u=>{if(typeof u.label!="boolean"){let d=Qf(u.label,o),f=e5(u)?n?n+" > "+d:d:n,m=e5(u)&&u.name?a?a+"."+u.name:u.name:a;typeof d=="string"&&s.push(..._n({fieldPermissions:typeof t=="boolean"?t:e5(u)&&u.name?t?.[u.name]?.fields||t?.[u.name]:t,fields:u.fields,i18n:o,labelPrefix:f,pathPrefix:m}))}}),s;if(i.type==="row"&&"fields"in i)return s.push(..._n({fieldPermissions:t,fields:i.fields,i18n:o,labelPrefix:n,pathPrefix:a})),s;if(i.type==="collapsible"&&"fields"in i){let c=Qf(i.label||"",o),u=n?n+" > "+c:c;return s.push(..._n({fieldPermissions:t,fields:i.fields,i18n:o,labelPrefix:u,pathPrefix:a})),s}if(i.type==="group"&&"fields"in i){let c=Qf(i.label||"",o),u=n?c?n+" > "+c:n:c;if(ZF(i)){let d=i.name?a?a+"."+i.name:i.name:a;s.push(..._n({fieldPermissions:typeof t=="boolean"?t:t?.[i.name]?.fields||t?.[i.name],fields:i.fields,i18n:o,labelPrefix:u,pathPrefix:d}))}else s.push(..._n({fieldPermissions:t,fields:i.fields,i18n:o,labelPrefix:u,pathPrefix:a}));return s}if(i.type==="array"&&"fields"in i){let c=Qf(i.label||"",o),u=n?c?n+" > "+c:n:c,d=i.name?a?a+"."+i.name:i.name:a;return s.push(..._n({fieldPermissions:typeof t=="boolean"?t:t?.[i.name]?.fields||t?.[i.name],fields:i.fields,i18n:o,labelPrefix:u,pathPrefix:d})),s}if(typeof qu[i.type]=="object"&&(YF(i)||t===!0||t?.[i.name]===!0||t?.[i.name]?.read===!0)){let c=new Set,{validOperators:u}=qf({field:i}),d=u.reduce((g,b)=>{if(!c.has(b.value)){c.add(b.value);let v=`operators:${b.label}`;g.push({...b,label:o.t(v)})}return g},[]),f=Qf(i.label||"",o),m=n?Ff({field:i,prefix:n}):f,p;l?p=a:a?p=Vu(a,i):p=i.name;let h={fieldPath:p,label:m,plainTextLabel:`${n?n+" > ":""}${f}`,...qu[i.type],field:i,operators:d};return s.push(h),s}return s},[]);var uoe=({cellData:t,rowData:e})=>{let{i18n:o}=N(),{permissions:n}=ye(),{config:r}=G(),s=e?.relatedCollection,i=JF(()=>s?r.collections?.find(m=>m.slug===s):null,[s,r.collections]),a=JF(()=>{if(!i)return[];let m=n?.collections?.[s]?.fields;return _n({fieldPermissions:m,fields:i.fields,i18n:o})},[i,n,s,o]);if(!t||typeof t!="string")return aoe("div",{children:"No group by selected"});let l=t.startsWith("-"),c=l?t.slice(1):t,u=l?"descending":"ascending",f=a.find(m=>m.fieldPath===c)?.label||coe(c);return loe("div",{children:[f," (",u,")"]})};import{jsx as B0,jsxs as goe}from"react/jsx-runtime";import{fieldIsHiddenOrDisabled as boe,fieldIsID as sN,flattenTopLevelFields as voe}from"payload/shared";import yoe,{useMemo as o5}from"react";import{fieldAffectsData as doe,fieldIsHiddenOrDisabled as moe,fieldIsID as qF,isFieldDisabled as foe}from"payload/shared";var poe=t=>t.type!=="ui"&&moe(t)&&!qF(t)||foe(t,"column"),nc=({fieldPermissions:t,fields:e})=>(e??[]).reduce((o,n)=>{if(poe(n))return o;if(n.type==="tabs"&&"tabs"in n){let r={...n,tabs:n.tabs.map(s=>({...s,fields:nc({fieldPermissions:typeof t=="boolean"?t:"name"in s&&s.name?t[s.name]?.fields||t[s.name]:t,fields:s.fields})}))};return o.push(r),o}if("fields"in n&&Array.isArray(n.fields)){let r={...n,fields:nc({fieldPermissions:typeof t=="boolean"?t:"name"in n&&n.name?t?.[n.name]?.fields||t?.[n.name]:t,fields:n.fields})};return o.push(r),o}if(t===!0)return o.push(n),o;if(doe(n)){let r=t?.[n.name];return(qF(n)||r===!0||r?.read===!0)&&o.push(n),o}return o.push(n),o},[]);function QF({accessor:t,activeColumnsIndices:e,column:o,columns:n}){return o?o.active:n&&Array.isArray(n)&&n.length>0?!!n.find(r=>r.accessor===t)?.active:e.length<4}function KF(t){return t.accessor??("name"in t?t.name:void 0)}function eN(t,e){return t?.sort((o,n)=>{let r=e.findIndex(i=>"name"in o&&i.accessor===KF(o)),s=e.findIndex(i=>"name"in n&&i.accessor===KF(n));return r===-1&&s===-1?0:r===-1?1:s===-1?-1:r-s})}import{fieldAffectsData as rN,flattenTopLevelFields as hoe}from"payload/shared";import{fieldAffectsData as tN}from"payload/shared";var t5=(t,e)=>t?.reduce((o,n)=>tN(n)&&n.name===e?o:!tN(n)&&"fields"in n?[...o,...t5(n.fields,e)]:n.type==="tabs"&&"tabs"in n?[...o,...n.tabs.reduce((r,s)=>[...r,..."name"in s?[s.name]:t5(s.fields,e)],[])]:[...o,n.name],[]),oN=(t,e,o)=>{let n=[];if(Array.isArray(o)&&o.length>=1)n=o;else{e&&n.push(e);let r=t5(t,e);n=n.concat(r),n=n.slice(0,4)}return n.map(r=>({accessor:r,active:!0}))};var nN=({clientConfig:t,collectionConfig:e,collectionSlug:o,columns:n,i18n:r,permissions:s})=>{let i=Array.isArray(o),a=i?[]:e?.fields??[];if(i)for(let l of o){let c=t.collections.find(u=>u.slug===l);for(let u of nc({fieldPermissions:s?.collections?.[l]?.fields||!0,fields:c.fields}))rN(u)&&a.some(d=>rN(d)&&d.name===u.name)||a.push(u)}return n?.length?n?.filter(l=>hoe(a,{i18n:r,keepPresentationalFields:!0,moveSubFieldsToTop:!0})?.some(c=>("accessor"in c?c.accessor:"name"in c?c.name:void 0)===l.accessor)):oN(i?a:nc({fieldPermissions:typeof o=="string"&&s?.collections?.[o]?.fields?s.collections[o].fields:!0,fields:a}),e?.admin?.useAsTitle,i?[]:e?.admin?.defaultColumns)};var Coe=({field:{label:t,required:e}})=>{let{path:o,setValue:n,value:r}=Ne(),i=Ne({path:"relatedCollection"}).value,{config:a,getEntityConfig:l}=G(),{i18n:c}=N(),{permissions:u}=ye(),d=o5(()=>i?l({collectionSlug:i}):null,[i,l]),f=o5(()=>!i||!d?[]:nN({clientConfig:a,collectionConfig:d,collectionSlug:i,columns:r??[],i18n:c,permissions:u}),[a,d,i,r,c,u]),m=o5(()=>{if(!d?.fields)return[];let h=u?.collections?.[i]?.fields??!0,g=voe(nc({fieldPermissions:h,fields:d.fields}),{i18n:c,keepPresentationalFields:!0,moveSubFieldsToTop:!0}),b=g.findIndex(x=>sN(x));b>-1&&g.unshift(g.splice(b,1)[0]);let v=d.admin?.useAsTitle,C=v?g.findIndex(x=>"name"in x&&x.name===v):-1;C>-1&&g.unshift(g.splice(C,1)[0]),g=eN(g,f);let y=[];return g.reduce((x,w,S)=>{if(boe(w)&&!sN(w)||w.type==="group")return x;let _="accessor"in w?w.accessor:"name"in w?w.name:void 0;if(!_)return x;let I=f.find(D=>D.accessor===_),A=QF({accessor:_,activeColumnsIndices:y,column:I,columns:f});return A&&y.push(S),x.push({accessor:_,active:A,field:w,Heading:null,renderedCells:[]}),x},[])},[d,f,c,u,i]),p=yoe.useCallback(h=>{let g=h.map(b=>({accessor:b.accessor,active:b.active}));n(g.length?g:void 0)},[n]);return!i||!d?goe("div",{className:"field-type query-preset-columns-field",children:[B0(Fe,{as:"h3",label:t,path:o,required:e}),B0("p",{className:"query-preset-columns-field__hint",children:"Select the related collection to configure columns."})]}):B0("div",{className:"field-type query-preset-columns-field",children:B0(Ag,{collectionSlug:i,columns:m,onChange:p})})};import{c as Hoe}from"react/compiler-runtime";import{jsx as z0,jsxs as zoe}from"react/jsx-runtime";import"react";import{jsx as Ku,jsxs as Moe}from"react/jsx-runtime";import{dequal as Boe}from"dequal/lite";import{isFieldDisabled as Ooe,transformWhereQuery as Voe,validateWhereQuery as RN}from"payload/shared";import Kf,{useMemo as m5}from"react";import{jsx as rn,jsxs as wN}from"react/jsx-runtime";import{useCallback as SN,useEffect as _N,useRef as joe,useState as koe}from"react";import{isFieldDisabled as d5}from"payload/shared";import{jsx as Qu}from"react/jsx-runtime";import"react";import{jsx as iN}from"react/jsx-runtime";import{getTranslation as xoe}from"@payloadcms/translations";import"react";var woe="condition-value-date",r5=t=>{let{disabled:e,field:o,onChange:n,value:r}=t,{admin:s}=o,{date:i}=s||{},{config:a}=G(),{admin:l}=a,{dateFormat:c}=l,{i18n:u,t:d}=N(),f=i?.displayFormat||c;return iN("div",{className:woe,children:iN(su,{...i,displayFormat:f,onChange:n,placeholder:xoe(s.placeholder,u)||d("general:enterAValue"),readOnly:e,value:r})})};import{c as Soe}from"react/compiler-runtime";import{jsx as aN}from"react/jsx-runtime";import{getTranslation as lN}from"@payloadcms/translations";import cN from"react";var n5=t=>{let e=Soe(10),{disabled:o,field:n,onChange:r,operator:s,value:i}=t,{admin:a,hasMany:l,label:c}=n,{i18n:u,t:d}=N(),f=c?lN(c,u):d("general:enterAValue"),m;e[0]!==l||e[1]!==s?(m=["in","not_in"].includes(s)||l,e[0]=l,e[1]=s,e[2]=m):m=e[2];let p=m,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[3]=h):h=e[3];let[g,b]=cN.useState(h),v;e[4]!==p||e[5]!==r?(v=S=>{let _;S?p&&(Array.isArray(S)?_=S.map(_oe):_=[Number(S.value?.value||S.value)]):_=[],r(_)},e[4]=p,e[5]=r,e[6]=v):v=e[6];let C=v,y,x;e[7]!==i?(y=()=>{Array.isArray(i)?b(i.map(Ioe)):b([])},x=[i],e[7]=i,e[8]=y,e[9]=x):(y=e[8],x=e[9]),cN.useEffect(y,x);let w=lN(a?.placeholder,u)||d("general:enterAValue");return p?aN(mt,{"aria-label":f,disabled:o,isClearable:!0,isCreatable:!0,isMulti:p,isSortable:!0,numberOnly:!0,onChange:C,options:[],placeholder:w,value:g||[]}):aN("input",{"aria-label":f,className:"form-input",disabled:o,onChange:S=>r(S.target.value),placeholder:w,type:"number",value:i})};function _oe(t){return Number(t.value?.value||t.value)}function Ioe(t,e){return{id:`${t}${e}`,label:`${t}`,value:{toString:()=>`${t}${e}`,value:t?.value||t}}}import{jsx as s5}from"react/jsx-runtime";import{formatAdminURL as fN}from"payload/shared";import*as bN from"qs-esm";import pN,{useCallback as O0,useEffect as hN,useReducer as Toe,useState as i5}from"react";import{getTranslation as uN}from"@payloadcms/translations";var dN=t=>t.reduce((e,o)=>o.options?[...e,...dN(o.options)]:[...e,o.value],[]),Roe=(t,e)=>{switch(e.type){case"ADD":{let{collection:o,data:n,hasMultipleRelations:r,i18n:s,relation:i}=e,a=o.admin.useAsTitle||"id",l=dN(t);if(!r)return[...t,...n.docs.reduce((f,m)=>l.indexOf(m.id)===-1?(l.push(m.id),[...f,{label:m[a],value:m.id}]):f,[])];let c=[...t],u=c.find(f=>f.label===uN(o.labels.plural,s)),d=n.docs.reduce((f,m)=>l.indexOf(m.id)===-1?(l.push(m.id),[...f,{label:m[a],relationTo:i,value:m.id}]):f,[]);return u?u.options=[...u.options,...d]:c.push({label:uN(o.labels.plural,s),options:d,value:void 0}),c}case"CLEAR":return e.required?[]:[{label:e.i18n.t("general:none"),value:"null"}];default:return t}},mN=Roe;var gN="condition-value-relationship",Doe=10,V0=t=>{let{disabled:e,field:{admin:o={},hasMany:n,relationTo:r},filterOptions:s,onChange:i,operator:a,value:l}=t,c="placeholder"in o?o?.placeholder:void 0,u=o?.isSortable,d=n||["in","not_in"].includes(a),{config:{routes:{api:f}},getEntityConfig:m}=G(),p=Array.isArray(r),[h,g]=Toe(mN,[]),[b,v]=i5(""),C=Vn(b,300),[y,x]=i5(""),[w,S]=i5(!1),{i18n:_,t:I}=N(),A=Ce(),D=p?r:[r],T=pN.useRef(new Map(D.map(j=>[j,{hasLoadedAll:!1,nextPage:1}]))),R=O0((j,k)=>{let O=m({collectionSlug:k});g({type:"ADD",collection:O,data:j,hasMultipleRelations:p,i18n:_,relation:k})},[p,_,m]),P=et(async({abortController:j,relationSlug:k})=>{let O=T.current.get(k);if(k&&!O.hasLoadedAll){let H=m({collectionSlug:k})?.admin?.useAsTitle||"id",z={and:[]},W={depth:0,limit:Doe,locale:A.code,page:O.nextPage,select:{[H]:!0},where:z};s&&s?.[k]&&W.where.and.push(s[k]),C&&W.where.and.push({[H]:{like:C}});try{let U=await fetch(fN({apiRoute:f,path:`/${k}${bN.stringify(W,{addQueryPrefix:!0})}`}),{credentials:"include",headers:{"Accept-Language":_.language},signal:j.signal});if(U.ok){let X=await U.json();X.docs.length>0&&(R(X,k),X.nextPage?T.current.set(k,{hasLoadedAll:!1,nextPage:X.nextPage}):T.current.set(k,{hasLoadedAll:!0,nextPage:null}))}else x(I("error:unspecific"))}catch(U){j.signal.aborted||console.error(U)}}S(!0)}),E=pN.useCallback(()=>{let j=T.current.entries().next().value;if(j[0]&&!j[1].hasLoadedAll){let k=new AbortController;P({abortController:k,relationSlug:j[0]})}},[]),F=O0(()=>{if(l){if(d)return Array.isArray(l)?l.map(j=>{if(p){let k;return h.forEach(O=>{O.options&&O.options.some(V=>V?.value==j.value?(k=V,!0):!1)}),k}return h.find(k=>k.value==j)}):void 0;if(p){let j,k=l;return h.forEach(O=>{O?.options&&O.options.some(V=>V?.value==k.value?(j=V,!0):!1)}),j}return h.find(j=>j.value==l)}},[d,p,l,h]),L=O0(j=>{if(j!==b){g({type:"CLEAR",i18n:_,required:!1});let k=Array.isArray(r)?r:[r];T.current=new Map(k.map(O=>[O,{hasLoadedAll:!1,nextPage:1}])),v(j)}},[_,r,b]),M=O0(async(j,k)=>{if(!y&&j!=="null"&&j&&k){let O=await fetch(fN({apiRoute:f,path:`/${k}/${j}?depth=0`}),{credentials:"include",headers:{"Accept-Language":_.language}});if(O.ok){let V=await O.json();R({docs:[V]},k)}else console.error(I("error:loadingDocument",{id:j}))}},[_,R,f,y,I]);hN(()=>{let j=Array.isArray(r)?r:[r];T.current=new Map(j.map(O=>[O,{hasLoadedAll:!1,nextPage:1}])),g({type:"CLEAR",i18n:_,required:!1}),S(!1);let k=[];return j.forEach(O=>{let V=new AbortController;P({abortController:V,relationSlug:O}),k.push(V)}),()=>{k.forEach(O=>{if(O.signal)try{O.abort()}catch{}})}},[_,r,C,s]),hN(()=>{if(l&&w){if(d)(F()||[]).forEach((k,O)=>{k||(p?M(l[O].value,l[O].relationTo):M(l[O],r))});else if(!F())if(p){let k=l;M(k.value,k.relationTo)}else M(l,r)}},[M,F,d,p,r,l,w]);let $=["field-type",gN,y&&"error-loading"].filter(Boolean).join(" "),B=F()||l;return s5("div",{className:$,children:y?s5("div",{className:`${gN}__error-loading`,children:y}):s5(mt,{disabled:e,isMulti:d,isSortable:u,onChange:j=>{if(!j){i(null);return}d&&Array.isArray(j)?i(j?j.map(k=>p?{relationTo:k?.relationTo,value:k?.value}:k?.value):null):p&&!Array.isArray(j)?i({relationTo:j?.relationTo,value:j?.value}):Array.isArray(j)||i(j?.value)},onInputChange:L,onMenuScrollToBottom:E,options:h,placeholder:c,value:B})})};import{c as Aoe}from"react/compiler-runtime";import{jsx as Poe}from"react/jsx-runtime";import{getTranslation as a5}from"@payloadcms/translations";import l5 from"react";var c5=t=>{let e=Aoe(21),{disabled:o,field:n,isClearable:r,onChange:s,operator:i,options:a,value:l}=t,{admin:c}=n,{placeholder:u}=c,{i18n:d}=N(),f;e[0]!==a?(f=Hm(a),e[0]=a,e[1]=f):f=e[1];let[m,p]=l5.useState(f),h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=["in","not_in"],e[2]=h):h=e[2];let g=h.includes(i),b;if(g&&Array.isArray(l)){let I;e[3]!==d||e[4]!==m?(I=A=>{let D=m.find(T=>T.value===A);return{label:D?a5(D.label,d):A,value:D?.value??A}},e[3]=d,e[4]=m,e[5]=I):I=e[5],b=l.map(I)}else if(l){let I;e[6]!==l?(I=D=>D.value===l,e[6]=l,e[7]=I):I=e[7];let A=m.find(I);b={label:A?a5(A.label,d):l,value:A?.value??l}}let v;e[8]!==g||e[9]!==s?(v=I=>{let A;I?g?Array.isArray(I)?A=I.map(Foe):A=[]:A=I.value:A=null,s(A)},e[8]=g,e[9]=s,e[10]=v):v=e[10];let C=v,y,x;e[11]!==a?(y=()=>{p(Hm(a))},x=[a],e[11]=a,e[12]=y,e[13]=x):(y=e[12],x=e[13]),l5.useEffect(y,x);let w,S;e[14]!==g||e[15]!==s||e[16]!==l?(w=()=>{!g&&Array.isArray(l)&&s(l[0])},S=[g,s,l],e[14]=g,e[15]=s,e[16]=l,e[17]=w,e[18]=S):(w=e[17],S=e[18]),l5.useEffect(w,S);let _;return e[19]!==d?(_=I=>({...I,label:a5(I.label,d)}),e[19]=d,e[20]=_):_=e[20],Poe(mt,{disabled:o,isClearable:r,isMulti:g,onChange:C,options:m.map(_),placeholder:u,value:b})};function Foe(t){return t.value}import{c as Noe}from"react/compiler-runtime";import{jsx as vN}from"react/jsx-runtime";import{getTranslation as Eoe}from"@payloadcms/translations";import yN from"react";var u5=t=>{let e=Noe(10),{disabled:o,field:n,onChange:r,operator:s,value:i}=t,{i18n:a,t:l}=N(),c=n?.label?Eoe(n.label,a):l("general:enterAValue"),u=n?.hasMany??!1,d;e[0]!==u||e[1]!==s?(d=["in","not_in"].includes(s)||u,e[0]=u,e[1]=s,e[2]=d):d=e[2];let f=d,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=[],e[3]=m):m=e[3];let[p,h]=yN.useState(m),g;e[4]!==f||e[5]!==r?(g=y=>{let x;y?f&&(Array.isArray(y)?x=y.map(Loe):x=[y.value?.value||y.value]):x=[],r(x)},e[4]=f,e[5]=r,e[6]=g):g=e[6];let b=g,v,C;return e[7]!==i?(v=()=>{Array.isArray(i)?h(i.map($oe)):h([])},C=[i],e[7]=i,e[8]=v,e[9]=C):(v=e[8],C=e[9]),yN.useEffect(v,C),f?vN(mt,{"aria-label":c,disabled:o,isClearable:!0,isCreatable:!0,isMulti:f,isSortable:!0,onChange:b,options:[],placeholder:l("general:enterAValue"),value:p||[]}):vN("input",{"aria-label":c,className:"form-input",disabled:o,onChange:y=>r(y.target.value),placeholder:l("general:enterAValue"),type:"text",value:i||""})};function Loe(t){return t.value?.value||t.value}function $oe(t,e){return{id:`${t}${e}`,label:`${t}`,value:{toString:()=>`${t}${e}`,value:t?.value||t}}}var CN=({booleanSelect:t,disabled:e,filterOptions:o,internalField:n,onChange:r,operator:s,options:i,value:a})=>{if(t||["radio","select"].includes(n?.field?.type))return Qu(c5,{disabled:e,field:n.field,isClearable:!t,onChange:r,operator:s,options:i,value:a});switch(n?.field?.type){case"date":return Qu(r5,{disabled:e,field:n.field,onChange:r,operator:s,value:a});case"number":return Qu(n5,{disabled:e,field:n.field,onChange:r,operator:s,value:a});case"relationship":return Qu(V0,{disabled:e,field:n.field,filterOptions:o??{},onChange:r,operator:s,value:a});case"upload":return Qu(V0,{disabled:e,field:n.field,filterOptions:o??{},onChange:r,operator:s,value:a});default:return Qu(u5,{disabled:e,field:n?.field,onChange:r,operator:s,value:a})}};var xN=t=>({all:"any",contains:"string",equals:"any",exists:"boolean",greater_than:t==="date"?"object":"string",greater_than_equal:t==="date"?"object":"string",in:"any",intersects:"any",less_than:t==="date"?"object":"string",less_than_equal:t==="date"?"object":"string",like:"string",near:"any",not_equals:"any",not_in:"any",not_like:"string",within:"any"});var Ps="condition",IN=t=>{let{andIndex:e,disableRemoveButton:o,fieldPath:n,filterOptions:r,isFirstCondition:s,join:i,operator:a,orIndex:l,reducedFields:c,removeCondition:u,RenderedFilter:d,updateCondition:f,updateJoin:m,value:p}=t,{t:h}=N(),g=c.find(D=>D.fieldPath===n),[b,v]=koe(p),C=Vn(b,300),y=joe(p),x=["exists"].includes(a)||g?.field?.type==="checkbox",w=[];x?w=[{label:h("general:true"),value:"true"},{label:h("general:false"),value:"false"}]:g?.field&&"options"in g.field&&(w=g.field.options);let S=et(async D=>{if(a){let T=D===null||D===""?void 0:D;y.current=T,await f({type:"value",andIndex:e,field:g,operator:a,orIndex:l,value:T})}});_N(()=>{S(C)},[C]),_N(()=>{p!==y.current&&(y.current=p,v(p))},[p]);let _=!g?.fieldPath||d5(g?.field,"filter"),I=SN(async D=>{v(void 0),await f({type:"field",andIndex:e,field:c.find(T=>T.fieldPath===D.value),operator:a,orIndex:l,value:void 0})},[e,a,l,c,f]),A=SN(async D=>{let R=xN(g.field.type)[D.value]||"any",P=R==="any"||typeof p===R||R==="boolean"&&(p==="true"||p==="false");P||v(void 0),await f({type:"operator",andIndex:e,field:g,operator:D.value,orIndex:l,value:P?p:void 0})},[e,g,l,f,p]);return rn("div",{className:Ps,children:wN("div",{className:`${Ps}__wrap`,children:[rn("div",{className:`${Ps}__join`,children:s?rn("span",{className:`${Ps}__join-label`,children:h("general:where")}):rn(mt,{classNames:{menu:()=>"condition__join-menu"},isClearable:!1,onChange:D=>m({andIndex:e,join:D.value,orIndex:l}),options:[{label:h("general:and"),value:"and"},{label:h("general:or"),value:"or"}],value:{label:h(i==="and"?"general:and":"general:or"),value:i}})}),wN("div",{className:`${Ps}__inputs`,children:[rn("div",{className:`${Ps}__field`,children:rn(mt,{disabled:_,filterOption:(D,T)=>(D?.data?.plainTextLabel||D.label).toLowerCase().includes(T.toLowerCase()),isClearable:!1,onChange:I,options:c.filter(D=>!d5(D.field,"filter")).map(D=>({...D,value:D.fieldPath})),value:g?{...g,value:g.fieldPath}:void 0})}),rn("div",{className:`${Ps}__operator`,children:rn(mt,{disabled:_,isClearable:!1,onChange:A,options:g?.operators,value:g?.operators.find(D=>a===D.value)||null})}),rn("div",{className:`${Ps}__value`,children:d||rn(CN,{booleanSelect:x,disabled:!a||!g||d5(g?.field,"filter"),filterOptions:r,internalField:g,onChange:v,operator:a,options:w,value:b??""})})]}),rn("div",{className:`${Ps}__actions`,children:rn(Z,{buttonStyle:"ghost",className:`${Ps}__actions-remove`,disabled:o,icon:rn(gm,{size:24}),onClick:()=>u({andIndex:e,orIndex:l})})})]})})};var ep="where-builder",H0=t=>{let{collectionSlug:e,fields:o,onChange:n,onEmptyRemove:r,renderedFilters:s=void 0,resolvedFilterOptions:i=void 0,value:a}=t,{i18n:l,t:c}=N(),{permissions:u}=ye(),d=u?.collections?.[e]?.fields,f=m5(()=>_n({fieldPermissions:d,fields:o??[],i18n:l}),[d,o,l]),m=m5(()=>f.find(w=>!Ooe(w.field,"filter")),[f]),p=m5(()=>{if(a){if(RN(a))return a.or??[];let w=Voe(a);if(RN(w))return w.or??[]}return[]},[a]),h=Kf.useCallback(({andIndex:w,field:S,orIndex:_,relation:I})=>{let A=structuredClone(p),D=qu[S.field.type].operators[0].value;I==="and"?A[_].and.splice(w,0,{[String(S.fieldPath)]:{[D]:void 0}}):A.push({and:[{[String(S.fieldPath)]:{[D]:void 0}}]}),n({or:A})},[p,n]),g=Kf.useCallback(({type:w,andIndex:S,field:_,operator:I,orIndex:A,value:D})=>{if(p.length===0){if(w==="value"&&(D==null||D===""))return;let{validOperator:R}=qf({field:_.field,operator:I});n({or:[{and:[{[String(_.fieldPath)]:{[R]:D}}]}]});return}let T=p[A].and[S];if(typeof T=="object"&&_?.fieldPath){let{validOperator:R}=qf({field:_.field,operator:I}),P=T[String(_.fieldPath)]?.[R];if(typeof P<"u"&&P===D)return;let E={[String(_.fieldPath)]:{[R]:D}};if(Boe(T,E))return;let F=structuredClone(p);F[A].and[S]=E,n({or:F})}},[p,n]),b=Kf.useCallback(({andIndex:w,orIndex:S})=>{if(p.length===0){r?.();return}let _=structuredClone(p);_[S].and.splice(w,1),_[S].and.length===0&&_.splice(S,1),n({or:_}),_.length===0&&r?.()},[p,n,r]),v=Kf.useCallback(({andIndex:w,join:S,orIndex:_})=>{let I=[];p.forEach((D,T)=>{D.and.forEach((R,P)=>{let E=T===_&&P===w,F=I.length===0?null:P===0?"or":"and";I.push({cond:R,join:E?S:F})})});let A=[];I.forEach(({cond:D,join:T},R)=>{R===0||T==="or"?A.push({and:[D]}):A[A.length-1].and.push(D)}),n({or:A})},[p,n]),C=Kf.useCallback(()=>{if(m){if(p.length===0){let w=m.operators[0].value,S=()=>({and:[{[String(m.fieldPath)]:{[w]:void 0}}]});n({or:[S(),S()]});return}h({andIndex:0,field:m,orIndex:p.length,relation:"or"})}},[h,p.length,m,n]),y=p.length===0&&m?[{and:[{[m.fieldPath]:{[m.operators[0].value]:void 0}}]}]:p,x=p.length===0&&!r;return Ku("div",{className:ep,children:Moe("div",{className:`${ep}__or-filters`,children:[y.map((w,S)=>{let _=`${S}_${Array.isArray(w?.and)?w.and.length:""}`;return Ku("div",{className:`${ep}__and-filters`,children:Array.isArray(w?.and)&&w.and.map((I,A)=>{let D=y[S].and[A],T=Object.keys(D)[0],R=Object.keys(D?.[T]||{})?.[0]||void 0,P=D?.[T]?.[R]||void 0,E=S===0&&A===0,F=A===0?"or":"and";return Ku(IN,{addCondition:h,andIndex:A,disableRemoveButton:x,fieldPath:T,filterOptions:i?.get(T),isFirstCondition:E,join:F,operator:R,orIndex:S,reducedFields:f,removeCondition:b,RenderedFilter:s?.get(T),updateCondition:g,updateJoin:v,value:P},A)})},_)}),Ku("div",{className:`${ep}__add-or-row`,children:Ku(Z,{buttonStyle:"ghost",className:`${ep}__add-or`,icon:Ku(ai,{size:24}),iconPosition:"left",onClick:C,children:c("general:addFilter")})})]})})};var Goe=t=>{let e=Hoe(12),{field:o}=t,{label:n,required:r}=o,{path:s,setValue:i,value:a}=Ne(),l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={path:"relatedCollection"},e[0]=l):l=e[0];let u=Ne(l).value,{getEntityConfig:d}=G();if(!u){let m;return e[1]!==n||e[2]!==s||e[3]!==r?(m=zoe("div",{className:"field-type query-preset-where-field",children:[z0(Fe,{as:"h3",label:n,path:s,required:r}),z0("p",{className:"query-preset-where-field__hint",children:"Select the related collection to configure filters."})]}),e[1]=n,e[2]=s,e[3]=r,e[4]=m):m=e[4],m}let f;if(e[5]!==d||e[6]!==u||e[7]!==i||e[8]!==a){let m=d({collectionSlug:u}),p;e[10]!==i?(p=h=>i(h),e[10]=i,e[11]=p):p=e[11],f=z0("div",{className:"field-type query-preset-where-field",children:z0(H0,{collectionSlug:u,fields:m?.fields??[],onChange:p,value:a??void 0})}),e[5]=d,e[6]=u,e[7]=i,e[8]=a,e[9]=f}else f=e[9];return f};import{jsx as U0,jsxs as Zoe}from"react/jsx-runtime";import{useMemo as Yoe}from"react";import{jsx as G0}from"react/jsx-runtime";import{isFieldDisabled as Uoe}from"payload/shared";import{useMemo as DN}from"react";import{c as Woe}from"react/compiler-runtime";import{jsx as Eo,jsxs as Fi}from"react/jsx-runtime";import"react";var Mo="group-by-control",TN=t=>{let e=Woe(35),{close:o,filteredFields:n,groupByField:r,groupByFieldName:s,isActive:i,onChange:a,value:l}=t,{t:c}=N(),u=!l||typeof l!="string"?"asc":l.startsWith("-")?"desc":"asc",d;e[0]!==a||e[1]!==l?(d=v=>{a(l?.startsWith("-")?`-${v}`:v)},e[0]=a,e[1]=l,e[2]=d):d=e[2];let f=d,m;e[3]!==o||e[4]!==a?(m=()=>{a(""),o()},e[3]=o,e[4]=a,e[5]=m):m=e[5];let p=m,h;e[6]!==s||e[7]!==a?(h=v=>{s&&a(v==="asc"?s:`-${s}`)},e[6]=s,e[7]=a,e[8]=h):h=e[8];let g=h,b;if(e[9]!==o||e[10]!==u||e[11]!==n||e[12]!==r?.label||e[13]!==s||e[14]!==p||e[15]!==g||e[16]!==f||e[17]!==i||e[18]!==c){let v;e[20]!==n||e[21]!==s||e[22]!==f?(v=w=>{let{close:S}=w;return Eo(ue.RadioGroup,{children:n.map((_,I)=>Eo(ue.RadioGroupItem,{active:_.fieldPath===s,onClick:()=>{f(_.fieldPath),S()},children:_.label},I))})},e[20]=n,e[21]=s,e[22]=f,e[23]=v):v=e[23];let C;e[24]!==r?.label||e[25]!==c?(C=w=>{let{active:S,onClick:_,onKeyDown:I}=w;return Fi("button",{className:`${Mo}__select-trigger`,onClick:_,onKeyDown:I,type:"button",children:[Eo("span",{className:`${Mo}__select-value`,children:r?.label||c("general:selectValue")}),Eo(ve,{direction:S?"up":"down",size:16})]})},e[24]=r?.label,e[25]=c,e[26]=C):C=e[26];let y;e[27]!==u||e[28]!==g||e[29]!==c?(y=w=>{let{close:S}=w;return Fi(ue.RadioGroup,{children:[Eo(ue.RadioGroupItem,{active:u==="desc",onClick:()=>{g("desc"),S()},children:c("general:descending")}),Eo(ue.RadioGroupItem,{active:u==="asc",onClick:()=>{g("asc"),S()},children:c("general:ascending")})]})},e[27]=u,e[28]=g,e[29]=c,e[30]=y):y=e[30];let x;e[31]!==u||e[32]!==s||e[33]!==c?(x=w=>{let{active:S,onClick:_,onKeyDown:I}=w;return Fi("button",{className:[`${Mo}__select-trigger`,!s&&`${Mo}__select-trigger--disabled`].filter(Boolean).join(" "),disabled:!s,onClick:_,onKeyDown:I,type:"button",children:[Eo("span",{className:`${Mo}__select-value`,children:c(u==="desc"?"general:descending":"general:ascending")}),Eo(ve,{direction:S?"up":"down",size:16})]})},e[31]=u,e[32]=s,e[33]=c,e[34]=x):x=e[34],b=Fi("div",{className:`${Mo}__content`,children:[Fi("div",{className:`${Mo}__header`,children:[Eo("span",{className:`${Mo}__title`,children:c("general:groupByLabel",{label:""})}),Fi("div",{className:`${Mo}__header-actions`,children:[i&&Eo(Z,{"aria-label":c("general:clear"),buttonStyle:"ghost",icon:Eo(Ql,{}),onClick:p,round:!0,size:"medium"}),Eo(Z,{"aria-label":c("general:close"),buttonStyle:"ghost",icon:Eo(xt,{size:24}),onClick:o,round:!0,size:"medium"})]})]}),Fi("div",{className:`${Mo}__body`,children:[Fi("div",{className:`${Mo}__row`,children:[Eo("label",{className:`${Mo}__label`,children:c("general:field")}),Eo("div",{className:`${Mo}__input`,"data-popup-prevent-close":!0,children:Eo(Ve,{className:`${Mo}__select-popup`,horizontalAlign:"right",render:v,renderButton:C,size:"medium",verticalAlign:"bottom"})})]}),Fi("div",{className:`${Mo}__row`,children:[Eo("label",{className:`${Mo}__label`,children:c("general:sort")}),Eo("div",{className:`${Mo}__input`,"data-popup-prevent-close":!0,children:Eo(Ve,{className:`${Mo}__select-popup`,disabled:!s,horizontalAlign:"right",render:y,renderButton:x,size:"small",verticalAlign:"bottom"})})]})]})]}),e[9]=o,e[10]=u,e[11]=n,e[12]=r?.label,e[13]=s,e[14]=p,e[15]=g,e[16]=f,e[17]=i,e[18]=c,e[19]=b}else b=e[19];return b};var f5="group-by-control",Xoe=["text","textarea","number","select","relationship","date","checkbox","radio","email","upload"],W0=({collectionSlug:t,fields:e,onChange:o,value:n})=>{let{i18n:r,t:s}=N(),{permissions:i}=ye(),a=n?.replace(/^-/,""),l=i?.collections?.[t]?.fields,c=DN(()=>_n({fieldPermissions:l,fields:e,i18n:r}),[e,l,r]),u=DN(()=>c.filter(p=>!Uoe(p.field,"groupBy")&&p.fieldPath!=="id"&&Xoe.includes(p.field.type)),[c]),d=c.find(p=>p.fieldPath===a),f=!!(a&&d);if(u.length===0)return null;let m=f?s("general:groupByLabel",{label:d?.label||""}):s("general:groupByLabel",{label:""});return G0(Ve,{className:f5,horizontalAlign:"right",portalClassName:`${f5}__popup`,render:({close:p})=>G0(TN,{close:p,filteredFields:u,groupByField:d,groupByFieldName:a,isActive:f,onChange:o,value:n}),renderButton:({active:p,onClick:h,onKeyDown:g,...b})=>G0(Z,{buttonStyle:"secondary",className:`${f5}__trigger`,extraButtonProps:{onKeyDown:g},icon:G0(ve,{direction:p?"up":"down",size:16}),id:"toggle-group-by",onClick:h,selected:p||f,size:"medium",...b,children:m}),size:"large",theme:"auto",verticalAlign:"bottom"})};var Joe=({field:{label:t,required:e}})=>{let{path:o,setValue:n,value:r}=Ne(),i=Ne({path:"relatedCollection"}).value,{getEntityConfig:a}=G(),l=Yoe(()=>i?a({collectionSlug:i}):null,[i,a]);return!i||!l?Zoe("div",{className:"field-type query-preset-group-by-field",children:[U0(Fe,{as:"h3",label:t,path:o,required:e}),U0("p",{className:"query-preset-group-by-field__hint",children:"Select the related collection to configure group by."})]}):U0("div",{className:"field-type query-preset-group-by-field",children:U0(W0,{collectionSlug:i,fields:l.fields,onChange:c=>n(c||null),value:r??""})})};import{c as qoe}from"react/compiler-runtime";import{jsx as Qoe}from"react/jsx-runtime";import"react";var Koe=t=>{let e=qoe(3),{i18nKey:o}=t,n=o===void 0?"general:presets":o,{t:r}=N(),s;return e[0]!==n||e[1]!==r?(s=Qoe("h3",{className:"query-preset-heading",children:r(n)}),e[0]=n,e[1]=r,e[2]=s):s=e[2],s};import{c as PN}from"react/compiler-runtime";import{jsx as FN}from"react/jsx-runtime";import sre from"react";import{c as ere}from"react/compiler-runtime";import{useEffect as p5,useRef as tre}from"react";function ore(t,...e){t&&t.addEventListener&&t.addEventListener(...e)}function rre(t,...e){t&&t.removeEventListener&&t.removeEventListener(...e)}var nre=(t,e)=>{let o=ere(7),n=t===void 0?!0:t,r;o[0]!==n||o[1]!==e?(r=l=>{if(typeof n!="function"||n())return l.preventDefault(),e&&(l.returnValue=e),e},o[0]=n,o[1]=e,o[2]=r):r=o[2];let s=r,i,a;o[3]!==n||o[4]!==s?(i=()=>{if(n)return ore(window,"beforeunload",s),()=>rre(window,"beforeunload",s)},a=[n,s],o[3]=n,o[4]=s,o[5]=i,o[6]=a):(i=o[5],a=o[6]),p5(i,a)},AN=({hasAccepted:t=!1,message:e="Are you sure you want to leave this page?",onAccept:o,onPrevent:n,prevent:r=!0})=>{nre(r,e);let{startRouteTransition:s}=Ue(),i=Re(),a=tre("");p5(()=>{function l(d,f){try{let m=new URL(d),p=new URL(f);if(m.hostname===p.hostname&&m.pathname===p.pathname&&m.search===p.search){let h=m.hash,g=p.hash;return h!==g&&m.href.replace(h,"")===p.href.replace(g,"")}}catch(m){console.log("Unexpected exception thrown in LeaveWithoutSaving:isAnchorOfCurrentUrl",m)}return!1}function c(d){for(;d&&d.tagName.toLowerCase()!=="a";)d=d.parentElement;return d}function u(d){try{let f=d.target,m=c(f);if(m){let p=window.location.href,h=m.href,g=l(p,h),b=m.download!=="",v=m.target==="_blank"||d.metaKey||d.ctrlKey;!(h===p||g||b||v)&&r&&(n||!window.confirm(e))&&(a.current=h,d.preventDefault(),d.stopPropagation(),typeof n=="function"&&n())}}catch(f){console.log("Unexpected exception thrown in LeaveWithoutSaving:usePreventLeave",f)}}return r&&document.addEventListener("click",u,!0),()=>{document.removeEventListener("click",u,!0)}},[n,r,e]),p5(()=>{t&&a.current&&(o&&o(),s(()=>i.push(a.current)))},[t,o,i,s])};var ire="leave-without-saving",tp=t=>{let e=PN(21),{disablePreventLeave:o,modalSlug:n,onConfirm:r,onPrevent:s}=t,i=o===void 0?!1:o,a=n??ire,{closeModal:l,openModal:c}=ie(),u=Kt(),{isValid:d}=Ge(),{user:f}=ye(),[m,p]=sre.useState(!1),h=!i&&!!((u||!d)&&f),g;e[0]!==a||e[1]!==s||e[2]!==c?(g=()=>{let A=document.activeElement?.href||null;s&&s(A),c(a)},e[0]=a,e[1]=s,e[2]=c,e[3]=g):g=e[3];let b=g,v;e[4]!==l||e[5]!==a?(v=()=>{l(a)},e[4]=l,e[5]=a,e[6]=v):v=e[6];let C=v,y;e[7]!==C||e[8]!==b||e[9]!==m||e[10]!==h?(y={hasAccepted:m,onAccept:C,onPrevent:b,prevent:h},e[7]=C,e[8]=b,e[9]=m,e[10]=h,e[11]=y):y=e[11],AN(y);let x;e[12]!==l||e[13]!==a?(x=()=>{l(a)},e[12]=l,e[13]=a,e[14]=x):x=e[14];let w=x,S;e[15]!==r?(S=async()=>{if(r)try{await r()}catch(A){console.error("Error in LeaveWithoutSaving onConfirm:",A)}p(!0)},e[15]=r,e[16]=S):S=e[16];let _=S,I;return e[17]!==_||e[18]!==a||e[19]!==w?(I=FN(h5,{modalSlug:a,onCancel:w,onConfirm:_}),e[17]=_,e[18]=a,e[19]=w,e[20]=I):I=e[20],I},h5=t=>{let e=PN(5),{modalSlug:o,onCancel:n,onConfirm:r}=t,{t:s}=N(),i;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s?(i=FN(nt,{body:s("general:changesNotSaved"),cancelLabel:s("general:stayOnThisPage"),confirmLabel:s("general:leaveAnyway"),heading:s("general:leaveWithoutSaving"),modalSlug:o,onCancel:n,onConfirm:r}),e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=i):i=e[4],i};import{c as mre}from"react/compiler-runtime";import{jsx as op,jsxs as LN}from"react/jsx-runtime";import{useEffect as fre}from"react";import{c as are}from"react/compiler-runtime";import{jsx as lre}from"react/jsx-runtime";import{createContext as cre,use as ure,useEffect as NN,useRef as dre}from"react";var EN=cre({cachingEnabled:!0,clearRouteCache:()=>{}}),g5=t=>{let e=are(17),{cachingEnabled:o,children:n}=t,r=o===void 0?!0:o,s=Ao(),i=Re(),a=dre(!1),l;e[0]!==i?(l=()=>{i.refresh()},e[0]=i,e[1]=l):l=e[1];let c=l,u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{let b=()=>{a.current=!0};return window.addEventListener("popstate",b),()=>{window.removeEventListener("popstate",b)}},e[2]=u):u=e[2];let d;e[3]!==i?(d=[i],e[3]=i,e[4]=d):d=e[4],NN(u,d);let f;e[5]!==r||e[6]!==c?(f=b=>{(r||a.current)&&(a.current=!1,c())},e[5]=r,e[6]=c,e[7]=f):f=e[7];let m=et(f),p;e[8]!==m||e[9]!==s?(p=()=>{m(s)},e[8]=m,e[9]=s,e[10]=p):p=e[10];let h;e[11]!==s?(h=[s],e[11]=s,e[12]=h):h=e[12],NN(p,h);let g;return e[13]!==r||e[14]!==n||e[15]!==c?(g=lre(EN,{value:{cachingEnabled:r,clearRouteCache:c},children:n}),e[13]=r,e[14]=n,e[15]=c,e[16]=g):g=e[16],g},zt=()=>ure(EN);var b5="document-take-over",v5=t=>{let e=mre(17),{handleBackToDashboard:o,isActive:n,onReadOnly:r}=t,{closeModal:s,openModal:i}=ie(),{t:a}=N(),{startRouteTransition:l}=Ue(),{clearRouteCache:c}=zt(),u,d;e[0]!==s||e[1]!==n||e[2]!==i?(u=()=>{n?i(b5):s(b5)},d=[n,i,s],e[0]=s,e[1]=n,e[2]=i,e[3]=u,e[4]=d):(u=e[3],d=e[4]),fre(u,d);let f;if(e[5]!==c||e[6]!==o||e[7]!==r||e[8]!==l||e[9]!==a){let m;e[11]!==c||e[12]!==r?(m=()=>{r(),c()},e[11]=c,e[12]=r,e[13]=m):m=e[13];let p;e[14]!==o||e[15]!==l?(p=()=>l(()=>o()),e[14]=o,e[15]=l,e[16]=p):p=e[16],f=LN(fn,{closeOnEsc:!1,slug:b5,children:[op(gs,{title:a("general:editingTakenOver")}),op(fs,{children:op("p",{children:a("general:anotherUserTakenOver")})}),LN(hs,{children:[op(ia,{label:a("general:viewReadOnly"),onClick:m}),op(ps,{label:a("general:backToDashboard"),onClick:p})]})]}),e[5]=c,e[6]=o,e[7]=r,e[8]=l,e[9]=a,e[10]=f}else f=e[10];return f};import{c as pre}from"react/compiler-runtime";import{jsx as rp,jsxs as hre}from"react/jsx-runtime";import{useEffect as gre}from"react";var y5="document-stale-data",C5=t=>{let e=pre(12),{isActive:o,onReload:n}=t,{closeModal:r,openModal:s}=ie(),{clearRouteCache:i}=zt(),{t:a}=N(),l,c;e[0]!==r||e[1]!==o||e[2]!==s?(l=()=>{o?s(y5):r(y5)},c=[o,s,r],e[0]=r,e[1]=o,e[2]=s,e[3]=l,e[4]=c):(l=e[3],c=e[4]),gre(l,c);let u;if(e[5]!==i||e[6]!==n||e[7]!==a){let d;e[9]!==i||e[10]!==n?(d=async()=>{i(),await n()},e[9]=i,e[10]=n,e[11]=d):d=e[11],u=hre(fn,{closeOnEsc:!1,size:"small",slug:y5,children:[rp(gs,{title:a("general:documentModified")}),rp(fs,{children:rp("p",{children:a("general:documentOutOfDate")})}),rp(hs,{children:rp(ps,{label:a("general:reloadDocument"),onClick:d})})]}),e[5]=i,e[6]=n,e[7]=a,e[8]=u}else u=e[8];return u};import{c as bre}from"react/compiler-runtime";import{jsx as ed,jsxs as np}from"react/jsx-runtime";import{useEffect as vre}from"react";var X0=t=>t&&typeof t=="object";var sp="document-locked",yre=t=>t?new Intl.DateTimeFormat("en-US",{day:"numeric",hour:"numeric",hour12:!0,minute:"numeric",month:"short",year:"numeric"}).format(new Date(t)):"",x5=t=>{let e=bre(25),{handleGoBack:o,isActive:n,onReadOnly:r,onTakeOver:s,updatedAt:i,user:a}=t,{closeModal:l,openModal:c}=ie(),{t:u}=N(),{clearRouteCache:d}=zt(),{startRouteTransition:f}=Ue(),m,p;e[0]!==l||e[1]!==n||e[2]!==c?(m=()=>{n?c(sp):l(sp)},p=[n,c,l],e[0]=l,e[1]=n,e[2]=c,e[3]=m,e[4]=p):(m=e[3],p=e[4]),vre(m,p);let h;if(e[5]!==d||e[6]!==l||e[7]!==o||e[8]!==r||e[9]!==s||e[10]!==f||e[11]!==u||e[12]!==i||e[13]!==a){let g;e[15]!==u||e[16]!==a?(g=X0(a)?a.email??a.id:`${u("general:user")}: ${a}`,e[15]=u,e[16]=a,e[17]=g):g=e[17];let b;e[18]!==o||e[19]!==f?(b=()=>f(()=>o()),e[18]=o,e[19]=f,e[20]=b):b=e[20];let v;e[21]!==d||e[22]!==l||e[23]!==r?(v=()=>{r(),l(sp),d()},e[21]=d,e[22]=l,e[23]=r,e[24]=v):v=e[24],h=np(fn,{closeOnEsc:!1,size:"small",slug:sp,children:[ed(gs,{title:u("general:documentLocked")}),np(fs,{children:[np("p",{children:[ed("strong",{children:g})," ",u("general:currentlyEditing")]}),np("p",{className:"document-locked__updated-at",children:[u("general:editedSince")," ",ed("strong",{children:yre(i)})]})]}),np(hs,{children:[ed(ia,{label:u("general:goBack"),onClick:b}),ed(Z,{buttonStyle:"secondary",id:`${sp}-view-read-only`,margin:!1,onClick:v,size:"medium",children:u("general:viewReadOnly")}),ed(ps,{label:u("general:takeOver"),onClick:s})]})]}),e[5]=d,e[6]=l,e[7]=o,e[8]=r,e[9]=s,e[10]=f,e[11]=u,e[12]=i,e[13]=a,e[14]=h}else h=e[14];return h};import{jsx as Z0,jsxs as $N}from"react/jsx-runtime";import"react";var td="table-section";function Cre({children:t,className:e,"data-group-id":o}){return $N("div",{className:[td,e].filter(Boolean).join(" "),"data-group-id":o,children:[Z0("div",{className:`${td}__divider`}),t]})}function xre({children:t,className:e,heading:o}){return Z0("header",{className:[`${td}__header`,e].filter(Boolean).join(" "),children:$N("div",{className:`${td}__header-inner`,children:[o&&Z0("h4",{className:`${td}__heading`,children:o}),t]})})}function wre({children:t,className:e}){return Z0("div",{className:[`${td}__content`,e].filter(Boolean).join(" "),children:t})}var ip=Object.assign(Cre,{Content:wre,Header:xre});import{jsx as Y0}from"react/jsx-runtime";import"react";var jN=({elements:t,translationString:e})=>{let o=/(<[^>]+>.*?<\/[^>]+>)/g,n=e.split(o);return Y0("span",{children:n.map((r,s)=>{if(t&&r.startsWith("<")&&r.endsWith(">")){let i=r[1],a=t[i];if(a){let l=new RegExp(`<${i}>(.*?)</${i}>`,"g"),c=r.replace(l,(u,d)=>d);return Y0(a,{children:Y0(jN,{translationString:c})},s)}}return r})})},Ro=({elements:t,i18nKey:e,t:o,variables:n})=>{let r=o(e,n||{});return t?Y0(jN,{elements:t,translationString:r}):r};import{c as Sre}from"react/compiler-runtime";import{jsx as _re}from"react/jsx-runtime";import{getTranslation as Ire}from"@payloadcms/translations";import Cat from"react";function ap(t){let e=Sre(3),{i18n:o}=N(),{description:n}=t;if(n){let r;return e[0]!==n||e[1]!==o?(r=_re("div",{className:"custom-view-description",children:Ire(n,o)}),e[0]=n,e[1]=o,e[2]=r):r=e[2],r}return null}import{jsx as Dr,jsxs as fp}from"react/jsx-runtime";import{useEffect as Cne,useRef as xne,useState as wne}from"react";import{jsx as kN}from"react/jsx-runtime";import"react";var Rre={24:"M9 5.5a.5.5 0 0 1 1 0V7h3.5a.5.5 0 0 1 0 1h-1.282l-.054.16c-.503 1.488-1.086 2.54-2.03 3.708l1.527 1.907a.5.5 0 1 1-.781.625l-1.407-1.758c-.689.77-1.54 1.63-2.62 2.711a.5.5 0 1 1-.707-.706c1.146-1.148 2.013-2.028 2.693-2.798L7.21 9.812a.5.5 0 0 1 .781-.624l1.504 1.879c.773-.986 1.248-1.869 1.668-3.067H5.5a.5.5 0 0 1 0-1H9zm5.039 5.808A.5.5 0 0 1 14.5 11h.5a.5.5 0 0 1 .461.308l1.667 4 .834 2a.5.5 0 1 1-.924.384L16.334 16h-3.166l-.706 1.692a.5.5 0 1 1-.922-.384l.833-2zM15.917 15l-1.167-2.8-1.167 2.8z"},$a=({className:t,size:e=24})=>kN("svg",{className:["icon","icon--language",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,children:kN("path",{clipRule:"evenodd",d:Rre[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as MN}from"react/jsx-runtime";import"react";var lp={16:{height:12,path:"M14 0C15.1046 0 16 0.895431 16 2V10L15.9893 10.2041C15.887 11.2128 15.0357 12 14 12H2C0.964349 12 0.113005 11.2128 0.0107422 10.2041L0 10V2C1.28853e-07 0.895431 0.895431 0 2 0H14ZM2 1C1.44772 1 1 1.44772 1 2V10C1 10.5523 1.44772 11 2 11H5V1H2ZM14 11C14.5523 11 15 10.5523 15 10V2C15 1.44772 14.5523 1 14 1H6V11H14Z",width:16}},J0=({className:t,size:e=16})=>MN("svg",{className:["icon","icon--sidebar",t].filter(Boolean).join(" "),fill:"none",height:lp[e].height,viewBox:`0 0 ${lp[e].width} ${lp[e].height}`,width:lp[e].width,xmlns:"http://www.w3.org/2000/svg",children:MN("path",{clipRule:"evenodd",d:lp[e].path,fill:"currentColor",fillRule:"evenodd"})});import{c as Tre}from"react/compiler-runtime";import{jsx as Dre}from"react/jsx-runtime";import{createContext as Are,use as Pre,useState as Fre}from"react";var BN=Are({Actions:{},setViewActions:()=>{}}),w5=()=>Pre(BN),Nre=t=>{let e=Tre(4),{Actions:o,children:n}=t,[r,s]=Fre(o),i;return e[0]!==o||e[1]!==n||e[2]!==r?(i=Dre(BN,{value:{Actions:{...r,...o},setViewActions:s},children:n}),e[0]=o,e[1]=n,e[2]=r,e[3]=i):i=e[3],i};import{c as Ere}from"react/compiler-runtime";import{jsx as Ni,jsxs as ON}from"react/jsx-runtime";import{getTranslation as Lre}from"@payloadcms/translations";import*as Q0 from"qs-esm";import{Fragment as $re}from"react";var q0="localizer",VN=t=>{let e=Ere(17),{className:o,renderButton:n}=t,{config:r}=G(),{localization:s}=r,i=Re(),{startRouteTransition:a}=Ue(),{setLocaleIsLoading:l}=y1(),{i18n:c,t:u}=N(),d=Ce();if(s){let{locales:f}=s,m;e[0]!==o?(m=[q0,o].filter(Boolean),e[0]=o,e[1]=m):m=e[1];let p=m.join(" "),h;e[2]!==c||e[3]!==d||e[4]!==f||e[5]!==i||e[6]!==l||e[7]!==a?(h=v=>{let{close:C}=v;return Ni(ue.RadioGroup,{children:f.map(y=>{let x=Lre(y.label,c);return Ni(ue.RadioGroupItem,{active:d.code===y.code,disabled:d.code===y.code,onClick:()=>{l(!0),C();let w=new URLSearchParams(window.location.search),S=Q0.stringify({...Q0.parse(w.toString(),{depth:10,ignoreQueryPrefix:!0}),locale:y.code},{addQueryPrefix:!0});a(()=>{i.push(S)})},children:x!==y.code?ON($re,{children:[x,"\xA0",Ni("span",{className:`${q0}__locale-code`,"data-locale":y.code,children:`(${y.code})`})]}):Ni("span",{className:`${q0}__locale-code`,"data-locale":y.code,children:x})},y.code)})})},e[2]=c,e[3]=d,e[4]=f,e[5]=i,e[6]=l,e[7]=a,e[8]=h):h=e[8];let g;e[9]!==d||e[10]!==n||e[11]!==u?(g=n??(v=>{let{active:C,onClick:y,onKeyDown:x,...w}=v;return Ni(Z,{"aria-label":u("general:locale"),buttonStyle:"secondary",extraButtonProps:{onKeyDown:x},icon:Ni($a,{size:24}),iconPosition:"left",onClick:y,...w,children:ON("div",{className:`${q0}__button-content`,children:[d.code,Ni(ve,{size:16})]})})}),e[9]=d,e[10]=n,e[11]=u,e[12]=g):g=e[12];let b;return e[13]!==p||e[14]!==h||e[15]!==g?(b=Ni("div",{className:p,children:Ni(Ve,{horizontalAlign:"right",render:h,renderButton:g,showScrollbar:!0})}),e[13]=p,e[14]=h,e[15]=g,e[16]=b):b=e[16],b}return null};import{jsx as jre}from"react/jsx-runtime";import{PREFERENCE_KEYS as kre}from"payload/shared";import K0,{useEffect as cp,useRef as Mre}from"react";var S5=K0.createContext({hydrated:!1,navOpen:!0,navRef:null,setNavOpen:()=>{}}),nn=()=>K0.use(S5),Bre=async t=>{let o=(await t(kre.NAV))?.open;return typeof o=="boolean"?o:!0},_5=({children:t,initialIsOpen:e})=>{let{breakpoints:{l:o,m:n,s:r}}=sr(),s=Ao(),{getPreference:i}=Jt(),a=Mre(null),[l,c]=K0.useState(e),[u,d]=K0.useState(!1);return cp(()=>{o===!1&&(async()=>{let m=await Bre(i);c(m)})()},[o,i,c]),cp(()=>{r===!0&&c(!1)},[s]),cp(()=>{a.current&&(l&&n?a.current.style.overscrollBehavior="contain":a.current.style.overscrollBehavior="auto")},[l,n]),cp(()=>{(o===!0||n===!0||r===!0)&&c(!1),d(!0)},[o,n,r]),cp(()=>()=>{a.current&&(a.current.style.overscrollBehavior="auto")},[]),jre(S5,{value:{hydrated:u,navOpen:l,navRef:a,setNavOpen:c},children:t})};import{c as Ore}from"react/compiler-runtime";import{jsx as Vre}from"react/jsx-runtime";import{PREFERENCE_KEYS as Hre}from"payload/shared";import"react";var HN="nav-toggler",I5=t=>{let e=Ore(15),{id:o,children:n,className:r,tabIndex:s}=t,i=s===void 0?0:s,{t:a}=N(),{setPreference:l}=Jt(),{navOpen:c,setNavOpen:u}=nn(),{breakpoints:d}=sr(),{l:f}=d,m=`${a(c?"general:close":"general:open")} ${a("general:menu")}`,p=c&&`${HN}--is-open`,h;e[0]!==r||e[1]!==p?(h=[HN,p,r].filter(Boolean),e[0]=r,e[1]=p,e[2]=h):h=e[2];let g=h.join(" "),b;e[3]!==f||e[4]!==c||e[5]!==u||e[6]!==l?(b=async()=>{u(!c),f||await l(Hre.NAV,{open:!c},!0)},e[3]=f,e[4]=c,e[5]=u,e[6]=l,e[7]=b):b=e[7];let v;return e[8]!==n||e[9]!==o||e[10]!==m||e[11]!==g||e[12]!==b||e[13]!==i?(v=Vre("button",{"aria-label":m,className:g,id:o,onClick:b,tabIndex:i,type:"button",children:n}),e[8]=n,e[9]=o,e[10]=m,e[11]=g,e[12]=b,e[13]=i,e[14]=v):v=e[14],v};import{c as qre}from"react/compiler-runtime";import{jsx as eb,jsxs as Qre}from"react/jsx-runtime";import{getTranslation as Kre}from"@payloadcms/translations";import ene,{Fragment as tne}from"react";import{c as zre}from"react/compiler-runtime";import{jsx as Gre}from"react/jsx-runtime";import{createContext as Wre,use as Ure,useState as Xre}from"react";var Lo=()=>Ure(zN),zN=Wre({setStepNav:()=>{},stepNav:[]}),R5=t=>{let e=zre(4),{children:o}=t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[0]=n):n=e[0];let[r,s]=Xre(n),i;return e[1]!==o||e[2]!==r?(i=Gre(zN,{value:{setStepNav:s,stepNav:r},children:o}),e[1]=o,e[2]=r,e[3]=i):i=e[3],i};import{c as Zre}from"react/compiler-runtime";import{useEffect as Yre}from"react";var Jre=t=>{let e=Zre(4),{nav:o}=t,{setStepNav:n}=Lo(),r,s;return e[0]!==o||e[1]!==n?(r=()=>{n(o)},s=[n,o],e[0]=o,e[1]=n,e[2]=r,e[3]=s):(r=e[2],s=e[3]),Yre(r,s),null};var ja="step-nav",GN=t=>{let e=qre(11),{className:o}=t,{i18n:n}=N(),{stepNav:r}=Lo(),{config:s}=G(),{routes:i}=s,{admin:a}=i,{t:l}=N(),c=r[0],u;e[0]!==c?(u=c&&!c.url&&typeof c.label!="string"&&ene.isValidElement(c.label),e[0]=c,e[1]=u):u=e[1];let d=u,f;if(e[2]!==a||e[3]!==o||e[4]!==d||e[5]!==n||e[6]!==r||e[7]!==l){let m=d?r:[{label:l("general:dashboard"),url:a},...r],p;e[9]!==o?(p=[ja,o].filter(Boolean),e[9]=o,e[10]=p):p=e[10],f=eb("nav",{className:p.join(" "),children:m.map((h,g)=>{let b=Kre(h.label,n),v=m.length===g+1,C=g===0;return Qre(tne,{children:[h.url?eb(Z,{buttonStyle:"ghost",className:[`${ja}__item`,v?`${ja}__last`:void 0,C?`${ja}__first`:void 0].filter(Boolean).join(" "),el:"link",url:h.url,children:b}):eb("span",{className:[`${ja}__item`,v?`${ja}__last`:void 0,C?`${ja}__first`:void 0].filter(Boolean).join(" "),children:b}),!v&&eb("span",{className:`${ja}__separator`,children:"/"})]},g)})}),e[2]=a,e[3]=o,e[4]=d,e[5]=n,e[6]=r,e[7]=l,e[8]=f}else f=e[8];return f};import{c as gne}from"react/compiler-runtime";import{jsx as Ut,jsxs as Ei,Fragment as od}from"react/jsx-runtime";import{formatAdminURL as hE}from"payload/shared";import{useEffect as bne,useState as vne}from"react";import{c as ine}from"react/compiler-runtime";import{jsx as oE}from"react/jsx-runtime";import{formatAdminURL as ane}from"payload/shared";import"react";import{jsx as T5,jsxs as one}from"react/jsx-runtime";import"react";var up="graphic-account",WN=t=>one("svg",{className:[up,t?.active&&`${up}--active`].filter(Boolean).join(" "),height:"25",viewBox:"0 0 25 25",width:"25",xmlns:"http://www.w3.org/2000/svg",children:[T5("circle",{className:`${up}__bg`,cx:"12.5",cy:"12.5",r:"11.5"}),T5("circle",{className:`${up}__head`,cx:"12.5",cy:"10.73",r:"3.98"}),T5("path",{className:`${up}__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"})]});var eE=Ji(KN(),1);import{c as nne}from"react/compiler-runtime";import{jsx as sne}from"react/jsx-runtime";import"react";var tE=()=>{let t=nne(2),{user:e}=ye(),o=(0,eE.default)(e.email.trim().toLowerCase()),r=`?${new URLSearchParams({default:"mp",r:"g",s:"50"}).toString()}`,s=`https://www.gravatar.com/avatar/${o}${r}`,i;return t[0]!==s?(i=sne("img",{alt:"yas",className:"gravatar-account",height:24,src:s,style:{borderRadius:"50%"},width:24}),t[0]=s,t[1]=i):i=t[1],i};var tb=()=>{let t=ine(3),{config:e}=G(),{admin:o,routes:n}=e,{avatar:r,routes:s}=o,{account:i}=s,{admin:a}=n,{user:l}=ye(),u=Ao()===ane({adminRoute:a,path:i});if(!l?.email||r==="default"){let d;return t[0]!==u?(d=oE(WN,{active:u}),t[0]=u,t[1]=d):d=t[1],d}if(r==="gravatar"){let d;return t[2]===Symbol.for("react.memo_cache_sentinel")?(d=oE(tE,{}),t[2]=d):d=t[2],d}};import{jsx as rE}from"react/jsx-runtime";import"react";var lne={16:"M9 3h3a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H9a.5.5 0 0 1 0-1h3V4H9a.5.5 0 0 1 0-1M5.854 5.146a.5.5 0 0 1 0 .708L4.207 7.5H9a.5.5 0 0 1 0 1H4.207l1.647 1.646a.5.5 0 0 1-.708.708l-2.5-2.5a.5.5 0 0 1 0-.708l2.5-2.5a.5.5 0 0 1 .708 0",24:"M7.5 6A1.5 1.5 0 0 0 6 7.5v1a.5.5 0 0 0 1 0v-1a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 0-1 0v1A1.5 1.5 0 0 0 7.5 18h9a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 16.5 6zm4.146 3.146a.5.5 0 0 1 .708 0l2.5 2.5a.5.5 0 0 1 0 .708l-2.5 2.5a.5.5 0 0 1-.708-.708l1.647-1.646H9.5a.5.5 0 0 1 0-1h3.793l-1.647-1.646a.5.5 0 0 1 0-.708"},dp=({className:t,size:e=24})=>rE("svg",{className:["icon","icon--logout",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:rE("path",{clipRule:"evenodd",d:lne[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as cne}from"react/jsx-runtime";import"react";var une="popup-divider",ka=()=>cne("hr",{className:une});import{c as sE}from"react/compiler-runtime";import{jsx as Rr,jsxs as nE}from"react/jsx-runtime";import"react";var P5=()=>{let t=sE(4),{i18n:e,languageOptions:o,switchLanguage:n}=N(),r;return t[0]!==e||t[1]!==o||t[2]!==n?(r=Rr("div",{"data-popup-prevent-close":!0,children:Rr(ue.RadioGroup,{children:o?.map(s=>{let{label:i,value:a}=s;return Rr(ue.RadioGroupItem,{active:e.language===a,onClick:()=>{n&&n(a)},children:i},a)})})}),t[0]=e,t[1]=o,t[2]=n,t[3]=r):r=t[3],r},iE=t=>{let e=sE(5),{onMobileOpen:o}=t,{t:n}=N();if(o){let s;return e[0]!==o||e[1]!==n?(s=nE("button",{className:"popup-button-list__button popup-button-list__button--submenu-trigger","data-popup-prevent-close":!0,onClick:o,type:"button",children:[Rr("span",{className:"popup-button-list__submenu-icon",children:Rr($a,{size:24})}),Rr("span",{className:"popup-button-list__label",children:n("general:language")}),Rr("span",{className:"popup-button-list__chevron",children:Rr(ve,{direction:"right",size:24})})]}),e[0]=o,e[1]=n,e[2]=s):s=e[2],s}let r;return e[3]!==n?(r=Rr(Ve,{renderButton:s=>{let{active:i,onClick:a,onKeyDown:l,...c}=s;return nE("button",{...c,className:["popup-button-list__button","popup-button-list__button--submenu-trigger",i&&"popup-button-list__button--selected"].filter(Boolean).join(" "),onClick:a,onKeyDown:l,type:"button",children:[Rr("span",{className:"popup-button-list__submenu-icon",children:Rr($a,{size:24})}),Rr("span",{className:"popup-button-list__label",children:n("general:language")}),Rr("span",{className:"popup-button-list__chevron",children:Rr(ve,{direction:"right",size:16})})]})},side:"left",size:"large",theme:"dark",children:Rr(P5,{})}),e[3]=n,e[4]=r):r=e[4],r};import{c as fne}from"react/compiler-runtime";import{jsx as ir,jsxs as F5,Fragment as pne}from"react/jsx-runtime";import{Fragment as lE}from"react";import{jsx as aE}from"react/jsx-runtime";import"react";var dne={16:"M8.32 2.008q.48.027.937.124l.117.032c.49.151.76.557.848.937a4 4 0 0 0 .052.29.5.5 0 0 0 .226.28c.002.002.099.043.109.047a.5.5 0 0 0 .352-.028c.003-.004.15-.06.163-.065.372-.113.857-.084 1.233.26.006.001.082.077.088.083l.203.243a5.9 5.9 0 0 1 1.064 1.951l.03.12c.112.495-.104.93-.389 1.196l-.134.108a.5.5 0 0 0-.215.351c-.004 0-.004.125-.004.125.02.141.097.264.21.345.002 0 .132.1.141.108.28.267.497.7.39 1.196 0 .009-.03.117-.03.117a5.9 5.9 0 0 1-1.06 1.962c-.017.016-.205.241-.205.241-.387.422-.92.467-1.32.343l-.165-.062a.5.5 0 0 0-.28-.045l-.087.022a.2.2 0 0 0-.04.015l-.053.025-.055.038a.5.5 0 0 0-.192.336c-.004 0-.004.133-.004.133a1.02 1.02 0 0 1-.633.935c-.014.007-.14.05-.14.05a6.3 6.3 0 0 1-1.101.167A13 13 0 0 0 8 14q-.488 0-.953-.075l-.305-.058c-.645-.138-.953-.692-.992-1.14a.52.52 0 0 0-.18-.352l-.036-.018-.105-.06a.5.5 0 0 0-.39.014c-.387.18-.972.202-1.407-.2-.006-.009-.085-.088-.085-.088a6 6 0 0 1-1.155-1.883l-.103-.304c-.204-.625.125-1.168.494-1.425.008-.012.083-.075.091-.082A.5.5 0 0 0 3 8l-.015-.125a.5.5 0 0 0-.203-.29c-.37-.257-.696-.798-.497-1.422.008-.01.1-.288.106-.303a6 6 0 0 1 1.156-1.882 1.26 1.26 0 0 1 1.327-.351l.274.099a.497.497 0 0 0 .6-.445c.003-.006.024-.17.026-.179.096-.41.403-.852.967-.97.013-.001.285-.05.305-.054a5.7 5.7 0 0 1 1.274-.07m-.594 1a5 5 0 0 0-.778.102.27.27 0 0 0-.203.25A1.5 1.5 0 0 1 4.61 4.595c-.111-.05-.24-.038-.319.05a5 5 0 0 0-1.054 1.822c-.035.114.019.23.113.298.39.272.645.718.649 1.227 0 .517-.255.968-.644 1.239a.28.28 0 0 0-.127.26c0 .007.006.04.006.04a5.1 5.1 0 0 0 1.057 1.826c.083.088.211.1.317.05a1.5 1.5 0 0 1 1.274-.002l.25.141c.318.233.522.573.592.939.003.007.017.156.017.156.015.116.09.222.203.248A5 5 0 0 0 7.999 13a5 5 0 0 0 1.242-.156l.009-.015v-.046a1.51 1.51 0 0 1 .743-1.318L10 11.46l.14-.07.142-.055c.37-.12.765-.09 1.107.07.085.038.178.04.252 0l.063-.046a4.9 4.9 0 0 0 1.052-1.829.26.26 0 0 0-.05-.243c-.008-.006-.064-.061-.064-.061A1.49 1.49 0 0 1 12 8c0-.51.254-.959.644-1.233.088-.064.137-.16.124-.258a.2.2 0 0 1-.01-.04 4.9 4.9 0 0 0-1.055-1.825.27.27 0 0 0-.314-.05c-.38.177-.82.194-1.22.027-.015-.012-.17-.082-.17-.082a1.52 1.52 0 0 1-.747-1.178.28.28 0 0 0-.159-.236l-.047-.016a5 5 0 0 0-1.321-.101m2.718 9.344.032-.008q.006-.009.017-.013l-.046.024zm-2.24-6.344A2 2 0 1 1 5.998 8l.009-.203A2.003 2.003 0 0 1 7.999 6zm-.304 1a.995.995 0 0 0-.9.992l.009.102c.045.471.42.845.89.893a1 1 0 0 0 .204-1.99L8 7z",24:"M17.287 6.044c-.561.24-1.22.22-1.787-.106a2 2 0 0 1-.986-1.495c-.07-.576-.495-1.253-1.297-1.361a9 9 0 0 0-2.434 0c-.802.108-1.228.785-1.297 1.36A2 2 0 0 1 8.5 5.939a2 2 0 0 1-1.787.106c-.533-.227-1.33-.197-1.826.44a9 9 0 0 0-1.22 2.111c-.307.749.067 1.456.53 1.803.49.367.803.948.803 1.602s-.313 1.235-.802 1.602c-.464.347-.838 1.054-.531 1.803.311.761.724 1.47 1.22 2.11.495.638 1.293.668 1.826.44a2 2 0 0 1 1.787.107c.566.327.913.889.986 1.495.07.576.495 1.253 1.297 1.361a9 9 0 0 0 2.434 0c.802-.108 1.227-.785 1.297-1.36.073-.607.42-1.169.986-1.496a2 2 0 0 1 1.787-.106c.533.227 1.33.197 1.826-.44.496-.64.909-1.35 1.22-2.111.307-.749-.067-1.456-.53-1.803A2 2 0 0 1 19 12c0-.654.313-1.235.802-1.602.464-.347.838-1.054.531-1.803a9 9 0 0 0-1.22-2.11c-.495-.638-1.293-.668-1.826-.44M15 6.804c.85.49 1.841.518 2.68.16.224-.096.493-.058.643.134.442.57.808 1.2 1.085 1.876.092.226-.01.478-.206.624A3 3 0 0 0 18 12c0 .983.472 1.855 1.203 2.402.195.146.297.398.205.624a8 8 0 0 1-1.085 1.876c-.15.192-.419.23-.643.134a3 3 0 0 0-2.68.16 3 3 0 0 0-1.479 2.241c-.03.243-.196.458-.438.49a8 8 0 0 1-2.166 0c-.242-.032-.409-.247-.438-.49A3 3 0 0 0 9 17.197a3 3 0 0 0-2.68-.161c-.224.096-.493.058-.643-.134a8 8 0 0 1-1.085-1.876c-.092-.226.01-.478.205-.624A3 3 0 0 0 6 12c0-.983-.472-1.855-1.203-2.402-.195-.146-.297-.398-.205-.624a8 8 0 0 1 1.085-1.876c.15-.192.419-.23.643-.134.839.358 1.83.33 2.68-.16a3 3 0 0 0 1.479-2.241c.03-.243.196-.458.438-.49a8 8 0 0 1 2.166 0c.242.032.409.247.438.49.11.905.628 1.75 1.479 2.24M9.5 12a2.5 2.5 0 1 1 5 0 2.5 2.5 0 0 1-5 0M12 8.5a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7"},mne={16:"0 0 16 16",24:"-4 -4 32 32"},Ma=({ariaLabel:t,className:e,size:o=24})=>aE("svg",{"aria-label":t,className:["icon","icon--gear",e].filter(Boolean).join(" "),fill:"none",height:o,viewBox:mne[o],width:o,xmlns:"http://www.w3.org/2000/svg",children:aE("path",{clipRule:"evenodd",d:dne[o],fill:"currentColor",fillRule:"evenodd"})});var N5=({groups:t})=>ir(pne,{children:t.map((e,o)=>F5(lE,{children:[o>0&&ir(ka,{}),e.group&&ir(ue.GroupLabel,{label:e.group}),e.items.map((n,r)=>ir(lE,{children:n},`settings-item-${o}-${r}`))]},`settings-group-${e.group}-${o}`))}),cE=t=>{let e=fne(8),{groups:o,onMobileOpen:n}=t,{t:r}=N();if(n){let a;return e[0]!==n||e[1]!==r?(a=F5("button",{className:"popup-button-list__button popup-button-list__button--submenu-trigger","data-popup-prevent-close":!0,onClick:n,type:"button",children:[ir("span",{className:"popup-button-list__submenu-icon",children:ir(Ma,{size:24})}),ir("span",{className:"popup-button-list__label",children:r("general:settings")}),ir("span",{className:"popup-button-list__chevron",children:ir(ve,{direction:"right",size:24})})]}),e[0]=n,e[1]=r,e[2]=a):a=e[2],a}let s;e[3]!==r?(s=a=>{let{active:l,onClick:c,onKeyDown:u,...d}=a;return F5("button",{...d,className:["popup-button-list__button","popup-button-list__button--submenu-trigger",l&&"popup-button-list__button--selected"].filter(Boolean).join(" "),onClick:c,onKeyDown:u,type:"button",children:[ir("span",{className:"popup-button-list__submenu-icon",children:ir(Ma,{size:24})}),ir("span",{className:"popup-button-list__label",children:r("general:settings")}),ir("span",{className:"popup-button-list__chevron",children:ir(ve,{direction:"right",size:16})})]})},e[3]=r,e[4]=s):s=e[4];let i;return e[5]!==o||e[6]!==s?(i=ir(Ve,{renderButton:s,side:"left",size:"large",theme:"dark",children:ir(N5,{groups:o})}),e[5]=o,e[6]=s,e[7]=i):i=e[7],i};import{jsx as mp,jsxs as uE}from"react/jsx-runtime";import"react";var ob=({onBack:t,title:e})=>uE("div",{className:"user-menu__submenu-header","data-popup-prevent-close":!0,children:[mp("div",{className:"user-menu__submenu-header-wrap",children:uE("div",{className:"user-menu__submenu-header-row",children:[mp(Z,{"aria-label":e,buttonStyle:"ghost",className:"user-menu__submenu-back",icon:mp(ve,{direction:"left",size:24}),onClick:t}),mp("p",{className:"user-menu__submenu-title",children:e})]})}),mp(ka,{})]});import{c as fE}from"react/compiler-runtime";import{jsx as Tr,jsxs as mE}from"react/jsx-runtime";import"react";import{jsx as dE}from"react/jsx-runtime";import"react";var hne={16:"M8 2a6 6 0 0 1 5.934 6.895C13.719 10.325 12.39 11 11.274 11H9c0 .821-.343 1.61-.93 2.129-.576.508-1.394.75-2.238.463l-.169-.065A6.001 6.001 0 0 1 8 2m0 1a5 5 0 0 0-1.947 9.606C7.07 13.036 8 12.104 8 11a1 1 0 0 1 1-1h2.274l.149-.006c.69-.05 1.321-.452 1.492-1.104l.03-.144Q13 8.381 13 8a5 5 0 0 0-5-5M5.25 7.986a.75.75 0 1 1-.002 1.502.75.75 0 0 1 .002-1.502m5.5-1.486a.75.75 0 1 1 0 1.5.75.75 0 0 1 0-1.5m-5-1.5a.75.75 0 1 1 0 1.5.75.75 0 0 1 0-1.5m3-.5a.75.75 0 1 1 0 1.5.75.75 0 0 1 0-1.5",24:"M7.312 6.803a7 7 0 0 1 9.638.248l.28.298a7 7 0 0 1 1.761 4.999l-.029.38c-.155 1.494-1.516 2.274-2.72 2.274H13.5a.5.5 0 0 0-.5.5V16c0 .82-.34 1.603-.92 2.127-.602.542-1.468.8-2.37.49A7.002 7.002 0 0 1 7.05 7.051zm8.931.956a6 6 0 0 0-8.485 0l-.213.223a6 6 0 0 0 2.491 9.69c.979.338 1.849-.456 1.953-1.467l.011-.204v-.5c0-.775.59-1.415 1.346-1.492l.154-.007h2.742l.159-.007c.733-.057 1.391-.513 1.543-1.217l.024-.154a6 6 0 0 0-1.484-4.611zM9 12a1 1 0 1 1-.001 2A1 1 0 0 1 9 12m6-2a1 1 0 1 1-.002 2.002A1 1 0 0 1 15 10m-5-1a1 1 0 1 1 0 2 1 1 0 0 1 0-2m3-1a1 1 0 1 1 0 2.002 1 1 0 0 1 0-2.001"},rb=({className:t,size:e=24})=>dE("svg",{className:["icon","icon--variable-color",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:dE("path",{d:hne[e],fill:"currentColor"})});var E5=()=>{let t=fE(5),{autoMode:e,setTheme:o,theme:n}=Us(),{t:r}=N(),s;if(t[0]!==e||t[1]!==o||t[2]!==r||t[3]!==n){let i=[{label:r("general:auto"),value:"auto"},{label:r("general:light"),value:"light"},{label:r("general:dark"),value:"dark"}],a=e?"auto":n;s=Tr("div",{"data-popup-prevent-close":!0,children:Tr(ue.RadioGroup,{children:i.map(l=>{let{label:c,value:u}=l;return Tr(ue.RadioGroupItem,{active:a===u,onClick:()=>o(u),children:c},u)})})}),t[0]=e,t[1]=o,t[2]=r,t[3]=n,t[4]=s}else s=t[4];return s},pE=t=>{let e=fE(5),{onMobileOpen:o}=t,{t:n}=N();if(o){let s;return e[0]!==o||e[1]!==n?(s=mE("button",{className:"popup-button-list__button popup-button-list__button--submenu-trigger","data-popup-prevent-close":!0,onClick:o,type:"button",children:[Tr("span",{className:"popup-button-list__submenu-icon",children:Tr(rb,{size:24})}),Tr("span",{className:"popup-button-list__label",children:n("general:theme")}),Tr("span",{className:"popup-button-list__chevron",children:Tr(ve,{direction:"right",size:24})})]}),e[0]=o,e[1]=n,e[2]=s):s=e[2],s}let r;return e[3]!==n?(r=Tr(Ve,{renderButton:s=>{let{active:i,onClick:a,onKeyDown:l,...c}=s;return mE("button",{...c,className:["popup-button-list__button","popup-button-list__button--submenu-trigger",i&&"popup-button-list__button--selected"].filter(Boolean).join(" "),onClick:a,onKeyDown:l,type:"button",children:[Tr("span",{className:"popup-button-list__submenu-icon",children:Tr(rb,{size:24})}),Tr("span",{className:"popup-button-list__label",children:n("general:theme")}),Tr("span",{className:"popup-button-list__chevron",children:Tr(ve,{direction:"right",size:16})})]})},side:"left",size:"large",theme:"dark",children:Tr(E5,{})}),e[3]=n,e[4]=r):r=e[4],r};var sc="user-menu",L5=t=>{let e=gne(7),{CustomAvatar:o,settingsItemGroups:n}=t,r=n===void 0?[]:n,{user:s}=ye(),{languageOptions:i,t:a}=N(),{config:l,getEntityConfig:c}=G(),{admin:u,routes:d}=l,{routes:f,theme:m,user:p}=u,{account:h,logout:g}=f,{admin:b}=d,{breakpoints:v}=sr(),{s:C}=v,y=!!C,[x,w]=vne(null),S,_;e[0]!==y?(S=()=>{y||w(null)},_=[y],e[0]=y,e[1]=S,e[2]=_):(S=e[1],_=e[2]),bne(S,_);let A=c({collectionSlug:p})?.admin?.useAsTitle??"email",D=A!=="email"&&s?s[A]:void 0,T=typeof D=="string"?D:void 0,R=s?.username??s?.email??"",P=Array.isArray(i)&&i.length>1,E=m==="all",F=r.some(yne),L=E||P,M=hE({adminRoute:b,path:g}),$=hE({adminRoute:b,path:h}),B;e[3]===Symbol.for("react.memo_cache_sentinel")?(B=()=>w(null),e[3]=B):B=e[3];let j;return e[4]!==o||e[5]!==a?(j=k=>{let{active:O,...V}=k;return Ut("button",{...V,"aria-label":a("authentication:account"),className:[`${sc}__trigger`,O&&`${sc}__trigger--active`].filter(Boolean).join(" "),type:"button",children:Ut(le,{CustomComponent:o,Fallback:Ut(tb,{})})})},e[4]=o,e[5]=a,e[6]=j):j=e[6],Ut(Ve,{caret:!1,className:sc,horizontalAlign:"right",onToggleClose:B,renderButton:j,size:"large",theme:"dark",verticalAlign:"bottom",children:y&&x?Ei(od,{children:[x==="theme"&&Ei(od,{children:[Ut(ob,{onBack:()=>w(null),title:a("general:theme")}),Ut(E5,{})]}),x==="language"&&Ei(od,{children:[Ut(ob,{onBack:()=>w(null),title:a("general:language")}),Ut(P5,{})]}),x==="settings"&&Ei(od,{children:[Ut(ob,{onBack:()=>w(null),title:a("general:settings")}),Ut(N5,{groups:r})]})]}):Ei(od,{children:[Ei("a",{className:`${sc}__profile`,href:$,children:[Ut("div",{className:`${sc}__avatar`,children:Ut(le,{CustomComponent:o,Fallback:Ut(tb,{})})}),Ei("div",{children:[T&&Ut("p",{className:`${sc}__name`,children:T}),R&&Ut("p",{className:`${sc}__identifier`,children:R})]})]}),L&&Ei(ue.ButtonGroup,{children:[E&&Ut(pE,{onMobileOpen:y?()=>w("theme"):void 0}),P&&Ut(iE,{onMobileOpen:y?()=>w("language"):void 0})]}),Ut(ka,{}),F&&Ei(od,{children:[Ut(ue.ButtonGroup,{children:Ut(cE,{groups:r,onMobileOpen:y?()=>w("settings"):void 0})}),Ut(ka,{})]}),Ut(ue.MenuItem,{children:Ut(ue.Button,{href:M,icon:Ut(dp,{}),children:a("authentication:logOut")})})]})})};function yne(t){return t.items.length>0}var Ar="app-header";function Sne({CustomAvatar:t,settingsItemGroups:e}){let{t:o}=N(),n=Ce(),{Actions:r}=w5(),{navOpen:s,setNavOpen:i}=nn(),{config:{localization:a}}=G(),l=xne(null),[c,u]=wne(!1);Cne(()=>{let f=()=>{let m=l.current;if(m){let p=m.scrollWidth>m.clientWidth;u(p)}};return f(),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[r]);let d=r?Object.values(r):[];return Dr("header",{className:[Ar,s&&`${Ar}--nav-open`].filter(Boolean).join(" "),children:Dr("div",{className:`${Ar}__content`,children:fp("div",{className:`${Ar}__wrapper`,children:[Dr(I5,{className:`${Ar}__mobile-nav-toggler`,tabIndex:-1}),fp("div",{className:`${Ar}__controls-wrapper`,children:[fp("div",{className:`${Ar}__step-nav-wrapper`,children:[Dr(Z,{"aria-label":`${o(s?"general:close":"general:open")} ${o("general:menu")}`,buttonStyle:"ghost",className:`${Ar}__sidebar-toggle`,icon:Dr(J0,{}),onClick:()=>i(!s),type:"button"}),Dr("div",{className:`${Ar}__step-nav-wrapper`,children:Dr(GN,{className:`${Ar}__step-nav`})})]}),fp("div",{className:`${Ar}__actions-wrapper`,children:[Dr("div",{className:`${Ar}__actions`,ref:l,children:d.map((f,m)=>Dr("div",{className:c&&m===d.length-1?`${Ar}__last-action`:"",children:f},m))}),c&&Dr("div",{className:`${Ar}__gradient-placeholder`})]}),a&&Dr(VN,{className:`${Ar}__localizer`,renderButton:({active:f,onClick:m,onKeyDown:p,...h})=>Dr(Z,{"aria-label":o("general:locale"),buttonStyle:"secondary",extraButtonProps:{onKeyDown:p,style:{padding:"0 var(--spacer-1) 0 0"}},icon:Dr($a,{size:24}),iconPosition:"left",onClick:m,selected:f,...h,children:fp("div",{className:"localizer__button-content",children:[n.code,Dr(ve,{direction:f?"up":"down",size:16})]})})}),Dr(L5,{CustomAvatar:t,settingsItemGroups:e})]})]})})})}import{jsx as _ne}from"react/jsx-runtime";import"react";var Ine="drawer-content-container";function Rne({children:t,className:e}){return _ne("div",{className:[Ine,e].filter(Boolean).join(" "),children:t})}import{c as Dne}from"react/compiler-runtime";import{jsx as pp,jsxs as bE}from"react/jsx-runtime";import{useState as Ane}from"react";import{jsx as gE}from"react/jsx-runtime";import"react";var Tne={24:"M10.7988 11.1154L11.1794 10.7348L11.0713 10.2075C11.0247 9.97983 11 9.74332 11 9.5C11 7.567 12.567 6 14.5 6C16.433 6 18 7.567 18 9.5C18 11.433 16.433 13 14.5 13C14.2313 13 13.9708 12.9699 13.7213 12.9133L12.5 12.6362V13.8885V14H11.5H10.5V15V16H9.5H8.5V17V18H6V15.9142L10.7988 11.1154ZM13.5 14C13.5 14.1878 13.4482 14.3636 13.3581 14.5137C13.1834 14.805 12.8644 15 12.5 15H11.5V16C11.5 16.5523 11.0523 17 10.5 17H9.5V18C9.5 18.5523 9.05228 19 8.5 19H6C5.44772 19 5 18.5523 5 18V15.9142C5 15.649 5.10536 15.3946 5.29289 15.2071L10.0917 10.4083C10.0316 10.1149 10 9.81115 10 9.5C10 7.01472 12.0147 5 14.5 5C16.9853 5 19 7.01472 19 9.5C19 11.9853 16.9853 14 14.5 14C14.1563 14 13.8216 13.9615 13.5 13.8885V14ZM15 10C15.5523 10 16 9.55228 16 9C16 8.44772 15.5523 8 15 8C14.4477 8 14 8.44772 14 9C14 9.55228 14.4477 10 15 10Z"},$5=({className:t,size:e=24})=>gE("svg",{className:["icon","icon--key",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:gE("path",{clipRule:"evenodd",d:Tne[e],fill:"currentColor",fillRule:"evenodd"})});var hp="api-key-input",j5=t=>{let e=Dne(9),{id:o,"aria-label":n,highlighted:r,value:s}=t,i=n===void 0?"API Key":n,[a,l]=Ane(!1),c=s??"",u=r&&"highlight",d;e[0]!==u?(d=[`${hp}__control`,u].filter(Boolean),e[0]=u,e[1]=d):d=e[1];let f=d.join(" "),m;if(e[2]!==i||e[3]!==o||e[4]!==c||e[5]!==a||e[6]!==f){let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=()=>l(Pne),e[8]=p):p=e[8],m=bE("div",{className:hp,children:[bE("div",{className:f,children:[pp($5,{className:`${hp}__icon`}),pp("input",{"aria-label":i,className:`${hp}__field`,id:o,readOnly:!0,type:a?"text":"password",value:c}),pp("button",{"aria-label":a?"Hide API key":"Show API key",className:`${hp}__toggle`,onClick:p,type:"button",children:pp(rc,{active:a,size:24})})]}),pp(jf,{value:c})]}),e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=f,e[7]=m}else m=e[7];return m};function Pne(t){return!t}import{jsx as Kn}from"react/jsx-runtime";import"react";import{c as Fne}from"react/compiler-runtime";import{jsx as gp,jsxs as Nne}from"react/jsx-runtime";import"react";var Ba="chip",rd=t=>{let e=Fne(17),{id:o,"aria-label":n,children:r,className:s,disabled:i,elementProps:a,icon:l,onClick:c,onRemove:u,selected:d,size:f,variant:m}=t,p=f===void 0?"medium":f,h=m===void 0?"default":m,{t:g}=N(),b=`${Ba}--size-${p}`,v=`${Ba}--variant-${h}`,C=d&&`${Ba}--selected`,y;e[0]!==s||e[1]!==b||e[2]!==v||e[3]!==C?(y=[Ba,b,v,C,s].filter(Boolean),e[0]=s,e[1]=b,e[2]=v,e[3]=C,e[4]=y):y=e[4];let x=y.join(" "),w=a?.ref,S;return e[5]!==n||e[6]!==r||e[7]!==x||e[8]!==i||e[9]!==a||e[10]!==l||e[11]!==o||e[12]!==c||e[13]!==u||e[14]!==g||e[15]!==w?(S=Nne("div",{...a,className:x,id:o,ref:w,children:[c?gp("button",{"aria-label":n,className:`${Ba}__action`,disabled:i,onClick:c,type:"button"}):null,l?gp("span",{className:`${Ba}__icon`,children:l}):null,gp("span",{className:`${Ba}__label`,children:r}),u?gp("button",{"aria-label":g("general:remove"),className:`${Ba}__remove`,disabled:i,onClick:u,type:"button",children:gp(xt,{size:24})}):null]}),e[5]=n,e[6]=r,e[7]=x,e[8]=i,e[9]=a,e[10]=l,e[11]=o,e[12]=c,e[13]=u,e[14]=g,e[15]=w,e[16]=S):S=e[16],S};var nd="pill-selector",Ene=({draggable:t,onClick:e,pills:o})=>t?Kn(hr,{className:nd,ids:o.map(n=>n.name),onDragEnd:({moveFromIndex:n,moveToIndex:r})=>{t.onDragEnd({moveFromIndex:n,moveToIndex:r})},sortingStrategy:Y4,children:o.map((n,r)=>Kn(Yr,{id:n.name,children:({attributes:s,isDragging:i,listeners:a,setNodeRef:l,transform:c})=>{let{tabIndex:u,...d}=s;return Kn(rd,{"aria-label":n.name,className:[`${nd}__draggable-item`,i&&`${nd}__draggable-item--is-dragging`].filter(Boolean).join(" "),elementProps:{...a,...d,ref:l,style:{...d.style,transform:c}},icon:n.selected?Kn(xt,{}):Kn(Po,{}),id:n.name,onClick:()=>{e&&e({pill:n})},selected:n.selected,children:n.Label??Kn("span",{className:`${nd}__pill-label`,children:n.name})})}},n.key??`${n.name}-${r}`))}):Kn("div",{className:nd,children:o.map((n,r)=>Kn(rd,{"aria-label":n.name,icon:n.selected?Kn(xt,{}):Kn(Po,{}),id:n.name,onClick:()=>{e&&e({pill:n})},selected:n.selected,children:n.Label??Kn("span",{className:`${nd}__pill-label`,children:n.name})},n.key??`${n.name}-${r}`))});import{jsx as k5,jsxs as Lne}from"react/jsx-runtime";import"react";var bp="card",$ne=t=>{let{id:e,actions:o,buttonAriaLabel:n,href:r,onClick:s,title:i,titleAs:a}=t,l=[bp,e,(s||r)&&`${bp}--has-onclick`].filter(Boolean).join(" ");return Lne("div",{className:l,id:e,children:[k5(a??"div",{className:`${bp}__title`,children:i}),(s||r)&&k5(Z,{"aria-label":n,buttonStyle:"ghost",className:`${bp}__click`,el:"link",onClick:s,to:r}),o?k5("div",{className:`${bp}__actions`,children:o}):null]})};import{jsx as M5,jsxs as jne}from"react/jsx-runtime";import"react";var vp="sidebar-row";function kne({as:t,children:e,className:o,icon:n,selected:r,title:s,...i}){let a=t||"div";return M5("div",{className:`${vp}-wrapper`,children:jne(a,{className:[vp,r&&`${vp}--selected`,o].filter(Boolean).join(" "),...i,children:[!!n&&M5("span",{className:`${vp}__icon`,children:n}),!!s&&M5("span",{className:`${vp}__title`,children:s}),e]})})}import{c as Rse}from"react/compiler-runtime";import{jsx as U5,jsxs as kE,Fragment as Tse}from"react/jsx-runtime";import{formatAdminURL as Dse}from"payload/shared";import{useEffect as Ase,useRef as Pse,useState as ME}from"react";import{c as Mne}from"react/compiler-runtime";import{useEffect as Bne}from"react";var B5=t=>{let e=Mne(15),{allowedCollections:o,baseFilter:n,collectionSlug:r,expandedNodes:s,parent:i,parentFieldName:a,selectedFilters:l,tableData:c,treeData:u,treeLimit:d,typeFieldName:f,useAsTitle:m}=t,{hydrate:p}=No(),h,g;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s||e[4]!==p||e[5]!==i||e[6]!==a||e[7]!==l||e[8]!==c||e[9]!==u||e[10]!==d||e[11]!==f||e[12]!==m?(h=()=>{p({allowedCollections:o,baseFilter:n,collectionSlug:r,expandedNodes:s,parent:i,parentFieldName:a,selectedFilters:l,tableData:c,treeData:u,treeLimit:d,typeFieldName:f,useAsTitle:m})},g=[o,n,r,s,p,i,a,l,c,u,d,f,m],e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=p,e[5]=i,e[6]=a,e[7]=l,e[8]=c,e[9]=u,e[10]=d,e[11]=f,e[12]=m,e[13]=h,e[14]=g):(h=e[13],g=e[14]),Bne(h,g),null};import{c as Xne}from"react/compiler-runtime";import{jsx as Oa,jsxs as _E}from"react/jsx-runtime";import{getTranslation as Zne}from"@payloadcms/translations";import{useState as Yne}from"react";import{jsx as yp,jsxs as vE}from"react/jsx-runtime";import"react";var One={16:"M5.5 13a.5.5 0 0 0 .5-.5v-1q-.001-.033-.007-.065a1.998 1.998 0 0 0 0-3.872Q6 7.533 6 7.5v-4a.5.5 0 0 0-1 0v4q0 .033.006.063a2 2 0 0 0 0 3.872Q5 11.468 5 11.5v1a.5.5 0 0 0 .5.5m5 0a.5.5 0 0 0 .5-.5v-4q-.001-.033-.007-.063a1.998 1.998 0 0 0 0-3.872Q11 4.532 11 4.5v-1a.5.5 0 0 0-1 0v1q0 .033.006.064a1.998 1.998 0 0 0 0 3.873Q10 8.467 10 8.5v4a.5.5 0 0 0 .5.5m0-5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2m-5 3a1 1 0 1 1 0-2 1 1 0 0 1 0 2",24:"M8.5 18a.5.5 0 0 0 .5-.5v-1.55a2.5 2.5 0 0 0 0-4.9V6.5a.5.5 0 0 0-1 0v4.55a2.501 2.501 0 0 0 0 4.9v1.55a.5.5 0 0 0 .5.5m7 0a.5.5 0 0 0 .5-.5v-4.55a2.501 2.501 0 0 0 0-4.9V6.5a.5.5 0 0 0-1 0v1.55a2.5 2.5 0 0 0 0 4.9v4.55a.5.5 0 0 0 .5.5m0-6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m-7 3a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3"},Vne={16:{badgeRadius:2,cutoutRadius:3,cx:12.5,cy:5},24:{badgeRadius:2,cutoutRadius:4,cx:18,cy:7}},Cp=({className:t,hasBadgeCutout:e,size:o=24})=>{let n=e?`filter-badge-cutout-${o}`:void 0,r=Vne[o];return vE("svg",{className:["icon","icon--filter",t].filter(Boolean).join(" "),fill:"none",height:o,viewBox:`0 0 ${o} ${o}`,width:o,xmlns:"http://www.w3.org/2000/svg",children:[e&&yp("defs",{children:vE("mask",{id:n,children:[yp("rect",{fill:"white",height:o,width:o}),yp("circle",{cx:r.cx,cy:r.cy,fill:"black",r:r.cutoutRadius})]})}),yp("path",{d:One[o],fill:"currentColor",mask:n?`url(#${n})`:void 0}),e&&yp("circle",{className:"icon--filter__badge",cx:r.cx,cy:r.cy,r:r.badgeRadius})]})};import{c as Gne}from"react/compiler-runtime";import{jsx as nb,jsxs as Wne}from"react/jsx-runtime";import"react";import{c as Hne}from"react/compiler-runtime";import{jsx as yE,jsxs as zne}from"react/jsx-runtime";import"react";var O5="hierarchy-search-result-item",CE=t=>{let e=Hne(11),{id:o,onClick:n,path:r,title:s,truncateSegments:i}=t,a=i===void 0?3:i,l;e[0]!==o||e[1]!==n?(l=()=>{n({id:o})},e[0]=o,e[1]=n,e[2]=l):l=e[2];let c=l,u;e[3]!==o||e[4]!==n?(u=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),n({id:o}))},e[3]=o,e[4]=n,e[5]=u):u=e[5];let d=u,f;e:{if(!r){f="";break e}let h=r.split(" / ");if(h.length<=a){f=r;break e}f="... / "+h.slice(-a).join(" / ")}let m=f,p;return e[6]!==c||e[7]!==d||e[8]!==s||e[9]!==m?(p=zne("div",{className:O5,onClick:c,onKeyDown:d,role:"button",tabIndex:0,children:[yE("div",{className:`${O5}__title`,children:s}),m&&yE("div",{className:`${O5}__path`,children:m})]}),e[6]=c,e[7]=d,e[8]=s,e[9]=m,e[10]=p):p=e[10],p};var sb="hierarchy-search-results",xE=t=>{let e=Gne(14),{hasNextPage:o,isLoading:n,onLoadMore:r,onSelect:s,query:i,results:a,titleField:l,totalDocs:c}=t,{t:u}=N();if(a.length===0&&!n){let f;return e[0]!==i||e[1]!==u?(f=nb("div",{className:`${sb}__empty`,children:u("hierarchy:noResults",{query:i})}),e[0]=i,e[1]=u,e[2]=f):f=e[2],f}let d;if(e[3]!==o||e[4]!==n||e[5]!==r||e[6]!==s||e[7]!==a||e[8]!==l||e[9]!==c){let f;e[11]!==s||e[12]!==l?(f=m=>nb(CE,{id:m.id,onClick:s,path:m.path,title:String(m[l]||m.id)},m.id),e[11]=s,e[12]=l,e[13]=f):f=e[13],d=Wne("div",{className:sb,children:[nb("div",{className:`${sb}__list`,children:a.map(f)}),nb(_u,{className:`${sb}__load-more`,currentCount:a.length,hasMore:o,isLoading:n,onLoadMore:r,totalDocs:c})]}),e[3]=o,e[4]=n,e[5]=r,e[6]=s,e[7]=a,e[8]=l,e[9]=c,e[10]=d}else d=e[10];return d};import{formatAdminURL as Une}from"payload/shared";import*as wE from"qs-esm";import{useCallback as ib,useState as sd}from"react";var SE=({collectionSlug:t,limit:e=15,parentFieldName:o="parent",titleField:n,titlePathField:r="_h_titlePath"})=>{let[s,i]=sd([]),[a,l]=sd(!1),[c,u]=sd(!1),[d,f]=sd(0),[m,p]=sd(1),[h,g]=sd(""),{config:{routes:{api:b},serverURL:v}}=G(),{code:C}=Ce(),y=ib(async({append:_,pageToFetch:I,query:A})=>{l(!0);try{let D=wE.stringify({computeHierarchyPaths:!0,limit:e,locale:C,page:I,select:{[o]:!0,[n]:!0,[r]:!0},where:{[n]:{contains:A}}},{addQueryPrefix:!0}),T=Une({apiRoute:b,path:`/${t}${D}`,serverURL:v}),R=await fetch(T,{credentials:"include"});if(!R.ok)throw new Error("Search failed");let P=await R.json(),E=(P.docs||[]).map(F=>({...F,path:F[r]||""}));i(_?F=>[...F,...E]:E),u(P.hasNextPage||!1),f(P.totalDocs||0),p(I),g(A)}catch{_||(i([]),u(!1),f(0))}finally{l(!1)}},[b,t,e,C,o,v,n,r]),x=ib(async _=>{await y({append:!1,pageToFetch:1,query:_})},[y]),w=ib(async()=>{a||!c||!h||await y({append:!0,pageToFetch:m+1,query:h})},[a,c,h,m,y]);return{clearResults:ib(()=>{i([]),u(!1),f(0),p(1),g("")},[]),hasNextPage:c,isLoading:a,loadMore:w,results:s,search:x,totalDocs:d}};var ab="hierarchy-search",IE=t=>{let e=Xne(15),{collectionSlug:o,collectionSpecificOptions:n,isActive:r,onActiveChange:s,onFilterChange:i,onSelect:a,selectedFilters:l}=t,{i18n:c,t:u}=N(),{getEntityConfig:d}=G(),[f,m]=Yne(""),p=d({collectionSlug:o}),h=p?.admin?.useAsTitle||"id",g=Zne(p?.labels?.plural,c),b=p?.hierarchy&&typeof p.hierarchy=="object"?p.hierarchy:null,{clearResults:v,hasNextPage:C,isLoading:y,loadMore:x,results:w,search:S,totalDocs:_}=SE({collectionSlug:o,parentFieldName:b?.parentFieldName,titleField:h,titlePathField:b?.titlePathFieldName}),I;e[0]!==s||e[1]!==S?(I=async j=>{await S(j),s(!0)},e[0]=s,e[1]=S,e[2]=I):I=e[2];let A=I,D;e[3]!==v||e[4]!==s?(D=()=>{m(""),v(),s(!1)},e[3]=v,e[4]=s,e[5]=D):D=e[5];let T=D,R;e[6]!==v||e[7]!==r||e[8]!==s?(R=j=>{m(j),!j&&r&&(v(),s(!1))},e[6]=v,e[7]=r,e[8]=s,e[9]=R):R=e[9];let P=R,E;e[10]!==T||e[11]!==a?(E=j=>{let{id:k}=j;a({id:k}),T()},e[10]=T,e[11]=a,e[12]=E):E=e[12];let F=E,L;e[13]!==i?(L=j=>{let{selectedValues:k}=j;i?.(k)},e[13]=i,e[14]=L):L=e[14];let M=L,$=n&&n.length>0,B=l&&l.length>0;return _E("div",{className:ab,children:[_E("div",{className:`${ab}__controls`,children:[Oa(xl,{onChange:P,onClear:T,onSearch:A,placeholder:u("hierarchy:searchLabel",{label:g}),value:f}),$&&Oa(Ve,{buttonClassName:`${ab}__filter`,caret:!1,horizontalAlign:"right",render:()=>Oa(ue.RadioGroup,{children:n.map(j=>{let{label:k,value:O}=j,V=l?.includes(O);return Oa(ue.Button,{active:V,icon:V?Oa(Vo,{size:16}):void 0,onClick:()=>{let H=V?l.filter(z=>z!==O):[...l,O];M({selectedValues:H})},children:k},O)})}),renderButton:j=>{let{active:k,onClick:O,onKeyDown:V}=j;return Oa(Z,{"aria-label":u("general:filter"),buttonStyle:"secondary",className:`${ab}__filter`,extraButtonProps:{onKeyDown:V},icon:Oa(Cp,{hasBadgeCutout:B,size:16}),onClick:O,round:!0,selected:k})},verticalAlign:"bottom"})]}),r&&Oa(xE,{hasNextPage:C,isLoading:y,onLoadMore:x,onSelect:F,query:f,results:w,titleField:h,totalDocs:_})]})};import{jsx as In,jsxs as pb,Fragment as Cse}from"react/jsx-runtime";import{getTranslation as $E}from"@payloadcms/translations";import{DEFAULT_HIERARCHY_TREE_LIMIT as xse}from"payload/shared";import{useCallback as hb,useId as wse,useMemo as W5,useRef as Sp,useState as Sse}from"react";import{c as Jne}from"react/compiler-runtime";import{jsx as ic,jsxs as RE,Fragment as TE}from"react/jsx-runtime";import{getTranslation as qne}from"@payloadcms/translations";import{useState as Qne}from"react";var V5="create-document-button";function id(t){let e=Jne(37),{buttonStyle:o,collections:n,drawerSlug:r,label:s,onSave:i,size:a}=t,l=o===void 0?"pill":o,c=a===void 0?"medium":a,{config:u}=G(),{i18n:d,t:f}=N(),{closeModal:m,openModal:p}=ie(),[h,g]=Qne(null);if(n.length===0)return null;let b;e[0]!==u||e[1]!==d?(b=_=>{if(_.label)return _.label;let I=u.collections.find(A=>A.slug===_.collectionSlug);return qne(I?.labels?.singular,d)||_.collectionSlug},e[0]=u,e[1]=d,e[2]=b):b=e[2];let v=b,C;e[3]!==r||e[4]!==p?(C=_=>{g(_),p(r)},e[3]=r,e[4]=p,e[5]=C):C=e[5];let y=C,x;e[6]!==m||e[7]!==r||e[8]!==i?(x=_=>(m(r),i?.(_)),e[6]=m,e[7]=r,e[8]=i,e[9]=x):x=e[9];let w=x;if(n.length===1){let _=n[0],I;if(e[10]!==l||e[11]!==_||e[12]!==r||e[13]!==w||e[14]!==y||e[15]!==s||e[16]!==h||e[17]!==c||e[18]!==f){let A=s||f("general:createNew"),D;e[20]!==_||e[21]!==y?(D=()=>y(_),e[20]=_,e[21]=y,e[22]=D):D=e[22],I=RE(TE,{children:[ic(Z,{buttonStyle:l,className:V5,margin:!1,onClick:D,size:c,children:A}),h&&ic(wu,{collectionSlug:h.collectionSlug,drawerSlug:r,initialData:h.initialData,onSave:w,redirectAfterCreate:!1})]}),e[10]=l,e[11]=_,e[12]=r,e[13]=w,e[14]=y,e[15]=s,e[16]=h,e[17]=c,e[18]=f,e[19]=I}else I=e[19];return I}let S;if(e[23]!==l||e[24]!==n||e[25]!==r||e[26]!==v||e[27]!==w||e[28]!==y||e[29]!==s||e[30]!==h||e[31]!==c||e[32]!==f){let _=s||f("general:createNew"),I;e[34]!==v||e[35]!==y?(I=A=>ic(ue.Button,{onClick:()=>y(A),children:v(A)},A.collectionSlug),e[34]=v,e[35]=y,e[36]=I):I=e[36],S=RE(TE,{children:[ic(Ve,{button:ic(Z,{buttonStyle:l,className:`${V5}__popup-button`,icon:"chevron",size:c,children:_}),buttonType:"custom",className:`${V5}__popup`,horizontalAlign:"right",size:"medium",children:ic(ue.ButtonGroup,{children:n.map(I)})}),h&&ic(wu,{collectionSlug:h.collectionSlug,drawerSlug:r,initialData:h.initialData,onSave:w,redirectAfterCreate:!1})]}),e[23]=l,e[24]=n,e[25]=r,e[26]=v,e[27]=w,e[28]=y,e[29]=s,e[30]=h,e[31]=c,e[32]=f,e[33]=S}else S=e[33];return S}import{c as Kne}from"react/compiler-runtime";import{jsx as DE}from"react/jsx-runtime";import{useEffect as ese,useState as tse}from"react";var ac=t=>{let e=Kne(7),{baseClass:o,delay:n,isLoading:r,spinnerProps:s}=t,i=n===void 0?200:n,[a,l]=tse(!1),c,u;if(e[0]!==i||e[1]!==r?(c=()=>{if(r){let p=setTimeout(()=>{l(!0)},i);return()=>clearTimeout(p)}else l(!1)},u=[i,r],e[0]=i,e[1]=r,e[2]=c,e[3]=u):(c=e[2],u=e[3]),ese(c,u),!a)return null;let f=`${o||"delayed-spinner"}__loading`,m;return e[4]!==s||e[5]!==f?(m=DE("div",{className:f,children:DE(tn,{...s})}),e[4]=s,e[5]=f,e[6]=m):m=e[6],m};import{jsx as EE}from"react/jsx-runtime";import"react";import{jsx as cse}from"react/jsx-runtime";import{useCallback as use,useRef as dse}from"react";import{c as ose}from"react/compiler-runtime";import{jsx as rse}from"react/jsx-runtime";import{createContext as nse,use as sse,useCallback as lb,useEffect as ise,useLayoutEffect as ase,useRef as AE,useState as lse}from"react";var PE=nse(void 0),FE=({children:t})=>{let[e,o]=lse(null),n=AE(new Map),r=lb(l=>{if(o(l),l){let c=n.current.get(l);c?.ref.current&&document.activeElement!==c.ref.current&&c.ref.current.focus()}},[]),s=lb(l=>{n.current.set(l.id,l)},[]),i=lb(l=>{n.current.delete(l)},[]),a=lb(l=>{let c=Array.from(n.current.values());if(c.length===0)return;let u=c.filter(p=>p.ref.current).sort((p,h)=>{let g=p.ref.current,b=h.ref.current;if(!g||!b)return 0;let v=g.compareDocumentPosition(b);return v&Node.DOCUMENT_POSITION_FOLLOWING?-1:v&Node.DOCUMENT_POSITION_PRECEDING?1:0}),d=e?u.findIndex(p=>p.id===e):-1,f;l==="down"?f=d===-1?0:Math.min(d+1,u.length-1):f=Math.max(d-1,0);let m=u[f];m&&m.ref.current&&(m.ref.current.focus(),r(m.id))},[e,r]);return rse(PE,{value:{focusedId:e,moveFocus:a,registerItem:s,setFocusedId:r,unregisterItem:i},children:t})},xp=()=>{let t=sse(PE);if(!t)throw new Error("useTreeFocus must be used within TreeFocusProvider");return t},cb=t=>{let e=ose(18),{id:o,type:n,ref:r}=t,{focusedId:s,registerItem:i,setFocusedId:a,unregisterItem:l}=xp(),c=s===o,u=s===null,d=AE(!1),f,m;e[0]!==o||e[1]!==r||e[2]!==i||e[3]!==n||e[4]!==l?(f=()=>(i({id:o,type:n,ref:r}),()=>{l(o)}),m=[o,r,n,i,l],e[0]=o,e[1]=r,e[2]=i,e[3]=n,e[4]=l,e[5]=f,e[6]=m):(f=e[5],m=e[6]),ise(f,m);let p,h;e[7]!==c||e[8]!==r?(p=()=>{c&&!d.current&&r.current&&document.activeElement!==r.current&&r.current.focus(),d.current=c},h=[c,r],e[7]=c,e[8]=r,e[9]=p,e[10]=h):(p=e[9],h=e[10]),ase(p,h);let g;e[11]!==o||e[12]!==a?(g=()=>{a(o)},e[11]=o,e[12]=a,e[13]=g):g=e[13];let b=g,v=c||u?0:-1,C;return e[14]!==b||e[15]!==c||e[16]!==v?(C={handleFocus:b,isFocused:c,tabIndex:v},e[14]=b,e[15]=c,e[16]=v,e[17]=C):C=e[17],C};var NE=({id:t,onLoadMore:e})=>{let{t:o}=N(),n=dse(null),{handleFocus:r,tabIndex:s}=cb({id:t,type:"load-more",ref:n}),i=use(async()=>{await e()},[e]);return cse("button",{className:"tree__load-more-button",onClick:i,onFocus:r,ref:n,tabIndex:s,type:"button",children:o("general:loadMore")})};var ub=({id:t,currentCount:e,depth:o,onLoadMore:n,totalDocs:r})=>EE(_u,{className:"tree__load-more",currentCount:e,hasMore:e<r,loadMoreButton:EE(NE,{id:t,onLoadMore:n}),style:{"--tree-depth":o},totalDocs:r});import{jsx as Fs,jsxs as H5,Fragment as hse}from"react/jsx-runtime";import gse,{useCallback as z5,useRef as bse}from"react";import{combineWhereConstraints as mse,formatAdminURL as fse}from"payload/shared";import*as LE from"qs-esm";import{useCallback as db,useEffect as pse,useRef as mb,useState as wp}from"react";var fb=({allPossibleTypeValues:t,baseFilter:e,cache:o,cacheKey:n,collectionSlug:r,enabled:s=!0,filterByCollections:i,initialData:a,limit:l=2,parentFieldName:c,parentId:u,typeFieldName:d,useAsTitle:f})=>{let m=i?.length?i.slice().sort().join(","):"",p=e?JSON.stringify(e):"",h=n??`${r}-${String(u)}-${m}-${p}`,g=o?.current.get(h),b=u==="null"?"null":String(u),v=a?.loadedParents?.[b],C=!!v,y=C?a.docs.filter(z=>{let W=z[c]||"null";return String(W)!==b?!1:i?.length&&d?$l(z[d],i):!0}):null,[x,w]=wp(y||g?.children||null),[S,_]=wp(!1),[I,A]=wp(g?.page||1),[D,T]=wp(v?.totalDocs||g?.totalDocs||0),[R,P]=wp(v?.hasMore||g?.hasMore||!1),E=mb(!!C),F=mb(x);F.current=x;let L=mb(S);L.current=S;let{config:{routes:{api:M},serverURL:$}}=G(),B=db(async(z,W)=>{_(!0);try{let U=u==="null"||u===null?{or:[{[c]:{exists:!1}},{[c]:{equals:null}}]}:{[c]:{equals:u}},X=i?.length&&d?{or:[{[d]:{in:i}},{[d]:{exists:!1}},...t?.length?[{[d]:{not_in:t}}]:[]]}:void 0,Q=mse([U,X,e]),oe=LE.stringify({limit:l,page:z,sort:f??"id",where:Q},{addQueryPrefix:!0}),Y=fse({apiRoute:M,path:`/${r}${oe}`,serverURL:$}),K=await fetch(Y,{credentials:"include"});if(!K.ok)throw new Error("Failed to fetch children");let ee=await K.json(),te=ee.docs||[],re=i?.length&&d?te.filter(we=>$l(we[d],i)):te,me=z===1?re:[...W||[],...re];return w(me),T(ee.totalDocs||0),P(ee.hasNextPage||!1),A(z),o&&o.current.set(h,{children:me,hasMore:ee.hasNextPage||!1,page:z,totalDocs:ee.totalDocs||0}),re}catch{if(z===1){let U=[];w(U),P(!1),o&&o.current.set(h,{children:U,hasMore:!1,page:1,totalDocs:0})}return[]}finally{_(!1)}},[t,e,u,c,i,d,l,f,M,r,$,o,h]),j=mb(m);pse(()=>{j.current!==m&&(j.current=m,w(null),A(1),T(0),P(!1),s&&B(1,null))},[m,s,B]);let k=db(async()=>{if(E.current&&F.current!==null)return E.current=!1,F.current;if(F.current!==null)return F.current;if(L.current)return[];let z=o?.current.get(h);return z?(w(z.children),A(z.page),T(z.totalDocs),P(z.hasMore),z.children):B(1,null)},[o,h,B]),O=db(async()=>{if(S||!R)return[];let z=x&&x.length<l;return B(z?1:I+1,x)},[S,R,I,x,B,l]),V=db(async()=>(o&&o.current.delete(h),w(null),A(1),B(1,null)),[o,h,B]);return{children:x??o?.current.get(h)?.children??null,hasMore:R,isLoading:S,load:k,loadMore:O,refresh:V,totalDocs:D}};var vse=10,Va="tree-node",yse=(t,e)=>{let o=t.id,n=typeof o=="number"?String(o):o;if(!e)return n;let r=t[e];return r&&(typeof r=="string"||typeof r=="number")?String(r):n},G5=({allPossibleTypeValues:t,baseFilter:e,cache:o,collectionSlug:n,depth:r=0,expandedNodes:s,filterByCollections:i,icon:a,limit:l=vse,node:c,onSelect:u,onToggle:d,parentFieldName:f,selected:m,selectedNodeId:p,typeFieldName:h,useAsTitle:g})=>{let{t:b}=N(),v=s.has(c.id),C=bse(null),{setFocusedId:y}=xp(),{children:x,hasMore:w,isLoading:S,load:_,loadMore:I,totalDocs:A}=fb({allPossibleTypeValues:t,baseFilter:e,cache:o,collectionSlug:n,enabled:v,filterByCollections:i,limit:l,parentFieldName:f,parentId:c.id,typeFieldName:h,useAsTitle:g}),D=gse.useCallback(async()=>{let $=await I();if($&&$.length>0){let j=$[0].id;window.requestAnimationFrame(()=>{y(`node-${j}`)})}},[I,y]),{handleFocus:T,isFocused:R,tabIndex:P}=cb({id:`node-${c.id}`,type:"node",ref:C}),E=c.hasChildren===!0||(v&&x!==null?x.length>0:!0),F=z5($=>{$?.stopPropagation(),_(),d({id:c.id})},[_,c.id,d]),L=z5(()=>{u?.({id:c.id})},[c.id,u]),M=z5($=>{if($.target===$.currentTarget)switch($.key){case" ":case"Enter":$.preventDefault(),$.stopPropagation(),L();break;case"ArrowLeft":$.preventDefault(),$.stopPropagation(),E&&v&&d({id:c.id});break;case"ArrowRight":$.preventDefault(),$.stopPropagation(),E&&!v&&F();break}},[v,L,F,E,c.id,d]);return H5("div",{"aria-expanded":E?v:void 0,"aria-level":r+1,"aria-selected":m,className:Va,onFocus:$=>{$.target===$.currentTarget&&T()},onKeyDown:M,ref:C,role:"treeitem",style:{"--tree-depth":r},tabIndex:P,children:[H5("div",{className:[`${Va}__content`,"sidebar-row",m&&`${Va}__content--selected`,m&&"sidebar-row--selected"].filter(Boolean).join(" "),children:[E?Fs("button",{"aria-label":b(v?"general:collapse":"general:open"),className:`${Va}__toggle`,onClick:F,onMouseDown:$=>$.preventDefault(),tabIndex:-1,type:"button",children:Fs(ve,{direction:v?"down":"right"})}):Fs("div",{className:`${Va}__toggle-spacer`}),!!a&&Fs("span",{className:"sidebar-row__icon",children:a}),Fs("span",{className:`${Va}__title sidebar-row__title`,onClick:L,onMouseDown:$=>$.preventDefault(),title:c.title,children:c.title}),S&&v&&Fs("span",{className:`${Va}__loading`,children:Fs(tn,{loadingText:null,size:"sm"})})]}),v&&x&&x.length>0&&H5(hse,{children:[Fs("div",{className:`${Va}__children`,role:"group",children:x.map($=>{let j=$.id,k=yse($,g);return Fs(G5,{allPossibleTypeValues:t,baseFilter:e,cache:o,collectionSlug:n,depth:r+1,expandedNodes:s,filterByCollections:i,icon:a,limit:l,node:{id:j,hasChildren:!0,title:k},onSelect:u,onToggle:d,parentFieldName:f,selected:String(j)===String(p),selectedNodeId:p,typeFieldName:h,useAsTitle:g},String(j))})}),w&&Fs(ub,{currentCount:x.length,depth:r+1,id:`load-more-${c.id}`,onLoadMore:D,totalDocs:A})]})]})};var Ha="tree",_se=(t,e)=>{let o=t.id,n=typeof o=="number"?String(o):o;if(!e)return n;let r=t[e];return r&&(typeof r=="string"||typeof r=="number")?String(r):n},Ise=({baseFilter:t,collectionSlug:e,filterByCollections:o,icon:n,initialData:r,initialExpandedNodes:s,onNodeClick:i,selectedNodeId:a,useAsTitle:l})=>{let{moveFocus:c}=xp(),u=Re(),{i18n:d,t:f}=N(),{permissions:m}=ye(),{getEntityConfig:p}=G(),{closeModal:h,openModal:g}=ie(),b=`tree-create-${wse()}`,[v,C]=Sse(!1),{getExpandedNodesForCollection:y,getTreeDataForCollection:x,toggleNodeForCollection:w,typeFieldName:S}=No(),_=p({collectionSlug:e}),I=_.hierarchy&&typeof _.hierarchy=="object"?_.hierarchy:void 0,A=I?.parentFieldName,D=I?.admin?.treeLimit??xse,T=l??_.admin?.useAsTitle,R=!!m?.collections?.[e]?.create,P=W5(()=>I?.relatedCollections?Object.keys(I.relatedCollections):void 0,[I?.relatedCollections]),E=x(e),F=t?JSON.stringify(t):"",L=E?.baseFilter?JSON.stringify(E.baseFilter):"",M=F===L?E??r:r,$=Sp(!1),B=Sp(s);B.current!==s&&(B.current=s,$.current=!1);let j=W5(()=>{let re=y(e);return re.size>0?($.current=!0,re):$.current?re:s?new Set(s):re},[e,y,s]),k=hb(({id:re})=>{let me=$.current;$.current=!0;let we=y(e);if(!me&&we.size===0&&s?.length){let de=new Set(s.map(String)).has(String(re));for(let xe of s)(!de||String(xe)!==String(re))&&w(e,xe);de||w(e,re);return}w(e,re)},[e,y,s,w]),O=Sp(new Map),V=Sp(F);V.current!==F&&(V.current=F,O.current.clear()),W5(()=>{if(!M||M.docs.length===0)return;let re=new Map;for(let we of M.docs){let Ae=we[A]||"null",de=String(Ae);re.has(de)||re.set(de,[]),re.get(de).push(we)}let me=o?.length?o.slice().sort().join(","):"";for(let[we,Ae]of re){let de=`${e}-${we}-${me}-${F}`,xe=M.loadedParents[we];if(xe){let $e=xe.loadedCount??Ae.length;O.current.set(de,{children:Ae,hasMore:xe.hasMore,page:Math.ceil($e/D)||1,totalDocs:xe.totalDocs})}else O.current.set(de,{children:Ae,hasMore:!1,page:1,totalDocs:Ae.length})}},[M,o,A,e,D,F]);let H=Sp(null),{children:z,hasMore:W,isLoading:U,loadMore:X,refresh:Q,totalDocs:J}=fb({allPossibleTypeValues:P,baseFilter:t,cache:O,collectionSlug:e,enabled:!0,filterByCollections:o,initialData:M,limit:D,parentFieldName:A,parentId:"null",typeFieldName:S,useAsTitle:T}),oe=hb(async()=>{await X()},[X]),Y=hb(({id:re})=>{i?.({id:re})},[i]),K=hb(re=>{re.key==="ArrowDown"?(re.preventDefault(),c("down")):re.key==="ArrowUp"&&(re.preventDefault(),c("up"))},[c]);if(U&&!z)return In("div",{className:Ha,children:In(ac,{baseClass:Ha,isLoading:!0})});if(!z||z.length===0){let re=p({collectionSlug:e});return In("div",{className:Ha,children:In(id,{buttonStyle:"primary",collections:[{collectionSlug:e}],drawerSlug:b,label:f("general:createNewLabel",{label:$E(re.labels.singular,d)}),onSave:async()=>{await Q(),u.refresh()}})})}let ee=a===null,te=()=>i?.({id:null});return pb("div",{className:Ha,onKeyDown:K,ref:H,role:"tree",tabIndex:-1,children:[pb("div",{className:`${Ha}__all-option-wrapper`,children:[In("div",{"aria-selected":ee,className:[`${Ha}__all-option`,"sidebar-row",ee&&`${Ha}__all-option--selected`,ee&&"sidebar-row--selected"].filter(Boolean).join(" "),onClick:te,onKeyDown:re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),te())},role:"treeitem",tabIndex:0,children:pb("span",{className:"sidebar-row__title",children:[f("general:all")," ",$E(p({collectionSlug:e})?.labels?.plural,d)]})}),R&&pb(Cse,{children:[In(Z,{"aria-label":f("general:createNew"),buttonStyle:"ghost",className:`${Ha}__create-button`,margin:!1,onClick:()=>{C(!0),g(b)},children:In(Po,{size:24})}),v&&In(wu,{collectionSlug:e,drawerSlug:b,initialData:A?{[A]:null}:void 0,onSave:async()=>{h(b),C(!1),await Q(),u.refresh()},redirectAfterCreate:!1})]})]}),z.map(re=>{let me=re.id,we=typeof me=="number"?String(me):me,Ae=_se(re,T);return In(G5,{allPossibleTypeValues:P,baseFilter:t,cache:O,collectionSlug:e,depth:0,expandedNodes:j,filterByCollections:o,icon:n,limit:D,node:{id:me,hasChildren:!0,title:Ae},onSelect:Y,onToggle:k,parentFieldName:A,selected:we===String(a),selectedNodeId:a,typeFieldName:S,useAsTitle:T},we)}),W&&In(ub,{currentCount:z.length,depth:0,id:"load-more-root",onLoadMore:oe,totalDocs:J})]})},jE=t=>In(FE,{children:In(Ise,{...t})});var Fse=t=>{let e=Rse(40),{baseFilter:o,collectionSpecificOptions:n,hierarchyCollectionSlug:r,icon:s,initialData:i,initialExpandedNodes:a,initialSelectedFilters:l,parentFieldName:c,selectedNodeId:u,treeLimit:d,typeFieldName:f,useAsTitle:m}=t,p=Re(),h=lt(),{startRouteTransition:g}=Ue(),{config:b}=G(),{routes:v}=b,{admin:C}=v,[y,x]=ME(!1),w;e[0]!==l?(w=l??[],e[0]=l,e[1]=w):w=e[1];let[S,_]=ME(w),{setSelectedFilters:I,treeRefreshKeys:A}=No(),D=W2(),T=`hierarchy-${r}`,R;e[2]!==r||e[3]!==A?(R=A.get(r)??0,e[2]=r,e[3]=A,e[4]=R):R=e[4];let P=R,E=Pse(P),F,L;e[5]!==D||e[6]!==T||e[7]!==P?(F=()=>{E.current!==P&&(E.current=P,D?.reloadTabContent(T))},L=[P,D,T],e[5]=D,e[6]=T,e[7]=P,e[8]=F,e[9]=L):(F=e[8],L=e[9]),Ase(F,L);let M;if(e[10]!==C||e[11]!==o||e[12]!==n||e[13]!==r||e[14]!==s||e[15]!==i||e[16]!==a||e[17]!==l||e[18]!==y||e[19]!==c||e[20]!==p||e[21]!==h||e[22]!==S||e[23]!==u||e[24]!==I||e[25]!==D?.activeTabSlug||e[26]!==g||e[27]!==T||e[28]!==d||e[29]!==f||e[30]!==m){let $=h.get(c??"parent"),j=D?.activeTabSlug===T?$??u??void 0:void 0,k=o?JSON.stringify(o):"",O;e[32]!==I?(O=W=>{_(W),I(W)},e[32]=I,e[33]=O):O=e[33];let V=O,H;e[34]!==C||e[35]!==r||e[36]!==c||e[37]!==p||e[38]!==g?(H=W=>{let{id:U}=W,Q=Dse({adminRoute:C,path:`/collections/${r}/hierarchy?${c??"parent"}=${U}`});g(()=>{p.push(Q),p.refresh()})},e[34]=C,e[35]=r,e[36]=c,e[37]=p,e[38]=g,e[39]=H):H=e[39];let z=H;M=kE(Tse,{children:[U5(B5,{baseFilter:o,collectionSlug:r,expandedNodes:a,parentFieldName:c,selectedFilters:l,treeData:i,treeLimit:d,typeFieldName:f}),kE("div",{className:"hierarchy-sidebar-tab",children:[U5(IE,{collectionSlug:r,collectionSpecificOptions:n,isActive:y,onActiveChange:x,onFilterChange:V,onSelect:z,selectedFilters:S}),!y&&U5(jE,{baseFilter:o,collectionSlug:r,filterByCollections:S.length>0?S:void 0,icon:s,initialData:i,initialExpandedNodes:a,onNodeClick:z,selectedNodeId:j,useAsTitle:m},`${r}-${k}`)]})]}),e[10]=C,e[11]=o,e[12]=n,e[13]=r,e[14]=s,e[15]=i,e[16]=a,e[17]=l,e[18]=y,e[19]=c,e[20]=p,e[21]=h,e[22]=S,e[23]=u,e[24]=I,e[25]=D?.activeTabSlug,e[26]=g,e[27]=T,e[28]=d,e[29]=f,e[30]=m,e[31]=M}else M=e[31];return M};import{c as Nse}from"react/compiler-runtime";import{jsx as za,jsxs as gb}from"react/jsx-runtime";import{getTranslation as Ese}from"@payloadcms/translations";import{formatAdminURL as Lse}from"payload/shared";import ad from"react";var bb="copy-locale-data",vb="copy-locale",X5=()=>{let t=Nse(36),{config:e}=G(),{localization:o,routes:n}=e,{admin:r}=n,{code:s}=Ce(),{id:i,collectionSlug:a,globalSlug:l}=be(),{i18n:c,t:u}=N(),d=Kt(),{toggleModal:f}=ie(),{copyDataFromLocale:m}=ct(),p=Re(),{startRouteTransition:h}=Ue(),g=o&&o.locales.map($se)||[],b;t[0]!==s?(b=O=>O.value!==s,t[0]=s,t[1]=b):b=t[1];let v=g.filter(b),C;t[2]!==c||t[3]!==o?(C=O=>{let V=o&&o.locales.find(H=>H.code===O);return V&&V.label?Ese(V.label,c):O},t[2]=c,t[3]=o,t[4]=C):C=t[4];let y=C,[x,w]=ad.useState(!1),[S,_]=ad.useState(null),[I,A]=ad.useState(s),[D,T]=ad.useState(!1),R,P;t[5]!==s||t[6]!==I?(R=()=>{I!==s&&A(s)},P=[s,I],t[5]=s,t[6]=I,t[7]=R,t[8]=P):(R=t[7],P=t[8]),ad.useEffect(R,P);let E;t[9]!==r||t[10]!==a||t[11]!==m||t[12]!==l||t[13]!==i||t[14]!==D||t[15]!==p||t[16]!==h||t[17]!==u||t[18]!==f?(E=async O=>{let{from:V,to:H}=O;w(!0);try{await m({collectionSlug:a,docID:i,fromLocale:V,globalSlug:l,overrideData:D,toLocale:H}),w(!1),h(()=>p.push(Lse({adminRoute:r,path:`/${a?`collections/${a}/${i}`:`globals/${l}`}`})+`?locale=${H}`)),f(vb)}catch(z){let W=z;w(!1);let U=W.message||"error:unknown",X=U.startsWith("error:")?u(U):U;se.error(X)}},t[9]=r,t[10]=a,t[11]=m,t[12]=l,t[13]=i,t[14]=D,t[15]=p,t[16]=h,t[17]=u,t[18]=f,t[19]=E):E=t[19];let F=E;if(!i&&!l)return null;let L;t[20]!==d||t[21]!==u||t[22]!==f?(L=()=>{d?se.info(u("general:unsavedChanges")):f(vb)},t[20]=d,t[21]=u,t[22]=f,t[23]=L):L=t[23];let M;t[24]!==f?(M=()=>{f(vb)},t[24]=f,t[25]=M):M=t[25];let $;t[26]!==F||t[27]!==x||t[28]!==I||t[29]!==u||t[30]!==S?($=async()=>{if(I===S){se.error(u("localization:cannotCopySameLocale"));return}x||await F({from:I,to:S})},t[26]=F,t[27]=x,t[28]=I,t[29]=u,t[30]=S,t[31]=$):$=t[31];let B;t[32]===Symbol.for("react.memo_cache_sentinel")?(B=O=>{O?.value&&A(O.value)},t[32]=B):B=t[32];let j;t[33]===Symbol.for("react.memo_cache_sentinel")?(j=O=>{O?.value&&_(O.value)},t[33]=j):j=t[33];let k;return t[34]!==D?(k=()=>T(!D),t[34]=D,t[35]=k):k=t[35],gb(ad.Fragment,{children:[za(ue.Button,{id:`${bb}__button`,onClick:L,children:u("localization:copyToLocale")}),gb(It,{className:bb,Header:za(Ra,{onClose:M,title:u("localization:copyToLocale")}),slug:vb,children:[gb("div",{className:`${bb}__sub-header`,children:[za("span",{children:I&&S?za("div",{children:u("localization:copyFromTo",{from:y(I),to:y(S)})}):u("localization:selectLocaleToCopy")}),za(Z,{buttonStyle:"primary",disabled:!I||!S,iconPosition:"left",onClick:$,size:"medium",children:x?u("general:copying")+"...":u("general:copy")})]}),gb("div",{className:`${bb}__content`,children:[za(_s,{label:u("localization:copyFrom"),name:"fromLocale",onChange:B,options:g,path:"fromLocale",readOnly:!0,value:I}),za(_s,{label:u("localization:copyTo"),name:"toLocale",onChange:j,options:v,path:"toLocale",value:S}),za(gr,{checked:D,field:{name:"overwriteExisting",label:u("general:overwriteExistingData")},onChange:k,path:"overwriteExisting"})]})]})]})};function $se(t){return{label:t.label,value:t.code}}import{jsx as lc,jsxs as OE}from"react/jsx-runtime";import{getTranslation as VE}from"@payloadcms/translations";import{formatAdminURL as kse,mergeListSearchAndWhere as Mse}from"payload/shared";import*as HE from"qs-esm";import xb from"react";function yb({deletePermanently:t,hasDeletePermission:e,hasTrashPermission:o,isTrashView:n=!1}){return n||!o||e&&t}import{c as jse}from"react/compiler-runtime";import{jsx as ld,jsxs as Z5}from"react/jsx-runtime";import BE from"react";var _p="list-selection";function Cb(t){let e=jse(5),{count:o,ListActions:n,SelectionActions:r}=t,{t:s}=N(),i;return e[0]!==n||e[1]!==r||e[2]!==o||e[3]!==s?(i=Z5("div",{className:_p,children:[ld("span",{className:`${_p}__count`,children:s("general:selectedCount",{count:o,label:""})}),n&&n.length>0&&Z5(BE.Fragment,{children:[ld("span",{children:"\u2014"}),ld("div",{className:`${_p}__actions`,children:n})]}),r&&r.length>0&&Z5(BE.Fragment,{children:[ld("span",{children:"\u2014"}),ld("div",{className:`${_p}__actions`,children:r})]})]}),e[0]=n,e[1]=r,e[2]=o,e[3]=s,e[4]=i):i=e[4],i}function Xo({children:t,className:e,...o}){return ld(Z,{...o,buttonStyle:"ghost",className:[`${_p}__button`,e].filter(Boolean).join(" "),children:t})}function Ip({afterDelete:t,hasDeletePermission:e=!1,hasTrashPermission:o=!1,modalPrefix:n,search:r,selections:s,trash:i,viewType:a,where:l}){let{t:c}=N(),{config:{collections:u,routes:{api:d}}}=G(),{code:f}=Ce(),{i18n:m}=N(),{openModal:p}=ie(),[h,g]=xb.useState(!1),b=`${n?`${n}-`:""}confirm-delete-many-docs`,v=xb.useCallback(async()=>{let x=Object.keys(s).length===1,w={};for(let[S,{all:_,ids:I=[]}]of Object.entries(s)){let A=u.find(({slug:D})=>D===S);if(A){let D;_?x&&l?D=a==="trash"?{and:[...Array.isArray(l.and)?l.and:[l],{deletedAt:{exists:!0}}]}:l:D=a==="trash"?{and:[{id:{not_equals:""}},{deletedAt:{exists:!0}}]}:{id:{not_equals:""}}:D={and:[{id:{in:I}},...a==="trash"?[{deletedAt:{exists:!0}}]:[]]};let T=kse({apiRoute:d,path:`/${S}${HE.stringify({limit:0,locale:f,select:{},where:Mse({collectionConfig:A,search:r,where:D}),...a==="trash"?{trash:!0}:{}},{addQueryPrefix:!0})}`}),R=yb({deletePermanently:h,hasDeletePermission:e,hasTrashPermission:!!A.trash&&o,isTrashView:a==="trash"}),P=R?await We.delete(T,{headers:{"Accept-Language":m.language,"Content-Type":"application/json"}}):await We.patch(T,{body:JSON.stringify({deletedAt:new Date().toISOString()}),headers:{"Accept-Language":m.language,"Content-Type":"application/json"}});try{let{plural:E,singular:F}=A.labels,L=await P.json(),M=L?.docs.length||0,$=M>1?E:F;if(P.status<400||M>0){let B;R?a==="trash"||e&&h?B="general:permanentlyDeletedCountSuccessfully":B="general:deletedCountSuccessfully":B="general:trashedCountSuccessfully",se.success(c(B,{count:M,label:VE($,m)}))}L?.errors.length>0&&se.error(L.message,{description:L.errors.map(B=>B.message).join(`
55
- `)}),w[S]={deletedCount:M,errors:L?.errors||null,ids:L?.docs.map(B=>B.id)||[],totalCount:L.totalDocs},P.status>400&&L?.errors.length===0&&(se.error(c("error:unknown")),w[S].errors=[c("error:unknown")]);continue}catch(E){se.error(c("error:unknown")),w[S]={deletedCount:0,errors:[E],ids:[],totalCount:0};continue}}}typeof t=="function"&&t(w)},[s,t,u,h,e,o,f,r,d,m,a,l,c]),{label:C,labelCount:y}=Object.entries(s).reduce((x,[w,S],_,I)=>{let A=u.find(({slug:D})=>D===w);if(A){let D=x.labelCount===void 0?S.totalCount:x.labelCount,T=`${x.labelCount!==void 0?`${S.totalCount} `:""}${VE(S.totalCount>1?A.labels.plural:A.labels.singular,m)}`,R;return _===I.length-1&&_!==0?R=`${x.label} and ${T}`:_>0?R=`${x.label}, ${T}`:R=T,{label:R,labelCount:D}}return x},{label:"",labelCount:void 0});return OE(xb.Fragment,{children:[lc(Xo,{"aria-label":c("general:delete"),className:"delete-documents__toggle",onClick:()=>{p(b)},children:c("general:delete")}),lc(nt,{body:OE(xb.Fragment,{children:[lc("p",{children:i&&o?a==="trash"?lc(Ro,{elements:{0:({children:x})=>lc("strong",{children:x}),1:({children:x})=>lc("strong",{children:x})},i18nKey:"general:aboutToPermanentlyDeleteTrash",t:c,variables:{count:y??0,label:C}}):c("general:aboutToTrashCount",{count:y,label:C}):c("general:aboutToDeleteCount",{count:y,label:C})}),i&&o&&e&&a!=="trash"&&lc(Ft,{checked:h,id:"delete-forever",label:c("general:deletePermanently"),name:"delete-forever",onToggle:x=>g(x.target.checked)})]}),confirmingLabel:c("general:deleting"),heading:c("general:confirmDeletion"),modalSlug:b,onConfirm:v})]})}import{jsx as ft,jsxs as Rn,Fragment as Uie}from"react/jsx-runtime";import{getTranslation as Xie}from"@payloadcms/translations";import{formatAdminURL as Zie,hasAutosaveEnabled as U8,hasDraftsEnabled as X8,hasScheduledPublishEnabled as Yie}from"payload/shared";import uw,{Fragment as Lb,useCallback as Jie,useEffect as Z8,useRef as qie,useState as Qie}from"react";import{createContext as Bse,use as zE}from"react";var wb=Bse({appIsReady:!1,breakpoint:void 0,breakpoints:void 0,iframeRef:void 0,isExpanded:!1,isLivePreviewEnabled:void 0,isLivePreviewing:!1,isPopupOpen:!1,isPreviewEnabled:void 0,lastReadyAt:0,measuredDeviceSize:{height:0,width:0},openPopupWindow:()=>{},popupRef:void 0,previewURL:void 0,setBreakpoint:()=>{},setHeight:()=>{},setIsExpanded:()=>{},setIsLivePreviewing:()=>{},setLoadedURL:()=>{},setMeasuredDeviceSize:()=>{},setPreviewURL:()=>{},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}),Zo=()=>zE(wb),Sb=()=>{let{isPreviewEnabled:t,previewURL:e,setPreviewURL:o}=zE(wb);return{isPreviewEnabled:t,previewURL:e,setPreviewURL:o}};import{jsx as WE,jsxs as Vse}from"react/jsx-runtime";import{dequal as Hse}from"dequal/lite";import{formatAdminURL as UE,getAutosaveInterval as zse,hasDraftValidationEnabled as Gse,reduceFieldsToValues as XE}from"payload/shared";import*as JE from"qs-esm";import Wse,{useDeferredValue as Use,useEffect as ZE,useRef as Y5,useState as Xse}from"react";import{unflatten as Ose}from"payload/shared";var GE=(t,e,o)=>{let n={data:{},valid:!0};return t&&(Object.keys(t).forEach(r=>{(o===!0||!t[r]?.disableFormData)&&(n.data[r]=t[r]?.value,t[r].valid||(n.valid=!1))}),e&&(n.data=Ose(n.data))),n};var Zse="autosave",YE=1e3,_b=({id:t,collection:e,global:o})=>{let{config:{routes:{api:n}}}=G(),{docConfig:r,mostRecentVersionIsAutosaved:s,setMostRecentVersionIsAutosaved:i,setUnpublishedVersionCount:a}=be(),{isValid:l,setBackgroundProcessing:c,submit:u}=Ge(),[d]=ea(),f=Kt(),m=vo(),{code:p}=Ce(),{t:h}=N(),g=zse(r),b=Gse(r),[v,C]=Xse(!1),y=Use(v),x=Vn(d,g),{queueTask:w}=Hl(),S=Y5(null),_=et(()=>{S.current=void 0;let T,R,P=()=>{R-T<YE?S.current=setTimeout(()=>{C(!1)},YE-(R-T)):D()};w(async()=>{if(f){T=new Date().getTime(),C(!0);let E,F,L,M=JE.stringify({autosave:!0,depth:0,draft:!0,"fallback-locale":"null",locale:p},{addQueryPrefix:!0});e&&t&&(L=e.slug,E=UE({apiRoute:n,path:`/${L}/${t}${M}`}),F="PATCH"),o&&(L=o.slug,E=UE({apiRoute:n,path:`/globals/${L}${M}`}),F="POST");let{valid:$}=GE(d,!0);if(!(m&&!$&&b)&&f&&E){let j=await u({acceptValues:{overrideLocalChanges:!1},action:E,context:{getDocPermissions:!1,incrementVersionCount:!s},disableFormWhileProcessing:!1,disableSuccessStatus:!0,method:F,overrides:{_status:"draft"},skipValidation:!b});j&&j?.res?.ok&&!s&&(i(!0),a(O=>O+1)),R=new Date().getTime(),P()}}},{afterProcess:()=>{c(!1)},beforeProcess:()=>{c(!0)}})}),I=Y5(!1),A=Y5(XE(x));ZE(()=>{if(!I.current){I.current=!0;return}let{updatedAt:T,...R}=XE(x),{updatedAt:P,...E}=A.current;Hse(R,E)||(A.current=R,_())},[x]),ZE(()=>()=>{D()},[]);let D=et(()=>{S.current&&clearTimeout(S.current),C(!1)});return Vse(Wse.Fragment,{children:[b&&!l&&WE(tp,{}),y&&WE("div",{className:Zse,children:h("general:saving")})]})};import{jsx as Rp,jsxs as qE}from"react/jsx-runtime";import{getTranslation as QE}from"@payloadcms/translations";import{formatAdminURL as KE}from"payload/shared";import{Fragment as e8,useCallback as t8,useState as Yse}from"react";var Jse="delete-document",o8=t=>{let{id:e,buttonId:o,collectionSlug:n,onDelete:r,redirectAfterDelete:s=!0,singularLabel:i,title:a}=t,{config:{routes:{admin:l,api:c}},getEntityConfig:u}=G(),d=u({collectionSlug:n}),{hasDeletePermission:f,hasTrashPermission:m}=be(),{setModified:p}=Ge(),h=Re(),{i18n:g,t:b}=N(),{title:v}=zo(),{startRouteTransition:C}=Ue(),{openModal:y}=ie(),x=`delete-${e}`,[w,S]=Yse(!1),_=t8(()=>{se.error(b("error:deletingTitle",{title:v}))},[b,v]),I=t8(async()=>{p(!1);let A=yb({deletePermanently:w,hasDeletePermission:f,hasTrashPermission:m});try{let D=KE({apiRoute:c,path:`/${n}/${e}`}),T=A?await We.delete(D,{headers:{"Accept-Language":g.language,"Content-Type":"application/json"}}):await We.patch(D,{body:JSON.stringify({deletedAt:new Date().toISOString()}),headers:{"Accept-Language":g.language,"Content-Type":"application/json"}}),R=await T.json();if(T.status<400){if(se.success(b(A?"general:titleDeleted":"general:titleTrashed",{label:QE(i,g),title:v})||R.message),s)return C(()=>h.push(KE({adminRoute:l,path:`/collections/${n}`})));typeof r=="function"&&await r({id:e,collectionConfig:d});return}R.errors?R.errors.forEach(P=>se.error(P.message)):_();return}catch{return _()}},[w,p,f,m,c,n,e,b,i,_,g,v,h,l,s,r,d,C]);return e?qE(e8,{children:[Rp(ue.Button,{id:o,onClick:()=>{y(x)},children:b("general:delete")}),Rp(nt,{body:qE(e8,{children:[Rp(Ro,{elements:{1:({children:A})=>Rp("strong",{children:A})},i18nKey:d.trash&&m?"general:aboutToTrash":"general:aboutToDelete",t:b,variables:{label:QE(i,g),title:a||v||e}}),d.trash&&m&&f&&Rp(Ft,{checked:w,id:"delete-forever",label:b("general:deletePermanently"),name:"delete-forever",onToggle:A=>S(A.target.checked)})]}),className:Jse,confirmingLabel:b("general:deleting"),heading:b("general:confirmDeletion"),modalSlug:x,onConfirm:I})]}):null};import{jsx as K5,jsxs as tie}from"react/jsx-runtime";import{getTranslation as ew}from"@payloadcms/translations";import{formatAdminURL as n8,hasDraftsEnabled as oie}from"payload/shared";import*as i8 from"qs-esm";import rie,{useCallback as s8,useMemo as nie}from"react";var cc=t=>{for(let e of t){if("localized"in e&&e.localized)return!0;switch(e.type){case"array":case"collapsible":case"group":case"row":if(e.fields&&cc(e.fields))return!0;break;case"blocks":if(e.blocks){for(let o of e.blocks)if(typeof o!="string"&&o.fields&&cc(o.fields))return!0}break;case"tabs":if(e.tabs){for(let o of e.tabs)if("localized"in o&&o.localized||"fields"in o&&o.fields&&cc(o.fields))return!0}break}}return!1};import{jsx as uc,jsxs as J5}from"react/jsx-runtime";import{getTranslation as qse}from"@payloadcms/translations";import{setsAreEqual as Qse}from"payload/shared";import{useCallback as q5,useMemo as Q5,useState as Kse}from"react";var eie=({i18n:t,localization:e})=>e.locales.map(o=>({label:qse(o.label,t),value:o.code})),Tp="select-locales-drawer",r8=({slug:t,localization:e,onConfirm:o})=>{let{i18n:n,t:r}=N(),{toggleModal:s}=ie(),[i,a]=Kse([]),l=Q5(()=>eie({i18n:n,localization:e}),[e,n]),c=Q5(()=>l.map(p=>p.value),[l]),u=Q5(()=>Qse(new Set(i),new Set(c)),[i,c]),d=q5(()=>{a(u?[]:[...c])},[u,c]),f=q5(p=>{a(h=>h.includes(p)?h.filter(g=>g!==p):[...h,p])},[]),m=q5(async()=>{await o({selectedLocales:i}),s(t)},[o,i,t,s]);return J5(It,{className:Tp,Header:uc(Ra,{onClose:()=>{s(t)},title:`${r("general:duplicate")} ${r("localization:selectedLocales")}`}),slug:t,children:[J5("div",{className:`${Tp}__sub-header`,children:[uc("span",{children:r("localization:selectLocaleToDuplicate")}),uc(Z,{buttonStyle:"primary",disabled:i.length===0,iconPosition:"left",id:"#action-duplicate-confirm",onClick:m,size:"medium",children:r("general:duplicate")})]}),J5("div",{className:`${Tp}__content`,children:[uc("div",{className:`${Tp}__item`,children:uc(Ft,{checked:u,id:"select-locale-all",label:r("general:selectAll",{count:c.length,label:r("general:locales")}),onToggle:d})}),l.map(p=>uc("div",{className:`${Tp}__item`,children:uc(Ft,{checked:i.includes(p.value),id:`select-locale-${p.value}`,label:p.label,onToggle:()=>f(p.value)})},p.value))]})]})};var tw=({id:t,slug:e,onDuplicate:o,redirectAfterDuplicate:n=!0,selectLocales:r,singularLabel:s})=>{let i=Re(),a=Kt(),{openModal:l}=ie(),{code:c}=Ce(),{setModified:u}=Ge(),{startRouteTransition:d}=Ue(),{config:{localization:f,routes:{admin:m,api:p}},getEntityConfig:h}=G(),g=h({collectionSlug:e}),{i18n:b,t:v}=N(),C=`duplicate-${t}`,y=`duplicate-locales-${t}`,x=nie(()=>r&&g?cc(g.fields):!1,[g,r]),w=s8(async I=>{let{selectedLocales:A}=I||{},D=A&&A.length>0,T={};c&&(T.locale=c),D&&(T.selectedLocales=A);let R={"Accept-Language":b.language,"Content-Type":"application/json",credentials:"include"};try{let P=await We.post(n8({apiRoute:p,path:`/${e}/${t}/duplicate${i8.stringify(T,{addQueryPrefix:!0})}`}),{body:JSON.stringify(oie(g)?{_status:"draft"}:{}),headers:R}),{doc:E,errors:F,message:L}=await P.json();if(P.status<400){if(se.success(L||v("general:successfullyDuplicated",{label:ew(s,b)})),u(!1),n)return d(()=>i.push(n8({adminRoute:m,path:`/collections/${e}/${E.id}${c?`?locale=${c}`:""}`})));typeof o=="function"&&o({collectionConfig:g,doc:E})}else se.error(F?.[0].message||L||v("error:unspecific",{label:ew(s,b)}))}catch{se.error(v("error:unspecific",{label:ew(s,b)}))}},[m,p,g,b,t,c,o,n,i,u,s,e,d,v]),S=s8(async()=>{r?l(y):await w()},[w,y,r,l]),_=r?`${v("general:duplicate")} ${v("localization:selectedLocales")}`:v("general:duplicate");return!r||x?tie(rie.Fragment,{children:[K5(ue.Button,{id:`action-duplicate${x?"-locales":""}`,onClick:()=>{a?l(C):r?l(y):w()},children:_}),K5(nt,{body:v("general:unsavedChangesDuplicate"),confirmLabel:v("general:duplicateWithoutSaving"),heading:v("general:unsavedChanges"),modalSlug:C,onConfirm:S}),r&&f&&K5(r8,{localization:f,onConfirm:w,slug:y})]}):null};import{jsx as u8}from"react/jsx-runtime";import"react";import{jsx as a8}from"react/jsx-runtime";import"react";var l8={visible:{16:"M11.5 4h-7a.5.5 0 0 0-.5.5v7a.5.5 0 0 0 .5.5h1a.5.5 0 0 1 0 1h-1A1.5 1.5 0 0 1 3 11.5v-7A1.5 1.5 0 0 1 4.5 3h7A1.5 1.5 0 0 1 13 4.5v3a.5.5 0 0 1-1 0v-3a.5.5 0 0 0-.5-.5m-3.466 7.5q.023.045.068.116c.116.18.3.403.544.619.495.437 1.145.765 1.854.765s1.359-.328 1.854-.765c.245-.216.428-.44.544-.62q.044-.07.068-.115a2 2 0 0 0-.068-.116c-.116-.18-.3-.403-.544-.619-.495-.437-1.145-.765-1.854-.765s-1.359.328-1.854.765a3 3 0 0 0-.544.62q-.044.07-.068.115M10.5 9C8.458 9 7 10.875 7 11.5S8.458 14 10.5 14s3.5-1.875 3.5-2.5S12.542 9 10.5 9m.5 2.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0",24:"M16.5 7h-9a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h1a.5.5 0 0 1 0 1h-1A1.5 1.5 0 0 1 6 16.5v-9A1.5 1.5 0 0 1 7.5 6h9A1.5 1.5 0 0 1 18 7.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5m-5.509 9.087.001-.003zm.037-.087q.04-.085.13-.22a4 4 0 0 1 .743-.79c.668-.55 1.576-.99 2.599-.99s1.93.44 2.599.99c.332.274.583.557.742.79q.091.135.131.22-.04.085-.13.22a4 4 0 0 1-.743.79c-.669.55-1.576.99-2.599.99s-1.93-.44-2.599-.99a4 4 0 0 1-.742-.79 2 2 0 0 1-.132-.22m6.98.087v-.003zm0-.17v-.004zm-7.016 0v-.004zM14.5 13c-2.625 0-4.5 2.25-4.5 3s1.875 3 4.5 3 4.5-2.25 4.5-3-1.875-3-4.5-3m1 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0"},hidden:{16:"M4.5 4h7a.5.5 0 0 1 .5.5v3a.5.5 0 0 0 1 0v-3A1.5 1.5 0 0 0 11.5 3h-7A1.5 1.5 0 0 0 3 4.5v7A1.5 1.5 0 0 0 4.5 13h1a.5.5 0 0 0 0-1h-1a.5.5 0 0 1-.5-.5v-7a.5.5 0 0 1 .5-.5m3.115 6.383C7.222 10.822 7 11.256 7 11.5c0 .625 1.458 2.5 3.5 2.5q.345-.001.665-.067l-.95-.95c-.598-.074-1.14-.37-1.569-.748a3 3 0 0 1-.544-.62 2 2 0 0 1-.068-.115q.023-.045.068-.116.086-.135.221-.293zm5.062 1.526q.136-.158.22-.293.045-.07.069-.116a2 2 0 0 0-.068-.116c-.116-.18-.3-.403-.544-.619-.428-.377-.971-.674-1.569-.747l-.95-.951Q10.154 9 10.5 9c2.042 0 3.5 1.875 3.5 2.5 0 .244-.222.678-.615 1.117zM8.354 8.646a.5.5 0 1 0-.708.708l5 5a.5.5 0 0 0 .708-.708z",24:"M11.147 12.648a.5.5 0 0 1 .707 0l6 6a.5.5 0 1 1-.707.707l-6-6a.5.5 0 0 1 0-.707m-.569 2.25c.176-.209.491-.205.685-.012.196.196.19.514.017.731a3 3 0 0 0-.12.163q-.088.131-.129.215a.01.01 0 0 0 0 .01q.04.084.128.215c.16.232.41.516.742.79.597.491 1.385.893 2.276.973a.54.54 0 0 1 .336.152l.22.22c.24.241.108.645-.233.645-2.625 0-4.5-2.25-4.5-3 0-.248.207-.66.578-1.102M16.5 6A1.5 1.5 0 0 1 18 7.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5h-9a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h1a.5.5 0 0 1 0 1h-1A1.5 1.5 0 0 1 6 16.5v-9A1.5 1.5 0 0 1 7.5 6zm-2 7c2.625 0 4.5 2.25 4.5 3l-.006.074c-.035.253-.237.63-.575 1.03-.176.208-.492.204-.685.011-.196-.196-.19-.513-.016-.73q.068-.086.123-.165.088-.131.127-.215a.01.01 0 0 0 0-.01 2 2 0 0 0-.127-.215 4 4 0 0 0-.742-.79c-.598-.492-1.388-.896-2.28-.975a.54.54 0 0 1-.337-.152l-.215-.215c-.243-.243-.11-.648.233-.648"}},c8=({active:t=!0,className:e,size:o=16})=>{let n=t?l8.hidden[o]:l8.visible[o];return a8("svg",{className:["icon","icon--preview",e].filter(Boolean).join(" "),fill:"none",height:o,viewBox:`0 0 ${o} ${o}`,width:o,xmlns:"http://www.w3.org/2000/svg",children:a8("path",{clipRule:"evenodd",d:n,fill:"currentColor",fillRule:"evenodd"})})};var d8="live-preview-toggler",m8=()=>{let{isLivePreviewing:t,setIsLivePreviewing:e,url:o}=Zo(),{t:n}=N();if(!o)return null;let r=n(t?"general:exitLivePreview":"general:livePreview");return u8(Z,{"aria-label":r,buttonStyle:"ghost",className:[d8,t&&`${d8}--active`].filter(Boolean).join(" "),icon:u8(c8,{active:t,size:24}),id:"live-preview-toggler",onClick:()=>{e(!t)},tooltip:r})};import{c as iie}from"react/compiler-runtime";import{jsx as p8,jsxs as aie}from"react/jsx-runtime";import{useState as lie}from"react";import{jsx as f8}from"react/jsx-runtime";import"react";var sie={16:"M10.776 8H5.224l-.025.005A.25.25 0 0 0 5 8.25v3.5c0 .138.112.25.25.25h5.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.199-.245zM7 7H6V6a2 2 0 1 1 4 0v1zM5 6a3 3 0 0 1 6 0v1.025c.57.116 1 .62 1 1.225v3.5c0 .69-.56 1.25-1.25 1.25h-5.5C4.56 13 4 12.44 4 11.75v-3.5c0-.605.43-1.11 1-1.225z",24:"M12 6C13.6569 6 15 7.34315 15 9V11H15.5C16.3284 11 17 11.6716 17 12.5V16.5C17 17.3284 16.3284 18 15.5 18H8.5C7.67157 18 7 17.3284 7 16.5V12.5C7 11.6716 7.67157 11 8.5 11H9V9C9 7.34315 10.3431 6 12 6ZM8.5 12C8.22386 12 8 12.2239 8 12.5V16.5C8 16.7761 8.22386 17 8.5 17H15.5C15.7761 17 16 16.7761 16 16.5V12.5C16 12.2239 15.7761 12 15.5 12H8.5ZM12 7C10.8954 7 10 7.89543 10 9V11H14V9C14 7.89543 13.1046 7 12 7Z"},Dp=({className:t,size:e=24})=>f8("svg",{className:["icon","icon--lock",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:f8("path",{clipRule:"evenodd",d:sie[e],fill:"currentColor",fillRule:"evenodd"})});var h8="locked",Li=t=>{let e=iie(8),{className:o,user:n}=t,[r,s]=lie(!1),{t:i}=N(),a=X0(n)?n.email??n.id:i("general:anotherUser"),l;e[0]!==o?(l=[h8,o].filter(Boolean),e[0]=o,e[1]=l):l=e[1];let c=l.join(" "),u,d;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=()=>s(!0),d=()=>s(!1),e[2]=u,e[3]=d):(u=e[2],d=e[3]);let f=`${a} ${i("general:isEditing")}`,m;return e[4]!==r||e[5]!==c||e[6]!==f?(m=aie("div",{className:c,onMouseEnter:u,onMouseLeave:d,role:"button",tabIndex:0,children:[p8(io,{alignCaret:"left",className:`${h8}__tooltip`,position:"bottom",show:r,staticPositioning:!0,children:f}),p8(Dp,{})]}),e[4]=r,e[5]=c,e[6]=f,e[7]=m):m=e[7],m};import{jsx as Ib,jsxs as cie}from"react/jsx-runtime";import{getTranslation as g8}from"@payloadcms/translations";import{formatAdminURL as b8}from"payload/shared";import*as y8 from"qs-esm";import{Fragment as uie,useCallback as v8}from"react";var C8=t=>{let{id:e,buttonId:o,collectionSlug:n,onDelete:r,redirectAfterDelete:s=!0,singularLabel:i,title:a}=t,{config:{routes:{admin:l,api:c},serverURL:u},getEntityConfig:d}=G(),f=d({collectionSlug:n}),m=Re(),{i18n:p,t:h}=N(),{title:g}=zo(),{startRouteTransition:b}=Ue(),{openModal:v}=ie(),C=`perma-delete-${e}`,y=v8(()=>{se.error(h("error:deletingTitle",{title:g}))},[h,g]),x=v8(async()=>{try{let w=b8({apiRoute:c,path:`/${n}${y8.stringify({trash:!0,where:{and:[{id:{equals:e}},{deletedAt:{exists:!0}}]}},{addQueryPrefix:!0})}`}),S=await We.delete(w,{headers:{"Accept-Language":p.language,"Content-Type":"application/json"}}),_=await S.json();if(S.status<400){if(se.success(h("general:titleDeleted",{label:g8(i,p),title:g})||_.message),s)return b(()=>m.push(b8({adminRoute:l,path:`/collections/${n}/trash`,serverURL:u})));typeof r=="function"&&await r({id:e,collectionConfig:f});return}_.errors?_.errors.forEach(I=>se.error(I.message)):y()}catch{y()}},[u,c,n,e,h,i,y,p,g,m,l,s,r,f,b]);return e?cie(uie,{children:[Ib(Z,{buttonStyle:"secondary",id:o,onClick:()=>{v(C)},children:h("general:permanentlyDelete")}),Ib(nt,{body:Ib(Ro,{elements:{1:({children:w})=>Ib("strong",{children:w})},i18nKey:"general:aboutToPermanentlyDelete",t:h,variables:{label:g8(i,p),title:a||g||e}}),confirmingLabel:h("general:deleting"),heading:h("general:confirmDeletion"),modalSlug:C,onConfirm:x})]}):null};import{c as die}from"react/compiler-runtime";import{jsx as ow,jsxs as mie}from"react/jsx-runtime";import{useState as x8}from"react";function rw(t){let e=die(9),{previewURL:o}=Sb(),{t:n}=N(),[r,s]=x8(!1),[i,a]=x8(!1),l;e[0]!==o?(l=async()=>{o&&(await navigator.clipboard.writeText(o),s(!0))},e[0]=o,e[1]=l):l=e[1];let c=l;if(!o)return null;let u;if(e[2]!==r||e[3]!==c||e[4]!==i||e[5]!==n){let d=n(r?"general:copied":"general:copy"),f,m;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{a(!0),s(!1)},m=()=>{a(!1),s(!1)},e[7]=f,e[8]=m):(f=e[7],m=e[8]),u=mie("span",{onPointerEnter:f,onPointerLeave:m,style:{position:"relative"},children:[ow(Z,{buttonStyle:"ghost",icon:ow(em,{size:24}),id:"preview-button",onClick:c}),ow(io,{delay:0,show:i||r,children:d})]}),e[2]=r,e[3]=c,e[4]=i,e[5]=n,e[6]=u}else u=e[6];return u}import{jsx as dc,jsxs as fie}from"react/jsx-runtime";import{getTranslation as pie}from"@payloadcms/translations";import{formatAdminURL as Rb,hasAutosaveEnabled as hie,hasLocalizeStatusEnabled as gie}from"payload/shared";import*as Db from"qs-esm";import Tb,{useCallback as nw,useEffect as bie,useState as vie}from"react";function sw({label:t}={}){let{id:e,collectionSlug:o,globalSlug:n,hasPublishedDoc:r,hasPublishPermission:s,setHasPublishedDoc:i,setMostRecentVersionIsAutosaved:a,setUnpublishedVersionCount:l,unpublishedVersionCount:c,uploadStatus:u}=be(),{config:d,getEntityConfig:f}=G(),{submit:m}=Ge(),p=Kt(),h=vt(),{code:g}=Ce(),{localization:b,routes:{api:v}}=d,{i18n:C,t:y}=N(),x=t||y("version:publishChanges"),w=t||y("version:publish"),S=Tb.useMemo(()=>{if(o)return f({collectionSlug:o});if(n)return f({globalSlug:n})},[o,n,f]),_=c>0,I=s&&(p||_||!r)&&u!=="uploading",[A,D]=vie(!1);bie(()=>{let O=cc(S?.fields);D(O)},[S?.fields]);let T=b&&A&&s,P=qr()==="update"&&!p,E=hie(S),F=nw(async()=>{if(P)return;let O=Db.stringify({depth:0,draft:!0,"fallback-locale":"null",locale:g},{addQueryPrefix:!0}),V,H="POST";o&&(V=Rb({apiRoute:v,path:`/${o}${e?`/${e}`:""}${O}`}),e&&(H="PATCH")),n&&(V=Rb({apiRoute:v,path:`/globals/${n}${O}`})),await m({action:V,method:H,overrides:{_status:"draft"},skipValidation:!0})},[P,g,o,n,m,v,e]);Ai({cmdCtrlKey:!0,editDepth:h,keyCodes:["s"]},O=>{O.preventDefault(),O.stopPropagation(),F&&E&&F()});let L=gie(S),M=nw(async()=>{if(u==="uploading")return;let O=Db.stringify({depth:0,locale:g,...L&&{publishAllLocales:!0}},{addQueryPrefix:!0}),V=Rb({apiRoute:v,path:`${n?`/globals/${n}`:`/${o}${e?`/${e}`:""}`}${O}`});await m({action:V,overrides:{_status:"published"}})&&(l(0),a(!1),i(!0))},[g,L,v,o,n,e,i,m,l,u,a]),$=nw(async O=>{if(u==="uploading")return;let V=Db.stringify({depth:0,locale:O},{addQueryPrefix:!0}),H=n?`/globals/${n}`:`/${o}${e?`/${e}`:""}`,z=Rb({apiRoute:v,path:`${H}${V}`});await m({action:z,overrides:{_status:"published"}})&&(l(0),a(!1),i(!0))},[v,o,n,e,i,a,l,m,u]),B=!T||b&&b?.defaultLocalePublishOption!=="active",j=b&&b?.locales.find(O=>typeof O=="string"?O===g:O.code===g),k=j&&pie(j.label,C);return s?dc(Tb.Fragment,{children:dc(qt,{buttonId:"action-save",disabled:!I,onClick:B?M:()=>$(j.code),size:"medium",SubMenuPopupContent:T?({close:O})=>dc(Tb.Fragment,{children:T&&dc(ue.ButtonGroup,{children:dc(ue.Button,{id:"publish-locale",onClick:B?()=>$(j.code):M,children:B?y("version:publishIn",{locale:k}):y("version:publishAllLocales")})})}):void 0,type:"button",children:B?fie(Tb.Fragment,{children:[dc("span",{className:"publish-button__label--full",children:x}),dc("span",{className:"publish-button__label--short",children:w})]}):y("version:publishIn",{locale:k})})}):null}import{jsx as Ap,jsxs as w8}from"react/jsx-runtime";import{getTranslation as S8}from"@payloadcms/translations";import{formatAdminURL as _8}from"payload/shared";import*as T8 from"qs-esm";import{Fragment as I8,useCallback as R8,useState as yie}from"react";var D8=t=>{let{id:e,buttonId:o,collectionSlug:n,onRestore:r,redirectAfterRestore:s=!0,singularLabel:i,title:a}=t,{config:{routes:{admin:l,api:c},serverURL:u},getEntityConfig:d}=G(),f=d({collectionSlug:n}),m=Re(),{i18n:p,t:h}=N(),{title:g}=zo(),{startRouteTransition:b}=Ue(),{openModal:v}=ie(),C=`restore-${e}`,[y,x]=yie(!1),w=R8(()=>{se.error(h("error:restoringTitle",{title:g}))},[h,g]),S=R8(async()=>{try{let _=_8({apiRoute:c,path:`/${n}${T8.stringify({trash:!0,where:{and:[{id:{equals:e}},{deletedAt:{exists:!0}}]}},{addQueryPrefix:!0})}`}),I={deletedAt:null};f?.versions?.drafts&&(I._status=y?"published":"draft");let A=await We.patch(_,{body:JSON.stringify(I),headers:{"Accept-Language":p.language,"Content-Type":"application/json"}}),D=await A.json();if(A.status<400){if(se.success(h("general:titleRestored",{label:S8(i,p),title:g})||D.message),s)return b(()=>m.push(_8({adminRoute:l,path:`/collections/${n}/${e}`,serverURL:u})));typeof r=="function"&&await r({id:e,collectionConfig:f});return}D.errors?D.errors.forEach(T=>se.error(T.message)):w()}catch{w()}},[u,c,n,e,h,i,w,p,g,m,l,s,r,f,b,y]);return e?w8(I8,{children:[Ap(Z,{buttonStyle:"primary",id:o,onClick:()=>{v(C)},children:h("general:restore")},o),Ap(nt,{body:w8(I8,{children:[Ap(Ro,{elements:{1:({children:_})=>Ap("strong",{children:_})},i18nKey:f?.versions?.drafts?"general:aboutToRestoreAsDraft":"general:aboutToRestore",t:h,variables:{label:S8(i,p),title:a||g||e}}),f?.versions?.drafts&&Ap(Ft,{checked:y,id:"restore-as-published",label:h("general:restoreAsPublished"),name:"restore-as-published",onToggle:_=>x(_.target.checked)})]}),confirmingLabel:h("general:restoring"),heading:h("general:confirmRestoration"),modalSlug:C,onConfirm:S})]}):null};import{jsx as Cie}from"react/jsx-runtime";import{useRef as xie}from"react";function iw({label:t}){let{uploadStatus:e}=be(),{t:o}=N(),{submit:n}=Ge(),r=Kt(),s=t||o("general:save"),i=xie(null),a=vt(),c=qr()==="update"&&!r||e==="uploading";return Ai({cmdCtrlKey:!0,editDepth:a,keyCodes:["s"]},d=>{d.preventDefault(),d.stopPropagation(),i?.current&&i.current.click()}),Cie(qt,{buttonId:"action-save",disabled:c,onClick:()=>{e!=="uploading"&&n()},ref:i,size:"medium",type:"button",children:s})}import{jsx as wie}from"react/jsx-runtime";import{formatAdminURL as A8}from"payload/shared";import{useCallback as Sie,useRef as _ie}from"react";var Iie="save-draft";function aw(t){let{config:{routes:{api:e}}}=G(),{id:o,collectionSlug:n,globalSlug:r,setUnpublishedVersionCount:s,uploadStatus:i}=be(),a=Kt(),{code:l}=Ce(),c=_ie(null),u=vt(),{t:d}=N(),{submit:f}=Ge(),p=qr()==="update"&&!a||i==="uploading",h=Sie(async()=>{if(p)return;let g=`?locale=${l}&depth=0&fallback-locale=null&draft=true`,b,v="POST";n&&(b=A8({apiRoute:e,path:`/${n}${o?`/${o}`:""}${g}`}),o&&(v="PATCH")),r&&(b=A8({apiRoute:e,path:`/globals/${r}${g}`})),await f({action:b,method:v,overrides:{_status:"draft"},skipValidation:!0}),s(C=>C+1)},[f,n,r,e,l,o,p,s]);return Ai({cmdCtrlKey:!0,editDepth:u,keyCodes:["s"]},g=>{g.preventDefault(),g.stopPropagation(),c?.current&&c.current.click()}),wie(qt,{buttonId:"action-save-draft",buttonStyle:"secondary",className:Iie,disabled:p,onClick:()=>{h()},ref:c,size:"medium",type:"button",children:d("version:saveDraft")})}import{jsx as Ab,jsxs as O8}from"react/jsx-runtime";import{hasAutosaveEnabled as Lie,hasScheduledPublishEnabled as $ie}from"payload/shared";import jie,{useMemo as kie,useState as Mie}from"react";import{jsx as mc,jsxs as Rie}from"react/jsx-runtime";import Tie from"react";var P8="M12 5C15.866 5 19 8.13401 19 12C19 15.866 15.866 19 12 19C8.13401 19 5 15.866 5 12C5 8.13401 8.13401 5 12 5ZM12 6C8.68629 6 6 8.68629 6 12C6 15.3137 8.68629 18 12 18C15.3137 18 18 15.3137 18 12C18 8.68629 15.3137 6 12 6ZM12 8C12.2761 8 12.5 8.22386 12.5 8.5V11.793L14.3535 13.6465C14.5488 13.8417 14.5488 14.1583 14.3535 14.3535C14.1583 14.5488 13.8417 14.5488 13.6465 14.3535L11.6465 12.3535C11.5527 12.2597 11.5 12.1326 11.5 12V8.5C11.5 8.22386 11.7239 8 12 8Z",Die="M24 24H0V0H24V24ZM18 3.5C16.067 3.5 14.5 5.067 14.5 7C14.5 8.933 16.067 10.5 18 10.5C19.933 10.5 21.5 8.933 21.5 7C21.5 5.067 19.933 3.5 18 3.5Z",F8=({active:t=!1,className:e,size:o=24})=>mc("svg",{className:["icon","icon--schedule",e].filter(Boolean).join(" "),fill:"none",height:o,viewBox:`0 0 ${o} ${o}`,width:o,xmlns:"http://www.w3.org/2000/svg",children:t?Rie(Tie.Fragment,{children:[mc("circle",{cx:"18",cy:"7",fill:"var(--color-icon-danger)",r:"2"}),mc("mask",{height:o,id:"schedule-mask",maskUnits:"userSpaceOnUse",style:{maskType:"alpha"},width:o,x:"0",y:"0",children:mc("path",{d:Die,fill:"currentColor"})}),mc("g",{mask:"url(#schedule-mask)",children:mc("path",{clipRule:"evenodd",d:P8,fill:"currentColor",fillRule:"evenodd"})})]}):mc("path",{clipRule:"evenodd",d:P8,fill:"currentColor",fillRule:"evenodd"})});import{jsx as ar,jsxs as Ga}from"react/jsx-runtime";import{getTranslation as Fie}from"@payloadcms/translations";import{formatAdminURL as Nie}from"payload/shared";import*as M8 from"qs-esm";import zr,{useCallback as Eie,useMemo as j8}from"react";import{jsx as fc,jsxs as N8}from"react/jsx-runtime";import"react";var E8="table",Pp=({appearance:t,BeforeTable:e,columns:o,data:n})=>{let r=o?.filter(s=>s?.active);return!r||r.length===0?fc("div",{children:"No columns selected"}):N8("div",{className:[E8,t&&`${E8}--appearance-${t}`].filter(Boolean).join(" "),children:[e,N8("table",{cellPadding:"0",cellSpacing:"0",children:[fc("thead",{children:fc("tr",{children:r.map((s,i)=>fc("th",{id:`heading-${s.accessor.replace(/\./g,"__")}`,children:s.Heading},i))})}),fc("tbody",{children:n&&n?.map((s,i)=>fc("tr",{className:`row-${i+1}`,"data-id":s.id,children:r.map((a,l)=>{let{accessor:c}=a;return fc("td",{className:[`cell-${c.replace(/\./g,"__")}`,a.isLinkedColumn&&"cell--linked"].filter(Boolean).join(" "),children:a.renderedCells[i]},l)})},typeof s.id=="string"||typeof s.id=="number"?String(s.id):i))})]})]})};import{jsx as Ns,jsxs as Aie}from"react/jsx-runtime";import{getTranslation as Pie}from"@payloadcms/translations";import"react";var L8=({dateFormat:t,deleteHandler:e,docs:o,i18n:n,localization:r,supportedTimezones:s,t:i})=>{let a=[{accessor:"input.type",active:!0,field:{name:"",type:"text"},Heading:Ns("span",{children:i("version:type")}),renderedCells:o.map(l=>{let c=l.input?.type;return Aie(vr,{pillStyle:c==="publish"?"success":"warning",size:"small",children:[c==="publish"&&i("version:publish"),c==="unpublish"&&i("version:unpublish")]},l.id)})},{accessor:"waitUntil",active:!0,field:{name:"",type:"date"},Heading:Ns("span",{children:i("general:time")}),renderedCells:o.map(l=>Ns("span",{children:lo({date:l.waitUntil,i18n:n,pattern:t,timezone:l.input.timezone})},l.id))},{accessor:"input.timezone",active:!0,field:{name:"",type:"text"},Heading:Ns("span",{children:i("general:timezone")}),renderedCells:o.map(l=>{let u=s.find(d=>d.value===l.input.timezone)?.label||l.input.timezone;return Ns("span",{children:u||i("general:noValue")},l.id)})}];return r&&a.push({accessor:"input.locale",active:!0,field:{name:"",type:"text"},Heading:Ns("span",{children:i("general:locale")}),renderedCells:o.map(l=>{if(l.input.locale){let c=r.locales.find(u=>u.code===l.input.locale);if(c)return Ns("span",{children:Pie(c.label,n)},l.id)}return Ns("span",{children:i("general:all")},l.id)})}),a.push({accessor:"delete",active:!0,field:{name:"delete",type:"text"},Heading:Ns("span",{children:i("general:delete")}),renderedCells:o.map(l=>Ns(Z,{buttonStyle:"ghost",className:"schedule-publish__delete",icon:"x",onClick:c=>{c.preventDefault(),e(l.id)},tooltip:i("general:delete")},l.id))}),a};var $8=({id:t,collectionSlug:e,globalSlug:o})=>{let n={and:[{taskSlug:{equals:"schedulePublish"}},{waitUntil:{greater_than:new Date}}]};return e&&(n.and.push({"input.doc.value":{equals:String(t)}}),n.and.push({"input.doc.relationTo":{equals:e}})),o&&n.and.push({"input.global":{equals:o}}),n};var Wa="schedule-publish",k8={label:"All",value:"all"},B8=({slug:t,defaultType:e,onUpcomingChange:o,schedulePublishConfig:n})=>{let{config:{admin:{dateFormat:r,timezones:{defaultTimezone:s,supportedTimezones:i}},localization:a,routes:{api:l}}}=G(),{id:c,collectionSlug:u,globalSlug:d}=be(),{title:f}=zo(),{i18n:m,t:p}=N(),{schedulePublish:h}=ct(),[g,b]=zr.useState(e||"publish"),[v,C]=zr.useState(),[y,x]=zr.useState(s),[w,S]=zr.useState(k8),[_,I]=zr.useState(!1),A=p("general:schedulePublishFor",{title:f}),[D,T]=zr.useState(),[R,P]=zr.useState(),E=zr.useRef(()=>null),F=Intl.DateTimeFormat().resolvedOptions().timeZone,L=zr.useMemo(()=>{if(a){let V=a.locales.map(({code:H,label:z})=>({label:Fie(z,m),value:H}));return V.unshift(k8),V}return[]},[a,m]),M=zr.useCallback(async()=>{let V={sort:"waitUntil",where:$8({id:c,collectionSlug:u,globalSlug:d})},{docs:H}=await We.post(Nie({apiRoute:l,path:"/payload-jobs"}),{body:M8.stringify(V),headers:{"Accept-Language":m.language,"Content-Type":"application/x-www-form-urlencoded","X-Payload-HTTP-Method-Override":"GET"}}).then(z=>z.json());P(L8({dateFormat:r,deleteHandler:E.current,docs:H,i18n:m,localization:a,supportedTimezones:i,t:p})),T(H),o?.(H.length>0)},[u,d,l,m,r,a,i,p,c,o]),$=zr.useCallback(async V=>{try{await h({deleteID:V}),await M(),se.success(p("general:deletedSuccessfully"))}catch(H){console.error(H),se.error(H.message)}},[M,h,p]);zr.useEffect(()=>{E.current=$},[$]);let B=zr.useCallback(async()=>{if(!v)return se.error(p("general:noDateSelected"));I(!0);let V;typeof w=="object"&&w.value!=="all"&&g==="publish"&&(V=w.value);try{await h({type:g,date:v,doc:u?{relationTo:u,value:String(c)}:void 0,global:d||void 0,localeToPublish:V,timezone:y}),C(void 0),se.success(p("version:scheduledSuccessfully")),M()}catch(H){console.error(H),se.error(H.message)}I(!1)},[v,w,g,p,h,u,c,d,y,M]),j=j8(()=>{if(y&&F&&v){let V=ao.tz(y),H=ao.tz(F),z=new ao(v).withTimeZone(y),W=$n(z,V);return $n(W,H).toISOString()}return v},[y,v,F]),k=Eie(V=>{if(y&&V){let H=ao.tz(y),z=new ao(V),W=$n(z,H);C(W||null)}else C(V||null)},[C,y]);zr.useEffect(()=>{D||(async()=>await M())()},[D,M]);let O=j8(()=>v&&_I(v)?new Date:la(new Date),[v]);return Ga(It,{className:Wa,slug:t,title:A,children:[Ga(Is,{className:`${Wa}__scheduler`,children:[Ga("div",{className:`${Wa}__section`,children:[ar(Fe,{label:p("version:type"),required:!0}),Ga("ul",{className:`${Wa}__type`,children:[ar("li",{children:ar(df,{id:`${t}-type`,isSelected:g==="publish",onChange:()=>b("publish"),option:{label:p("version:publish"),value:"publish"},path:`${t}-type`,readOnly:_})}),ar("li",{children:ar(df,{id:`${t}-type`,isSelected:g==="unpublish",onChange:()=>b("unpublish"),option:{label:p("version:unpublish"),value:"unpublish"},path:`${t}-type`,readOnly:_})})]})]}),Ga("div",{className:`${Wa}__section`,children:[ar(Fe,{label:p("general:time"),path:"time",required:!0}),ar(su,{id:"time",maxTime:cI(),minDate:new Date,minTime:O,onChange:V=>k(V),pickerAppearance:"dayAndTime",readOnly:_,timeFormat:n?.timeFormat,timeIntervals:n?.timeIntervals??5,value:j}),i.length>0&&ar(zm,{id:"timezone-picker",onChange:x,options:i,selectedTimezone:y})]}),L.length>0&&g==="publish"&&Ga("div",{className:`${Wa}__section`,children:[ar(Fe,{label:p("localization:localeToPublish")}),ar(mt,{onChange:V=>S(V),options:L,value:w})]}),Ga("div",{className:`${Wa}__actions`,children:[ar(Z,{buttonStyle:"primary",disabled:_,id:"scheduled-publish-save",onClick:B,type:"button",children:p("general:save")}),_?ar("span",{children:p("general:saving")}):null]})]}),Ga(Is,{className:`${Wa}__upcoming`,children:[ar("h4",{children:p("general:upcomingEvents")}),!D&&ar(Ct,{}),D?.length===0&&ar(Xr,{children:p("general:noUpcomingEventsScheduled")}),D?.length>0&&ar(Pp,{appearance:"condensed",columns:R,data:D})]})]})};var V8=({disabled:t})=>{let{id:e,collectionSlug:o,globalSlug:n,hasPublishPermission:r,hasScheduledPublish:s,setHasScheduledPublish:i,unpublishedVersionCount:a}=be(),{getEntityConfig:l}=G(),{isModalOpen:c,toggleModal:u}=ie(),{t:d}=N(),f=Kt(),[m,p]=Mie(!1),h=kie(()=>{if(o)return l({collectionSlug:o});if(n)return l({globalSlug:n})},[o,n,l]),g=$ie(h),b=Lie(h),v=!!(g&&r&&(n||o&&e)&&(b||!f)),C=`schedule-publish-${e}`,y=a>0;if(!v)return null;let x=d("version:schedulePublish");return O8(jie.Fragment,{children:[O8("span",{onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1),style:{position:"relative"},children:[Ab(Z,{buttonStyle:"ghost",disabled:t,icon:Ab(F8,{active:s}),id:"schedule-publish-button",onClick:()=>u(C)}),Ab(io,{delay:0,show:m,children:x})]}),c(C)&&Ab(B8,{defaultType:y?"publish":"unpublish",onUpcomingChange:i,schedulePublishConfig:g&&typeof h.versions.drafts.schedulePublish=="object"?h.versions.drafts.schedulePublish:void 0,slug:C})]})};import{jsx as Pb,jsxs as H8}from"react/jsx-runtime";import{formatAdminURL as z8}from"payload/shared";import Bie,{useCallback as Oie}from"react";var Fb="status",Nb=()=>{let{id:t,collectionSlug:e,docPermissions:o,globalSlug:n,hasPublishedDoc:r,incrementVersionCount:s,isTrashed:i,setMostRecentVersionIsAutosaved:a,setUnpublishedVersionCount:l,unpublishedVersionCount:c}=be(),{toggleModal:u}=ie(),{config:{routes:{api:d}}}=G(),{reset:f}=Ge(),{code:m}=Ce(),{i18n:p,t:h}=N(),g=`confirm-revert-${t}`,b;c>0&&r?b="changed":r?r&&c<=0&&(b="published"):b="draft";let v=i?r?"previouslyPublished":"previouslyDraft":b,C=Oie(async()=>{let x,w;e&&(x=z8({apiRoute:d,path:`/${e}/${t}?locale=${m}&fallback-locale=null&depth=0`}),w="patch"),n&&(x=z8({apiRoute:d,path:`/globals/${n}?locale=${m}&fallback-locale=null&depth=0`}),w="post");let _=await We.get(x,{headers:{"Accept-Language":p.language,"Content-Type":"application/json"}}).then(A=>A.json()),I=await We[w](x,{body:JSON.stringify(_),headers:{"Accept-Language":p.language,"Content-Type":"application/json"}});if(I.status===200){let A,D=await I.json();n?A=D.result:e&&(A=D.doc),f(A),se.success(D.message),s(),a(!1),l(0)}else try{let A=await I.json();A.errors?.[0]?.message?se.error(A.errors[0].message):A.error?se.error(A.error):se.error(h("error:revertingDocument"))}catch{se.error(h("error:revertingDocument"))}},[d,e,n,t,p.language,s,m,f,l,a,h]),y=o?.update;return b?Pb("div",{className:Fb,title:`${h("version:status")}: ${h(`version:${v}`)}`,children:H8("div",{className:`${Fb}__value-wrap`,children:[Pb("span",{className:`${Fb}__value`,children:h(`version:${v}`)}),!i&&y&&r&&b==="changed"&&H8(Bie.Fragment,{children:["\xA0\u2014\xA0",Pb(Z,{buttonStyle:"ghost",className:`${Fb}__action`,id:"action-revert-to-published",onClick:()=>u(g),children:h("version:revertToPublished")}),Pb(nt,{body:h("version:aboutToRevertToPublished"),confirmingLabel:h("version:reverting"),heading:h("version:confirmRevertToSaved"),modalSlug:g,onConfirm:()=>C()})]})]})}):null};import{jsx as lw,jsxs as Vie}from"react/jsx-runtime";import{getTranslation as Hie}from"@payloadcms/translations";import{formatAdminURL as G8,hasLocalizeStatusEnabled as zie}from"payload/shared";import*as W8 from"qs-esm";import Eb,{useCallback as Gie,useState as Wie}from"react";function cw({label:t}={}){let{id:e,collectionSlug:o,data:n,globalSlug:r,hasPublishedDoc:s,hasPublishPermission:i,incrementVersionCount:a,isTrashed:l,setHasPublishedDoc:c,setMostRecentVersionIsAutosaved:u,setUnpublishedVersionCount:d}=be(),{toggleModal:f}=ie(),{config:m,getEntityConfig:p}=G(),{reset:h}=Ge(),{code:g,label:b}=Ce(),[v,C]=Wie(!1),y=`confirm-un-publish-${e}`,{routes:{api:x},serverURL:w}=m,{i18n:S,t:_}=N(),I=Eb.useMemo(()=>{if(o)return p({collectionSlug:o});if(r)return p({globalSlug:r})},[o,r,p]),A=Gie(F=>{(async()=>{let L,M,$=W8.stringify({depth:0,"fallback-locale":"null",locale:F?void 0:g,unpublishAllLocales:F},{addQueryPrefix:!0});o&&(L=G8({apiRoute:x,path:`/${o}/${e}${$}`,serverURL:w}),M="patch"),r&&(L=G8({apiRoute:x,path:`/globals/${r}${$}`,serverURL:w}),M="post");try{let B=await We[M](L,{body:JSON.stringify({_status:"draft"}),headers:{"Accept-Language":S.language,"Content-Type":"application/json"}});if(B.status===200)h({...n||{},_status:"draft"}),se.success(_("version:unpublishedSuccessfully")),F||a(),d(1),u(!1),c(!1);else try{let j=await B.json();j.errors?.[0]?.message?se.error(j.errors[0].message):j.error?se.error(j.error):se.error(_("error:unPublishingDocument"))}catch{se.error(_("error:unPublishingDocument"))}}catch{se.error(_("error:unPublishingDocument"))}})().catch(()=>{se.error(_("error:unPublishingDocument"))})},[n,h,o,r,w,x,g,e,S.language,a,c,u,d,_]),D=I?.versions?.drafts,T=typeof D=="object"&&D!==null,R=Eb.useMemo(()=>T&&i&&s&&!l,[i,s,l,T]),P=Eb.useMemo(()=>R?!!(I&&zie(I)):!1,[R,I]),E=Hie(b,S);return R?Vie(Eb.Fragment,{children:[lw(ue.Button,{id:"action-unpublish",onClick:()=>{C(!0),f(y)},children:t||_("version:unpublish")}),P&&lw(ue.Button,{id:"action-unpublish-locale",onClick:()=>{C(!1),f(y)},children:t?`${t} [${E}]`:_("version:unpublishIn",{locale:E})}),lw(nt,{body:v?_("version:aboutToUnpublish"):_("version:aboutToUnpublishIn",{locale:E}),confirmingLabel:_("version:unpublishing"),heading:_("version:confirmUnpublish"),modalSlug:y,onConfirm:()=>A(v)})]}):null}var To="doc-controls",$b=t=>{let{id:e,slug:o,BeforeDocumentControls:n,BeforeDocumentMeta:r,customComponents:{PreviewButton:s,PublishButton:i,SaveButton:a,SaveDraftButton:l,Status:c,UnpublishButton:u}={},data:d,disableActions:f,disableCreate:m,EditMenuItems:p,hasSavePermission:h,isAccountView:g,isEditing:b,isInDrawer:v,isTrashed:C,onDelete:y,onDrawerCreateNew:x,onDuplicate:w,onRestore:S,onTakeOver:_,permissions:I,readOnlyForIncomingUser:A,redirectAfterDelete:D,redirectAfterDuplicate:T,redirectAfterRestore:R,user:P,variant:E="default"}=t,{i18n:F,t:L}=N(),M=vt(),{config:$,getEntityConfig:B}=G(),j=B({collectionSlug:o}),k=B({globalSlug:o}),{isLivePreviewEnabled:O}=Zo(),{hasDeletePermission:V,hasTrashPermission:H}=be(),{admin:{dateFormat:z},localization:W,routes:{admin:U}}=$,[X,Q]=uw.useState(""),[J,oe]=uw.useState(""),[Y,K]=Qie(""),ee=mn(),te=Xs(),re=qie(F);re.current=F;let me=Jie(()=>{let Se=d?.updatedAt||d?.createdAt;Se&&K(ca({date:Se,i18n:re.current}))},[d?.updatedAt,d?.createdAt]);Z8(()=>{d?.updatedAt&&Q(lo({date:d.updatedAt,i18n:F,pattern:z})),d?.createdAt&&oe(lo({date:d.createdAt,i18n:F,pattern:z})),me()},[d,F,z,me]),Z8(()=>{let Se=setInterval(me,6e4);return()=>clearInterval(Se)},[me]);let we=I&&"create"in I&&I.create,Ae=I&&"delete"in I&&I.delete,de=j?.trash?H||V:Ae,xe=!e&&j?.versions?.drafts&&j.versions?.drafts.validate,$e=X8(k),Le=X8(j),rt=!!(!f&&(p||j&&e&&(we||de)||k&&($e||W))),q=U8(j),pe=U8(k),fe=q||pe,Pe=q&&j.versions.drafts.autosave!==!1&&j.versions.drafts.autosave.showSaveDraftButton===!0||pe&&k.versions.drafts.autosave!==!1&&k.versions.drafts.autosave.showSaveDraftButton===!0,ge=W&&!j?.admin?.disableCopyToLocale,ae=P&&A;return Rn("div",{className:[To,E!=="default"&&`${To}--${E}`].filter(Boolean).join(" "),children:[E==="default"&&Rn("div",{className:`${To}__content`,children:[!!(ae||r)&&Rn("div",{className:`${To}__before-meta`,children:[ae&&ft(Li,{className:`${To}__locked-controls`,user:P}),r]}),Rn("ul",{className:`${To}__meta`,children:[j&&!b&&!g&&ft("li",{className:`${To}__list-item`,children:ft("p",{className:`${To}__creating-new`,children:F.t("general:creatingNewLabel",{label:Xie(j?.labels?.singular??F.t("general:document"),F)})})}),(Le||$e)&&Rn(Lb,{children:[(k||j&&b)&&ft("li",{className:`${To}__status ${To}__list-item`,children:ft(le,{CustomComponent:c,Fallback:ft(Nb,{})})}),h&&fe&&!xe&&!C&&ft("li",{className:`${To}__list-item`,children:ft(_b,{collection:j,global:k,id:e,publishedDocUpdatedAt:d?.createdAt})})]}),j?.timestamps&&(b||g)&&(d?.updatedAt||d?.createdAt)&&ft("li",{className:`${To}__list-item ${To}__value-wrap`,title:X||J||void 0,children:ft("p",{className:`${To}__value`,children:Y?L(C?"general:deletedAgo":"general:updatedAgo",{distance:Y}):`${L("general:loading")}...`})})]})]}),Rn("div",{className:`${To}__controls-wrapper`,children:[Rn("div",{className:`${To}__controls`,children:[n,Rn("div",{className:`${To}__icon-buttons`,children:[O&&!v&&ft(m8,{}),(j?.admin.preview||k?.admin.preview)&&ft(le,{CustomComponent:s,Fallback:ft(rw,{})}),Yie(j||k)&&!C&&ft(V8,{disabled:A})]}),h&&!C&&!A&&ft(Lb,{children:Le||$e?Rn(Lb,{children:[(xe||!fe||fe&&Pe)&&ft(le,{CustomComponent:l,Fallback:ft(aw,{})}),ft(le,{CustomComponent:i,Fallback:ft(sw,{})})]}):ft(le,{CustomComponent:a,Fallback:ft(iw,{})})}),V&&C&&ft(C8,{buttonId:"action-permanently-delete",collectionSlug:j?.slug,id:e.toString(),onDelete:y,redirectAfterDelete:D,singularLabel:j?.labels?.singular}),h&&C&&ft(D8,{buttonId:"action-restore",collectionSlug:j?.slug,id:e.toString(),onRestore:S,redirectAfterRestore:R,singularLabel:j?.labels?.singular}),P&&A&&ft(Z,{buttonStyle:"secondary",id:"take-over",onClick:_,size:"medium",type:"button",children:L("general:takeOver")})]}),rt&&!A&&ft(Ve,{buttonClassName:`${To}__popup-button`,caret:!1,className:`${To}__popup`,disabled:te||ee,horizontalAlign:"right",renderButton:({active:Se,...ne})=>ft(Z,{...ne,buttonStyle:"ghost",className:`${To}__popup-button`,icon:ft(il,{}),selected:Se,size:"medium"}),size:"medium",verticalAlign:"bottom",children:Rn(ue.ButtonGroup,{children:[ge&&ft(X5,{}),we&&Rn(uw.Fragment,{children:[!m&&ft(Lb,{children:M>1?ft(ue.Button,{id:"action-create",onClick:x,children:F.t("general:createNew")}):ft(ue.Button,{href:Zie({adminRoute:U,path:`/collections/${j?.slug}/create`}),id:"action-create",children:F.t("general:createNew")})}),j.disableDuplicate!==!0&&b&&Rn(Uie,{children:[ft(tw,{id:e,onDuplicate:w,redirectAfterDuplicate:T,singularLabel:j?.labels?.singular,slug:j?.slug}),W&&ft(tw,{id:e,onDuplicate:w,redirectAfterDuplicate:T,selectLocales:!0,singularLabel:j?.labels?.singular,slug:j?.slug})]})]}),de&&e&&ft(o8,{buttonId:"action-delete",collectionSlug:j?.slug,id:e.toString(),onDelete:y,redirectAfterDelete:D,singularLabel:j?.labels?.singular,useAsTitle:j?.admin?.useAsTitle}),ft(le,{CustomComponent:u,Fallback:ft(cw,{})}),p]})})]})]})};import{jsx as Q8}from"react/jsx-runtime";import"react";var Y8=/^<(?<name>[^\s/>]+)[^>]*>$/,J8=/^<(?<isEnd>\/)?(?<name>[^\s>]+)[^>]*>$/,dw=/^<[^>]+>/,Kie=/^<img[^>]*>$/,q8=/^<video[^>]*>.*?<\/video>$/ms,jb=class{config;leastCommonLength=1/0;matchedBlockList=[];newTokens=[];oldTokens=[];operationList=[];sideBySideContents;unifiedContent;constructor(e,o,{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:r=1e3,greedyMatch:s=!0,minMatchedSize:i=2,tokenizeByCharacter:a=!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:r,greedyMatch:s,minMatchedSize:i},e=e.trim(),o=o.trim(),e===o){this.unifiedContent=e;let c=0,u=e.replace(/<([^\s/>]+)[^>]*>/g,(d,f)=>{let m=f.length+1;return`${d.slice(0,m)} data-seq="${++c}"${d.slice(m)}`});this.sideBySideContents=[u,u];return}let l=a?this.tokenizeByCharacter:this.tokenizeByWord;this.oldTokens=l(e),this.newTokens=l(o),this.matchedBlockList=this.getMatchedBlockList(),this.operationList=this.getOperationList()}computeBestMatchedBlock(e,o,n,r){let s=null;for(let i=e;i<o;i++){let a=Math.min(o-i,r-n),l=this.slideBestMatchedBlock(i,n,a);if(l&&(!s||l.size>s.size)&&(s=l,l.size>this.leastCommonLength))return s}for(let i=n;i<r;i++){let a=Math.min(o-e,r-i),l=this.slideBestMatchedBlock(e,i,a);if(l&&(!s||l.size>s.size)&&(s=l,l.size>this.leastCommonLength))return s}return s}computeMatchedBlockList(e,o,n,r,s=[]){let i=this.computeBestMatchedBlock(e,o,n,r);return i?(e<i.oldStart&&n<i.newStart&&this.computeMatchedBlockList(e,i.oldStart,n,i.newStart,s),s.push(i),o>i.oldEnd&&r>i.newEnd&&this.computeMatchedBlockList(i.oldEnd,o,i.newEnd,r,s),s):[]}dressUpBlockTag(e,o){return e==="create"?`<div class="${this.config.classNames.createBlock}">${o}</div>`:e==="delete"?`<div class="${this.config.classNames.deleteBlock}">${o}</div>`:""}dressUpDiffContent(e,o){let n=o.length;if(!n)return"";let r="",s=0,i=-1;for(let a of o){i++;let l=a.includes('data-enable-match="true"'),c=a.includes('data-enable-match="false"'),u=!!a.match(dw)?.length;if(c)s=i+1,r+=a;else if(!l&&u)i>s&&(r+=this.dressUpText(e,o.slice(s,i))),s=i+1,a.match(q8)?r+=this.dressUpBlockTag(e,a):r+=a;else if(l&&u){i>s&&(r+=this.dressUpText(e,o.slice(s,i))),s=i+1;let d=this.dressupMatchEnabledHtmlTag(e,a);r+=d}}return s<n&&(r+=this.dressUpText(e,o.slice(s))),r}dressUpInlineTag(e,o){return e==="create"?`<span class="${this.config.classNames.createInline}">${o}</span>`:e==="delete"?`<span class="${this.config.classNames.deleteInline}">${o}</span>`:""}dressupMatchEnabledHtmlTag(e,o){let n=o.match(Y8)?.groups?.name;if(!n)return o;let r=n.length+1,s=e==="create"?"create":"delete";return`${o.slice(0,r)} data-match-type="${s}"${o.slice(r,o.length)}`}dressUpText(e,o){let n=o.join("");return n.trim()?e==="create"?`<span data-match-type="create">${n}</span>`:e==="delete"?`<span data-match-type="delete">${n}</span>`:"":""}getMatchedBlockList(){let e=this.oldTokens.length,o=this.newTokens.length,n=null,r=0;for(;r<e&&r<o&&this.oldTokens[r]===this.newTokens[r];)r++;r>=this.config.minMatchedSize&&(n={newEnd:r,newStart:0,oldEnd:r,oldStart:0,size:r});let s=null,i=e-1,a=o-1;for(;r<=i&&r<=a&&this.oldTokens[i]===this.newTokens[a];)i--,a--;let l=e-1-i;l>=this.config.minMatchedSize&&(s={newEnd:o,newStart:a+1,oldEnd:e,oldStart:i+1,size:l});let c=n?r:0,u=s?i+1:e,d=n?r:0,f=s?a+1:o;if(this.config.greedyMatch){let p=Math.min(u-c,f-d);p>this.config.greedyBoundary&&(this.leastCommonLength=Math.floor(p/3))}let m=this.computeMatchedBlockList(c,u,d,f);return n&&m.unshift(n),s&&m.push(s),m}getOperationList(){let e=[],o=0,n=0;for(let c of this.matchedBlockList){let u=o===c.oldStart,d=n===c.newStart,f={newEnd:c.newStart,newStart:n,oldEnd:c.oldStart,oldStart:o};!u&&!d?e.push(Object.assign(f,{type:"replace"})):u&&!d?e.push(Object.assign(f,{type:"create"})):!u&&d&&e.push(Object.assign(f,{type:"delete"})),e.push({type:"equal",newEnd:c.newEnd,newStart:c.newStart,oldEnd:c.oldEnd,oldStart:c.oldStart}),o=c.oldEnd,n=c.newEnd}let r=this.oldTokens.length,s=this.newTokens.length,i={newEnd:s,newStart:n,oldEnd:r,oldStart:o},a=o===r,l=n===s;return!a&&!l?e.push(Object.assign(i,{type:"replace"})):a&&!l?e.push(Object.assign(i,{type:"create"})):!a&&l&&e.push(Object.assign(i,{type:"delete"})),e}slideBestMatchedBlock(e,o,n){let r=0,s=null,i=0;for(let a=0;a<n;a++)this.oldTokens[e+a]===this.newTokens[o+a]?i++:i=0,i>r&&(r=i,s={newEnd:o+a+1,newStart:o+a-i+1,oldEnd:e+a+1,oldStart:e+a-i+1,size:i});return r>=this.config.minMatchedSize?s:null}tokenizeByCharacter(e){let o=[],n=0,r=/<picture[^>]*>.*?<\/picture>|<video[^>]*>.*?<\/video>|<[^>]+>/gs,s;for(;(s=r.exec(e))!==null;){let a=e.substring(n,s.index);if(a)for(let l of a)o.push(l);o.push(s[0]),n=s.index+s[0].length}let i=e.substring(n);for(let a of i)o.push(a);return o}tokenizeByWord(e){return e.match(/<picture[^>]*>.*?<\/picture>|<video[^>]*>.*?<\/video>|<[^>]+>|\w+\b|\s+|[^<>\w]/gs)||[]}getSideBySideContents(){if(this.sideBySideContents!==void 0)return this.sideBySideContents;let e="",o="",n=0;this.operationList.forEach(s=>{switch(s.type){case"create":{o+=this.dressUpDiffContent("create",this.newTokens.slice(s.newStart,s.newEnd));break}case"delete":{let i=this.oldTokens.slice(s.oldStart,s.oldEnd);e+=this.dressUpDiffContent("delete",i);break}case"equal":{let i=this.newTokens.slice(s.newStart,s.newEnd),a="";for(let l of i){let c=l.match(Y8);if(c){n+=1;let u=(c?.groups?.name?.length??0)+1;a+=`${l.slice(0,u)} data-seq="${n}"${l.slice(u)}`}else a+=l}e+=a,o+=a;break}case"replace":{e+=this.dressUpDiffContent("delete",this.oldTokens.slice(s.oldStart,s.oldEnd)),o+=this.dressUpDiffContent("create",this.newTokens.slice(s.newStart,s.newEnd));break}default:console.error("Richtext diff error - invalid operation: "+String(s.type))}});let r=[e,o];return this.sideBySideContents=r,r}getUnifiedContent(){if(this.unifiedContent!==void 0)return this.unifiedContent;let e="";return this.operationList.forEach(o=>{switch(o.type){case"create":{e+=this.dressUpDiffContent("create",this.newTokens.slice(o.newStart,o.newEnd));break}case"delete":{e+=this.dressUpDiffContent("delete",this.oldTokens.slice(o.oldStart,o.oldEnd));break}case"equal":{for(let n of this.newTokens.slice(o.newStart,o.newEnd))e+=n;break}case"replace":{let n=this.oldTokens.slice(o.oldStart,o.oldEnd),r=this.newTokens.slice(o.newStart,o.newEnd);if(n.length===1&&r.length===1&&n[0]?.match(dw)&&r[0]?.match(dw)){e+=r[0];break}let s=[],i=[],a=o.newStart;for(let l=o.oldStart;l<o.oldEnd;l++){let c=this.oldTokens[l];if(!c)continue;let u=c?.match(J8);if(u){if([Kie,q8].some(f=>c?.match(f))){s.push(c);continue}e+=this.dressUpDiffContent("delete",s),s.splice(0);let d=!1;for(let f=a;f<o.newEnd;f++){let m=this.newTokens[f];if(!m)continue;let p=m?.match(J8);if(p&&p.groups?.name===u.groups?.name&&p.groups?.isEnd===u.groups?.isEnd){d=!0,e+=this.dressUpDiffContent("create",i),e+=m,i.splice(0),a=f+1;break}else i.push(m)}d||(e+=c,i.splice(0))}else s.push(c)}a<o.newEnd&&i.push(...this.newTokens.slice(a,o.newEnd)),e+=this.dressUpDiffContent("delete",s),e+=this.dressUpDiffContent("create",i);break}default:console.error("Richtext diff error - invalid operation: "+String(o.type))}}),this.unifiedContent=e,e}};var Fp={'"':"\uE004","&":"\uE001","'":"\uE005","<":"\uE002",">":"\uE003"},Np={"\uE001":"&amp;","\uE002":"&lt;","\uE003":"&gt;","\uE004":"&quot;","\uE005":"&#39;"};function es(t){return t==null?"":(typeof t=="string"?t:String(t)).replace(/&/g,Fp["&"]).replace(/</g,Fp["<"]).replace(/>/g,Fp[">"]).replace(/"/g,Fp['"']).replace(/'/g,Fp["'"])}function Ua(t){return t.replace(/\uE001/g,Np["\uE001"]).replace(/\uE002/g,Np["\uE002"]).replace(/\uE003/g,Np["\uE003"]).replace(/\uE004/g,Np["\uE004"]).replace(/\uE005/g,Np["\uE005"])}var K8="html-diff",pc=({fromHTML:t,postProcess:e,toHTML:o,tokenizeByCharacter:n})=>{let r=new jb(t,o,{tokenizeByCharacter:n}),[s,i]=r.getSideBySideContents();e&&(s=e(s),i=e(i));let a=s?Q8("div",{className:`${K8}__diff-old html-diff`,dangerouslySetInnerHTML:{__html:s}}):null,l=i?Q8("div",{className:`${K8}__diff-new html-diff`,dangerouslySetInnerHTML:{__html:i}}):null;return{From:a,To:l}};import{useEffect as sae}from"react";import{jsx as eae}from"react/jsx-runtime";import{createContext as tae,use as oae,useEffect as rae,useRef as nae}from"react";var e9=tae(null),t9=({children:t})=>{let e=nae(new Set);return rae(()=>{let r=s=>{e.current.forEach(({handler:i,ref:a})=>{a.current&&!a.current.contains(s.target)&&i()})};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[]),eae(e9,{value:{register:r=>e.current.add(r),unregister:r=>e.current.delete(r)},children:t})},mw=()=>{let t=oae(e9);if(!t)throw new Error("useClickOutside must be used within a ClickOutsideProvider");return t};function iae(t,e,o=!0){let{register:n,unregister:r}=mw();sae(()=>{if(!o||!t.current)return;let s={handler:e,ref:t};return n(s),()=>r(s)},[t,e,o,n,r])}import{c as hae}from"react/compiler-runtime";import{jsx as Mb,jsxs as gae}from"react/jsx-runtime";import{useState as bae}from"react";import{c as hw}from"react/compiler-runtime";import{jsx as Yo,jsxs as kb}from"react/jsx-runtime";import{getTranslation as aae}from"@payloadcms/translations";import{combineWhereConstraints as lae,formatAdminURL as fw,mergeListSearchAndWhere as cae,unflatten as o9}from"payload/shared";import*as pw from"qs-esm";import r9,{useCallback as n9,useEffect as uae,useMemo as s9,useState as dae}from"react";var mae=t=>{let e=hw(7),{action:o,disabled:n}=t,{submit:r}=Ge(),{t:s}=N(),i;e[0]!==o||e[1]!==r?(i=()=>{r({action:o,method:"PATCH",skipValidation:!0})},e[0]=o,e[1]=r,e[2]=i):i=e[2];let a=i,l;return e[3]!==n||e[4]!==a||e[5]!==s?(l=Yo(qt,{className:`${Gr}__save`,disabled:n,onClick:a,size:"medium",children:s("general:save")}),e[3]=n,e[4]=a,e[5]=s,e[6]=l):l=e[6],l},fae=t=>{let e=hw(7),{action:o,disabled:n}=t,{submit:r}=Ge(),{t:s}=N(),i;e[0]!==o||e[1]!==r?(i=()=>{r({action:o,method:"PATCH",overrides:{_status:"published"},skipValidation:!0})},e[0]=o,e[1]=r,e[2]=i):i=e[2];let a=i,l;return e[3]!==n||e[4]!==a||e[5]!==s?(l=Yo(qt,{className:`${Gr}__publish`,disabled:n,onClick:a,size:"medium",children:s("version:publishChanges")}),e[3]=n,e[4]=a,e[5]=s,e[6]=l):l=e[6],l},pae=t=>{let e=hw(7),{action:o,disabled:n}=t,{submit:r}=Ge(),{t:s}=N(),i;e[0]!==o||e[1]!==r?(i=()=>{r({action:o,method:"PATCH",overrides:{_status:"draft"},skipValidation:!0})},e[0]=o,e[1]=r,e[2]=i):i=e[2];let a=i,l;return e[3]!==n||e[4]!==a||e[5]!==s?(l=Yo(qt,{buttonStyle:"secondary",className:`${Gr}__draft`,disabled:n,onClick:a,size:"medium",children:s("version:saveDraft")}),e[3]=n,e[4]=a,e[5]=s,e[6]=l):l=e[6],l},i9=t=>{let{collection:e,collection:{fields:o,labels:{plural:n,singular:r}}={},count:s,drawerSlug:i,ids:a,onSuccess:l,selectAll:c,selectedFields:u,setSelectedFields:d,where:f}=t,{permissions:m,user:p}=ye(),{code:h}=Ce(),{closeModal:g}=ie(),{config:{routes:{api:b}}}=G(),{getFormState:v}=ct(),{i18n:C,t:y}=N(),[x,w]=dae(!1),S=Re(),_=r9.useRef(null),I=m?.collections?.[e.slug],A=lt(),D=s9(()=>o9(u.reduce((L,M)=>(L[M.value.path]=!0,L),{})),[u]),T=n9(async({formState:L,submitted:M})=>{let $=_r(_),{state:B}=await v({collectionSlug:e.slug,docPermissions:I,docPreferences:null,formState:L,operation:"update",schemaPath:e.slug,select:D,signal:$.signal,skipValidation:!M});return _.current=null,B},[v,e,I,D]);uae(()=>{let L=_.current;return()=>{Fo(L)}},[]);let R=s9(()=>{let L=[];f&&L.push(f);let M=cae({collectionConfig:e,search:A.get("search")});return M&&L.push(M),c?L.push(mo(A)?.where||{id:{not_equals:""}}):L.push({id:{in:a||[]}}),pw.stringify({locale:h,select:{},where:lae(L)},{addQueryPrefix:!0})},[e,A,c,a,h,f]),P=()=>{S.replace(pw.stringify({...mo(A),_r:Date.now(),page:c?"1":void 0},{addQueryPrefix:!0})),g(i),typeof l=="function"&&l()},E=n9(async({dispatchFields:L,formState:M,selected:$})=>{w(!0),d($||[]);let{state:B}=await v({collectionSlug:e.slug,docPermissions:I,docPreferences:null,formState:M,operation:"update",schemaPath:e.slug,select:o9($.reduce((j,k)=>(j[k.value.path]=!0,j),{})),skipValidation:!0});L({type:"UPDATE_MANY",formState:B}),w(!1)},[v,e.slug,I,d]),F=y("general:editingLabel",{count:s,label:aae(s>1?n:r,C)});return Yo(hm,{collectionSlug:e.slug,currentEditor:p,hasPublishedDoc:!1,id:null,initialData:{},isLocked:!1,lastUpdateTime:0,mostRecentVersionIsAutosaved:!1,unpublishedVersionCount:0,versionCount:0,children:Yo(P1,{value:"update",children:kb(fo,{className:`${Gr}__form`,isInitializing:x,onChange:[T],onSuccess:P,children:[kb("div",{className:`${Gr}__header`,children:[Yo(Z,{"aria-label":y("general:close"),buttonStyle:"ghost",className:`${Gr}__header__close`,icon:Yo(ve,{direction:"left",size:24}),onClick:()=>g(i)}),Yo("h2",{className:`${Gr}__header__title`,title:F,children:F}),Yo("div",{className:`${Gr}__header__actions`,children:e?.versions?.drafts?kb(r9.Fragment,{children:[Yo(pae,{action:fw({apiRoute:b,path:`/${e.slug}${R}&draft=true`}),disabled:u.length===0}),Yo(fae,{action:fw({apiRoute:b,path:`/${e.slug}${R}&draft=true`}),disabled:u.length===0})]}):Yo(mae,{action:fw({apiRoute:b,path:`/${e.slug}${R}`}),disabled:u.length===0})})]}),kb("div",{className:`${Gr}__body`,children:[Yo("div",{className:`${Gr}__select-fields`,children:Yo(y0,{fields:o,onChange:E,permissions:I.fields})}),u.length===0?null:Yo("div",{className:`${Gr}__edit`,children:Yo("div",{className:"render-fields",children:u.map((L,M)=>{let{value:{field:$,fieldPermissions:B,path:j}}=L;return Yo(Hu,{clientFieldConfig:$,indexPath:"",parentPath:"",parentSchemaPath:"",path:j,permissions:B},`${j}-${M}`)})})})]})]})})})};var Gr="edit-many",Ep=t=>{let e=hae(16),{collection:o,count:n,ids:r,modalPrefix:s,onSuccess:i,selectAll:a,where:l}=t,{permissions:c}=ye(),{openModal:u}=ie(),{t:d}=N(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[0]=f):f=e[0];let[m,p]=bae(f),h=c?.collections?.[o.slug],g=`${s?`${s}-`:""}edit-${o.slug}`;if(n===0||!h?.update)return null;let b;e[1]===Symbol.for("react.memo_cache_sentinel")?(b=[Gr,`${Gr}__toggle`].filter(Boolean),e[1]=b):b=e[1];let v;if(e[2]!==o||e[3]!==n||e[4]!==g||e[5]!==r||e[6]!==i||e[7]!==u||e[8]!==a||e[9]!==m||e[10]!==d||e[11]!==l){let C;e[13]!==g||e[14]!==u?(C=()=>{u(g),p([])},e[13]=g,e[14]=u,e[15]=C):C=e[15],v=gae("div",{className:b.join(" "),children:[Mb(Xo,{"aria-label":d("general:edit"),onClick:C,children:d("general:edit")}),Mb(Ks,{children:Mb(It,{Header:null,slug:g,children:Mb(i9,{collection:o,count:n,drawerSlug:g,ids:r,onSuccess:i,selectAll:a,selectedFields:m,setSelectedFields:p,where:l})})})]}),e[2]=o,e[3]=n,e[4]=g,e[5]=r,e[6]=i,e[7]=u,e[8]=a,e[9]=m,e[10]=d,e[11]=l,e[12]=v}else v=e[12];return v};import{c as vae}from"react/compiler-runtime";import{jsx as yae}from"react/jsx-runtime";import"react";function Cae(t){let e=vae(3),o=vt(),n;return e[0]!==o||e[1]!==t?(n=yae(En,{closeOnBlur:!1,...t,style:{...t.style||{},zIndex:`calc(100 + ${o||0} + 1)`}}),e[0]=o,e[1]=t,e[2]=n):n=e[2],n}import{c as xae}from"react/compiler-runtime";import{jsx as Bb,jsxs as wae}from"react/jsx-runtime";import Sae from"react";function gw(t){let e=xae(12),{highlightField:o,setKey:n}=t,{id:r}=be(),{toggleModal:s}=ie(),{t:i}=N(),a=`generate-confirmation-${r}`,l;e[0]!==o||e[1]!==n||e[2]!==i?(l=()=>{n(),se.success(i("authentication:newAPIKeyGenerated")),o(!0)},e[0]=o,e[1]=n,e[2]=i,e[3]=l):l=e[3];let c=l,u;e[4]!==a||e[5]!==s?(u=()=>{s(a)},e[4]=a,e[5]=s,e[6]=u):u=e[6];let d;return e[7]!==c||e[8]!==a||e[9]!==i||e[10]!==u?(d=wae(Sae.Fragment,{children:[Bb(Z,{buttonStyle:"secondary",onClick:u,size:"medium",children:i("authentication:generateNewAPIKey")}),Bb(nt,{body:Bb(Ro,{elements:{1:_ae},i18nKey:"authentication:generatingNewAPIKeyWillInvalidate",t:i}),confirmLabel:i("authentication:generate"),heading:i("authentication:confirmGeneration"),modalSlug:a,onConfirm:c})]}),e[7]=c,e[8]=a,e[9]=i,e[10]=u,e[11]=d):d=e[11],d}function _ae(t){let{children:e}=t;return Bb("strong",{children:e})}import{c as Iae}from"react/compiler-runtime";import{jsx as a9,jsxs as Rae}from"react/jsx-runtime";import{useState as Tae}from"react";var Dae="sidebar-toggle",bw=t=>{let e=Iae(5),{isActive:o}=t,n=o===void 0?!1:o,[r,s]=Tae(!1),i=n?"Hide Sidebar":"Show Sidebar",a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>s(!0),l=()=>s(!1),e[0]=a,e[1]=l):(a=e[0],l=e[1]);let c;return e[2]!==i||e[3]!==r?(c=Rae("div",{className:Dae,onMouseEnter:a,onMouseLeave:l,role:"presentation",children:[a9(J0,{}),a9(io,{alignCaret:"left",delay:300,position:"bottom",show:r,staticPositioning:!0,children:i})]}),e[2]=i,e[3]=r,e[4]=c):c=e[4],c};import{c as Aae}from"react/compiler-runtime";import{useEffect as Pae}from"react";function Fae(t){let e=Aae(4),{permissions:o}=t,{setPermissions:n}=ye(),r,s;return e[0]!==o||e[1]!==n?(r=()=>{n(o)},s=[o,n],e[0]=o,e[1]=n,e[2]=r,e[3]=s):(r=e[2],s=e[3]),Pae(r,s),null}import{c as Nae}from"react/compiler-runtime";import{jsx as Ob,jsxs as c9}from"react/jsx-runtime";import{formatAdminURL as Eae}from"payload/shared";import"react";function l9(t){return t===void 0||typeof t=="number"?t:decodeURIComponent(t)}var cd="id-label",vw=t=>{let e=Nae(13),{id:o,className:n,prefix:r}=t,s=r===void 0?"ID":r,{config:i}=G(),{routes:a}=i,{admin:l}=a,{collectionSlug:c,globalSlug:u}=be(),d=aa(),f,m;if(e[0]!==l||e[1]!==n||e[2]!==c||e[3]!==d||e[4]!==u||e[5]!==o||e[6]!==s){m=Symbol.for("react.early_return_sentinel");e:{let p=l9(o);if(d>0&&(c||u)){let b=Eae({adminRoute:l,path:`/${c?`collections/${c}`:`globals/${u}`}/${o}`}),v;e[9]!==n?(v=[cd,n].filter(Boolean),e[9]=n,e[10]=v):v=e[10],m=c9("div",{className:v.join(" "),title:o,children:[Ob("span",{className:`${cd}__prefix`,children:s}),Ob(jt,{className:`${cd}__link`,href:b,children:p})]});break e}let g;e[11]!==n?(g=[cd,n].filter(Boolean),e[11]=n,e[12]=g):g=e[12],f=c9("div",{className:g.join(" "),title:o,children:[Ob("span",{className:`${cd}__prefix`,children:s}),Ob("span",{className:`${cd}__value`,children:p})]})}e[0]=l,e[1]=n,e[2]=c,e[3]=d,e[4]=u,e[5]=o,e[6]=s,e[7]=f,e[8]=m}else f=e[7],m=e[8];return m!==Symbol.for("react.early_return_sentinel")?m:f};import{c as Wae}from"react/compiler-runtime";import{jsx as lr,jsxs as zb}from"react/jsx-runtime";import{Fragment as Uae,useEffect as Xae,useRef as Zae,useState as Yae}from"react";import{jsx as yw,jsxs as Lae}from"react/jsx-runtime";import"react";var Cw="dots",xw=({ariaLabel:t,className:e,noBackground:o,orientation:n="vertical"})=>Lae("div",{"aria-label":t,className:[e,Cw,o&&`${Cw}--no-background`,n&&`${Cw}--${n}`].filter(Boolean).join(" "),children:[yw("div",{}),yw("div",{}),yw("div",{})]});import{c as $ae}from"react/compiler-runtime";import{jsx as jae}from"react/jsx-runtime";import"react";var u9=t=>{let e=$ae(7),{collectionSlug:o,fields:n}=t,{query:r,refineListData:s}=bt(),i;e[0]!==s?(i=u=>{s({groupBy:u,page:1})},e[0]=s,e[1]=i):i=e[1];let a=i,l=r?.groupBy??"",c;return e[2]!==o||e[3]!==n||e[4]!==a||e[5]!==l?(c=jae(W0,{collectionSlug:o,fields:n,onChange:a,value:l}),e[2]=o,e[3]=n,e[4]=a,e[5]=l,e[6]=c):c=e[6],c};import{c as kae}from"react/compiler-runtime";import{jsx as Mae}from"react/jsx-runtime";import"react";var Vb=t=>{let e=kae(11),{collectionPluralLabel:o,collectionSlug:n,fields:r,onEmptyRemove:s,renderedFilters:i,resolvedFilterOptions:a}=t,{handleWhereChange:l,query:c}=bt(),u;e[0]!==l?(u=p=>l(p),e[0]=l,e[1]=u):u=e[1];let d=u,f=c?.where,m;return e[2]!==o||e[3]!==n||e[4]!==r||e[5]!==d||e[6]!==s||e[7]!==i||e[8]!==a||e[9]!==f?(m=Mae(H0,{collectionPluralLabel:o,collectionSlug:n,fields:r,onChange:d,onEmptyRemove:s,renderedFilters:i,resolvedFilterOptions:a,value:f}),e[2]=o,e[3]=n,e[4]=r,e[5]=d,e[6]=s,e[7]=i,e[8]=a,e[9]=f,e[10]=m):m=e[10],m};import{jsx as Gt,jsxs as jp}from"react/jsx-runtime";import{getTranslation as ud}from"@payloadcms/translations";import{formatAdminURL as _w,transformColumnsToPreferences as m9,transformColumnsToSearchParams as Iw}from"payload/shared";import*as h9 from"qs-esm";import{Fragment as Rw,useCallback as dd,useEffect as f9,useMemo as Vae,useState as Hae}from"react";import{jsx as d9,jsxs as Bae}from"react/jsx-runtime";import"react";var ww={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"}},Lp=({className:t,size:e=16})=>Bae("svg",{className:["icon","icon--refresh",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:[e===16&&ww[16].stroke&&d9("path",{d:ww[16].stroke,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),d9("path",{clipRule:"evenodd",d:ww[e].fill,fill:"currentColor",fillRule:"evenodd"})]});import{jsx as Hb,jsxs as Oae}from"react/jsx-runtime";import"react";var Sw="filter-trigger";function $p({id:t,children:e,className:o,isActive:n,onClear:r,onClick:s,onKeyDown:i,popupActive:a,showBadge:l}){return Oae("div",{className:`${Sw}__wrap`,children:[Hb(Z,{buttonStyle:"secondary",className:[Sw,o].filter(Boolean).join(" "),extraButtonProps:{onKeyDown:i},icon:Hb(Cp,{hasBadgeCutout:l??n,size:24}),iconPosition:"left",id:t,onClick:s,selected:n||a,size:"medium",children:e}),n&&r&&Hb("button",{className:`${Sw}__clear`,onClick:r,type:"button",children:Hb(xt,{size:16})})]})}var p9="delete-preset-confirmation",Xa="payload-query-presets",kp="query-preset-bar",g9=({activePreset:t,collectionSlug:e,queryPresetPermissions:o})=>{let{modified:n,query:r,refineListData:s,setModified:i}=bt(),{openModal:a}=ie(),[l,c]=Hae([]),{i18n:u,t:d}=N(),{config:{routes:{api:f},serverURL:m},getEntityConfig:p}=G(),h=p({collectionSlug:Xa}),[g,,{openDrawer:b}]=ro({id:t?.id,collectionSlug:Xa}),[v,,{closeDrawer:C,openDrawer:y}]=ro({collectionSlug:Xa}),x=Vae(()=>({"payload-query-presets":{isTemp:{not_equals:!0},relatedCollection:{equals:e}}}),[e]),[w,,{openDrawer:S}]=Vl({collectionSlugs:[Xa],filterOptions:x,selectedCollection:Xa}),_=dd(async()=>{try{let L=h9.stringify({limit:50,where:{and:[{isTemp:{not_equals:!0}},{relatedCollection:{equals:e}}]}},{addQueryPrefix:!0}),M=_w({apiRoute:f,path:`/${Xa}${L}`,serverURL:m}),$=await fetch(M,{credentials:"include"});if($.ok){let B=await $.json();c(B.docs||[])}}catch{}},[f,e,m]);f9(()=>{_()},[_]);let I=dd(async F=>{await s({columns:F.columns?Iw(F.columns):void 0,groupBy:F.groupBy||"",preset:F.id,where:F.where},!1)},[s]),A=t?.title||d("general:selectLabel",{label:ud(h?.labels?.singular,u)}),D=dd(async F=>{F.stopPropagation(),await s({columns:void 0,groupBy:"",preset:"",where:void 0},!1)},[s]),T=dd(async()=>{if(t?.id)try{let F=_w({apiRoute:f,path:`/${Xa}/${t.id}`,serverURL:m});(await fetch(F,{credentials:"include",method:"DELETE"})).ok&&(await s({columns:void 0,groupBy:"",preset:"",where:void 0},!1),_())}catch{}},[t?.id,f,_,s,m]),R=dd(async()=>{t&&await s({columns:t.columns?Iw(t.columns):[],groupBy:t.groupBy||"",preset:t.id,where:t.where},!1)},[t,s]),P=dd(async()=>{if(t?.id)try{let F=_w({apiRoute:f,path:`/${Xa}/${t.id}`,serverURL:m});(await fetch(F,{body:JSON.stringify({columns:m9(r.columns),groupBy:r.groupBy,where:r.where}),credentials:"include",headers:{"Content-Type":"application/json"},method:"PATCH"})).ok&&(i(!1),_())}catch{}},[t?.id,f,_,r.columns,r.groupBy,r.where,m,i]);f9(()=>{if(!t)return;let F=t.columns?Iw(t.columns):[],L=t.where,M=t.groupBy||"",$=r.columns||[];if(typeof $=="string")try{$=JSON.parse($)}catch{$=[]}let B=JSON.stringify($)===JSON.stringify(F),j=JSON.stringify(r.where)===JSON.stringify(L),k=(r.groupBy||"")===M;i(!B||!j||!k)},[t,r.columns,r.where,r.groupBy,i]);let E=t&&n;return jp(Rw,{children:[Gt("div",{className:kp,children:Gt(Ve,{className:`${kp}__popup`,horizontalAlign:"left",portalClassName:`${kp}__popup-content`,render:({close:F})=>jp(Rw,{children:[Gt(ue.RadioGroup,{children:l.map(L=>{let M=t?.id===L.id;return Gt(ue.RadioGroupItem,{active:M,onClick:async()=>{F(),await I(L)},children:L.title},L.id)})}),t&&jp(Rw,{children:[Gt(ue.Divider,{}),jp(ue.MenuItem,{size:"small",children:[E&&Gt(ue.Button,{icon:Gt(Lp,{size:16}),id:"reset-preset",onClick:async()=>{F(),await R()},children:d("general:reset")}),E&&o?.update&&Gt(ue.Button,{icon:Gt(Vo,{size:16}),id:"save-preset",onClick:async()=>{F(),await P()},children:t?.isShared?d("general:updateForEveryone"):d("fields:saveChanges")}),o?.update&&Gt(ue.Button,{icon:Gt(fr,{size:16}),id:"edit-preset",onClick:()=>{F(),b()},children:d("general:editLabel",{label:ud(h?.labels?.singular,u)})}),o?.delete&&Gt(ue.Button,{className:`${kp}__delete`,icon:Gt(Ql,{size:16}),id:"delete-preset",onClick:()=>{F(),a(p9)},children:d("general:deleteLabel",{label:ud(h?.labels?.singular,u)})})]})]}),(l.length>0||t)&&Gt(ue.Divider,{}),jp(ue.MenuItem,{size:"small",children:[o?.create&&Gt(ue.Button,{icon:Gt(Po,{size:16}),id:"create-new-preset",onClick:()=>{F(),y()},children:d("general:createNewLabel",{label:ud(h?.labels?.singular,u)})}),Gt(ue.Button,{icon:Gt(Ma,{size:16}),id:"manage-presets",onClick:()=>{F(),S()},children:d("general:manageLabel",{label:ud(h?.labels?.plural,u)})})]})]}),renderButton:({active:F,onClick:L,onKeyDown:M})=>Gt($p,{className:`${kp}__trigger`,id:"select-preset",isActive:!!t,onClear:D,onClick:L,onKeyDown:M,popupActive:F,showBadge:E,children:A}),size:"large",verticalAlign:"bottom"})}),Gt(v,{initialData:{columns:m9(r.columns),groupBy:r.groupBy,relatedCollection:e,where:r.where},onSave:async({doc:F})=>{C(),await I(F),_()},redirectAfterCreate:!1}),Gt(g,{onDelete:()=>{_()},onDuplicate:async({doc:F})=>{await I(F),_()},onSave:async({doc:F})=>{await I(F),_()}}),Gt(w,{allowCreate:!1,disableQueryPresets:!0,onSelect:async({doc:F})=>{await I(F)}}),Gt(nt,{body:Gt(Ro,{elements:{1:({children:F})=>Gt("strong",{children:F})},i18nKey:"general:aboutToDelete",t:d,variables:{label:ud(h?.labels?.singular,u),title:t?.title}}),confirmLabel:d("general:delete"),heading:d("general:confirmDeletion"),modalSlug:p9,onConfirm:T})]})};import{jsx as zae}from"react/jsx-runtime";import{useEffect as b9,useRef as v9,useState as Gae}from"react";function Mp({className:t,disabled:e,label:o="Search...",onSearchChange:n,searchQueryParam:r}){let[s,i]=Gae(typeof r=="string"?r:void 0),a=v9(!0),l=v9(typeof r=="string"?r:void 0),c=Vn(s,300);return b9(()=>(r!==l.current&&(a.current=!1,i(r),l.current=r),()=>{a.current=!0,l.current=void 0}),[r]),b9(()=>{c!==l.current&&a.current&&(n(c),l.current=c)},[c,n]),zae(xl,{className:t,disabled:e,id:"search-filter-input",onChange:u=>{a.current=!0,i(u)},onClear:()=>{a.current=!0,i("")},placeholder:o,value:s||""})}var sn="list-controls",Tw=t=>{let e=Wae(8),{beforeActions:o,collectionConfig:n,collectionSlug:r,disableQueryPresets:s,enableColumns:i,enableFilters:a,enableSort:l,hasCreatePermission:c,isWhereOpen:u,listMenuItems:d,newDocumentURL:f,onWhereToggle:m,queryPreset:p,queryPresetPermissions:h,renderedFilters:g,resolvedFilterOptions:b}=t,v=i===void 0?!0:i,C=a===void 0?!0:a,y=l===void 0?!1:l,x=typeof m=="function",{handleSearchChange:w,hasActiveFilters:S,query:_}=bt(),{t:I}=N(),{breakpoints:A}=sr(),{s:D}=A,T=I("general:searchBy",{label:""}).split(" ")[0],R=Zae(!!_?.where),[P,E]=Yae(S?"where":void 0),F;e[0]!==_?.where?(F=()=>{R.current&&!_?.where?R.current=!1:_?.where&&(R.current=!0)},e[0]=_?.where,e[1]=F):F=e[1];let L=_?.where,M;e[2]!==L?(M=[E,L],e[2]=L,e[3]=M):M=e[3],Xae(F,M);let $=x?!!u:P==="where",B;e[4]!==x||e[5]!==m||e[6]!==P?(B=x?m:()=>E(P!=="where"?"where":void 0),e[4]=x,e[5]=m,e[6]=P,e[7]=B):B=e[7];let j=B;return zb("div",{className:sn,children:[zb("div",{className:`${sn}__search-row`,children:[zb("div",{className:`${sn}__left`,children:[lr(Mp,{label:T,onSearchChange:w,searchQueryParam:_?.search},r),n?.enableQueryPresets&&!s&&lr(g9,{activePreset:p,collectionSlug:r,queryPresetPermissions:h})]}),lr("div",{className:`${sn}__spacer`}),zb("div",{className:`${sn}__actions`,children:[!D&&o,C&&lr(Z,{buttonStyle:"secondary",className:`${sn}__toggle-where`,extraButtonProps:{"aria-controls":`${sn}-where`,"aria-expanded":P==="where"},icon:lr(ve,{direction:$?"up":"down",size:16}),id:"toggle-list-filters",onClick:j,selected:$||S,size:"medium",children:I("general:filters")}),lr(u9,{collectionSlug:n.slug,fields:n.fields}),v&&lr(Pg,{collectionSlug:n.slug}),y&&lr(Z,{buttonStyle:"secondary",className:`${sn}__toggle-sort`,extraButtonProps:{"aria-controls":`${sn}-sort`,"aria-expanded":P==="sort"},icon:lr(ve,{size:16}),id:"toggle-list-sort",onClick:()=>E(P!=="sort"?"sort":void 0),size:"medium",children:I("general:sort")}),c&&f&&lr(Z,{buttonStyle:"primary",className:`${sn}__create-new`,el:"link",id:"create-new-doc",size:"medium",to:f,children:I("general:createNew")}),d&&Array.isArray(d)&&d.length>0&&lr(Ve,{button:lr(xw,{ariaLabel:I("general:moreOptions")}),className:`${sn}__popup`,horizontalAlign:"right",id:"list-menu",size:"medium",verticalAlign:"bottom",children:lr(ue.ButtonGroup,{children:d.map(Jae)})})]})]}),!x&&$&&lr("div",{className:`${sn}__where`,id:`${sn}-where`,children:lr(Vb,{collectionPluralLabel:n?.labels?.plural,collectionSlug:n.slug,fields:n?.fields,onEmptyRemove:()=>E(void 0),renderedFilters:g,resolvedFilterOptions:b})})]})};function Jae(t,e){return lr(Uae,{children:t},`list-menu-item-${e}`)}import{jsx as qae}from"react/jsx-runtime";import"react";var y9="list-controls-bar",Dw=({children:t,className:e,showBorder:o=!0})=>qae("div",{className:[y9,o&&`${y9}--border`,e].filter(Boolean).join(" "),children:t});import{jsx as C9,jsxs as Qae,Fragment as Kae}from"react/jsx-runtime";import{formatAdminURL as ele}from"payload/shared";import{useCallback as x9,useEffect as tle,useMemo as ole,useState as w9}from"react";var S9="hierarchy-button",rle=({fieldName:t,hasMany:e=!1,hierarchyCollectionSlug:o,Icon:n,readOnly:r,SmallIcon:s})=>{let{t:i}=N(),{config:a,getEntityConfig:l}=G(),{collectionSlug:c}=be(),{disabled:u,setModified:d}=Ge(),f=r||u,m=Ht(([R,P])=>P),p=Ht(([R])=>R&&R?.[t]||null),h=p?.value,[g,b]=w9(""),[v,C]=w9(!0),x=l({collectionSlug:o})?.admin?.useAsTitle||"name",w=c===o,S=ole(()=>w||!c?void 0:[c],[w,c]),[_,,{openDrawer:I}]=fi({filterByCollection:S,hierarchyCollectionSlug:o,Icon:n});tle(()=>{(async()=>{if(h&&(typeof h=="string"||typeof h=="number")){C(!0);try{let P=await fetch(ele({apiRoute:a.routes.api,path:`/${o}/${h}`,serverURL:a.serverURL}),{credentials:"include"});if(P.ok){let E=await P.json(),F=E?.[x]||E?.name||E?.id;b(String(F))}else b(i("general:none"))}catch{b(i("general:none"))}finally{C(!1)}}else b(i("general:none")),C(!1)})()},[h,o,a.routes.api,a.serverURL,x,i]);let A=x9(({closeDrawer:R,selections:P})=>{let E=Array.from(P.keys()),F=e?E:E[0]??null;p?.value!==F&&(m({type:"UPDATE",path:t,value:F}),d(!0)),R()},[p?.value,m,t,e,d]),D=x9(()=>{f||I()},[I,f]),T=v?`${i("general:loading")}...`:g;return Qae(Kae,{children:[C9(Z,{buttonStyle:"secondary",className:[S9,f&&`${S9}--read-only`].filter(Boolean).join(" "),disabled:f,icon:s??n,iconPosition:"left",margin:!1,onClick:D,children:T}),C9(_,{hasMany:e,initialSelections:h?[h]:void 0,onSave:A})]})};import{jsx as Es,jsxs as Aw}from"react/jsx-runtime";import{getTranslation as cle}from"@payloadcms/translations";import{useCallback as Wb,useMemo as Ub}from"react";import{jsx as md}from"react/jsx-runtime";import{formatAdminURL as nle}from"payload/shared";import*as I9 from"qs-esm";import{useEffect as sle,useMemo as ile,useRef as ale,useState as _9}from"react";var Gb="selected-hierarchies",R9=({hierarchySlug:t,Icon:e,onRemove:o,readOnly:n=!1,selectedIds:r})=>{let{config:s,getEntityConfig:i}=G(),{i18n:a}=N(),[l,c]=_9([]),[u,d]=_9(!0),f=ale(""),{routes:{api:m},serverURL:p}=s,h=i({collectionSlug:t}),g=ile(()=>r.slice().sort().join(","),[r]);return sle(()=>{if(!r||r.length===0){c([]),d(!1);return}if(f.current===g)return;f.current=g,(async()=>{let v=h?.admin?.useAsTitle||"id",C={depth:0,limit:r.length,select:{[v]:!0},where:{id:{in:r}}},y=I9.stringify(C);try{let x=nle({apiRoute:m,path:`/${t}?${y}`,serverURL:p}),w=await fetch(x,{credentials:"include",headers:{"Accept-Language":a.language}});if(w.ok){let _=(await w.json()).docs.map(A=>{let D=A.id,T=A[v]??D,R=String(typeof T=="string"||typeof T=="number"?T:D);return{id:D,title:R}}),I=r.map(A=>_.find(D=>D.id===A)).filter(A=>A!==void 0);c(I)}}catch{}finally{d(!1)}})()},[r,g,t,h,p,m,a.language]),u?md("div",{className:`${Gb}__loading`,children:md(tn,{size:"sm"})}):l.length===0?null:md("div",{className:Gb,children:md("div",{className:`${Gb}__pills`,children:l.map(b=>md(lle,{Icon:e,item:b,onRemove:o,readOnly:n},b.id))})})},lle=({Icon:t,item:e,onRemove:o,readOnly:n})=>md(rd,{className:`${Gb}__pill`,disabled:n,icon:t,onRemove:()=>o({id:e.id}),size:"medium",children:e.title});var Xb="hierarchy-field",ule=t=>{let{field:e,field:{admin:{className:o,description:n}={},hasMany:r,label:s,localized:i,relationTo:a,required:l},Icon:c,path:u,readOnly:d,validate:f}=t,m=Array.isArray(a)?a[0]:a,{getEntityConfig:p}=G(),{collectionSlug:h}=be(),{i18n:g,t:b}=N(),v=p({collectionSlug:m}),C=Wb((V,H)=>{if(typeof f=="function")return f(V,{...H,required:l})},[f,l]),{customComponents:{AfterInput:y,BeforeInput:x,Description:w,Error:S,Label:_}={},disabled:I,path:A,setValue:D,showError:T,value:R}=Ne({potentiallyStalePath:u,validate:C}),P=Ub(()=>st(e),[e]),E=Ub(()=>R?Array.isArray(R)?R:[R]:[],[R]),F=Ub(()=>R?Array.isArray(R)?R:[R]:[],[R]),L=Ub(()=>h?[h]:void 0,[h]),[M,,{openDrawer:$}]=fi({filterByCollection:L,hierarchyCollectionSlug:m,Icon:c}),B=Wb(({closeDrawer:V,selections:H})=>{let z=Array.from(H.keys()),W=r?z:z[0]??null;D(W),V()},[r,D]),j=Wb(({id:V})=>{if(r){let H=E.filter(z=>z!==V);D(H.length>0?H:null)}else D(null)},[r,E,D]),k=Wb(()=>{$()},[$]),O=cle(r?v?.labels?.plural:v?.labels?.singular,g)||m;return Aw("div",{className:[Ee,Xb,o,T&&"error",d&&`${Xb}--read-only`].filter(Boolean).join(" "),id:`field-${A?.replace(/\./g,"__")}`,style:P,children:[Es(le,{CustomComponent:_,Fallback:Es(Fe,{label:s,localized:i,path:A,required:l})}),Aw("div",{className:`${Ee}__wrap`,children:[Es(le,{CustomComponent:S,Fallback:Es(tt,{path:A,showError:T})}),x,Aw("div",{className:`${Xb}__content`,children:[E.length>0&&Es(R9,{hierarchySlug:m,onRemove:j,readOnly:d||I,selectedIds:E}),!d&&(r||E.length===0)&&Es(Z,{buttonStyle:"dashed",className:`${Xb}__manage-button`,disabled:I,icon:Es(ai,{size:24}),iconPosition:"left",margin:!1,onClick:k,size:"medium",children:b("general:selectLabel",{label:O})})]}),y,Es(le,{CustomComponent:w,Fallback:Es(Xe,{description:n,path:A})})]}),Es(M,{hasMany:r,initialSelections:F,onSave:B})]})};import{c as Lle}from"react/compiler-runtime";import{jsx as hc,jsxs as $le}from"react/jsx-runtime";import*as H9 from"qs-esm";import{Fragment as jle}from"react";import{c as gle}from"react/compiler-runtime";import{jsx as P9,jsxs as ble}from"react/jsx-runtime";import vle from"react";import{jsx as dle}from"react/jsx-runtime";import{getTranslation as T9}from"@payloadcms/translations";import{combineWhereConstraints as mle,formatAdminURL as fle,mergeListSearchAndWhere as ple}from"payload/shared";import*as Pw from"qs-esm";import hle,{useCallback as D9}from"react";function A9(t){let{collection:e,collection:{slug:o,labels:{plural:n,singular:r}}={},drawerSlug:s,ids:i,onSuccess:a,selectAll:l,where:c}=t,{clearRouteCache:u}=zt(),{config:{routes:{api:d}}}=G(),{code:f}=Ce(),m=Re(),p=lt(),{i18n:h,t:g}=N(),b=D9(()=>{se.error(g("error:unknown"))},[g]),v=hle.useMemo(()=>{let y=[{_status:{not_equals:"published"}}];c&&y.push(c);let x=ple({collectionConfig:e,search:p.get("search")});return x&&y.push(x),l?y.push(mo(p)?.where||{id:{not_equals:""}}):y.push({id:{in:i||[]}}),Pw.stringify({locale:f,select:{},where:mle(y)},{addQueryPrefix:!0})},[e,p,l,i,f,c]),C=D9(async()=>{let y=fle({apiRoute:d,path:`/${o}${v}&draft=true`});await We.patch(y,{body:JSON.stringify({_status:"published"}),headers:{"Accept-Language":h.language,"Content-Type":"application/json"}}).then(async x=>{try{let w=await x.json(),S=w?.docs.length||0,_=S>1?n:r;return x.status<400||S>0?(se.success(g("general:updatedCountSuccessfully",{count:S,label:T9(_,h)})),w?.errors.length>0&&se.error(w.message,{description:w.errors.map(I=>I.message).join(`
56
- `)}),m.replace(Pw.stringify({...mo(p),page:l?"1":void 0},{addQueryPrefix:!0})),u(),typeof a=="function"&&a(),null):(w.errors?w.errors.forEach(I=>se.error(I.message)):b(),!1)}catch{return b()}})},[d,o,v,h,n,r,g,m,p,l,u,b,a]);return dle(nt,{body:g("version:aboutToPublishSelection",{label:T9(n,h)}),cancelLabel:g("general:cancel"),confirmingLabel:g("version:publishing"),confirmLabel:g("general:confirm"),heading:g("version:confirmPublish"),modalSlug:s,onConfirm:C})}var Bp=t=>{let e=gle(12),{collection:o,collection:n,count:r,ids:s,modalPrefix:i,onSuccess:a,selectAll:l,where:c}=t,{slug:u,versions:d}=n===void 0?{}:n,{permissions:f}=ye(),{t:m}=N(),{openModal:p}=ie(),g=f?.collections?.[u]?.update,b=`${i?`${i}-`:""}publish-${u}`;if(!d?.drafts||r===0||!g)return null;let v;if(e[0]!==o||e[1]!==b||e[2]!==s||e[3]!==a||e[4]!==p||e[5]!==l||e[6]!==m||e[7]!==c){let C;e[9]!==b||e[10]!==p?(C=()=>{p(b)},e[9]=b,e[10]=p,e[11]=C):C=e[11],v=ble(vle.Fragment,{children:[P9(Xo,{"aria-label":m("version:publish"),onClick:C,children:m("version:publish")}),P9(A9,{collection:o,drawerSlug:b,ids:s,onSuccess:a,selectAll:l,where:c})]}),e[0]=o,e[1]=b,e[2]=s,e[3]=a,e[4]=p,e[5]=l,e[6]=m,e[7]=c,e[8]=v}else v=e[8];return v};import{jsx as Lw,jsxs as L9}from"react/jsx-runtime";import{getTranslation as $9}from"@payloadcms/translations";import{formatAdminURL as _le,mergeListSearchAndWhere as Ile}from"payload/shared";import*as jw from"qs-esm";import $w from"react";import{jsx as yle}from"react/jsx-runtime";import*as N9 from"qs-esm";import{createContext as Cle,use as xle,useCallback as Zb,useEffect as Fw,useMemo as wle,useRef as Sle,useState as Nw}from"react";var no=(function(t){return t.AllAvailable="allAvailable",t.AllInPage="allInPage",t.None="none",t.Some="some",t})({}),E9=Cle({count:void 0,getQueryParams:t=>"",getSelectedIds:()=>[],selectAll:void 0,selected:new Map,selectedIDs:[],setSelection:t=>{},toggleAll:t=>{},totalDocs:void 0}),F9=t=>{let e=[];for(let[o,n]of t)n&&e.push(o);return e},Ew=({children:t,docs:e=[],totalDocs:o})=>{let n=Sle({}),{user:r}=ye(),{code:s}=Ce(),[i,a]=Nw(()=>{let C=new Map;return e.forEach(({id:y})=>{C.set(y,!1)}),C}),[l,c]=Nw("none"),[u,d]=Nw(0),f=lt(),{query:m}=bt(),p=Zb((C=!1)=>{let y=new Map;if(C)c("allAvailable"),e.forEach(({id:x,_isLocked:w,_userEditing:S})=>{(!w||S?.id===r?.id)&&y.set(x,!0)});else if(l==="allAvailable"||l==="allInPage")c("none");else{let x=l!=="some";e.forEach(({id:w,_isLocked:S,_userEditing:_})=>{(!S||_?.id===r?.id)&&y.set(w,x)}),x&&y.size>0?y.size===e.length?c("allInPage"):c("some"):c("none")}a(y)},[e,l,r?.id]),h=Zb(C=>{let y=e.find(_=>_.id===C);if(y?._isLocked&&r?.id!==y?._userEditing.id)return;let x=i.get(C),w=typeof x=="boolean"?!x:!0,S=new Map(i.set(C,w));l==="allAvailable"&&!w&&c("some"),a(S)},[i,e,l,r?.id]),g=Zb(C=>{let y;if(l==="allAvailable")y=mo(f)?.where||{id:{not_equals:""}};else{let x=[];for(let[w,S]of i)S&&x.push(w);y={id:{in:x}}}return C&&(y={and:[{...C},y]}),N9.stringify({locale:s,where:y},{addQueryPrefix:!0})},[l,i,s,f]),b=Zb(()=>F9(i),[i]);Fw(()=>{if(l==="allAvailable")return;let C=!1,y=!0;if(!i.size)y=!1,C=!1;else for(let[x,w]of i)y=y&&w,C=C||w;y&&i.size===e.length?c("allInPage"):c(C?"some":"none")},[l,i,o,e]),Fw(()=>{let C=0;if(l==="allAvailable")C=o;else for(let[y,x]of i)x&&C++;d(C)},[l,i,o]),Fw(()=>{c("none"),a(new Map)},[m]);let v=wle(()=>F9(i),[i]);return n.current={count:u,getQueryParams:g,getSelectedIds:b,selectAll:l,selected:i,selectedIDs:v,setSelection:h,toggleAll:p,totalDocs:o},yle(E9,{value:n.current,children:t})},ts=()=>xle(E9);var j9="confirm-restore-many-docs",k9=t=>{let{collection:{slug:e}={},viewType:o}=t,{permissions:n}=ye(),{config:{collections:r,routes:s,serverURL:i}}=G(),{code:a}=Ce(),l=Re(),{clearRouteCache:c}=zt(),u=lt(),{count:d,getSelectedIds:f,selectAll:m,toggleAll:p}=ts(),{openModal:h}=ie(),{i18n:g,t:b}=N(),[v,C]=$w.useState(!1),x=n?.collections?.[e]?.update;if(m===no.None||!x||o!=="trash")return null;let w=m===no.AllAvailable,S=w?[]:f(),_=mo(u)?.where,I={and:[...Array.isArray(_?.and)?_.and:_?[_]:[],{deletedAt:{exists:!0}}]},A=async()=>{let R=r.find(M=>M.slug===e);if(!R)return;let P;w?P=I:P={and:[{id:{in:S}},{deletedAt:{exists:!0}}]};let E=_le({apiRoute:s.api,path:`/${e}${jw.stringify({limit:0,locale:a,select:{},trash:!0,where:Ile({collectionConfig:R,search:mo(u)?.search,where:P})},{addQueryPrefix:!0})}`}),F={deletedAt:null};R?.versions?.drafts&&(F._status=v?"published":"draft");let L=await We.patch(E,{body:JSON.stringify(F),headers:{"Accept-Language":g.language,"Content-Type":"application/json"}});try{let{plural:M,singular:$}=R.labels,B=await L.json(),j=B?.docs?.length||0,k=j>1?M:$;(L.status<400||j>0)&&se.success(b("general:restoredCountSuccessfully",{count:j,label:$9(k,g)})),B?.errors?.length>0&&se.error(B.message,{description:B.errors.map(O=>O.message).join(`
57
- `)})}catch{se.error(b("error:unknown"))}p(),l.replace(jw.stringify({...mo(u),page:w?"1":void 0},{addQueryPrefix:!0})),c()},D=r.find(({slug:R})=>R===e),T=$9(d===1?D.labels.singular:D.labels.plural,g);return L9($w.Fragment,{children:[Lw(Xo,{"aria-label":b("general:restore"),onClick:()=>{h(j9)},children:b("general:restore")}),Lw(nt,{body:L9($w.Fragment,{children:[b(D?.versions?.drafts?"general:aboutToRestoreAsDraftCount":"general:aboutToRestoreCount",{count:d,label:T}),D?.versions?.drafts&&Lw(Ft,{checked:v,id:"restore-as-published-many",label:b("general:restoreAsPublished"),name:"restore-as-published-many",onToggle:R=>C(R.target.checked)})]}),confirmingLabel:b("general:restoring"),heading:b("general:confirmRestoration"),modalSlug:j9,onConfirm:A})]})};import{c as Fle}from"react/compiler-runtime";import{jsx as V9,jsxs as Nle}from"react/jsx-runtime";import Ele from"react";import{jsx as Rle}from"react/jsx-runtime";import{getTranslation as M9}from"@payloadcms/translations";import{combineWhereConstraints as Tle,formatAdminURL as Dle,mergeListSearchAndWhere as Ale}from"payload/shared";import*as kw from"qs-esm";import Ple,{useCallback as B9}from"react";function O9(t){let{collection:e,collection:{slug:o,labels:{plural:n,singular:r}}={},drawerSlug:s,ids:i,onSuccess:a,selectAll:l,where:c}=t,{config:{routes:{api:u}}}=G(),{code:d}=Ce(),{i18n:f,t:m}=N(),p=lt(),h=Re(),{clearRouteCache:g}=zt(),b=B9(()=>{se.error(m("error:unknown"))},[m]),v=Ple.useMemo(()=>{let y=[{_status:{not_equals:"draft"}}];c&&y.push(c);let x=Ale({collectionConfig:e,search:p.get("search")});return x&&y.push(x),l||y.push({id:{in:i||[]}}),kw.stringify({locale:d,select:{},where:Tle(y)},{addQueryPrefix:!0})},[e,p,l,i,d,c]),C=B9(async()=>{let y=Dle({apiRoute:u,path:`/${o}${v}`});await We.patch(y,{body:JSON.stringify({_status:"draft"}),headers:{"Accept-Language":f.language,"Content-Type":"application/json"}}).then(async x=>{try{let w=await x.json(),S=w?.docs.length||0,_=S>1?n:r;return x.status<400||S>0?(se.success(m("general:updatedCountSuccessfully",{count:S,label:M9(_,f)})),w?.errors.length>0&&se.error(w.message,{description:w.errors.map(I=>I.message).join(`
58
- `)}),h.replace(kw.stringify({...mo(p),page:l?"1":void 0},{addQueryPrefix:!0})),g(),typeof a=="function"&&a(),null):(w.errors?w.errors.forEach(I=>se.error(I.message)):b(),!1)}catch{return b()}})},[u,o,v,f,n,r,m,h,p,l,g,b,a]);return Rle(nt,{body:m("version:aboutToUnpublishSelection",{label:M9(n,f)}),confirmingLabel:m("version:unpublishing"),heading:m("version:confirmUnpublish"),modalSlug:s,onConfirm:C})}var Op=t=>{let e=Fle(12),{collection:o,collection:n,count:r,ids:s,modalPrefix:i,onSuccess:a,selectAll:l,where:c}=t,{slug:u,versions:d}=n===void 0?{}:n,{t:f}=N(),{permissions:m}=ye(),{toggleModal:p}=ie(),g=m?.collections?.[u]?.update,b=`${i?`${i}-`:""}unpublish-${u}`;if(!d?.drafts||r===0||!g)return null;let v;if(e[0]!==o||e[1]!==b||e[2]!==s||e[3]!==a||e[4]!==l||e[5]!==f||e[6]!==p||e[7]!==c){let C;e[9]!==b||e[10]!==p?(C=()=>{p(b)},e[9]=b,e[10]=p,e[11]=C):C=e[11],v=Nle(Ele.Fragment,{children:[V9(Xo,{"aria-label":f("version:unpublish"),onClick:C,children:f("version:unpublish")}),V9(O9,{collection:o,drawerSlug:b,ids:s,onSuccess:a,selectAll:l,where:c})]}),e[0]=o,e[1]=b,e[2]=s,e[3]=a,e[4]=l,e[5]=f,e[6]=p,e[7]=c,e[8]=v}else v=e[8];return v};var gc=t=>{let e=Lle(26),{collectionConfig:o,disableBulkDelete:n,disableBulkEdit:r,hasDeletePermission:s,hasTrashPermission:i,label:a,modalPrefix:l,showSelectAllAcrossPages:c,viewType:u,where:d}=t,f=c===void 0?!0:c,{count:m,selectAll:p,selectedIDs:h,toggleAll:g,totalDocs:b}=ts(),{t:v}=N(),{permissions:C}=ye(),y=Re(),x=lt(),{clearRouteCache:w}=zt(),S;e[0]!==g?(S=()=>g(),e[0]=g,e[1]=S):S=e[1];let _=S;if(m===0)return null;let I=o?.trash&&u==="trash",A=C?.collections?.[o?.slug],D=s!==void 0?s:!!A?.delete,T=i!==void 0?i:D,R=u==="trash"?D:D||T,P=p===no.AllAvailable,E;if(e[2]!==R||e[3]!==w||e[4]!==o||e[5]!==m||e[6]!==n||e[7]!==r||e[8]!==D||e[9]!==T||e[10]!==I||e[11]!==a||e[12]!==l||e[13]!==_||e[14]!==y||e[15]!==x||e[16]!==p||e[17]!==h||e[18]!==P||e[19]!==f||e[20]!==v||e[21]!==g||e[22]!==b||e[23]!==u||e[24]!==d){let F=P?[]:h,L=mo(x)?.where,M=u==="trash"?{and:[...Array.isArray(L?.and)?L.and:L?[L]:[],{deletedAt:{exists:!0}}]}:L;E=hc(Cb,{count:m,ListActions:[p!==no.AllAvailable&&m<b&&f!==!1?hc(Xo,{"aria-label":v("general:selectAll",{count:`(${b})`,label:a}),id:"select-all-across-pages",onClick:()=>g(!0),children:v("general:selectAll",{count:`(${b})`,label:""})},"select-all"):null].filter(Boolean),SelectionActions:[!r&&!I&&$le(jle,{children:[hc(Ep,{collection:o,count:m,ids:h,modalPrefix:l,onSuccess:_,selectAll:p===no.AllAvailable,where:d}),hc(Bp,{collection:o,count:m,ids:h,modalPrefix:l,onSuccess:_,selectAll:p===no.AllAvailable,where:d}),hc(Op,{collection:o,count:m,ids:h,modalPrefix:l,onSuccess:_,selectAll:p===no.AllAvailable,where:d})]},"bulk-actions"),I&&hc(k9,{collection:o,viewType:u},"bulk-restore"),!n&&R&&o&&hc(Ip,{afterDelete:()=>{g(),y.replace(H9.stringify({...mo(x),page:p?"1":void 0},{addQueryPrefix:!0})),w()},hasDeletePermission:D,hasTrashPermission:T,modalPrefix:l,search:mo(x)?.search,selections:{[o.slug]:{all:P,ids:F,totalCount:P?m:F.length}},trash:o?.trash,viewType:u,where:M},"bulk-delete")].filter(Boolean)}),e[2]=R,e[3]=w,e[4]=o,e[5]=m,e[6]=n,e[7]=r,e[8]=D,e[9]=T,e[10]=I,e[11]=a,e[12]=l,e[13]=_,e[14]=y,e[15]=x,e[16]=p,e[17]=h,e[18]=P,e[19]=f,e[20]=v,e[21]=g,e[22]=b,e[23]=u,e[24]=d,e[25]=E}else E=e[25];return E};import{jsx as ji,jsxs as Jle,Fragment as qle}from"react/jsx-runtime";import{getTranslation as Gw}from"@payloadcms/translations";import"react";import{jsx as z9}from"react/jsx-runtime";var kle="close-modal-button";function G9({slug:t,className:e}){let{closeModal:o}=ie(),{t:n}=N();return z9(Z,{"aria-label":n("general:close"),buttonStyle:"ghost",className:[kle,e].filter(Boolean).join(" "),icon:z9(ve,{direction:"left",size:24}),onClick:()=>{o(t)}},"close-button")}import{c as Mle}from"react/compiler-runtime";import{jsx as Mw,jsxs as Ble}from"react/jsx-runtime";import{getTranslation as W9}from"@payloadcms/translations";import{formatAdminURL as Ole}from"payload/shared";import"react";var bc="default-list-view-tabs",Yb=t=>{let e=Mle(24),{collectionConfig:o,config:n,onChange:r,viewType:s}=t,{i18n:i,t:a}=N(),{setPreference:l}=Jt(),c=Re(),u=o.trash,d=!!o.hierarchy;if(!u&&!d)return null;let f;e[0]!==o.slug||e[1]!==n||e[2]!==r||e[3]!==c||e[4]!==l?(f=async C=>{r&&r(C),(C==="list"||C==="hierarchy")&&await l(`collection-${o.slug}`,{listViewType:C});let y=`/collections/${o.slug}`;e:switch(C){case"hierarchy":{y=`/collections/${o.slug}/hierarchy`;break e}case"trash":y=`/collections/${o.slug}/trash`}let x=Ole({adminRoute:n.routes.admin,path:y});c.push(x)},e[0]=o.slug,e[1]=n,e[2]=r,e[3]=c,e[4]=l,e[5]=f):f=e[5];let m=f,p=o?.labels?.plural,h;e[6]!==i||e[7]!==p?(h=W9(p,i),e[6]=i,e[7]=p,e[8]=h):h=e[8];let g=h,b=`${a("general:all")} ${g}`,v;if(e[9]!==b||e[10]!==o.labels?.singular||e[11]!==g||e[12]!==m||e[13]!==i||e[14]!==d||e[15]!==u||e[16]!==a||e[17]!==s){let C;e[19]===Symbol.for("react.memo_cache_sentinel")?(C=/\s+/g,e[19]=C):C=e[19];let y=b.toLowerCase().replace(C,"-"),x=s==="list"&&`${bc}__button--active`,w;e[20]!==x?(w=[`${bc}__button`,x].filter(Boolean),e[20]=x,e[21]=w):w=e[21];let S;e[22]!==m?(S=()=>m("list"),e[22]=m,e[23]=S):S=e[23],v=Ble("div",{className:bc,children:[Mw(Z,{buttonStyle:s==="list"?"pill":"ghost",className:w.join(" "),disabled:s==="list",el:"button",id:y,onClick:S,children:`${a("general:all")} ${g}`}),d&&Mw(Z,{buttonStyle:s==="hierarchy"?"pill":"ghost",className:[`${bc}__button`,s==="hierarchy"&&`${bc}__button--active`].filter(Boolean).join(" "),disabled:s==="hierarchy",el:"button",id:"hierarchy-view-pill",onClick:()=>m("hierarchy"),children:`${a("general:by")} ${W9(o?.labels?.singular,i)}`}),u&&Mw(Z,{buttonStyle:s==="trash"?"pill":"ghost",className:[`${bc}__button`,s==="trash"&&`${bc}__button--active`].filter(Boolean).join(" "),disabled:s==="trash",el:"button",id:"trash-view-pill",onClick:()=>m("trash"),children:a("general:trash")})]}),e[9]=b,e[10]=o.labels?.singular,e[11]=g,e[12]=m,e[13]=i,e[14]=d,e[15]=u,e[16]=a,e[17]=s,e[18]=v}else v=e[18];return v};import{c as Vle}from"react/compiler-runtime";import{jsx as U9,jsxs as Hle}from"react/jsx-runtime";import{getTranslation as X9}from"@payloadcms/translations";import{jsx as Jb,jsxs as Bw}from"react/jsx-runtime";import"react";var $i="list-header",Vp=t=>Bw("header",{className:[$i,t.className].filter(Boolean).join(" "),children:[Bw("div",{className:`${$i}__content`,children:[Bw("div",{className:`${$i}__title-and-actions`,children:[t.BeforeTitle,Jb("h1",{className:`${$i}__title`,children:t.title}),t.TitleActions?.length?Jb("div",{className:`${$i}__title-actions`,children:t.TitleActions}):null]}),t.Actions?.length?Jb("div",{className:`${$i}__actions`,children:t.Actions}):null]}),t.AfterListHeaderContent?Jb("div",{className:`${$i}__after-header-content`,children:t.AfterListHeaderContent}):null]});var zle="list-drawer",Z9=()=>{let t=Vle(12),{i18n:e,t:o}=N(),{config:n,getEntityConfig:r}=G(),{collections:s}=n,{enabledCollections:i,selectedOption:a,setSelectedOption:l}=Sr(),c;if(t[0]!==s||t[1]!==i||t[2]!==r||t[3]!==e||t[4]!==a||t[5]!==l||t[6]!==o){c=Symbol.for("react.early_return_sentinel");e:{let u;t[8]!==i?(u=f=>{let{slug:m}=f;return i.includes(m)},t[8]=i,t[9]=u):u=t[9];let d=s.filter(u);if(d.length>1){let f=r({collectionSlug:a.value}),m;t[10]!==e?(m=p=>({label:X9(p.labels.singular,e),value:p.slug}),t[10]=e,t[11]=m):m=t[11],c=Hle("div",{className:`${zle}__select-collection-wrap`,children:[U9(Fe,{label:o("upload:selectCollectionToBrowse")}),U9(mt,{className:`${$i}__select-collection`,isClearable:!1,onChange:l,options:d.map(m),value:{label:X9(f?.labels.singular,e),value:f?.slug}})]});break e}}t[0]=s,t[1]=i,t[2]=r,t[3]=e,t[4]=a,t[5]=l,t[6]=o,t[7]=c}else c=t[7];return c!==Symbol.for("react.early_return_sentinel")?c:null};import{c as Gle}from"react/compiler-runtime";import{jsx as Wle}from"react/jsx-runtime";var Ule="list-header";function Ow(t){let e=Gle(3),{hasCreatePermission:o}=t,{DocumentDrawerToggler:n}=Sr(),{t:r}=N();if(!o)return null;let s;return e[0]!==n||e[1]!==r?(s=Wle(n,{buttonStyle:"primary",className:`${Ule}__create-new-button`,children:r("general:createNew")},"create-new-button-toggler"),e[0]=n,e[1]=r,e[2]=s):s=e[2],s}import{c as Xle}from"react/compiler-runtime";import{jsx as Zle}from"react/jsx-runtime";import"react";function Vw(t){let e=Xle(14),{collectionSlug:o,hasCreatePermission:n,isBulkUploadEnabled:r,onBulkUploadSuccess:s,openBulkUpload:i}=t,{drawerSlug:a,setCollectionSlug:l,setOnSuccess:c,setParentID:u}=nr(),{parent:d}=No(),{t:f}=N(),{openModal:m}=ie(),p=Re(),h;e[0]!==a||e[1]!==o||e[2]!==s||e[3]!==i||e[4]!==m||e[5]!==d?.id||e[6]!==p||e[7]!==l||e[8]!==c||e[9]!==u?(h=()=>{typeof i=="function"?i():(l(o),u(d?.id),m(a),c(()=>{typeof s=="function"?s():p.refresh()}))},e[0]=a,e[1]=o,e[2]=s,e[3]=i,e[4]=m,e[5]=d?.id,e[6]=p,e[7]=l,e[8]=c,e[9]=u,e[10]=h):h=e[10];let g=h;if(!n||!r)return null;let b;return e[11]!==g||e[12]!==f?(b=Zle(Z,{"aria-label":f("upload:bulkUpload"),buttonStyle:"pill",onClick:g,size:"medium",children:f("upload:bulkUpload")},"bulk-upload-button"),e[11]=g,e[12]=f,e[13]=b):b=e[13],b}import{jsx as Hp,jsxs as Yle}from"react/jsx-runtime";import{getTranslation as Hw}from"@payloadcms/translations";import{formatAdminURL as Y9}from"payload/shared";import*as Qb from"qs-esm";import qb from"react";var J9="confirm-empty-trash";function zw({collectionConfig:t,hasDeletePermission:e}){let{i18n:o,t:n}=N(),{code:r}=Ce(),{config:s}=G(),{openModal:i}=ie(),a=Re(),l=lt(),{clearRouteCache:c}=zt(),[u,d]=qb.useState(null);qb.useEffect(()=>{(async()=>{let p=Qb.stringify({depth:0,limit:0,locale:r,trash:!0,where:{deletedAt:{exists:!0}}},{addQueryPrefix:!0});try{let g=await(await We.get(Y9({apiRoute:s.routes.api,path:`/${t.slug}${p}`}),{headers:{"Accept-Language":o.language,"Content-Type":"application/json"}})).json();d(g?.totalDocs??0)}catch{d(0)}})()},[t.slug,s,o.language,r]);let f=qb.useCallback(async()=>{if(!e)return;let{slug:m,labels:p}=t,h=Qb.stringify({limit:0,locale:r,trash:!0,where:{deletedAt:{exists:!0}}},{addQueryPrefix:!0}),g=await We.delete(Y9({apiRoute:s.routes.api,path:`/${m}${h}`}),{headers:{"Accept-Language":o.language,"Content-Type":"application/json"}});try{let b=await g.json(),v=b?.docs?.length||0;g.status<400&&se.success(n("general:permanentlyDeletedCountSuccessfully",{count:v,label:Hw(p?.plural,o)})),b?.errors?.length>0&&se.error(b.message,{description:b.errors.map(C=>C.message).join(`
59
- `)}),a.replace(Qb.stringify({...Object.fromEntries(l.entries()),page:"1"},{addQueryPrefix:!0})),c()}catch{se.error(n("error:unknown"))}},[t,s,e,o,n,r,l,a,c]);return Yle(qb.Fragment,{children:[Hp(Z,{"aria-label":n("general:emptyTrashLabel",{label:Hw(t?.labels?.plural,o)}),buttonStyle:"pill",disabled:u===0,id:"empty-trash-button",onClick:()=>{i(J9)},size:"medium",children:n("general:emptyTrash")},"empty-trash-button"),Hp(nt,{body:Hp(Ro,{elements:{0:({children:m})=>Hp("strong",{children:m}),1:({children:m})=>Hp("strong",{children:m})},i18nKey:"general:aboutToPermanentlyDeleteTrash",t:n,variables:{count:u??0,label:Hw(u===1?t.labels?.singular:t.labels?.plural,o)}}),confirmingLabel:n("general:deleting"),heading:n("general:confirmDeletion"),modalSlug:J9,onConfirm:f})]})}var q9="list-drawer",Ww=({className:t,collectionConfig:e,Description:o,disableBulkDelete:n,disableBulkEdit:r,hasCreatePermission:s,hasDeletePermission:i,hasTrashPermission:a,i18n:l,isBulkUploadEnabled:c,isTrashEnabled:u,onBulkUploadSuccess:d,openBulkUpload:f,smallBreak:m,viewType:p})=>{let{config:h,getEntityConfig:g}=G(),{drawerSlug:b,isInDrawer:v,selectedOption:C}=Sr(),y=p==="trash",{isGroupingBy:x}=bt();return v?ji(Vp,{Actions:[],AfterListHeaderContent:Jle(qle,{children:[o,ji(Z9,{})]}),BeforeTitle:ji(G9,{className:`${q9}__header-close`,slug:b}),className:`${q9}__header`,title:Gw(g({collectionSlug:C.value})?.labels?.plural,l),TitleActions:[ji(Ow,{hasCreatePermission:s},"list-drawer-create-new-doc")].filter(Boolean)}):ji(Vp,{Actions:[!m&&!x&&ji(gc,{collectionConfig:e,disableBulkDelete:n,disableBulkEdit:r,hasDeletePermission:i,hasTrashPermission:a,label:Gw(e?.labels?.plural,l),showSelectAllAcrossPages:!x,viewType:p},"list-selection"),ji(Yb,{collectionConfig:e,config:h,viewType:p},"default-list-actions")].filter(Boolean),AfterListHeaderContent:o,className:t,title:Gw(e?.labels?.plural,l),TitleActions:[s&&c&&!y&&ji(Vw,{collectionSlug:e.slug,hasCreatePermission:s,isBulkUploadEnabled:c,onBulkUploadSuccess:d,openBulkUpload:f},"list-header-bulk-upload"),i&&u&&p==="trash"&&ji(zw,{collectionConfig:e,hasDeletePermission:i},"list-header-empty-trash")].filter(Boolean)})};import{jsx as Qle}from"react/jsx-runtime";import"react";var Kle=({collectionConfig:t,groupByFieldPath:e,groupByValue:o,heading:n})=>Qle(gc,{collectionConfig:t,label:n,modalPrefix:o,where:{[e]:{equals:o}}});import{c as K9}from"react/compiler-runtime";import{jsx as qw,jsxs as tv}from"react/jsx-runtime";import{isNumber as lce}from"payload/shared";import"react";import{c as ece}from"react/compiler-runtime";import{jsx as Xw,jsxs as Zw}from"react/jsx-runtime";import tce,{useState as oce}from"react";import{jsx as Q9}from"react/jsx-runtime";import"react";var Uw="clickable-arrow",fd=t=>{let{direction:e="right",isDisabled:o=!1,updatePage:n}=t,r=[Uw,o&&`${Uw}--is-disabled`,e&&`${Uw}--${e}`].filter(Boolean).join(" ");return Q9("button",{className:r,disabled:o,onClick:o?void 0:n,type:"button",children:Q9(ve,{})})};var Kb="paginator",Yw=t=>{let e=ece(34),{hasNextPage:o,hasPrevPage:n,nextPage:r,onChange:s,page:i,prevPage:a,totalPages:l}=t,c=o===void 0?!1:o,u=n===void 0?!1:n,d=r===void 0?null:r,f=i===void 0?1:i,m=a===void 0?null:a,p=l===void 0?1:l,[h,g]=oce(String(f)),b,v;e[0]!==f?(b=()=>{g(String(f))},v=[f],e[0]=f,e[1]=b,e[2]=v):(b=e[1],v=e[2]),tce.useEffect(b,v);let C;e[3]!==s?(C=P=>{typeof s=="function"&&s(P)},e[3]=s,e[4]=C):C=e[4];let y=C,x;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=P=>{g(P.target.value)},e[5]=x):x=e[5];let w=x,S;e[6]!==f||e[7]!==h||e[8]!==p||e[9]!==y?(S=()=>{let P=parseInt(h,10);if(isNaN(P))g(String(f));else{let E=Math.max(1,Math.min(P,p));E!==f?y(E):g(String(f))}},e[6]=f,e[7]=h,e[8]=p,e[9]=y,e[10]=S):S=e[10];let _=S,I;e[11]!==f||e[12]!==h||e[13]!==p?(I=P=>{if(P.key==="Enter")P.currentTarget.blur();else if(P.key==="Escape")g(String(f)),P.currentTarget.blur();else if(P.key==="ArrowUp"){P.preventDefault();let E=parseInt(h,10);!isNaN(E)&&E<p&&g(String(E+1))}else if(P.key==="ArrowDown"){P.preventDefault();let E=parseInt(h,10);!isNaN(E)&&E>1&&g(String(E-1))}},e[11]=f,e[12]=h,e[13]=p,e[14]=I):I=e[14];let A=I;if(!p||p<=1)return null;let D=!u,T;e[15]!==f||e[16]!==m||e[17]!==y?(T=()=>y(m??Math.max(1,f-1)),e[15]=f,e[16]=m,e[17]=y,e[18]=T):T=e[18];let R;if(e[19]!==f||e[20]!==_||e[21]!==A||e[22]!==c||e[23]!==h||e[24]!==d||e[25]!==D||e[26]!==T||e[27]!==p||e[28]!==y){let P;e[30]!==f||e[31]!==d||e[32]!==y?(P=()=>y(d??f+1),e[30]=f,e[31]=d,e[32]=y,e[33]=P):P=e[33],R=Zw("div",{className:Kb,children:[Xw(fd,{direction:"left",isDisabled:D,updatePage:T}),Xw(fd,{direction:"right",isDisabled:!c,updatePage:P}),Zw("div",{className:`${Kb}__page-input-wrapper`,children:[Xw("input",{"aria-label":"Go to page",className:`${Kb}__page-input`,inputMode:"numeric",max:p,min:1,onBlur:_,onChange:w,onKeyDown:A,style:{width:`${Math.max(h.length,1)}ch`},type:"text",value:h}),Zw("span",{className:`${Kb}__page-total`,children:["of ",p]})]})]}),e[19]=f,e[20]=_,e[21]=A,e[22]=c,e[23]=h,e[24]=d,e[25]=D,e[26]=T,e[27]=p,e[28]=y,e[29]=R}else R=e[29];return R};import{c as rce}from"react/compiler-runtime";import{jsx as pd,jsxs as nce}from"react/jsx-runtime";import{collectionDefaults as sce,isNumber as ice}from"payload/shared";import"react";var ev="per-page",ace=sce.admin.pagination.limits,Jw=t=>{let e=rce(11),{defaultLimit:o,handleChange:n,limit:r,limits:s}=t,i=o===void 0?10:o,a=s===void 0?ace:s,{t:l}=N(),c=ice(r)?r:i,u;if(e[0]!==n||e[1]!==c||e[2]!==a||e[3]!==l){let d;e[5]!==n||e[6]!==c||e[7]!==a?(d=m=>{let{close:p}=m;return pd(ue.RadioGroup,{children:a.map((h,g)=>pd(ue.RadioGroupItem,{active:h===c,onClick:()=>{p(),n&&n(h)},children:h},g))})},e[5]=n,e[6]=c,e[7]=a,e[8]=d):d=e[8];let f;e[9]!==c?(f=m=>{let{active:p,onClick:h,onKeyDown:g,...b}=m;return pd(Z,{...b,buttonStyle:"secondary",className:[p&&`${ev}--active`].filter(Boolean).join(" "),extraButtonProps:{onKeyDown:g},icon:pd(ve,{className:`${ev}__icon`,size:16}),iconPosition:"right",onClick:h,children:c})},e[9]=c,e[10]=f):f=e[10],u=nce("div",{className:ev,children:[pd("span",{className:`${ev}__label`,children:l("general:perPageLabel")}),pd(Ve,{horizontalAlign:"right",render:d,renderButton:f,size:"small"})]}),e[0]=n,e[1]=c,e[2]=a,e[3]=l,e[4]=u}else u=e[4];return u};var ov="page-controls",rv=t=>{let e=K9(16),{AfterPageControls:o,data:n,handlePageChange:r,handlePerPageChange:s,limit:i,limits:a}=t,{i18n:l}=N(),c;return e[0]!==o||e[1]!==n.hasNextPage||e[2]!==n.hasPrevPage||e[3]!==n.limit||e[4]!==n.nextPage||e[5]!==n.page||e[6]!==n.pagingCounter||e[7]!==n.prevPage||e[8]!==n.totalDocs||e[9]!==n.totalPages||e[10]!==r||e[11]!==s||e[12]!==l||e[13]!==i||e[14]!==a?(c=tv("div",{className:ov,children:[o,tv("div",{className:`${ov}__inner`,children:[qw(Yw,{hasNextPage:n.hasNextPage,hasPrevPage:n.hasPrevPage,limit:n.limit,nextPage:n.nextPage,numberOfNeighbors:1,onChange:r,page:n.page,prevPage:n.prevPage,totalPages:n.totalPages}),n.totalDocs>0&&tv("div",{className:`${ov}__per-page-container`,children:[tv("div",{className:`${ov}__page-info`,children:[n.page*n.limit-(n.limit-1),"-",n.totalPages>1&&n.totalPages!==n.page?n.limit*n.page:n.totalDocs," ",l.t("general:of")," ",n.totalDocs]}),qw(Jw,{handleChange:s,limit:i,limits:a,resetPage:n.totalDocs<=n.pagingCounter})]})]})]}),e[0]=o,e[1]=n.hasNextPage,e[2]=n.hasPrevPage,e[3]=n.limit,e[4]=n.nextPage,e[5]=n.page,e[6]=n.pagingCounter,e[7]=n.prevPage,e[8]=n.totalDocs,e[9]=n.totalPages,e[10]=r,e[11]=s,e[12]=l,e[13]=i,e[14]=a,e[15]=c):c=e[15],c},nv=t=>{let e=K9(10),{AfterPageControls:o,collectionConfig:n}=t,{data:r,defaultLimit:s,handlePageChange:i,handlePerPageChange:a,query:l}=bt(),c;e[0]!==s||e[1]!==l.limit?(c=lce(l.limit)?l.limit:s,e[0]=s,e[1]=l.limit,e[2]=c):c=e[2];let u=n?.admin?.pagination?.limits,d;return e[3]!==o||e[4]!==r||e[5]!==i||e[6]!==a||e[7]!==c||e[8]!==u?(d=qw(rv,{AfterPageControls:o,data:r,handlePageChange:i,handlePerPageChange:a,limit:c,limits:u}),e[3]=o,e[4]=r,e[5]=i,e[6]=a,e[7]=c,e[8]=u,e[9]=d):d=e[9],d};import{c as uce}from"react/compiler-runtime";import{jsx as dce}from"react/jsx-runtime";import"react";import{c as cce}from"react/compiler-runtime";import{jsx as eL,jsxs as Qw}from"react/jsx-runtime";import"react";var Kw="simple-pagination",zp=t=>{let e=cce(20),{data:o,onChange:n}=t,{i18n:r}=N(),{hasNextPage:s,hasPrevPage:i,limit:a,nextPage:l,page:c,pagingCounter:u,prevPage:d,totalDocs:f,totalPages:m}=o,p=s===void 0?!1:s,h=i===void 0?!1:i,g=c===void 0?1:c,b=m===void 0?1:m,v;e[0]!==g||e[1]!==h||e[2]!==n||e[3]!==d?(v=()=>{n&&h&&n(d??Math.max(1,g-1))},e[0]=g,e[1]=h,e[2]=n,e[3]=d,e[4]=v):v=e[4];let C=v,y;e[5]!==g||e[6]!==p||e[7]!==l||e[8]!==n?(y=()=>{n&&p&&n(l??g+1)},e[5]=g,e[6]=p,e[7]=l,e[8]=n,e[9]=y):y=e[9];let x=y;if(f===0)return null;let w=u??(g-1)*a+1,S=Math.min(w+a-1,f),_;return e[10]!==S||e[11]!==x||e[12]!==C||e[13]!==p||e[14]!==h||e[15]!==r||e[16]!==w||e[17]!==f||e[18]!==b?(_=Qw("div",{className:Kw,children:[Qw("span",{className:`${Kw}__info`,children:[w,"-",S," ",r.t("general:of")," ",f]}),b>1&&Qw("div",{className:`${Kw}__arrows`,children:[eL(fd,{direction:"left",isDisabled:!h,updatePage:C}),eL(fd,{direction:"right",isDisabled:!p,updatePage:x})]})]}),e[10]=S,e[11]=x,e[12]=C,e[13]=p,e[14]=h,e[15]=r,e[16]=w,e[17]=f,e[18]=b,e[19]=_):_=e[19],_};var mce=t=>{let e=uce(6),{data:o,groupByValue:n}=t,{refineListData:r}=bt(),s;e[0]!==n||e[1]!==r?(s=async l=>{await r({queryByGroup:{[n]:{page:l}}})},e[0]=n,e[1]=r,e[2]=s):s=e[2];let i=s,a;return e[3]!==o||e[4]!==i?(a=dce(zp,{data:o,onChange:i}),e[3]=o,e[4]=i,e[5]=a):a=e[5],a};import{c as fce}from"react/compiler-runtime";import{jsx as tL}from"react/jsx-runtime";import{formatAdminURL as pce}from"payload/shared";import"react";var hce="nav",gce=t=>{let e=fce(5),{tabIndex:o}=t,n=o===void 0?0:o,{t:r}=N(),{config:s}=G(),{admin:i,routes:a}=s,{routes:l}=i,{logout:c}=l,{admin:u}=a,d;return e[0]!==u||e[1]!==c||e[2]!==r||e[3]!==n?(d=tL(jt,{"aria-label":r("authentication:logOut"),className:`${hce}__log-out`,href:pce({adminRoute:u,path:c}),prefetch:!1,tabIndex:n,title:r("authentication:logOut"),children:tL(dp,{})}),e[0]=u,e[1]=c,e[2]=r,e[3]=n,e[4]=d):d=e[4],d};import{c as bce}from"react/compiler-runtime";import{jsx as oL}from"react/jsx-runtime";import"react";var vce=t=>{let e=bce(6),{baseClass:o}=t,{navOpen:n,setNavOpen:r}=nn(),s=`${o}__mobile-close`,i;e[0]!==r?(i=()=>{r(!1)},e[0]=r,e[1]=i):i=e[1];let a=n?void 0:-1,l;return e[2]!==s||e[3]!==i||e[4]!==a?(l=oL("button",{className:s,onClick:i,tabIndex:a,type:"button",children:oL(bw,{isActive:!0})}),e[2]=s,e[3]=i,e[4]=a,e[5]=l):l=e[5],l};import{c as yce}from"react/compiler-runtime";import{jsx as rL}from"react/jsx-runtime";import"react";var Cce=t=>{let e=yce(10),{baseClass:o,children:n}=t,{hydrated:r,navOpen:s,navRef:i}=nn(),a=s&&`${o}--nav-open`,l=r&&`${o}--nav-hydrated`,c;e[0]!==o||e[1]!==a||e[2]!==l?(c=[o,a,l].filter(Boolean),e[0]=o,e[1]=a,e[2]=l,e[3]=c):c=e[3];let u=c.join(" "),d=s?void 0:!0,f=`${o}__scroll`,m;return e[4]!==n||e[5]!==i||e[6]!==u||e[7]!==d||e[8]!==f?(m=rL("aside",{className:u,inert:d,children:rL("div",{className:f,ref:i,children:n})}),e[4]=n,e[5]=i,e[6]=u,e[7]=d,e[8]=f,e[9]=m):m=e[9],m};import{c as xce}from"react/compiler-runtime";import{jsx as eS}from"react/jsx-runtime";import{Fragment as wce}from"react";var Sce="settings-menu-button",_ce=t=>{let e=xce(3),{settingsMenu:o}=t,{t:n}=N();if(!o||o.length===0)return null;let r;return e[0]!==o||e[1]!==n?(r=eS(Ve,{button:eS(Ma,{ariaLabel:n("general:menu")}),className:Sce,horizontalAlign:"left",id:"settings-menu",size:"small",verticalAlign:"bottom",children:o.map(Ice)}),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};function Ice(t,e){return eS(wce,{children:t},`settings-menu-item-${e}`)}import{c as Pce}from"react/compiler-runtime";import{jsx as yc}from"react/jsx-runtime";import{getTranslation as Fce}from"@payloadcms/translations";import{EntityType as sL,formatAdminURL as iL}from"payload/shared";import{Fragment as Nce}from"react";import{c as Rce}from"react/compiler-runtime";import{jsx as Gp,jsxs as nL}from"react/jsx-runtime";import{PREFERENCE_KEYS as Tce}from"payload/shared";import Dce,{useState as Ace}from"react";var vc="nav-group",tS=t=>{let e=Rce(21),{children:o,isOpen:n,label:r}=t,[s,i]=Ace(typeof n<"u"?!n:!1),{setPreference:a}=Jt(),{navOpen:l}=nn();if(r){let u;e[0]!==s||e[1]!==r||e[2]!==a?(u=()=>{let S={};S?.[r]?S[r].open=!!s:S[r]={open:!!s},a(Tce.NAV,{groups:S},!0),i(!s)},e[0]=s,e[1]=r,e[2]=a,e[3]=u):u=e[3];let d=u,f=`${r}`,m=s&&`${vc}--collapsed`,p;e[4]!==f||e[5]!==m?(p=[`${vc}`,f,m].filter(Boolean),e[4]=f,e[5]=m,e[6]=p):p=e[6];let h=p.join(" "),g=`nav-group-${r}`,b=`${vc}__toggle--${s?"collapsed":"open"}`,v;e[7]!==b?(v=[`${vc}__toggle`,b].filter(Boolean),e[7]=b,e[8]=v):v=e[8];let C=v.join(" "),y=l?0:-1,x=s?"right":"down",w;return e[9]!==o||e[10]!==s||e[11]!==r||e[12]!==y||e[13]!==x||e[14]!==h||e[15]!==g||e[16]!==C||e[17]!==d?(w=nL("div",{className:h,id:g,children:[nL("button",{className:C,onClick:d,tabIndex:y,type:"button",children:[Gp("div",{className:`${vc}__indicator`,children:Gp(ve,{direction:x,size:16})}),Gp("div",{className:`${vc}__label`,children:r})]}),!s&&Gp("div",{className:`${vc}__content`,children:o})]}),e[9]=o,e[10]=s,e[11]=r,e[12]=y,e[13]=x,e[14]=h,e[15]=g,e[16]=C,e[17]=d,e[18]=w):w=e[18],w}let c;return e[19]!==o?(c=Gp(Dce.Fragment,{children:o}),e[19]=o,e[20]=c):c=e[20],c};var Wp="nav",Ece=t=>{let e=Pce(11),{groups:o,navPreferences:n}=t,r=Ao(),{config:s}=G(),{routes:i}=s,{admin:a}=i,{i18n:l}=N(),c;if(e[0]!==a||e[1]!==o||e[2]!==l||e[3]!==n?.groups||e[4]!==r){let u;e[6]!==a||e[7]!==l||e[8]!==n?.groups||e[9]!==r?(u=(d,f)=>{let{entities:m,label:p}=d;return yc(tS,{isOpen:n?.groups?.[p]?.open,label:p,children:m.map((h,g)=>{let{slug:b,type:v,label:C}=h,y,x;v===sL.collection&&(y=iL({adminRoute:a,path:`/collections/${b}`}),x=`nav-${b}`),v===sL.global&&(y=iL({adminRoute:a,path:`/globals/${b}`}),x=`nav-global-${b}`);let w=r.startsWith(y)&&["/",void 0].includes(r[y.length]),S=`${Wp}__link${w?` ${Wp}__link--selected`:""}`,_=yc("span",{className:`${Wp}__link-label`,children:Fce(C,l)});return r===y?yc("div",{className:`${Wp}__link-wrapper`,children:yc("div",{className:S,id:x,children:_})},g):yc("div",{className:`${Wp}__link-wrapper`,children:yc(jt,{className:S,href:y,id:x,prefetch:!1,children:_})},g)})},f)},e[6]=a,e[7]=l,e[8]=n?.groups,e[9]=r,e[10]=u):u=e[10],c=yc(Nce,{children:o.map(u)}),e[0]=a,e[1]=o,e[2]=l,e[3]=n?.groups,e[4]=r,e[5]=c}else c=e[5];return c};import{jsx as ki,jsxs as sS,Fragment as jce}from"react/jsx-runtime";import{PREFERENCE_KEYS as kce}from"payload/shared";import Mce,{useCallback as sv,useRef as aL,useState as iv}from"react";import{c as Lce}from"react/compiler-runtime";import{jsx as oS,jsxs as $ce}from"react/jsx-runtime";import"react";var rS="sidebar-tab-error",nS=t=>{let e=Lce(4),{message:o,onRetry:n}=t,{t:r}=N(),s;return e[0]!==o||e[1]!==n||e[2]!==r?(s=oS("div",{className:rS,children:$ce("div",{className:`${rS}__content`,children:[oS("span",{children:o}),oS("button",{className:`${rS}__retry`,onClick:n,type:"button",children:r("general:retry")})]})}),e[0]=o,e[1]=n,e[2]=r,e[3]=s):s=e[3],s};var Bce=({baseClass:t,initialActiveTabID:e,initialTabContents:o,loadingDelay:n=200,tabs:r})=>{let{setPreference:s}=Jt(),{serverFunction:i}=ct(),[a,l]=iv(e),[c,u]=iv(o),[d,f]=iv(null),[m,p]=iv(null),h=aL(new Set),g=aL(o);Mce.useEffect(()=>{g.current={...g.current,...o},u(w=>({...w,...o}))},[o]);let b=sv(async(w,{revalidate:S=!1}={})=>{let _=!!g.current[w];if(!(_&&!S||h.current.has(w))){h.current.add(w),_||f(w);try{let I=await i({name:"render-tab",args:{tabSlug:w}}),A={...g.current,[w]:I.component};g.current=A,u(A)}catch(I){if(_&&S)return;let A=I instanceof Error?I.message:"Unknown error",D=()=>{let R={...g.current};delete R[w],g.current=R,u(R),b(w)},T={...g.current,[w]:ki(nS,{message:A,onRetry:D})};g.current=T,u(T)}finally{h.current.delete(w),f(null)}}},[i]),v=sv(w=>{let S={...g.current};delete S[w],g.current=S,u(S),b(w)},[b]),C=sv(w=>{l(w),s(kce.NAV_SIDEBAR_ACTIVE_TAB,{activeTab:w});let S=r.find(_=>_.slug===w);b(w,{revalidate:S?.lazyLoadable??!1})},[s,b,r]),y=sv((w,S)=>{if(w.key==="ArrowLeft"||w.key==="ArrowRight"){w.preventDefault();let _=w.key==="ArrowLeft"?-1:1,I=(S+_+r.length)%r.length,A=r[I];C(A.slug),setTimeout(()=>{document.querySelector(`.${t}__tab--active`)?.focus()},0)}},[t,C,r]),x=c[a];return r.length===1?ki(jce,{children:x}):ki(G2,{activeTabSlug:a,reloadTabContent:v,children:sS("div",{className:t,children:[ki("div",{className:`${t}__tabs`,role:"tablist",children:r.map((w,S)=>{let _=w.slug===a;return sS("button",{"aria-selected":_,className:`${t}__tab ${_?`${t}__tab--active`:""}`,onClick:()=>C(w.slug),onKeyDown:I=>y(I,S),onMouseEnter:()=>p(w.slug),onMouseLeave:()=>p(null),role:"tab",tabIndex:_?0:-1,type:"button",children:[ki(io,{className:`${t}__tooltip`,position:"bottom",show:m===w.slug,children:w.label}),ki("span",{className:`${t}__tab-icon`,children:w.icon}),ki("span",{className:`${t}__tab-label`,children:w.label})]},w.slug)})}),sS("div",{className:`${t}__content`,role:"tabpanel",children:[ki(ac,{baseClass:t,delay:n,isLoading:d===a}),r.map(w=>{let S=c[w.slug];if(!S)return null;let _=w.slug===a&&d!==a;return ki("div",{style:_?void 0:{display:"none"},children:S},w.slug)})]})]})})};var Oce=t=>{let{children:e}=t,{id:o,collectionSlug:n,globalSlug:r}=be();return n&&(o!=="create"?o:null)||r?e:null};import{c as Vce}from"react/compiler-runtime";import{jsx as Hce}from"react/jsx-runtime";import{formatAdminURL as zce}from"payload/shared";import"react";var Gce=t=>{let e=Vce(13),{adminRoute:o,ariaLabel:n,baseClass:r,children:s,href:i,isActive:a,newTab:l}=t,c=Ao(),u=Gv(),f=lt().get("locale"),[m,p,h,g]=u.segments||[],b=m==="collections",v=`/${b?"collections":"globals"}/${p}`,C;e[0]!==o||e[1]!==v?(C=zce({adminRoute:o,path:v}),e[0]=o,e[1]=v,e[2]=C):C=e[2];let y=C;b&&(h==="trash"&&g?y=y+`/trash/${g}`:h&&(y=y+`/${h}`));let x=`${y}${i}`,w=`${x}${f?`?locale=${f}`:""}`,S;if(e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==y||e[7]!==x||e[8]!==w||e[9]!==a||e[10]!==l||e[11]!==c){let _=x===y&&c===y||x!==y&&c.startsWith(x)||a;S=Hce(Z,{"aria-label":n,buttonStyle:_?"pill":"ghost",className:[r,_&&`${r}--active`].filter(Boolean).join(" "),disabled:_,el:!_||x!==c?"link":"div",margin:!1,newTab:l,size:"medium",to:!_||x!==c?w:void 0,children:s}),e[3]=n,e[4]=r,e[5]=s,e[6]=y,e[7]=x,e[8]=w,e[9]=a,e[10]=l,e[11]=c,e[12]=S}else S=e[12];return S};import{c as Wce}from"react/compiler-runtime";import{jsx as Uce}from"react/jsx-runtime";import"react";var Xce="pill-version-count",Zce=()=>{let t=Wce(2),{versionCount:e}=be();if(!e)return null;let o;return t[0]!==e?(o=Uce("span",{className:Xce,children:e}),t[0]=e,t[1]=o):o=t[1],o};import{c as Yce}from"react/compiler-runtime";import{jsx as Jce}from"react/jsx-runtime";import"react";var qce=t=>{let e=Yce(8),{baseClass:o,children:n,className:r}=t,{hydrated:s,navOpen:i}=nn(),a=i&&`${o}--nav-open`,l=s&&`${o}--nav-hydrated`,c;e[0]!==o||e[1]!==r||e[2]!==a||e[3]!==l?(c=[o,r,a,l].filter(Boolean),e[0]=o,e[1]=r,e[2]=a,e[3]=l,e[4]=c):c=e[4];let u=c.join(" "),d;return e[5]!==n||e[6]!==u?(d=Jce("div",{className:u,children:n}),e[5]=n,e[6]=u,e[7]=d):d=e[7],d};import{jsx as lL,jsxs as Qce}from"react/jsx-runtime";import"react";var Kce="form-header";function hd({description:t,heading:e}){return e?Qce("div",{className:Kce,children:[lL("h1",{children:e}),!!t&&lL("p",{children:t})]}):null}import{jsx as cL}from"react/jsx-runtime";import{useCallback as eue,useMemo as uL}from"react";var tue=({options:t,parentFieldName:e,...o})=>{let{field:n,field:{name:r,admin:{className:s,isClearable:i=!0,isSortable:a=!0,placeholder:l}={},hasMany:c=!1,label:u,localized:d,required:f},onChange:m,path:p,readOnly:h,validate:g}=o,{allowedCollections:b}=No(),v=uL(()=>!b||b.length===0?wf(t):wf(t.filter(L=>typeof L=="object"&&"value"in L&&L.value?b.some(M=>M.slug===L.value):!0)),[t,b]),{customComponents:{AfterInput:C,BeforeInput:y,Description:x,Error:w,Label:S}={},disabled:_,path:I,selectFilterOptions:A,setValue:D,showError:T,value:R}=Ne({potentiallyStalePath:p,validate:g}),P=eue(L=>{if(h||_)return;let M=null;L&&c?Array.isArray(L)?M=L.map($=>$.value):M=[]:L&&!Array.isArray(L)&&(M=L.value),typeof m=="function"&&m(M),D(M)},[h,_,c,D,m]),E=uL(()=>st(n),[n]),F=f||Array.isArray(b)&&b.length>0;return cL("div",{children:cL(_s,{AfterInput:C,BeforeInput:y,className:s,Description:x,description:"Select the collection types this item can contain",Error:w,filterOption:A?({value:L})=>A?.some(M=>(typeof M=="string"?M:M.value)===L):void 0,hasMany:c,isClearable:i,isSortable:a,Label:S,label:u,localized:d,name:r,onChange:P,options:v,path:I,placeholder:l,readOnly:h||_,required:F,showError:T,style:E,value:R})})};import{jsx as gd,jsxs as oue}from"react/jsx-runtime";import dL,{useMemo as rue,useRef as mL,useState as nue}from"react";var bd="combobox",sue=t=>{let{"aria-label":e,entries:o,minEntriesForSearch:n=8,onSelect:r,onToggleClose:s,onToggleOpen:i,searchPlaceholder:a="Search...",...l}=t,[c,u]=nue(""),d=mL(!1),f=mL(null),m=rue(()=>{if(!c)return o;let v=c.toLowerCase();return o.filter(C=>C.name.toLowerCase().includes(v))},[o,c]),p=o.length>=n,h=m.length>0,g=dL.useCallback(v=>{d.current=v,v&&p&&setTimeout(()=>{f.current?.focus()},100),i?.(v)},[p,i]),b=dL.useCallback(()=>{d.current=!1,u(""),s?.()},[s]);return gd(Ve,{...l,className:`${bd} ${l.className||""}`,onToggleClose:b,onToggleOpen:g,render:({close:v})=>oue("div",{className:`${bd}__content`,children:[p&&gd("div",{className:`${bd}__search-wrapper${h?"":` ${bd}__search-wrapper--no-results`}`,children:gd("input",{"aria-label":a,className:`${bd}__search-input`,onChange:C=>u(C.target.value),placeholder:a,ref:f,type:"text",value:c})}),gd(ue.ButtonGroup,{children:gd("div",{"aria-label":e,role:"menu",children:m.map((C,y)=>{let x=()=>{r&&r(C),v()};return gd("div",{className:`${bd}__entry`,"data-popup-prevent-close":!0,onClick:x,onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),x())},role:"menuitem",tabIndex:0,children:C.Component},`${C.name}-${y}`)})})})]})})};import{jsx as Ls,jsxs as Cc}from"react/jsx-runtime";import{useCallback as Xp,useEffect as yL,useId as mue,useMemo as lS,useRef as fue,useState as CL}from"react";import{c as iue}from"react/compiler-runtime";import{jsx as aue}from"react/jsx-runtime";import{createContext as lue,use as cue}from"react";var fL=lue({}),uue=t=>{let e=iue(6),{children:o,visibleEntities:n}=t,r;e[0]!==n?(r=a=>{let{collectionSlug:l,globalSlug:c}=a;return l?n.collections.includes(l):c?n.globals.includes(c):!1},e[0]=n,e[1]=r):r=e[1];let s=r,i;return e[2]!==o||e[3]!==s||e[4]!==n?(i=aue(fL,{value:{isEntityVisible:s,visibleEntities:n},children:o}),e[2]=o,e[3]=s,e[4]=n,e[5]=i):i=e[5],i},Up=()=>cue(fL);import{getTranslation as pL}from"@payloadcms/translations";import{formatAdminURL as aS}from"payload/shared";function iS({adminGroup:t,entityPermissions:e}){return t===!1?!1:!!e?.read}function hL({adminRoute:t,collections:e,globals:o,i18n:n,permissions:r,visibleEntities:s}){let i=e.filter(c=>iS({adminGroup:c.admin.group,entityPermissions:r?.collections?.[c.slug]})&&(!s?.collections||s.collections.includes(c.slug))).map(c=>{let u=!!r?.collections?.[c.slug]?.create;return{id:`collection-${c.slug}`,type:"collection",createHref:u?aS({adminRoute:t,path:`/collections/${c.slug}/create`}):void 0,href:aS({adminRoute:t,path:`/collections/${c.slug}`}),label:pL(c.labels.plural,n)}}),a=o.filter(c=>iS({adminGroup:c.admin.group,entityPermissions:r?.globals?.[c.slug]})&&(!s?.globals||s.globals.includes(c.slug))).map(c=>({id:`global-${c.slug}`,type:"global",href:aS({adminRoute:t,path:`/globals/${c.slug}`}),label:pL(c.label,n)})),l=[];return i.length>0&&l.push({actions:i,label:n.t("general:collections")}),a.length>0&&l.push({actions:a,label:n.t("general:globals")}),l}var due=t=>!!t&&/[a-z0-9]/i.test(t);function gL(t,e){if(!t)return{indices:[],score:0};let o=t.toLowerCase(),n=e.toLowerCase(),r=[],s=0,i=0,a=-1;for(let l=0;l<n.length&&i<o.length;l++)n[l]===o[i]&&(r.push(l),l===0?s+=12:due(e[l-1])||(s+=10),a===l-1?s+=8:a!==-1&&(s-=(l-a-1)*1),a=l,i++);return i<o.length?null:{indices:r,score:s}}function bL(t,e){return e?t.reduce((o,n)=>{let r=n.actions.map(s=>({action:s,match:gL(e,s.label)})).filter(s=>s.match!==null).sort((s,i)=>i.match.score-s.match.score).map(s=>({...s.action,matchIndices:s.match.indices}));return r.length>0&&o.push({...n,actions:r}),o},[]):t}function vL(t,e){if(!t)return[];if(!e||e.length===0)return[{isMatch:!1,text:t}];let o=new Set(e),n=[],r="",s=o.has(0);for(let i=0;i<t.length;i++){let a=o.has(i);a!==s?(r&&n.push({isMatch:s,text:r}),r=t[i],s=a):r+=t[i]}return r&&n.push({isMatch:s,text:r}),n}var Zp="command-palette",go="cmd-palette",pue=["k"],xL=t=>`${go}-option-${t.id}`,hue=()=>{let{closeModal:t,modalState:e,openModal:o}=ie(),n=Re(),{i18n:r,t:s}=N(),{permissions:i}=ye(),{visibleEntities:a}=Up(),{config:{collections:l,globals:c,routes:{admin:u}}}=G(),d=!!e[Zp]?.isOpen,[f,m]=CL(""),[p,h]=CL(0),g=fue(null),b=mue(),v=Xp(P=>{P.preventDefault(),o(Zp)},[o]);Ai({cmdCtrlKey:!0,editDepth:1,keyCodes:pue},v);let C=lS(()=>hL({adminRoute:u,collections:l,globals:c,i18n:r,permissions:i,visibleEntities:a}),[u,l,c,r,i,a]),y=lS(()=>bL(C,f),[C,f]),x=lS(()=>y.flatMap(P=>P.actions),[y]),w=Math.min(p,Math.max(0,x.length-1)),S=x[w],_=S?xL(S):null;yL(()=>{d&&(m(""),h(0),requestAnimationFrame(()=>g.current?.focus()))},[d]),yL(()=>{let P=_?document.getElementById(_):null;if(!P)return;let E=P.previousElementSibling;(E?.classList.contains(`${go}__group-label`)?E:P).scrollIntoView({block:"nearest"})},[_]);let I=Xp(()=>t(Zp),[t]),A=Xp(P=>{P.target===P.currentTarget&&I()},[I]),D=Xp((P,E)=>{if(!P)return;let F=E==="create"?P.createHref:P.href;F&&(I(),n.push(F))},[I,n]),T=Xp(P=>{let E=P.metaKey||P.ctrlKey;if(P.key==="Escape"||E&&P.key.toLowerCase()==="k"){P.preventDefault(),I();return}if(P.key==="ArrowDown"){P.preventDefault(),h(F=>Math.min(F+1,x.length-1));return}if(P.key==="ArrowUp"){P.preventDefault(),h(F=>Math.max(F-1,0));return}P.key==="Enter"&&(P.preventDefault(),D(S,E?"create":"navigate"))},[S,I,x.length,D]);if(!d)return null;let R=x.length>0;return Ls(En,{className:go,onClick:A,slug:Zp,children:Cc("div",{className:`${go}__inner`,onKeyDown:T,children:[Ls("input",{"aria-activedescendant":_??void 0,"aria-controls":b,"aria-expanded":d,"aria-label":s("commandPalette:title"),autoComplete:"off",className:`${go}__input`,onChange:P=>{m(P.target.value),h(0)},placeholder:s("commandPalette:placeholder"),ref:g,role:"combobox",spellCheck:!1,type:"text",value:f}),Cc("div",{"aria-label":s("commandPalette:title"),className:`${go}__results`,id:b,role:"listbox",children:[y.map((P,E)=>{let F=y.slice(0,E).reduce((L,M)=>L+M.actions.length,0);return Cc("div",{"aria-label":P.label,className:`${go}__group`,role:"group",children:[Ls("div",{"aria-hidden":"true",className:`${go}__group-label`,children:P.label}),P.actions.map((L,M)=>{let $=F+M,B=L===S;return Ls("div",{"aria-selected":B,className:[`${go}__option`,B&&`${go}__option--active`].filter(Boolean).join(" "),id:xL(L),onClick:()=>D(L,"navigate"),onMouseMove:()=>h($),role:"option",children:Ls("span",{className:`${go}__option-label`,children:vL(L.label,L.matchIndices).map((j,k)=>j.isMatch?Ls("strong",{className:`${go}__option-match`,children:j.text},k):j.text)})},L.id)})]},P.label)}),R?null:Ls("div",{"aria-live":"polite",className:`${go}__empty`,role:"status",children:s("commandPalette:noResults")})]}),S?Cc("div",{className:`${go}__footer`,children:[Cc("button",{className:`${go}__hint ${go}__hint--primary`,onClick:()=>D(S,"navigate"),type:"button",children:[s("commandPalette:hintSelect"),Ls("kbd",{className:`${go}__key`,children:"\u21B5"})]}),S.createHref?Cc("button",{className:`${go}__hint`,onClick:()=>D(S,"create"),type:"button",children:[s("commandPalette:hintCreate"),Cc("span",{className:`${go}__keys`,children:[Ls("kbd",{className:`${go}__key`,children:"\u2318"}),Ls("kbd",{className:`${go}__key`,children:"\u21B5"})]})]}):null]}):null]})})};import{c as gue}from"react/compiler-runtime";import{jsx as av}from"react/jsx-runtime";import{formatAdminURL as bue}from"payload/shared";import{Fragment as vue}from"react";var lv="render-title",cS=t=>{let e=gue(14),{className:o,element:n,fallback:r,renderAsLink:s,title:i}=t,a=n===void 0?"h1":n,{id:l,collectionSlug:c,globalSlug:u,isInitializing:d}=be(),{title:f}=zo(),{config:m}=G(),{routes:p}=m,{admin:h}=p,g=i||f||r,b=g===l,v=a,C;if(e[0]!==v||e[1]!==h||e[2]!==o||e[3]!==c||e[4]!==u||e[5]!==l||e[6]!==b||e[7]!==d||e[8]!==s||e[9]!==g){let y=av(vue,{children:"\xA0"}),x=s&&l&&(c||u)?bue({adminRoute:h,path:`/${c?`collections/${c}`:`globals/${u}`}/${l}`}):null,w=b&&`${lv}--has-id`,S;e[11]!==o||e[12]!==w?(S=[o,lv,w].filter(Boolean),e[11]=o,e[12]=w,e[13]=S):S=e[13],C=av(v,{className:S.join(" "),"data-doc-id":l,title:g,children:d?y:b?av(vw,{className:`${lv}__id`,id:l}):x?av(jt,{className:`${lv}__link`,href:x,children:g||y}):g||y}),e[0]=v,e[1]=h,e[2]=o,e[3]=c,e[4]=u,e[5]=l,e[6]=b,e[7]=d,e[8]=s,e[9]=g,e[10]=C}else C=e[10];return C};import{c as yue}from"react/compiler-runtime";import{jsx as vd,jsxs as wL}from"react/jsx-runtime";import"react";var os="sort-column",Cue=t=>{let e=yue(20),{name:o,appearance:n,disable:r,Label:s,label:i}=t,a=r===void 0?!1:r,{handleSortChange:l,query:c}=bt(),{t:u}=N(),{sort:d}=c,f=`-${o}`,m=o,p;e[0]!==m||e[1]!==d?(p=[`${os}__asc`],d===m&&p.push(`${os}--active`),e[0]=m,e[1]=d,e[2]=p):p=e[2];let h;e[3]!==f||e[4]!==d?(h=[`${os}__desc`],d===f&&h.push(`${os}--active`),e[3]=f,e[4]=d,e[5]=h):h=e[5];let g=d===m||d===f,b=n&&`${os}--appearance-${n}`,v=g&&`${os}--sorted`,C;e[6]!==b||e[7]!==v?(C=[os,b,v].filter(Boolean),e[6]=b,e[7]=v,e[8]=C):C=e[8];let y=C.join(" "),x;return e[9]!==s||e[10]!==m||e[11]!==p||e[12]!==f||e[13]!==h||e[14]!==a||e[15]!==l||e[16]!==i||e[17]!==u||e[18]!==y?(x=wL("div",{className:y,children:[vd("span",{className:`${os}__label`,children:s??vd(Fe,{hideLocale:!0,label:i,unstyled:!0})}),!a&&wL("div",{className:`${os}__buttons`,children:[vd("button",{"aria-label":u("general:sortByLabelDirection",{direction:u("general:descending"),label:i}),className:[...h,`${os}__button`].filter(Boolean).join(" "),onClick:()=>{l(f)},type:"button",children:vd(ve,{size:16})}),vd("button",{"aria-label":u("general:sortByLabelDirection",{direction:u("general:ascending"),label:i}),className:[...p,`${os}__button`].filter(Boolean).join(" "),onClick:()=>{l(m)},type:"button",children:vd(ve,{direction:"up",size:16})})]})]}),e[9]=s,e[10]=m,e[11]=p,e[12]=f,e[13]=h,e[14]=a,e[15]=l,e[16]=i,e[17]=u,e[18]=y,e[19]=x):x=e[19],x};import{jsx as $s,jsxs as IL}from"react/jsx-runtime";import{getTranslation as yd}from"@payloadcms/translations";import{toWords as DL}from"payload/shared";import{useEffect as RL,useMemo as _ue,useState as TL}from"react";import{c as xue}from"react/compiler-runtime";import{jsx as uS,jsxs as wue}from"react/jsx-runtime";import{useId as Sue}from"react";var SL="item-search",_L=t=>{let e=xue(7),{placeholder:o,setSearchTerm:n}=t,r=Sue(),s=`${r}-label`,i;e[0]!==n?(i=c=>{n(c.target.value)},e[0]=n,e[1]=i):i=e[1];let a=i,l;return e[2]!==a||e[3]!==r||e[4]!==s||e[5]!==o?(l=wue("div",{className:SL,children:[uS("label",{className:"sr-only",htmlFor:r,id:s,children:o}),uS(Cl,{}),uS("input",{"aria-labelledby":s,className:`${SL}__input`,id:r,onChange:a,placeholder:o,type:"text"})]}),e[2]=a,e[3]=r,e[4]=s,e[5]=o,e[6]=l):l=e[6],l};var Za="items-drawer",Iue=(t,e)=>{if("labels"in t&&t.labels?.singular){if(typeof t.labels.singular=="string")return t.labels.singular.toLowerCase();if(typeof t.labels.singular=="object")return yd(t.labels.singular,e).toLowerCase()}if("label"in t&&t.label){if(typeof t.label=="string")return t.label.toLowerCase();if(typeof t.label=="object")return yd(t.label,e).toLowerCase()}return"slug"in t?DL(t.slug).toLowerCase():""};var Rue=t=>{if("admin"in t&&t?.admin?.images?.thumbnail){let e=t.admin?.images.thumbnail;return{imageAltText:typeof e=="string"?void 0:e.alt,imageURL:typeof e=="string"?e:e.url}}return"imageURL"in t?{imageAltText:t.imageAltText,imageURL:t.imageURL}:{imageAltText:void 0,imageURL:void 0}},Tue=(t,e)=>{if("labels"in t&&t.labels?.singular)return yd(t.labels.singular,e);if("label"in t&&t.label){if(typeof t.label=="string")return t.label;if(typeof t.label=="object")return yd(t.label,e)}return DL(t.slug)},dS=t=>{let{addRowIndex:e,drawerSlug:o,items:n,labels:r,onItemClick:s,searchPlaceholder:i,title:a}=t,[l,c]=TL(""),[u,d]=TL(n),{closeModal:f,isModalOpen:m}=ie(),{i18n:p,t:h}=N(),{config:g}=G(),b=_ue(()=>{let C={_none:[]};return u.forEach(y=>{if(typeof y=="object"&&"admin"in y&&y.admin?.group){let x=y.admin.group,w=typeof x=="string"?x:yd(x,p);Object.hasOwn(C,w)?C[w].push(y):C[w]=[y]}else C._none.push(y)}),C},[u,p]);RL(()=>{m(o)||c("")},[m,o]),RL(()=>{let C=l.toLowerCase(),y=n?.reduce((x,w)=>{let S;return typeof w=="string"?S=g.blocksMap?.[w]:S=w,S&&Iue(S,p).includes(C)&&x.push(S),x},[]);d(y||[])},[l,n,p,g.blocksMap]);let v=a||(r?h("fields:addLabel",{label:yd(r.singular,p)}):h("fields:addNew"));return IL(It,{slug:o,title:v,children:[$s(_L,{placeholder:i||h("fields:searchForBlock"),setSearchTerm:c}),$s("div",{className:`${Za}__items-wrapper`,children:$s("ul",{className:`${Za}__item-groups`,children:Object.entries(b).map(([C,y])=>y.length?IL("li",{className:[`${Za}__item-group`,C==="_none"&&`${Za}__item-group-none`].filter(Boolean).join(" "),children:[C!=="_none"&&$s("h3",{className:`${Za}__item-group-label`,children:C}),$s("ul",{className:`${Za}__items`,children:y.map((x,w)=>{let S=typeof x=="string"?g.blocksMap?.[x]:x;if(!S)return null;let{imageAltText:_,imageURL:I}=Rue(S),A=Tue(S,p);return $s("li",{className:`${Za}__item`,children:$s(Cm,{alignLabel:"center",label:A,onClick:()=>{s(S,e),f(o)},thumbnail:$s("div",{className:`${Za}__default-image`,children:I?$s("img",{alt:_,src:I}):$s(xm,{})})})},w)})})]},C):null)})})]})};var Due=()=>null;import{c as Pue}from"react/compiler-runtime";import{jsx as Mi,jsxs as cv}from"react/jsx-runtime";import{getTranslation as PL}from"@payloadcms/translations";import{useState as Fue}from"react";import{jsx as AL}from"react/jsx-runtime";import"react";var Aue={16:"M5 5a3 3 0 0 1 6 0v2.025c.57.116 1 .62 1 1.225v3.5c0 .69-.56 1.25-1.25 1.25h-5.5C4.56 13 4 12.44 4 11.75v-3.5C4 7.56 4.56 7 5.25 7H10V5a2 2 0 1 0-4 0 .5.5 0 0 1-1 0m.25 3a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h5.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25z",24:"M9 7a3 3 0 1 1 6 0v.5a.5.5 0 0 0 1 0V7a4 4 0 0 0-8 0v3h-.125C6.839 10 6 10.84 6 11.875v5.25C6 18.16 6.84 19 7.875 19h8.25C17.16 19 18 18.16 18 17.125v-5.25C18 10.839 17.16 10 16.125 10H9zm-2 4.875c0-.483.392-.875.875-.875h8.25c.483 0 .875.392.875.875v5.25a.875.875 0 0 1-.875.875h-8.25A.875.875 0 0 1 7 17.125z"},mS=({className:t,size:e=24})=>AL("svg",{className:["icon","icon--lock-open",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:AL("path",{className:"fill",clipRule:"evenodd",d:Aue[e],fillRule:"evenodd"})});var js="slug-field-component",Nue=t=>{let e=Pue(17),{field:o,path:n,useAsSlug:r}=t,{admin:s,label:i,required:a}=o,{description:l,placeholder:c,readOnly:u}=s||{},{i18n:d,t:f}=N(),{collectionSlug:m,globalSlug:p}=be(),{slugify:h}=ct(),g=n||o.name,b;e[0]!==g?(b={path:g},e[0]=g,e[1]=b):b=e[1];let{path:v,setValue:C,showError:y,value:x}=Ne(b),{getData:w,getDataByPath:S}=Ge(),[_,I]=Fue(!0),A;e[2]!==m||e[3]!==v||e[4]!==w||e[5]!==S||e[6]!==p||e[7]!==C||e[8]!==h||e[9]!==r||e[10]!==x?(A=async k=>{k.preventDefault();let O=S(r),V=await h({collectionSlug:m,data:w(),globalSlug:p,path:v,valueToSlugify:O});if(V==null){C("");return}x!==V&&C(V)},e[2]=m,e[3]=v,e[4]=w,e[5]=S,e[6]=p,e[7]=C,e[8]=h,e[9]=r,e[10]=x,e[11]=A):A=e[11];let D=A,T;e[12]===Symbol.for("react.memo_cache_sentinel")?(T=k=>{k.preventDefault(),I(Eue)},e[12]=T):T=e[12];let R=T,P;e[13]!==C?(P=k=>{C(k.target.value)},e[13]=C,e[14]=P):P=e[14];let E=P,F=!!(u||_),L=["field-type",js,y&&`${js}--error`,_&&`${js}--locked`,u&&`${js}--read-only`].filter(Boolean).join(" "),M=Mi(Fe,{htmlFor:`field-${v}`,label:i,required:a}),$=Mi(tt,{path:v,showError:y}),B=y&&"form-input-group-error",j;return e[15]!==B?(j=["form-input-group",`${js}__input-container`,B].filter(Boolean),e[15]=B,e[16]=j):j=e[16],cv("div",{className:L,children:[M,cv("div",{className:`${js}__wrap`,children:[$,cv("div",{className:j.join(" "),children:[Mi("input",{"aria-label":PL(i,d)||n,className:`form-input ${js}__input`,disabled:F,id:`field-${v?.replace(/\./g,"__")}`,name:v,onChange:E,placeholder:PL(c,d),type:"text",value:x||""}),!u&&cv("div",{className:`${js}__actions`,children:[!_&&Mi(Z,{"aria-label":f("authentication:generate"),buttonStyle:"ghost",className:`${js}__action-btn`,icon:Mi(Lp,{}),id:`field-${v?.replace(/\./g,"__")}-generate`,margin:!1,onClick:D}),Mi(Z,{"aria-label":f(_?"general:unlock":"general:lock"),buttonStyle:"ghost",className:`${js}__action-btn`,icon:_?Mi(Dp,{size:16}):Mi(mS,{size:16}),id:`field-${v?.replace(/\./g,"__")}-lock`,margin:!1,onClick:R})]})]}),Mi(Xe,{description:l,path:v})]})]})};function Eue(t){return!t}import{jsx as FL,jsxs as Lue}from"react/jsx-runtime";import"react";var $ue=({fill:t})=>{let e=t||"var(--theme-elevation-1000)";return Lue("svg",{className:"graphic-icon",height:"100%",viewBox:"0 0 25 25",width:"100%",xmlns:"http://www.w3.org/2000/svg",children:[FL("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:e}),FL("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:e})]})};import{jsx as NL}from"react/jsx-runtime";import"react";var jue={16:"M4.854 4.146a.5.5 0 1 0-.708.708L7.293 8l-3.147 3.146a.5.5 0 0 0 .708.708L8 8.707l3.146 3.147a.5.5 0 0 0 .708-.708L8.707 8l3.147-3.146a.5.5 0 0 0-.708-.708L8 7.293z",24:"M17.354 6.646a.5.5 0 0 1 0 .708L12.707 12l4.647 4.646a.5.5 0 0 1-.708.708L12 12.707l-4.646 4.647a.5.5 0 0 1-.708-.708L11.293 12 6.646 7.354a.5.5 0 0 1 .708-.707L12 11.293l4.646-4.647a.5.5 0 0 1 .708 0"},kue=({className:t,size:e=24})=>NL("svg",{className:["icon","icon--close-menu",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:NL("path",{clipRule:"evenodd",d:jue[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as EL}from"react/jsx-runtime";import"react";var Mue={16:"M6.646 6.146a.5.5 0 1 0 .708.708l1.5-1.5a.5.5 0 0 0 0-.708l-1.5-1.5a.5.5 0 1 0-.708.708L7.793 5zm-1.292-3a.5.5 0 0 1 0 .708L4.207 5l1.147 1.146a.5.5 0 1 1-.708.708l-1.5-1.5a.5.5 0 0 1 0-.708l1.5-1.5a.5.5 0 0 1 .708 0M10.5 3h1A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5v-3a.5.5 0 0 1 1 0v3a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 1 0-1",24:"M7.354 4.146a.5.5 0 0 1 0 .708L5.207 7l2.147 2.146a.5.5 0 1 1-.708.708l-2.5-2.5a.5.5 0 0 1 0-.708l2.5-2.5a.5.5 0 0 1 .708 0M14 4.5a.5.5 0 0 1 .5-.5H18a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-6.5a.5.5 0 0 1 1 0V18a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-3.5a.5.5 0 0 1-.5-.5m-4.354.354a.5.5 0 1 1 .708-.708l2.5 2.5a.5.5 0 0 1 0 .708l-2.5 2.5a.5.5 0 0 1-.708-.708L11.793 7z"},Bue=({className:t,size:e=24})=>EL("svg",{className:["icon","icon--code-block",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:EL("path",{clipRule:"evenodd",d:Mue[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as LL}from"react/jsx-runtime";import"react";var Oue={16:"M4 3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V9a.5.5 0 0 0-1 0v3H4V4h3a.5.5 0 0 0 0-1H4zm5-.5a.5.5 0 0 1 .5-.5H13a.5.5 0 0 1 .5.5V6a.5.5 0 0 1-1 0V3.707l-4.646 4.647a.5.5 0 1 1-.708-.708L11.793 3H9.5a.5.5 0 0 1-.5-.5",24:"M6 5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-4a.5.5 0 0 0-1 0v4H6V6h4a.5.5 0 0 0 0-1H6zm7-.5a.5.5 0 0 1 .5-.5H19a.5.5 0 0 1 .5.5V10a.5.5 0 0 1-1 0V5.707l-6.646 6.647a.5.5 0 0 1-.708-.708L17.793 5H13.5a.5.5 0 0 1-.5-.5"},Yp=({className:t,size:e=24})=>LL("svg",{className:["icon","icon--external-link",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:LL("path",{clipRule:"evenodd",d:Oue[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as $L}from"react/jsx-runtime";import"react";var Vue={16:"M4 3.5a.5.5 0 0 1 .5-.5H6a.5.5 0 0 1 0 1H4.5V5.5a.5.5 0 0 1-1 0V3.5zM12 3.5a.5.5 0 0 1 .5-.5h1.5a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0V4h-1a.5.5 0 0 1-.5-.5zM4 10.5a.5.5 0 0 1 1 0V12h1.5a.5.5 0 0 1 0 1H4.5a.5.5 0 0 1-.5-.5v-2zm9.5 0a.5.5 0 0 1 1 0v2a.5.5 0 0 1-.5.5H12a.5.5 0 0 1 0-1h1V10.5z",24:"M10.1465 13.1465C10.3417 12.9512 10.6583 12.9512 10.8535 13.1465C11.0488 13.3417 11.0488 13.6583 10.8535 13.8535L7.70703 17H10.5C10.7761 17 11 17.2239 11 17.5C11 17.7761 10.7761 18 10.5 18H6.5C6.22386 18 6 17.7761 6 17.5V13.5C6 13.2239 6.22386 13 6.5 13C6.77614 13 7 13.2239 7 13.5V16.293L10.1465 13.1465ZM17.5 6C17.7761 6 18 6.22386 18 6.5V10.5C18 10.7761 17.7761 11 17.5 11C17.2239 11 17 10.7761 17 10.5V7.70703L13.8535 10.8535C13.6583 11.0488 13.3417 11.0488 13.1465 10.8535C12.9512 10.6583 12.9512 10.3417 13.1465 10.1465L16.293 7H13.5C13.2239 7 13 6.77614 13 6.5C13 6.22386 13.2239 6 13.5 6H17.5Z"},Hue={16:"M6 3a.5.5 0 0 1 .5.5V5a.5.5 0 0 1-.5.5H4.5a.5.5 0 0 1 0-1H5V3.5A.5.5 0 0 1 5.5 3H6zm4.5 0a.5.5 0 0 1 .5.5V4h1a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H10a.5.5 0 0 1-.5-.5V3.5a.5.5 0 0 1 .5-.5zM6 10a.5.5 0 0 1 .5.5V11H5v-.5a.5.5 0 0 1 .5-.5h.5a.5.5 0 0 0-.5.5V12a.5.5 0 0 1-.5.5H4.5a.5.5 0 0 1 0-1H5v-.5a.5.5 0 0 1 .5-.5H6zm4.5.5a.5.5 0 0 1 .5-.5h1.5a.5.5 0 0 1 0 1H12v1a.5.5 0 0 1-1 0v-1.5z",24:"M10.5 13C10.7761 13 11 13.2239 11 13.5V17.5C11 17.7761 10.7761 18 10.5 18C10.2239 18 10 17.7761 10 17.5V14.707L6.85352 17.8535C6.65825 18.0488 6.34175 18.0488 6.14648 17.8535C5.95122 17.6583 5.95122 17.3417 6.14648 17.1465L9.29297 14H6.5C6.22386 14 6 13.7761 6 13.5C6 13.2239 6.22386 13 6.5 13H10.5ZM17.1465 6.14648C17.3417 5.95122 17.6583 5.95122 17.8535 6.14648C18.0488 6.34175 18.0488 6.65825 17.8535 6.85352L14.707 10H17.5C17.7761 10 18 10.2239 18 10.5C18 10.7761 17.7761 11 17.5 11H13.5C13.2239 11 13 10.7761 13 10.5V6.5C13 6.22386 13.2239 6 13.5 6C13.7761 6 14 6.22386 14 6.5V9.29297L17.1465 6.14648Z"},fS=({className:t,isMinimized:e,size:o=24})=>{let n=e?Vue[o]:Hue[o];return $L("svg",{className:["icon","icon--minimize-maximize",e?"icon--minimize-maximize--minimized":"icon--minimize-maximize--maximized",t].filter(Boolean).join(" "),fill:"none",height:o,viewBox:`0 0 ${o} ${o}`,width:o,xmlns:"http://www.w3.org/2000/svg",children:$L("path",{clipRule:"evenodd",d:n,fill:"currentColor",fillRule:"evenodd"})})};import{jsx as jL}from"react/jsx-runtime";import"react";var zue={16:"M8.098 2.51a.5.5 0 0 1 .256.136l4 4A.5.5 0 0 1 12 7.5H8a.5.5 0 0 1-.5-.5V3.5H5a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h6a.5.5 0 0 0 .5-.5V9a.5.5 0 0 1 1 0v3a1.5 1.5 0 0 1-1.5 1.5H5A1.5 1.5 0 0 1 3.5 12V4A1.5 1.5 0 0 1 5 2.5h3zM8.5 6.5h2.293L8.5 4.207z",24:"M12.598 5.01a.5.5 0 0 1 .255.136l4 4A.5.5 0 0 1 16.5 10h-4a.5.5 0 0 1-.5-.5V6H8.5a.5.5 0 0 0-.5.5v11a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-6a.5.5 0 0 1 1 0v6a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 7 17.5v-11A1.5 1.5 0 0 1 8.5 5h4zM13 9h2.293L13 6.707z"},pS=({className:t,size:e=24})=>jL("svg",{className:["icon","icon--document",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:jL("path",{clipRule:"evenodd",d:zue[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as kL}from"react/jsx-runtime";import"react";var Gue={16:"M3 5a1 1 0 0 1 1-1h2.618a1 1 0 0 1 .894.553L8.118 6H12a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5zm1 0v7h8V7H7.882a1 1 0 0 1-.894-.553L6.382 5H4zm-.5 3.5a.5.5 0 0 1 .5-.5h4.293L7.146 6.854a.5.5 0 1 1 .708-.708l2 2a.5.5 0 0 1 0 .708l-2 2a.5.5 0 0 1-.708-.708L8.293 9H4a.5.5 0 0 1-.5-.5",24:"M5 7a1 1 0 0 1 1-1h3.236a1 1 0 0 1 .894.553L10.882 8H18a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7zm1 0v10h12V9h-7.118a1 1 0 0 1-.894-.553L9.236 7H6zm-.5 5.5a.5.5 0 0 1 .5-.5h5.293l-1.647-1.646a.5.5 0 0 1 .708-.708l2.5 2.5a.5.5 0 0 1 0 .708l-2.5 2.5a.5.5 0 0 1-.708-.708L11.293 13H6a.5.5 0 0 1-.5-.5"};function Wue({className:t,size:e=24}){return kL("svg",{className:["icon","icon--move-folder",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:kL("path",{clipRule:"evenodd",d:Gue[e],fill:"currentColor",fillRule:"evenodd"})})}import{jsx as ML}from"react/jsx-runtime";import"react";var Uue={16:"M3 3h4v4H3zM2 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1zm1 6h4v4H3zm-1 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1zm10-6H9v4h3zm-3-1a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1zm0 7h3v4H9zm-1 0a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1z",24:"M7 7h3v3H7zM6 7a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm1 7h3v3H7zm-1 0a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm11-7h-3v3h3zm-3-1a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zm0 8h3v3h-3zm-1 0a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1z"},Xue=({className:t,size:e=24})=>ML("svg",{className:["icon","icon--grid-view",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ML("path",{clipRule:"evenodd",d:Uue[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as BL}from"react/jsx-runtime";import"react";var Zue={16:"M6 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0m1 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0m3 5a1 1 0 1 1 2 0v2.5a.5.5 0 0 0 1 0V10a2 2 0 1 0-4 0v2.5a.5.5 0 0 0 1 0zM5 9a1 1 0 0 0-1 1v2.5a.5.5 0 0 1-1 0V10a2 2 0 1 1 4 0v2.5a.5.5 0 0 1-1 0V10a1 1 0 0 0-1-1m7-4a1 1 0 1 1-2 0 1 1 0 0 1 2 0m1 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0",24:"M10 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m1 0a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0m4.5 4.5a2.5 2.5 0 0 0-2.5 2.5c0-.686-.153-1.336-.428-1.918A3.5 3.5 0 0 1 19 15.5v2a.5.5 0 0 1-1 0v-2a2.5 2.5 0 0 0-2.5-2.5m-7 0A2.5 2.5 0 0 0 6 15.5v2a.5.5 0 0 1-1 0v-2a3.5 3.5 0 1 1 7 0v2a.5.5 0 0 1-1 0v-2A2.5 2.5 0 0 0 8.5 13M17 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m1 0a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0"},Yue=({className:t,size:e=24})=>BL("svg",{className:["icon","icon--people",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:BL("path",{clipRule:"evenodd",d:Zue[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as hS,jsxs as Jue}from"react/jsx-runtime";import"react";function que({className:t=""}){return Jue("div",{className:`icon icon--dots ${t}`.trim(),children:[hS("div",{}),hS("div",{}),hS("div",{})]})}import{jsx as OL,jsxs as Que}from"react/jsx-runtime";import"react";var VL={26:{circle:"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",symbol:"M15.4001 10.5996L10.6001 15.3996M10.6001 10.5996L15.4001 15.3996"}},Kue=({className:t,size:e=26})=>Que("svg",{className:["icon","icon--error",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:[OL("path",{className:"icon__circle",d:VL[e].circle}),OL("path",{className:"icon__symbol",d:VL[e].symbol,strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as HL}from"react/jsx-runtime";import"react";var ede=({className:t,size:e=24})=>HL("svg",{className:["icon","icon--interaction-enter",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:"0 0 24 24",width:e,xmlns:"http://www.w3.org/2000/svg",children:HL("path",{clipRule:"evenodd",d:"M7.5 6A1.5 1.5 0 0 0 6 7.5v1a.5.5 0 0 0 1 0v-1a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 0-1 0v1A1.5 1.5 0 0 0 7.5 18h9a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 16.5 6zm4.146 3.146a.5.5 0 0 1 .708 0l2.5 2.5a.5.5 0 0 1 0 .708l-2.5 2.5a.5.5 0 0 1-.708-.708l1.647-1.646H9.5a.5.5 0 0 1 0-1h3.793l-1.647-1.646a.5.5 0 0 1 0-.708",fill:"currentColor",fillRule:"evenodd"})});import{jsx as zL,jsxs as tde}from"react/jsx-runtime";import"react";var GL={26:{circle:"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",symbol:"M10.6001 13.0004L12.2001 14.6004L15.4001 11.4004"}},ode=({className:t,size:e=26})=>tde("svg",{className:["icon","icon--success",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:[zL("path",{className:"icon__circle",d:GL[e].circle}),zL("path",{className:"icon__symbol",d:GL[e].symbol,strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as WL}from"react/jsx-runtime";import"react";var rde={15:"M5.29978 1.01946C6.06438 -0.339835 8.02149 -0.339802 8.78611 1.01946L13.8261 9.97942C14.5761 11.3126 13.6126 12.9599 12.083 12.9599H2.0029C0.473297 12.9598 -0.49016 11.3126 0.259741 9.97942L5.29978 1.01946ZM7.91404 1.50969C7.53172 0.830085 6.55415 0.830054 6.17185 1.50969L1.13083 10.4697L1.07126 10.5966C0.835032 11.1938 1.22686 11.8636 1.86326 11.9501L2.0029 11.9599H12.083C12.7999 11.9599 13.2677 11.2363 13.0146 10.5966L12.9551 10.4697L7.91404 1.50969ZM7.04294 8.96282C7.45701 8.96282 7.7927 9.29881 7.79294 9.71282C7.79294 10.127 7.45716 10.4628 7.04294 10.4628C6.62875 10.4628 6.29294 10.127 6.29294 9.71282C6.29319 9.29882 6.6289 8.96284 7.04294 8.96282ZM7.04294 3.45989C7.46821 3.45989 7.80371 3.82086 7.77341 4.24504L7.54197 7.49504C7.52326 7.75668 7.30525 7.95989 7.04294 7.95989C6.78065 7.95987 6.56262 7.75667 6.54392 7.49504L6.31248 4.24504C6.28218 3.82087 6.6177 3.45991 7.04294 3.45989Z"},nde=({className:t})=>WL("svg",{className:["icon","icon--warning-triangle",t].filter(Boolean).join(" "),fill:"none",height:13,viewBox:"0 0 15 13",width:15,xmlns:"http://www.w3.org/2000/svg",children:WL("path",{d:rde[15],fill:"currentColor"})});import{c as XL}from"react/compiler-runtime";import{jsx as UL}from"react/jsx-runtime";import Cd from"react";var ZL=Cd.createContext({addClientFunction:()=>null,removeClientFunction:()=>null}),YL=Cd.createContext({}),gS=t=>{let e=XL(6),{children:o}=t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={},e[0]=n):n=e[0];let[r,s]=Cd.useState(n),i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=d=>{s(f=>{let m={...f};return m[d.key]=d.func,m})},e[1]=i):i=e[1];let a=i,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=d=>{s(f=>{let m={...f};return delete m[d.key],m})},e[2]=l):l=e[2];let c=l,u;return e[3]!==o||e[4]!==r?(u=UL(ZL,{value:{addClientFunction:a,removeClientFunction:c},children:UL(YL,{value:r,children:o})}),e[3]=o,e[4]=r,e[5]=u):u=e[5],u},sde=(t,e)=>{let o=XL(6),{addClientFunction:n,removeClientFunction:r}=Cd.use(ZL),s,i;o[0]!==n||o[1]!==e||o[2]!==t||o[3]!==r?(s=()=>(n({func:e,key:t}),()=>{r({func:e,key:t})}),i=[e,t,n,r],o[0]=n,o[1]=e,o[2]=t,o[3]=r,o[4]=s,o[5]=i):(s=o[4],i=o[5]),Cd.useEffect(s,i)},ide=()=>Cd.use(YL);import{jsx as t$}from"react/jsx-runtime";import{DndContext as dde}from"@dnd-kit/core";import vS,{useCallback as uv,useEffect as dv,useId as mde,useMemo as fde,useRef as pde,useState as rs}from"react";import{c as ade}from"react/compiler-runtime";import{useEffect as JL,useRef as qL,useState as lde}from"react";var QL=t=>{let e=ade(15),{eventType:o,onMessage:n,url:r}=t,s=qL(!1),[i,a]=lde(!1),{config:l}=G(),{serverURL:c}=l,u=qL(null),d,f;e[0]!==o||e[1]!==i||e[2]!==n||e[3]!==c||e[4]!==r?(d=()=>{let v=async C=>{C.origin!==window.location.origin||C.origin!==r||C.origin!==c||typeof n=="function"&&C.data?.type===o&&!s.current&&(s.current=!0,await n(C.data?.searchParams),s.current=!1)};return i&&u.current&&window.addEventListener("message",v,!1),()=>{window.removeEventListener("message",v)}},f=[n,o,r,c,i],e[0]=o,e[1]=i,e[2]=n,e[3]=c,e[4]=r,e[5]=d,e[6]=f):(d=e[5],f=e[6]),JL(d,f);let m;e[7]!==r?(m=v=>{if(v&&v.preventDefault(),u.current&&!u.current.closed){u.current.focus();return}let C={height:700,left:"auto",menubar:"no",popup:"yes",toolbar:"no",top:"auto",width:800},y=Object.entries(C).reduce((w,S)=>{let[_,I]=S,A=w;if(I==="auto"){if(_==="top"){let D=Math.round(window.innerHeight/2-C.height/2);A=A+`top=${D},`}else if(_==="left"){let D=Math.round(window.innerWidth/2-C.width/2);A=A+`left=${D},`}return A}return A=A+`${_}=${I},`,A},"").slice(0,-1),x=window.open(r,"_blank",y);u.current=x,a(!0)},e[7]=r,e[8]=m):m=e[8];let p=m,h,g;e[9]!==i?(h=()=>{let v;return i?v=setInterval(function(){u.current.closed&&(clearInterval(v),a(!1))},1e3):clearInterval(v),()=>{v&&clearInterval(v)}},g=[i,u],e[9]=i,e[10]=h,e[11]=g):(h=e[10],g=e[11]),JL(h,g);let b;return e[12]!==i||e[13]!==p?(b={isPopupOpen:i,openPopupWindow:p,popupRef:u},e[12]=i,e[13]=p,e[14]=b):b=e[14],b};var cde=t=>{try{return new URL(t,window.location.origin).href}catch{return t}},bS=t=>t?.startsWith("http://")||t?.startsWith("https://")?t:cde(t);import{rectIntersection as ude}from"@dnd-kit/core";var KL=({collisionRect:t,droppableContainers:e,...o})=>{let n=e.find(({id:a})=>a==="live-preview-area"),r=ude({...o,collisionRect:t,droppableContainers:[n]});if(r.length===0)return r;let s=n?.rect?.current;if(t.top>=s.top&&t.left>=s.left&&t.bottom<=s.bottom&&t.right<=s.right)return r};var e$=(t,e)=>{switch(e.type){case"height":return{...t,height:e.value};case"width":return{...t,width:e.value};default:return{...t,...e?.value||{}}}};var hde=({breakpoints:t,children:e,isLivePreviewEnabled:o,isLivePreviewing:n,isPreviewEnabled:r,previewURL:s,typeofLivePreviewURL:i,url:a})=>{let[l,c]=rs(n),[u,d]=rs(l),f=uv(Y=>{Y&&d(!0),c(Y)},[]),m=fde(()=>[...t||[],{name:"responsive",height:"100%",label:"Responsive",width:"100%"}],[t]),[p,h]=rs(""),[g,b]=rs(s),{isPopupOpen:v,openPopupWindow:C,popupRef:y}=QL({eventType:"payload-live-preview",url:p}),[x,w]=rs(!1),[S,_]=rs(0),{collectionSlug:I,globalSlug:A}=be(),D=pde(!0),{setPreference:T}=Jt(),R=vS.useRef(null),[P,E]=rs(!1),[F,L]=rs(),[M,$]=rs(1),[B,j]=rs({x:0,y:0}),[k,O]=vS.useReducer(e$,{height:0,width:0}),[V,H]=rs({height:0,width:0}),[z,W]=vS.useState("responsive"),U=uv(Y=>{let K;typeof Y=="string"&&(K=bS(Y)),K||f(!1),K!==p&&(w(!1),h(K))},[f,p]);dv(()=>{typeof a=="string"&&h(bS(a))},[a]);let X=Y=>{if(Y.over&&Y.over.id==="live-preview-area"){let K={x:B.x+Y.delta.x,y:B.y+Y.delta.y};j(K)}},Q=uv(Y=>{O({type:"width",value:Y})},[O]),J=uv(Y=>{O({type:"height",value:Y})},[O]);dv(()=>{let Y=m?.find(K=>K.name===z);Y&&z!=="responsive"&&z!=="custom"&&typeof Y?.width=="number"&&typeof Y?.height=="number"&&O({type:"reset",value:{height:Y.height,width:Y.width}})},[z,m]),dv(()=>{let Y=K=>{p?.startsWith(K.origin)&&K.data&&typeof K.data=="object"&&K.data.type==="payload-live-preview"&&K.data.ready&&(w(!0),_(Date.now()))};return window.addEventListener("message",Y),()=>{window.removeEventListener("message",Y)}},[p]),dv(()=>{if(D.current){D.current=!1;return}T(I?`collection-${I}`:`global-${A}`,{editViewType:l?"live-preview":"default"},!0)},[l,T,I,A]);let oe=mde();return t$(wb,{value:{appIsReady:x,breakpoint:z,breakpoints:m,iframeRef:R,isExpanded:P,isLivePreviewEnabled:o,isLivePreviewing:l,isPopupOpen:v,isPreviewEnabled:r,lastReadyAt:S,loadedURL:F,measuredDeviceSize:V,openPopupWindow:C,popupRef:y,previewURL:g,setBreakpoint:W,setHeight:J,setIsExpanded:E,setIsLivePreviewing:f,setLoadedURL:L,setMeasuredDeviceSize:H,setPreviewURL:b,setSize:O,setToolbarPosition:j,setURL:U,setWidth:Q,setZoom:$,shouldRenderIframe:u,size:k,toolbarPosition:B,typeofLivePreviewURL:i,url:p,zoom:M},children:t$(dde,{collisionDetection:KL,id:oe,onDragEnd:X,children:e})})};import{c as gde}from"react/compiler-runtime";import{jsx as o$}from"react/jsx-runtime";import bde,{useEffect as vde,useRef as yde}from"react";var r$=200,yS="progress-bar",Cde=150,xde=()=>{let t=gde(9),{isTransitioning:e,transitionProgress:o}=Ue(),[n,r]=bde.useState(null),s=yde(!0),i,a;if(t[0]!==e||t[1]!==o?(i=()=>{let l,c;return e?s.current?c=setTimeout(()=>{r(o),s.current=!1},Cde):r(o):(s.current=!0,r(1),l=setTimeout(()=>{r(null)},r$*2)),()=>{clearTimeout(l),clearTimeout(c)}},a=[e,o],t[0]=e,t[1]=o,t[2]=i,t[3]=a):(i=t[2],a=t[3]),vde(i,a),typeof n=="number"){let l=n===1&&`${yS}--fade-out`,c;t[4]!==l?(c=[yS,l].filter(Boolean),t[4]=l,t[5]=c):c=t[5];let u=c.join(" "),d;return t[6]!==n||t[7]!==u?(d=o$("div",{className:u,style:{"--transition-duration":`${r$}ms`},children:o$("div",{className:`${yS}__progress`,style:{width:`${(n||0)*100}%`}})}),t[6]=n,t[7]=u,t[8]=d):d=t[8],d}return null};import{c as Ede}from"react/compiler-runtime";import{jsx as Xt,jsxs as wS}from"react/jsx-runtime";import{DndContext as Lde,pointerWithin as $de}from"@dnd-kit/core";import MTt,{Fragment as BTt}from"react";import{useContext as Sde}from"react";import{createContext as wde}from"react";var Jp=wde({});var qp=()=>Sde(Jp);import _de,{useCallback as Ide,useEffect as Rde,useReducer as Tde,useRef as Dde}from"react";var Ade=(t,e)=>{let{timestamp:o,animationRef:n}=e;n.current=null;let{x:r,y:s,xDirection:i,yDirection:a,eventsFired:l,hasScrolled:c}=t,u=c||!!o,d=u?window.pageXOffset:0,f=u?window.pageYOffset:0,m=u?l+1:l,p=d-r,h=f-s,g=d/(document.body.scrollWidth-window.innerWidth)*100,b=f/(document.body.scrollHeight-window.innerHeight)*100,v=(g+b)/2,C=p>0?"right":p<0?"left":i,y=h>0?"down":h<0?"up":a;return{x:d,y:f,xDifference:p,yDifference:h,xDirection:C,yDirection:y,xPercentage:g,yPercentage:b,totalPercentage:v,eventsFired:m,hasScrolled:u}},Qp=t=>{let{children:e}=t,o=Dde(null),[n,r]=Tde(Ade,{x:0,y:0,xDifference:0,yDifference:0,xDirection:void 0,yDirection:void 0,xPercentage:0,yPercentage:0,totalPercentage:0,eventsFired:0,hasScrolled:!1}),s=Ide(i=>{o.current&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(a=>{r({e:i,timestamp:a,animationRef:o})})},[]);return Rde(()=>(window.addEventListener("scroll",s),()=>{window.removeEventListener("scroll",s)}),[s]),_de.createElement(Jp.Provider,{value:Object.assign({},n)},e&&e)};import UTt from"react";import jde from"react";import{c as Pde}from"react/compiler-runtime";import{useEffect as Fde,useRef as Nde}from"react";function n$(){let t=Pde(6),{closeAllModals:e}=ie(),o=Ao(),n;t[0]!==e?(n=()=>{e()},t[0]=e,t[1]=n):n=t[1];let r=et(n),s=Nde(!0),i;t[2]!==r?(i=()=>{if(s.current){s.current=!1;return}r()},t[2]=r,t[3]=i):i=t[3];let a;return t[4]!==o?(a=[o],t[4]=o,t[5]=a):a=t[5],Fde(i,a),null}var{WindowInfoProvider:CS}=Fa&&"WindowInfoProvider"in Fa?Fa:{WindowInfoProvider:void 0},{useWindowInfo:xS}=Fa&&"useWindowInfo"in Fa?Fa:{useWindowInfo:void 0};import{jsx as xd}from"react/jsx-runtime";import"react";var s$=({config:t})=>{let{admin:{toast:{duration:e,expand:o,limit:n,position:r}={}}={}}=t;return xd(a3,{className:"payload-toast-container",closeButton:!0,dir:"undefined",duration:e??4e3,expand:o??!1,gap:8,icons:{close:xd(xt,{size:24}),error:xd(ju,{}),info:xd(Kd,{}),success:xd(Vo,{size:24}),warning:xd(ju,{})},offset:{bottom:"var(--spacer-6)",right:"var(--spacer-6)"},position:r??"bottom-right",style:{width:"280px"},theme:"dark",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:n??5})};var kde=t=>{let e=Ede(17),{children:o,config:n,dateFNSKey:r,fallbackLang:s,highContrastMode:i,isNavOpen:a,languageCode:l,languageOptions:c,locale:u,permissions:d,RouterAdapter:f,serverFunction:m,theme:p,translations:h,user:g}=t,b=jde.useId(),v;return e[0]!==f||e[1]!==o||e[2]!==n||e[3]!==r||e[4]!==b||e[5]!==s||e[6]!==i||e[7]!==a||e[8]!==l||e[9]!==c||e[10]!==u||e[11]!==d||e[12]!==m||e[13]!==p||e[14]!==h||e[15]!==g?(v=wS(t9,{children:[Xt(f,{children:Xt(Xv,{serverFunction:m,children:Xt(vy,{children:Xt(g5,{cachingEnabled:process.env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH==="true",children:Xt(Uv,{config:n,children:Xt(gS,{children:Xt(Zv,{dateFNSKey:r,fallbackLang:s,language:l,languageOptions:c,translations:h,children:Xt(CS,{breakpoints:{l:"(max-width: 1440px)",m:"(max-width: 1024px)",s:"(max-width: 768px)",xs:"(max-width: 400px)"},children:Xt(Qp,{children:Xt(Uy,{classPrefix:"payload",transTime:0,zIndex:"var(--z-modal)",children:wS(F_,{children:[Xt(n$,{}),wS(eC,{permissions:d,user:g,children:[Xt(dC,{children:Xt(Px,{children:Xt(Wd,{highContrastMode:i,theme:p,children:Xt(tC,{locale:u,children:Xt(R5,{children:Xt(qA,{children:Xt(r2,{children:Xt(_5,{initialIsOpen:a,children:Xt(g2,{children:Xt(Lde,{collisionDetection:$de,id:b,children:o})})})})})})})})})}),Xt(zy,{}),Xt(L_,{})]})]})})})})})})})})})})}),Xt(s$,{config:n})]}),e[0]=f,e[1]=o,e[2]=n,e[3]=r,e[4]=b,e[5]=s,e[6]=i,e[7]=a,e[8]=l,e[9]=c,e[10]=u,e[11]=d,e[12]=m,e[13]=p,e[14]=h,e[15]=g,e[16]=v):v=e[16],v};import{jsx as Mde}from"react/jsx-runtime";import{createContext as Bde,use as Ode,useCallback as ns,useEffect as Vde,useMemo as Hde,useRef as zde,useState as Gde}from"react";var a$=Bde(void 0),wd=()=>({selectAllStatus:no.None,selected:new Map}),i$=({docCount:t,selected:e})=>!e.size||t===0?no.None:e.size===t?no.AllInPage:no.Some,Kp=({children:t,collectionData:e,currentUserId:o})=>{let n=zde({}),[r,s]=Gde(()=>{let v={};for(let C of Object.keys(e))v[C]=wd();return v});Vde(()=>{s(()=>{let v={};for(let C of Object.keys(e))v[C]=wd();return v})},[e]);let i=ns(({id:v,collectionSlug:C})=>{let x=(e[C]?.docs??[]).find(w=>w.id===v);return x?!!(x._isLocked&&x._userEditing?.id!==o):!1},[e,o]),a=ns(({id:v,collectionSlug:C})=>r[C]?.selected.has(v)??!1,[r]),l=ns(({collectionSlug:v})=>r[v]?.selectAllStatus??no.None,[r]),c=ns(({collectionSlug:v})=>r[v]?.selected.size??0,[r]),u=ns(()=>{let v=0;for(let C of Object.keys(r))v+=c({collectionSlug:C});return v},[r,c]),d=ns(()=>{let v={};for(let[C,y]of Object.entries(r)){let x=Array.from(y.selected.keys());x.length>0&&(v[C]={ids:x,totalCount:x.length})}return v},[r]),f=ns(()=>{let v={};for(let[C,y]of Object.entries(r)){let x=[];for(let[w,S]of y.selected)x.push({id:w,metadata:S});x.length>0&&(v[C]={selections:x,totalCount:x.length})}return v},[r]),m=ns(({id:v,collectionSlug:C,metadata:y={}})=>{i({id:v,collectionSlug:C})||s(x=>{let w=x[C]??wd(),S=w.selected.has(v),_=new Map(w.selected);S?_.delete(v):_.set(v,y);let I=e[C]?.docs.length??0,A=i$({docCount:I,selected:_});return{...x,[C]:{selectAllStatus:A,selected:_}}})},[e,i]),p=ns(({collectionSlug:v})=>{s(C=>{let y=C[v]??wd(),x=e[v]?.docs??[];if(y.selectAllStatus===no.AllInPage)return{...C,[v]:{selectAllStatus:no.None,selected:new Map}};let S=new Map;for(let I of x)I._isLocked&&I._userEditing?.id!==o||S.set(I.id,{});let _=i$({docCount:x.length,selected:S});return{...C,[v]:{selectAllStatus:_,selected:S}}})},[e,o]),h=ns(({collectionSlug:v})=>{s(C=>({...C,[v]:wd()}))},[]),g=ns(()=>{s(v=>{let C={};for(let y of Object.keys(v))C[y]=wd();return C})},[]),b=Hde(()=>({clearAll:g,clearCollection:h,getCollectionCount:c,getSelectAllStatus:l,getSelectionsForActions:d,getSelectionsWithMetadata:f,getTotalCount:u,isLocked:i,isSelected:a,selections:r,toggleAllInCollection:p,toggleSelection:m}),[g,h,c,l,d,f,u,i,a,r,p,m]);return n.current=b,Mde(a$,{value:n.current,children:t})},xc=()=>{let t=Ode(a$);if(t===void 0)throw new Error("useDocumentSelection must be used within a DocumentSelectionProvider");return t};import{jsx as mv,jsxs as Wde}from"react/jsx-runtime";import{email as Ude,getFieldPermissions as Xde,username as Zde}from"payload/shared";import"react";var Yde="login-fields";function eh(t){let{className:e,loginWithUsername:o,operation:n,permissions:r,readOnly:s,t:i}=t;function a(p,h){return Xde({field:{name:p,type:"text"},operation:n==="create"?"create":h,parentName:"",permissions:r}).operation}let l=typeof r=="object"&&"email"in r&&r.email,c=typeof r=="object"&&"username"in r&&r.username,u=l?{read:a("email","read"),update:a("email","update")}:{read:!0,update:!0},d=c?{read:a("username","read"),update:a("username","update")}:{read:!0,update:!0},f=(!o||o?.requireEmail||o?.allowEmailLogin)&&u.read,m=!!o&&d.read;if(f||m)return Wde("div",{className:[Yde,e&&e].filter(Boolean).join(" "),children:[f?mv(si,{value:"email",children:mv(On,{field:{name:"email",admin:{autoComplete:"off"},label:i("general:email"),required:!o||o&&o.requireEmail},path:"email",readOnly:s||!u.update,schemaPath:"email",validate:Ude})}):null,m&&mv(si,{value:"username",children:mv(Cn,{field:{name:"username",admin:{autoComplete:"off"},label:i("authentication:username"),required:o&&o.requireUsername},path:"username",readOnly:s||!d.update,schemaPath:"username",validate:Zde})})]})}import{c as Jde}from"react/compiler-runtime";import{jsx as qde}from"react/jsx-runtime";import"react";var l$="select-all",Qde=()=>{let t=Jde(7),{selectAll:e,toggleAll:o}=ts(),{i18n:n}=N(),r;if(t[0]!==n||t[1]!==e||t[2]!==o){let s;t[4]===Symbol.for("react.memo_cache_sentinel")?(s=[l$,`${l$}__checkbox`],t[4]=s):s=t[4];let i;t[5]!==o?(i=()=>o(),t[5]=o,t[6]=i):i=t[6],r=qde(Ft,{"aria-label":e===no.None?n.t("general:selectAllRows"):n.t("general:deselectAllRows"),checked:e===no.AllInPage||e===no.AllAvailable,className:s.join(" "),id:"select-all",name:"select-all",onToggle:i,partialChecked:e===no.Some,variant:"muted"}),t[0]=n,t[1]=e,t[2]=o,t[3]=r}else r=t[3];return r};import{c as Kde}from"react/compiler-runtime";import{jsx as c$}from"react/jsx-runtime";import"react";var u$="select-row",eme=t=>{let e=Kde(13),{rowData:o}=t,{user:n}=ye(),{selected:r,setSelection:s}=ts(),i;if(e[0]!==o||e[1]!==n?.id){i=Symbol.for("react.early_return_sentinel");e:{let{_isLocked:f,_userEditing:m}=o||{};if(f&&m&&m.id!==n?.id){i=c$(Li,{user:m});break e}}e[0]=o,e[1]=n?.id,e[2]=i}else i=e[2];if(i!==Symbol.for("react.early_return_sentinel"))return i;let a;e[3]!==o.id||e[4]!==r?(a=r.get(o.id),e[3]=o.id,e[4]=r,e[5]=a):a=e[5];let l=!!a,c;e[6]===Symbol.for("react.memo_cache_sentinel")?(c=[u$,`${u$}__checkbox`],e[6]=c):c=e[6];let u;e[7]!==o.id||e[8]!==s?(u=()=>s(o.id),e[7]=o.id,e[8]=s,e[9]=u):u=e[9];let d;return e[10]!==l||e[11]!==u?(d=c$(Ft,{checked:l,className:c.join(" "),onToggle:u,variant:"muted"}),e[10]=l,e[11]=u,e[12]=d):d=e[12],d};import{jsxs as tme}from"react/jsx-runtime";import"react";var Sd=t=>{let{onClick:e}=t,{count:o,selected:n}=ts(),{t:r}=N();return!n||!o?null:tme(Z,{buttonStyle:"primary",onClick:()=>{typeof e=="function"&&e(n)},size:"medium",children:[r("general:select")," ",o]})};import{jsx as so,jsxs as vv}from"react/jsx-runtime";import{getTranslation as yv}from"@payloadcms/translations";import{formatAdminURL as T$,formatFilesize as xme}from"payload/shared";import D$,{Fragment as wme,useEffect as A$,useRef as Sme,useState as _me}from"react";import{c as f$}from"react/compiler-runtime";import{jsx as ks,jsxs as p$}from"react/jsx-runtime";import{Fragment as h$}from"react";import{jsx as Ya,jsxs as ome}from"react/jsx-runtime";import{getTranslation as rme}from"@payloadcms/translations";import{formatAdminURL as nme}from"payload/shared";import*as d$ from"qs-esm";import sme,{useCallback as SS,useMemo as _S,useState as ime}from"react";var ame="move-many";function lme(t){return(t?.hierarchy&&typeof t.hierarchy=="object"?t.hierarchy:void 0)?.parentFieldName}function m$({currentParentID:t,hierarchySlug:e,Icon:o,modalPrefix:n,onSuccess:r,selections:s}){let{i18n:i,t:a}=N(),{code:l}=Ce(),{openModal:c}=ie(),{config:{collections:u,routes:{api:d}}}=G(),{getSelectionsWithMetadata:f}=xc(),[m,p]=ime(null),h=`${n?`${n}-`:""}confirm-move-many`,g=_S(()=>{let R=f(),P=new Set;for(let[E,{selections:F}]of Object.entries(R))if(E===e){for(let{metadata:L}of F)if(L.allowedCollections)for(let M of L.allowedCollections)P.add(M)}else P.add(E);return P.size>0?Array.from(P):void 0},[f,e]),b=_S(()=>{let R=s[e]?.ids;return R?.length?new Set(R):void 0},[s,e]),[v,,{closeDrawer:C,openDrawer:y}]=fi({disabledIds:b,filterByCollection:g,hierarchyCollectionSlug:e,Icon:o}),{count:x,label:w}=_S(()=>{let R=0,P=[];for(let[E,{ids:F}]of Object.entries(s)){let L=u.find(M=>M.slug===E);if(L&&F.length>0){R+=F.length;let M=rme(F.length>1?L.labels.plural:L.labels.singular,i);P.push(M)}}return{count:R,label:P.join(", ")}},[s,u,i]),S=u.find(R=>R.slug===e),_=lme(S),I=_!==void 0,A=SS(({selections:R})=>{if(R.size===0)return;let P=R.values().next().value,E=P?.id,F=P?.path?.[P.path.length-1]?.title||String(E);p({id:E,title:F}),c(h)},[c,h]),D=SS(()=>{p({id:null,title:a("hierarchy:noParent")}),c(h)},[c,h,a]),T=SS(async()=>{if(m===null)return;let R=0,P=!1;try{for(let[E,{ids:F}]of Object.entries(s)){if(F.length===0)continue;let L=d$.stringify({locale:l,where:{id:{in:F}}},{addQueryPrefix:!0}),M=nme({apiRoute:d,path:`/${E}${L}`}),$=await We.patch(M,{body:JSON.stringify({[_]:m.id}),headers:{"Accept-Language":i.language,"Content-Type":"application/json",credentials:"include"}}),B=await $.json();if($.status>=400){P=!0,B?.errors?.length>0?se.error(B.message||a("error:unknown"),{description:B.errors.map(k=>k.message).join(`
60
- `)}):se.error(B?.message||a("error:unknown"));continue}let j=B?.docs?.length||0;R+=j,B?.errors?.length>0&&(P=!0,se.error(B.message,{description:B.errors.map(k=>k.message).join(`
61
- `)}))}if(R>0){let E=m.id===null?"hierarchy:itemsMovedToRoot":"hierarchy:itemsMovedTo";se.success(a(E,{destination:m.title,title:w}))}(!P||R>0)&&(C(),r?.())}catch{se.error(a("error:unknown"))}finally{p(null)}},[C,m,s,_,l,d,i,a,w,r]);return x===0||!I?null:ome(sme.Fragment,{children:[Ya(Xo,{"aria-label":a("general:move"),className:`${ame}__toggle`,onClick:y,children:a("general:move")}),Ya(v,{hasMany:!1,initialSelections:t?[t]:null,onMoveToRoot:D,onSave:A,showMoveToRoot:!0}),Ya(nt,{body:Ya("p",{children:m?.id===null?Ya(Ro,{elements:{1:({children:R})=>Ya("strong",{children:R})},i18nKey:"hierarchy:moveItemsToRootConfirmation",t:a,variables:{count:x,label:w}}):Ya(Ro,{elements:{1:({children:R})=>Ya("strong",{children:R})},i18nKey:"general:moveConfirm",t:a,variables:{count:x,destination:m?.title||"",label:w}})}),confirmingLabel:a("general:moving"),heading:a("general:confirmMove"),modalSlug:h,onConfirm:T})]})}var cme=t=>{let e=f$(8),{id:o,collectionSlug:n,onSuccess:r}=t,{t:s}=N(),i;e[0]!==n||e[1]!==o?(i={id:o,collectionSlug:n},e[0]=n,e[1]=o,e[2]=i):i=e[2];let[a,,l]=ro(i),{openDrawer:c}=l,u;return e[3]!==a||e[4]!==r||e[5]!==c||e[6]!==s?(u=p$(h$,{children:[ks(Xo,{onClick:c,children:s("general:edit")}),ks(a,{onSave:r})]}),e[3]=a,e[4]=r,e[5]=c,e[6]=s,e[7]=u):u=e[7],u},fv=t=>{let e=f$(16),{disableBulkDelete:o,disableBulkEdit:n,hierarchyIcon:r,hierarchySlug:s}=t,{clearAll:i,getSelectionsForActions:a,getTotalCount:l}=xc(),{parent:c,refreshTree:u}=No(),{clearRouteCache:d}=zt(),{config:f}=G(),{t:m}=N(),p,h;if(e[0]!==i||e[1]!==d||e[2]!==f||e[3]!==o||e[4]!==n||e[5]!==a||e[6]!==l||e[7]!==r||e[8]!==s||e[9]!==c?.id||e[10]!==u||e[11]!==m){h=Symbol.for("react.early_return_sentinel");e:{let g=l(),b=a(),v=Object.keys(b),C=v.length===1,y=C?v[0]:null,x=y?f.collections.find(A=>A.slug===y):null,w=C?b[y]?.ids||[]:[],S=s&&y===s&&w.length===1?w[0]:null;if(g===0){h=null;break e}let _=()=>{d(),s&&u(s),i()},I;e[14]!==i?(I=()=>i(),e[14]=i,e[15]=I):I=e[15],p=ks(Cb,{count:g,ListActions:[ks(Xo,{onClick:I,children:m("general:clearAll")},"clear-all")],SelectionActions:[S&&s&&ks(cme,{collectionSlug:s,id:S,onSuccess:_},"single-edit"),!n&&!S&&C&&x&&w.length>0&&p$(h$,{children:[ks(Ep,{collection:x,count:w.length,ids:w,modalPrefix:"hierarchy-list",onSuccess:_,selectAll:!1}),ks(Bp,{collection:x,count:w.length,ids:w,modalPrefix:"hierarchy-list",onSuccess:_,selectAll:!1}),ks(Op,{collection:x,count:w.length,ids:w,modalPrefix:"hierarchy-list",onSuccess:_,selectAll:!1})]},"bulk-actions"),!o&&ks(Ip,{afterDelete:_,modalPrefix:"hierarchy-list",selections:b},"bulk-delete"),s&&ks(m$,{currentParentID:c?.id||null,hierarchySlug:s,Icon:r,modalPrefix:"hierarchy-list",onSuccess:_,selections:b},"bulk-move")].filter(Boolean)})}e[0]=i,e[1]=d,e[2]=f,e[3]=o,e[4]=n,e[5]=a,e[6]=l,e[7]=r,e[8]=s,e[9]=c?.id,e[10]=u,e[11]=m,e[12]=p,e[13]=h}else p=e[12],h=e[13];return h!==Symbol.for("react.early_return_sentinel")?h:p};import{jsx as Ms,jsxs as vme}from"react/jsx-runtime";import{getTranslation as _$}from"@payloadcms/translations";import{combineWhereConstraints as I$,DEFAULT_HIERARCHY_LIST_LIMIT as _d,formatAdminURL as R$}from"payload/shared";import*as RS from"qs-esm";import{useCallback as IS,useMemo as th,useState as gv}from"react";import{c as ume}from"react/compiler-runtime";import{jsx as Ja,jsxs as g$}from"react/jsx-runtime";import{formatAdminURL as b$}from"payload/shared";import"react";var cr="hierarchy-tables";var v$=t=>{let e=ume(12),{row:o}=t,{config:n,getEntityConfig:r}=G(),{routes:s}=n,{admin:i}=s,{t:a}=N(),l;e[0]!==r||e[1]!==o._collectionSlug?(l=r({collectionSlug:o._collectionSlug}),e[0]=r,e[1]=o._collectionSlug,e[2]=l):l=e[2];let c=l,u=c?.admin?.useAsTitle||"id",d=typeof o[u]=="string"||typeof o[u]=="number"?o[u]:o.id,f;if(e[3]!==i||e[4]!==c||e[5]!==d||e[6]!==o._collectionSlug||e[7]!==o._hasChildren||e[8]!==o._hierarchyIcon||e[9]!==o.id||e[10]!==a){let m=typeof d=="object"?JSON.stringify(d):String(d),p=c?.hierarchy&&typeof c.hierarchy=="object"?c.hierarchy:void 0,h=!!(p&&p.allowHasMany===!1),g=p?.parentFieldName||"parent",b=b$({adminRoute:i,path:`/collections/${o._collectionSlug}/${o.id}`}),v=b$({adminRoute:i,path:`/collections/${o._collectionSlug}?${g}=${o.id}`}),C=h?Ja(ef,{}):Ja(Ll,{});f=g$("div",{className:`${cr}__name-cell`,children:[g$(jt,{className:`${cr}__name-link`,href:v,children:[Ja("span",{className:`${cr}__name-icon`,children:o._hierarchyIcon||C}),Ja("span",{className:`${cr}__name-text`,children:m}),o._hasChildren&&Ja("span",{className:`${cr}__chevron`,children:Ja(ve,{direction:"right"})})]}),Ja(jt,{"aria-label":a("general:editLabel",{label:m}),className:`${cr}__edit-button`,href:b,children:Ja(fr,{})})]}),e[3]=i,e[4]=c,e[5]=d,e[6]=o._collectionSlug,e[7]=o._hasChildren,e[8]=o._hierarchyIcon,e[9]=o.id,e[10]=a,e[11]=f}else f=e[11];return f};import{c as dme}from"react/compiler-runtime";import{jsx as y$}from"react/jsx-runtime";import"react";function mme(t,e){try{return new Date(t).toLocaleDateString(e,{day:"numeric",month:"short",year:"numeric"})}catch{return t}}var C$=t=>{let e=dme(4),{row:o}=t,{i18n:n}=N();if(!o.updatedAt||typeof o.updatedAt!="string"){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=y$("span",{children:"\u2014"}),e[0]=i):i=e[0],i}let r=String(o.updatedAt),s;return e[1]!==n.language||e[2]!==r?(s=y$("span",{children:mme(r,n.language)}),e[1]=n.language,e[2]=r,e[3]=s):s=e[3],s};import{c as x$}from"react/compiler-runtime";import{jsx as pv,jsxs as fme}from"react/jsx-runtime";import{formatAdminURL as pme,getBestFitFromSizes as hme,isImage as gme}from"payload/shared";import"react";var bme=t=>{let e=x$(6),{collectionSlug:o,row:n}=t,{getEntityConfig:r}=G(),s,i;if(e[0]!==o||e[1]!==r||e[2]!==n){i=Symbol.for("react.early_return_sentinel");e:{let a=r({collectionSlug:o}),l=!!a?.upload,c=a?.upload?.displayPreview??!0;if(!l||!c){let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=pv(pS,{}),e[5]=m):m=e[5],i=m;break e}let u=n.mimeType,d=u?gme(u):!1,f=d?n.thumbnailURL||n.url:n.thumbnailURL;d&&(f=hme({sizes:n.sizes,thumbnailURL:n.thumbnailURL,url:n.url,width:n.width})),s=pv(on,{className:`${cr}__thumbnail`,collectionSlug:a?.slug,doc:n,fileSrc:f,imageCacheTag:a?.upload?.cacheTags?n.updatedAt:void 0,size:"small",uploadConfig:a?.upload})}e[0]=o,e[1]=r,e[2]=n,e[3]=s,e[4]=i}else s=e[3],i=e[4];return i!==Symbol.for("react.early_return_sentinel")?i:s},w$=t=>{let e=x$(4),{row:o}=t,{getEntityConfig:n}=G(),{config:r}=G(),{routes:s}=r,{admin:i}=s,l=n({collectionSlug:o._collectionSlug})?.admin?.useAsTitle||"id",c=typeof o[l]=="string"||typeof o[l]=="number"?o[l]:o.id,u;if(e[0]!==i||e[1]!==c||e[2]!==o){let d=typeof c=="object"?JSON.stringify(c):String(c),f=pme({adminRoute:i,path:`/collections/${o._collectionSlug}/${o.id}`});u=fme(jt,{className:`${cr}__name-link`,href:f,children:[pv(bme,{collectionSlug:o._collectionSlug,row:o}),pv("span",{className:`${cr}__name-text`,children:d})]}),e[0]=i,e[1]=c,e[2]=o,e[3]=u}else u=e[3];return u};import{jsx as Jo,jsxs as hv}from"react/jsx-runtime";import"react";var bo="slot-table";function S$({appearance:t="default",className:e,collectionSlug:o,columns:n,data:r,enableCheckbox:s=!0,enableDragHandle:i=!0,enableHeader:a=!0,enableSelectAll:l=!0,getRowId:c=(b,v)=>b.id??v,getRowLockedUser:u,mergeCheckboxHeader:d=!1,onCheckboxChange:f,onRowClick:m,onSelectAllChange:p,parentId:h,selectedIds:g=new Set}){let b=r.length>0&&r.every((S,_)=>g.has(c(S,_))),v=r.some((S,_)=>g.has(c(S,_))),C=()=>{p?.(!b)},y=(S,_,I)=>{f?.(S,!I,_)},x=(S,_)=>{m?.(S,_)},w=(S,_,I)=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),m?.(S,_))};return Jo("div",{className:[bo,t&&`${bo}--appearance-${t}`,e].filter(Boolean).join(" "),children:hv("table",{cellPadding:"0",cellSpacing:"0",children:[a&&Jo("thead",{children:hv("tr",{children:[s&&!d&&Jo("th",{className:`${bo}__th ${bo}__th--checkbox`,children:l&&Jo(Ft,{checked:b,className:`${bo}__checkbox`,onToggle:C,partialChecked:v&&!b,variant:"muted"})}),i&&Jo("th",{className:`${bo}__th ${bo}__th--drag`,children:Jo("span",{className:`${bo}__drag-header`})}),n.map((S,_)=>{let I=_===0&&s&&d;return Jo("th",{className:[`${bo}__th`,S.className].filter(Boolean).join(" "),colSpan:I?2:void 0,children:I&&l?hv("span",{className:`${bo}__th-merged`,children:[Jo(Ft,{checked:b,className:`${bo}__checkbox`,onToggle:C,partialChecked:v&&!b,variant:"muted"}),S.heading]}):S.heading},S.accessor)})]})}),Jo("tbody",{children:r.map((S,_)=>{let I=c(S,_),A=g.has(I),D=!!m;return hv("tr",{className:[`${bo}__tr`,A&&`${bo}__tr--selected`,D&&`${bo}__tr--clickable`].filter(Boolean).join(" "),"data-id":I,onClick:D?()=>x(S,_):void 0,onKeyDown:D?T=>w(S,_,T):void 0,tabIndex:D?0:void 0,children:[s&&Jo("td",{className:`${bo}__td ${bo}__td--checkbox`,children:(()=>{let T=u?.(S,_);return T?Jo(Li,{user:T}):Jo(Ft,{checked:A,className:`${bo}__checkbox`,onToggle:()=>y(S,_,A),variant:"muted"})})()}),i&&Jo("td",{className:`${bo}__td ${bo}__td--drag`,children:Jo("span",{className:`${bo}__drag-handle`,children:Jo(Ho,{})})}),n.map(T=>Jo("td",{className:[`${bo}__td`,T.className].filter(Boolean).join(" "),children:Jo(T.Cell,{column:T,row:S,rowIndex:_})},T.accessor))]},I)})})]})},`${o}-${h}`)}var yme=t=>t.row._hasChildren!==void 0?Ms(v$,{...t}):Ms(w$,{...t}),Cme=({row:t})=>Ms("span",{children:t._collectionLabel});function bv({baseFilter:t,childrenData:e,collections:o,collectionSlug:n,hasCreatePermission:r,HierarchyIcon:s,hierarchyLabel:i,parentFieldName:a,parentId:l,relatedBaseFilters:c,relatedGroups:u,search:d,useAsTitle:f}){let{i18n:m,t:p}=N(),{clearRouteCache:h}=zt(),{config:{routes:{api:g},serverURL:b},getEntityConfig:v}=G(),[C,y]=gv(e?.docs||[]),[x,w]=gv({hasNextPage:e?.hasNextPage||!1,hasPrevPage:e?.hasPrevPage||!1,limit:e?.limit||_d,page:e?.page||1,pagingCounter:e?.pagingCounter||1,totalDocs:e?.totalDocs||0,totalPages:e?.totalPages||1}),[S,_]=gv(!1),[I,A]=gv(()=>{let H={};for(let z of u)H[z.collectionSlug]={docs:z.data.docs,hasNextPage:z.data.hasNextPage,hasPrevPage:z.data.hasPrevPage||!1,isLoading:!1,limit:z.data.limit||_d,page:z.data.page||1,pagingCounter:z.data.pagingCounter||1,totalDocs:z.data.totalDocs,totalPages:z.data.totalPages||1};return H}),{isLocked:D,isSelected:T,toggleAllInCollection:R,toggleSelection:P}=xc(),E=IS(H=>D({id:H.id,collectionSlug:H._collectionSlug})?H._userEditing:void 0,[D]),F=IS(async H=>{if(!S){_(!0);try{let z=l?{[a]:{equals:l}}:{or:[{[a]:{exists:!1}},{[a]:{equals:null}}]},W=d?{[f]:{like:d}}:void 0,U=I$([z,W,t]),X=RS.stringify({limit:_d,page:H,where:U},{addQueryPrefix:!0}),Q=R$({apiRoute:g,path:`/${n}${X}`,serverURL:b}),J=await fetch(Q,{credentials:"include"});if(!J.ok)throw new Error("Failed to load page");let oe=await J.json();y(oe.docs),w({hasNextPage:oe.hasNextPage,hasPrevPage:oe.hasPrevPage,limit:oe.limit,page:oe.page,pagingCounter:oe.pagingCounter,totalDocs:oe.totalDocs,totalPages:oe.totalPages})}catch{}finally{_(!1)}}},[g,t,S,n,a,l,d,b,f]),L=IS(async(H,z)=>{let W=I[H];if(!W||W.isLoading)return;let U=u.find(X=>X.collectionSlug===H);if(U){A(X=>({...X,[H]:{...X[H],isLoading:!0}}));try{let X;if(l)X={[U.fieldName]:{in:[l]}};else{let we=[{[U.fieldName]:{exists:!1}},{[U.fieldName]:{equals:null}}];U.hasMany&&we.push({[U.fieldName]:{equals:[]}}),X={or:we}}let J=v({collectionSlug:H})?.admin?.useAsTitle||"id",oe=d?{[J]:{like:d}}:void 0,Y=c?.[H],K=I$([X,oe,Y]),ee=RS.stringify({limit:_d,page:z,where:K},{addQueryPrefix:!0}),te=R$({apiRoute:g,path:`/${H}${ee}`,serverURL:b}),re=await fetch(te,{credentials:"include"});if(!re.ok)throw new Error("Failed to load page");let me=await re.json();A(we=>({...we,[H]:{docs:me.docs,hasNextPage:me.hasNextPage,hasPrevPage:me.hasPrevPage,isLoading:!1,limit:me.limit,page:me.page,pagingCounter:me.pagingCounter,totalDocs:me.totalDocs,totalPages:me.totalPages}}))}catch{A(Q=>({...Q,[H]:{...Q[H],isLoading:!1}}))}}},[g,v,a,l,c,u,I,d,b]),M=th(()=>{let z=v({collectionSlug:n})?.hierarchy;if(z&&typeof z=="object"&&z.collectionSpecific)return z.collectionSpecific.fieldName},[n,v]),$=th(()=>_$(v({collectionSlug:n})?.labels?.plural,m)||i,[n,v,i,m]),B=th(()=>C.map(H=>({...H,id:H.id,_allowedCollections:M?H[M]:void 0,_collectionLabel:$,_collectionSlug:n,_hasChildren:!!H._hasChildren,_hierarchyIcon:s})),[s,M,C,$,n]),j=(x.totalDocs||0)>0,k=u.some(H=>I[H.collectionSlug]?.totalDocs>0),O=th(()=>{let H=[];j&&H.push({slug:n,docs:B,isChildren:!0,isHierarchyEnabled:!0,isLoading:S,label:$,onCheckboxChange:z=>P({id:z.id,collectionSlug:n,metadata:{allowedCollections:z._allowedCollections}}),onPageChange:z=>{F(z)},onSelectAllChange:()=>R({collectionSlug:n}),paginationData:{docs:C,hasNextPage:x.hasNextPage||!1,hasPrevPage:x.hasPrevPage||!1,limit:x.limit||_d,page:x.page||1,pagingCounter:x.pagingCounter||1,totalDocs:x.totalDocs||0,totalPages:x.totalPages||1}});for(let z of u){let W=I[z.collectionSlug];if(!W||W.totalDocs===0)continue;let U=v({collectionSlug:z.collectionSlug}),X=_$(U?.labels?.plural,m)||z.label,Q=W.docs.map(J=>({...J,id:J.id,_collectionLabel:X,_collectionSlug:z.collectionSlug}));H.push({slug:z.collectionSlug,docs:Q,isChildren:!1,isHierarchyEnabled:!1,isLoading:W.isLoading,label:X,onCheckboxChange:J=>P({id:J.id,collectionSlug:z.collectionSlug,metadata:{}}),onPageChange:J=>{L(z.collectionSlug,J)},onSelectAllChange:()=>R({collectionSlug:z.collectionSlug}),paginationData:{docs:W.docs||[],hasNextPage:W.hasNextPage||!1,hasPrevPage:W.hasPrevPage||!1,limit:W.limit||_d,page:W.page||1,pagingCounter:W.pagingCounter||1,totalDocs:W.totalDocs||0,totalPages:W.totalPages||1}})}return H},[C,S,x,$,B,n,v,F,L,j,m,u,I,R,P]),V=th(()=>[{accessor:"name",Cell:yme,className:`${cr}__col-name`,heading:p("general:name")},{accessor:"collection",Cell:Cme,className:`${cr}__col-collection`,heading:p("general:collection")},{accessor:"updatedAt",Cell:C$,className:`${cr}__col-date`,heading:p("general:updatedAt")}],[p]);if(!j&&!k){let H=r&&o&&o.length>0;return Ms(El,{Actions:H?[Ms(id,{collections:o,drawerSlug:`hierarchy-create-empty-${n}`,onSave:h},"create")]:void 0,description:p("general:noResultsDescription"),title:p("general:noResultsFound"),withMargin:!0})}return Ms("div",{className:cr,children:O.map(H=>vme(ip,{children:[Ms(ip.Header,{heading:H.label,children:Ms(zp,{data:H.paginationData,onChange:H.onPageChange})}),Ms(ip.Content,{children:Ms(S$,{collectionSlug:H.slug,columns:V,data:H.docs,enableCheckbox:!0,enableDragHandle:!1,enableHeader:!0,enableSelectAll:!0,getRowLockedUser:E,mergeCheckboxHeader:!1,onCheckboxChange:H.onCheckboxChange,onSelectAllChange:H.onSelectAllChange,parentId:l,selectedIds:new Set(H.docs.filter(z=>T({id:z.id,collectionSlug:H.slug})).map(z=>z.id))})})]},H.slug))})}var oh="collection-list";function Ime(t){let{AfterList:e,AfterListTable:o,beforeActions:n,BeforeList:r,BeforeListTable:s,collectionSlug:i,columnState:a,Description:l,disableBulkDelete:c,disableBulkEdit:u,disableQueryPresets:d,enableRowSelections:f,hasCreatePermission:m,hasDeletePermission:p,hasTrashPermission:h,hierarchyData:g,listMenuItems:b,newDocumentURL:v,NoResults:C,queryPreset:y,queryPresetPermissions:x,renderedFilters:w,resolvedFilterOptions:S,Table:_,viewType:I}=t,[A]=Lr(_),{allowCreate:D,createNewDrawerSlug:T,isInDrawer:R,onBulkSelect:P}=Sr(),E=D!==void 0?D&&m:m,{config:{routes:{admin:F},serverURL:L},getEntityConfig:M}=G(),$=Re(),{data:B,hasActiveFilters:j,isGroupingBy:k,query:O}=bt(),V=Sme(!!O?.where),[H,z]=_me(j);A$(()=>{V.current&&!O?.where?(V.current=!1,z(!1)):O?.where&&(V.current=!0)},[O?.where]);let{openModal:W}=ie(),{drawerSlug:U,setCollectionSlug:X,setOnSuccess:Q}=nr(),J=M({collectionSlug:i}),{labels:oe,upload:Y}=J,K=!!Y,ee=K&&J.upload.bulkUpload,te=!!J.trash,{i18n:re}=N(),me=yv(oe?.plural,re),{setStepNav:we}=Lo(),{breakpoints:{s:Ae}}=xS(),de=D$.useMemo(()=>K?B.docs.map($e=>({...$e,filesize:xme($e.filesize)})):B?.docs,[B?.docs,K]),xe=D$.useCallback(()=>{X(i),W(U),Q(()=>$.refresh())},[$,i,U,W,X,Q]);return A$(()=>{if(!R){let $e={label:me,url:g||te&&I==="trash"?T$({adminRoute:F,path:`/collections/${i}`}):void 0},Le={label:re.t("general:trash")},rt=te&&I==="trash"?[$e,Le]:[$e];if(g?.breadcrumbs){let q=g.parentFieldName||"parent",pe=g.breadcrumbs.map((fe,Pe)=>{let ge=Pe===g.breadcrumbs.length-1;return{label:fe.title,url:ge?void 0:T$({adminRoute:F,path:`/collections/${i}?${q}=${fe.id}`})}});rt=[...rt,...pe]}we(rt)}},[F,we,L,oe,R,te,I,re,i,g,me]),vv(wme,{children:[so(Xm,{collectionSlug:i,columnState:a,children:so("div",{className:`${oh} ${oh}--${i}`,children:vv(Ew,{docs:de,totalDocs:B?.totalDocs,children:[r,so(Ww,{collectionConfig:J,Description:l||J?.admin?.description?so("div",{className:`${oh}__sub-header`,children:so(le,{CustomComponent:l,Fallback:so(ap,{collectionSlug:i,description:J?.admin?.description})})}):void 0,disableBulkDelete:c,disableBulkEdit:u,hasCreatePermission:E,hasDeletePermission:p,hasTrashPermission:h,i18n:re,isBulkUploadEnabled:ee&&!Y.hideFileInputOnCreate,isTrashEnabled:te,newDocumentURL:v,openBulkUpload:xe,smallBreak:Ae,viewType:I}),so(Tw,{beforeActions:f&&typeof P=="function"?n?[...n,so(Sd,{onClick:P},"select-many")]:[so(Sd,{onClick:P},"select-many")]:n,collectionConfig:J,collectionSlug:i,disableQueryPresets:J?.enableQueryPresets!==!0||d,hasCreatePermission:E&&I!=="trash"&&!R,isWhereOpen:H,listMenuItems:b,newDocumentURL:v,onWhereToggle:()=>z($e=>!$e),queryPreset:y,queryPresetPermissions:x,renderedFilters:w,resolvedFilterOptions:S}),H&&so(Vb,{collectionPluralLabel:J?.labels?.plural,collectionSlug:i,fields:J?.fields,onEmptyRemove:()=>z(!1),renderedFilters:w,resolvedFilterOptions:S}),s,g?vv(Kp,{collectionData:{[i]:{docs:g.childrenData.docs},...Object.fromEntries(Object.entries(g.relatedDocumentsByCollection).map(([$e,Le])=>[$e,{docs:Le.result.docs}]))},children:[so(bv,{childrenData:g.childrenData,collectionSlug:i,hierarchyLabel:me,parentId:g.parentId,relatedGroups:Object.entries(g.relatedDocumentsByCollection).map(([$e,Le])=>({collectionSlug:$e,data:Le.result,fieldName:Le.fieldName,hasMany:Le.hasMany,label:Le.label})),useAsTitle:J?.admin?.useAsTitle||"id"},g.parentId),so(fv,{disableBulkDelete:c,disableBulkEdit:u})]}):de?.length>0?so(Qm,{children:A}):null,de?.length===0&&(C??so(El,{Actions:E&&v&&I!=="trash"?[R?so(Z,{el:"button",onClick:()=>W(T),children:re.t("general:createNewLabel",{label:yv(oe?.singular,re)})},"create"):so(Z,{el:"link",to:v,children:re.t("general:createNewLabel",{label:yv(oe?.singular,re)})},"create")]:[],description:I==="trash"?re.t("general:noTrashResults",{label:yv(oe?.plural,re)}):re.t("general:noResultsDescription"),title:I!=="trash"?re.t("general:noResultsFound"):void 0,withMargin:!0})),o,e,de?.length>0&&!k&&so(nv,{AfterPageControls:Ae?vv("div",{className:`${oh}__list-selection`,children:[so(gc,{collectionConfig:J,disableBulkDelete:c,disableBulkEdit:u,label:me,showSelectAllAcrossPages:!k}),so("div",{className:`${oh}__list-selection-actions`,children:f&&typeof P=="function"?n?[...n,so(Sd,{onClick:P},"select-many")]:[so(Sd,{onClick:P},"select-many")]:n})]}):null,collectionConfig:J})]})})}),de?.length>0&&k&&B.totalPages>1&&so(nv,{collectionConfig:J})]})}import{jsx as Bs,jsxs as Id}from"react/jsx-runtime";import{getTranslation as DS}from"@payloadcms/translations";import{formatAdminURL as N$}from"payload/shared";import*as FS from"qs-esm";import Nme,{Fragment as Eme,useCallback as AS,useEffect as Lme,useMemo as PS,useState as $me}from"react";import{c as Rme}from"react/compiler-runtime";import{jsx as TS}from"react/jsx-runtime";import{getTranslation as Tme}from"@payloadcms/translations";import"react";var Dme="hierarchy-list-header";function P$(t){let e=Rme(11),{collectionConfig:o,currentItemTitle:n,Description:r,disableBulkDelete:s,disableBulkEdit:i,HierarchyIcon:a,i18n:l,viewType:c}=t,{config:u}=G(),{labels:d}=o,f;if(e[0]!==r||e[1]!==a||e[2]!==o||e[3]!==u||e[4]!==n||e[5]!==s||e[6]!==i||e[7]!==l||e[8]!==d?.plural||e[9]!==c){let m=n||Tme(d?.plural,l);f=TS(Vp,{Actions:[TS(fv,{disableBulkDelete:s,disableBulkEdit:i,hierarchyIcon:a,hierarchySlug:o.slug},"document-list-selection"),TS(Yb,{collectionConfig:o,config:u,viewType:c},"default-list-actions")],AfterListHeaderContent:r,className:Dme,title:m}),e[0]=r,e[1]=a,e[2]=o,e[3]=u,e[4]=n,e[5]=s,e[6]=i,e[7]=l,e[8]=d?.plural,e[9]=c,e[10]=f}else f=e[10];return f}import{c as Ame}from"react/compiler-runtime";import{jsx as rh}from"react/jsx-runtime";import"react";var Pme="type-filter";function F$(t){let e=Ame(14),{i18n:o,onChange:n,options:r,selectedValues:s}=t,i=s.length!==r.length,a;e[0]!==n||e[1]!==r?(a=f=>{f.stopPropagation(),n(r.map(Fme))},e[0]=n,e[1]=r,e[2]=a):a=e[2];let l=a,c;e[3]!==n||e[4]!==r||e[5]!==s?(c=()=>rh(ue.RadioGroup,{children:r.map(f=>{let{label:m,value:p}=f,h=s?.includes(p);return rh(ue.Button,{active:h,icon:h?rh(Vo,{size:16}):void 0,onClick:()=>{let g=h?s.filter(b=>b!==p):[...s,p];n(g)},children:m},p)})}),e[3]=n,e[4]=r,e[5]=s,e[6]=c):c=e[6];let u;e[7]!==l||e[8]!==o||e[9]!==i?(u=f=>{let{active:m,onClick:p,onKeyDown:h}=f;return rh($p,{isActive:i,onClear:l,onClick:p,onKeyDown:h,popupActive:m,children:o.t("version:type")})},e[7]=l,e[8]=o,e[9]=i,e[10]=u):u=e[10];let d;return e[11]!==c||e[12]!==u?(d=rh(Ve,{className:Pme,horizontalAlign:"left",render:c,renderButton:u,verticalAlign:"bottom"}),e[11]=c,e[12]=u,e[13]=d):d=e[13],d}function Fme(t){return t.value}var wc="hierarchy-list";function jme(t){let{AfterList:e,baseFilter:o,BeforeList:n,collectionSlug:r,Description:s,hasCreatePermission:i,hierarchyData:a,HierarchyIcon:l,HierarchySmallIcon:c,viewType:u}=t,d=Re(),f=lt(),{startRouteTransition:m}=Ue(),{allowCreate:p,isInDrawer:h}=Sr(),g=p!==void 0?p&&i:i,{config:{routes:{admin:b}},getEntityConfig:v}=G(),C=v({collectionSlug:r}),{labels:y}=C,x=C?.hierarchy&&typeof C.hierarchy=="object"?C.hierarchy:void 0,w=x?.parentFieldName,{i18n:S,t:_}=N(),I=DS(y?.plural,S),{setStepNav:A}=Lo(),{parent:D,refreshTree:T}=No(),{clearRouteCache:R}=zt(),P=AS(()=>{R(),T(r)},[R,r,T]),E=f.get("search")||"",F=AS(J=>{let oe={};f.forEach((ee,te)=>{oe[te]=ee}),J?oe.search=J:delete oe.search;let Y=FS.stringify(oe,{addQueryPrefix:!0}),K=`${window.location.pathname}${Y}`;window.location.search!==Y&&m(()=>d.replace(K))},[d,f,m]),L=a?.breadcrumbs&&a.breadcrumbs.length>0?a.breadcrumbs[a.breadcrumbs.length-1].title:void 0;Lme(()=>{if(!h){let J=a?.breadcrumbs?.slice(0,-1)||[],Y=[{label:I,url:N$({adminRoute:b,path:`/collections/${r}`})}];if(J.length>0){let K=w||"parent",ee=J.map(te=>({label:te.title,url:N$({adminRoute:b,path:`/collections/${r}?${K}=${te.id}`})}));Y=[...Y,...ee]}A(Y)}},[b,A,h,r,a,I,w]);let M=a?.parentId??null,{allowedCollections:$}=a||{},B=[],j={};if(M!==null){j[w]=M;let J=x?.collectionSpecific&&typeof x.collectionSpecific=="object"?x.collectionSpecific.fieldName:void 0,oe=J?D?.[J]:void 0;J&&oe&&oe.length>0&&(j[J]=oe)}B.push({collectionSlug:r,initialData:Object.keys(j).length>0?j:{}});for(let[J,oe]of Object.entries(x?.relatedCollections||{})){if($&&$.length>0&&!$.some(K=>K.slug===J))continue;let Y=oe.hasMany?[M]:M;B.push({collectionSlug:J,initialData:M!==null?{[oe.fieldName]:Y}:{}})}let k=PS(()=>{let J=[];for(let[oe]of Object.entries(x?.relatedCollections||{})){if($&&$.length>0&&!$.some(K=>K.slug===oe))continue;let Y=v({collectionSlug:oe});J.push({label:DS(Y.labels?.plural,S),value:oe})}return J},[$,v,x?.relatedCollections,S]),O=f.get("typeFilter"),V=O?O.split(","):null,[H,z]=$me(()=>V||k.map(J=>J.value)),W=AS(J=>{z(J);let oe={};f.forEach((te,re)=>{oe[re]=te}),!(J.length===k.length)&&J.length>0?oe.typeFilter=J.join(","):delete oe.typeFilter;let K=FS.stringify(oe,{addQueryPrefix:!0}),ee=`${window.location.pathname}${K}`;window.location.search!==K&&m(()=>d.replace(ee))},[d,f,m,k.length]),U=PS(()=>{if(a?.childrenData)return a.childrenData},[a?.childrenData]),X=PS(()=>Object.entries(a?.relatedDocumentsByCollection||{}).filter(([J])=>H.includes(J)).map(([J,oe])=>({collectionSlug:J,data:oe.result,fieldName:oe.fieldName,hasMany:oe.hasMany,label:oe.label})),[a?.relatedDocumentsByCollection,H]),Q=a?{[r]:{docs:a.childrenData.docs},...Object.fromEntries(Object.entries(a.relatedDocumentsByCollection||{}).map(([J,oe])=>[J,{docs:oe.result.docs}]))}:{};return Bs(Eme,{children:Id("div",{className:`${wc} ${wc}--${r}`,children:[n,Bs(Kp,{collectionData:Q,children:Id("div",{className:`${wc}__wrap`,children:[Bs(P$,{collectionConfig:C,currentItemTitle:L,Description:Id(Nme.Fragment,{children:[a.allowedCollections&&a.allowedCollections.length>0&&Id("div",{className:`${wc}__allowed-types`,children:[_("general:accepts"),":"," ",a.allowedCollections.map(J=>J.label).join(", ")]}),s||C?.admin?.description?Bs("div",{className:`${wc}__sub-header`,children:Bs(le,{CustomComponent:s,Fallback:Bs(ap,{collectionSlug:r,description:C?.admin?.description})})}):null]}),HierarchyIcon:l,i18n:S,viewType:u}),Id(Dw,{className:`${wc}__controls`,children:[Id("div",{className:`${wc}__controls-left`,children:[Bs(Mp,{label:_("general:searchBy",{label:DS(C?.admin?.useAsTitle||"id",S)}),onSearchChange:F,searchQueryParam:E}),Bs(F$,{i18n:S,onChange:W,options:k,selectedValues:H},`type-filter-${a.parent?a.parent.id:"root"}`)]}),g&&B.length>0&&Bs(id,{buttonStyle:"primary",collections:B,drawerSlug:`hierarchy-create-${r}`,onSave:P})]}),Bs(bv,{baseFilter:o,childrenData:U,collections:B,collectionSlug:r,hasCreatePermission:g,HierarchyIcon:c??l,hierarchyLabel:I,parentFieldName:w,parentId:M,relatedGroups:X,search:E,useAsTitle:C?.admin?.useAsTitle||"id"},`${r}-${M}-${E}-${JSON.stringify(o)}-${U?.totalDocs}-${Object.entries(a?.relatedDocumentsByCollection||{}).map(([J,oe])=>`${J}:${oe.result.totalDocs}`).join(",")}`)]})}),e]})})}import{c as kme}from"react/compiler-runtime";import Mme from"react";var Bme=()=>{let t=kme(4),{setStepNav:e}=Lo(),{t:o}=N(),n,r;return t[0]!==e||t[1]!==o?(n=()=>{let s=[];s.push({label:o("authentication:account"),url:"/account"}),e(s)},r=[e,o],t[0]=e,t[1]=o,t[2]=n,t[3]=r):(n=t[2],r=t[3]),Mme.useEffect(n,r),null};import{c as Ome}from"react/compiler-runtime";import{jsx as NS,jsxs as Vme}from"react/jsx-runtime";import{formatAdminURL as Hme}from"payload/shared";import*as L$ from"qs-esm";import{Fragment as zme}from"react";var E$="confirm-reset-modal",Gme=t=>{let e=Ome(9),{user:o}=t,{openModal:n}=ie(),{t:r}=N(),{config:s}=G(),{routes:i}=s,{api:a}=i,l;e[0]!==a||e[1]!==o?(l=async()=>{if(!o)return;let f=L$.stringify({depth:0,where:{"user.value":{equals:o.id}}},{addQueryPrefix:!0});try{let m=await fetch(Hme({apiRoute:a,path:`/payload-preferences${f}`}),{credentials:"include",headers:{"Content-Type":"application/json"},method:"DELETE"}),h=(await m.json()).message;m.ok?se.success(h):se.error(h)}catch(m){let p=m}},e[0]=a,e[1]=o,e[2]=l):l=e[2];let c=l,u;e[3]!==n?(u=()=>n(E$),e[3]=n,e[4]=u):u=e[4];let d;return e[5]!==c||e[6]!==r||e[7]!==u?(d=Vme(zme,{children:[NS("div",{className:"payload-reset-preferences",children:NS(Z,{buttonStyle:"secondary",onClick:u,children:r("general:resetPreferences")})}),NS(nt,{body:r("general:resetPreferencesDescription"),confirmingLabel:r("general:resettingPreferences"),heading:r("general:resetPreferences"),modalSlug:E$,onConfirm:c})]}),e[5]=c,e[6]=r,e[7]=u,e[8]=d):d=e[8],d};import{c as Wme}from"react/compiler-runtime";import{jsx as Ume}from"react/jsx-runtime";import"react";var Xme=t=>{let e=Wme(8),{languageOptions:o}=t,{i18n:n,switchLanguage:r}=N(),s;e[0]!==r?(s=async a=>{await r(a.value)},e[0]=r,e[1]=s):s=e[1];let i;if(e[2]!==n||e[3]!==o||e[4]!==s){let a;e[6]!==n?(a=l=>l.value===n.language,e[6]=n,e[7]=a):a=e[7],i=Ume(mt,{inputId:"language-select",isClearable:!1,onChange:s,options:o,value:o.find(a)}),e[2]=n,e[3]=o,e[4]=s,e[5]=i}else i=e[5];return i};import{c as Zme}from"react/compiler-runtime";import{jsx as Yme}from"react/jsx-runtime";import"react";var Jme=()=>{let t=Zme(6),{highContrastMode:e,setHighContrastMode:o}=Us(),{t:n}=N(),r;t[0]!==o?(r=a=>{o(a.target.checked)},t[0]=o,t[1]=r):r=t[1];let s=r,i;return t[2]!==e||t[3]!==s||t[4]!==n?(i=Yme(Ft,{checked:e,id:"field-highContrastMode",label:n("general:enhancedContrastMode"),name:"highContrastMode",onToggle:s}),t[2]=e,t[3]=s,t[4]=n,t[5]=i):i=t[5],i};import{jsx as $$,jsxs as qme}from"react/jsx-runtime";import{useCallback as Qme,useMemo as Kme}from"react";var efe=()=>{let{autoMode:t,setTheme:e,theme:o}=Us(),{t:n}=N(),r=Kme(()=>[{label:n("general:automatic"),value:"auto"},{label:n("general:light"),value:"light"},{label:n("general:dark"),value:"dark"}],[n]),s=t?"auto":o,i=Qme(a=>{e(a.value)},[e]);return qme("div",{className:"payload-settings__theme",children:[$$(Fe,{htmlFor:"theme-select",label:n("general:theme")}),$$(mt,{inputId:"theme-select",isClearable:!1,onChange:i,options:r,value:r.find(a=>a.value===s)})]})};import{jsx as Pr,jsxs as Rd}from"react/jsx-runtime";import{formatAdminURL as ife,hasDraftsEnabled as k$}from"payload/shared";import*as Fr from"react";import{c as tfe}from"react/compiler-runtime";import{getTranslation as ofe}from"@payloadcms/translations";import{formatAdminURL as Cv}from"payload/shared";import{useEffect as rfe}from"react";var nh=t=>{let e=tfe(37),{id:o,collectionSlug:n,globalSlug:r,isTrashed:s,pluralLabel:i,useAsTitle:a}=t,l=t?.view||void 0,{isEditing:c,isInitializing:u}=be(),{title:d}=zo(),{isEntityVisible:f}=Up(),m;e[0]!==n||e[1]!==r||e[2]!==f?(m=f({collectionSlug:n,globalSlug:r}),e[0]=n,e[1]=r,e[2]=f,e[3]=m):m=e[3];let p=m,{setStepNav:h}=Lo(),{i18n:g,t:b}=N(),{config:v}=G(),{routes:C,serverURL:y}=v,{admin:x}=C,w;e[4]!==x||e[5]!==n||e[6]!==r||e[7]!==g||e[8]!==o||e[9]!==c||e[10]!==u||e[11]!==s||e[12]!==p||e[13]!==i||e[14]!==h||e[15]!==b||e[16]!==d||e[17]!==a||e[18]!==l?(w=()=>{let _=[];u||(n?(_.push({label:ofe(i,g),url:p?Cv({adminRoute:x,path:`/collections/${n}`}):void 0}),s&&_.push({label:b("general:trash"),url:p?Cv({adminRoute:x,path:`/collections/${n}/trash`}):void 0}),c?_.push({label:a&&a!=="id"&&d||`${o}`,url:p?Cv({adminRoute:x,path:s?`/collections/${n}/trash/${o}`:`/collections/${n}/${o}`}):void 0}):_.push({label:b("general:createNew")})):r&&_.push({label:d,url:p?Cv({adminRoute:x,path:`/globals/${r}`}):void 0}),l&&_.push({label:l}),h(_))},e[4]=x,e[5]=n,e[6]=r,e[7]=g,e[8]=o,e[9]=c,e[10]=u,e[11]=s,e[12]=p,e[13]=i,e[14]=h,e[15]=b,e[16]=d,e[17]=a,e[18]=l,e[19]=w):w=e[19];let S;return e[20]!==x||e[21]!==n||e[22]!==r||e[23]!==g||e[24]!==o||e[25]!==c||e[26]!==u||e[27]!==s||e[28]!==p||e[29]!==i||e[30]!==y||e[31]!==h||e[32]!==b||e[33]!==d||e[34]!==a||e[35]!==l?(S=[h,u,c,i,o,s,a,x,b,g,d,n,r,y,l,p],e[20]=x,e[21]=n,e[22]=r,e[23]=g,e[24]=o,e[25]=c,e[26]=u,e[27]=s,e[28]=p,e[29]=i,e[30]=y,e[31]=h,e[32]=b,e[33]=d,e[34]=a,e[35]=l,e[36]=S):S=e[36],rfe(w,S),null};import{c as nfe}from"react/compiler-runtime";import{jsx as sfe}from"react/jsx-runtime";import"react";var j$=t=>{let e=nfe(6),{localeOptions:o,onChange:n}=t,{t:r}=N(),s;if(e[0]!==o||e[1]!==n||e[2]!==r){let i;e[4]!==n?(i=a=>n(a),e[4]=n,e[5]=i):i=e[5],s=sfe(Wl,{field:{name:"locale",label:r("general:locale"),options:o},onChange:i,path:"locale"}),e[0]=o,e[1]=n,e[2]=r,e[3]=s}else s=e[3];return s};var an="query-inspector",afe=()=>{let{id:t,collectionSlug:e,globalSlug:o,initialData:n,isTrashed:r}=be(),s=lt(),{i18n:i,t:a}=N(),{code:l}=Ce(),{config:{defaultDepth:c,localization:u,routes:{api:d},serverURL:f},getEntityConfig:m}=G(),p=m({collectionSlug:e}),h=m({globalSlug:o}),g=u&&u.locales.map(O=>({label:O.label,value:O.code})),b=!1,v;p&&(b=k$(p),v=`/${e}/${t}`),h&&(b=k$(h),v=`/globals/${o}`);let[C,y]=Fr.useState(n),[x,w]=Fr.useState(s.get("draft")==="true"),[S,_]=Fr.useState(s?.get("locale")||l),[I,A]=Fr.useState(s.get("depth")||c.toString()),[D,T]=Fr.useState(!0),[R,P]=Fr.useState(!1),[E,F]=Fr.useState(f||""),L=Fr.useMemo(()=>C===void 0?"":JSON.stringify(C,null,2),[C]),[M,$]=Fr.useState(0);Fr.useEffect(()=>{$(O=>O+1)},[L]),Fr.useEffect(()=>{f||F(window.location.origin)},[f]);let B=typeof n?.deletedAt=="string",j=new URLSearchParams({depth:I,draft:String(x),locale:S,trash:B?"true":"false"}).toString(),k=ife({apiRoute:d,path:`${v}?${j}`,serverURL:E});return Fr.useEffect(()=>{(async()=>{try{let V=await fetch(k,{credentials:D?"include":"omit",headers:{"Accept-Language":i.language},method:"GET"});try{let H=await V.json();y(H)}catch(H){se.error("Error parsing response"),console.error(H)}}catch(V){se.error("Error making request"),console.error(V)}})()},[i.language,k,D]),Rd("div",{className:[an,R&&`${an}--fullscreen`].filter(Boolean).join(" "),children:[Pr(nh,{collectionSlug:e,globalLabel:h?.label,globalSlug:o,id:t,isTrashed:r,pluralLabel:p?p?.labels?.plural:void 0,useAsTitle:p?p?.admin?.useAsTitle:void 0,view:"API"}),Rd("div",{className:`${an}__content`,children:[Pr("div",{className:`${an}__configuration`,children:Pr(fo,{initialState:{authenticated:{initialValue:D||!1,valid:!0,value:D||!1},depth:{initialValue:Number(I||0),valid:!0,value:Number(I||0)},draft:{initialValue:x||!1,valid:!0,value:x||!1},locale:{initialValue:S,valid:!0,value:S}},children:Rd("div",{className:`${an}__form-fields`,children:[g&&Pr(j$,{localeOptions:g,onChange:_}),Pr(Ol,{field:{name:"depth",admin:{step:1},label:a("general:depth"),max:10,min:0},onChange:O=>A(O?.toString()),path:"depth"}),b&&Pr(gr,{field:{name:"draft",label:a("version:draft")},onChange:()=>w(!x),path:"draft"}),Pr(gr,{field:{name:"authenticated",label:a("authentication:authenticated")},onChange:()=>T(!D),path:"authenticated"})]})})}),Rd("div",{className:`${an}__results-wrapper`,children:[Rd("div",{className:`${an}__results-bar`,children:[Pr("div",{className:`${an}__api-url-field`,children:Pr(Df,{className:`${an}__api-url-input`,htmlAttributes:{"aria-label":"API URL",readOnly:!0},path:"api-url",readOnly:!1,value:k})}),Rd("div",{className:`${an}__results-bar-actions`,children:[Pr(Z,{"aria-label":a("general:openInNewWindow"),buttonStyle:"secondary",className:`${an}__api-url-open-button`,el:"anchor",icon:Pr(Yp,{size:16}),margin:!1,newTab:!0,size:"large",url:k}),Pr(Z,{"aria-label":"toggle fullscreen",buttonStyle:"secondary",className:`${an}__toggle-fullscreen-button`,icon:Pr(fS,{isMinimized:!R}),margin:!1,onClick:()=>P(!R),size:"large"})]})]}),Pr("div",{className:`${an}__results`,children:Pr(wl,{defaultLanguage:"json",height:"100%",options:{fixedOverflowWidgets:!0,folding:!0,lineNumbers:"on",stickyScroll:{enabled:!1},wordWrap:"off"},readOnly:!0,recalculatedHeightAt:M,value:L})})]})]})]})};import{jsx as Td,jsxs as M$}from"react/jsx-runtime";import{formatAdminURL as lfe}from"payload/shared";import B$,{useEffect as cfe}from"react";var ES="create-first-user__form",ufe=({docPermissions:t,docPreferences:e,initialState:o,loginWithUsername:n,userSlug:r})=>{let{config:{routes:{admin:s,api:i}},getEntityConfig:a}=G(),{getFormState:l}=ct(),{t:c}=N(),{setUser:u}=ye(),d=B$.useRef(null),f=a({collectionSlug:r}),m=B$.useCallback(async({formState:h,submitted:g})=>{let b=_r(d),v=await l({collectionSlug:r,docPermissions:t,docPreferences:e,formState:h,operation:"create",schemaPath:r,signal:b.signal,skipValidation:!g});if(d.current=null,v&&v.state)return v.state},[r,l,t,e]),p=h=>{u(h)};return cfe(()=>{let h=d.current;return()=>{Fo(h)}},[]),M$(fo,{action:lfe({apiRoute:i,path:`/${r}/first-register`}),className:ES,initialState:{...o,"confirm-password":{...o["confirm-password"],valid:o["confirm-password"].valid||!1,value:o["confirm-password"].value||""}},method:"POST",onChange:[m],onSuccess:p,redirect:s,validationOperation:"create",children:[M$("div",{className:`${ES}__inputWrap`,children:[Td(eh,{loginWithUsername:n,operation:"create",readOnly:!1,t:c}),Td(Qn,{autoComplete:"off",field:{name:"password",label:c("authentication:newPassword"),required:!0},path:"password"}),Td(Ri,{}),Td(co,{fields:f.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:r,permissions:!0,readOnly:!1})]}),Td("div",{className:`${ES}__actions`,children:Td(qt,{size:"large",children:c("authentication:createUser")})})]})};import{c as VS}from"react/compiler-runtime";import{jsx as Zt,jsxs as Bi}from"react/jsx-runtime";import{DndContext as Mfe,DragOverlay as Bfe,useDraggable as Ofe,useDroppable as Vfe}from"@dnd-kit/core";var O$=t=>{let{activatorEvent:e,draggingNodeRect:o,transform:n}=t;if(o&&e){let r=X4(e);if(!r)return n;let s=r.x-o.left,i=r.y-o.top;return{...n,x:n.x+s-o.width/2,y:n.y+i-o.height/2}}return n};import Hfe,{useMemo as zfe,useState as Gfe}from"react";import{c as V$}from"react/compiler-runtime";import{jsx as ln,jsxs as xv,Fragment as dfe}from"react/jsx-runtime";import{useEffect as mfe,useId as ffe}from"react";function H$(t){let e=V$(15),{addWidget:o,cancel:n,isEditing:r,resetLayout:s,saveLayout:i,setIsEditing:a,widgets:l}=t,{t:c}=N(),{setStepNav:u}=Lo(),f=`widgets-drawer-${ffe()}`,m,p;e[0]!==n||e[1]!==f||e[2]!==r||e[3]!==s||e[4]!==i||e[5]!==a||e[6]!==u?(m=()=>{u([{label:ln(pfe,{isEditing:r,onCancel:n,onEditClick:()=>a(!0),onResetLayout:s,onSaveChanges:i,widgetsDrawerSlug:f})}])},p=[r,f,n,s,i,a,u],e[0]=n,e[1]=f,e[2]=r,e[3]=s,e[4]=i,e[5]=a,e[6]=u,e[7]=m,e[8]=p):(m=e[7],p=e[8]),mfe(m,p);let h;return e[9]!==o||e[10]!==f||e[11]!==r||e[12]!==c||e[13]!==l?(h=ln(dfe,{children:r&&ln(dS,{drawerSlug:f,items:l,onItemClick:g=>o(g.slug),searchPlaceholder:c("dashboard:searchWidgets"),title:c("dashboard:addWidget")})}),e[9]=o,e[10]=f,e[11]=r,e[12]=c,e[13]=l,e[14]=h):h=e[14],h}function pfe(t){let e=V$(14),{isEditing:o,onCancel:n,onEditClick:r,onResetLayout:s,onSaveChanges:i,widgetsDrawerSlug:a}=t,{t:l}=N();if(o){let f;return e[0]!==n||e[1]!==i||e[2]!==l||e[3]!==a?(f=xv("div",{className:"dashboard-breadcrumb-dropdown__editing",children:[ln("span",{children:l("dashboard:editingDashboard")}),xv("div",{className:"dashboard-breadcrumb-dropdown__actions",children:[ln(Jr,{className:"drawer-toggler--unstyled",slug:a,children:ln(Z,{buttonStyle:"primary",el:"span",size:"medium",children:l("dashboard:addButton")})}),ln(Z,{buttonStyle:"pill",onClick:i,size:"medium",children:l("fields:saveChanges")}),ln(Z,{buttonStyle:"pill",onClick:n,size:"medium",children:l("general:cancel")})]})]}),e[0]=n,e[1]=i,e[2]=l,e[3]=a,e[4]=f):f=e[4],f}let c;e[5]!==r||e[6]!==s||e[7]!==l?(c=f=>{let{close:m}=f;return xv(Ys,{children:[ln(Fn,{onClick:()=>{m(),r()},children:l("dashboard:editDashboard")}),ln(Fn,{onClick:()=>{m(),s()},children:l("dashboard:resetLayout")})]})},e[5]=r,e[6]=s,e[7]=l,e[8]=c):c=e[8];let u;e[9]!==l?(u=f=>{let{active:m,onClick:p,onKeyDown:h,...g}=f;return ln(Z,{"aria-label":l("general:dashboard"),buttonStyle:"ghost",extraButtonProps:{onKeyDown:h},onClick:p,...g,children:xv("span",{className:"dashboard-breadcrumb-dropdown__label",children:[l("general:dashboard"),ln(ve,{direction:"down",size:16})]})})},e[9]=l,e[10]=u):u=e[10];let d;return e[11]!==c||e[12]!==u?(d=ln(Ve,{className:"dashboard-breadcrumb-dropdown",horizontalAlign:"left",render:c,renderButton:u,size:"large"}),e[11]=c,e[12]=u,e[13]=d):d=e[13],d}import{PREFERENCE_KEYS as yfe}from"payload/shared";import $S,{useCallback as Os,useEffect as Cfe,useState as W$}from"react";import{c as hfe}from"react/compiler-runtime";import{jsx as z$,Fragment as gfe}from"react/jsx-runtime";import G$,{useEffect as bfe,useRef as vfe}from"react";var LS=t=>{let e=hfe(10),{widgetData:o,widgetId:n}=t,[r,s]=G$.useState(null),{serverFunction:i}=ct(),a=vfe(0),l;e[0]!==i||e[1]!==o||e[2]!==n?(l=()=>{(async function(){let h=a.current=a.current+1;s(null);try{let g=n.slice(0,n.lastIndexOf("-")),b=await i({name:"render-widget",args:{widgetData:o,widgetSlug:g}});if(h!==a.current)return;s(b.component)}catch{if(h!==a.current)return;s(G$.createElement("div",{style:{background:"var(--theme-error-50)",border:"1px solid var(--theme-error-200)",borderRadius:"4px",color:"var(--theme-error-text)",padding:"20px",textAlign:"center"}},"Failed to load widget. Please try again later."))}})()},e[0]=i,e[1]=o,e[2]=n,e[3]=l):l=e[3];let c=l,u,d;if(e[4]!==c?(u=()=>{c()},d=[c],e[4]=c,e[5]=u,e[6]=d):(u=e[5],d=e[6]),bfe(u,d),!r){let m;return e[7]===Symbol.for("react.memo_cache_sentinel")?(m=z$(Ct,{height:"100%"}),e[7]=m):m=e[7],m}let f;return e[8]!==r?(f=z$(gfe,{children:r}),e[8]=r,e[9]=f):f=e[9],f};function U$(t){let e=xfe(),[o,n]=W$(!1),{widgets:r=[]}=G().config.admin.dashboard??{},[s,i]=W$(t),{openModal:a}=ie(),l="cancel-dashboard-changes",{serverFunction:c}=ct(),{t:u}=N();Cfe(()=>{o||i(t)},[t]);let d=Os(async()=>{try{let x=s.map(w=>w.item);n(!1),await e(x)}catch{n(!0),se.error(u("error:failedToSaveLayout"))}},[e,s]),f=Os(async()=>{try{await e(null);let x=await c({name:"get-default-layout",args:{}});i(x.layout),n(!1)}catch{se.error(u("error:failedToResetLayout"))}},[e,c]),m=Os(()=>{i(t),n(!1)},[t]),p=Os(()=>{s.length!==t.length||s.some((w,S)=>{let _=t[S];return!_||w.item.id!==_.item.id||w.item.width!==_.item.width||JSON.stringify(w.item.data||{})!==JSON.stringify(_.item.data||{})})?a(l):m()},[s,t,a,l,m]),h=Os(({moveFromIndex:x,moveToIndex:w})=>{x===w||x<0||w<0||i(S=>jc(S,x,w))},[]),g=Os(x=>{if(!o)return;let w=`${x}-${Date.now()}`,S=r.find(I=>I.slug===x),_={component:$S.createElement(LS,{widgetData:{},widgetId:w}),item:{id:w,data:{},maxWidth:S?.maxWidth??"full",minWidth:S?.minWidth??"x-small",width:S?.minWidth??"x-small"}};i(I=>[...I,_]),setTimeout(()=>{let I=document.getElementById(w);if(I){I.scrollIntoView({behavior:"smooth",block:"center"});let A=I.closest(".widget");A&&(A.classList.add("widget--highlight"),setTimeout(()=>{A.classList.remove("widget--highlight")},1500))}},100)},[o,r]),b=Os(x=>{o&&i(w=>w.filter(S=>S.item.id!==x))},[o]),v=Os((x,w)=>{o&&i(S=>S.map(_=>_.item.id===x?{..._,item:{..._.item,width:w}}:_))},[o]),C=Os((x,w)=>{o&&i(S=>S.map(_=>_.item.id===x?{component:$S.createElement(LS,{widgetData:w,widgetId:x}),item:{..._.item,data:w}}:_))},[o]),y=$S.createElement(nt,{body:u("dashboard:discardMessage"),confirmLabel:u("dashboard:discardConfirmLabel"),heading:u("dashboard:discardTitle"),modalSlug:l,onConfirm:m});return{addWidget:g,cancel:p,cancelModal:y,currentLayout:s,deleteWidget:b,isEditing:o,moveWidget:h,resetLayout:f,resizeWidget:v,saveLayout:d,setIsEditing:n,updateWidgetData:C}}function xfe(){let{setPreference:t}=Jt();return Os(async e=>{await t(yfe.DASHBOARD_LAYOUT,{layouts:e},!1)},[t])}var X$=t=>{let e=[],o,n;if(t.pointerCoordinates)o=t.pointerCoordinates.x,n=t.pointerCoordinates.y;else if(t.collisionRect)o=t.collisionRect.left+t.collisionRect.width/2,n=t.collisionRect.top+t.collisionRect.height/2;else return[];for(let r of t.droppableContainers){let s=t.droppableRects.get(r.id);if(s&&n>=s.top&&n<=s.bottom){let i=s.left+s.width/2,a=Math.abs(o-i);e.push({id:String(r.id),data:{value:a}})}}return e.sort((r,s)=>r.data.value-s.data.value)};import{KeyboardCode as sh,KeyboardSensor as wfe,MouseSensor as Sfe,TouchSensor as _fe,useSensor as jS,useSensors as Ife}from"@dnd-kit/core";function Rfe(){let o=[],n=0,r=null,s=Array.from(document.querySelectorAll(".droppable-widget"));for(let i=0;i<s.length;i++){let a=s[i],l=a.getBoundingClientRect();if(l.width===0||l.height===0)continue;let c=l.left+l.width/2,u=l.top+l.height/2,f=(a.getAttribute("data-testid")||"").endsWith("-before");f&&s.some((p,h)=>{if(h===i)return!1;let g=p.getBoundingClientRect(),b=g.left+g.width/2,v=g.top+g.height/2;return Math.abs(b-c)<5&&Math.abs(v-u)<5})||(r===null?r=u:Math.abs(u-r)>=10&&(n++,r=u),o.push({centerX:c,centerY:u,element:a,isBeforeDroppable:f,rect:l,row:n}))}return o}function Tfe(t,e){if(t.length===0)return null;let o=t[0].row,n=1/0;for(let r of t){let s=Math.abs(r.centerY-e);s<n&&(n=s,o=r.row)}return o}function kS(t,e,o){let n=-1,r=1/0;for(let s=0;s<t.length;s++){let i=t[s];if(i.row===e){let a=Math.abs(i.centerX-o);a<r&&(r=a,n=s)}}return n===-1?null:{droppable:t[n],index:n}}function Dfe(t,e,o,n){let r=Tfe(t,o);if(r===null)return null;let s=kS(t,r,e);if(!s)return null;let{index:i}=s;switch(n){case"ArrowDown":{let a=r+1;return kS(t,a,e)?.droppable||null}case"ArrowLeft":return t[i-1]||null;case"ArrowRight":return t[i+1]||null;case"ArrowUp":{let a=r-1;return kS(t,a,e)?.droppable||null}default:return null}}var Afe=(t,{context:e,currentCoordinates:o})=>{let{collisionRect:n}=e,{code:r}=t;if(!n||!["ArrowDown","ArrowLeft","ArrowRight","ArrowUp"].includes(r))return o;t.preventDefault(),e.scrollableAncestors&&(e.scrollableAncestors.length=0);let s=Rfe();if(s.length===0)return o;let i=n.left+n.width/2,a=n.top+n.height/2,l=Dfe(s,i,a,r);if(l){let c=window.innerHeight,u=l.rect,d=20,f=u.top<d,m=u.bottom>c-d;if(f){let C=u.top-d;window.scrollBy({behavior:"instant",top:C})}else if(m){let C=u.bottom-c+d;window.scrollBy({behavior:"instant",top:C})}let p=l.element.getBoundingClientRect(),h=p.left+p.width/2,g=p.top+p.height/2,b=h-i,v=g-a;return{x:o.x+b,y:o.y+v}}return o},MS=class extends wfe{static activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:o={cancel:[sh.Esc],end:[sh.Space,sh.Enter],start:[sh.Space,sh.Enter]},onActivation:n},{active:r})=>{let{code:s}=e.nativeEvent;return e.target!==r.node.current?!1:o.start.includes(s)?(e.preventDefault(),n?.({event:e.nativeEvent}),!0):!1}}]};function Z$(){return Ife(jS(Sfe,{activationConstraint:{distance:5}}),jS(_fe,{activationConstraint:{delay:200,tolerance:5}}),jS(MS,{coordinateGetter:Afe}))}import{c as Lfe}from"react/compiler-runtime";import{jsx as ej,jsxs as OS,Fragment as $fe}from"react/jsx-runtime";import{useId as jfe}from"react";import{jsx as ih,jsxs as Pfe}from"react/jsx-runtime";import{useCallback as Ffe,useEffect as q$,useMemo as BS,useRef as Nfe,useState as Efe}from"react";import{fieldAffectsData as wv,fieldHasSubFields as Sv,tabHasName as Y$}from"payload/shared";function J$(t){return"localized"in t&&!!t.localized}function Sc(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{}}function Dd(t,e,o){let n={};for(let r of o){if(r.type==="tabs"){for(let a of r.tabs){let l=a.fields;Y$(a)?n[a.name]=Dd(Sc(t[a.name]),e,l):Object.assign(n,Dd(t,e,l))}continue}if(Sv(r)&&!wv(r)){Object.assign(n,Dd(t,e,r.fields));continue}if(!wv(r))continue;let{name:s}=r,i=t[s];if(Sv(r)){n[s]=Dd(Sc(i),e,r.fields);continue}J$(r)&&i!==void 0&&typeof i=="object"&&i!==null&&!Array.isArray(i)?n[s]=i[e]:n[s]=i}return n}function Ad(t,e,o,n){let r={...t};for(let s of n){if(s.type==="tabs"){for(let a of s.tabs){let l=a.fields;Y$(a)?r[a.name]=Ad(Sc(r[a.name]),Sc(e[a.name]),o,l):Object.assign(r,Ad(r,e,o,l))}continue}if(Sv(s)&&!wv(s)){Object.assign(r,Ad(r,e,o,s.fields));continue}if(!wv(s))continue;let{name:i}=s;if(Sv(s)){r[i]=Ad(Sc(r[i]),Sc(e[i]),o,s.fields);continue}J$(s)?r[i]={...Sc(r[i]),[o]:e[i]}:r[i]=e[i]}return r}var Q$={fields:{}};function K$({drawerSlug:t,onSave:e,widget:o,widgetData:n}){let{closeModal:r,modalState:s}=ie(),{getFormState:i}=ct(),{t:a}=N(),c=Ce()?.code??"en",u=Nfe(null),[d,f]=Efe(!1),m=!!s?.[t]?.isOpen,p=BS(()=>Qr(),[]),h=BS(()=>typeof o.label=="string"?o.label:o.slug,[o.label,o.slug]),g=BS(()=>o.fields??[],[o.fields]);q$(()=>{if(!m||g.length===0){f(!1);return}let v=new AbortController;return(async()=>{let y=Dd(n??{},c,g),{state:x}=await i({data:y,docPermissions:{fields:!0},docPreferences:Q$,locale:c,operation:"update",renderAllFields:!0,schemaPath:o.slug,signal:v.signal,widgetSlug:o.slug});x&&f(x)})(),()=>{Fo(v)}},[g,i,m,c,o.slug,n]);let b=Ffe(async({formState:v})=>{Fo(u.current);let C=new AbortController;u.current=C;let{state:y}=await i({docPermissions:{fields:!0},docPreferences:Q$,formState:v,operation:"update",schemaPath:o.slug,signal:C.signal,widgetSlug:o.slug});return y||v},[i,o.slug]);return q$(()=>()=>{Fo(u.current)},[]),ih(It,{slug:t,title:`${a("general:edit")} ${h}`,children:d===!1?ih(Ct,{height:"250px"}):ih(vl,{operation:"update",children:Pfe(fo,{fields:g,initialState:d,onChange:[b],onSubmit:(v,C)=>{e(Ad(n??{},C,c,g)),r(t)},uuid:p,children:[ih(co,{fields:g,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:o.slug,permissions:!0,readOnly:!1}),ih(qt,{children:a("fields:saveChanges")})]})})})}var kfe=t=>t.slice(0,t.lastIndexOf("-"));function tj(t){let e=Lfe(7),{onSave:o,widgetData:n,widgetID:r}=t,{t:s}=N(),{openModal:i}=ie(),{widgets:a}=G().config.admin.dashboard??{},l=a===void 0?[]:a,c;e[0]!==r?(c=kfe(r),e[0]=r,e[1]=c):c=e[1];let u=c,d;e[2]!==u?(d=b=>b.slug===u,e[2]=u,e[3]=d):d=e[3];let f=l.find(d),m=!!f?.fields?.length,h=`widget-editor-${jfe()}`;if(!m)return null;let g;return e[4]!==h||e[5]!==i?(g=()=>{i(h)},e[4]=h,e[5]=i,e[6]=g):g=e[6],OS($fe,{children:[OS("button",{className:"widget-wrapper__edit-btn",onClick:g,type:"button",children:[OS("span",{className:"sr-only",children:[s("general:edit")," ",r]}),ej(fr,{})]}),ej(K$,{drawerSlug:h,onSave:o,widget:f,widgetData:n})]})}var Wfe=t=>{let{activatorEvent:e}=t;return e&&"key"in e?t.transform:O$(t)},_v={"x-small":25,small:1/3*100,medium:50,large:2/3*100,"x-large":75,full:100};function Ufe(t){let e=VS(22),{clientLayout:o,widgets:n}=t,{t:r}=N(),{addWidget:s,cancel:i,cancelModal:a,currentLayout:l,deleteWidget:c,isEditing:u,moveWidget:d,resetLayout:f,resizeWidget:m,saveLayout:p,setIsEditing:h,updateWidgetData:g}=U$(o),[b,v]=Gfe(null),C=Z$(),y;if(e[0]!==b||e[1]!==s||e[2]!==i||e[3]!==a||e[4]!==l||e[5]!==c||e[6]!==u||e[7]!==d||e[8]!==f||e[9]!==m||e[10]!==p||e[11]!==C||e[12]!==h||e[13]!==r||e[14]!==g||e[15]!==n){let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{v(null)},e[17]=x):x=e[17];let w;e[18]!==l||e[19]!==d?(w=_=>{if(!_.over){v(null);return}let I=_.over.id,A=I.lastIndexOf("-"),D=I.slice(0,A),T=I.slice(A+1);if(D===_.active.id)return;let R=l?.findIndex(E=>E.item.id===_.active.id),P=l?.findIndex(E=>E.item.id===D);R<P&&P--,T==="after"&&P++,d({moveFromIndex:R,moveToIndex:P}),v(null)},e[18]=l,e[19]=d,e[20]=w):w=e[20];let S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=_=>{v(_.active.id)},e[21]=S):S=e[21],y=Bi("div",{children:[Zt(Mfe,{autoScroll:{enabled:!0,threshold:{x:0,y:.2}},collisionDetection:X$,id:"dashboard-dnd-context",onDragCancel:x,onDragEnd:w,onDragStart:S,sensors:C,children:Bi("div",{className:`modular-dashboard ${u?"editing":""}`,style:{display:"flex",flexWrap:"wrap"},children:[l?.length===0&&Zt("div",{className:"modular-dashboard__empty",children:Zt("p",{children:r("dashboard:noItems")})}),l?.map((_,I)=>Zt(Hfe.Fragment,{children:Zt(Yfe,{disabled:!u,id:_.item.id,style:{width:`${_v[_.item.width]}%`},width:_.item.width,children:Bi("div",{className:`widget-wrapper ${u?"widget-wrapper--editing":""}`,children:[Zt("div",{"aria-hidden":u,className:"widget-content",inert:u,children:_.component}),u&&Bi("div",{className:"widget-wrapper__controls",onPointerDown:Xfe,children:[Zt(tj,{onSave:A=>{g(_.item.id,A)},widgetData:_.item.data,widgetID:_.item.id}),Zt(Zfe,{currentWidth:_.item.width,maxWidth:_.item.maxWidth,minWidth:_.item.minWidth,onResize:A=>m(_.item.id,A)}),Bi("button",{className:"widget-wrapper__delete-btn",onClick:()=>c(_.item.id),type:"button",children:[Zt("span",{className:"sr-only",children:r("dashboard:deleteWidget",{id:_.item.id})}),Zt(xt,{})]})]})]})})},_.item.id)),Zt(Bfe,{className:"drag-overlay",dropAnimation:{duration:100},modifiers:[Wfe],children:b?(()=>{let _=l?.find(I=>I.item.id===b);return _?Zt("div",{style:{transform:"scale(0.25)"},children:Zt("div",{className:`widget-wrapper ${u?"widget-wrapper--editing":""}`,children:Zt("div",{className:"widget-content",children:_.component})})}):null})():null})]})}),Zt(H$,{addWidget:s,cancel:i,isEditing:u,resetLayout:f,saveLayout:p,setIsEditing:h,widgets:n}),a]}),e[0]=b,e[1]=s,e[2]=i,e[3]=a,e[4]=l,e[5]=c,e[6]=u,e[7]=d,e[8]=f,e[9]=m,e[10]=p,e[11]=C,e[12]=h,e[13]=r,e[14]=g,e[15]=n,e[16]=y}else y=e[16];return y}function Xfe(t){return t.stopPropagation()}function Zfe({currentWidth:t,maxWidth:e,minWidth:o,onResize:n}){let r=zfe(()=>{let i=_v[o],a=_v[e];return Object.entries(_v).map(([l,c])=>({width:l,percentage:c})).filter(l=>l.percentage>=i&&l.percentage<=a)},[o,e]);return r.length<=1?null:Zt(Ve,{button:Bi("button",{className:"widget-wrapper__size-btn",onPointerDown:i=>i.stopPropagation(),type:"button",children:[Zt("span",{className:"widget-wrapper__size-btn-text",children:t}),Zt(ve,{className:"widget-wrapper__size-btn-icon"})]}),buttonType:"custom",render:({close:i})=>Zt(Ys,{children:r.map(a=>{let l=a.width===t;return Bi(Fn,{active:l,onClick:()=>{n(a.width),i()},children:[Zt("span",{className:"widget-wrapper__size-btn-label",children:a.width}),Bi("span",{className:"widget-wrapper__size-btn-percentage",children:[a.percentage.toFixed(0),"%"]})]},a.width)})}),size:"small",verticalAlign:"bottom"})}function Yfe(t){let e=VS(13),o;e[0]!==t.disabled||e[1]!==t.id?(o={id:t.id,disabled:t.disabled},e[0]=t.disabled,e[1]=t.id,e[2]=o):o=e[2];let{attributes:n,isDragging:r,listeners:s,setNodeRef:i}=Ofe(o),a=r?.3:1,l;if(e[3]!==n||e[4]!==s||e[5]!==t.children||e[6]!==t.disabled||e[7]!==t.id||e[8]!==t.style||e[9]!==t.width||e[10]!==i||e[11]!==a){let c={...t.style,opacity:a,position:"relative"},u=t.disabled?{}:{...s,...n};l=Bi("div",{className:"widget","data-slug":t.id,"data-width":t.width,style:c,children:[Zt(oj,{id:t.id,position:"before"}),Zt("div",{className:"draggable",id:t.id,ref:i,...u,style:{width:"100%",height:"100%"},children:t.children}),Zt(oj,{id:t.id,position:"after"})]}),e[3]=n,e[4]=s,e[5]=t.children,e[6]=t.disabled,e[7]=t.id,e[8]=t.style,e[9]=t.width,e[10]=i,e[11]=a,e[12]=l}else l=e[12];return l}function oj(t){let e=VS(11),{id:o,position:n}=t,r=`${o}-${n}`,s;e[0]!==n?(s={position:n},e[0]=n,e[1]=s):s=e[1];let i;e[2]!==r||e[3]!==s?(i={id:r,data:s},e[2]=r,e[3]=s,e[4]=i):i=e[4];let{setNodeRef:a,isOver:l}=Vfe(i),c=`${o}-${n}`,u=n==="before"?-2:"auto",d=n==="after"?-2:"auto",f=l?"var(--color-bg-success)":"transparent",m;return e[5]!==a||e[6]!==c||e[7]!==u||e[8]!==d||e[9]!==f?(m=Zt("div",{className:"droppable-widget","data-testid":c,ref:a,style:{position:"absolute",left:u,right:d,top:0,bottom:0,borderRadius:"1000px",width:"4px",backgroundColor:f,marginBottom:"10px",marginTop:"10px",pointerEvents:"none",zIndex:1e3}}),e[5]=a,e[6]=c,e[7]=u,e[8]=d,e[9]=f,e[10]=m):m=e[10],m}import{c as Jfe}from"react/compiler-runtime";import{jsx as Pd,jsxs as qfe}from"react/jsx-runtime";import{email as Qfe,formatAdminURL as Kfe,text as epe}from"payload/shared";import{useState as tpe}from"react";var HS="forgot-password__form",ope=()=>{let t=Jfe(17),{config:e,getEntityConfig:o}=G(),{admin:n,routes:r}=e,{user:s}=n,{api:i}=r,{t:a}=N(),[l,c]=tpe(!1),u;t[0]!==o||t[1]!==s?(u=o({collectionSlug:s}),t[0]=o,t[1]=s,t[2]=u):u=t[2];let f=u?.auth?.loginWithUsername,m;t[3]!==f||t[4]!==a?(m=(b,v,C)=>{b.json().then(()=>{c(!0),v(a("general:submissionSuccessful"))}).catch(()=>{C(a(f?"authentication:usernameNotValid":"authentication:emailNotValid"))})},t[3]=f,t[4]=a,t[5]=m):m=t[5];let p=m,h,g;if(t[6]!==i||t[7]!==e||t[8]!==p||t[9]!==l||t[10]!==f||t[11]!==a||t[12]!==s){g=Symbol.for("react.early_return_sentinel");e:{let b=f?{username:{initialValue:"",valid:!0,value:void 0}}:{email:{initialValue:"",valid:!0,value:void 0}};if(l){let v;t[15]!==a?(v=Pd(hd,{description:a("authentication:checkYourEmailForPasswordReset"),heading:a("authentication:emailSent")}),t[15]=a,t[16]=v):v=t[16],g=v;break e}h=qfe(fo,{action:Kfe({apiRoute:i,path:`/${s}/forgot-password`}),className:HS,handleResponse:p,initialState:b,method:"POST",children:[Pd(hd,{description:a(f?"authentication:forgotPasswordUsernameInstructions":"authentication:forgotPasswordEmailInstructions"),heading:a("authentication:forgotPassword")}),Pd("div",{className:`${HS}__inputWrap`,children:f?Pd(Cn,{field:{name:"username",label:a("authentication:username"),required:!0},path:"username",validate:v=>epe(v,{name:"username",type:"text",blockData:{},data:{},event:"onChange",path:["username"],preferences:{fields:{}},req:{payload:{config:e},t:a},required:!0,siblingData:{}})}):Pd(On,{field:{name:"email",admin:{autoComplete:"email"},label:a("general:email"),required:!0},path:"email",validate:v=>Qfe(v,{name:"email",type:"email",blockData:{},data:{},event:"onChange",path:["email"],preferences:{fields:{}},req:{payload:{config:e},t:a},required:!0,siblingData:{}})})}),Pd(qt,{className:`${HS}__submit`,children:a("general:submit")})]})}t[6]=i,t[7]=e,t[8]=p,t[9]=l,t[10]=f,t[11]=a,t[12]=s,t[13]=h,t[14]=g}else h=t[13],g=t[14];return g!==Symbol.for("react.early_return_sentinel")?g:h};import{c as npe}from"react/compiler-runtime";import{jsx as Iv,jsxs as GS}from"react/jsx-runtime";import{formatAdminURL as ij,getLoginOptions as spe,getSafeRedirect as ipe}from"payload/shared";import ape from"react";import{c as rpe}from"react/compiler-runtime";import{jsx as zS}from"react/jsx-runtime";import{email as rj,username as nj}from"payload/shared";import"react";var sj=t=>{let e=rpe(11),{type:o,required:n}=t,r=n===void 0?!0:n,{t:s}=N();if(o==="email"){let i;return e[0]!==r||e[1]!==s?(i=zS(On,{field:{name:"email",admin:{autoComplete:"email"},label:s("general:email"),required:r},path:"email",validate:rj}),e[0]=r,e[1]=s,e[2]=i):i=e[2],i}if(o==="username"){let i;return e[3]!==r||e[4]!==s?(i=zS(Cn,{field:{name:"username",label:s("authentication:username"),required:r},path:"username",validate:nj}),e[3]=r,e[4]=s,e[5]=i):i=e[5],i}if(o==="emailOrUsername"){let i;if(e[6]!==r||e[7]!==s){let a;e[9]!==s?(a=(l,c)=>{let u=nj(l,c),d=rj(l,c);return!d&&!u?`${s("general:email")}: ${d} ${s("general:username")}: ${u}`:!0},e[9]=s,e[10]=a):a=e[10],i=zS(Cn,{field:{name:"username",label:s("authentication:emailOrUsername"),required:r},path:"username",validate:a}),e[6]=r,e[7]=s,e[8]=i}else i=e[8];return i}return null};var Rv="login__form",lpe=t=>{let e=npe(23),{prefillEmail:o,prefillPassword:n,prefillUsername:r,searchParams:s}=t,{config:i,getEntityConfig:a}=G(),{admin:l,routes:c}=i,{routes:u,user:d}=l,{forgot:f}=u,{admin:m,api:p}=c,h,g;if(e[0]!==a||e[1]!==d){let A=a({collectionSlug:d}),{auth:D}=A;h=D.loginWithUsername,g=spe(h),e[0]=a,e[1]=d,e[2]=h,e[3]=g}else h=e[2],g=e[3];let{canLoginWithEmail:b,canLoginWithUsername:v}=g,C;e[4]!==b||e[5]!==v?(C=()=>b&&v?"emailOrUsername":v?"username":"email",e[4]=b,e[5]=v,e[6]=C):C=e[6];let[y]=ape.useState(C),{t:x}=N(),{setUser:w}=ye(),S=n??void 0,_=n??void 0,I;if(e[7]!==m||e[8]!==p||e[9]!==f||e[10]!==y||e[11]!==h||e[12]!==o||e[13]!==r||e[14]!==s?.redirect||e[15]!==w||e[16]!==x||e[17]!==S||e[18]!==_||e[19]!==d){let A={password:{initialValue:S,valid:!0,value:_}};h?A.username={initialValue:r??void 0,valid:!0,value:r??void 0}:A.email={initialValue:o??void 0,valid:!0,value:o??void 0};let D;e[21]!==w?(D=R=>{w(R)},e[21]=w,e[22]=D):D=e[22];let T=D;I=GS(fo,{action:ij({apiRoute:p,path:`/${d}/login`}),className:Rv,disableSuccessStatus:!0,initialState:A,method:"POST",onSuccess:T,redirect:ipe({fallbackTo:m,redirectTo:s?.redirect}),waitForAutocomplete:!0,children:[GS("div",{className:`${Rv}__inputWrap`,children:[Iv(sj,{type:y}),Iv(Qn,{field:{name:"password",label:x("general:password"),required:!0},path:"password"})]}),GS("div",{className:`${Rv}__actions`,children:[Iv(qt,{children:x("authentication:login")}),Iv(Z,{buttonStyle:"ghost",className:`${Rv}__forgotPassword`,el:"link",url:ij({adminRoute:m,path:f}),children:x("authentication:forgotPasswordQuestion")})]})]}),e[7]=m,e[8]=p,e[9]=f,e[10]=y,e[11]=h,e[12]=o,e[13]=r,e[14]=s?.redirect,e[15]=w,e[16]=x,e[17]=S,e[18]=_,e[19]=d,e[20]=I}else I=e[20];return I};import{c as cpe}from"react/compiler-runtime";import{jsx as WS,jsxs as upe}from"react/jsx-runtime";import{formatAdminURL as dpe}from"payload/shared";import aj,{useEffect as mpe}from"react";var fpe="logout",ppe=t=>{let e=cpe(23),{adminRoute:o,inactivity:n,redirect:r}=t,{logOut:s,user:i}=ye(),{startRouteTransition:a}=Ue();i?.id;let l=!!i?.id,c=aj.useRef(!1),u;e[0]!==o||e[1]!==n||e[2]!==r?(u=()=>dpe({adminRoute:o,path:`/login${n&&r&&r.length>0?`?redirect=${encodeURIComponent(r)}`:""}`}),e[0]=o,e[1]=n,e[2]=r,e[3]=u):u=e[3];let[d]=aj.useState(u),{t:f}=N(),m=Re(),p;e[4]!==s||e[5]!==d||e[6]!==m||e[7]!==a||e[8]!==f?(p=async()=>{if(!c.current){c.current=!0,await s(),se(f("authentication:loggedOutSuccessfully")),a(()=>m.push(d));return}},e[4]=s,e[5]=d,e[6]=m,e[7]=a,e[8]=f,e[9]=p):p=e[9];let h=p,g,b;if(e[10]!==h||e[11]!==n||e[12]!==l||e[13]!==d||e[14]!==m||e[15]!==a?(g=()=>{l&&!n?h():!n&&!c.current&&(c.current=!0,a(()=>m.push(d)))},b=[h,l,d,m,a,n],e[10]=h,e[11]=n,e[12]=l,e[13]=d,e[14]=m,e[15]=a,e[16]=g,e[17]=b):(g=e[16],b=e[17]),mpe(g,b),!l&&n){let C;return e[18]!==d||e[19]!==f?(C=upe("div",{className:`${fpe}__wrap`,children:[WS("h2",{children:f("authentication:loggedOutInactivity")}),WS(Z,{buttonStyle:"primary",el:"link",size:"medium",url:d,children:f("authentication:logBackIn")})]}),e[18]=d,e[19]=f,e[20]=C):C=e[20],C}let v;return e[21]!==f?(v=WS(en,{animationDuration:"0ms",loadingText:f("authentication:loggingOut")}),e[21]=f,e[22]=v):v=e[22],v};import{c as hpe}from"react/compiler-runtime";import{jsx as Tv,jsxs as lj}from"react/jsx-runtime";import{useEffect as gpe}from"react";var US="not-found",bpe=()=>{let t=hpe(7),{setStepNav:e}=Lo(),{t:o}=N(),{config:n}=G(),{routes:r}=n,{admin:s}=r,i,a;t[0]!==e||t[1]!==o?(i=()=>{e([{label:o("general:notFound")}])},a=[e,o],t[0]=e,t[1]=o,t[2]=i,t[3]=a):(i=t[2],a=t[3]),gpe(i,a);let l;return t[4]!==s||t[5]!==o?(l=Tv("div",{className:US,children:lj("div",{className:`${US}__wrap`,children:[lj("div",{className:`${US}__content`,children:[Tv("h1",{children:o("general:nothingFound")}),Tv("p",{children:o("general:sorryNotFound")})]}),Tv(Z,{el:"link",to:s,children:o("general:backToDashboard")})]})}),t[4]=s,t[5]=o,t[6]=l):l=t[6],l};import{c as vpe}from"react/compiler-runtime";import{jsx as ah,jsxs as cj}from"react/jsx-runtime";import{formatAdminURL as uj}from"payload/shared";import"react";var XS="reset-password__form",ype=t=>{let e=vpe(11),{token:o}=t,n=N(),{config:r}=G(),{admin:s,routes:i}=r,{routes:a,user:l}=s,{login:c}=a,{admin:u,api:d}=i,f=Re(),{fetchFullUser:m}=ye(),p;e[0]!==u||e[1]!==m||e[2]!==f||e[3]!==c?(p=async()=>{await m()?f.push(u):f.push(uj({adminRoute:u,path:c}))},e[0]=u,e[1]=m,e[2]=f,e[3]=c,e[4]=p):p=e[4];let h=p,g;if(e[5]!==d||e[6]!==n||e[7]!==h||e[8]!==o||e[9]!==l){let b={"confirm-password":{initialValue:"",valid:!1,value:""},password:{initialValue:"",valid:!1,value:""},token:{initialValue:o,valid:!0,value:o}};g=cj(fo,{action:uj({apiRoute:d,path:`/${l}/reset-password`}),className:XS,initialState:b,method:"POST",onSuccess:h,children:[ah(hd,{heading:n.t("authentication:resetPassword")}),cj("div",{className:`${XS}__inputWrap`,children:[ah(Qn,{field:{name:"password",label:n.t("authentication:newPassword"),required:!0},path:"password",schemaPath:`${l}.password`}),ah(Ri,{}),ah(Fl,{path:"token",schemaPath:`${l}.token`,value:o})]}),ah(qt,{className:`${XS}__submit`,children:n.t("authentication:resetPassword")})]}),e[5]=d,e[6]=n,e[7]=h,e[8]=o,e[9]=l,e[10]=g}else g=e[10];return g};import{c as dj}from"react/compiler-runtime";import{jsx as Dv,jsxs as Cpe}from"react/jsx-runtime";import xpe,{useEffect as mj}from"react";var wpe="verify",Spe=3e3;function _pe(t){let e=dj(6),{message:o,redirectTo:n}=t,r=Re(),{startRouteTransition:s}=Ue(),i=xpe.useRef(!1),a,l;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s?(a=()=>{let c;return se&&(c=setTimeout(()=>{se.success(o),i.current=!0,s(()=>r.push(n))},100)),()=>{c&&clearTimeout(c)}},l=[r,n,o,s],e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=a,e[5]=l):(a=e[4],l=e[5]),mj(a,l),null}function Ipe(t){let e=dj(10),{loginRoute:o}=t,n=Re(),{startRouteTransition:r}=Ue(),{t:s}=N(),i,a;e[0]!==o||e[1]!==n||e[2]!==r?(i=()=>{let c=setTimeout(()=>{r(()=>n.push(o))},Spe);return()=>{clearTimeout(c)}},a=[n,o,r],e[0]=o,e[1]=n,e[2]=r,e[3]=i,e[4]=a):(i=e[3],a=e[4]),mj(i,a);let l;if(e[5]!==o||e[6]!==s){let c;e[8]!==o?(c=u=>{let{children:d}=u;return Dv(jt,{href:o,prefetch:!1,children:d})},e[8]=o,e[9]=c):c=e[9],l=Cpe("div",{className:`${wpe}__content`,children:[Dv("p",{children:s("authentication:emailVerifiedRedirecting")}),Dv("p",{children:Dv(Ro,{elements:{0:c},i18nKey:"authentication:notRedirected",t:s})})]}),e[5]=o,e[6]=s,e[7]=l}else l=e[7];return l}import{jsx as Nr,jsxs as Vi}from"react/jsx-runtime";import{useCallback as Pv,useEffect as Zpe,useMemo as KS,useState as _j}from"react";import{jsx as lh,jsxs as Rpe}from"react/jsx-runtime";import{getTranslation as Tpe}from"@payloadcms/translations";import{formatAdminURL as ZS}from"payload/shared";import{Fragment as Dpe,useCallback as Ape,useState as Ppe}from"react";var fj="restore-version",YS="restore-version",pj=({className:t,collectionConfig:e,globalConfig:o,label:n,originalDocID:r,status:s,versionDateFormatted:i,versionID:a})=>{let{config:{routes:{admin:l,api:c}}}=G(),{toggleModal:u}=ie(),d=Re(),{i18n:f,t:m}=N(),[p,h]=Ppe(!1),{startRouteTransition:g}=Ue(),b=m(o?"version:aboutToRestoreGlobal":"version:aboutToRestore",{label:Tpe(n,f),versionDate:i}),v=s!=="draft"&&e?.versions?.drafts,C=Ape(async()=>{let y=ZS({apiRoute:c,path:""}),x;e&&(y=`${y}/${e.slug}/versions/${a}?draft=${p}`,x=ZS({adminRoute:l,path:`/collections/${e.slug}/${r}`})),o&&(y=`${y}/globals/${o.slug}/versions/${a}?draft=${p}`,x=ZS({adminRoute:l,path:`/globals/${o.slug}`}));let w=await We.post(y,{headers:{"Accept-Language":f.language}});if(w.status===200){let S=await w.json();return se.success(S.message),g(()=>d.push(x))}else se.error(m("version:problemRestoringVersion"))},[c,e,o,f.language,a,p,l,r,g,d,m]);return Rpe(Dpe,{children:[lh("div",{className:[fj,t].filter(Boolean).join(" "),children:lh(Z,{buttonStyle:"primary",className:[v&&`${fj}__restore-as-draft-button`].filter(Boolean).join(" "),onClick:()=>u(YS),size:"medium",SubMenuPopupContent:v?()=>lh(Ys,{children:lh(Fn,{onClick:()=>[h(!0),u(YS)],children:m("version:restoreAsDraft")})}):null,children:m("version:restoreThisVersion")})}),lh(nt,{body:b,confirmingLabel:m("version:restoring"),heading:m("version:confirmVersionRestoration"),modalSlug:YS,onConfirm:C})]})};import{jsx as qS,jsxs as kpe}from"react/jsx-runtime";import{memo as Mpe,useCallback as Bpe,useMemo as yj}from"react";import{c as gj}from"react/compiler-runtime";import{jsx as Av}from"react/jsx-runtime";import{useCallback as Fpe,useEffect as bj,useId as Npe,useRef as hj,useState as JS}from"react";var Epe="version-drawer",Lpe=({depth:t,uuid:e})=>`version-drawer_${t}_${e}`,$pe=t=>{let{collectionSlug:e,docID:o,drawerSlug:n,globalSlug:r}=t,{isTrashed:s}=be(),{closeModal:i}=ie(),a=lt(),l=hj(a),{renderDocument:c}=ct(),[u,d]=JS(void 0),[f,m]=JS(!0),p=hj(!1),{t:h}=N(),g=Fpe(b=>{(async()=>{m(!0);try{let C=!!r,y=e??r,x=await c({collectionSlug:y,docID:b,drawerSlug:n,paramsOverride:{segments:[C?"globals":"collections",y,...s?["trash"]:[],C?void 0:String(b),"versions"].filter(Boolean)},redirectAfterDelete:!1,redirectAfterDuplicate:!1,searchParams:Object.fromEntries(a.entries()),versions:{useVersionDrawerCreatedAtCell:!0}});x?.Document&&(d(x.Document),m(!1))}catch(C){se.error(C?.message||h("error:unspecific")),i(n)}})()},[i,e,n,r,s,c,a,h]);return bj(()=>{(!p.current||l.current!==a)&&(l.current=a,g(o),p.current=!0)},[o,g,a]),f?Av(en,{}):u},jpe=t=>{let e=gj(6),{collectionSlug:o,docID:n,drawerSlug:r,globalSlug:s}=t,{t:i}=N(),a;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s||e[4]!==i?(a=Av(It,{className:Epe,slug:r,title:i("version:selectVersionToCompare"),children:Av($pe,{collectionSlug:o,docID:n,drawerSlug:r,globalSlug:s})}),e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=a):a=e[5],a},vj=t=>{let e=gj(29),{collectionSlug:o,docID:n,globalSlug:r}=t,s=vt(),i=Npe(),{closeModal:a,modalState:l,openModal:c,toggleModal:u}=ie(),[d,f]=JS(!1),m;e[0]!==s||e[1]!==i?(m=Lpe({depth:s,uuid:i}),e[0]=s,e[1]=i,e[2]=m):m=e[2];let p=m,h,g;e[3]!==p||e[4]!==l?(h=()=>{f(!!l[p]?.isOpen)},g=[l,p],e[3]=p,e[4]=l,e[5]=h,e[6]=g):(h=e[5],g=e[6]),bj(h,g);let b;e[7]!==p||e[8]!==u?(b=()=>{u(p)},e[7]=p,e[8]=u,e[9]=b):b=e[9];let v=b,C;e[10]!==a||e[11]!==p?(C=()=>{a(p)},e[10]=a,e[11]=p,e[12]=C):C=e[12];let y=C,x;e[13]!==p||e[14]!==c?(x=()=>{c(p)},e[13]=p,e[14]=c,e[15]=x):x=e[15];let w=x,S;e[16]!==o||e[17]!==n||e[18]!==p||e[19]!==r?(S=()=>Av(jpe,{collectionSlug:o,docID:n,drawerSlug:p,globalSlug:r}),e[16]=o,e[17]=n,e[18]=p,e[19]=r,e[20]=S):S=e[20];let _=S,I;return e[21]!==_||e[22]!==y||e[23]!==s||e[24]!==p||e[25]!==d||e[26]!==w||e[27]!==v?(I={closeDrawer:y,Drawer:_,drawerDepth:s,drawerSlug:p,isDrawerOpen:d,openDrawer:w,toggleDrawer:v},e[21]=_,e[22]=y,e[23]=s,e[24]=p,e[25]=d,e[26]=w,e[27]=v,e[28]=I):I=e[28],I};var Cj="compare-version",xj=Mpe(t=>{let{collectionSlug:e,docID:o,globalSlug:n,onChange:r,versionFromID:s,versionFromOptions:i}=t,{t:a}=N(),{Drawer:l,openDrawer:c}=vj({collectionSlug:e,docID:o,globalSlug:n}),u=yj(()=>[...i,{label:qS("span",{className:`${Cj}-moreVersions`,children:a("version:moreVersions")}),value:"more"}],[a,i]),d=yj(()=>i.find(m=>m.value===s),[i,s]),f=Bpe(m=>{if(m.value==="more"){c();return}r(m)},[r,c]);return kpe("div",{className:[Ee,Cj].filter(Boolean).join(" "),children:[qS(mt,{isClearable:!1,isSearchable:!1,onChange:f,options:u,placeholder:a("version:selectVersionToCompare"),value:d}),qS(l,{})]})});import{c as Ope}from"react/compiler-runtime";import{jsx as ch}from"react/jsx-runtime";import"react";var Vpe="select-version-locales",wj=t=>{let e=Ope(9),{locales:o,onChange:n}=t,{t:r}=N(),s;e[0]!==o||e[1]!==n?(s=()=>ch(ue.RadioGroup,{children:o.map(l=>ch(ue.RadioGroupItem,{active:l.selected,onClick:()=>{let c=o.map(u=>u.name===l.name?{...u,selected:!u.selected}:u);n({locales:c})},children:l.name},l.name))}),e[0]=o,e[1]=n,e[2]=s):s=e[2];let i;e[3]!==o||e[4]!==r?(i=l=>{let{active:c,...u}=l;return ch(Z,{...u,buttonStyle:"secondary",className:"view-version__toggle-locales",icon:ch(ve,{direction:c?"up":"down",size:16}),selected:o.some(Hpe),size:"medium",children:r("general:locales")})},e[3]=o,e[4]=r,e[5]=i):i=e[5];let a;return e[6]!==s||e[7]!==i?(a=ch(Ve,{className:Vpe,horizontalAlign:"right",render:s,renderButton:i,size:"small",theme:"dark"}),e[6]=s,e[7]=i,e[8]=a):a=e[8],a};function Hpe(t){return t.selected}import{createContext as zpe,use as Gpe}from"react";var QS=zpe({selectedLocales:[]}),Oi=()=>Gpe(QS);import{c as Wpe}from"react/compiler-runtime";import{getTranslation as Upe}from"@payloadcms/translations";import{formatAdminURL as Fd}from"payload/shared";import{useEffect as Xpe}from"react";var Sj=t=>{let e=Wpe(24),{id:o,collectionConfig:n,globalConfig:r,isTrashed:s,versionToCreatedAtFormatted:i,versionToID:a}=t,{config:l}=G(),{setStepNav:c}=Lo(),{i18n:u,t:d}=N(),f=Ce(),{title:m}=zo(),p;e[0]!==n||e[1]!==l||e[2]!==r||e[3]!==u||e[4]!==o||e[5]!==s||e[6]!==c||e[7]!==d||e[8]!==m||e[9]!==i?(p=()=>{let{routes:g}=l,{admin:b}=g;if(n){let v=n.slug,C=n.labels?.plural,y=s?`/collections/${v}/trash/${o}`:`/collections/${v}/${o}`,x=[{label:Upe(C,u),url:Fd({adminRoute:b,path:`/collections/${v}`})}];s&&x.push({label:d("general:trash"),url:Fd({adminRoute:b,path:`/collections/${v}/trash`})}),x.push({label:m,url:Fd({adminRoute:b,path:y})},{label:d("version:versions"),url:Fd({adminRoute:b,path:`${y}/versions`})},{label:i,url:void 0}),c(x);return}if(r){let v=r.slug;c([{label:r.label,url:Fd({adminRoute:b,path:`/globals/${v}`})},{label:d("version:versions"),url:Fd({adminRoute:b,path:`/globals/${v}/versions`})},{label:i}])}},e[0]=n,e[1]=l,e[2]=r,e[3]=u,e[4]=o,e[5]=s,e[6]=c,e[7]=d,e[8]=m,e[9]=i,e[10]=p):p=e[10];let h;return e[11]!==n||e[12]!==l||e[13]!==r||e[14]!==u||e[15]!==o||e[16]!==s||e[17]!==f||e[18]!==c||e[19]!==d||e[20]!==m||e[21]!==i||e[22]!==a?(h=[l,c,o,s,f,d,u,n,r,m,i,a],e[11]=n,e[12]=l,e[13]=r,e[14]=u,e[15]=o,e[16]=s,e[17]=f,e[18]=c,e[19]=d,e[20]=m,e[21]=i,e[22]=a,e[23]=h):h=e[23],Xpe(p,h),null};var ur="view-version",Ype=({canUpdate:t,modifiedOnly:e,RenderedDiff:o,selectedLocales:n,versionFromCreatedAt:r,versionFromID:s,versionFromOptions:i,versionToCreatedAt:a,versionToCreatedAtFormatted:l,VersionToCreatedAtLabel:c,versionToID:u,versionToStatus:d})=>{let{config:f,getEntityConfig:m}=G(),{code:p}=Ce(),{i18n:h,t:g}=N(),[b,v]=_j([]);Zpe(()=>{if(f.localization){let k=f.localization.locales.map(O=>{let V=O.label;return typeof O.label!="string"&&O.label[p]&&(V=O.label[p]),{name:O.code,Label:V,selected:n.includes(O.code)}});v(k)}},[p,f.localization,n]);let{id:C,collectionSlug:y,globalSlug:x,isTrashed:w}=be(),{startRouteTransition:S}=Ue(),{collectionConfig:_,globalConfig:I}=KS(()=>({collectionConfig:m({collectionSlug:y}),globalConfig:m({globalSlug:x})}),[y,x,m]),A=Re(),D=Ao(),T=lt(),[R,P]=_j(e),E=Pv(k=>{let O=new URLSearchParams(Array.from(T.entries()));if(k?.versionFromID&&O.set("versionFrom",k?.versionFromID),k?.selectedLocales)if(!k.selectedLocales.length)O.delete("localeCodes");else{let z=[];for(let W of k.selectedLocales)W.selected&&z.push(W.name);O.set("localeCodes",JSON.stringify(z))}k?.modifiedOnly===!1?O.set("modifiedOnly","false"):k?.modifiedOnly===!0&&O.delete("modifiedOnly");let V=O.toString(),H=V?`?${V}`:"";S(()=>A.push(`${D}${H}`))},[D,A,T,S]),F=Pv(k=>{let O=k.target.checked;P(O),E({modifiedOnly:O})},[E]),L=Pv(({locales:k})=>{v(k),E({selectedLocales:k})},[E]),M=Pv(k=>{E({versionFromID:k.value})},[E]),{localization:$}=f,B=KS(()=>g("version:versionAgo",{distance:ca({date:a,i18n:h})}),[a,h,g]),j=KS(()=>r?g("version:versionAgo",{distance:ca({date:r,i18n:h})}):void 0,[r,h,g]);return Vi("main",{className:ur,children:[Nr(Is,{className:`${ur}-controls-top`,children:Vi("div",{className:`${ur}-controls-top__wrapper`,children:[Nr("h2",{children:h.t("version:compareVersions")}),Vi("div",{className:`${ur}-controls-top__wrapper-actions`,children:[Nr("span",{className:`${ur}__modifiedCheckBox`,children:Nr(Ft,{checked:R,id:"modifiedOnly",label:h.t("version:modifiedOnly"),onToggle:F})}),$&&Nr(wj,{locales:b,onChange:L})]})]})}),Nr(Is,{className:`${ur}-controls-bottom`,children:Vi("div",{className:`${ur}-controls-bottom__wrapper`,children:[Vi("div",{className:`${ur}__version-from`,children:[Vi("div",{className:`${ur}__version-from-labels`,children:[Nr("span",{children:g("version:comparingAgainst")}),j&&Nr("span",{className:`${ur}__time-elapsed`,children:j})]}),Nr(xj,{collectionSlug:y,docID:C,globalSlug:x,onChange:M,versionFromID:s,versionFromOptions:i})]}),Vi("div",{className:`${ur}__version-to`,children:[Vi("div",{className:`${ur}__version-to-labels`,children:[Nr("span",{children:g("version:currentlyViewing")}),Nr("span",{className:`${ur}__time-elapsed`,children:B})]}),Vi("div",{className:`${ur}__version-to-version`,children:[c,t&&!w&&Nr(pj,{className:`${ur}__restore`,collectionConfig:_,globalConfig:I,label:_?.labels.singular||I?.label,originalDocID:C,status:d,versionDateFormatted:l,versionID:u})]})]})]})}),Nr(Sj,{collectionConfig:_,globalConfig:I,id:C,isTrashed:w,versionToCreatedAtFormatted:l,versionToID:u}),Nr(Is,{className:`${ur}__diff-wrap`,children:Nr(QS,{value:{selectedLocales:b.map(k=>k.name)},children:a&&o})})]})};import{c as Jpe}from"react/compiler-runtime";import{jsx as Fv,jsxs as Ij}from"react/jsx-runtime";import Rj from"react";var qpe=t=>{let e=Jpe(13),{baseClass:o,columns:n,paginationLimits:r}=t,{data:s,handlePageChange:i,handlePerPageChange:a}=bt(),l=lt(),c;e[0]!==l?(c=l.get("limit"),e[0]=l,e[1]=c):c=e[1];let u=c,{i18n:d}=N(),f=s?.totalDocs||0,m=!s,p;return e[2]!==o||e[3]!==n||e[4]!==s||e[5]!==i||e[6]!==a||e[7]!==d||e[8]!==u||e[9]!==r||e[10]!==m||e[11]!==f?(p=Ij(Rj.Fragment,{children:[Fv(Rg,{name:"versions",show:m}),f===0&&Fv("div",{className:`${o}__no-versions`,children:d.t("version:noFurtherVersionsFound")}),f>0&&Ij(Rj.Fragment,{children:[Fv(Pp,{columns:n,data:s?.docs}),Fv(rv,{data:s,handlePageChange:i,handlePerPageChange:a,limit:u?Number(u):10,limits:r})]})]}),e[2]=o,e[3]=n,e[4]=s,e[5]=i,e[6]=a,e[7]=d,e[8]=u,e[9]=r,e[10]=m,e[11]=f,e[12]=p):p=e[12],p};import{c as Qpe}from"react/compiler-runtime";import{jsx as Nd,jsxs as Nv}from"react/jsx-runtime";import Dj from"react";function Tj({currentLocale:t,currentlyPublishedVersion:e,latestDraftVersion:o,t:n,version:r}){let s=r.version._status;if(s==="draft"){if(e?.updatedAt>o?.updatedAt)return{name:"draft",label:n("version:draft"),pillStyle:"light"};let c=r.id===o?.id;return{name:c?"currentDraft":"draft",label:n(c?"version:currentDraft":"version:draft"),pillStyle:"light"}}if(s==="published"&&r.publishedLocale&&t!==r.publishedLocale)return{name:"currentDraft",label:n("version:currentDraft"),pillStyle:"light"};let a=e&&r.id===e.id;return{name:a?"currentlyPublished":"previouslyPublished",label:n(a?"version:currentlyPublished":"version:previouslyPublished"),pillStyle:a?"success":"light"}}var uh="version-pill-label",Kpe={currentDraft:"draft",currentlyPublished:"published",draft:"draft",previouslyPublished:"previously-published",published:"published"},Aj=(t,e)=>{let o=Kpe[e]||"draft";return Nd("span",{className:`status-cell status-cell--${o}`,children:t})},e4=t=>{let e=Qpe(14),{currentlyPublishedVersion:o,disableDate:n,doc:r,labelFirst:s,labelOverride:i,labelStyle:a,labelSuffix:l,latestDraftVersion:c}=t,u=n===void 0?!1:n,d=s===void 0?!1:s,f=a===void 0?"pill":a,{config:m}=G(),{admin:p,localization:h}=m,{dateFormat:g}=p,{i18n:b,t:v}=N(),{code:C}=Ce(),y;if(e[0]!==C||e[1]!==o||e[2]!==g||e[3]!==u||e[4]!==r||e[5]!==b||e[6]!==d||e[7]!==i||e[8]!==f||e[9]!==l||e[10]!==c||e[11]!==h||e[12]!==v){let{name:x,label:w}=Tj({currentLocale:C,currentlyPublishedVersion:o,latestDraftVersion:c,t:v,version:r}),S=Nv("span",{children:[i||w,l]}),_=!u&&r.updatedAt,I=_?lo({date:r.updatedAt,i18n:b,pattern:g}):null,A=Array.isArray(r.publishedLocale)?r.publishedLocale[0]:r.publishedLocale,D=h&&h?.locales?h.locales.find(R=>R.code===A):null,T=D?D?.label?.[b?.language]||D?.label:null;y=Nv("div",{className:uh,children:[d?Nv(Dj.Fragment,{children:[f==="pill"?Aj(S,x):Nd("span",{className:`${uh}-text`,children:S}),_&&Nd("span",{className:`${uh}-date`,children:I})]}):Nv(Dj.Fragment,{children:[_&&Nd("span",{className:`${uh}-date`,children:I}),f==="pill"?Aj(S,x):Nd("span",{className:`${uh}-text`,children:S})]}),T&&Nd(vr,{size:"small",children:T})]}),e[0]=C,e[1]=o,e[2]=g,e[3]=u,e[4]=r,e[5]=b,e[6]=d,e[7]=i,e[8]=f,e[9]=l,e[10]=c,e[11]=h,e[12]=v,e[13]=y}else y=e[13];return y};import{c as ehe}from"react/compiler-runtime";import{jsx as _c}from"react/jsx-runtime";import the,{Fragment as ohe,useEffect as rhe}from"react";var Ed="render-field-diffs",ss=t=>{let e=ehe(6),{parent:o,versionFields:n}=t,r=o===void 0?!1:o,[s,i]=the.useState(!1),a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{i(!0)},l=[],e[0]=a,e[1]=l):(a=e[0],l=e[1]),rhe(a,l);let c=`${Ed}${r?` ${Ed}--parent`:""}`,u;return e[2]!==s||e[3]!==c||e[4]!==n?(u=_c("div",{className:c,children:s?n?.map(nhe):_c(ohe,{children:_c(Ct,{height:"8rem",width:"100%"})})}),e[2]=s,e[3]=c,e[4]=n,e[5]=u):u=e[5],u};function nhe(t,e){if(t.fieldByLocale){let o=[];for(let[n,r]of Object.entries(t.fieldByLocale))o.push(_c("div",{className:`${Ed}__locale`,"data-field-path":r.path,"data-locale":n,children:_c("div",{className:`${Ed}__locale-value`,children:r.CustomComponent})},[n,e].join("-")));return _c("div",{className:`${Ed}__field`,children:o},e)}else if(t.field)return _c("div",{className:`${Ed}__field field__${t.field.type}`,"data-field-path":t.field.path,children:t.field.CustomComponent},e);return null}import{c as che}from"react/compiler-runtime";import{jsx as qa,jsxs as Fj}from"react/jsx-runtime";import"react";import{jsx as ahe,jsxs as t4}from"react/jsx-runtime";import{getTranslation as lhe}from"@payloadcms/translations";import"react";import{jsx as she}from"react/jsx-runtime";import"react";var ihe="field-diff-label",dh=({children:t})=>she("div",{className:ihe,children:t});var o4="field-diff",Pj=6.5,Hi=t=>{let{className:e,From:o,i18n:n,label:{label:r,locale:s},nestingLevel:i=0,To:a}=t;return t4("div",{className:`${o4}-container${e?` ${e}`:""} nested-level-${i}`,children:[t4(dh,{children:[s&&ahe("span",{className:`${o4}__locale-label`,children:s}),r!==!1&&typeof r!="function"&&lhe(r||"",n)]}),t4("div",{className:`${o4}-content`,style:i?{"--field-diff-columns":`calc(50% - ${i*Pj}px) calc(50% + ${i*Pj}px)`}:void 0,children:[o,a]})]})};var cn="checkbox-diff",Nj=({checked:t,variant:e="default"})=>{let o=[`${cn}__indicator`,`${cn}__indicator--${e}`,t&&`${cn}__indicator--checked`].filter(Boolean).join(" ");return qa("span",{className:o,children:qa("span",{className:`${cn}__icon`,children:qa(Vo,{size:16})})})},uhe=t=>{let e=che(11),{comparisonValue:o,field:n,locale:r,nestingLevel:s,versionValue:i}=t,{i18n:a,t:l}=N(),c=!!o,u=!!i,d=c!==u,f=d?"delete":"default",m=d?"create":"default",p=`${cn}__value ${cn}__value--${f}`,h;if(e[0]!==c||e[1]!==u||e[2]!==n.label||e[3]!==f||e[4]!==a||e[5]!==r||e[6]!==s||e[7]!==l||e[8]!==p||e[9]!==m){let g=Fj("div",{className:p,children:[qa(Nj,{checked:c,variant:f}),qa("span",{className:`${cn}__label ${cn}__label--${f}`,children:l(c?"general:checked":"general:unchecked")})]}),b=Fj("div",{className:`${cn}__value ${cn}__value--${m}`,children:[qa(Nj,{checked:u,variant:m}),qa("span",{className:`${cn}__label ${cn}__label--${m}`,children:l(u?"general:checked":"general:unchecked")})]});h=qa(Hi,{className:cn,From:g,i18n:a,label:{label:n.label,locale:r},nestingLevel:s,To:b}),e[0]=c,e[1]=u,e[2]=n.label,e[3]=f,e[4]=a,e[5]=r,e[6]=s,e[7]=l,e[8]=p,e[9]=m,e[10]=h}else h=e[10];return h};import{c as bhe}from"react/compiler-runtime";import{jsx as jv}from"react/jsx-runtime";import{getTranslation as vhe}from"@payloadcms/translations";import"react";import{c as fhe}from"react/compiler-runtime";import{jsx as $v,jsxs as s4}from"react/jsx-runtime";import{fieldIsArrayType as phe,fieldIsBlockType as hhe}from"payload/shared";import{useState as ghe}from"react";import{fieldShouldBeLocalized as n4,groupHasName as mhe}from"payload/shared";function r4(t,e){return JSON.stringify(t)!==JSON.stringify(e)}import{getUniqueListBy as dhe}from"payload/shared";function Ev({baseVersionField:t,config:e,field:o,row:n,valueFromRow:r,valueToRow:s}){let i=[],a=[];if(o.type==="array"&&"fields"in o)i=o.fields,a=t.rows?.length?t.rows[n]:t.fields;else if(o.type==="blocks")if(s?.blockType===r?.blockType)i=(e?.blocksMap?.[s?.blockType]??(o.blocks.find(c=>typeof c!="string"&&c.slug===s?.blockType)||{fields:[]})).fields,a=t.rows?.length?t.rows[n]:t.fields;else{let l=e?.blocksMap?.[s?.blockType]??(o.blocks.find(u=>typeof u!="string"&&u.slug===s?.blockType)||{fields:[]}),c=e?.blocksMap?.[r?.blockType]??(o.blocks.find(u=>typeof u!="string"&&u.slug===r?.blockType)||{fields:[]});i=dhe([...l.fields,...c.fields],"name"),a=t.rows?.length?t.rows[n]:t.fields}return{fields:i,versionFields:a}}function Vs({config:t,fields:e,locales:o,parentIsLocalized:n,valueFrom:r,valueTo:s}){let i=0;return e.forEach(a=>{if("name"in a&&a.name==="id")return;let l=a.type;switch(l){case"array":case"blocks":{if(o&&n4({field:a,parentIsLocalized:n}))o.forEach(c=>{let u=r?.[a.name]?.[c]??[],d=s?.[a.name]?.[c]??[];i+=Lv({config:t,field:a,locales:o,parentIsLocalized:n||a.localized,valueFromRows:u,valueToRows:d})});else{let c=r?.[a.name]??[],u=s?.[a.name]??[];i+=Lv({config:t,field:a,locales:o,parentIsLocalized:n||a.localized,valueFromRows:c,valueToRows:u})}break}case"checkbox":case"code":case"date":case"email":case"join":case"json":case"number":case"point":case"radio":case"relationship":case"richText":case"select":case"text":case"textarea":case"upload":{o&&n4({field:a,parentIsLocalized:n})?o.forEach(c=>{r4(s?.[a.name]?.[c],r?.[a.name]?.[c])&&i++}):r4(s?.[a.name],r?.[a.name])&&i++;break}case"collapsible":case"row":{i+=Vs({config:t,fields:a.fields,locales:o,parentIsLocalized:n||a.localized,valueFrom:r,valueTo:s});break}case"group":{mhe(a)?o&&n4({field:a,parentIsLocalized:n})?o.forEach(c=>{i+=Vs({config:t,fields:a.fields,locales:o,parentIsLocalized:n||a.localized,valueFrom:r?.[a.name]?.[c],valueTo:s?.[a.name]?.[c]})}):i+=Vs({config:t,fields:a.fields,locales:o,parentIsLocalized:n||a.localized,valueFrom:r?.[a.name],valueTo:s?.[a.name]}):i+=Vs({config:t,fields:a.fields,locales:o,parentIsLocalized:n||a.localized,valueFrom:r,valueTo:s});break}case"tabs":{a.tabs.forEach(c=>{"name"in c&&o&&c.localized?o.forEach(u=>{i+=Vs({config:t,fields:c.fields,locales:o,parentIsLocalized:n||c.localized,valueFrom:r?.[c.name]?.[u],valueTo:s?.[c.name]?.[u]})}):"name"in c?i+=Vs({config:t,fields:c.fields,locales:o,parentIsLocalized:n||c.localized,valueFrom:r?.[c.name],valueTo:s?.[c.name]}):i+=Vs({config:t,fields:c.fields,locales:o,parentIsLocalized:n||c.localized,valueFrom:r,valueTo:s})});break}case"ui":break;default:{let c=l;throw new Error(`Unexpected field.type in countChangedFields : ${String(l)}`)}}}),i}function Lv({config:t,field:e,locales:o,parentIsLocalized:n,valueFromRows:r=[],valueToRows:s=[]}){let i=0,a=0;for(;r[a]||s[a];){let l=r?.[a]||{},c=s?.[a]||{},{fields:u}=Ev({baseVersionField:{type:"text",fields:[],path:"",schemaPath:""},config:t,field:e,row:a,valueFromRow:l,valueToRow:c});i+=Vs({config:t,fields:u,locales:o,parentIsLocalized:n||e.localized,valueFrom:l,valueTo:c}),a++}return i}var Ic="diff-collapser",zi=t=>{let e=fhe(19),{children:o,field:n,fields:r,hideGutter:s,initCollapsed:i,isIterable:a,Label:l,locales:c,parentIsLocalized:u,valueFrom:d,valueTo:f}=t,m=s===void 0?!1:s,p=i===void 0?!1:i,h=a===void 0?!1:a,{t:g}=N(),[b,v]=ghe(p),{config:C}=G(),y;if(e[0]!==l||e[1]!==o||e[2]!==C||e[3]!==n||e[4]!==r||e[5]!==m||e[6]!==b||e[7]!==h||e[8]!==c||e[9]!==u||e[10]!==g||e[11]!==d||e[12]!==f){let x;if(h){if(!phe(n)&&!hhe(n))throw new Error("DiffCollapser: field must be an array or blocks field when isIterable is true");let D=d??[],T=f??[];if(!Array.isArray(D)||!Array.isArray(T))throw new Error("DiffCollapser: valueFrom and valueTro must be arrays when isIterable is true");x=Lv({config:C,field:n,locales:c,parentIsLocalized:u,valueFromRows:D,valueToRows:T})}else x=Vs({config:C,fields:r,locales:c,parentIsLocalized:u,valueFrom:d,valueTo:f});let w=b&&`${Ic}__content--is-collapsed`,S=m&&`${Ic}__content--hide-gutter`,_;e[14]!==w||e[15]!==S?(_=[`${Ic}__content`,w,S].filter(Boolean),e[14]=w,e[15]=S,e[16]=_):_=e[16];let I=_.join(" "),A;e[17]!==b?(A=()=>v(!b),e[17]=b,e[18]=A):A=e[18],y=s4("div",{className:Ic,children:[s4(dh,{children:[s4("button",{"aria-label":b?"Expand":"Collapse",className:`${Ic}__toggle-button`,onClick:A,type:"button",children:[$v("div",{className:`${Ic}__label`,children:l}),$v(ve,{direction:b?"right":"down",size:16})]}),x>0&&b&&$v("span",{className:`${Ic}__field-change-count`,children:g("version:changedFieldsCount",{count:x})})]}),$v("div",{className:I,children:o})]}),e[0]=l,e[1]=o,e[2]=C,e[3]=n,e[4]=r,e[5]=m,e[6]=b,e[7]=h,e[8]=c,e[9]=u,e[10]=g,e[11]=d,e[12]=f,e[13]=y}else y=e[13];return y};var yhe="collapsible-diff",Che=t=>{let e=bhe(8),{baseVersionField:o,comparisonValue:n,field:r,parentIsLocalized:s,versionValue:i}=t,{i18n:a}=N(),{selectedLocales:l}=Oi();if(!o.fields?.length)return null;let c;return e[0]!==o.fields||e[1]!==r||e[2]!==a||e[3]!==s||e[4]!==l||e[5]!==n||e[6]!==i?(c=jv("div",{className:yhe,children:jv(zi,{fields:r.fields,Label:"label"in r&&r.label&&typeof r.label!="function"&&jv("span",{children:vhe(r.label,a)}),locales:l,parentIsLocalized:s||r.localized,valueFrom:n,valueTo:i,children:jv(ss,{versionFields:o.fields})})}),e[0]=o.fields,e[1]=r,e[2]=a,e[3]=s,e[4]=l,e[5]=n,e[6]=i,e[7]=c):c=e[7],c};import{c as xhe}from"react/compiler-runtime";import{jsx as whe}from"react/jsx-runtime";import"react";var i4="date-diff",She=t=>{let e=xhe(7),{comparisonValue:o,field:n,locale:r,nestingLevel:s,versionValue:i}=t,{i18n:a}=N(),{config:l}=G(),{admin:c}=l,{dateFormat:u}=c,d=o?lo({date:typeof o=="string"?new Date(o):o,i18n:a,pattern:u}):"",f=i?lo({date:typeof i=="string"?new Date(i):i,i18n:a,pattern:u}):"",m=es(d),p=es(f),h=`<div class="${i4}" data-enable-match="true" data-date="${m}"><p>`+m+"</p></div>",g=`<div class="${i4}" data-enable-match="true" data-date="${p}"><p>`+p+"</p></div>",b;if(e[0]!==n.label||e[1]!==a||e[2]!==r||e[3]!==s||e[4]!==h||e[5]!==g){let{From:v,To:C}=pc({fromHTML:h,postProcess:Ua,toHTML:g,tokenizeByCharacter:!1});b=whe(Hi,{className:i4,From:v,i18n:a,label:{label:n.label,locale:r},nestingLevel:s,To:C}),e[0]=n.label,e[1]=a,e[2]=r,e[3]=s,e[4]=h,e[5]=g,e[6]=b}else b=e[6];return b};import{c as _he}from"react/compiler-runtime";import{jsx as kv,jsxs as Ej}from"react/jsx-runtime";import{getTranslation as Ihe}from"@payloadcms/translations";import"react";var Mv="group-diff",Rhe=t=>{let e=_he(9),{baseVersionField:o,comparisonValue:n,field:r,locale:s,parentIsLocalized:i,versionValue:a}=t,{i18n:l}=N(),{selectedLocales:c}=Oi(),u;return e[0]!==o.fields||e[1]!==r||e[2]!==l||e[3]!==s||e[4]!==i||e[5]!==c||e[6]!==n||e[7]!==a?(u=kv("div",{className:Mv,children:kv(zi,{fields:r.fields,Label:"label"in r&&r.label&&typeof r.label!="function"?Ej("span",{children:[s&&kv("span",{className:`${Mv}__locale-label`,children:s}),Ihe(r.label,l)]}):Ej("span",{className:`${Mv}__locale-label ${Mv}__locale-label--no-label`,children:["<",l.t("version:noLabelGroup"),">"]}),locales:c,parentIsLocalized:i||r.localized,valueFrom:n,valueTo:a,children:kv(ss,{versionFields:o.fields})})}),e[0]=o.fields,e[1]=r,e[2]=l,e[3]=s,e[4]=i,e[5]=c,e[6]=n,e[7]=a,e[8]=u):u=e[8],u};import{c as The}from"react/compiler-runtime";import{jsx as Gi,jsxs as a4}from"react/jsx-runtime";import{getTranslation as Lj}from"@payloadcms/translations";import{fieldIsArrayType as $j,fieldIsBlockType as Dhe}from"payload/shared";import"react";var Qa="iterable-diff",Ahe=t=>{let e=The(12),{baseVersionField:o,comparisonValue:n,field:r,locale:s,parentIsLocalized:i,versionValue:a}=t,{i18n:l,t:c}=N(),{selectedLocales:u}=Oi(),{config:d}=G();if(!$j(r)&&!Dhe(r))throw new Error(`Expected field to be an array or blocks type but got: ${r.type}`);let f=Array.isArray(a)?a.length:0,m=Array.isArray(n)?n.length:0,p=Math.max(f,m),h;return e[0]!==o||e[1]!==d||e[2]!==r||e[3]!==l||e[4]!==s||e[5]!==p||e[6]!==i||e[7]!==u||e[8]!==c||e[9]!==n||e[10]!==a?(h=Gi("div",{className:Qa,children:a4(zi,{field:r,isIterable:!0,Label:"label"in r&&r.label&&typeof r.label!="function"&&a4("span",{children:[s&&Gi("span",{className:`${Qa}__locale-label`,children:s}),Lj(r.label,l)]}),locales:u,parentIsLocalized:i,valueFrom:n,valueTo:a,children:[p>0&&Gi("div",{className:`${Qa}__rows`,children:Array.from({length:p},(g,b)=>{let v=a?.[b]||{},C=n?.[b]||{},{fields:y,versionFields:x}=Ev({baseVersionField:o,config:d,field:r,row:b,valueFromRow:C,valueToRow:v});if(!x?.length)return null;let w=String(b+1).padStart(2,"0"),S=$j(r)?`${c("general:item")} ${w}`:`${c("fields:block")} ${w}`;return Gi("div",{className:`${Qa}__row`,children:Gi(zi,{fields:y,hideGutter:!0,Label:a4("div",{className:`${Qa}-label-container`,children:[Gi("div",{className:`${Qa}-label-prefix`}),Gi("span",{className:`${Qa}__label`,children:S})]}),locales:u,parentIsLocalized:i||r.localized,valueFrom:C,valueTo:v,children:Gi(ss,{versionFields:x})})},b)})}),p===0&&Gi("div",{className:`${Qa}__no-rows`,children:l.t("version:noRowsFound",{label:"labels"in r&&r.labels?.plural?Lj(r.labels.plural,l):l.t("general:rows")})})]})}),e[0]=o,e[1]=d,e[2]=r,e[3]=l,e[4]=s,e[5]=p,e[6]=i,e[7]=u,e[8]=c,e[9]=n,e[10]=a,e[11]=h):h=e[11],h};import{jsx as jj}from"react/jsx-runtime";import"react";var Phe="row-diff",Fhe=({baseVersionField:t})=>jj("div",{className:Phe,children:jj(ss,{versionFields:t.fields})});import{c as Nhe}from"react/compiler-runtime";import{jsx as Ehe}from"react/jsx-runtime";import{getTranslation as kj}from"@payloadcms/translations";import"react";var Lhe="select-diff",Mj=(t,e,o)=>o&&Array.isArray(t)?t.map(n=>e.find(r=>(typeof r=="string"?r:r.value)===n)||String(n)):e.find(n=>(typeof n=="string"?n:n.value)===t)||String(t),Bj=(t,e)=>{if(Array.isArray(t))return t.map(n=>{if(typeof n=="string")return n;let r=kj(n.label,e);return typeof r=="string"?r:n.value}).join(", ");if(typeof t=="string")return t;let o=kj(t.label,e);return typeof o=="string"?o:t.value},$he=t=>{let e=Nhe(7),{comparisonValue:o,field:n,locale:r,nestingLevel:s,versionValue:i}=t,{i18n:a}=N(),l="options"in n&&n.options,c=typeof o<"u"?Bj(Mj(typeof o=="string"?o:JSON.stringify(o),l,n.hasMany),a):"",u=typeof i<"u"?Bj(Mj(typeof i=="string"?i:JSON.stringify(i),l,n.hasMany),a):"",d="<p>"+es(c)+"</p>",f="<p>"+es(u)+"</p>",m;if(e[0]!==n.label||e[1]!==a||e[2]!==r||e[3]!==s||e[4]!==d||e[5]!==f){let{From:p,To:h}=pc({fromHTML:d,postProcess:Ua,toHTML:f,tokenizeByCharacter:!0});m=Ehe(Hi,{className:Lhe,From:p,i18n:a,label:{label:n.label,locale:r},nestingLevel:s,To:h}),e[0]=n.label,e[1]=a,e[2]=r,e[3]=s,e[4]=d,e[5]=f,e[6]=m}else m=e[6];return m};import{c as Oj}from"react/compiler-runtime";import{jsx as Hs,jsxs as jhe}from"react/jsx-runtime";import{getTranslation as khe}from"@payloadcms/translations";import"react";var mh="tabs-diff",Mhe=t=>{let e=Oj(13),{baseVersionField:o,comparisonValue:n,field:r,versionValue:s}=t,{selectedLocales:i}=Oi(),a;if(e[0]!==o.tabs||e[1]!==r||e[2]!==t||e[3]!==i||e[4]!==n||e[5]!==s){let l;e[7]!==r||e[8]!==t||e[9]!==i||e[10]!==n||e[11]!==s?(l=(c,u)=>{if(!c?.fields?.length)return null;let d=r.tabs?.[u];return d?Hs("div",{className:`${mh}__tab`,children:(()=>{if("name"in d&&i&&d.localized)return i.map((f,m)=>{let p={...t,comparisonValue:n?.[c.name]?.[f],fieldTab:d,locale:f,tab:c,versionValue:s?.[c.name]?.[f]};return Hs("div",{className:`${mh}__tab-locale`,children:Hs("div",{className:`${mh}__tab-locale-value`,children:Hs(l4,{...p},f)})},[f,m].join("-"))});if("name"in c&&c.name){let f={...t,comparisonValue:n?.[c.name],fieldTab:d,tab:c,versionValue:s?.[c.name]};return Hs(l4,{...f},u)}else return Hs(l4,{fieldTab:d,...t,tab:c},u)})()},u):null},e[7]=r,e[8]=t,e[9]=i,e[10]=n,e[11]=s,e[12]=l):l=e[12],a=Hs("div",{className:mh,children:o.tabs.map(l)}),e[0]=o.tabs,e[1]=r,e[2]=t,e[3]=i,e[4]=n,e[5]=s,e[6]=a}else a=e[6];return a},l4=t=>{let e=Oj(10),{comparisonValue:o,fieldTab:n,locale:r,parentIsLocalized:s,tab:i,versionValue:a}=t,{i18n:l}=N(),{selectedLocales:c}=Oi();if(!i.fields?.length)return null;let u;return e[0]!==n.fields||e[1]!==n.localized||e[2]!==l||e[3]!==r||e[4]!==s||e[5]!==c||e[6]!==i||e[7]!==o||e[8]!==a?(u=Hs(zi,{fields:n.fields,Label:"label"in i&&i.label&&typeof i.label!="function"&&jhe("span",{children:[r&&Hs("span",{className:`${mh}__locale-label`,children:r}),khe(i.label,l)]}),locales:c,parentIsLocalized:s||n.localized,valueFrom:o,valueTo:a,children:Hs(ss,{versionFields:i.fields})}),e[0]=n.fields,e[1]=n.localized,e[2]=l,e[3]=r,e[4]=s,e[5]=c,e[6]=i,e[7]=o,e[8]=a,e[9]=u):u=e[9],u};import{c as Bhe}from"react/compiler-runtime";import{jsx as Ohe}from"react/jsx-runtime";import"react";var Vhe="text-diff";function Vj(t){return typeof t=="string"?{tokenizeByCharacter:!0,value:es(t)}:typeof t=="number"?{tokenizeByCharacter:!0,value:String(t)}:typeof t=="boolean"?{tokenizeByCharacter:!1,value:String(t)}:t&&typeof t=="object"?{tokenizeByCharacter:!1,value:`<pre>${es(JSON.stringify(t,null,2))}</pre>`}:{tokenizeByCharacter:!0,value:void 0}}var Hhe=t=>{let e=Bhe(8),{comparisonValue:o,field:n,locale:r,nestingLevel:s,versionValue:i}=t,{i18n:a}=N(),l="";i==o&&(l='<span class="html-diff-no-value"><span>');let c;if(e[0]!==n.label||e[1]!==a||e[2]!==r||e[3]!==s||e[4]!==l||e[5]!==o||e[6]!==i){let u=Vj(o),d=Vj(i),f=!0;u.value?.length?f=u.tokenizeByCharacter:d.value?.length&&(f=d.tokenizeByCharacter);let m=u.value??l,p=d.value??l,{From:h,To:g}=pc({fromHTML:"<p>"+m+"</p>",postProcess:Ua,toHTML:"<p>"+p+"</p>",tokenizeByCharacter:f});c=Ohe(Hi,{className:Vhe,From:h,i18n:a,label:{label:n.label,locale:r},nestingLevel:s,To:g}),e[0]=n.label,e[1]=a,e[2]=r,e[3]=s,e[4]=l,e[5]=o,e[6]=i,e[7]=c}else c=e[7];return c};import{c as zhe}from"react/compiler-runtime";import{jsx as Hj,jsxs as Ghe}from"react/jsx-runtime";import"react";var Whe="autosave-cell",Uhe=t=>{let e=zhe(5),{currentlyPublishedVersion:o,latestDraftVersion:n,rowData:r}=t,{t:s}=N(),i;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==s?(i=Ghe("div",{className:`${Whe}__items`,children:[r?.autosave&&Hj(vr,{size:"small",children:s("version:autosave")}),Hj(e4,{currentlyPublishedVersion:o,disableDate:!0,doc:r,labelFirst:!1,labelStyle:"pill",latestDraftVersion:n})]}),e[0]=o,e[1]=n,e[2]=r,e[3]=s,e[4]=i):i=e[4],i};import{jsx as Xhe}from"react/jsx-runtime";import{formatAdminURL as zj}from"payload/shared";import"react";var Zhe=t=>{let{collectionSlug:e,docID:o,globalSlug:n,isTrashed:r,rowData:s}=t,{id:i,updatedAt:a}=s===void 0?{}:s,{config:l}=G(),{admin:c,routes:u}=l,{dateFormat:d}=c,{admin:f}=u,{i18n:m}=N(),p=r?"trash/":"",h;return e&&(h=zj({adminRoute:f,path:`/collections/${e}/${p}${o}/versions/${i}`})),n&&(h=zj({adminRoute:f,path:`/globals/${n}/versions/${i}`})),Xhe(jt,{href:h,prefetch:!1,children:lo({date:a,i18n:m,pattern:d})})};import{jsx as Yhe}from"react/jsx-runtime";import{Fragment as Jhe}from"react";function qhe({id:t}){return Yhe(Jhe,{children:t})}import{jsx as Qhe}from"react/jsx-runtime";import"react";var Khe=t=>{let{rowData:e}=t,{id:o,updatedAt:n}=e===void 0?{}:e,{config:r}=G(),{admin:s}=r,{dateFormat:i}=s,{closeAllModals:a}=ie(),l=Re(),c=Ao(),u=lt(),{startRouteTransition:d}=Ue(),{i18n:f}=N();return Qhe("button",{className:"created-at-cell",onClick:()=>{a();let m=new URLSearchParams(Array.from(u.entries()));o&&m.set("versionFrom",String(o));let p=m.toString(),h=p?`?${p}`:"";d(()=>l.push(`${c}${h}`))},type:"button",children:lo({date:n,i18n:f,pattern:i})})};import{jsx as Oo,jsxs as Vv,Fragment as z1e}from"react/jsx-runtime";import{formatAdminURL as G1e,hasAutosaveEnabled as W1e}from"payload/shared";import hk,{Fragment as U1e,useCallback as kd,useEffect as v4,useMemo as X1e,useRef as Md,useState as hh}from"react";import{jsx as Tn,jsxs as Ld}from"react/jsx-runtime";import{getTranslation as e1e}from"@payloadcms/translations";import{hasAutosaveEnabled as Gj,hasDraftsEnabled as Wj}from"payload/shared";import{useCallback as t1e,useEffect as Uj,useRef as o1e,useState as c4}from"react";var Xj="leave-without-saving-doc-drawer",Zj=({actions:t,AfterHeader:e,BeforeDocumentMeta:o,drawerSlug:n,readOnlyForIncomingUser:r,renderTitleAsLink:s=!0,Status:i,user:a})=>{let{closeModal:l,openModal:c}=ie(),{i18n:u,t:d}=N(),{config:f,getEntityConfig:m}=G(),p=Kt(),{id:h,collectionSlug:g,data:b,globalSlug:v,hasSavePermission:C,isEditing:y,isTrashed:x}=be(),w=m({collectionSlug:g}),S=m({globalSlug:v}),_=Wj(w),I=Wj(S),A=Gj(w)||Gj(S),D=!h&&w?.versions?.drafts&&w.versions?.drafts.validate,T=(_||I)&&(!!S||!!w&&y),R=(_||I)&&C&&A&&!D&&!x,P=e1e(w?.labels?.singular??S?.label??d("general:document"),u),E=h?`${d("general:editing")} ${P}`:d("general:creatingNewLabel",{label:P}),F=b?.updatedAt,L=b?.createdAt,{admin:{dateFormat:M}}=f,[$,B]=c4(""),[j,k]=c4(""),[O,V]=c4(""),H=o1e(u);H.current=u,Uj(()=>{let J=F||L;if(!J){B("");return}let oe=()=>B(ca({date:J,i18n:H.current}));oe();let Y=setInterval(oe,6e4);return()=>clearInterval(Y)},[F,L]),Uj(()=>{F&&k(lo({date:F,i18n:u,pattern:M})),L&&V(lo({date:L,i18n:u,pattern:M}))},[F,L,u,M]);let z=!!(w?.timestamps&&y&&(F||L)),W=t1e(()=>{p?c(Xj):l(n)},[p,c,l,n]),U=a&&r,X=!!(U||o),Q=X||T||z||R;return Ld("div",{className:`${Uo}__header`,children:[Ld("div",{className:`${Uo}__header-bar`,children:[Ld("div",{className:`${Uo}__header-content`,children:[Tn(Z,{"aria-label":d("general:close"),buttonStyle:"ghost",className:`${Uo}__header-close`,icon:Tn(ve,{direction:"left",size:24}),onClick:W}),Tn("span",{className:`${Uo}__header-text`,children:E})]}),t?Tn("div",{className:`${Uo}__header-actions`,children:t}):null]}),Ld("div",{className:`${Uo}__title-bar`,children:[Tn(cS,{className:`${Uo}__title`,element:"h2",renderAsLink:s}),Q?Ld("div",{className:`${Uo}__meta`,children:[X&&Ld("div",{className:`${Uo}__before-meta`,children:[U&&Tn(Li,{className:`${Uo}__locked-controls`,user:a}),o]}),T?Tn(le,{CustomComponent:i,Fallback:Tn(Nb,{})}):null,z?Tn("span",{className:`${Uo}__updated-at`,title:j||O||void 0,children:$?d(x?"general:deletedAgo":"general:updatedAgo",{distance:$}):`${d("general:loading")}...`}):null,R?Tn(_b,{collection:w,global:S,id:h,publishedDocUpdatedAt:b?.createdAt}):null]}):null,e?Tn("div",{className:`${Uo}__after-header`,children:e}):null]}),Tn(h5,{modalSlug:Xj,onConfirm:()=>l(n)})]})};import{jsx as ph,jsxs as w1e}from"react/jsx-runtime";import{reduceFieldsToValues as S1e}from"payload/shared";import{useCallback as _1e,useEffect as ik}from"react";import{jsx as Yj,jsxs as r1e}from"react/jsx-runtime";import{useCallback as n1e,useEffect as s1e,useState as i1e}from"react";var Bv="iframe-loader",Jj=({onLoad:t,src:e,title:o,...n})=>{let[r,s]=i1e(!!e);s1e(()=>{s(!!e)},[e]);let i=n1e(a=>{typeof t=="function"&&t(a),s(!1)},[t]);return r1e("div",{className:`${Bv}__container`,children:[Yj(ac,{baseClass:Bv,isLoading:r}),Yj("iframe",{...n,className:[`${Bv}__iframe`,r&&`${Bv}__iframe--is-loading`].filter(Boolean).join(" "),onLoad:i,sandbox:"allow-same-origin allow-scripts allow-forms allow-popups allow-modals allow-downloads",src:e,title:o})]})};import{jsx as qj}from"react/jsx-runtime";import Qj,{useEffect as a1e}from"react";var Kj=t=>{let{children:e}=t,o=Qj.useRef(null),n=Qj.useRef(null),{breakpoint:r,setMeasuredDeviceSize:s,size:i,zoom:a}=Zo(),{size:l}=E0(o.current),{size:c}=E0(n.current),u=!1;a1e(()=>{l&&s(l)},[l,s]);let d="0",f="0";if(r&&r!=="responsive"&&(d="-50%",i&&l&&typeof a=="number"&&typeof i.width=="number"&&typeof i.height=="number"&&typeof l.width=="number"&&typeof l.height=="number")){f="0 auto";let h=i.width/a,g=l.width*a,b=h-i.width;if(u=g>c.width,u)if(a>1){let v=l.width-c.width;v<0?d=`${v/2}px`:d="0"}else d="0";else a>=1?d=`${b/2}px`:(d=`${(c.width-g)/2}px`,f="0")}let m=a?`${100/a}%`:"100%",p=a?`${100/a}%`:"100%";return r!=="responsive"&&(m=`${i?.width/(typeof a=="number"?a:1)}px`,p=`${i?.height/(typeof a=="number"?a:1)}px`),qj("div",{ref:n,style:{height:"100%",width:"100%"},children:qj("div",{ref:o,style:{height:p,margin:f,transform:`translate3d(${d}, 0, 0)`,width:m},children:e})})};import{c as b1e}from"react/compiler-runtime";import{jsx as Tc,jsxs as v1e}from"react/jsx-runtime";import{useDraggable as y1e}from"@dnd-kit/core";import"react";import{c as h1e}from"react/compiler-runtime";import{jsx as Bo,jsxs as $d}from"react/jsx-runtime";import nk from"react";import{jsx as ek}from"react/jsx-runtime";import"react";var l1e={16:"M12.146 3.146a.5.5 0 1 1 .708.708L10.707 6H12.5a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5v-3a.5.5 0 0 1 1 0v1.793zM6.5 9a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-1 0V10.707L3.854 12.854a.5.5 0 1 1-.708-.708L5.293 10H3.5a.5.5 0 0 1 0-1z",24:"M17.146 6.146a.5.5 0 0 1 .708.708L14.707 10H17.5a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 1 0v2.793zM6.854 17.854a.5.5 0 0 1-.708-.708L9.293 14H6.5a.5.5 0 0 1 0-1h4a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-1 0v-2.793z"},tk=({className:t,size:e=24})=>ek("svg",{className:["icon","icon--collapse",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ek("path",{className:"fill",d:l1e[e]})});import{jsx as ok}from"react/jsx-runtime";import"react";var c1e={16:"M6.146 9.146a.5.5 0 1 1 .708.708L4.707 12H6.5a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5v-3a.5.5 0 0 1 1 0v1.793zM12.5 3a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-1 0V4.707L9.854 6.854a.5.5 0 1 1-.708-.708L11.293 4H9.5a.5.5 0 0 1 0-1z",24:"m17 7.707-3.146 3.147a.5.5 0 0 1-.708-.708L16.293 7H13.5a.5.5 0 0 1 0-1h4a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-1 0zm-6.854 5.44a.5.5 0 0 1 .708.707L7.707 17H10.5a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 1 0v2.793z"},rk=({className:t,size:e=24})=>ok("svg",{className:["icon","icon--expand",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ok("path",{className:"fill",d:c1e[e]})});import{c as u1e}from"react/compiler-runtime";import{jsx as u4,jsxs as d1e}from"react/jsx-runtime";import m1e,{useEffect as f1e}from"react";var d4="toolbar-input",m4=t=>{let e=u1e(32),{axis:o}=t,{breakpoint:n,measuredDeviceSize:r,setBreakpoint:s,setSize:i,size:a,zoom:l}=Zo(),{t:c}=N(),[u,d]=m1e.useState((o==="x"?r?.width:r?.height)||0),f;e[0]!==o||e[1]!==r?.height||e[2]!==r?.width||e[3]!==s||e[4]!==i||e[5]!==l?(f=y=>{let x=Number(y.target.value);x<0&&(x=0),d(x),s("custom"),i({type:"reset",value:{height:o==="y"?x:Number(r?.height.toFixed(0))*l,width:o==="x"?x:Number(r?.width.toFixed(0))*l}})},e[0]=o,e[1]=r?.height,e[2]=r?.width,e[3]=s,e[4]=i,e[5]=l,e[6]=f):f=e[6];let m=f,p;e[7]!==o||e[8]!==u||e[9]!==r?.height||e[10]!==r?.width||e[11]!==s||e[12]!==i||e[13]!==l?(p=y=>{let x=u||0,w=y==="up"?x+1:x-1;w<0&&(w=0),d(w),s("custom"),i({type:"reset",value:{height:o==="y"?w:Number(r?.height.toFixed(0))*l,width:o==="x"?w:Number(r?.width.toFixed(0))*l}})},e[7]=o,e[8]=u,e[9]=r?.height,e[10]=r?.width,e[11]=s,e[12]=i,e[13]=l,e[14]=p):p=e[14];let h=p,g,b;e[15]!==o||e[16]!==n||e[17]!==r||e[18]!==a||e[19]!==l?(g=()=>{n==="responsive"&&r&&d(o==="x"?Number(r.width.toFixed(0))*l:Number(r.height.toFixed(0))*l),n!=="responsive"&&a&&d(o==="x"?a.width:a.height)},b=[n,o,r,a,l],e[15]=o,e[16]=n,e[17]=r,e[18]=a,e[19]=l,e[20]=g,e[21]=b):(g=e[20],b=e[21]),f1e(g,b);let v=o==="x"?"W":"H",C;if(e[22]!==o||e[23]!==m||e[24]!==h||e[25]!==u||e[26]!==c||e[27]!==v){let y,x;e[29]!==h?(y=()=>h("down"),x=()=>h("up"),e[29]=h,e[30]=y,e[31]=x):(y=e[30],x=e[31]),C=d1e("div",{className:`${d4}__group`,children:[u4("span",{className:`${d4}__prefix`,children:v}),u4("input",{"aria-label":c(o==="x"?"upload:width":"upload:height"),className:d4,min:0,name:o==="x"?"live-preview-width":"live-preview-height",onChange:m,onWheel:p1e,step:1,type:"number",value:u||0}),u4(ya,{onDecrement:y,onIncrement:x})]}),e[22]=o,e[23]=m,e[24]=h,e[25]=u,e[26]=c,e[27]=v,e[28]=C}else C=e[28];return C};function p1e(t){t.target.blur()}var Rc="live-preview-toolbar-controls",g1e=[50,75,100,125,150,200],f4=()=>{let t=h1e(22),{breakpoint:e,breakpoints:o,isExpanded:n,openPopupWindow:r,setBreakpoint:s,setIsExpanded:i,setIsLivePreviewing:a,setZoom:l,zoom:c}=Zo(),{t:u}=N(),d;if(t[0]!==e||t[1]!==o||t[2]!==n||t[3]!==r||t[4]!==s||t[5]!==i||t[6]!==a||t[7]!==l||t[8]!==u||t[9]!==c){let f={label:u("general:custom"),value:"custom"},m;t[11]!==l||t[12]!==c?(m=b=>{let{close:v}=b;return Bo(ue.RadioGroup,{children:Bo(nk.Fragment,{children:g1e.map(C=>{let y=c*100==C;return $d(ue.RadioGroupItem,{active:y,onClick:()=>{l(C/100),v()},children:[C,"%"]},C)})})})},t[11]=l,t[12]=c,t[13]=m):m=t[13];let p;t[14]!==c?(p=b=>$d(Z,{...b,buttonStyle:"pill",icon:Bo(ve,{size:16}),children:[Bo("span",{className:`${Rc}__zoom-percentage`,children:"%"}),c*100]}),t[14]=c,t[15]=p):p=t[15];let h;t[16]!==n||t[17]!==i?(h=()=>i(!n),t[16]=n,t[17]=i,t[18]=h):h=t[18];let g;t[19]!==r||t[20]!==a?(g=b=>{b.preventDefault(),r(),a(!1)},t[19]=r,t[20]=a,t[21]=g):g=t[21],d=$d("div",{className:Rc,children:[o?.length>0&&Bo(Ve,{className:`${Rc}__breakpoint`,horizontalAlign:"right",render:b=>{let{close:v}=b;return Bo(ue.RadioGroup,{children:$d(nk.Fragment,{children:[o.map(C=>{let y=C.name==e;return Bo(ue.RadioGroupItem,{active:y,onClick:()=>{s(C.name),v()},children:C.label},C.name)}),e==="custom"&&Bo(ue.RadioGroupItem,{active:e==f.value,onClick:()=>{s(f.value),v()},children:f.label})]})})},renderButton:b=>Bo(Z,{...b,buttonStyle:"secondary",icon:Bo(ve,{size:16}),children:o.find(v=>v.name==e)?.label??f.label}),showScrollbar:!0,verticalAlign:"bottom"}),$d("div",{className:`${Rc}__center`,children:[Bo(m4,{axis:"x"}),Bo(m4,{axis:"y"}),Bo(Ve,{className:`${Rc}__zoom`,horizontalAlign:"right",render:m,renderButton:p,showScrollbar:!0,verticalAlign:"bottom"})]}),$d("div",{className:`${Rc}__end`,children:[Bo(Z,{"aria-label":u(n?"general:collapse":"general:expand"),buttonStyle:"ghost",icon:n?Bo(tk,{size:16}):Bo(rk,{size:16}),onClick:h,tooltip:u(n?"general:collapse":"general:expand")}),Bo(Z,{"aria-label":u("general:openInNewWindow"),buttonStyle:"ghost",className:`${Rc}__external`,icon:Bo(Yp,{size:16}),onClick:g,tooltip:u("general:openInNewWindow")})]})]}),t[0]=e,t[1]=o,t[2]=n,t[3]=r,t[4]=s,t[5]=i,t[6]=a,t[7]=l,t[8]=u,t[9]=c,t[10]=d}else d=t[10];return d};var fh="live-preview-toolbar",C1e=t=>{let e=b1e(10),{toolbarPosition:o}=Zo(),n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={id:"live-preview-toolbar"},e[0]=n):n=e[0];let{attributes:r,listeners:s,setNodeRef:i,transform:a}=y1e(n),l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=[fh,`${fh}--draggable`],e[1]=l):l=e[1];let c=`${o.x}px`,u=`${o.y}px`,d;return e[2]!==r||e[3]!==s||e[4]!==t||e[5]!==i||e[6]!==c||e[7]!==u||e[8]!==a?(d=v1e("div",{className:l.join(" "),style:{left:c,top:u,...a?{transform:a?`translate3d(${a?.x||0}px, ${a?.y||0}px, 0)`:void 0}:{}},children:[Tc("button",{...s,...r,className:`${fh}__drag-handle`,ref:i,type:"button",children:Tc(Ho,{})}),Tc(f4,{...t})]}),e[2]=r,e[3]=s,e[4]=t,e[5]=i,e[6]=c,e[7]=u,e[8]=a,e[9]=d):d=e[9],d},x1e=t=>Tc("div",{className:[fh,`${fh}--static`].join(" "),children:Tc(f4,{...t})}),sk=t=>{let{draggable:e}=t;return e?Tc(C1e,{...t}):Tc(x1e,{...t})};var jd="live-preview-window",p4=t=>{let{appIsReady:e,breakpoint:o,iframeRef:n,isExpanded:r,isLivePreviewing:s,lastReadyAt:i,loadedURL:a,popupRef:l,setLoadedURL:c,shouldRenderIframe:u,url:d,zoom:f}=Zo(),m=Ce(),{mostRecentUpdate:p}=yi(),[h]=ea(),{id:g,collectionSlug:b,globalSlug:v}=be(),C=_1e(x=>{l.current&&!l.current.closed&&l.current.postMessage(x,d),n.current&&n.current.contentWindow?.postMessage(x,d)},[n,l,d]),y=s||l.current&&!l.current.closed;return ik(()=>{if(!y||!e||!h)return;let x=S1e(h,!0);x.id||(x.id=g),C({type:"payload-live-preview",collectionSlug:b,data:x,externallyUpdatedRelationship:p,globalSlug:v,locale:m.code})},[h,b,v,g,e,p,m,y,a,i,C]),ik(()=>{!y||!e||C({type:"payload-document-event"})},[p,y,e,C]),ph("div",{className:[jd,s&&`${jd}--is-live-previewing`,r&&`${jd}--is-expanded`,o&&o!=="responsive"&&o!=="custom"&&`${jd}--has-breakpoint`].filter(Boolean).join(" "),children:w1e("div",{className:`${jd}__wrapper`,children:[ph(sk,{...t}),ph("div",{className:`${jd}__main`,children:ph(Kj,{children:u&&ph(Jj,{className:"live-preview-iframe",id:"live-preview-iframe",onLoad:()=>{c(d)},ref:n,src:d,style:{transform:typeof f=="number"?`scale(${f}) `:void 0}})})})]})})};import{formatAdminURL as I1e}from"payload/shared";var ak=({adminRoute:t,router:e,serverURL:o})=>{let n=I1e({adminRoute:t,path:"",serverURL:o});e.push(n)};import{formatAdminURL as R1e}from"payload/shared";var lk=({adminRoute:t,collectionSlug:e,router:o,serverURL:n})=>{let r=R1e({adminRoute:t,path:e?`/collections/${e}`:"/"});o.push(r)};var h4=async({id:t,clearRouteCache:e,collectionSlug:o,documentLockStateRef:n,globalSlug:r,isLockingEnabled:s,isWithinDoc:i,setCurrentEditor:a,setIsReadOnlyForIncomingUser:l,updateDocumentEditor:c,user:u})=>{if(s)try{await c(t,o??r,u),i||(n.current.hasShownLockedModal=!0),n.current={hasShownLockedModal:n.current?.hasShownLockedModal,isLocked:!0,user:u},a(u),i&&l&&l(!1),e&&e()}catch(d){console.error("Error during document takeover:",d)}};import{c as E1e}from"react/compiler-runtime";import{jsx as is,jsxs as Dc}from"react/jsx-runtime";import{formatAdminURL as L1e,getFieldPermissions as g4}from"payload/shared";import{Fragment as $1e,useEffect as j1e,useState as k1e}from"react";import{jsx as Ov,jsxs as ck}from"react/jsx-runtime";import{getTranslation as T1e}from"@payloadcms/translations";import{text as D1e}from"payload/shared";import A1e,{useEffect as uk,useMemo as dk,useState as mk}from"react";var P1e="apiKey",F1e="api-key",N1e="field-type",fk=({enabled:t,readOnly:e})=>{let[o]=mk(Qr()),[n,r]=mk(!1),{i18n:s,t:i}=N(),{config:a,getEntityConfig:l}=G(),{collectionSlug:c}=be(),u=Ht(([y])=>y&&y[P1e]||null),d=l({collectionSlug:c})?.fields?.find(y=>"name"in y&&y.name==="apiKey"),f=y=>D1e(y,{name:"apiKey",type:"text",blockData:{},data:{},event:"onChange",maxLength:48,minLength:24,path:["apiKey"],preferences:{fields:{}},req:{payload:{config:a},t:i},siblingData:{}}),m=u?.value,p=dk(()=>{let y="API Key";return d?.label&&(y=d.label),T1e(y,s)},[d,s]),h=dk(()=>Ov("label",{className:`${F1e}__label field-label`,htmlFor:"apiKey",children:Ov("span",{children:p})}),[p]),g=Ne({path:"apiKey",validate:f}),b=()=>{n&&r(!1),setTimeout(()=>{r(!0)},1)},{setValue:v,value:C}=g;return uk(()=>{!m&&t&&v(o),!t&&m&&v(null)},[m,t,v,o]),uk(()=>{n&&setTimeout(()=>{r(!1)},1e4)},[n]),t?ck(A1e.Fragment,{children:[ck("div",{className:[N1e,"api-key","read-only"].filter(Boolean).join(" "),children:[h,Ov(j5,{"aria-label":p,highlighted:n,id:"apiKey",value:C})]}),!e&&Ov(gw,{highlightField:b,setKey:()=>v(Qr())})]}):null};var Ka="auth-fields",pk=t=>{let e=E1e(19),{className:o,collectionSlug:n,disableLocalStrategy:r,email:s,loginWithUsername:i,operation:a,readOnly:l,requirePassword:c,setValidateBeforeSubmit:u,useAPIKey:d,username:f,verify:m}=t,[p,h]=k1e(c),g=Ht(M1e),b=Ht(B1e),v=Kt(),{i18n:C,t:y}=N(),{docPermissions:x,isEditing:w,isInitializing:S,isTrashed:_}=be(),{config:I}=G(),{routes:A}=I,{api:D}=A,T=!0,R=!0,P=typeof x.fields=="object"&&"password"in x.fields,E=typeof x.fields=="object"&&("username"in x.fields||"email"in x.fields);if(P){let{permissions:re}=g4({field:{name:"password",type:"text"},operation:a,parentName:"",permissions:x?.fields});a==="create"?T=re===!0||typeof re=="object"&&re.create:T=re===!0||typeof re=="object"&&re.update}if(E){let re=i&&(i.requireEmail||i.allowEmailLogin),{operation:me}=g4({field:{name:"email",type:"text"},operation:"read",parentName:"",permissions:x?.fields}),{operation:we}=g4({field:{name:"username",type:"text"},operation:"read",parentName:"",permissions:x?.fields});re?R=we||me:i&&!re?R=we:R=me}let F=(!r||typeof r=="object"&&r.enableFields===!0)&&(R||T),L=l||S||_,M=x?.fields===!0?!0:x?.fields?.enableAPIKey,$=l||M!==!0&&M&&typeof M=="object"&&!M?.update,B=l||M!==!0&&!M?.update,j=M===!0||M?.read,k;e:{if(x){k=!!("unlock"in x&&x.unlock);break e}k=!1}let O=k,V;e[0]!==b||e[1]!==u||e[2]!==y?(V=re=>{re?(u(!0),b({type:"UPDATE",errorMessage:y("validation:required"),path:"password",valid:!1}),b({type:"UPDATE",errorMessage:y("validation:required"),path:"confirm-password",valid:!1})):(u(!1),b({type:"REMOVE",path:"password"}),b({type:"REMOVE",path:"confirm-password"})),h(re)},e[0]=b,e[1]=u,e[2]=y,e[3]=V):V=e[3];let H=V,z;e[4]!==D||e[5]!==n||e[6]!==s||e[7]!==C||e[8]!==i||e[9]!==y||e[10]!==f?(z=async()=>{let re=L1e({apiRoute:D,path:`/${n}/unlock`});(await fetch(re,{body:JSON.stringify(i&&f?{username:f}:{email:s}),credentials:"include",headers:{"Accept-Language":C.language,"Content-Type":"application/json"},method:"post"})).status===200?se.success(y("authentication:successfullyUnlocked")):se.error(y("authentication:failedToUnlock"))},e[4]=D,e[5]=n,e[6]=s,e[7]=C,e[8]=i,e[9]=y,e[10]=f,e[11]=z):z=e[11];let W=z,U,X;e[12]!==v?(U=()=>{v||h(!1)},X=[v],e[12]=v,e[13]=U,e[14]=X):(U=e[13],X=e[14]),j1e(U,X);let Q=F,J=d&&j,oe=m&&w;if(!(Q||J||oe))return null;let Y;e[15]!==C?.language?(Y=re=>!C?.language?.startsWith("en")||!re?re:re.charAt(0)+re.slice(1).toLowerCase(),e[15]=C?.language,e[16]=Y):Y=e[16];let K=Y,ee=F&&(p||!p&&!c&&!r&&T||!p&&a==="update"&&O)?Dc("div",{className:`${Ka}__controls`,children:[p&&!c&&is(Z,{buttonStyle:"secondary",disabled:L,id:"cancel-change-password",onClick:()=>H(!1),size:"medium",children:y("general:cancel")}),!p&&!c&&!r&&T&&is(Z,{buttonStyle:"secondary",disabled:L,id:"change-password",onClick:()=>H(!0),size:"medium",children:K(y("authentication:changePassword"))}),!p&&a==="update"&&O&&is(Z,{buttonStyle:"secondary",disabled:L||!R,id:"force-unlock",onClick:()=>{W()},size:"medium",children:K(y("authentication:forceUnlock"))})]}):null,te;return e[17]!==o?(te=[Ka,o].filter(Boolean),e[17]=o,e[18]=te):te=e[18],is("div",{className:te.join(" "),children:Dc("div",{className:`${Ka}__card`,children:[Dc("div",{className:`${Ka}__header`,children:[is("div",{className:`${Ka}__title`,children:y("authentication:account")}),ee]}),Dc("div",{className:`${Ka}__body`,children:[Q&&Dc($1e,{children:[is(eh,{loginWithUsername:i,operation:a,permissions:x?.fields,readOnly:l||_,t:y}),(p||c)&&(!r||!F)&&Dc("div",{className:`${Ka}__changing-password`,children:[is(Qn,{autoComplete:"new-password",field:{name:"password",label:y("authentication:newPassword"),required:!0},indexPath:"",parentPath:"",parentSchemaPath:"",path:"password",schemaPath:"password"}),is(Ri,{disabled:l||_})]})]}),J&&Dc("div",{className:`${Ka}__api-key`,children:[is(gr,{field:{name:"enableAPIKey",admin:{disabled:L,readOnly:B},label:y("authentication:enableAPIKey")},path:"enableAPIKey",schemaPath:`${n}.enableAPIKey`}),is(fk,{enabled:!!g?.value,readOnly:$})]}),oe&&is(gr,{field:{name:"_verified",admin:{disabled:L,readOnly:l},label:y("authentication:verified")},path:"_verified",schemaPath:`${n}._verified`})]})]})})};function M1e(t){let[e]=t;return e&&e?.enableAPIKey||null}function B1e(t){return t[1]}import{c as O1e}from"react/compiler-runtime";import{useEffect as V1e,useRef as H1e}from"react";var b4=t=>{let e=O1e(14),{collectionConfig:o,config:n,fallback:r,globalConfig:s}=t,i=o?.admin?.useAsTitle,a;e[0]!==i?(a=v=>{let[C]=v;return i&&C&&C?.[i]||null},e[0]=i,e[1]=a):a=e[1];let l=Ht(a),c=H1e(!1),{i18n:u}=N(),{setDocumentTitle:d}=zo(),f=n?.admin?.dateFormat,m=l?.value||"",p;e[2]!==o||e[3]!==f||e[4]!==r||e[5]!==s||e[6]!==u||e[7]!==m||e[8]!==i?(p=Br({collectionConfig:o,data:{id:"",[i]:m},dateFormat:f,fallback:r,globalConfig:s,i18n:u}),e[2]=o,e[3]=f,e[4]=r,e[5]=s,e[6]=u,e[7]=m,e[8]=i,e[9]=p):p=e[9];let h=p,g,b;return e[10]!==d||e[11]!==h?(g=()=>{if(!c.current){c.current=!0;return}d(h)},b=[d,h],e[10]=d,e[11]=h,e[12]=g,e[13]=b):(g=e[12],b=e[13]),V1e(g,b),null};var Wi="collection-edit",y4="payload-pending-success-toast";function Z1e({BeforeDocumentControls:t,BeforeDocumentMeta:e,Description:o,EditMenuItems:n,LivePreview:r,PreviewButton:s,PublishButton:i,SaveButton:a,SaveDraftButton:l,Status:c,UnpublishButton:u,Upload:d,UploadControls:f}){let{id:m,action:p,AfterDocument:h,AfterFields:g,apiURL:b,BeforeFields:v,collectionSlug:C,currentEditor:y,data:x,disableActions:w,disableCreate:S,disableLeaveWithoutSaving:_,docPermissions:I,documentIsLocked:A,documentLockState:D,getDocPermissions:T,getDocPreferences:R,globalSlug:P,hasPublishPermission:E,hasSavePermission:F,incrementVersionCount:L,initialState:M,isEditing:$,isInitializing:B,isLocked:j,isTrashed:k,lastUpdateTime:O,redirectAfterCreate:V,redirectAfterDelete:H,redirectAfterDuplicate:z,redirectAfterRestore:W,setCurrentEditor:U,setData:X,setDocumentIsLocked:Q,setLastUpdateTime:J,unlockDocument:oe,updateDocumentEditor:Y}=be(),{clearDoc:K,drawerSlug:ee,onDelete:te,onDuplicate:re,onRestore:me,onSave:we}=Zm(),Ae=!!ee,{refreshCookieAsync:de,user:xe}=ye(),{config:$e,config:{admin:{user:Le},routes:{admin:rt},serverURL:q},getEntityConfig:pe}=G(),fe=pe({collectionSlug:C}),Pe=pe({globalSlug:P}),ge=vt(),ae=Re(),Se=lt(),{reportUpdate:ne}=yi(),{resetUploadEdits:Te}=bl(),{getFormState:he}=ct(),{startRouteTransition:_e}=Ue(),{clearRouteCache:Ze}=zt(),{isLivePreviewEnabled:ut,isLivePreviewing:De,isPopupOpen:it,setURL:pt,typeofLivePreviewURL:Vt,url:Nt}=Zo(),{isPreviewEnabled:Do,setPreviewURL:Be}=Sb(),qe=Md(null),ce=Md(null),ze=Se.get("locale"),He=fe?.slug||Pe?.slug,at=C&&!m?"create":"update",Ye=fe?fe.auth:void 0,ot=fe?fe.upload:void 0,Ie=fe||Pe,Qe=Ie?.lockDocuments!==void 0?Ie?.lockDocuments:!0,Ke=Qe!==!1,$t=(typeof Qe=="object"?Qe.duration:300)*1e3,$o=W1e(Ie),[dr,St]=hh(!1),[mr,Er]=hh(!1),[qo,as]=hh(!1),[Ui,zs]=hh(Date.now()),un=Md(!1),Wr=Md(x?.updatedAt),Xi=Md(0),Zi=Md(!1),Yt=O+$t,jo=Date.now()>Yt,Yi=!dr&&(typeof _<"u"?!_:!$o),Gs=X1e(()=>[He],[He]),[ls,Ac]=hh(()=>!!(at==="create"&&Ye&&!Ye.disableLocalStrategy)),Bd=hk.useRef(null),gh=kd(_t=>{Q(!0);let cs=typeof D.current?.user=="object"?D.current?.user?.id:D.current?.user;if(_t&&_t.user){let us=typeof _t.user=="string"||typeof _t.user=="number"?_t.user:_t.user.id;(!D.current||us!==cs)&&(cs===xe.id&&us!==xe.id&&(Er(!0),D.current.hasShownLockedModal=!0),D.current={hasShownLockedModal:D.current?.hasShownLockedModal||!1,isLocked:!0,user:_t.user},U(_t.user)),_t.lastEditedAt&&J(new Date(_t.lastEditedAt).getTime())}},[D,U,Q,J,xe?.id]),Od=kd(()=>{as(!1),ae.refresh()},[ae]),Hv=kd(_t=>{Bd.current=_t},[]),Pc=kd(async()=>{let _t=D.current?.user,cs=typeof _t=="object"?_t?.id===xe?.id:_t===xe?.id;if(Ke&&A&&(m||P)){let us=Bd.current?new URL(Bd.current).pathname:"",zd=["/preview","/api","/versions"].some(el=>us.includes(el));if(cs&&!zd)try{await oe(m,C??P),Q(!1),U(null)}catch(el){console.error("Failed to unlock before leave",el)}}},[C,A,D,P,m,Ke,U,Q,oe,xe?.id]),Vd=kd(async(_t,cs)=>{let{context:us,formState:zd}=cs||{},el=_r(ce),ds=_t?.doc||_t?.result,Nc=ds?.updatedAt||new Date().toISOString();if(xe&&C===Le&&m===xe.id&&de(),J(new Date(Nc).getTime()),Wr.current=Nc,un.current=!1,Zi.current=!1,us?.incrementVersionCount!==!1&&L(),typeof X=="function"&&X(ds||{}),typeof we=="function"){let Ws=m?"update":"create";we({..._t,context:us,operation:Ws,updatedAt:Ws==="update"?new Date().toISOString():ds?.updatedAt||new Date().toISOString()})}if(!$&&ge<2&&V!==!1){_t.message&&typeof window<"u"&&window.sessionStorage.setItem(y4,_t.message);let Ws=G1e({adminRoute:rt,path:`/collections/${C}/${ds?.id}${ze?`?locale=${ze}`:""}`});_e(()=>ae.push(Ws))}else Te();if(us?.getDocPermissions!==!1&&await T(_t),m||P){let Ws=await R(),{livePreviewURL:Gd,previewURL:zv,state:Ec}=await he({id:m,collectionSlug:C,data:ds,docPermissions:I,docPreferences:Ws,formState:zd,globalSlug:P,operation:at,renderAllFields:!1,returnLivePreviewURL:ut&&Vt==="function",returnLockStatus:!1,returnPreviewURL:Do,schemaPath:Gs.join("."),signal:el.signal,skipValidation:!0});return ot&&Ec&&delete Ec.file,Ke&&Q(!1),ut&&Vt==="function"&&pt(Gd),Do&&Be(zv),ne({id:m,doc:ds,drawerSlug:ee,entitySlug:He,operation:"update",updatedAt:Nc}),ce.current=null,Ec}else ne({id:m,doc:ds,drawerSlug:ee,entitySlug:He,operation:"create",updatedAt:Nc})},[xe,C,Le,m,J,X,we,$,ge,V,P,de,L,rt,ze,_e,ae,Te,T,R,he,I,at,ut,Vt,Do,Gs,ot,Ke,ne,ee,He,Q,pt,Be]),Hd=kd(async({formState:_t,submitted:cs})=>{let us=_r(qe),zd=Xi.current,el=Zi.current;x?.updatedAt&&x.updatedAt>Wr.current&&(Wr.current=x.updatedAt,un.current=!1);let ds=Date.now(),Nc=ds-Ui,Ws=Ke&&Nc>=1e4;Ws&&zs(ds);let Gd=!un.current&&Wr.current&&at==="update"&&!$o;Gd&&(un.current=!0);let zv=await R(),Ec=await he({id:m,checkForStaleData:Gd,collectionSlug:C,docPermissions:I,docPreferences:zv,formState:_t,globalSlug:P,operation:at,originalUpdatedAt:Gd?Wr.current:void 0,renderAllFields:!1,returnLockStatus:Ke,schemaPath:Gs.join("."),signal:us.signal,skipValidation:!cs,updateLastEdited:Ws});if(!Ec)return;let{lockedState:bk,staleDataState:vk,state:yk}=Ec;return Ke&&gh(bk),vk?.isStale&&!el&&Xi.current===zd&&as(!0),qe.current=null,yk},[x?.updatedAt,Ui,Ke,R,he,m,C,I,P,at,Gs,gh,$o]);v4(()=>()=>{Er(!1)},[]),v4(()=>{let _t=qe.current,cs=ce.current;return()=>{Fo(_t),Fo(cs)}},[]),v4(()=>{if(!B&&typeof window<"u"){let _t=window.sessionStorage.getItem(y4);_t&&(window.sessionStorage.removeItem(y4),se.success(_t))}},[B]);let Fc=A&&y&&(typeof y=="object"?y.id!==xe?.id:y!==xe?.id)&&!dr&&!mr&&!D.current?.hasShownLockedModal&&!jo,gk=!!(fe?.hierarchy&&typeof fe.hierarchy=="object"&&fe.hierarchy.allowHasMany===!1),C4={id:m,slug:fe?.slug||Pe?.slug,apiURL:b,BeforeDocumentControls:t,BeforeDocumentMeta:e,customComponents:{PreviewButton:s,PublishButton:i,SaveButton:a,SaveDraftButton:l,Status:c,UnpublishButton:u},data:x,disableActions:w||k,disableCreate:S,EditMenuItems:n,hasPublishPermission:E,hasSavePermission:F,isEditing:$,isInDrawer:Ae,isTrashed:k,onDelete:te,onDrawerCreateNew:K,onDuplicate:re,onRestore:me,onSave:Vd,onTakeOver:()=>{h4({id:m,clearRouteCache:Ze,collectionSlug:C,documentLockStateRef:D,globalSlug:P,isLockingEnabled:Ke,isWithinDoc:!0,setCurrentEditor:U,setIsReadOnlyForIncomingUser:St,updateDocumentEditor:Y,user:xe})},permissions:I,readOnlyForIncomingUser:dr,redirectAfterDelete:H,redirectAfterDuplicate:z,redirectAfterRestore:W,user:y};return Oo("main",{className:[Wi,(m||P)&&`${Wi}--is-editing`,P&&`global-edit--${P}`,C&&`collection-edit--${C}`,De&&`${Wi}--is-live-previewing`].filter(Boolean).join(" "),children:Oo(vl,{operation:at,children:Vv(fo,{action:p,className:`${Wi}__form`,disabled:dr||B||!F||k,disableSuccessStatus:!$&&ge<2&&V!==!1,disableValidationOnSubmit:!ls,initialState:!B&&M,isDocumentForm:!0,isInitializing:B,method:m?"PATCH":"POST",onChange:[Hd],onSubmit:()=>{Xi.current+=1,Zi.current=!0},onSuccess:Vd,children:[Ae&&Oo(Zj,{actions:Oo($b,{...C4,variant:"drawerHeaderActions"}),AfterHeader:o,BeforeDocumentMeta:e,drawerSlug:ee,readOnlyForIncomingUser:dr,renderTitleAsLink:!gk,Status:c,user:y}),Ke&&Fc&&Oo(x5,{handleGoBack:()=>lk({adminRoute:rt,collectionSlug:C,router:ae,serverURL:q}),isActive:Fc,onReadOnly:()=>{St(!0),Er(!1)},onTakeOver:()=>h4({id:m,clearRouteCache:Ze,collectionSlug:C,documentLockStateRef:D,globalSlug:P,isLockingEnabled:Ke,isWithinDoc:!1,setCurrentEditor:U,updateDocumentEditor:Y,user:xe}),updatedAt:O,user:y}),Ke&&mr&&Oo(v5,{handleBackToDashboard:()=>ak({adminRoute:rt,router:ae,serverURL:q}),isActive:mr,onReadOnly:()=>{St(!0),Er(!1)}}),qo&&Oo(C5,{isActive:qo,onReload:Od}),Yi&&Oo(tp,{modalSlug:ee?`leave-without-saving-${ee}`:void 0,onConfirm:Pc,onPrevent:Hv}),!Ae&&Oo(nh,{collectionSlug:fe?.slug,globalSlug:Pe?.slug,id:m,isTrashed:k,pluralLabel:fe?.labels?.plural,useAsTitle:fe?.admin?.useAsTitle}),Oo(b4,{collectionConfig:fe,config:$e,fallback:ge<=1?m?.toString():void 0,globalConfig:Pe}),!Ae&&Oo($b,{...C4,variant:"default"}),Vv("div",{className:[`${Wi}__main-wrapper`,it&&`${Wi}--detached`].filter(Boolean).join(" "),children:[Vv("div",{className:[`${Wi}__main`,it&&`${Wi}__main--popup-open`].filter(Boolean).join(" "),children:[Oo(Lf,{AfterFields:g,BeforeFields:v||Vv(U1e,{children:[Ye&&Oo(pk,{className:`${Wi}__auth`,collectionSlug:fe.slug,disableLocalStrategy:fe.auth?.disableLocalStrategy,email:x?.email,loginWithUsername:Ye?.loginWithUsername,operation:at,readOnly:!F,requirePassword:!m,setValidateBeforeSubmit:Ac,useAPIKey:Ye.useAPIKey,username:x?.username,verify:Ye.verify}),ot&&Oo(hk.Fragment,{children:Oo(Ou,{children:d||Oo(L2,{collectionSlug:fe.slug,initialState:M,uploadConfig:ot,UploadControls:f})})})]}),Description:o,docPermissions:I,fields:Ie.fields,forceSidebarWrap:De,isTrashed:k,readOnly:dr||!F||k,schemaPathSegments:Gs}),h]}),ut&&!Ae&&Nt&&Oo(z1e,{children:r||Oo(p4,{collectionSlug:C,globalSlug:P})})]})]},`${j}`)})})}export{j5 as APIKeyInput,afe as APIViewClient,tb as Account,Bme as AccountClient,Xme as AccountLanguageSelector,Gme as AccountResetPreferences,Jme as AccountToggleHighContrast,efe as AccountToggleTheme,Nre as ActionsProvider,Ho as AlignJustifiedIcon,rm as AnimateHeight,Sne as AppHeader,Yf as ArrayField,E1 as ArrowIcon,eC as AuthProvider,Xr as Banner,wC as BlockSelector,wm as BlocksDrawer,Sm as BlocksField,gF as BulkUploadDrawer,k2 as BulkUploadProvider,Z as Button,Dk as CalendarIcon,$ne as Card,Vo as CheckIcon,gr as CheckboxField,Ft as CheckboxInput,ve as ChevronIcon,rd as Chip,ai as CirclePlusIcon,Om as CircledXIcon,gS as ClientFunctionProvider,tm as ClipboardIcon,kue as CloseMenuIcon,Bue as CodeBlockIcon,Rk as CodeEditor,wl as CodeEditorLazy,_m as CodeField,Qs as Collapsible,Rm as CollapsibleField,sue as Combobox,hue as CommandPalette,Uv as ConfigProvider,Ri as ConfirmPasswordField,nt as ConfirmationModal,sl as CopyIcon,X5 as CopyLocaleData,jf as CopyToClipboard,ufe as CreateFirstUserClient,Bx as DateCell,r5 as DateCondition,Ak as DatePicker,Gm as DateTimeField,xm as DefaultBlockImage,rf as DefaultCell,Z1e as DefaultEditView,Ime as DefaultListView,Ece as DefaultNavClient,qce as DefaultTemplateWrapper,Ype as DefaultVersionView,ac as DelayedSpinner,Ip as DeleteMany,fs as DialogBody,ia as DialogCancel,ps as DialogConfirm,hs as DialogFooter,gs as DialogHeader,fn as DialogModal,$b as DocumentControls,r2 as DocumentEventsProvider,Lf as DocumentFields,pS as DocumentIcon,hm as DocumentInfoProvider,x5 as DocumentLocked,Kp as DocumentSelectionProvider,C5 as DocumentStaleData,Gce as DocumentTabLink,v5 as DocumentTakeOver,xw as Dots,Ho as DragHandleIcon,hr as DraggableSortable,Yr as DraggableSortableItem,It as Drawer,Rne as DrawerContentContainer,Jr as DrawerToggler,Jl as Dropzone,vC as DuplicateIcon,Ks as EditDepthProvider,fr as EditIcon,Ep as EditMany,D2 as EditUpload,eh as EmailAndUsernameFields,On as EmailField,uue as EntityVisibilityProvider,Kue as ErrorIcon,yo as ErrorPill,Yp as ExternalLinkIcon,rc as EyeIcon,VI as FieldContext,Xe as FieldDescription,Hi as FieldDiffContainer,dh as FieldDiffLabel,tt as FieldError,Sf as FieldErrorsToast,Fe as FieldLabel,si as FieldPathContext,zg as File,N2 as FileDetails,Cp as FilterIcon,$p as FilterTrigger,ef as FolderIcon,ope as ForgotPasswordForm,fo as Form,hd as FormHeader,uZ as FormLoadingOverlayToggle,qt as FormSubmit,Cae as FullscreenModal,Ma as GearIcon,gw as GenerateConfirmation,Xue as GridViewIcon,Kle as GroupByHeader,mce as GroupByPageControls,Wm as GroupField,Is as Gutter,Fl as HiddenField,rle as HierarchyButtonClient,O6 as HierarchyDrawerToggler,ule as HierarchyFieldClient,jme as HierarchyListView,Px as HierarchyProvider,Fse as HierarchySidebarTab,tue as HierarchyTypeField,Fae as HydrateAuthProvider,B5 as HydrateHierarchyProvider,vw as IDLabel,Kd as InfoIcon,ya as InputStepper,ede as InteractionEnterIcon,dS as ItemsDrawer,lf as JSONField,af as JoinField,$5 as KeyIcon,$a as LanguageIcon,tp as LeaveWithoutSaving,gm as LineIcon,jt as Link,em as LinkIcon,Tw as ListControls,Dw as ListControlsBar,dx as ListDrawerContextProvider,Ww as ListHeader,hx as ListQueryProvider,Mp as ListSearchFilter,gc as ListSelection,Ho as ListViewIcon,hde as LivePreviewProvider,p4 as LivePreviewWindow,en as LoadingOverlay,Rg as LoadingOverlayToggle,tC as LocaleProvider,Dp as LockIcon,mS as LockOpenIcon,Li as Locked,dp as LogOutIcon,lpe as LoginForm,gce as Logout,ppe as LogoutClient,ka as MenuSeparator,fS as MinimizeMaximizeIcon,En as Modal,Ufe as ModularDashboardClient,il as MoreIcon,Wue as MoveFolderIcon,S5 as NavContext,tS as NavGroup,_5 as NavProvider,vce as NavSidebarToggle,I5 as NavToggler,Cce as NavWrapper,El as NoListResults,bpe as NotFoundClient,Due as NullField,vm as NullifyLocaleField,n5 as NumberCondition,Ol as NumberField,vl as OperationProvider,Ute as OrderableTable,xk as PageConfigProvider,nv as PageControls,rv as PageControlsComponent,Yw as Pagination,Qn as PasswordField,$ue as PayloadIcon,Wv as PayloadLink,Yue as PeopleIcon,Jw as PerPage,vr as Pill,Ene as PillSelector,Po as PlusIcon,cf as PointField,Ve as Popup,ue as PopupList,dC as PreferencesProvider,rw as PreviewButton,E2 as PreviewSizes,xde as ProgressBar,sw as PublishButton,Bp as PublishMany,toe as QueryPresetsAccessCell,Coe as QueryPresetsColumnField,Jte as QueryPresetsColumnsCell,uoe as QueryPresetsGroupByCell,Joe as QueryPresetsGroupByField,Koe as QueryPresetsHeading,Kte as QueryPresetsWhereCell,Goe as QueryPresetsWhereField,mf as RadioGroupField,mt as ReactSelect,Lp as RefreshIcon,V0 as RelationshipCondition,yf as RelationshipField,l2 as RelationshipInput,Qm as RelationshipProvider,Yx as RelationshipTable,le as RenderCustomComponent,yJ as RenderDefaultCell,co as RenderFields,cS as RenderTitle,ss as RenderVersionFieldsToDiff,ype as ResetPasswordForm,Cf as RichTextField,kde as RootProvider,g5 as RouteCacheProvider,vy as RouteTransitionProvider,Ck as RouterAdapterContext,xf as RowField,Ur as RowLabel,uy as RowLabelProvider,iw as SaveButton,aw as SaveDraftButton,Qp as ScrollInfoProvider,Cl as SearchIcon,xl as SearchInput,SC as SectionTitle,mt as Select,Qde as SelectAll,c5 as SelectCondition,Wl as SelectField,_s as SelectInput,Sd as SelectMany,eme as SelectRow,Ew as SelectionProvider,Sk as ServerFunctionsContext,Xv as ServerFunctionsProvider,nh as SetDocumentStepNav,b4 as SetDocumentTitle,Jre as SetStepNav,_ce as SettingsMenuButton,Ct as ShimmerEffect,Oce as ShouldRenderTabs,kne as SidebarRow,Bce as SidebarTabsClient,G2 as SidebarTabsProvider,bw as SidebarToggle,zp as SimplePagination,Nue as SlugField,Cue as SortColumn,U2 as SortDownIcon,Bte as SortHeader,Hte as SortRow,tn as Spinner,Ik as StaggeredShimmers,ode as SuccessIcon,yy as SwapIcon,Tx as Switch,c0 as TabButton,v2 as TabComponent,nS as TabError,Pp as Table,Xm as TableColumnsProvider,ip as TableSection,Vq as Tabs,Tf as TabsField,l0 as TabsList,ux as TabsProvider,Ll as TagIcon,u5 as TextCondition,Cn as TextField,Df as TextInput,Af as TextareaField,y2 as TextareaInput,Wd as ThemeProvider,que as ThreeDotsIcon,on as Thumbnail,Cm as ThumbnailCard,zm as TimezonePicker,_pe as ToastAndRedirect,io as Tooltip,Ro as Translation,Zv as TranslationProvider,Ql as TrashIcon,Pf as UIField,cw as UnpublishButton,Op as UnpublishMany,L2 as Upload,fC as UploadEditsProvider,Zf as UploadField,g2 as UploadHandlersProvider,P0 as UploadInput,L5 as UserMenu,rb as VariableColorIcon,Ipe as VerifyClient,Khe as VersionDrawerCreatedAtCell,uhe as VersionFieldDiffCheckbox,Che as VersionFieldDiffCollapsible,She as VersionFieldDiffDate,Rhe as VersionFieldDiffGroup,Ahe as VersionFieldDiffIterable,Fhe as VersionFieldDiffRow,$he as VersionFieldDiffSelect,Mhe as VersionFieldDiffTabs,Hhe as VersionFieldDiffText,e4 as VersionPillLabel,Uhe as VersionsAutosaveCell,Zhe as VersionsCreatedAtCell,qhe as VersionsIDCell,Zce as VersionsPill,qpe as VersionsViewClient,ap as ViewDescription,ju as WarningIcon,nde as WarningTriangleIcon,_l as WatchChildErrors,gC as WatchCondition,CS as WindowInfoProvider,nl as WriteIcon,xt as XIcon,gte as allFieldComponents,Zp as commandPaletteSlug,wk as defaultTheme,Uo as documentDrawerBaseClass,es as escapeDiffHTML,Ee as fieldBaseClass,EF as fieldComponents,Rf as fieldReducer,Zy as formatDrawerSlug,B6 as formatHierarchyDrawerSlug,wf as formatOptions,ca as formatTimeToNow,pc as getHTMLDiffComponents,yl as isFieldRTL,st as mergeFieldStyles,mo as parseSearchParams,se as toast,Ua as unescapeDiffHTML,w5 as useActions,sde as useAddClientFunction,ea as useAllFormFields,ye as useAuth,nr as useBulkUpload,vF as useBulkUploadDrawerSlug,Wx as useCellProps,iae as useClickOutside,mw as useClickOutsideContext,ide as useClientFunctions,ra as useCollapsible,G as useConfig,Lr as useControllableState,Vn as useDebounce,tf as useDebouncedCallback,Vm as useDebouncedEffect,Yv as useDelay,vx as useDelayedRender,ro as useDocumentDrawer,Zm as useDocumentDrawerContext,yi as useDocumentEvents,$c as useDocumentForm,be as useDocumentInfo,xc as useDocumentSelection,zo as useDocumentTitle,qs as useDraggableSortable,um as useDrawerSlug,vt as useEditDepth,et as useEffectEvent,Up as useEntityVisibility,Ne as useField,F1 as useFieldPath,Ge as useForm,ly as useFormBackgroundProcessing,Ht as useFormFields,Xs as useFormInitializing,Kt as useFormModified,mn as useFormProcessing,vo as useFormSubmitted,No as useHierarchy,fi as useHierarchyDrawer,Ai as useHotkey,Js as useIntersect,Vl as useListDrawer,Sr as useListDrawerContext,bt as useListQuery,Km as useListRelationships,Zo as useLivePreviewContext,Ce as useLocale,ie as useModal,nn as useNav,qr as useOperation,Gv as useParams,Ao as usePathname,Dte as usePayloadAPI,Jt as usePreferences,Hl as useQueue,E0 as useResize,zt as useRouteCache,Ue as useRouteTransition,Re as useRouter,Gk as useRowLabel,qp as useScrollInfo,lt as useSearchParams,ts as useSelection,ct as useServerFunctions,W2 as useSidebarTabs,Lo as useStepNav,xu as useTableColumns,Us as useTheme,pl as useThrottledEffect,N as useTranslation,x2 as useUploadControls,bl as useUploadEdits,_f as useUploadHandlers,Lte as useUseTitleField,Ph as useWatchForm,xS as useWindowInfo,Je as withCondition};
62
- /*! Bundled license information:
63
-
64
- scheduler/cjs/scheduler.production.js:
65
- (**
66
- * @license React
67
- * scheduler.production.js
68
- *
69
- * Copyright (c) Meta Platforms, Inc. and affiliates.
70
- *
71
- * This source code is licensed under the MIT license found in the
72
- * LICENSE file in the root directory of this source tree.
73
- *)
74
-
75
- react-is/cjs/react-is.production.min.js:
76
- (** @license React v16.13.1
77
- * react-is.production.min.js
78
- *
79
- * Copyright (c) Facebook, Inc. and its affiliates.
80
- *
81
- * This source code is licensed under the MIT license found in the
82
- * LICENSE file in the root directory of this source tree.
83
- *)
84
-
85
- is-buffer/index.js:
86
- (*!
87
- * Determine if an object is a Buffer
88
- *
89
- * @author Feross Aboukhadijeh <https://feross.org>
90
- * @license MIT
91
- *)
92
-
93
- focus-trap/dist/focus-trap.esm.js:
94
- (*!
95
- * focus-trap 7.5.4
96
- * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
97
- *)
98
- */
13
+ import{fieldComponents as Bt}from"../../fields/index.js";import{useDebounce as At}from"../../hooks/useDebounce.js";import{useDebouncedCallback as zt}from"../../hooks/useDebouncedCallback.js";import{useDebouncedEffect as Ut}from"../../hooks/useDebouncedEffect.js";import{useDelay as Yt}from"../../hooks/useDelay.js";import{useDelayedRender as Wt}from"../../hooks/useDelayedRender.js";import{useHotkey as Gt}from"../../hooks/useHotkey.js";import{useIntersect as Jt}from"../../hooks/useIntersect.js";import{usePayloadAPI as Xt}from"../../hooks/usePayloadAPI.js";import{useResize as Zt}from"../../hooks/useResize.js";import{useThrottledEffect as eo}from"../../hooks/useThrottledEffect.js";import{useEffectEvent as oo}from"../../hooks/useEffectEvent.js";import{FieldPathContext as ao,useFieldPath as no}from"../../forms/RenderFields/context.js";import{useQueue as io}from"../../hooks/useQueue.js";import{useUseTitleField as mo}from"../../hooks/useUseAsTitle.js";import{SidebarTabsProvider as fo,useSidebarTabs as po}from"../../providers/SidebarTabs/index.js";import{SortHeader as xo}from"../../elements/SortHeader/index.js";import{SortRow as go}from"../../elements/SortRow/index.js";import{OrderableTable as bo}from"../../elements/Table/OrderableTable.js";import{QueryPresetsColumnsCell as wo}from"../../elements/QueryPresets/cells/ColumnsCell/index.js";import{QueryPresetsWhereCell as So}from"../../elements/QueryPresets/cells/WhereCell/index.js";import{QueryPresetsAccessCell as Do}from"../../elements/QueryPresets/cells/AccessCell/index.js";import{QueryPresetsGroupByCell as Io}from"../../elements/QueryPresets/cells/GroupByCell/index.js";import{QueryPresetsColumnField as Eo}from"../../elements/QueryPresets/fields/ColumnsField/index.js";import{QueryPresetsWhereField as Lo}from"../../elements/QueryPresets/fields/WhereField/index.js";import{QueryPresetsGroupByField as No}from"../../elements/QueryPresets/fields/GroupByField/index.js";import{QueryPresetsHeading as Mo}from"../../elements/QueryPresets/fields/Heading/index.js";import{ConfirmationModal as Ho}from"../../elements/ConfirmationModal/index.js";import{DialogBody as Vo,DialogCancel as Uo,DialogConfirm as jo,DialogFooter as Yo,DialogHeader as Oo,DialogModal as Wo}from"../../elements/Dialog/index.js";import{Link as Go}from"../../elements/Link/index.js";import{LeaveWithoutSaving as Jo}from"../../elements/LeaveWithoutSaving/index.js";import{DocumentTakeOver as Xo}from"../../elements/DocumentTakeOver/index.js";import{DocumentStaleData as Zo}from"../../elements/DocumentStaleData/index.js";import{DocumentLocked as er}from"../../elements/DocumentLocked/index.js";import{TableColumnsProvider as or,useTableColumns as rr}from"../../providers/TableColumns/index.js";import{RenderDefaultCell as nr,useCellProps as sr}from"../../providers/TableColumns/RenderDefaultCell/index.js";import{DateCell as lr}from"../../elements/Table/DefaultCell/fields/Date/index.js";import{TableSection as mr}from"../../elements/TableSection/index.js";import{Translation as fr}from"../../elements/Translation/index.js";import{default as ur}from"../../elements/DatePicker/DatePicker.js";import{ViewDescription as hr}from"../../elements/ViewDescription/index.js";import{AppHeader as vr}from"../../elements/AppHeader/index.js";import{MenuSeparator as yr}from"../../elements/MenuSeparator/index.js";import{RenderCustomComponent as Cr}from"../../elements/RenderCustomComponent/index.js";import{BulkUploadDrawer as Tr,BulkUploadProvider as Dr,useBulkUpload as Pr,useBulkUploadDrawerSlug as Ir}from"../../elements/BulkUpload/index.js";import{DrawerContentContainer as Er}from"../../elements/DrawerContentContainer/index.js";import{APIKeyInput as Lr}from"../../elements/APIKeyInput/index.js";import{Banner as Nr}from"../../elements/Banner/index.js";import{Button as Mr}from"../../elements/Button/index.js";import{TabButton as Hr,Tabs as zr,TabsList as Vr}from"../../elements/Tabs/index.js";import{AnimateHeight as jr}from"../../elements/AnimateHeight/index.js";import{PillSelector as Or}from"../../elements/PillSelector/index.js";import{Card as $r}from"../../elements/Card/index.js";import{Chip as Qr}from"../../elements/Chip/index.js";import{Collapsible as Kr,useCollapsible as Xr}from"../../elements/Collapsible/index.js";import{SidebarRow as Zr}from"../../elements/SidebarRow/index.js";import{HierarchySidebarTab as ea}from"../../elements/Hierarchy/Tree/HierarchySidebarTab.js";import{CopyLocaleData as oa}from"../../elements/CopyLocaleData/index.js";import{CopyToClipboard as aa}from"../../elements/CopyToClipboard/index.js";import{DeleteMany as sa}from"../../elements/DeleteMany/index.js";import{DocumentControls as la}from"../../elements/DocumentControls/index.js";import{Dropzone as ma}from"../../elements/Dropzone/index.js";import{documentDrawerBaseClass as fa,useDocumentDrawer as pa}from"../../elements/DocumentDrawer/index.js";import{escapeDiffHTML as xa,getHTMLDiffComponents as ha,unescapeDiffHTML as ga}from"../../elements/HTMLDiff/index.js";import{useClickOutside as ba}from"../../hooks/useClickOutside.js";import{useClickOutsideContext as wa}from"../../providers/ClickOutside/index.js";import{useDocumentDrawerContext as Sa}from"../../elements/DocumentDrawer/Provider.js";import{useDraggableSortable as Da}from"../../elements/DraggableSortable/useDraggableSortable/index.js";import{DraggableSortable as Ia}from"../../elements/DraggableSortable/index.js";import{DraggableSortableItem as Ea}from"../../elements/DraggableSortable/DraggableSortableItem/index.js";import{DocumentFields as La}from"../../elements/DocumentFields/index.js";import{Drawer as Na,DrawerToggler as Ba,formatDrawerSlug as Ma}from"../../elements/Drawer/index.js";import{useDrawerSlug as Ha}from"../../elements/Drawer/useDrawerSlug.js";import{EditMany as Va}from"../../elements/EditMany/index.js";import{ErrorPill as ja}from"../../elements/ErrorPill/index.js";import{Modal as Oa,useModal as Wa}from"../../elements/Modal/index.js";import{FullscreenModal as Ga}from"../../elements/FullscreenModal/index.js";import{GenerateConfirmation as Ja}from"../../elements/GenerateConfirmation/index.js";import{Gutter as Xa}from"../../elements/Gutter/index.js";import{SidebarToggle as Za}from"../../elements/SidebarToggle/index.js";import{HydrateAuthProvider as en}from"../../elements/HydrateAuthProvider/index.js";import{HydrateHierarchyProvider as on}from"../../elements/Hierarchy/HydrateProvider/index.js";import{IDLabel as an}from"../../elements/IDLabel/index.js";import{InputStepper as sn}from"../../elements/InputStepper/index.js";import{Locked as dn}from"../../elements/Locked/index.js";import{ListControls as cn}from"../../elements/ListControls/index.js";import{ListControlsBar as pn}from"../../elements/ListControlsBar/index.js";import{useListDrawer as xn}from"../../elements/ListDrawer/index.js";import{HierarchyButtonClient as gn}from"../../elements/Hierarchy/DocHeaderButton/index.js";import{HierarchyFieldClient as bn}from"../../elements/Hierarchy/Field/index.client.js";import{formatHierarchyDrawerSlug as wn,HierarchyDrawerToggler as Cn,useHierarchyDrawer as Sn}from"../../elements/Hierarchy/Drawer/useHierarchyDrawer.js";import{ListSelection as Dn}from"../../views/List/ListSelection/index.js";import{CollectionListHeader as In}from"../../views/List/ListHeader/index.js";import{GroupByHeader as En}from"../../views/List/GroupByHeader/index.js";import{PageControls as Ln,PageControlsComponent as Rn}from"../../elements/PageControls/index.js";import{GroupByPageControls as Bn}from"../../elements/PageControls/GroupByPageControls.js";import{LoadingOverlayToggle as An}from"../../elements/Loading/index.js";import{FormLoadingOverlayToggle as zn}from"../../elements/Loading/index.js";import{LoadingOverlay as Un}from"../../elements/Loading/index.js";import{Spinner as Yn}from"../../elements/Spinner/index.js";import{Switch as Wn}from"../../elements/Switch/index.js";import{DelayedSpinner as Gn}from"../../elements/DelayedSpinner/index.js";import{Logout as Jn}from"../../elements/Logout/index.js";import{NavToggler as Xn}from"../../elements/Nav/NavToggler/index.js";import{NavSidebarToggle as Zn}from"../../elements/Nav/NavSidebarToggle/index.js";import{NavWrapper as es}from"../../elements/Nav/NavWrapper/index.js";import{SettingsMenuButton as os}from"../../elements/Nav/SettingsMenuButton/index.js";import{DefaultNavClient as as}from"../../elements/Nav/index.client.js";import{SidebarTabsClient as ss}from"../../elements/Nav/SidebarTabs/index.client.js";import{TabError as ls}from"../../elements/Nav/SidebarTabs/TabError/index.js";import{ShouldRenderTabs as ms}from"../../elements/DocumentHeader/Tabs/ShouldRenderTabs.js";import{DocumentTabLink as fs}from"../../elements/DocumentHeader/Tabs/Tab/TabLink.js";import{VersionsPill as us}from"../../elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js";import{Wrapper as hs}from"../../templates/Default/Wrapper/index.js";import{FormHeader as vs}from"../../elements/FormHeader/index.js";import{HierarchyTypeField as ys}from"../../elements/HierarchyTypeField/index.js";import{NoListResults as Cs}from"../../elements/NoListResults/index.js";import{NavContext as Ts,NavProvider as Ds,useNav as Ps}from"../../elements/Nav/context.js";import{NavGroup as Fs}from"../../elements/NavGroup/index.js";import{Pagination as ks}from"../../elements/Pagination/index.js";import{SimplePagination as Rs}from"../../elements/Pagination/SimplePagination/index.js";import{PerPage as Bs}from"../../elements/PerPage/index.js";import{Pill as As}from"../../elements/Pill/index.js";import*as kt from"../../elements/Popup/PopupButtonList/index.js";import{Popup as zs}from"../../elements/Popup/index.js";import{Combobox as Us}from"../../elements/Combobox/index.js";import{CommandPalette as Ys,commandPaletteSlug as Os}from"../../elements/CommandPalette/index.js";import{PublishMany as $s}from"../../elements/PublishMany/index.js";import{PublishButton as Qs}from"../../elements/PublishButton/index.js";import{SaveButton as Ks}from"../../elements/SaveButton/index.js";import{SaveDraftButton as qs}from"../../elements/SaveDraftButton/index.js";import{UnpublishButton as _s}from"../../elements/UnpublishButton/index.js";import{ReactSelect as ti}from"../../elements/ReactSelect/index.js";import{ReactSelect as ri}from"../../elements/ReactSelect/index.js";import{RenderTitle as ni}from"../../elements/RenderTitle/index.js";import{ShimmerEffect as ii}from"../../elements/ShimmerEffect/index.js";import{StaggeredShimmers as di}from"../../elements/ShimmerEffect/index.js";import{SortColumn as ci}from"../../elements/SortColumn/index.js";import{SetStepNav as pi}from"../../elements/StepNav/SetStepNav.js";import{useStepNav as xi}from"../../elements/StepNav/index.js";import{RelationshipProvider as gi,useListRelationships as vi}from"../../elements/Table/RelationshipProvider/index.js";import{Table as yi}from"../../elements/Table/index.js";import{DefaultCell as Ci}from"../../elements/Table/DefaultCell/index.js";import{Thumbnail as Ti}from"../../elements/Thumbnail/index.js";import{ThumbnailCard as Pi}from"../../elements/ThumbnailCard/index.js";import{Tooltip as Fi}from"../../elements/Tooltip/index.js";import r,{forwardRef as Ge,isValidElement as ye}from"react";import Qe from"react-dom";import S from"react";import ke from"react";import rt from"react";var Je=t=>{switch(t){case"success":return qe;case"info":return _e;case"warning":return Ze;case"error":return et;default:return null}},Ke=Array(12).fill(0),Xe=({visible:t,className:o})=>S.createElement("div",{className:["sonner-loading-wrapper",o].filter(Boolean).join(" "),"data-visible":t},S.createElement("div",{className:"sonner-spinner"},Ke.map((a,i)=>S.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),qe=S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},S.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"})),Ze=S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},S.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"})),_e=S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},S.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"})),et=S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},S.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"})),tt=S.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"},S.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),S.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),ot=()=>{let[t,o]=ke.useState(document.hidden);return ke.useEffect(()=>{let a=()=>{o(document.hidden)};return document.addEventListener("visibilitychange",a),()=>window.removeEventListener("visibilitychange",a)},[]),t},we=1,at=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let o=this.subscribers.indexOf(t);this.subscribers.splice(o,1)}),this.publish=t=>{this.subscribers.forEach(o=>o(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var o;let{message:a,...i}=t,u=typeof t?.id=="number"||((o=t.id)==null?void 0:o.length)>0?t.id:we++,y=this.toasts.find(v=>v.id===u),T=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(u)&&this.dismissedToasts.delete(u),y?this.toasts=this.toasts.map(v=>v.id===u?(this.publish({...v,...t,id:u,title:a}),{...v,...t,id:u,dismissible:T,title:a}):v):this.addToast({title:a,...i,dismissible:T,id:u}),u},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(o=>{this.subscribers.forEach(a=>a({id:o.id,dismiss:!0}))}),this.subscribers.forEach(o=>o({id:t,dismiss:!0})),t),this.message=(t,o)=>this.create({...o,message:t}),this.error=(t,o)=>this.create({...o,message:t,type:"error"}),this.success=(t,o)=>this.create({...o,type:"success",message:t}),this.info=(t,o)=>this.create({...o,type:"info",message:t}),this.warning=(t,o)=>this.create({...o,type:"warning",message:t}),this.loading=(t,o)=>this.create({...o,type:"loading",message:t}),this.promise=(t,o)=>{if(!o)return;let a;o.loading!==void 0&&(a=this.create({...o,promise:t,type:"loading",message:o.loading,description:typeof o.description!="function"?o.description:void 0}));let i=t instanceof Promise?t:t(),u=a!==void 0,y,T=i.then(async m=>{if(y=["resolve",m],rt.isValidElement(m))u=!1,this.create({id:a,type:"default",message:m});else if(st(m)&&!m.ok){u=!1;let f=typeof o.error=="function"?await o.error(`HTTP error! status: ${m.status}`):o.error,b=typeof o.description=="function"?await o.description(`HTTP error! status: ${m.status}`):o.description;this.create({id:a,type:"error",message:f,description:b})}else if(o.success!==void 0){u=!1;let f=typeof o.success=="function"?await o.success(m):o.success,b=typeof o.description=="function"?await o.description(m):o.description;this.create({id:a,type:"success",message:f,description:b})}}).catch(async m=>{if(y=["reject",m],o.error!==void 0){u=!1;let f=typeof o.error=="function"?await o.error(m):o.error,b=typeof o.description=="function"?await o.description(m):o.description;this.create({id:a,type:"error",message:f,description:b})}}).finally(()=>{var m;u&&(this.dismiss(a),a=void 0),(m=o.finally)==null||m.call(o)}),v=()=>new Promise((m,f)=>T.then(()=>y[0]==="reject"?f(y[1]):m(y[1])).catch(f));return typeof a!="string"&&typeof a!="number"?{unwrap:v}:Object.assign(a,{unwrap:v})},this.custom=(t,o)=>{let a=o?.id||we++;return this.create({jsx:t(a),id:a,...o}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},C=new at,nt=(t,o)=>{let a=o?.id||we++;return C.addToast({title:t,...o,id:a}),a},st=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",it=nt,lt=()=>C.toasts,dt=()=>C.getActiveToasts(),mt=Object.assign(it,{success:C.success,info:C.info,warning:C.warning,error:C.error,custom:C.custom,message:C.message,promise:C.promise,dismiss:C.dismiss,loading:C.loading},{getHistory:lt,getToasts:dt});function ct(t,{insertAt:o}={}){if(!t||typeof document>"u")return;let a=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",o==="top"&&a.firstChild?a.insertBefore(i,a.firstChild):a.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}ct(`: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;left: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}: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%);--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%)}
14
+ `);function de(t){return t.label!==void 0}var ft=3,pt="32px",ut="16px",Le=4e3,xt=356,ht=14,gt=20,vt=200;function L(...t){return t.filter(Boolean).join(" ")}function bt(t){let[o,a]=t.split("-"),i=[];return o&&i.push(o),a&&i.push(a),i}var yt=t=>{var o,a,i,u,y,T,v,m,f,b,_;let{invert:me,toast:e,unstyled:ce,interacting:g,setHeights:R,visibleToasts:ee,heights:Y,index:M,toasts:fe,expanded:J,removeToast:I,defaultRichColors:K,closeButton:te,style:oe,cancelButtonStyle:pe,actionButtonStyle:re,className:N="",descriptionClassName:ae="",duration:O,position:ne,gap:V,loadingIcon:B,expandByDefault:se,classNames:s,icons:D,closeButtonAriaLabel:ue="Close toast",pauseWhenPageIsHidden:d}=t,[c,x]=r.useState(null),[w,W]=r.useState(null),[h,xe]=r.useState(!1),[X,ie]=r.useState(!1),[q,he]=r.useState(!1),[Ce,Ne]=r.useState(!1),[Be,Se]=r.useState(!1),[Me,ge]=r.useState(0),[Ae,Te]=r.useState(0),Z=r.useRef(e.duration||O||Le),De=r.useRef(null),U=r.useRef(null),He=M===0,ze=M+1<=ee,P=e.type,$=e.dismissible!==!1,Ve=e.className||"",Ue=e.descriptionClassName||"",le=r.useMemo(()=>Y.findIndex(n=>n.toastId===e.id)||0,[Y,e.id]),je=r.useMemo(()=>{var n;return(n=e.closeButton)!=null?n:te},[e.closeButton,te]),Pe=r.useMemo(()=>e.duration||O||Le,[e.duration,O]),ve=r.useRef(0),G=r.useRef(0),Ie=r.useRef(0),Q=r.useRef(null),[Ye,Oe]=ne.split("-"),Fe=r.useMemo(()=>Y.reduce((n,l,p)=>p>=le?n:n+l.height,0),[Y,le]),Ee=ot(),We=e.invert||me,be=P==="loading";G.current=r.useMemo(()=>le*V+Fe,[le,Fe]),r.useEffect(()=>{Z.current=Pe},[Pe]),r.useEffect(()=>{xe(!0)},[]),r.useEffect(()=>{let n=U.current;if(n){let l=n.getBoundingClientRect().height;return Te(l),R(p=>[{toastId:e.id,height:l,position:e.position},...p]),()=>R(p=>p.filter(F=>F.toastId!==e.id))}},[R,e.id]),r.useLayoutEffect(()=>{if(!h)return;let n=U.current,l=n.style.height;n.style.height="auto";let p=n.getBoundingClientRect().height;n.style.height=l,Te(p),R(F=>F.find(E=>E.toastId===e.id)?F.map(E=>E.toastId===e.id?{...E,height:p}:E):[{toastId:e.id,height:p,position:e.position},...F])},[h,e.title,e.description,R,e.id]);let A=r.useCallback(()=>{ie(!0),ge(G.current),R(n=>n.filter(l=>l.toastId!==e.id)),setTimeout(()=>{I(e)},vt)},[e,I,R,G]);r.useEffect(()=>{if(e.promise&&P==="loading"||e.duration===1/0||e.type==="loading")return;let n;return J||g||d&&Ee?(()=>{if(Ie.current<ve.current){let l=new Date().getTime()-ve.current;Z.current=Z.current-l}Ie.current=new Date().getTime()})():Z.current!==1/0&&(ve.current=new Date().getTime(),n=setTimeout(()=>{var l;(l=e.onAutoClose)==null||l.call(e,e),A()},Z.current)),()=>clearTimeout(n)},[J,g,e,P,d,Ee,A]),r.useEffect(()=>{e.delete&&A()},[A,e.delete]);function $e(){var n,l,p;return D!=null&&D.loading?r.createElement("div",{className:L(s?.loader,(n=e?.classNames)==null?void 0:n.loader,"sonner-loader"),"data-visible":P==="loading"},D.loading):B?r.createElement("div",{className:L(s?.loader,(l=e?.classNames)==null?void 0:l.loader,"sonner-loader"),"data-visible":P==="loading"},B):r.createElement(Xe,{className:L(s?.loader,(p=e?.classNames)==null?void 0:p.loader),visible:P==="loading"})}return r.createElement("li",{tabIndex:0,ref:U,className:L(N,Ve,s?.toast,(o=e?.classNames)==null?void 0:o.toast,s?.default,s?.[P],(a=e?.classNames)==null?void 0:a[P]),"data-sonner-toast":"","data-rich-colors":(i=e.richColors)!=null?i:K,"data-styled":!(e.jsx||e.unstyled||ce),"data-mounted":h,"data-promise":!!e.promise,"data-swiped":Be,"data-removed":X,"data-visible":ze,"data-y-position":Ye,"data-x-position":Oe,"data-index":M,"data-front":He,"data-swiping":q,"data-dismissible":$,"data-type":P,"data-invert":We,"data-swipe-out":Ce,"data-swipe-direction":w,"data-expanded":!!(J||se&&h),style:{"--index":M,"--toasts-before":M,"--z-index":fe.length-M,"--offset":`${X?Me:G.current}px`,"--initial-height":se?"auto":`${Ae}px`,...oe,...e.style},onDragEnd:()=>{he(!1),x(null),Q.current=null},onPointerDown:n=>{be||!$||(De.current=new Date,ge(G.current),n.target.setPointerCapture(n.pointerId),n.target.tagName!=="BUTTON"&&(he(!0),Q.current={x:n.clientX,y:n.clientY}))},onPointerUp:()=>{var n,l,p,F;if(Ce||!$)return;Q.current=null;let E=Number(((n=U.current)==null?void 0:n.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),H=Number(((l=U.current)==null?void 0:l.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),j=new Date().getTime()-((p=De.current)==null?void 0:p.getTime()),k=c==="x"?E:H,z=Math.abs(k)/j;if(Math.abs(k)>=gt||z>.11){ge(G.current),(F=e.onDismiss)==null||F.call(e,e),W(c==="x"?E>0?"right":"left":H>0?"down":"up"),A(),Ne(!0),Se(!1);return}he(!1),x(null)},onPointerMove:n=>{var l,p,F,E;if(!Q.current||!$||((l=window.getSelection())==null?void 0:l.toString().length)>0)return;let H=n.clientY-Q.current.y,j=n.clientX-Q.current.x,k=(p=t.swipeDirections)!=null?p:bt(ne);!c&&(Math.abs(j)>1||Math.abs(H)>1)&&x(Math.abs(j)>Math.abs(H)?"x":"y");let z={x:0,y:0};c==="y"?(k.includes("top")||k.includes("bottom"))&&(k.includes("top")&&H<0||k.includes("bottom")&&H>0)&&(z.y=H):c==="x"&&(k.includes("left")||k.includes("right"))&&(k.includes("left")&&j<0||k.includes("right")&&j>0)&&(z.x=j),(Math.abs(z.x)>0||Math.abs(z.y)>0)&&Se(!0),(F=U.current)==null||F.style.setProperty("--swipe-amount-x",`${z.x}px`),(E=U.current)==null||E.style.setProperty("--swipe-amount-y",`${z.y}px`)}},je&&!e.jsx?r.createElement("button",{"aria-label":ue,"data-disabled":be,"data-close-button":!0,onClick:be||!$?()=>{}:()=>{var n;A(),(n=e.onDismiss)==null||n.call(e,e)},className:L(s?.closeButton,(u=e?.classNames)==null?void 0:u.closeButton)},(y=D?.close)!=null?y:tt):null,e.jsx||ye(e.title)?e.jsx?e.jsx:typeof e.title=="function"?e.title():e.title:r.createElement(r.Fragment,null,P||e.icon||e.promise?r.createElement("div",{"data-icon":"",className:L(s?.icon,(T=e?.classNames)==null?void 0:T.icon)},e.promise||e.type==="loading"&&!e.icon?e.icon||$e():null,e.type!=="loading"?e.icon||D?.[P]||Je(P):null):null,r.createElement("div",{"data-content":"",className:L(s?.content,(v=e?.classNames)==null?void 0:v.content)},r.createElement("div",{"data-title":"",className:L(s?.title,(m=e?.classNames)==null?void 0:m.title)},typeof e.title=="function"?e.title():e.title),e.description?r.createElement("div",{"data-description":"",className:L(ae,Ue,s?.description,(f=e?.classNames)==null?void 0:f.description)},typeof e.description=="function"?e.description():e.description):null),ye(e.cancel)?e.cancel:e.cancel&&de(e.cancel)?r.createElement("button",{"data-button":!0,"data-cancel":!0,style:e.cancelButtonStyle||pe,onClick:n=>{var l,p;de(e.cancel)&&$&&((p=(l=e.cancel).onClick)==null||p.call(l,n),A())},className:L(s?.cancelButton,(b=e?.classNames)==null?void 0:b.cancelButton)},e.cancel.label):null,ye(e.action)?e.action:e.action&&de(e.action)?r.createElement("button",{"data-button":!0,"data-action":!0,style:e.actionButtonStyle||re,onClick:n=>{var l,p;de(e.action)&&((p=(l=e.action).onClick)==null||p.call(l,n),!n.defaultPrevented&&A())},className:L(s?.actionButton,(_=e?.classNames)==null?void 0:_.actionButton)},e.action.label):null))};function Re(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function wt(t,o){let a={};return[t,o].forEach((i,u)=>{let y=u===1,T=y?"--mobile-offset":"--offset",v=y?ut:pt;function m(f){["top","right","bottom","left"].forEach(b=>{a[`${T}-${b}`]=typeof f=="number"?`${f}px`:f})}typeof i=="number"||typeof i=="string"?m(i):typeof i=="object"?["top","right","bottom","left"].forEach(f=>{i[f]===void 0?a[`${T}-${f}`]=v:a[`${T}-${f}`]=typeof i[f]=="number"?`${i[f]}px`:i[f]}):m(v)}),a}var It=Ge(function(t,o){let{invert:a,position:i="bottom-right",hotkey:u=["altKey","KeyT"],expand:y,closeButton:T,className:v,offset:m,mobileOffset:f,theme:b="light",richColors:_,duration:me,style:e,visibleToasts:ce=ft,toastOptions:g,dir:R=Re(),gap:ee=ht,loadingIcon:Y,icons:M,containerAriaLabel:fe="Notifications",pauseWhenPageIsHidden:J}=t,[I,K]=r.useState([]),te=r.useMemo(()=>Array.from(new Set([i].concat(I.filter(d=>d.position).map(d=>d.position)))),[I,i]),[oe,pe]=r.useState([]),[re,N]=r.useState(!1),[ae,O]=r.useState(!1),[ne,V]=r.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),B=r.useRef(null),se=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),s=r.useRef(null),D=r.useRef(!1),ue=r.useCallback(d=>{K(c=>{var x;return(x=c.find(w=>w.id===d.id))!=null&&x.delete||C.dismiss(d.id),c.filter(({id:w})=>w!==d.id)})},[]);return r.useEffect(()=>C.subscribe(d=>{if(d.dismiss){K(c=>c.map(x=>x.id===d.id?{...x,delete:!0}:x));return}setTimeout(()=>{Qe.flushSync(()=>{K(c=>{let x=c.findIndex(w=>w.id===d.id);return x!==-1?[...c.slice(0,x),{...c[x],...d},...c.slice(x+1)]:[d,...c]})})})}),[]),r.useEffect(()=>{if(b!=="system"){V(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window>"u")return;let d=window.matchMedia("(prefers-color-scheme: dark)");try{d.addEventListener("change",({matches:c})=>{V(c?"dark":"light")})}catch{d.addListener(({matches:x})=>{try{V(x?"dark":"light")}catch(w){console.error(w)}})}},[b]),r.useEffect(()=>{I.length<=1&&N(!1)},[I]),r.useEffect(()=>{let d=c=>{var x,w;u.every(W=>c[W]||c.code===W)&&(N(!0),(x=B.current)==null||x.focus()),c.code==="Escape"&&(document.activeElement===B.current||(w=B.current)!=null&&w.contains(document.activeElement))&&N(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[u]),r.useEffect(()=>{if(B.current)return()=>{s.current&&(s.current.focus({preventScroll:!0}),s.current=null,D.current=!1)}},[B.current]),r.createElement("section",{ref:o,"aria-label":`${fe} ${se}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},te.map((d,c)=>{var x;let[w,W]=d.split("-");return I.length?r.createElement("ol",{key:d,dir:R==="auto"?Re():R,tabIndex:-1,ref:B,className:v,"data-sonner-toaster":!0,"data-theme":ne,"data-y-position":w,"data-lifted":re&&I.length>1&&!y,"data-x-position":W,style:{"--front-toast-height":`${((x=oe[0])==null?void 0:x.height)||0}px`,"--width":`${xt}px`,"--gap":`${ee}px`,...e,...wt(m,f)},onBlur:h=>{D.current&&!h.currentTarget.contains(h.relatedTarget)&&(D.current=!1,s.current&&(s.current.focus({preventScroll:!0}),s.current=null))},onFocus:h=>{h.target instanceof HTMLElement&&h.target.dataset.dismissible==="false"||D.current||(D.current=!0,s.current=h.relatedTarget)},onMouseEnter:()=>N(!0),onMouseMove:()=>N(!0),onMouseLeave:()=>{ae||N(!1)},onDragEnd:()=>N(!1),onPointerDown:h=>{h.target instanceof HTMLElement&&h.target.dataset.dismissible==="false"||O(!0)},onPointerUp:()=>O(!1)},I.filter(h=>!h.position&&c===0||h.position===d).map((h,xe)=>{var X,ie;return r.createElement(yt,{key:h.id,icons:M,index:xe,toast:h,defaultRichColors:_,duration:(X=g?.duration)!=null?X:me,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:a,visibleToasts:ce,closeButton:(ie=g?.closeButton)!=null?ie:T,interacting:ae,position:d,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,removeToast:ue,toasts:I.filter(q=>q.position==h.position),heights:oe.filter(q=>q.position==h.position),setHeights:pe,expandByDefault:y,gap:ee,loadingIcon:Y,expanded:re,pauseWhenPageIsHidden:J,swipeDirections:t.swipeDirections})})):null}))});import{FieldErrorsToast as ki}from"../../elements/Toasts/fieldErrors.js";import{UnpublishMany as Ri}from"../../elements/UnpublishMany/index.js";import{Upload as Bi}from"../../elements/Upload/index.js";import{UserMenu as Ai}from"../../elements/UserMenu/index.js";import{ListSearchFilter as zi}from"../../elements/Search/ListSearchFilter/index.js";import{SearchInput as Ui}from"../../elements/Search/SearchInput/index.js";import{FilterTrigger as Yi}from"../../elements/FilterTrigger/index.js";import{EditUpload as Wi}from"../../elements/EditUpload/index.js";import{FileDetails as Gi}from"../../elements/FileDetails/index.js";import{PreviewSizes as Ji}from"../../elements/PreviewSizes/index.js";import{PreviewButton as Xi}from"../../elements/PreviewButton/index.js";import{RelationshipTable as Zi}from"../../elements/RelationshipTable/index.js";import{TimezonePicker as el}from"../../elements/TimezonePicker/index.js";import{BlocksDrawer as ol}from"../../fields/Blocks/BlocksDrawer/index.js";import{BlockSelector as al}from"../../fields/Blocks/BlockSelector/index.js";import{SectionTitle as sl}from"../../fields/Blocks/SectionTitle/index.js";import{ItemsDrawer as ll}from"../../elements/ItemsDrawer/index.js";import{HiddenField as ml}from"../../fields/Hidden/index.js";import{NullField as fl}from"../../fields/Null/index.js";import{ArrayField as ul}from"../../fields/Array/index.js";import{BlocksField as hl}from"../../fields/Blocks/index.js";import{CheckboxField as vl,CheckboxInput as bl}from"../../fields/Checkbox/index.js";import{CodeField as wl}from"../../fields/Code/index.js";import{CodeEditor as Sl}from"../../elements/CodeEditor/index.js";import{default as Dl}from"../../elements/CodeEditor/CodeEditor.js";import{CollapsibleField as Il}from"../../fields/Collapsible/index.js";import{ConfirmPasswordField as El}from"../../fields/ConfirmPassword/index.js";import{DateTimeField as Ll}from"../../fields/DateTime/index.js";import{EmailField as Nl}from"../../fields/Email/index.js";import{FieldDescription as Ml}from"../../fields/FieldDescription/index.js";import{FieldError as Hl}from"../../fields/FieldError/index.js";import{FieldLabel as Vl}from"../../fields/FieldLabel/index.js";import{GroupField as jl}from"../../fields/Group/index.js";import{JSONField as Ol}from"../../fields/JSON/index.js";import{NumberField as $l}from"../../fields/Number/index.js";import{PasswordField as Ql}from"../../fields/Password/index.js";import{PointField as Kl}from"../../fields/Point/index.js";import{RadioGroupField as ql}from"../../fields/RadioGroup/index.js";import{RelationshipField as _l,RelationshipInput as ed}from"../../fields/Relationship/index.js";import{RichTextField as od}from"../../fields/RichText/index.js";import{RowField as ad}from"../../fields/Row/index.js";import{formatOptions as sd,SelectField as id,SelectInput as ld}from"../../fields/Select/index.js";import{TabsField as md,TabsProvider as cd}from"../../fields/Tabs/index.js";import{TabComponent as pd}from"../../fields/Tabs/Tab/index.js";import{SlugField as xd}from"../../fields/Slug/index.js";import{TextField as gd,TextInput as vd}from"../../fields/Text/index.js";import{JoinField as yd}from"../../fields/Join/index.js";import{allFieldComponents as Cd}from"../../fields/index.js";import{TextareaField as Td,TextareaInput as Dd}from"../../fields/Textarea/index.js";import{UIField as Id}from"../../fields/UI/index.js";import{UploadField as Ed,UploadInput as kd}from"../../fields/Upload/index.js";import{mergeFieldStyles as Rd}from"../../fields/mergeFieldStyles.js";import{fieldBaseClass as Bd,isFieldRTL as Md}from"../../fields/shared/index.js";import{useAllFormFields as Hd,useDocumentForm as zd,useForm as Vd,useFormBackgroundProcessing as Ud,useFormFields as jd,useFormInitializing as Yd,useFormModified as Od,useFormProcessing as Wd,useFormSubmitted as $d,useWatchForm as Gd}from"../../forms/Form/context.js";import{Form as Jd}from"../../forms/Form/index.js";import{fieldReducer as Xd}from"../../forms/Form/fieldReducer.js";import{NullifyLocaleField as Zd}from"../../forms/NullifyField/index.js";import{RenderFields as em}from"../../forms/RenderFields/index.js";import{RowLabel as om}from"../../forms/RowLabel/index.js";import{RowLabelProvider as am,useRowLabel as nm}from"../../forms/RowLabel/Context/index.js";import{FormSubmit as im}from"../../forms/Submit/index.js";import{WatchChildErrors as dm}from"../../forms/WatchChildErrors/index.js";import{FieldContext as cm,useField as fm}from"../../forms/useField/index.js";import{withCondition as um}from"../../forms/withCondition/index.js";import{WatchCondition as hm}from"../../forms/withCondition/WatchCondition.js";import{Account as vm}from"../../graphics/Account/index.js";import{PayloadIcon as ym}from"../../graphics/Icon/index.js";import{DefaultBlockImage as Cm}from"../../graphics/DefaultBlockImage/index.js";import{File as Tm}from"../../graphics/File/index.js";import{CalendarIcon as Pm}from"../../icons/Calendar/index.js";import{CheckIcon as Fm}from"../../icons/Check/index.js";import{ChevronIcon as km}from"../../icons/Chevron/index.js";import{CloseMenuIcon as Rm}from"../../icons/CloseMenu/index.js";import{CodeBlockIcon as Bm}from"../../icons/CodeBlock/index.js";import{CopyIcon as Am}from"../../icons/Copy/index.js";import{AlignJustifiedIcon as zm,AlignJustifiedIcon as Vm}from"../../icons/AlignJustified/index.js";import{EditIcon as jm}from"../../icons/Edit/index.js";import{ExternalLinkIcon as Om}from"../../icons/ExternalLink/index.js";import{LineIcon as $m}from"../../icons/Line/index.js";import{LinkIcon as Qm}from"../../icons/Link/index.js";import{LogOutIcon as Km}from"../../icons/LogOut/index.js";import{MinimizeMaximizeIcon as qm}from"../../icons/MinimizeMaximize/index.js";import{MoreIcon as _m}from"../../icons/More/index.js";import{PlusIcon as tc}from"../../icons/Plus/index.js";import{SearchIcon as rc}from"../../icons/Search/index.js";import{SwapIcon as nc}from"../../icons/Swap/index.js";import{XIcon as ic}from"../../icons/X/index.js";import{FilterIcon as dc}from"../../icons/Filter/index.js";import{FolderIcon as cc}from"../../icons/Folder/index.js";import{GearIcon as pc}from"../../icons/Gear/index.js";import{DocumentIcon as xc}from"../../icons/Document/index.js";import{MoveFolderIcon as gc}from"../../icons/MoveFolder/index.js";import{GridViewIcon as bc}from"../../icons/GridView/index.js";import{WriteIcon as wc}from"../../icons/Write/index.js";import{AlignJustifiedIcon as Sc}from"../../icons/AlignJustified/index.js";import{ArrowIcon as Dc}from"../../icons/Arrow/index.js";import{CirclePlusIcon as Ic}from"../../icons/CirclePlus/index.js";import{CircledXIcon as Ec}from"../../icons/CircledX/index.js";import{ClipboardIcon as Lc}from"../../icons/Clipboard/index.js";import{Dots as Nc}from"../../icons/Dots/index.js";import{DuplicateIcon as Mc}from"../../icons/Duplicate/index.js";import{EyeIcon as Hc}from"../../icons/Eye/index.js";import{KeyIcon as Vc}from"../../icons/Key/index.js";import{LockIcon as jc}from"../../icons/Lock/index.js";import{LockOpenIcon as Oc}from"../../icons/LockOpen/index.js";import{PeopleIcon as $c}from"../../icons/People/index.js";import{RefreshIcon as Qc}from"../../icons/Refresh/index.js";import{SortDownIcon as Kc}from"../../icons/Sort/index.js";import{ThreeDotsIcon as qc}from"../../icons/ThreeDots/index.js";import{TrashIcon as _c}from"../../icons/Trash/index.js";import{ErrorIcon as tf}from"../../icons/Error/index.js";import{InfoIcon as rf}from"../../icons/Info/index.js";import{InteractionEnterIcon as nf}from"../../icons/InteractionEnter/index.js";import{LanguageIcon as lf}from"../../icons/Language/index.js";import{SuccessIcon as mf}from"../../icons/Success/index.js";import{VariableColorIcon as ff}from"../../icons/VariableColor/index.js";import{WarningIcon as uf}from"../../icons/Warning/index.js";import{WarningTriangleIcon as hf}from"../../icons/WarningTriangle/index.js";import{TagIcon as vf}from"../../icons/Tag/index.js";import{ServerFunctionsContext as yf,ServerFunctionsProvider as wf,useServerFunctions as Cf}from"../../providers/ServerFunctions/index.js";import{ActionsProvider as Tf,useActions as Df}from"../../providers/Actions/index.js";import{AuthProvider as If,useAuth as Ff}from"../../providers/Auth/index.js";import{ClientFunctionProvider as kf,useClientFunctions as Lf}from"../../providers/ClientFunction/index.js";import{useAddClientFunction as Nf}from"../../providers/ClientFunction/index.js";import{LivePreviewProvider as Mf}from"../../providers/LivePreview/index.js";import{ProgressBar as Hf}from"../../providers/RouteTransition/ProgressBar/index.js";import{RouteTransitionProvider as Vf,useRouteTransition as Uf}from"../../providers/RouteTransition/index.js";import{ConfigProvider as Yf,PageConfigProvider as Of,useConfig as Wf}from"../../providers/Config/index.js";import{DocumentEventsProvider as Gf,useDocumentEvents as Qf}from"../../providers/DocumentEvents/index.js";import{DocumentInfoProvider as Kf,useDocumentInfo as Xf}from"../../providers/DocumentInfo/index.js";import{useDocumentTitle as Zf}from"../../providers/DocumentTitle/index.js";import{useUploadControls as ep}from"../../providers/UploadControls/index.js";import{EditDepthProvider as op,useEditDepth as rp}from"../../providers/EditDepth/index.js";import{EntityVisibilityProvider as np,useEntityVisibility as sp}from"../../providers/EntityVisibility/index.js";import{UploadEditsProvider as lp,useUploadEdits as dp}from"../../providers/UploadEdits/index.js";import{ListDrawerContextProvider as cp,useListDrawerContext as fp}from"../../elements/ListDrawer/Provider.js";import{ListQueryProvider as up,useListQuery as xp}from"../../providers/ListQuery/index.js";import{LocaleProvider as gp,useLocale as vp}from"../../providers/Locale/index.js";import{OperationProvider as yp,useOperation as wp}from"../../providers/Operation/index.js";import{PreferencesProvider as Sp,usePreferences as Tp}from"../../providers/Preferences/index.js";import{RootProvider as Pp}from"../../providers/Root/index.js";import{PayloadLink as Fp,RouterAdapterContext as Ep,useParams as kp,usePathname as Lp,useRouter as Rp,useSearchParams as Np}from"../../providers/RouterAdapter/index.js";import{RouteCache as Mp,useRouteCache as Ap}from"../../providers/RouteCache/index.js";import{ScrollInfoProvider as zp,useScrollInfo as Vp}from"../../providers/ScrollInfo/index.js";import{SelectionProvider as jp,useSelection as Yp}from"../../providers/Selection/index.js";import{DocumentSelectionProvider as Wp,useDocumentSelection as $p}from"../../providers/DocumentSelection/index.js";import{HierarchyProvider as Qp,useHierarchy as Jp}from"../../providers/Hierarchy/index.js";import{UploadHandlersProvider as Xp,useUploadHandlers as qp}from"../../providers/UploadHandlers/index.js";import{defaultTheme as _p,ThemeProvider as eu,useTheme as tu}from"../../providers/Theme/index.js";import{TranslationProvider as ru,useTranslation as au}from"../../providers/Translation/index.js";import{useWindowInfo as su,WindowInfoProvider as iu}from"../../providers/WindowInfo/index.js";import{useControllableState as du}from"../../hooks/useControllableState.js";import{Text as cu}from"../../elements/WhereBuilder/Condition/Text/index.js";import{Select as pu}from"../../elements/WhereBuilder/Condition/Select/index.js";import{RelationshipFilter as xu}from"../../elements/WhereBuilder/Condition/Relationship/index.js";import{NumberFilter as gu}from"../../elements/WhereBuilder/Condition/Number/index.js";import{DateFilter as bu}from"../../elements/WhereBuilder/Condition/Date/index.js";import{EmailAndUsernameFields as wu}from"../../elements/EmailAndUsername/index.js";import{SelectAll as Su}from"../../elements/SelectAll/index.js";import{SelectRow as Du}from"../../elements/SelectRow/index.js";import{SelectMany as Iu}from"../../elements/SelectMany/index.js";import{DefaultListView as Eu}from"../../views/List/index.client.js";import{HierarchyListView as Lu}from"../../views/HierarchyList/index.js";import{AccountClient as Nu}from"../../views/Account/index.client.js";import{ResetPreferences as Mu}from"../../views/Account/ResetPreferences/index.js";import{LanguageSelector as Hu}from"../../views/Account/Settings/LanguageSelector.js";import{ToggleHighContrast as Vu}from"../../views/Account/ToggleHighContrast/index.js";import{ToggleTheme as ju}from"../../views/Account/ToggleTheme/index.js";import{APIViewClient as Ou}from"../../views/API/index.client.js";import{CreateFirstUserClient as $u}from"../../views/CreateFirstUser/index.client.js";import{ModularDashboardClient as Qu}from"../../views/Dashboard/Default/ModularDashboard/index.client.js";import{ForgotPasswordForm as Ku}from"../../views/ForgotPassword/ForgotPasswordForm/index.js";import{LoginForm as qu}from"../../views/Login/LoginForm/index.js";import{LogoutClient as _u}from"../../views/Logout/LogoutClient.js";import{NotFoundClient as tx}from"../../views/NotFound/index.client.js";import{ResetPasswordForm as rx}from"../../views/ResetPassword/ResetPasswordForm/index.js";import{ToastAndRedirect as nx,VerifyClient as sx}from"../../views/Verify/index.client.js";import{DefaultVersionView as lx}from"../../views/Version/Default/index.js";import{VersionsViewClient as mx}from"../../views/Versions/index.client.js";import{VersionPillLabel as fx}from"../../views/Versions/VersionPillLabel/VersionPillLabel.js";import{RenderVersionFieldsToDiff as ux}from"../../views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js";import{Checkbox as hx}from"../../views/Version/RenderFieldsToDiff/fields/Checkbox/index.js";import{Collapsible as vx}from"../../views/Version/RenderFieldsToDiff/fields/Collapsible/index.js";import{DateDiffComponent as yx}from"../../views/Version/RenderFieldsToDiff/fields/Date/index.js";import{Group as Cx}from"../../views/Version/RenderFieldsToDiff/fields/Group/index.js";import{Iterable as Tx}from"../../views/Version/RenderFieldsToDiff/fields/Iterable/index.js";import{Row as Px}from"../../views/Version/RenderFieldsToDiff/fields/Row/index.js";import{Select as Fx}from"../../views/Version/RenderFieldsToDiff/fields/Select/index.js";import{Tabs as kx}from"../../views/Version/RenderFieldsToDiff/fields/Tabs/index.js";import{Text as Rx}from"../../views/Version/RenderFieldsToDiff/fields/Text/index.js";import{AutosaveCell as Bx}from"../../views/Versions/cells/AutosaveCell/index.js";import{CreatedAtCell as Ax}from"../../views/Versions/cells/CreatedAt/index.js";import{IDCell as zx}from"../../views/Versions/cells/ID/index.js";import{VersionDrawerCreatedAtCell as Ux}from"../../views/Versions/cells/VersionDrawerCreatedAtCell/index.js";import{DefaultEditView as Yx}from"../../views/Edit/index.js";import{SetDocumentStepNav as Wx}from"../../views/Edit/SetDocumentStepNav/index.js";import{SetDocumentTitle as Gx}from"../../views/Edit/SetDocumentTitle/index.js";import{parseSearchParams as Jx}from"../../utilities/parseSearchParams.js";import{FieldDiffLabel as Xx}from"../../elements/FieldDiffLabel/index.js";import{FieldDiffContainer as Zx}from"../../elements/FieldDiffContainer/index.js";import{formatTimeToNow as e0}from"../../utilities/formatDocTitle/formatDateTitle.js";import{useLivePreviewContext as o0}from"../../providers/LivePreview/context.js";import{LivePreviewWindow as a0}from"../../elements/LivePreview/Window/index.js";export{Lr as APIKeyInput,Ou as APIViewClient,vm as Account,Nu as AccountClient,Hu as AccountLanguageSelector,Mu as AccountResetPreferences,Vu as AccountToggleHighContrast,ju as AccountToggleTheme,Tf as ActionsProvider,zm as AlignJustifiedIcon,jr as AnimateHeight,vr as AppHeader,ul as ArrayField,Dc as ArrowIcon,If as AuthProvider,Nr as Banner,al as BlockSelector,ol as BlocksDrawer,hl as BlocksField,Tr as BulkUploadDrawer,Dr as BulkUploadProvider,Mr as Button,Pm as CalendarIcon,$r as Card,Fm as CheckIcon,vl as CheckboxField,bl as CheckboxInput,km as ChevronIcon,Qr as Chip,Ic as CirclePlusIcon,Ec as CircledXIcon,kf as ClientFunctionProvider,Lc as ClipboardIcon,Rm as CloseMenuIcon,Bm as CodeBlockIcon,Dl as CodeEditor,Sl as CodeEditorLazy,wl as CodeField,Kr as Collapsible,Il as CollapsibleField,Us as Combobox,Ys as CommandPalette,Yf as ConfigProvider,El as ConfirmPasswordField,Ho as ConfirmationModal,Am as CopyIcon,oa as CopyLocaleData,aa as CopyToClipboard,$u as CreateFirstUserClient,lr as DateCell,bu as DateCondition,ur as DatePicker,Ll as DateTimeField,Cm as DefaultBlockImage,Ci as DefaultCell,Yx as DefaultEditView,Eu as DefaultListView,as as DefaultNavClient,hs as DefaultTemplateWrapper,lx as DefaultVersionView,Gn as DelayedSpinner,sa as DeleteMany,Vo as DialogBody,Uo as DialogCancel,jo as DialogConfirm,Yo as DialogFooter,Oo as DialogHeader,Wo as DialogModal,la as DocumentControls,Gf as DocumentEventsProvider,La as DocumentFields,xc as DocumentIcon,Kf as DocumentInfoProvider,er as DocumentLocked,Wp as DocumentSelectionProvider,Zo as DocumentStaleData,fs as DocumentTabLink,Xo as DocumentTakeOver,Nc as Dots,Vm as DragHandleIcon,Ia as DraggableSortable,Ea as DraggableSortableItem,Na as Drawer,Er as DrawerContentContainer,Ba as DrawerToggler,ma as Dropzone,Mc as DuplicateIcon,op as EditDepthProvider,jm as EditIcon,Va as EditMany,Wi as EditUpload,wu as EmailAndUsernameFields,Nl as EmailField,np as EntityVisibilityProvider,tf as ErrorIcon,ja as ErrorPill,Om as ExternalLinkIcon,Hc as EyeIcon,cm as FieldContext,Ml as FieldDescription,Zx as FieldDiffContainer,Xx as FieldDiffLabel,Hl as FieldError,ki as FieldErrorsToast,Vl as FieldLabel,ao as FieldPathContext,Tm as File,Gi as FileDetails,dc as FilterIcon,Yi as FilterTrigger,cc as FolderIcon,Ku as ForgotPasswordForm,Jd as Form,vs as FormHeader,zn as FormLoadingOverlayToggle,im as FormSubmit,Ga as FullscreenModal,pc as GearIcon,Ja as GenerateConfirmation,bc as GridViewIcon,En as GroupByHeader,Bn as GroupByPageControls,jl as GroupField,Xa as Gutter,ml as HiddenField,gn as HierarchyButtonClient,Cn as HierarchyDrawerToggler,bn as HierarchyFieldClient,Lu as HierarchyListView,Qp as HierarchyProvider,ea as HierarchySidebarTab,ys as HierarchyTypeField,en as HydrateAuthProvider,on as HydrateHierarchyProvider,an as IDLabel,rf as InfoIcon,sn as InputStepper,nf as InteractionEnterIcon,ll as ItemsDrawer,Ol as JSONField,yd as JoinField,Vc as KeyIcon,lf as LanguageIcon,Jo as LeaveWithoutSaving,$m as LineIcon,Go as Link,Qm as LinkIcon,cn as ListControls,pn as ListControlsBar,cp as ListDrawerContextProvider,In as ListHeader,up as ListQueryProvider,zi as ListSearchFilter,Dn as ListSelection,Sc as ListViewIcon,Mf as LivePreviewProvider,a0 as LivePreviewWindow,Un as LoadingOverlay,An as LoadingOverlayToggle,gp as LocaleProvider,jc as LockIcon,Oc as LockOpenIcon,dn as Locked,Km as LogOutIcon,qu as LoginForm,Jn as Logout,_u as LogoutClient,yr as MenuSeparator,qm as MinimizeMaximizeIcon,Oa as Modal,Qu as ModularDashboardClient,_m as MoreIcon,gc as MoveFolderIcon,Ts as NavContext,Fs as NavGroup,Ds as NavProvider,Zn as NavSidebarToggle,Xn as NavToggler,es as NavWrapper,Cs as NoListResults,tx as NotFoundClient,fl as NullField,Zd as NullifyLocaleField,gu as NumberCondition,$l as NumberField,yp as OperationProvider,bo as OrderableTable,Of as PageConfigProvider,Ln as PageControls,Rn as PageControlsComponent,ks as Pagination,Ql as PasswordField,ym as PayloadIcon,Fp as PayloadLink,$c as PeopleIcon,Bs as PerPage,As as Pill,Or as PillSelector,tc as PlusIcon,Kl as PointField,zs as Popup,kt as PopupList,Sp as PreferencesProvider,Xi as PreviewButton,Ji as PreviewSizes,Hf as ProgressBar,Qs as PublishButton,$s as PublishMany,Do as QueryPresetsAccessCell,Eo as QueryPresetsColumnField,wo as QueryPresetsColumnsCell,Io as QueryPresetsGroupByCell,No as QueryPresetsGroupByField,Mo as QueryPresetsHeading,So as QueryPresetsWhereCell,Lo as QueryPresetsWhereField,ql as RadioGroupField,ti as ReactSelect,Qc as RefreshIcon,xu as RelationshipCondition,_l as RelationshipField,ed as RelationshipInput,gi as RelationshipProvider,Zi as RelationshipTable,Cr as RenderCustomComponent,nr as RenderDefaultCell,em as RenderFields,ni as RenderTitle,ux as RenderVersionFieldsToDiff,rx as ResetPasswordForm,od as RichTextField,Pp as RootProvider,Mp as RouteCacheProvider,Vf as RouteTransitionProvider,Ep as RouterAdapterContext,ad as RowField,om as RowLabel,am as RowLabelProvider,Ks as SaveButton,qs as SaveDraftButton,zp as ScrollInfoProvider,rc as SearchIcon,Ui as SearchInput,sl as SectionTitle,ri as Select,Su as SelectAll,pu as SelectCondition,id as SelectField,ld as SelectInput,Iu as SelectMany,Du as SelectRow,jp as SelectionProvider,yf as ServerFunctionsContext,wf as ServerFunctionsProvider,Wx as SetDocumentStepNav,Gx as SetDocumentTitle,pi as SetStepNav,os as SettingsMenuButton,ii as ShimmerEffect,ms as ShouldRenderTabs,Zr as SidebarRow,ss as SidebarTabsClient,fo as SidebarTabsProvider,Za as SidebarToggle,Rs as SimplePagination,xd as SlugField,ci as SortColumn,Kc as SortDownIcon,xo as SortHeader,go as SortRow,Yn as Spinner,di as StaggeredShimmers,mf as SuccessIcon,nc as SwapIcon,Wn as Switch,Hr as TabButton,pd as TabComponent,ls as TabError,yi as Table,or as TableColumnsProvider,mr as TableSection,zr as Tabs,md as TabsField,Vr as TabsList,cd as TabsProvider,vf as TagIcon,cu as TextCondition,gd as TextField,vd as TextInput,Td as TextareaField,Dd as TextareaInput,eu as ThemeProvider,qc as ThreeDotsIcon,Ti as Thumbnail,Pi as ThumbnailCard,el as TimezonePicker,nx as ToastAndRedirect,Fi as Tooltip,fr as Translation,ru as TranslationProvider,_c as TrashIcon,Id as UIField,_s as UnpublishButton,Ri as UnpublishMany,Bi as Upload,lp as UploadEditsProvider,Ed as UploadField,Xp as UploadHandlersProvider,kd as UploadInput,Ai as UserMenu,ff as VariableColorIcon,sx as VerifyClient,Ux as VersionDrawerCreatedAtCell,hx as VersionFieldDiffCheckbox,vx as VersionFieldDiffCollapsible,yx as VersionFieldDiffDate,Cx as VersionFieldDiffGroup,Tx as VersionFieldDiffIterable,Px as VersionFieldDiffRow,Fx as VersionFieldDiffSelect,kx as VersionFieldDiffTabs,Rx as VersionFieldDiffText,fx as VersionPillLabel,Bx as VersionsAutosaveCell,Ax as VersionsCreatedAtCell,zx as VersionsIDCell,us as VersionsPill,mx as VersionsViewClient,hr as ViewDescription,uf as WarningIcon,hf as WarningTriangleIcon,dm as WatchChildErrors,hm as WatchCondition,iu as WindowInfoProvider,wc as WriteIcon,ic as XIcon,Cd as allFieldComponents,Os as commandPaletteSlug,_p as defaultTheme,fa as documentDrawerBaseClass,xa as escapeDiffHTML,Bd as fieldBaseClass,Bt as fieldComponents,Xd as fieldReducer,Ma as formatDrawerSlug,wn as formatHierarchyDrawerSlug,sd as formatOptions,e0 as formatTimeToNow,ha as getHTMLDiffComponents,Md as isFieldRTL,Rd as mergeFieldStyles,Jx as parseSearchParams,mt as toast,ga as unescapeDiffHTML,Df as useActions,Nf as useAddClientFunction,Hd as useAllFormFields,Ff as useAuth,Pr as useBulkUpload,Ir as useBulkUploadDrawerSlug,sr as useCellProps,ba as useClickOutside,wa as useClickOutsideContext,Lf as useClientFunctions,Xr as useCollapsible,Wf as useConfig,du as useControllableState,At as useDebounce,zt as useDebouncedCallback,Ut as useDebouncedEffect,Yt as useDelay,Wt as useDelayedRender,pa as useDocumentDrawer,Sa as useDocumentDrawerContext,Qf as useDocumentEvents,zd as useDocumentForm,Xf as useDocumentInfo,$p as useDocumentSelection,Zf as useDocumentTitle,Da as useDraggableSortable,Ha as useDrawerSlug,rp as useEditDepth,oo as useEffectEvent,sp as useEntityVisibility,fm as useField,no as useFieldPath,Vd as useForm,Ud as useFormBackgroundProcessing,jd as useFormFields,Yd as useFormInitializing,Od as useFormModified,Wd as useFormProcessing,$d as useFormSubmitted,Jp as useHierarchy,Sn as useHierarchyDrawer,Gt as useHotkey,Jt as useIntersect,xn as useListDrawer,fp as useListDrawerContext,xp as useListQuery,vi as useListRelationships,o0 as useLivePreviewContext,vp as useLocale,Wa as useModal,Ps as useNav,wp as useOperation,kp as useParams,Lp as usePathname,Xt as usePayloadAPI,Tp as usePreferences,io as useQueue,Zt as useResize,Ap as useRouteCache,Uf as useRouteTransition,Rp as useRouter,nm as useRowLabel,Vp as useScrollInfo,Np as useSearchParams,Yp as useSelection,Cf as useServerFunctions,po as useSidebarTabs,xi as useStepNav,rr as useTableColumns,tu as useTheme,eo as useThrottledEffect,au as useTranslation,ep as useUploadControls,dp as useUploadEdits,qp as useUploadHandlers,mo as useUseTitleField,Gd as useWatchForm,su as useWindowInfo,um as withCondition};
99
15
  //# sourceMappingURL=index.js.map